Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 23 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 24 | "testing" |
| 25 | "time" |
| 26 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 31 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 32 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 33 | ) |
| 34 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 35 | // In below test cases there is done only one retry for E2 messages |
| 36 | // In Helm chart retry count is currently 2 By default. Retry count |
| 37 | // used in test cases is defined in submgr-config.yaml file. |
| 38 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 39 | func TestSuiteSetup(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 40 | // The effect of this call shall endure though the UT suite! |
| 41 | // If this causes any issues, the previous interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 42 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 43 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 44 | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 45 | mainCtrl.InitAllCounterMap() |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 46 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 47 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 48 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 49 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 50 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 51 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 52 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 53 | Counter{cE2StateChangedToUp, 3}, |
| 54 | }) |
| 55 | |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 56 | // Current UT test cases use these ran names |
| 57 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 58 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 59 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 60 | |
| 61 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 62 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 63 | |
| 64 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 65 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 66 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 67 | |
| 68 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | //----------------------------------------------------------------------------- |
| 72 | // TestRESTSubReqAfterE2ConnBreak |
| 73 | // |
| 74 | // stub stub |
| 75 | // +-------+ +---------+ +---------+ |
| 76 | // | xapp | | submgr | | e2term | |
| 77 | // +-------+ +---------+ +---------+ |
| 78 | // | | | |
| 79 | // | [E2 Conn. DOWN] | |
| 80 | // | | | |
| 81 | // | RESTSubReq | | |
| 82 | // |---------------->| | |
| 83 | // | RESTSubFail | | |
| 84 | // |<----------------| | |
| 85 | // | | | |
| 86 | // |
| 87 | //----------------------------------------------------------------------------- |
| 88 | |
| 89 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 90 | |
| 91 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 92 | Counter{cRestSubReqFromXapp, 1}, |
| 93 | Counter{cRestReqRejDueE2Down, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 94 | Counter{cE2StateChangedToDown, 1}, |
| 95 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 96 | }) |
| 97 | |
| 98 | // E2 disconnect after E2term has received response |
| 99 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 100 | // Req |
| 101 | const subReqCount int = 1 |
| 102 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 103 | xappConn1.SendRESTSubsReq(t, params) |
| 104 | |
| 105 | // Restore E2 connection for following test cases |
| 106 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 107 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 108 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 109 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | //----------------------------------------------------------------------------- |
| 113 | // TestRESTSubReqE2ConnBreak |
| 114 | // |
| 115 | // stub stub |
| 116 | // +-------+ +---------+ +---------+ |
| 117 | // | xapp | | submgr | | e2term | |
| 118 | // +-------+ +---------+ +---------+ |
| 119 | // | | | |
| 120 | // | RESTSubReq | | |
| 121 | // |---------------->| | |
| 122 | // | RESTSubResp | | |
| 123 | // |<----------------| | |
| 124 | // | | SubReq | |
| 125 | // | |------------->| |
| 126 | // | | SubResp | |
| 127 | // | |<-------------| |
| 128 | // | | | |
| 129 | // | [E2 Conn. DOWN] | |
| 130 | // | [Int. SUBS DELETE] | |
| 131 | // | | | |
| 132 | // | RESTNotif(unsuccessful) | |
| 133 | // |<----------------| | |
| 134 | // | | | |
| 135 | // | | | |
| 136 | // |
| 137 | //----------------------------------------------------------------------------- |
| 138 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 139 | |
| 140 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 141 | Counter{cRestSubReqFromXapp, 1}, |
| 142 | Counter{cRestSubRespToXapp, 1}, |
| 143 | Counter{cSubReqToE2, 1}, |
| 144 | Counter{cSubRespFromE2, 1}, |
| 145 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 146 | Counter{cE2StateChangedToDown, 1}, |
| 147 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 148 | }) |
| 149 | |
| 150 | // Req |
| 151 | const subReqCount int = 1 |
| 152 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 153 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 154 | |
| 155 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 156 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 157 | |
| 158 | // E2 disconnect after E2term has received response |
| 159 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 160 | |
| 161 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 162 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 163 | |
| 164 | <-time.After(time.Second * 1) |
| 165 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 166 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 167 | |
| 168 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 169 | if err != nil { |
| 170 | xapp.Logger.Error("%v", err) |
| 171 | } else { |
| 172 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 173 | assert.Equal(t, 0, len(register)) |
| 174 | } |
| 175 | |
| 176 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 177 | if err != nil { |
| 178 | xapp.Logger.Error("%v", err) |
| 179 | } else { |
| 180 | assert.Equal(t, 0, len(restSubscriptions)) |
| 181 | } |
| 182 | |
| 183 | // Restore E2 connection for following test cases |
| 184 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 185 | |
| 186 | // Wait that subs is cleaned |
| 187 | waitSubsCleanup(t, e2SubsId, 10) |
| 188 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 189 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | //----------------------------------------------------------------------------- |
| 193 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 194 | // |
| 195 | // stub stub |
| 196 | // +-------+ +---------+ +---------+ |
| 197 | // | xapp | | submgr | | e2term | |
| 198 | // +-------+ +---------+ +---------+ |
| 199 | // | | | |
| 200 | // | [SUBS CREATE] | |
| 201 | // | | | |
| 202 | // | [E2 Conn. DOWN] | |
| 203 | // | | | |
| 204 | // | RESTSubDelReq | | |
| 205 | // |---------------->| | |
| 206 | // | | | |
| 207 | // | RESTSubDelResp | | |
| 208 | // |<----------------| | |
| 209 | // | | | |
| 210 | // | [No valid subscription found] | |
| 211 | // | | | |
| 212 | // |
| 213 | //----------------------------------------------------------------------------- |
| 214 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 215 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 216 | |
| 217 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 218 | Counter{cRestSubReqFromXapp, 1}, |
| 219 | Counter{cRestSubRespToXapp, 1}, |
| 220 | Counter{cSubReqToE2, 1}, |
| 221 | Counter{cSubRespFromE2, 1}, |
| 222 | Counter{cRestSubNotifToXapp, 1}, |
| 223 | Counter{cRestSubDelReqFromXapp, 1}, |
| 224 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 225 | Counter{cE2StateChangedToDown, 1}, |
| 226 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 227 | }) |
| 228 | |
| 229 | // Req |
| 230 | var params *teststube2ap.RESTSubsReqParams = nil |
| 231 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 232 | |
| 233 | // E2 disconnect after E2term has received response |
| 234 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 235 | |
| 236 | // Del |
| 237 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 238 | |
| 239 | <-time.After(time.Second * 1) |
| 240 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 241 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 242 | |
| 243 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 244 | if err != nil { |
| 245 | xapp.Logger.Error("%v", err) |
| 246 | } else { |
| 247 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 248 | assert.Equal(t, 0, len(register)) |
| 249 | } |
| 250 | |
| 251 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 252 | if err != nil { |
| 253 | xapp.Logger.Error("%v", err) |
| 254 | } else { |
| 255 | assert.Equal(t, 0, len(restSubscriptions)) |
| 256 | } |
| 257 | |
| 258 | // Restore E2 connection for following test cases |
| 259 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 260 | |
| 261 | // Wait that subs is cleaned |
| 262 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 263 | |
| 264 | xappConn1.TestMsgChanEmpty(t) |
| 265 | e2termConn1.TestMsgChanEmpty(t) |
| 266 | mainCtrl.wait_registry_empty(t, 10) |
| 267 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 268 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | //----------------------------------------------------------------------------- |
| 272 | // TestRESTOtherE2ConnectionChanges |
| 273 | // |
| 274 | |
| 275 | // stub stub |
| 276 | // +-------+ +---------+ +---------+ |
| 277 | // | xapp | | submgr | | e2term | |
| 278 | // +-------+ +---------+ +---------+ |
| 279 | // | | | |
| 280 | // | [SUBS CREATE] | |
| 281 | // | | | |
| 282 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 283 | // | [E2 CONNECTING] | |
| 284 | // | [E2 SHUTTING_DOWN] | |
| 285 | // | [E2 SHUT_DOWN] | |
| 286 | // | | | |
| 287 | // | [SUBS DELETE] | |
| 288 | // | | | |
| 289 | // |
| 290 | //----------------------------------------------------------------------------- |
| 291 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 292 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 293 | |
| 294 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 295 | Counter{cRestSubReqFromXapp, 1}, |
| 296 | Counter{cRestSubRespToXapp, 1}, |
| 297 | Counter{cSubReqToE2, 1}, |
| 298 | Counter{cSubRespFromE2, 1}, |
| 299 | Counter{cRestSubNotifToXapp, 1}, |
| 300 | Counter{cRestSubDelReqFromXapp, 1}, |
| 301 | Counter{cSubDelReqToE2, 1}, |
| 302 | Counter{cSubDelRespFromE2, 1}, |
| 303 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 304 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 305 | }) |
| 306 | |
| 307 | // Req |
| 308 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 309 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 310 | |
| 311 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 312 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 313 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 314 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 315 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 316 | // Submgr should not react to any other connection state changes than CONNECTED and DISCONNECTED |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 317 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 318 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 319 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 320 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 321 | |
| 322 | // Del |
| 323 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 324 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 325 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 326 | |
| 327 | // Restore E2 connection for following test cases |
| 328 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 329 | |
| 330 | // Wait that subs is cleaned |
| 331 | waitSubsCleanup(t, e2SubsId, 10) |
| 332 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 333 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 334 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 335 | |
| 336 | //----------------------------------------------------------------------------- |
| 337 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 338 | // |
| 339 | // stub stub stub |
| 340 | // +-------+ +---------+ +---------+ +---------+ |
| 341 | // | xapp | | submgr | | e2term | | rtmgr | |
| 342 | // +-------+ +---------+ +---------+ +---------+ |
| 343 | // | | | | |
| 344 | // | RESTSubReq | | | |
| 345 | // |---------------->| | | |
| 346 | // | | RouteCreate | | |
| 347 | // | |--------------------------->| // The order of these events may vary |
| 348 | // | | | | |
| 349 | // | RESTSubResp | | | // The order of these events may vary |
| 350 | // |<----------------| | | |
| 351 | // | | RouteResponse| | |
| 352 | // | |<---------------------------| // The order of these events may vary |
| 353 | // | | | | |
| 354 | // | | SubReq | | |
| 355 | // | |------------->| | // The order of these events may vary |
| 356 | // | | | | |
| 357 | // | | SubResp | | |
| 358 | // | |<-------------| | |
| 359 | // | RESTNotif1 | | | |
| 360 | // |<----------------| | | |
| 361 | // | | | | |
| 362 | // | RESTSubDelReq | | | |
| 363 | // |---------------->| | | |
| 364 | // | | SubDelReq | | |
| 365 | // | |------------->| | |
| 366 | // | | | | |
| 367 | // | RESTSubDelResp| | | |
| 368 | // |<----------------| | | |
| 369 | // | | | | |
| 370 | // | | SubDelResp | | |
| 371 | // | |<-------------| | |
| 372 | // | | | | |
| 373 | // | | | | |
| 374 | // |
| 375 | //----------------------------------------------------------------------------- |
| 376 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 377 | |
| 378 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 379 | |
| 380 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 381 | |
| 382 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 383 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 384 | } |
| 385 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 386 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 387 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 388 | // |
| 389 | // stub stub stub |
| 390 | // +-------+ +---------+ +---------+ +---------+ |
| 391 | // | xapp | | submgr | | e2term | | rtmgr | |
| 392 | // +-------+ +---------+ +---------+ +---------+ |
| 393 | // | | | | |
| 394 | // | RESTSubReq | | | |
| 395 | // |---------------->| | | |
| 396 | // | | RouteCreate | | |
| 397 | // | |--------------------------->| // The order of these events may vary |
| 398 | // | | | | |
| 399 | // | RESTSubResp | | | // The order of these events may vary |
| 400 | // |<----------------| | | |
| 401 | // | | RouteResponse| | |
| 402 | // | |<---------------------------| // The order of these events may vary |
| 403 | // | | | | |
| 404 | // | | SubReq | | |
| 405 | // | |------------->| | // The order of these events may vary |
| 406 | // | | | | |
| 407 | // | | SubResp | | |
| 408 | // | |<-------------| | |
| 409 | // | RESTNotif1 | | | |
| 410 | // |<----------------| | | |
| 411 | // | | | | |
| 412 | // | RESTSubDelReq | | | |
| 413 | // |---------------->| | | |
| 414 | // | | | | |
| 415 | // | RESTSubDelResp| | | |
| 416 | // |<----------------| | | |
| 417 | // | | | | |
| 418 | // | | | | |
| 419 | // |
| 420 | //----------------------------------------------------------------------------- |
| 421 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 422 | |
| 423 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 424 | |
| 425 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 426 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 427 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 428 | |
| 429 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 430 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | //----------------------------------------------------------------------------- |
| 434 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 435 | // |
| 436 | // stub stub stub |
| 437 | // +-------+ +---------+ +---------+ +---------+ |
| 438 | // | xapp | | submgr | | e2term | | rtmgr | |
| 439 | // +-------+ +---------+ +---------+ +---------+ |
| 440 | // | | | | |
| 441 | // | RESTSubReq | | | |
| 442 | // |---------------->| | | |
| 443 | // | | RouteCreate | | |
| 444 | // | |--------------------------->| // The order of these events may vary |
| 445 | // | | | | |
| 446 | // | RESTSubResp | | | // The order of these events may vary |
| 447 | // |<----------------| | | |
| 448 | // | | RouteResponse| | |
| 449 | // | |<---------------------------| // The order of these events may vary |
| 450 | // | | | | |
| 451 | // | | SubReq | | |
| 452 | // | |------------->| | // The order of these events may vary |
| 453 | // | | | | |
| 454 | // | | SubResp | | |
| 455 | // | |<-------------| | |
| 456 | // | RESTNotif1 | | | |
| 457 | // |<----------------| | | |
| 458 | // | | | | |
| 459 | // | RESTSubDelReq | | | |
| 460 | // |---------------->| | | |
| 461 | // | | SubDelReq | | |
| 462 | // | |------------->| | |
| 463 | // | | | | |
| 464 | // | RESTSubDelResp| | | |
| 465 | // |<----------------| | | // The order of these events may vary |
| 466 | // | | | | |
| 467 | // | | SubDelResp | | |
| 468 | // | |<-------------| | // 1.st NOK |
| 469 | // | | | | |
| 470 | // | | SubDelReq | | |
| 471 | // | |------------->| | |
| 472 | // | | | | |
| 473 | // | | SubDelResp | | |
| 474 | // | |<-------------| | // 2.nd NOK |
| 475 | // |
| 476 | //----------------------------------------------------------------------------- |
| 477 | |
| 478 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 479 | |
| 480 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 481 | |
| 482 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 483 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 484 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 485 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 486 | |
| 487 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 488 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 489 | |
| 490 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 491 | |
| 492 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 493 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 494 | } |
| 495 | |
| 496 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 497 | // TestSubReqAndRouteNok |
| 498 | // |
| 499 | // stub stub |
| 500 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 501 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 502 | // +-------+ +---------+ +---------+ |
| 503 | // | | | |
| 504 | // | SubReq | | |
| 505 | // |------------->| | |
| 506 | // | | | |
| 507 | // | | RouteCreate | |
| 508 | // | |------------->| |
| 509 | // | | | |
| 510 | // | | RouteCreate | |
| 511 | // | | status:400 | |
| 512 | // | |<-------------| |
| 513 | // | | | |
| 514 | // | [SUBS INT DELETE] | |
| 515 | // | | | |
| 516 | // |
| 517 | //----------------------------------------------------------------------------- |
| 518 | |
| 519 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 520 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 521 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 522 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 523 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 524 | Counter{cSubReqFromXapp, 1}, |
| 525 | Counter{cRouteCreateFail, 1}, |
| 526 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 527 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 528 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 529 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 530 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 531 | waiter.WaitResult(t) |
| 532 | |
| 533 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 534 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 535 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 536 | xappConn1.TestMsgChanEmpty(t) |
| 537 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 538 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 539 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 540 | |
| 541 | <-time.After(1 * time.Second) |
| 542 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 546 | // TestSubReqAndRouteUpdateNok |
| 547 | |
| 548 | // stub stub |
| 549 | // +-------+ +-------+ +---------+ +---------+ |
| 550 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 551 | // +-------+ +-------+ +---------+ +---------+ |
| 552 | // | | | | |
| 553 | // | [SUBS CREATE] | | |
| 554 | // | | | | |
| 555 | // | | | | |
| 556 | // | | | | |
| 557 | // | SubReq (mergeable) | | |
| 558 | // |--------------------------->| | | |
| 559 | // | | | | |
| 560 | // | | | RouteUpdate | |
| 561 | // | | |------------->| |
| 562 | // | | | | |
| 563 | // | | | RouteUpdate | |
| 564 | // | | | status:400 | |
| 565 | // | | |<-------------| |
| 566 | // | | | | |
| 567 | // | [SUBS INT DELETE] | | |
| 568 | // | | | | |
| 569 | // | | | | |
| 570 | // | [SUBS DELETE] | | |
| 571 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 572 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 573 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 574 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 575 | |
| 576 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 577 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 578 | Counter{cSubReqFromXapp, 2}, |
| 579 | Counter{cSubReqToE2, 1}, |
| 580 | Counter{cSubRespFromE2, 1}, |
| 581 | Counter{cSubRespToXapp, 1}, |
| 582 | Counter{cRouteCreateUpdateFail, 1}, |
| 583 | Counter{cSubDelReqFromXapp, 1}, |
| 584 | Counter{cSubDelReqToE2, 1}, |
| 585 | Counter{cSubDelRespFromE2, 1}, |
| 586 | Counter{cSubDelRespToXapp, 1}, |
| 587 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 588 | |
| 589 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 590 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 591 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 592 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 593 | |
| 594 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 595 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 596 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 597 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 598 | |
| 599 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 600 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 601 | xappConn2.SendSubsReq(t, nil, nil) |
| 602 | waiter.WaitResult(t) |
| 603 | |
| 604 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 605 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 606 | |
| 607 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 608 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 609 | |
| 610 | //Wait that subs is cleaned |
| 611 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 612 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 613 | |
| 614 | xappConn1.TestMsgChanEmpty(t) |
| 615 | xappConn2.TestMsgChanEmpty(t) |
| 616 | e2termConn1.TestMsgChanEmpty(t) |
| 617 | mainCtrl.wait_registry_empty(t, 10) |
| 618 | |
| 619 | mainCtrl.VerifyCounterValues(t) |
| 620 | } |
| 621 | |
| 622 | //----------------------------------------------------------------------------- |
| 623 | // TestSubDelReqAndRouteDeleteNok |
| 624 | // |
| 625 | // stub stub |
| 626 | // +-------+ +---------+ +---------+ +---------+ |
| 627 | // | xapp | | submgr | | e2term | | rtmgr | |
| 628 | // +-------+ +---------+ +---------+ +---------+ |
| 629 | // | | | | |
| 630 | // | [SUBS CREATE] | | |
| 631 | // | | | | |
| 632 | // | | | | |
| 633 | // | | | | |
| 634 | // | SubDelReq | | | |
| 635 | // |------------->| | | |
| 636 | // | | SubDelReq | | |
| 637 | // | |------------->| | |
| 638 | // | | SubDelRsp | | |
| 639 | // | |<-------------| | |
| 640 | // | SubDelRsp | | | |
| 641 | // |<-------------| | | |
| 642 | // | | RouteDelete | | |
| 643 | // | |---------------------------->| |
| 644 | // | | | | |
| 645 | // | | RouteDelete | | |
| 646 | // | | status:400 | | |
| 647 | // | |<----------------------------| |
| 648 | // | | | | |
| 649 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 650 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 651 | |
| 652 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 653 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 654 | Counter{cSubReqFromXapp, 1}, |
| 655 | Counter{cSubReqToE2, 1}, |
| 656 | Counter{cSubRespFromE2, 1}, |
| 657 | Counter{cSubRespToXapp, 1}, |
| 658 | Counter{cSubDelReqFromXapp, 1}, |
| 659 | Counter{cRouteDeleteFail, 1}, |
| 660 | Counter{cSubDelReqToE2, 1}, |
| 661 | Counter{cSubDelRespFromE2, 1}, |
| 662 | Counter{cSubDelRespToXapp, 1}, |
| 663 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 664 | |
| 665 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 666 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 667 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 668 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 669 | |
| 670 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 671 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 672 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 673 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 674 | |
| 675 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 676 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 677 | |
| 678 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 679 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 680 | waiter.WaitResult(t) |
| 681 | |
| 682 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 683 | |
| 684 | //Wait that subs is cleaned |
| 685 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 686 | |
| 687 | xappConn1.TestMsgChanEmpty(t) |
| 688 | xappConn2.TestMsgChanEmpty(t) |
| 689 | e2termConn1.TestMsgChanEmpty(t) |
| 690 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 691 | mainCtrl.VerifyCounterValues(t) |
| 692 | } |
| 693 | |
| 694 | //----------------------------------------------------------------------------- |
| 695 | // TestSubMergeDelAndRouteUpdateNok |
| 696 | // stub stub |
| 697 | // +-------+ +-------+ +---------+ +---------+ |
| 698 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 699 | // +-------+ +-------+ +---------+ +---------+ |
| 700 | // | | | | |
| 701 | // | | | | |
| 702 | // | | | | |
| 703 | // | | SubReq1 | | |
| 704 | // | |------------->| | |
| 705 | // | | | | |
| 706 | // | | | SubReq1 | |
| 707 | // | | |------------->| |
| 708 | // | | | SubResp1 | |
| 709 | // | | |<-------------| |
| 710 | // | | SubResp1 | | |
| 711 | // | |<-------------| | |
| 712 | // | | | | |
| 713 | // | SubReq2 | | |
| 714 | // |--------------------------->| | |
| 715 | // | | | | |
| 716 | // | SubResp2 | | |
| 717 | // |<---------------------------| | |
| 718 | // | | | | |
| 719 | // | | SubDelReq 1 | | |
| 720 | // | |------------->| | |
| 721 | // | | | RouteUpdate | |
| 722 | // | | |-----> rtmgr | |
| 723 | // | | | | |
| 724 | // | | | RouteUpdate | |
| 725 | // | | | status:400 | |
| 726 | // | | |<----- rtmgr | |
| 727 | // | | | | |
| 728 | // | | SubDelResp 1 | | |
| 729 | // | |<-------------| | |
| 730 | // | | | | |
| 731 | // | SubDelReq 2 | | |
| 732 | // |--------------------------->| | |
| 733 | // | | | | |
| 734 | // | | | SubDelReq 2 | |
| 735 | // | | |------------->| |
| 736 | // | | | | |
| 737 | // | | | SubDelReq 2 | |
| 738 | // | | |------------->| |
| 739 | // | | | | |
| 740 | // | SubDelResp 2 | | |
| 741 | // |<---------------------------| | |
| 742 | // |
| 743 | //----------------------------------------------------------------------------- |
| 744 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 745 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 746 | |
| 747 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 748 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 749 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 750 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 751 | Counter{cSubReqToE2, 1}, |
| 752 | Counter{cSubRespFromE2, 1}, |
| 753 | Counter{cSubRespToXapp, 2}, |
| 754 | Counter{cSubDelReqFromXapp, 2}, |
| 755 | Counter{cRouteDeleteUpdateFail, 1}, |
| 756 | Counter{cSubDelReqToE2, 1}, |
| 757 | Counter{cSubDelRespFromE2, 1}, |
| 758 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 759 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 760 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 761 | |
| 762 | //Req1 |
| 763 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 764 | rparams1.Init() |
| 765 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 766 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 767 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 768 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 769 | |
| 770 | //Req2 |
| 771 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 772 | rparams2.Init() |
| 773 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 774 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 775 | |
| 776 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 777 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 778 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 779 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 780 | |
| 781 | //Del1 |
| 782 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 783 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 784 | waiter.WaitResult(t) |
| 785 | |
| 786 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 787 | |
| 788 | //Del2 |
| 789 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 790 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 791 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 792 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 793 | //Wait that subs is cleaned |
| 794 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 795 | |
| 796 | xappConn1.TestMsgChanEmpty(t) |
| 797 | xappConn2.TestMsgChanEmpty(t) |
| 798 | e2termConn1.TestMsgChanEmpty(t) |
| 799 | mainCtrl.wait_registry_empty(t, 10) |
| 800 | |
| 801 | mainCtrl.VerifyCounterValues(t) |
| 802 | } |
| 803 | |
| 804 | //----------------------------------------------------------------------------- |
| 805 | |
| 806 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 807 | // TestSubReqAndSubDelOk |
| 808 | // |
| 809 | // stub stub |
| 810 | // +-------+ +---------+ +---------+ |
| 811 | // | xapp | | submgr | | e2term | |
| 812 | // +-------+ +---------+ +---------+ |
| 813 | // | | | |
| 814 | // | SubReq | | |
| 815 | // |------------->| | |
| 816 | // | | | |
| 817 | // | | SubReq | |
| 818 | // | |------------->| |
| 819 | // | | | |
| 820 | // | | SubResp | |
| 821 | // | |<-------------| |
| 822 | // | | | |
| 823 | // | SubResp | | |
| 824 | // |<-------------| | |
| 825 | // | | | |
| 826 | // | | | |
| 827 | // | SubDelReq | | |
| 828 | // |------------->| | |
| 829 | // | | | |
| 830 | // | | SubDelReq | |
| 831 | // | |------------->| |
| 832 | // | | | |
| 833 | // | | SubDelResp | |
| 834 | // | |<-------------| |
| 835 | // | | | |
| 836 | // | SubDelResp | | |
| 837 | // |<-------------| | |
| 838 | // |
| 839 | //----------------------------------------------------------------------------- |
| 840 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 841 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 842 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 843 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 844 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 845 | Counter{cSubReqFromXapp, 1}, |
| 846 | Counter{cSubReqToE2, 1}, |
| 847 | Counter{cSubRespFromE2, 1}, |
| 848 | Counter{cSubRespToXapp, 1}, |
| 849 | Counter{cSubDelReqFromXapp, 1}, |
| 850 | Counter{cSubDelReqToE2, 1}, |
| 851 | Counter{cSubDelRespFromE2, 1}, |
| 852 | Counter{cSubDelRespToXapp, 1}, |
| 853 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 854 | |
| 855 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 856 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 857 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 858 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 859 | |
| 860 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 861 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 862 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 863 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 864 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 865 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 866 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 867 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 868 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 869 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 870 | |
| 871 | //Wait that subs is cleaned |
| 872 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 873 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 874 | xappConn1.TestMsgChanEmpty(t) |
| 875 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 876 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 877 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 878 | |
| 879 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 880 | } |
| 881 | |
| 882 | //----------------------------------------------------------------------------- |
| 883 | // TestSubReqRetransmission |
| 884 | // |
| 885 | // stub stub |
| 886 | // +-------+ +---------+ +---------+ |
| 887 | // | xapp | | submgr | | e2term | |
| 888 | // +-------+ +---------+ +---------+ |
| 889 | // | | | |
| 890 | // | SubReq | | |
| 891 | // |------------->| | |
| 892 | // | | | |
| 893 | // | | SubReq | |
| 894 | // | |------------->| |
| 895 | // | | | |
| 896 | // | SubReq | | |
| 897 | // | (retrans) | | |
| 898 | // |------------->| | |
| 899 | // | | | |
| 900 | // | | SubResp | |
| 901 | // | |<-------------| |
| 902 | // | | | |
| 903 | // | SubResp | | |
| 904 | // |<-------------| | |
| 905 | // | | | |
| 906 | // | [SUBS DELETE] | |
| 907 | // | | | |
| 908 | // |
| 909 | //----------------------------------------------------------------------------- |
| 910 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 911 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 912 | |
| 913 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 914 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 915 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 916 | |
| 917 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 918 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 919 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 920 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 921 | // hack as there is no real way to see has message be handled. |
| 922 | // Previuos counter check just tells that is has been received by submgr |
| 923 | // --> artificial delay |
| 924 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 925 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 926 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 927 | |
| 928 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 929 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 930 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 931 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 932 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 933 | |
| 934 | //Wait that subs is cleaned |
| 935 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 936 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 937 | xappConn1.TestMsgChanEmpty(t) |
| 938 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 939 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 940 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 941 | } |
| 942 | |
| 943 | //----------------------------------------------------------------------------- |
| 944 | // TestSubDelReqRetransmission |
| 945 | // |
| 946 | // stub stub |
| 947 | // +-------+ +---------+ +---------+ |
| 948 | // | xapp | | submgr | | e2term | |
| 949 | // +-------+ +---------+ +---------+ |
| 950 | // | | | |
| 951 | // | [SUBS CREATE] | |
| 952 | // | | | |
| 953 | // | | | |
| 954 | // | SubDelReq | | |
| 955 | // |------------->| | |
| 956 | // | | | |
| 957 | // | | SubDelReq | |
| 958 | // | |------------->| |
| 959 | // | | | |
| 960 | // | SubDelReq | | |
| 961 | // | (same sub) | | |
| 962 | // | (same xid) | | |
| 963 | // |------------->| | |
| 964 | // | | | |
| 965 | // | | SubDelResp | |
| 966 | // | |<-------------| |
| 967 | // | | | |
| 968 | // | SubDelResp | | |
| 969 | // |<-------------| | |
| 970 | // |
| 971 | //----------------------------------------------------------------------------- |
| 972 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 973 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 974 | |
| 975 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 976 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 977 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 978 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 979 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 980 | |
| 981 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 982 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 983 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 984 | |
| 985 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 986 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 987 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 988 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 989 | // hack as there is no real way to see has message be handled. |
| 990 | // Previuos counter check just tells that is has been received by submgr |
| 991 | // --> artificial delay |
| 992 | <-time.After(1 * time.Second) |
| 993 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 994 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 995 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 996 | |
| 997 | //Wait that subs is cleaned |
| 998 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 999 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1000 | xappConn1.TestMsgChanEmpty(t) |
| 1001 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1002 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1003 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1004 | } |
| 1005 | |
| 1006 | //----------------------------------------------------------------------------- |
| 1007 | // TestSubDelReqCollision |
| 1008 | // |
| 1009 | // stub stub |
| 1010 | // +-------+ +---------+ +---------+ |
| 1011 | // | xapp | | submgr | | e2term | |
| 1012 | // +-------+ +---------+ +---------+ |
| 1013 | // | | | |
| 1014 | // | [SUBS CREATE] | |
| 1015 | // | | | |
| 1016 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1017 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1018 | // |------------->| | |
| 1019 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1020 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1021 | // | |------------->| |
| 1022 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1023 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1024 | // | (same sub) | | |
| 1025 | // | (diff xid) | | |
| 1026 | // |------------->| | |
| 1027 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1028 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1029 | // | |<-------------| |
| 1030 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1031 | // | SubDelResp 1 | | |
| 1032 | // |<-------------| | |
| 1033 | // | | | |
| 1034 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1035 | // |<-------------| | |
| 1036 | // |
| 1037 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1038 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1039 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1040 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1041 | |
| 1042 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1043 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1044 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1045 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1046 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1047 | |
| 1048 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1049 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1050 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1051 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1052 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1053 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1054 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1055 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1056 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1057 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1058 | // hack as there is no real way to see has message be handled. |
| 1059 | // Previuos counter check just tells that is has been received by submgr |
| 1060 | // --> artificial delay |
| 1061 | <-time.After(1 * time.Second) |
| 1062 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1063 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1064 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1065 | |
| 1066 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1067 | xappConn1.RecvSubsDelResp(t, nil) |
| 1068 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1069 | |
| 1070 | //Wait that subs is cleaned |
| 1071 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1072 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1073 | xappConn1.TestMsgChanEmpty(t) |
| 1074 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1075 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1076 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1077 | } |
| 1078 | |
| 1079 | //----------------------------------------------------------------------------- |
| 1080 | // TestSubReqAndSubDelOkTwoParallel |
| 1081 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1082 | // stub stub stub |
| 1083 | // +-------+ +-------+ +---------+ +---------+ |
| 1084 | // | xapp | | xapp | | submgr | | e2term | |
| 1085 | // +-------+ +-------+ +---------+ +---------+ |
| 1086 | // | | | | |
| 1087 | // | | | | |
| 1088 | // | | | | |
| 1089 | // | | SubReq1 | | |
| 1090 | // | |------------->| | |
| 1091 | // | | | | |
| 1092 | // | | | SubReq1 | |
| 1093 | // | | |------------->| |
| 1094 | // | | | | |
| 1095 | // | SubReq2 | | |
| 1096 | // |------------------------>| | |
| 1097 | // | | | | |
| 1098 | // | | | SubReq2 | |
| 1099 | // | | |------------->| |
| 1100 | // | | | | |
| 1101 | // | | | SubResp1 | |
| 1102 | // | | |<-------------| |
| 1103 | // | | SubResp1 | | |
| 1104 | // | |<-------------| | |
| 1105 | // | | | | |
| 1106 | // | | | SubResp2 | |
| 1107 | // | | |<-------------| |
| 1108 | // | SubResp2 | | |
| 1109 | // |<------------------------| | |
| 1110 | // | | | | |
| 1111 | // | | [SUBS 1 DELETE] | |
| 1112 | // | | | | |
| 1113 | // | | [SUBS 2 DELETE] | |
| 1114 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1115 | // |
| 1116 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1117 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1118 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1119 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1120 | |
| 1121 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1122 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1123 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1124 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1125 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1126 | |
| 1127 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1128 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1129 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1130 | |
| 1131 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1132 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1133 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1134 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1135 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1136 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1137 | |
| 1138 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1139 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1140 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1141 | |
| 1142 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1143 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1144 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1145 | |
| 1146 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1147 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1148 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1149 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1150 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1151 | //Wait that subs is cleaned |
| 1152 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1153 | |
| 1154 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1155 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1156 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1157 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1158 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1159 | //Wait that subs is cleaned |
| 1160 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1161 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1162 | xappConn1.TestMsgChanEmpty(t) |
| 1163 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1164 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1165 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1166 | } |
| 1167 | |
| 1168 | //----------------------------------------------------------------------------- |
| 1169 | // TestSameSubsDiffRan |
| 1170 | // Same subscription to different RANs |
| 1171 | // |
| 1172 | // stub stub |
| 1173 | // +-------+ +---------+ +---------+ |
| 1174 | // | xapp | | submgr | | e2term | |
| 1175 | // +-------+ +---------+ +---------+ |
| 1176 | // | | | |
| 1177 | // | | | |
| 1178 | // | | | |
| 1179 | // | SubReq(r1) | | |
| 1180 | // |------------->| | |
| 1181 | // | | | |
| 1182 | // | | SubReq(r1) | |
| 1183 | // | |------------->| |
| 1184 | // | | | |
| 1185 | // | | SubResp(r1) | |
| 1186 | // | |<-------------| |
| 1187 | // | | | |
| 1188 | // | SubResp(r1) | | |
| 1189 | // |<-------------| | |
| 1190 | // | | | |
| 1191 | // | SubReq(r2) | | |
| 1192 | // |------------->| | |
| 1193 | // | | | |
| 1194 | // | | SubReq(r2) | |
| 1195 | // | |------------->| |
| 1196 | // | | | |
| 1197 | // | | SubResp(r2) | |
| 1198 | // | |<-------------| |
| 1199 | // | | | |
| 1200 | // | SubResp(r2) | | |
| 1201 | // |<-------------| | |
| 1202 | // | | | |
| 1203 | // | [SUBS r1 DELETE] | |
| 1204 | // | | | |
| 1205 | // | [SUBS r2 DELETE] | |
| 1206 | // | | | |
| 1207 | // |
| 1208 | //----------------------------------------------------------------------------- |
| 1209 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1210 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1211 | |
| 1212 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1213 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1214 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1215 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1216 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1218 | |
| 1219 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1220 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1221 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1222 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1223 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1224 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1225 | |
| 1226 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1227 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1228 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1229 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1230 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1231 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1232 | //Wait that subs is cleaned |
| 1233 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1234 | |
| 1235 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1236 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1237 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1238 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1239 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1240 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1241 | //Wait that subs is cleaned |
| 1242 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1243 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1244 | xappConn1.TestMsgChanEmpty(t) |
| 1245 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1246 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1247 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1248 | } |
| 1249 | |
| 1250 | //----------------------------------------------------------------------------- |
| 1251 | // TestSubReqRetryInSubmgr |
| 1252 | // |
| 1253 | // stub stub |
| 1254 | // +-------+ +---------+ +---------+ |
| 1255 | // | xapp | | submgr | | e2term | |
| 1256 | // +-------+ +---------+ +---------+ |
| 1257 | // | | | |
| 1258 | // | SubReq | | |
| 1259 | // |------------->| | |
| 1260 | // | | | |
| 1261 | // | | SubReq | |
| 1262 | // | |------------->| |
| 1263 | // | | | |
| 1264 | // | | | |
| 1265 | // | | SubReq | |
| 1266 | // | |------------->| |
| 1267 | // | | | |
| 1268 | // | | SubResp | |
| 1269 | // | |<-------------| |
| 1270 | // | | | |
| 1271 | // | SubResp | | |
| 1272 | // |<-------------| | |
| 1273 | // | | | |
| 1274 | // | [SUBS DELETE] | |
| 1275 | // | | | |
| 1276 | // |
| 1277 | //----------------------------------------------------------------------------- |
| 1278 | |
| 1279 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1280 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1281 | |
| 1282 | // Init counter check |
| 1283 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1284 | Counter{cSubReqFromXapp, 1}, |
| 1285 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1286 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1287 | Counter{cSubReReqToE2, 1}, |
| 1288 | Counter{cSubRespFromE2, 1}, |
| 1289 | Counter{cSubRespToXapp, 1}, |
| 1290 | Counter{cSubDelReqFromXapp, 1}, |
| 1291 | Counter{cSubDelReqToE2, 1}, |
| 1292 | Counter{cSubDelRespFromE2, 1}, |
| 1293 | Counter{cSubDelRespToXapp, 1}, |
| 1294 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1295 | |
| 1296 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1297 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1298 | |
| 1299 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1300 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1301 | |
| 1302 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1303 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1304 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1305 | |
| 1306 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1307 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1308 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1309 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1310 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1311 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1312 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1313 | |
| 1314 | // Wait that subs is cleaned |
| 1315 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1316 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1317 | xappConn1.TestMsgChanEmpty(t) |
| 1318 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1319 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1320 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1321 | |
| 1322 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1323 | } |
| 1324 | |
| 1325 | //----------------------------------------------------------------------------- |
| 1326 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1327 | // |
| 1328 | // stub stub |
| 1329 | // +-------+ +---------+ +---------+ |
| 1330 | // | xapp | | submgr | | e2term | |
| 1331 | // +-------+ +---------+ +---------+ |
| 1332 | // | | | |
| 1333 | // | SubReq | | |
| 1334 | // |------------->| | |
| 1335 | // | | | |
| 1336 | // | | SubReq | |
| 1337 | // | |------------->| |
| 1338 | // | | | |
| 1339 | // | | | |
| 1340 | // | | SubReq | |
| 1341 | // | |------------->| |
| 1342 | // | | | |
| 1343 | // | | SubDelReq | |
| 1344 | // | |------------->| |
| 1345 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1346 | // | | SubDelResp | |
| 1347 | // | |<-------------| |
| 1348 | // | | | |
| 1349 | // |
| 1350 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1351 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1352 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1353 | |
| 1354 | // Init counter check |
| 1355 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1356 | Counter{cSubReqFromXapp, 1}, |
| 1357 | Counter{cSubReqToE2, 1}, |
| 1358 | Counter{cSubReReqToE2, 1}, |
| 1359 | Counter{cSubReqTimerExpiry, 2}, |
| 1360 | Counter{cSubDelReqToE2, 1}, |
| 1361 | Counter{cSubDelRespFromE2, 1}, |
| 1362 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1363 | |
| 1364 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1365 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1366 | |
| 1367 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1368 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1369 | |
| 1370 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1371 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1372 | |
| 1373 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1374 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1375 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1376 | |
| 1377 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1378 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1379 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1380 | xappConn1.TestMsgChanEmpty(t) |
| 1381 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1382 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1383 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1384 | |
| 1385 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1386 | } |
| 1387 | |
| 1388 | //----------------------------------------------------------------------------- |
| 1389 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1390 | // |
| 1391 | // stub stub |
| 1392 | // +-------+ +---------+ +---------+ |
| 1393 | // | xapp | | submgr | | e2term | |
| 1394 | // +-------+ +---------+ +---------+ |
| 1395 | // | | | |
| 1396 | // | SubReq | | |
| 1397 | // |------------->| | |
| 1398 | // | | | |
| 1399 | // | | SubReq | |
| 1400 | // | |------------->| |
| 1401 | // | | | |
| 1402 | // | | | |
| 1403 | // | | SubReq | |
| 1404 | // | |------------->| |
| 1405 | // | | | |
| 1406 | // | | SubDelReq | |
| 1407 | // | |------------->| |
| 1408 | // | | | |
| 1409 | // | | | |
| 1410 | // | | SubDelReq | |
| 1411 | // | |------------->| |
| 1412 | // | | | |
| 1413 | // | | | |
| 1414 | // |
| 1415 | //----------------------------------------------------------------------------- |
| 1416 | |
| 1417 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1418 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1419 | |
| 1420 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1421 | Counter{cSubReqFromXapp, 1}, |
| 1422 | Counter{cSubReqToE2, 1}, |
| 1423 | Counter{cSubReReqToE2, 1}, |
| 1424 | Counter{cSubReqTimerExpiry, 2}, |
| 1425 | Counter{cSubDelReqToE2, 1}, |
| 1426 | Counter{cSubDelReReqToE2, 1}, |
| 1427 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1428 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1429 | |
| 1430 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1431 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1432 | |
| 1433 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1434 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1435 | |
| 1436 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1437 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1438 | |
| 1439 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1440 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1441 | |
| 1442 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1443 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1444 | |
| 1445 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1446 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1447 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1448 | xappConn1.TestMsgChanEmpty(t) |
| 1449 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1450 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1451 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1452 | |
| 1453 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1454 | } |
| 1455 | |
| 1456 | //----------------------------------------------------------------------------- |
| 1457 | // TestSubReqSubFailRespInSubmgr |
| 1458 | // |
| 1459 | // stub stub |
| 1460 | // +-------+ +---------+ +---------+ |
| 1461 | // | xapp | | submgr | | e2term | |
| 1462 | // +-------+ +---------+ +---------+ |
| 1463 | // | | | |
| 1464 | // | SubReq | | |
| 1465 | // |------------->| | |
| 1466 | // | | | |
| 1467 | // | | SubReq | |
| 1468 | // | |------------->| |
| 1469 | // | | | |
| 1470 | // | | SubFail | |
| 1471 | // | |<-------------| |
| 1472 | // | | | |
| 1473 | // | SubFail | | |
| 1474 | // |<-------------| | |
| 1475 | // | | | |
| 1476 | // |
| 1477 | //----------------------------------------------------------------------------- |
| 1478 | |
| 1479 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1480 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1481 | |
| 1482 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1483 | Counter{cSubReqFromXapp, 1}, |
| 1484 | Counter{cSubReqToE2, 1}, |
| 1485 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1486 | Counter{cSubFailToXapp, 1}, |
| 1487 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1488 | |
| 1489 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1490 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1491 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1492 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1493 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1494 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1495 | fparams1.Set(crereq1) |
| 1496 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1497 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1498 | // Xapp: Receive SubsFail |
| 1499 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1500 | |
| 1501 | // Wait that subs is cleaned |
| 1502 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1503 | |
| 1504 | xappConn1.TestMsgChanEmpty(t) |
| 1505 | xappConn2.TestMsgChanEmpty(t) |
| 1506 | e2termConn1.TestMsgChanEmpty(t) |
| 1507 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1508 | |
| 1509 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1510 | } |
| 1511 | |
| 1512 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1513 | // TestSubDelReqRetryInSubmgr |
| 1514 | // |
| 1515 | // stub stub |
| 1516 | // +-------+ +---------+ +---------+ |
| 1517 | // | xapp | | submgr | | e2term | |
| 1518 | // +-------+ +---------+ +---------+ |
| 1519 | // | | | |
| 1520 | // | [SUBS CREATE] | |
| 1521 | // | | | |
| 1522 | // | | | |
| 1523 | // | SubDelReq | | |
| 1524 | // |------------->| | |
| 1525 | // | | | |
| 1526 | // | | SubDelReq | |
| 1527 | // | |------------->| |
| 1528 | // | | | |
| 1529 | // | | SubDelReq | |
| 1530 | // | |------------->| |
| 1531 | // | | | |
| 1532 | // | | SubDelResp | |
| 1533 | // | |<-------------| |
| 1534 | // | | | |
| 1535 | // | SubDelResp | | |
| 1536 | // |<-------------| | |
| 1537 | // |
| 1538 | //----------------------------------------------------------------------------- |
| 1539 | |
| 1540 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1541 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1542 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1543 | |
| 1544 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1545 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1546 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1547 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1548 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1549 | |
| 1550 | // Subs Delete |
| 1551 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1552 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1553 | |
| 1554 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1555 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1556 | |
| 1557 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1558 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1559 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1560 | |
| 1561 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1562 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1563 | |
| 1564 | // Wait that subs is cleaned |
| 1565 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1566 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1567 | xappConn1.TestMsgChanEmpty(t) |
| 1568 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1569 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1570 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1571 | } |
| 1572 | |
| 1573 | //----------------------------------------------------------------------------- |
| 1574 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1575 | // |
| 1576 | // stub stub |
| 1577 | // +-------+ +---------+ +---------+ |
| 1578 | // | xapp | | submgr | | e2term | |
| 1579 | // +-------+ +---------+ +---------+ |
| 1580 | // | | | |
| 1581 | // | [SUBS CREATE] | |
| 1582 | // | | | |
| 1583 | // | | | |
| 1584 | // | SubDelReq | | |
| 1585 | // |------------->| | |
| 1586 | // | | | |
| 1587 | // | | SubDelReq | |
| 1588 | // | |------------->| |
| 1589 | // | | | |
| 1590 | // | | SubDelReq | |
| 1591 | // | |------------->| |
| 1592 | // | | | |
| 1593 | // | | | |
| 1594 | // | SubDelResp | | |
| 1595 | // |<-------------| | |
| 1596 | // |
| 1597 | //----------------------------------------------------------------------------- |
| 1598 | |
| 1599 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1600 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1601 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1602 | |
| 1603 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1604 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1605 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1606 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1607 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1608 | |
| 1609 | // Subs Delete |
| 1610 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1611 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1612 | |
| 1613 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1614 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1615 | |
| 1616 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1617 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1618 | |
| 1619 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1620 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1621 | |
| 1622 | // Wait that subs is cleaned |
| 1623 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1624 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1625 | xappConn1.TestMsgChanEmpty(t) |
| 1626 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1627 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1628 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1629 | } |
| 1630 | |
| 1631 | //----------------------------------------------------------------------------- |
| 1632 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1633 | // |
| 1634 | // stub stub |
| 1635 | // +-------+ +---------+ +---------+ |
| 1636 | // | xapp | | submgr | | e2term | |
| 1637 | // +-------+ +---------+ +---------+ |
| 1638 | // | | | |
| 1639 | // | [SUBS CREATE] | |
| 1640 | // | | | |
| 1641 | // | | | |
| 1642 | // | SubDelReq | | |
| 1643 | // |------------->| | |
| 1644 | // | | | |
| 1645 | // | | SubDelReq | |
| 1646 | // | |------------->| |
| 1647 | // | | | |
| 1648 | // | | SubDelFail | |
| 1649 | // | |<-------------| |
| 1650 | // | | | |
| 1651 | // | SubDelResp | | |
| 1652 | // |<-------------| | |
| 1653 | // | | | |
| 1654 | // |
| 1655 | //----------------------------------------------------------------------------- |
| 1656 | |
| 1657 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1658 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1659 | |
| 1660 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1661 | Counter{cSubReqFromXapp, 1}, |
| 1662 | Counter{cSubReqToE2, 1}, |
| 1663 | Counter{cSubRespFromE2, 1}, |
| 1664 | Counter{cSubRespToXapp, 1}, |
| 1665 | Counter{cSubDelReqFromXapp, 1}, |
| 1666 | Counter{cSubDelReqToE2, 1}, |
| 1667 | Counter{cSubDelFailFromE2, 1}, |
| 1668 | Counter{cSubDelRespToXapp, 1}, |
| 1669 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1670 | |
| 1671 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1672 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1673 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1674 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1675 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1676 | |
| 1677 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1678 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1679 | |
| 1680 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1681 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1682 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1683 | |
| 1684 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1685 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1686 | |
| 1687 | // Wait that subs is cleaned |
| 1688 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1689 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1690 | xappConn1.TestMsgChanEmpty(t) |
| 1691 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1692 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1693 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1694 | |
| 1695 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1696 | } |
| 1697 | |
| 1698 | //----------------------------------------------------------------------------- |
| 1699 | // TestSubReqAndSubDelOkSameAction |
| 1700 | // |
| 1701 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1702 | // +-------+ +-------+ +---------+ +---------+ |
| 1703 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1704 | // +-------+ +-------+ +---------+ +---------+ |
| 1705 | // | | | | |
| 1706 | // | | | | |
| 1707 | // | | | | |
| 1708 | // | | SubReq1 | | |
| 1709 | // | |------------->| | |
| 1710 | // | | | | |
| 1711 | // | | | SubReq1 | |
| 1712 | // | | |------------->| |
| 1713 | // | | | SubResp1 | |
| 1714 | // | | |<-------------| |
| 1715 | // | | SubResp1 | | |
| 1716 | // | |<-------------| | |
| 1717 | // | | | | |
| 1718 | // | SubReq2 | | |
| 1719 | // |--------------------------->| | |
| 1720 | // | | | | |
| 1721 | // | SubResp2 | | |
| 1722 | // |<---------------------------| | |
| 1723 | // | | | | |
| 1724 | // | | SubDelReq 1 | | |
| 1725 | // | |------------->| | |
| 1726 | // | | | | |
| 1727 | // | | SubDelResp 1 | | |
| 1728 | // | |<-------------| | |
| 1729 | // | | | | |
| 1730 | // | SubDelReq 2 | | |
| 1731 | // |--------------------------->| | |
| 1732 | // | | | | |
| 1733 | // | | | SubDelReq 2 | |
| 1734 | // | | |------------->| |
| 1735 | // | | | | |
| 1736 | // | | | SubDelReq 2 | |
| 1737 | // | | |------------->| |
| 1738 | // | | | | |
| 1739 | // | SubDelResp 2 | | |
| 1740 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1741 | // |
| 1742 | //----------------------------------------------------------------------------- |
| 1743 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1744 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1745 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1746 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1747 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1748 | Counter{cSubReqFromXapp, 2}, |
| 1749 | Counter{cSubReqToE2, 1}, |
| 1750 | Counter{cSubRespFromE2, 1}, |
| 1751 | Counter{cSubRespToXapp, 2}, |
| 1752 | Counter{cMergedSubscriptions, 1}, |
| 1753 | Counter{cUnmergedSubscriptions, 1}, |
| 1754 | Counter{cSubDelReqFromXapp, 2}, |
| 1755 | Counter{cSubDelReqToE2, 1}, |
| 1756 | Counter{cSubDelRespFromE2, 1}, |
| 1757 | Counter{cSubDelRespToXapp, 2}, |
| 1758 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1759 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1760 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1761 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1762 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1763 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1764 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1765 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1766 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1767 | |
| 1768 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1769 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1770 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1771 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1773 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1774 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1775 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1776 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1777 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1778 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1779 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1780 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1781 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1782 | |
| 1783 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1784 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1785 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1786 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1787 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1788 | //Wait that subs is cleaned |
| 1789 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1790 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1791 | xappConn1.TestMsgChanEmpty(t) |
| 1792 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1793 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1794 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1795 | |
| 1796 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1797 | } |
| 1798 | |
| 1799 | //----------------------------------------------------------------------------- |
| 1800 | // TestSubReqAndSubDelOkSameActionParallel |
| 1801 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1802 | // stub stub stub |
| 1803 | // +-------+ +-------+ +---------+ +---------+ |
| 1804 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1805 | // +-------+ +-------+ +---------+ +---------+ |
| 1806 | // | | | | |
| 1807 | // | | | | |
| 1808 | // | | | | |
| 1809 | // | | SubReq1 | | |
| 1810 | // | |------------->| | |
| 1811 | // | | | | |
| 1812 | // | | | SubReq1 | |
| 1813 | // | | |------------->| |
| 1814 | // | SubReq2 | | |
| 1815 | // |--------------------------->| | |
| 1816 | // | | | SubResp1 | |
| 1817 | // | | |<-------------| |
| 1818 | // | | SubResp1 | | |
| 1819 | // | |<-------------| | |
| 1820 | // | | | | |
| 1821 | // | SubResp2 | | |
| 1822 | // |<---------------------------| | |
| 1823 | // | | | | |
| 1824 | // | | SubDelReq 1 | | |
| 1825 | // | |------------->| | |
| 1826 | // | | | | |
| 1827 | // | | SubDelResp 1 | | |
| 1828 | // | |<-------------| | |
| 1829 | // | | | | |
| 1830 | // | SubDelReq 2 | | |
| 1831 | // |--------------------------->| | |
| 1832 | // | | | | |
| 1833 | // | | | SubDelReq 2 | |
| 1834 | // | | |------------->| |
| 1835 | // | | | | |
| 1836 | // | | | SubDelReq 2 | |
| 1837 | // | | |------------->| |
| 1838 | // | | | | |
| 1839 | // | SubDelResp 2 | | |
| 1840 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1841 | // |
| 1842 | //----------------------------------------------------------------------------- |
| 1843 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1844 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1845 | |
| 1846 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1847 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1848 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1849 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1850 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1851 | |
| 1852 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1853 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1854 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1855 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1856 | |
| 1857 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1858 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1859 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1860 | |
| 1861 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1862 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1863 | |
| 1864 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1865 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1866 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1867 | |
| 1868 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1869 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1870 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1871 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1872 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1873 | |
| 1874 | //Wait that subs is cleaned |
| 1875 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1876 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1877 | xappConn1.TestMsgChanEmpty(t) |
| 1878 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1879 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1880 | mainCtrl.wait_registry_empty(t, 10) |
| 1881 | } |
| 1882 | |
| 1883 | //----------------------------------------------------------------------------- |
| 1884 | // TestSubReqAndSubDelNokSameActionParallel |
| 1885 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1886 | // stub stub stub |
| 1887 | // +-------+ +-------+ +---------+ +---------+ |
| 1888 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1889 | // +-------+ +-------+ +---------+ +---------+ |
| 1890 | // | | | | |
| 1891 | // | | | | |
| 1892 | // | | | | |
| 1893 | // | | SubReq1 | | |
| 1894 | // | |------------->| | |
| 1895 | // | | | | |
| 1896 | // | | | SubReq1 | |
| 1897 | // | | |------------->| |
| 1898 | // | SubReq2 | | |
| 1899 | // |--------------------------->| | |
| 1900 | // | | | SubFail1 | |
| 1901 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1902 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1903 | // | | SubFail1 | | |
| 1904 | // | |<-------------| | |
| 1905 | // | | | | |
| 1906 | // | SubFail2 | | |
| 1907 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1908 | // |
| 1909 | //----------------------------------------------------------------------------- |
| 1910 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1911 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1912 | |
| 1913 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1914 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1915 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1916 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1917 | |
| 1918 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1919 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1920 | |
| 1921 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1922 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1923 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1924 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1925 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1926 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1927 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1928 | // E2t: send SubsFail (first) |
| 1929 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1930 | fparams1.Set(crereq1) |
| 1931 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1932 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1933 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1934 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1935 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1936 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1937 | |
| 1938 | //Wait that subs is cleaned |
| 1939 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1940 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1941 | xappConn1.TestMsgChanEmpty(t) |
| 1942 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1943 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1944 | mainCtrl.wait_registry_empty(t, 10) |
| 1945 | } |
| 1946 | |
| 1947 | //----------------------------------------------------------------------------- |
| 1948 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1949 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1950 | // stub stub stub |
| 1951 | // +-------+ +-------+ +---------+ +---------+ |
| 1952 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1953 | // +-------+ +-------+ +---------+ +---------+ |
| 1954 | // | | | | |
| 1955 | // | | | | |
| 1956 | // | | | | |
| 1957 | // | | SubReq1 | | |
| 1958 | // | |------------->| | |
| 1959 | // | | | | |
| 1960 | // | | | SubReq1 | |
| 1961 | // | | |------------->| |
| 1962 | // | | SubReq2 | | |
| 1963 | // |--------------------------->| | |
| 1964 | // | | | | |
| 1965 | // | | | SubReq1 | |
| 1966 | // | | |------------->| |
| 1967 | // | | | | |
| 1968 | // | | | | |
| 1969 | // | | | SubDelReq | |
| 1970 | // | | |------------->| |
| 1971 | // | | | | |
| 1972 | // | | | SubDelResp | |
| 1973 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1974 | // |
| 1975 | //----------------------------------------------------------------------------- |
| 1976 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1977 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1978 | |
| 1979 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1980 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1981 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1982 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1983 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1984 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1985 | |
| 1986 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1987 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1988 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1989 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1990 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1991 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1992 | |
| 1993 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1994 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1995 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1996 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1997 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1998 | |
| 1999 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2000 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2001 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2002 | xappConn1.TestMsgChanEmpty(t) |
| 2003 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2004 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2005 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2006 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2007 | |
| 2008 | //----------------------------- Policy cases --------------------------------- |
| 2009 | //----------------------------------------------------------------------------- |
| 2010 | // TestSubReqPolicyAndSubDelOk |
| 2011 | // |
| 2012 | // stub stub |
| 2013 | // +-------+ +---------+ +---------+ |
| 2014 | // | xapp | | submgr | | e2term | |
| 2015 | // +-------+ +---------+ +---------+ |
| 2016 | // | | | |
| 2017 | // | SubReq | | |
| 2018 | // |------------->| | |
| 2019 | // | | | |
| 2020 | // | | SubReq | |
| 2021 | // | |------------->| |
| 2022 | // | | | |
| 2023 | // | | SubResp | |
| 2024 | // | |<-------------| |
| 2025 | // | | | |
| 2026 | // | SubResp | | |
| 2027 | // |<-------------| | |
| 2028 | // | | | |
| 2029 | // | | | |
| 2030 | // | SubDelReq | | |
| 2031 | // |------------->| | |
| 2032 | // | | | |
| 2033 | // | | SubDelReq | |
| 2034 | // | |------------->| |
| 2035 | // | | | |
| 2036 | // | | SubDelResp | |
| 2037 | // | |<-------------| |
| 2038 | // | | | |
| 2039 | // | SubDelResp | | |
| 2040 | // |<-------------| | |
| 2041 | // |
| 2042 | //----------------------------------------------------------------------------- |
| 2043 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2044 | CaseBegin("TestSubReqAndSubDelOk") |
| 2045 | |
| 2046 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2047 | rparams1.Init() |
| 2048 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2049 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2050 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2051 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2052 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2053 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2054 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2055 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2056 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2057 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2058 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2059 | |
| 2060 | //Wait that subs is cleaned |
| 2061 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2062 | |
| 2063 | xappConn1.TestMsgChanEmpty(t) |
| 2064 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2065 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2066 | mainCtrl.wait_registry_empty(t, 10) |
| 2067 | } |
| 2068 | |
| 2069 | //----------------------------------------------------------------------------- |
| 2070 | // TestSubReqPolicyChangeAndSubDelOk |
| 2071 | // |
| 2072 | // stub stub |
| 2073 | // +-------+ +---------+ +---------+ |
| 2074 | // | xapp | | submgr | | e2term | |
| 2075 | // +-------+ +---------+ +---------+ |
| 2076 | // | | | |
| 2077 | // | SubReq | | |
| 2078 | // |------------->| | |
| 2079 | // | | | |
| 2080 | // | | SubReq | |
| 2081 | // | |------------->| |
| 2082 | // | | | |
| 2083 | // | | SubResp | |
| 2084 | // | |<-------------| |
| 2085 | // | | | |
| 2086 | // | SubResp | | |
| 2087 | // |<-------------| | |
| 2088 | // | | | |
| 2089 | // | SubReq | | |
| 2090 | // |------------->| | |
| 2091 | // | | | |
| 2092 | // | | SubReq | |
| 2093 | // | |------------->| |
| 2094 | // | | | |
| 2095 | // | | SubResp | |
| 2096 | // | |<-------------| |
| 2097 | // | | | |
| 2098 | // | SubResp | | |
| 2099 | // |<-------------| | |
| 2100 | // | | | |
| 2101 | // | SubDelReq | | |
| 2102 | // |------------->| | |
| 2103 | // | | | |
| 2104 | // | | SubDelReq | |
| 2105 | // | |------------->| |
| 2106 | // | | | |
| 2107 | // | | SubDelResp | |
| 2108 | // | |<-------------| |
| 2109 | // | | | |
| 2110 | // | SubDelResp | | |
| 2111 | // |<-------------| | |
| 2112 | // |
| 2113 | //----------------------------------------------------------------------------- |
| 2114 | |
| 2115 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2116 | CaseBegin("TestSubReqAndSubDelOk") |
| 2117 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2118 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2119 | rparams1.Init() |
| 2120 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2121 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2122 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2123 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2124 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2125 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2126 | |
| 2127 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2128 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2129 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2130 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2131 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2132 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2133 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2134 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2135 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2136 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2137 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2138 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2139 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2140 | |
| 2141 | //Wait that subs is cleaned |
| 2142 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2143 | |
| 2144 | xappConn1.TestMsgChanEmpty(t) |
| 2145 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2146 | e2termConn1.TestMsgChanEmpty(t) |
| 2147 | mainCtrl.wait_registry_empty(t, 10) |
| 2148 | } |
| 2149 | |
| 2150 | //----------------------------------------------------------------------------- |
| 2151 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2152 | // |
| 2153 | // stub stub stub |
| 2154 | // +-------+ +---------+ +---------+ +---------+ |
| 2155 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2156 | // +-------+ +---------+ +---------+ +---------+ |
| 2157 | // | | | | |
| 2158 | // | | | | |
| 2159 | // | | | | |
| 2160 | // | SubReq1 | | | |
| 2161 | // |------------->| | | |
| 2162 | // | | | | |
| 2163 | // | | SubReq1 | | |
| 2164 | // | |------------->| | |
| 2165 | // | | | | |
| 2166 | // | SubReq2 | | | |
| 2167 | // |------------->| | | |
| 2168 | // | | | | |
| 2169 | // | | SubReq2 | | |
| 2170 | // | |---------------------------->| |
| 2171 | // | | | | |
| 2172 | // | | SubResp1 | | |
| 2173 | // | |<-------------| | |
| 2174 | // | SubResp1 | | | |
| 2175 | // |<-------------| | | |
| 2176 | // | | SubResp2 | | |
| 2177 | // | |<----------------------------| |
| 2178 | // | SubResp2 | | | |
| 2179 | // |<-------------| | | |
| 2180 | // | | | | |
| 2181 | // | [SUBS 1 DELETE] | | |
| 2182 | // | | | | |
| 2183 | // | [SUBS 2 DELETE] | | |
| 2184 | // | | | | |
| 2185 | // |
| 2186 | //----------------------------------------------------------------------------- |
| 2187 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2188 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2189 | |
| 2190 | //Req1 |
| 2191 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2192 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2193 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2194 | |
| 2195 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2196 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2197 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2198 | |
| 2199 | //Resp1 |
| 2200 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2201 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2202 | |
| 2203 | //Resp2 |
| 2204 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2205 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2206 | |
| 2207 | //Del1 |
| 2208 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2209 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2210 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2211 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2212 | //Wait that subs is cleaned |
| 2213 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2214 | |
| 2215 | //Del2 |
| 2216 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2217 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2218 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2219 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2220 | //Wait that subs is cleaned |
| 2221 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2222 | |
| 2223 | xappConn1.TestMsgChanEmpty(t) |
| 2224 | xappConn2.TestMsgChanEmpty(t) |
| 2225 | e2termConn1.TestMsgChanEmpty(t) |
| 2226 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2227 | mainCtrl.wait_registry_empty(t, 10) |
| 2228 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2229 | |
| 2230 | //----------------------------------------------------------------------------- |
| 2231 | // TestSubReqInsertAndSubDelOk |
| 2232 | // |
| 2233 | // stub stub |
| 2234 | // +-------+ +---------+ +---------+ |
| 2235 | // | xapp | | submgr | | e2term | |
| 2236 | // +-------+ +---------+ +---------+ |
| 2237 | // | | | |
| 2238 | // | SubReq | | |
| 2239 | // |------------->| | |
| 2240 | // | | | |
| 2241 | // | | SubReq | |
| 2242 | // | |------------->| |
| 2243 | // | | | |
| 2244 | // | | SubResp | |
| 2245 | // | |<-------------| |
| 2246 | // | | | |
| 2247 | // | SubResp | | |
| 2248 | // |<-------------| | |
| 2249 | // | | | |
| 2250 | // | | | |
| 2251 | // | SubDelReq | | |
| 2252 | // |------------->| | |
| 2253 | // | | | |
| 2254 | // | | SubDelReq | |
| 2255 | // | |------------->| |
| 2256 | // | | | |
| 2257 | // | | SubDelResp | |
| 2258 | // | |<-------------| |
| 2259 | // | | | |
| 2260 | // | SubDelResp | | |
| 2261 | // |<-------------| | |
| 2262 | // |
| 2263 | //----------------------------------------------------------------------------- |
| 2264 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2265 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2266 | |
| 2267 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2268 | rparams1.Init() |
| 2269 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2270 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2271 | |
| 2272 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2273 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2274 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2275 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2276 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2277 | |
| 2278 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2279 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2280 | |
| 2281 | //Wait that subs is cleaned |
| 2282 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2283 | |
| 2284 | xappConn1.TestMsgChanEmpty(t) |
| 2285 | xappConn2.TestMsgChanEmpty(t) |
| 2286 | e2termConn1.TestMsgChanEmpty(t) |
| 2287 | mainCtrl.wait_registry_empty(t, 10) |
| 2288 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2289 | |
| 2290 | //----------------------------------------------------------------------------- |
| 2291 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2292 | // |
| 2293 | // This case simulates case where xApp restarts and starts sending same |
| 2294 | // subscription requests which have already subscribed successfully |
| 2295 | |
| 2296 | // stub stub |
| 2297 | // +-------+ +---------+ +---------+ |
| 2298 | // | xapp | | submgr | | e2term | |
| 2299 | // +-------+ +---------+ +---------+ |
| 2300 | // | | | |
| 2301 | // | SubReq | | |
| 2302 | // |------------->| | |
| 2303 | // | | | |
| 2304 | // | | SubReq | |
| 2305 | // | |------------->| |
| 2306 | // | | | |
| 2307 | // | | SubResp | |
| 2308 | // | |<-------------| |
| 2309 | // | | | |
| 2310 | // | SubResp | | |
| 2311 | // |<-------------| | |
| 2312 | // | | | |
| 2313 | // | xApp restart | | |
| 2314 | // | | | |
| 2315 | // | SubReq | | |
| 2316 | // | (retrans with same xApp generated subid but diff xid) |
| 2317 | // |------------->| | |
| 2318 | // | | | |
| 2319 | // | SubResp | | |
| 2320 | // |<-------------| | |
| 2321 | // | | | |
| 2322 | // | [SUBS DELETE] | |
| 2323 | // | | | |
| 2324 | // |
| 2325 | //----------------------------------------------------------------------------- |
| 2326 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2327 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2328 | |
| 2329 | //Subs Create |
| 2330 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2331 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2332 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2333 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2334 | |
| 2335 | // xApp restart here |
| 2336 | // --> artificial delay |
| 2337 | <-time.After(1 * time.Second) |
| 2338 | |
| 2339 | //Subs Create |
| 2340 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2341 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2342 | |
| 2343 | //Subs Delete |
| 2344 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2345 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2346 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2347 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2348 | |
| 2349 | //Wait that subs is cleaned |
| 2350 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2351 | |
| 2352 | xappConn1.TestMsgChanEmpty(t) |
| 2353 | xappConn2.TestMsgChanEmpty(t) |
| 2354 | e2termConn1.TestMsgChanEmpty(t) |
| 2355 | mainCtrl.wait_registry_empty(t, 10) |
| 2356 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2357 | |
| 2358 | //----------------------------------------------------------------------------- |
| 2359 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2360 | // |
| 2361 | // stub stub |
| 2362 | // +-------+ +---------+ +---------+ |
| 2363 | // | xapp | | submgr | | e2term | |
| 2364 | // +-------+ +---------+ +---------+ |
| 2365 | // | | | |
| 2366 | // | SubReq | | |
| 2367 | // |------------->| | |
| 2368 | // | | | |
| 2369 | // | | SubReq | |
| 2370 | // | |------------->| |
| 2371 | // | | | |
| 2372 | // | | SubResp | |
| 2373 | // | <----| |
| 2374 | // | | |
| 2375 | // | Submgr restart | |
| 2376 | // | | |
| 2377 | // | | | |
| 2378 | // | | SubDelReq | |
| 2379 | // | |------------->| |
| 2380 | // | | | |
| 2381 | // | | SubDelResp | |
| 2382 | // | |<-------------| |
| 2383 | // | | | |
| 2384 | // |
| 2385 | //----------------------------------------------------------------------------- |
| 2386 | |
| 2387 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2388 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2389 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2390 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2391 | xappConn1.SendSubsReq(t, nil, nil) |
| 2392 | e2termConn1.RecvSubsReq(t) |
| 2393 | mainCtrl.SetResetTestFlag(t, false) |
| 2394 | |
| 2395 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2396 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2397 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2398 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2399 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2400 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2401 | mainCtrl.SimulateRestart(t) |
| 2402 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2403 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2404 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2405 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2406 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2407 | |
| 2408 | // Wait that subs is cleaned |
| 2409 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2410 | |
| 2411 | xappConn1.TestMsgChanEmpty(t) |
| 2412 | xappConn2.TestMsgChanEmpty(t) |
| 2413 | e2termConn1.TestMsgChanEmpty(t) |
| 2414 | mainCtrl.wait_registry_empty(t, 10) |
| 2415 | } |
| 2416 | |
| 2417 | //----------------------------------------------------------------------------- |
| 2418 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2419 | // |
| 2420 | // stub stub |
| 2421 | // +-------+ +---------+ +---------+ |
| 2422 | // | xapp | | submgr | | e2term | |
| 2423 | // +-------+ +---------+ +---------+ |
| 2424 | // | | | |
| 2425 | // | SubReq | | |
| 2426 | // |------------->| | |
| 2427 | // | | | |
| 2428 | // | | SubReq | |
| 2429 | // | |------------->| |
| 2430 | // | | | |
| 2431 | // | | SubResp | |
| 2432 | // | |<-------------| |
| 2433 | // | | | |
| 2434 | // | SubResp | | |
| 2435 | // |<-------------| | |
| 2436 | // | | | |
| 2437 | // | | |
| 2438 | // | Submgr restart | |
| 2439 | // | | |
| 2440 | // | SubDelReq | | |
| 2441 | // |------------->| | |
| 2442 | // | | | |
| 2443 | // | | SubDelReq | |
| 2444 | // | |------------->| |
| 2445 | // | | | |
| 2446 | // | | SubDelResp | |
| 2447 | // | |<-------------| |
| 2448 | // | | | |
| 2449 | // | SubDelResp | | |
| 2450 | // |<-------------| | |
| 2451 | // |
| 2452 | //----------------------------------------------------------------------------- |
| 2453 | |
| 2454 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2455 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2456 | |
| 2457 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2458 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2459 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2460 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2461 | |
| 2462 | // Check subscription |
| 2463 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2464 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2465 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2466 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2467 | |
| 2468 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2469 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2470 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2471 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2472 | // That needs to be completed before successful subscription query is possible |
| 2473 | <-time.After(time.Second * 1) |
| 2474 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2475 | // Check that subscription is restored correctly after restart |
| 2476 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2477 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2478 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2479 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2480 | |
| 2481 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2482 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2483 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2484 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2485 | |
| 2486 | //Wait that subs is cleaned |
| 2487 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2488 | |
| 2489 | xappConn1.TestMsgChanEmpty(t) |
| 2490 | xappConn2.TestMsgChanEmpty(t) |
| 2491 | e2termConn1.TestMsgChanEmpty(t) |
| 2492 | mainCtrl.wait_registry_empty(t, 10) |
| 2493 | } |
| 2494 | |
| 2495 | //----------------------------------------------------------------------------- |
| 2496 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2497 | // |
| 2498 | // stub stub |
| 2499 | // +-------+ +-------+ +---------+ +---------+ |
| 2500 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2501 | // +-------+ +-------+ +---------+ +---------+ |
| 2502 | // | | | | |
| 2503 | // | | | | |
| 2504 | // | | | | |
| 2505 | // | | SubReq1 | | |
| 2506 | // | |------------->| | |
| 2507 | // | | | | |
| 2508 | // | | | SubReq1 | |
| 2509 | // | | |------------->| |
| 2510 | // | | | SubResp1 | |
| 2511 | // | | |<-------------| |
| 2512 | // | | SubResp1 | | |
| 2513 | // | |<-------------| | |
| 2514 | // | | | | |
| 2515 | // | | |
| 2516 | // | submgr restart | |
| 2517 | // | | |
| 2518 | // | | | | |
| 2519 | // | | | | |
| 2520 | // | SubReq2 | | |
| 2521 | // |--------------------------->| | |
| 2522 | // | | | | |
| 2523 | // | SubResp2 | | |
| 2524 | // |<---------------------------| | |
| 2525 | // | | | | |
| 2526 | // | | SubDelReq 1 | | |
| 2527 | // | |------------->| | |
| 2528 | // | | | | |
| 2529 | // | | SubDelResp 1 | | |
| 2530 | // | |<-------------| | |
| 2531 | // | | | | |
| 2532 | // | | | | |
| 2533 | // | | |
| 2534 | // | submgr restart | |
| 2535 | // | | |
| 2536 | // | | | | |
| 2537 | // | SubDelReq 2 | | |
| 2538 | // |--------------------------->| | |
| 2539 | // | | | | |
| 2540 | // | | | SubDelReq 2 | |
| 2541 | // | | |------------->| |
| 2542 | // | | | | |
| 2543 | // | | | SubDelReq 2 | |
| 2544 | // | | |------------->| |
| 2545 | // | | | | |
| 2546 | // | SubDelResp 2 | | |
| 2547 | // |<---------------------------| | |
| 2548 | // |
| 2549 | //----------------------------------------------------------------------------- |
| 2550 | |
| 2551 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2552 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2553 | |
| 2554 | //Req1 |
| 2555 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2556 | rparams1.Init() |
| 2557 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2558 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2559 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2560 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2561 | |
| 2562 | //Req2 |
| 2563 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2564 | rparams2.Init() |
| 2565 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2566 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2567 | |
| 2568 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2569 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2570 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2571 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2572 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2573 | |
| 2574 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2575 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2576 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2577 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2578 | // That needs to be completed before successful subscription query is possible |
| 2579 | <-time.After(time.Second * 1) |
| 2580 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2581 | // Check that subscription is restored correctly after restart |
| 2582 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2583 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2584 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2585 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2586 | |
| 2587 | //Del1 |
| 2588 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2589 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2590 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2591 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2592 | |
| 2593 | mainCtrl.SimulateRestart(t) |
| 2594 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2595 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2596 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2597 | // Submgr need be ready before successful subscription deletion is possible |
| 2598 | <-time.After(time.Second * 1) |
| 2599 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2600 | //Del2 |
| 2601 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2602 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2603 | |
| 2604 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2605 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2606 | |
| 2607 | //Wait that subs is cleaned |
| 2608 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2609 | |
| 2610 | xappConn1.TestMsgChanEmpty(t) |
| 2611 | xappConn2.TestMsgChanEmpty(t) |
| 2612 | e2termConn1.TestMsgChanEmpty(t) |
| 2613 | mainCtrl.wait_registry_empty(t, 10) |
| 2614 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2615 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2616 | //***************************************************************************** |
| 2617 | // REST interface test cases |
| 2618 | //***************************************************************************** |
| 2619 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2620 | //----------------------------------------------------------------------------- |
| 2621 | // Test debug GET and POST requests |
| 2622 | // |
| 2623 | // curl |
| 2624 | // +-------+ +---------+ |
| 2625 | // | user | | submgr | |
| 2626 | // +-------+ +---------+ |
| 2627 | // | | |
| 2628 | // | GET/POST Req | |
| 2629 | // |------------->| |
| 2630 | // | Resp | |
| 2631 | // |<-------------| |
| 2632 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2633 | func TestGetSubscriptions(t *testing.T) { |
| 2634 | |
| 2635 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2636 | } |
| 2637 | |
| 2638 | func TestGetSymptomData(t *testing.T) { |
| 2639 | |
| 2640 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2641 | } |
| 2642 | |
| 2643 | func TestPostdeleteSubId(t *testing.T) { |
| 2644 | |
| 2645 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2646 | } |
| 2647 | |
| 2648 | func TestPostEmptyDb(t *testing.T) { |
| 2649 | |
| 2650 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2651 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2652 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2653 | func TestGetRestSubscriptions(t *testing.T) { |
| 2654 | |
| 2655 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2656 | } |
| 2657 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2658 | //----------------------------------------------------------------------------- |
| 2659 | // TestRESTSubReqAndRouteNok |
| 2660 | // |
| 2661 | // stub stub |
| 2662 | // +-------+ +---------+ +---------+ |
| 2663 | // | xapp | | submgr | | rtmgr | |
| 2664 | // +-------+ +---------+ +---------+ |
| 2665 | // | | | |
| 2666 | // | RESTSubReq | | |
| 2667 | // |---------------->| | |
| 2668 | // | | | |
| 2669 | // | RESTSubResp | | |
| 2670 | // |<----------------| | |
| 2671 | // | | RouteCreate | |
| 2672 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2673 | // | | RouteCreate | |
| 2674 | // | | status:400 | |
| 2675 | // | |(Bad request) | |
| 2676 | // | |<-------------| |
| 2677 | // | RESTNotif | | |
| 2678 | // |<----------------| | |
| 2679 | // | | | |
| 2680 | // | [SUBS INT DELETE] | |
| 2681 | // | | | |
| 2682 | // | RESTSubDelReq | | |
| 2683 | // |---------------->| | |
| 2684 | // | RESTSubDelResp | | |
| 2685 | // |<----------------| | |
| 2686 | // |
| 2687 | //----------------------------------------------------------------------------- |
| 2688 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2689 | |
| 2690 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2691 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2692 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2693 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2694 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2695 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2696 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2697 | }) |
| 2698 | |
| 2699 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2700 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2701 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2702 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2703 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2704 | |
| 2705 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2706 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2707 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2708 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2709 | waiter.WaitResult(t) |
| 2710 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2711 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2712 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2713 | |
| 2714 | // Del |
| 2715 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2716 | |
| 2717 | // Wait that subs is cleaned |
| 2718 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2719 | waitSubsCleanup(t, e2SubsId, 10) |
| 2720 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2721 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2722 | } |
| 2723 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 2724 | //----------------------------------------------------------------------------- |
| 2725 | // TestRESTSubReqAndRouteUpdateNok |
| 2726 | // |
| 2727 | // stub stub stub stub |
| 2728 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 2729 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 2730 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 2731 | // | | | | | |
| 2732 | // | RESTSubReq1 | | | |
| 2733 | // |------------------------>| | | |
| 2734 | // | RESTSubResp2 | | | |
| 2735 | // |<------------------------| | | |
| 2736 | // | | | | | |
| 2737 | // | | | RouteCreate | | |
| 2738 | // | | |------------->| | |
| 2739 | // | | | CreateResp | | |
| 2740 | // | | |<-------------| | |
| 2741 | // | | | SubReq | | |
| 2742 | // | | |---------------------------->| |
| 2743 | // | | | SubResp | | |
| 2744 | // | | |<----------------------------| |
| 2745 | // | RESTNotif1 | | | |
| 2746 | // |<------------------------| | | |
| 2747 | // | | | | | |
| 2748 | // | | RESTSubReq2 | | | |
| 2749 | // | |------------>| | | |
| 2750 | // | | RESTSubResp2| | | |
| 2751 | // | |<------------| | | |
| 2752 | // | | | RouteUpdate | | |
| 2753 | // | | |------------->| | |
| 2754 | // | | | RouteUpdate | | |
| 2755 | // | | | status:400 | | |
| 2756 | // | | |(Bad request) | | |
| 2757 | // | | |<-------------| | |
| 2758 | // | | RESTNotif2(unsuccessful) | | |
| 2759 | // | |<------------| | | |
| 2760 | // | | | | | |
| 2761 | // | [SUBS INT DELETE] | | |
| 2762 | // | | | | | |
| 2763 | // | RESTSubDelReq1 | | | |
| 2764 | // |------------------------>| | | |
| 2765 | // | RESTSubDelResp1 | | | |
| 2766 | // |<------------------------| | | |
| 2767 | // | | | | | |
| 2768 | // | | | [SUBS DELETE] | |
| 2769 | // |
| 2770 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2771 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2772 | |
| 2773 | //Init counter check |
| 2774 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2775 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2776 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2777 | Counter{cSubReqToE2, 1}, |
| 2778 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2779 | Counter{cRestSubNotifToXapp, 1}, |
| 2780 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2781 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2782 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2783 | Counter{cSubDelReqToE2, 1}, |
| 2784 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2785 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2786 | }) |
| 2787 | |
| 2788 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2789 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 2790 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2791 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2792 | |
| 2793 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2794 | |
| 2795 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2796 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2797 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2798 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2799 | params.SetMeid("RAN_NAME_1") |
| 2800 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2801 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2802 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2803 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2804 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2805 | |
| 2806 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2807 | |
| 2808 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2809 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2810 | |
| 2811 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2812 | //Wait that subs is cleaned |
| 2813 | waitSubsCleanup(t, e2SubsId, 10) |
| 2814 | |
| 2815 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2816 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2817 | } |
| 2818 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 2819 | //----------------------------------------------------------------------------- |
| 2820 | // TestRESTSubDelReqAndRouteDeleteNok |
| 2821 | // |
| 2822 | // stub stub stub |
| 2823 | // +-------+ +---------+ +---------+ +---------+ |
| 2824 | // | xapp | | submgr | | rtmgr | | e2term | |
| 2825 | // +-------+ +---------+ +---------+ +---------+ |
| 2826 | // | | | | |
| 2827 | // | RESTSubReq | | | |
| 2828 | // |---------------->| | | |
| 2829 | // | | | | |
| 2830 | // | RESTSubResp | | | |
| 2831 | // |<----------------| | | |
| 2832 | // | | SubReq | | |
| 2833 | // | |---------------------------->| |
| 2834 | // | | SubResp | | |
| 2835 | // | |<----------------------------| |
| 2836 | // | RESTNotif | | | |
| 2837 | // |<----------------| | | |
| 2838 | // | | | | |
| 2839 | // | | | | |
| 2840 | // | RESTSubDelReq | | | |
| 2841 | // |---------------->| | | |
| 2842 | // | RESTSubDelResp | | | |
| 2843 | // |<----------------| | | |
| 2844 | // | | SubSelReq | | |
| 2845 | // | |---------------------------->| |
| 2846 | // | | SubSelResp | | |
| 2847 | // | |<----------------------------| |
| 2848 | // | | RouteDelete | | |
| 2849 | // | |------------->| | |
| 2850 | // | | Routedelete | | |
| 2851 | // | | status:400 | | |
| 2852 | // | |(Bad request) | | |
| 2853 | // | |<-------------| | |
| 2854 | // |
| 2855 | //----------------------------------------------------------------------------- |
| 2856 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2857 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2858 | |
| 2859 | // Init counter check |
| 2860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2861 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2862 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2863 | Counter{cSubReqToE2, 1}, |
| 2864 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2865 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2866 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2867 | Counter{cRouteDeleteFail, 1}, |
| 2868 | Counter{cSubDelReqToE2, 1}, |
| 2869 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2870 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2871 | }) |
| 2872 | |
| 2873 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2874 | |
| 2875 | //Subs Create |
| 2876 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2877 | |
| 2878 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2879 | |
| 2880 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2881 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2882 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2883 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2884 | waiter.WaitResult(t) |
| 2885 | |
| 2886 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2887 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2888 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2889 | } |
| 2890 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 2891 | //----------------------------------------------------------------------------- |
| 2892 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 2893 | // |
| 2894 | // stub stub stub stub |
| 2895 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 2896 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 2897 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 2898 | // | | | | | |
| 2899 | // | RESTSubReq1 | | | |
| 2900 | // |------------------------>| | | |
| 2901 | // | RESTSubResp2 | | | |
| 2902 | // |<------------------------| | | |
| 2903 | // | | | | | |
| 2904 | // | | | RouteCreate | | |
| 2905 | // | | |------------->| | |
| 2906 | // | | | CreateResp | | |
| 2907 | // | | |<-------------| | |
| 2908 | // | | | SubReq | | |
| 2909 | // | | |---------------------------->| |
| 2910 | // | | | SubResp | | |
| 2911 | // | | |<----------------------------| |
| 2912 | // | RESTNotif1 | | | |
| 2913 | // |<------------------------| | | |
| 2914 | // | | | | | |
| 2915 | // | | RESTSubReq2 | | | |
| 2916 | // | |------------>| | | |
| 2917 | // | | RESTSubResp2| | | |
| 2918 | // | |<------------| | | |
| 2919 | // | | | RouteCreate | | |
| 2920 | // | | |------------->| | |
| 2921 | // | | | CreateResp | | |
| 2922 | // | | |<-------------| | |
| 2923 | // | | | SubReq | | |
| 2924 | // | | |---------------------------->| |
| 2925 | // | | | SubResp | | |
| 2926 | // | | |<----------------------------| |
| 2927 | // | | RESTNotif2 | | | |
| 2928 | // | |<------------| | | |
| 2929 | // | | | | | |
| 2930 | // | [SUBS INT DELETE] | | |
| 2931 | // | | | | | |
| 2932 | // | RESTSubDelReq1 | | | |
| 2933 | // |------------------------>| | | |
| 2934 | // | RESTSubDelResp1 | | | |
| 2935 | // |<------------------------| | | |
| 2936 | // | | | SubDelReq | | |
| 2937 | // | | |---------------------------->| |
| 2938 | // | | | SubDelResp | | |
| 2939 | // | | |<----------------------------| |
| 2940 | // | | | RouteUpdate | | |
| 2941 | // | | |------------->| | |
| 2942 | // | | | RouteUpdate | | |
| 2943 | // | | | status:400 | | |
| 2944 | // | | |(Bad request) | | |
| 2945 | // | | |<-------------| | |
| 2946 | // | | | | | |
| 2947 | // | | RESTSubDelReq2 | | |
| 2948 | // | |------------>| | | |
| 2949 | // | | RESTSubDelResp2 | | |
| 2950 | // | |<------------| | | |
| 2951 | // | | | SubDelReq | | |
| 2952 | // | | |---------------------------->| |
| 2953 | // | | | SubdelResp | | |
| 2954 | // | | |<----------------------------| |
| 2955 | // | | | RouteDelete | | |
| 2956 | // | | |------------->| | |
| 2957 | // | | | Deleteresp | | |
| 2958 | // | | |<-------------| | |
| 2959 | |
| 2960 | //----------------------------------------------------------------------------- |
| 2961 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2962 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2963 | |
| 2964 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2965 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2966 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2967 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2968 | Counter{cSubReqToE2, 1}, |
| 2969 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2970 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2971 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2972 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2973 | Counter{cSubDelReqToE2, 1}, |
| 2974 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2975 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2976 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2977 | }) |
| 2978 | |
| 2979 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2980 | |
| 2981 | //Subs Create |
| 2982 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2983 | |
| 2984 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2985 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2986 | |
| 2987 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2988 | |
| 2989 | //Del1, this shall fail on rtmgr side |
| 2990 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2991 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2992 | waiter.WaitResult(t) |
| 2993 | |
| 2994 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2995 | |
| 2996 | //Del2 |
| 2997 | deleteXapp2Subscription(t, &restSubId2) |
| 2998 | |
| 2999 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3000 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3001 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3002 | } |
| 3003 | |
| 3004 | //----------------------------------------------------------------------------- |
| 3005 | // TestRESTSubReqRetransmission |
| 3006 | // |
| 3007 | // stub stub |
| 3008 | // +-------+ +---------+ +---------+ |
| 3009 | // | xapp | | submgr | | e2term | |
| 3010 | // +-------+ +---------+ +---------+ |
| 3011 | // | | | |
| 3012 | // | RESTSubReq1 | | |
| 3013 | // |---------------->| | |
| 3014 | // | | | |
| 3015 | // | RESTSubResp | | |
| 3016 | // |<----------------| | |
| 3017 | // | | SubReq1 | |
| 3018 | // | |------------->| |
| 3019 | // | | | |
| 3020 | // | RESTSubReq2 | | |
| 3021 | // | (retrans) | | |
| 3022 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3023 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3024 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3025 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3026 | // | | SubResp1 | |
| 3027 | // | |<-------------| |
| 3028 | // | RESTNotif1 | | |
| 3029 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3030 | // | | | |
| 3031 | // | [SUBS DELETE] | |
| 3032 | // | | | |
| 3033 | // |
| 3034 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3035 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3036 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3037 | |
| 3038 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3039 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3040 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3041 | Counter{cSubReqToE2, 1}, |
| 3042 | Counter{cSubRespFromE2, 1}, |
| 3043 | Counter{cRestSubNotifToXapp, 1}, |
| 3044 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3045 | Counter{cSubDelReqToE2, 1}, |
| 3046 | Counter{cSubDelRespFromE2, 1}, |
| 3047 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3048 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3049 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3050 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3051 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3052 | |
| 3053 | // Subs Create |
| 3054 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3055 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3056 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3057 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3058 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3059 | xappConn1.SendRESTSubsReq(t, params) |
| 3060 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3061 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3062 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3063 | |
| 3064 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3065 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3066 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3067 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3068 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3069 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3070 | |
| 3071 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3072 | |
| 3073 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3074 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3075 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3076 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3077 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3078 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3079 | |
| 3080 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3081 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3082 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3083 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3084 | //----------------------------------------------------------------------------- |
| 3085 | // stub stub stub |
| 3086 | // +-------+ +---------+ +---------+ +---------+ |
| 3087 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3088 | // +-------+ +---------+ +---------+ +---------+ |
| 3089 | // | | | | |
| 3090 | // | RESTSubReq | | | |
| 3091 | // |---------------->| | | |
| 3092 | // | RESTSubResp | | | |
| 3093 | // |<----------------| | | |
| 3094 | // | | RouteCreate | | |
| 3095 | // | |--------------------------->| |
| 3096 | // | | RouteResponse| | |
| 3097 | // | |<---------------------------| // The order of these events may vary |
| 3098 | // | | SubReq | | |
| 3099 | // | |------------->| | // The order of these events may vary |
| 3100 | // | | SubResp | | |
| 3101 | // | |<-------------| | |
| 3102 | // | RESTNotif1 | | | |
| 3103 | // |<----------------| | | |
| 3104 | // | RESTSubReq | | | |
| 3105 | // | [RETRANS1] | | | |
| 3106 | // |---------------->| | | |
| 3107 | // | RESTNotif1 | | | |
| 3108 | // |<----------------| | | |
| 3109 | // | RESTSubReq | | | |
| 3110 | // | [RETRANS2] | | | |
| 3111 | // |---------------->| | | |
| 3112 | // | RESTNotif1 | | | |
| 3113 | // |<----------------| | | |
| 3114 | // | RESTSubDelReq | | | |
| 3115 | // |---------------->| | | |
| 3116 | // | | SubDelReq | | |
| 3117 | // | |------------->| | |
| 3118 | // | RESTSubDelResp| | | |
| 3119 | // |<----------------| | | |
| 3120 | // | | SubDelResp | | |
| 3121 | // | |<-------------| | |
| 3122 | // | | | | |
| 3123 | // |
| 3124 | //----------------------------------------------------------------------------- |
| 3125 | |
| 3126 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3127 | |
| 3128 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3129 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3130 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3131 | Counter{cRestSubRespToXapp, 3}, |
| 3132 | Counter{cSubReqToE2, 1}, |
| 3133 | Counter{cSubRespFromE2, 1}, |
| 3134 | Counter{cRestSubNotifToXapp, 3}, |
| 3135 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3136 | Counter{cSubDelReqToE2, 1}, |
| 3137 | Counter{cSubDelRespFromE2, 1}, |
| 3138 | Counter{cRestSubDelRespToXapp, 1}, |
| 3139 | }) |
| 3140 | |
| 3141 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3142 | |
| 3143 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3144 | |
| 3145 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3146 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3147 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3148 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3149 | //1.st resend |
| 3150 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3151 | |
| 3152 | assert.Equal(t, restSubId_resend, restSubId) |
| 3153 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3154 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3155 | |
| 3156 | //2.nd resend |
| 3157 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3158 | |
| 3159 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3160 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3161 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3162 | |
| 3163 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3164 | |
| 3165 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3166 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3167 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3168 | } |
| 3169 | |
| 3170 | //----------------------------------------------------------------------------- |
| 3171 | // stub stub stub |
| 3172 | // +-------+ +---------+ +---------+ +---------+ |
| 3173 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3174 | // +-------+ +---------+ +---------+ +---------+ |
| 3175 | // | | | | |
| 3176 | // | RESTSubReq | | | |
| 3177 | // |---------------->| | | |
| 3178 | // | RESTSubResp | | | |
| 3179 | // |<----------------| | | |
| 3180 | // | | RouteCreate | | |
| 3181 | // | |--------------------------->| |
| 3182 | // | | RouteResponse| | |
| 3183 | // | |<---------------------------| // The order of these events may vary |
| 3184 | // | | SubReq | | |
| 3185 | // | |------------->| | // The order of these events may vary |
| 3186 | // | | SubResp | | |
| 3187 | // | |<-------------| | |
| 3188 | // | RESTNotif1 | | | |
| 3189 | // |<----------------| | | |
| 3190 | // | RESTSubReq | | | |
| 3191 | // | [RETRANS, with RESTsubsId] | | |
| 3192 | // |---------------->| | | |
| 3193 | // | RESTNotif1 | | | |
| 3194 | // |<----------------| | | |
| 3195 | // | RESTSubReq | | | |
| 3196 | // | [RETRANS, without RESTsubsId] | | |
| 3197 | // |---------------->| | | |
| 3198 | // | RESTNotif1 | | | |
| 3199 | // |<----------------| | | |
| 3200 | // | RESTSubDelReq | | | |
| 3201 | // |---------------->| | | |
| 3202 | // | | SubDelReq | | |
| 3203 | // | |------------->| | |
| 3204 | // | RESTSubDelResp| | | |
| 3205 | // |<----------------| | | |
| 3206 | // | | SubDelResp | | |
| 3207 | // | |<-------------| | |
| 3208 | // | | | | |
| 3209 | // |
| 3210 | //----------------------------------------------------------------------------- |
| 3211 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3212 | |
| 3213 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3214 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3215 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3216 | Counter{cRestSubRespToXapp, 3}, |
| 3217 | Counter{cSubReqToE2, 1}, |
| 3218 | Counter{cSubRespFromE2, 1}, |
| 3219 | Counter{cRestSubNotifToXapp, 3}, |
| 3220 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3221 | Counter{cSubDelReqToE2, 1}, |
| 3222 | Counter{cSubDelRespFromE2, 1}, |
| 3223 | Counter{cRestSubDelRespToXapp, 1}, |
| 3224 | }) |
| 3225 | |
| 3226 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3227 | |
| 3228 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3229 | |
| 3230 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3231 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3232 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3233 | |
| 3234 | //1.st resend with subscription ID |
| 3235 | params.SetSubscriptionID(&restSubId) |
| 3236 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3237 | |
| 3238 | assert.Equal(t, restSubId_resend, restSubId) |
| 3239 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3240 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3241 | |
| 3242 | //2.nd resend without subscription ID (faking app restart) |
| 3243 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3244 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3245 | |
| 3246 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3247 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3248 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3249 | |
| 3250 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3251 | |
| 3252 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3253 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3254 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3255 | } |
| 3256 | |
| 3257 | //----------------------------------------------------------------------------- |
| 3258 | // stub stub stub |
| 3259 | // +-------+ +---------+ +---------+ +---------+ |
| 3260 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3261 | // +-------+ +---------+ +---------+ +---------+ |
| 3262 | // | | | | |
| 3263 | // | RESTSubReq | | | |
| 3264 | // |---------------->| | | |
| 3265 | // | RESTSubResp | | | |
| 3266 | // |<----------------| | | |
| 3267 | // | | RouteCreate | | |
| 3268 | // | |--------------------------->| |
| 3269 | // | | RouteResponse| | |
| 3270 | // | |<---------------------------| |
| 3271 | // | | SubReq | | |
| 3272 | // | |------------->| | |
| 3273 | // | | SubResp | | |
| 3274 | // | |<-------------| | |
| 3275 | // | RESTNotif1 | | | |
| 3276 | // |<----------------| | | |
| 3277 | // | RESTSubReq | | | |
| 3278 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3279 | // |---------------->| | | |
| 3280 | // | RESTNotif1 | | | |
| 3281 | // | [for initial e2 subDetail] | | |
| 3282 | // |<----------------| | | |
| 3283 | // | | RouteCreate | | |
| 3284 | // | |--------------------------->| |
| 3285 | // | | RouteResponse| | |
| 3286 | // | |<---------------------------| |
| 3287 | // | | SubReq | | |
| 3288 | // | |------------->| | |
| 3289 | // | | SubResp | | |
| 3290 | // | |<-------------| | |
| 3291 | // | RESTNotif1 | | | |
| 3292 | // |<----------------| | | |
| 3293 | // | RESTSubReq | | | |
| 3294 | // | [with RESTsubsId initial request] | |
| 3295 | // |---------------->| | | |
| 3296 | // | RESTNotif1 | | | |
| 3297 | // |<----------------| | | |
| 3298 | // | RESTSubDelReq | | | |
| 3299 | // |---------------->| | | |
| 3300 | // | RESTSubDelResp| | | |
| 3301 | // |<----------------| | | |
| 3302 | // | | SubDelReq | | |
| 3303 | // | |------------->| | |
| 3304 | // | | SubDelResp | | |
| 3305 | // | |<-------------| | |
| 3306 | // | | SubDelReq | | |
| 3307 | // | |------------->| | |
| 3308 | // | | SubDelResp | | |
| 3309 | // | |<-------------| | |
| 3310 | // | | | | |
| 3311 | // |
| 3312 | //----------------------------------------------------------------------------- |
| 3313 | |
| 3314 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3315 | |
| 3316 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3317 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3318 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3319 | Counter{cRestSubRespToXapp, 3}, |
| 3320 | Counter{cSubReqToE2, 2}, |
| 3321 | Counter{cSubRespFromE2, 2}, |
| 3322 | Counter{cRestSubNotifToXapp, 4}, |
| 3323 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3324 | Counter{cSubDelReqToE2, 2}, |
| 3325 | Counter{cSubDelRespFromE2, 2}, |
| 3326 | Counter{cRestSubDelRespToXapp, 1}, |
| 3327 | }) |
| 3328 | |
| 3329 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3330 | |
| 3331 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3332 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3333 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3334 | |
| 3335 | // Send modified requst, this time with e2 subscriptions. |
| 3336 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3337 | params2.SetSubscriptionID(&restSubId) |
| 3338 | |
| 3339 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3340 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3341 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3342 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3343 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3344 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3345 | |
| 3346 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3347 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3348 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3349 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3350 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3351 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3352 | assert.NotEqual(t, e2SubsId2, 0) |
| 3353 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3354 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3355 | |
| 3356 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3357 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3358 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3359 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3360 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3361 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3362 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3363 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3364 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3365 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3366 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3367 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3368 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3369 | // Delete both e2 subscriptions |
| 3370 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3371 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3372 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3373 | |
| 3374 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3375 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3376 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3377 | } |
| 3378 | |
| 3379 | //----------------------------------------------------------------------------- |
| 3380 | // stub stub stub |
| 3381 | // +-------+ +---------+ +---------+ +---------+ |
| 3382 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3383 | // +-------+ +---------+ +---------+ +---------+ |
| 3384 | // | | | | |
| 3385 | // | RESTSubReq | | | |
| 3386 | // |---------------->| | | |
| 3387 | // | RESTSubResp | | | |
| 3388 | // |<----------------| | | |
| 3389 | // | | RouteCreate | | |
| 3390 | // | |--------------------------->| |
| 3391 | // | | RouteResponse| | |
| 3392 | // | |<---------------------------| |
| 3393 | // | | SubReq | | |
| 3394 | // | |------------->| | |
| 3395 | // | | SubResp | | |
| 3396 | // | |<-------------| | |
| 3397 | // | RESTNotif1 | | | |
| 3398 | // |<----------------| | | |
| 3399 | // | RESTSubReq | | | |
| 3400 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3401 | // |---------------->| | | |
| 3402 | // | RESTNotif1 | | | |
| 3403 | // | [for initial e2 subDetail] | | |
| 3404 | // |<----------------| | | |
| 3405 | // | | RouteCreate | | |
| 3406 | // | |--------------------------->| |
| 3407 | // | | RouteResponse| | |
| 3408 | // | |<---------------------------| |
| 3409 | // | | SubReq | | |
| 3410 | // | |------------->| | |
| 3411 | // | | SubResp | | |
| 3412 | // | |<-------------| | |
| 3413 | // | RESTNotif1 | | | |
| 3414 | // |<----------------| | | |
| 3415 | // | RESTSubReq | | | |
| 3416 | // | [without RESTsubsId initial request] | |
| 3417 | // |---------------->| | | |
| 3418 | // | RESTNotif1 | | | |
| 3419 | // |<----------------| | | |
| 3420 | // | RESTSubDelReq | | | |
| 3421 | // |---------------->| | | |
| 3422 | // | RESTSubDelResp| | | |
| 3423 | // |<----------------| | | |
| 3424 | // | | SubDelReq | | |
| 3425 | // | |------------->| | |
| 3426 | // | | SubDelResp | | |
| 3427 | // | |<-------------| | |
| 3428 | // | | SubDelReq | | |
| 3429 | // | |------------->| | |
| 3430 | // | | SubDelResp | | |
| 3431 | // | |<-------------| | |
| 3432 | // | | | | |
| 3433 | // |
| 3434 | //----------------------------------------------------------------------------- |
| 3435 | |
| 3436 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3437 | |
| 3438 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3439 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3440 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3441 | Counter{cRestSubRespToXapp, 3}, |
| 3442 | Counter{cSubReqToE2, 2}, |
| 3443 | Counter{cSubRespFromE2, 2}, |
| 3444 | Counter{cRestSubNotifToXapp, 4}, |
| 3445 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3446 | Counter{cSubDelReqToE2, 2}, |
| 3447 | Counter{cSubDelRespFromE2, 2}, |
| 3448 | Counter{cRestSubDelRespToXapp, 1}, |
| 3449 | }) |
| 3450 | |
| 3451 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3452 | |
| 3453 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3454 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3455 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3456 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3457 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3458 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3459 | params2.SetSubscriptionID(&restSubId) |
| 3460 | |
| 3461 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3462 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3463 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3464 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3465 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3466 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3467 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3468 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3469 | xappConn1.DecrementRequestCount() |
| 3470 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3471 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3472 | |
| 3473 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3474 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3475 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3476 | assert.NotEqual(t, e2SubsId2, 0) |
| 3477 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3478 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3479 | |
| 3480 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3481 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3482 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3483 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3484 | // md5sum shall find the original request |
| 3485 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3486 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3487 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3488 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3489 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3490 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3491 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3492 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3493 | // Delete both e2 subscriptions |
| 3494 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3495 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3496 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3497 | |
| 3498 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3499 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3500 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3501 | } |
| 3502 | |
| 3503 | //----------------------------------------------------------------------------- |
| 3504 | // stub stub stub |
| 3505 | // +-------+ +---------+ +---------+ +---------+ |
| 3506 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3507 | // +-------+ +---------+ +---------+ +---------+ |
| 3508 | // | | | | |
| 3509 | // | RESTSubReq | | | |
| 3510 | // |---------------->| | | |
| 3511 | // | RESTSubResp | | | |
| 3512 | // |<----------------| | | |
| 3513 | // | | RouteCreate | | |
| 3514 | // | |--------------------------->| |
| 3515 | // | | RouteResponse| | |
| 3516 | // | |<---------------------------| |
| 3517 | // | | SubReq | | |
| 3518 | // | |------------->| | |
| 3519 | // | | SubResp | | |
| 3520 | // | |<-------------| | |
| 3521 | // | RESTNotif1 | | | |
| 3522 | // |<----------------| | | |
| 3523 | // | RESTSubReq | | | |
| 3524 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3525 | // |---------------->| | | |
| 3526 | // | RESTNotif1 | | | |
| 3527 | // | [for initial e2 subDetail] | | |
| 3528 | // |<----------------| | | |
| 3529 | // | | RouteCreate | | |
| 3530 | // | |--------------------------->| |
| 3531 | // | | RouteResponse| | |
| 3532 | // | |<---------------------------| |
| 3533 | // | | SubReq | | |
| 3534 | // | |------------->| | |
| 3535 | // | | SubResp | | |
| 3536 | // | |<-------------| | |
| 3537 | // | RESTNotif1 | | | |
| 3538 | // |<----------------| | | |
| 3539 | // | RESTSubDelReq | | | |
| 3540 | // |---------------->| | | |
| 3541 | // | RESTSubDelResp| | | |
| 3542 | // |<----------------| | | |
| 3543 | // | | SubDelReq | | |
| 3544 | // | |------------->| | |
| 3545 | // | | SubDelResp | | |
| 3546 | // | |<-------------| | |
| 3547 | // | | SubDelReq | | |
| 3548 | // | |------------->| | |
| 3549 | // | | SubDelResp | | |
| 3550 | // | |<-------------| | |
| 3551 | // | RESTSubReq | | | |
| 3552 | // | [with RESTsubsId initial request] | |
| 3553 | // |---------------->| | | |
| 3554 | // | RESTSubResp | | | |
| 3555 | // |<----------------| | | |
| 3556 | // | | RouteCreate | | |
| 3557 | // | |--------------------------->| |
| 3558 | // | | RouteResponse| | |
| 3559 | // | |<---------------------------| |
| 3560 | // | | SubReq | | |
| 3561 | // | |------------->| | |
| 3562 | // | | SubResp | | |
| 3563 | // | |<-------------| | |
| 3564 | // | RESTNotif1 | | | |
| 3565 | // |<----------------| | | |
| 3566 | // | | | | |
| 3567 | // |
| 3568 | //----------------------------------------------------------------------------- |
| 3569 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3570 | |
| 3571 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3572 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3573 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3574 | Counter{cRestSubRespToXapp, 3}, |
| 3575 | Counter{cSubReqToE2, 3}, |
| 3576 | Counter{cSubRespFromE2, 3}, |
| 3577 | Counter{cRestSubNotifToXapp, 4}, |
| 3578 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3579 | Counter{cSubDelReqToE2, 3}, |
| 3580 | Counter{cSubDelRespFromE2, 3}, |
| 3581 | Counter{cRestSubDelRespToXapp, 2}, |
| 3582 | }) |
| 3583 | |
| 3584 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3585 | |
| 3586 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3587 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3588 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3589 | |
| 3590 | // Send modified requst, this time with e2 subscriptions. |
| 3591 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3592 | params2.SetSubscriptionID(&restSubId) |
| 3593 | |
| 3594 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3595 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3596 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3597 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3598 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3599 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3600 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3601 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3602 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3603 | |
| 3604 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3605 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3606 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3607 | assert.NotEqual(t, e2SubsId2, 0) |
| 3608 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3609 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3610 | |
| 3611 | // Delete both e2 subscriptions |
| 3612 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3613 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3614 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3615 | |
| 3616 | waitSubsCleanup(t, e2SubsId, 10) |
| 3617 | |
| 3618 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3619 | // but the restsubscription has been already removed. This shall trigger a |
| 3620 | // fresh create. |
| 3621 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3622 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3623 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3624 | |
| 3625 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3626 | |
| 3627 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3628 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3629 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3630 | } |
| 3631 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3632 | //----------------------------------------------------------------------------- |
| 3633 | // TestRESTSubDelReqRetransmission |
| 3634 | // |
| 3635 | // stub stub |
| 3636 | // +-------+ +---------+ +---------+ |
| 3637 | // | xapp | | submgr | | e2term | |
| 3638 | // +-------+ +---------+ +---------+ |
| 3639 | // | | | |
| 3640 | // | RESTSubReq | | |
| 3641 | // |---------------->| | |
| 3642 | // | | | |
| 3643 | // | RESTSubResp | | |
| 3644 | // |<----------------| | |
| 3645 | // | | SubReq | |
| 3646 | // | |------------->| |
| 3647 | // | | SubResp | |
| 3648 | // | |<-------------| |
| 3649 | // | RESTNotif1 | | |
| 3650 | // |<----------------| | |
| 3651 | // | | | |
| 3652 | // | RESTSubDelReq | | |
| 3653 | // |---------------->| | |
| 3654 | // | RESTSubDelResp | | |
| 3655 | // |<----------------| | |
| 3656 | // | | SubDelReq | |
| 3657 | // | |------------->| |
| 3658 | // | RESTSubDelReq | | |
| 3659 | // |---------------->| | |
| 3660 | // | RESTSubDelResp | | |
| 3661 | // |<----------------| | |
| 3662 | // | | SubDelResp | |
| 3663 | // | |<-------------| |
| 3664 | // | | | |
| 3665 | // |
| 3666 | //----------------------------------------------------------------------------- |
| 3667 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3668 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3669 | |
| 3670 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3671 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3672 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3673 | Counter{cSubReqToE2, 1}, |
| 3674 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3675 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3676 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3677 | Counter{cSubDelReqToE2, 1}, |
| 3678 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3679 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3680 | }) |
| 3681 | |
| 3682 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3683 | |
| 3684 | //Subs Create |
| 3685 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3686 | |
| 3687 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3688 | |
| 3689 | //Subs Delete |
| 3690 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3691 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3692 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3693 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3694 | seqBef := mainCtrl.get_msgcounter(t) |
| 3695 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3696 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3697 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3698 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3699 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3700 | |
| 3701 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3702 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3703 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3704 | } |
| 3705 | |
| 3706 | //----------------------------------------------------------------------------- |
| 3707 | // TestRESTSubReqDelReq |
| 3708 | // |
| 3709 | // stub stub |
| 3710 | // +-------+ +---------+ +---------+ |
| 3711 | // | xapp | | submgr | | e2term | |
| 3712 | // +-------+ +---------+ +---------+ |
| 3713 | // | | | |
| 3714 | // | RESTSubReq | | |
| 3715 | // |---------------->| | |
| 3716 | // | | | |
| 3717 | // | RESTSubResp | | |
| 3718 | // |<----------------| | |
| 3719 | // | | SubReq | |
| 3720 | // | |------------->| |
| 3721 | // | RESTSubDelReq | | |
| 3722 | // |---------------->| | |
| 3723 | // | RESTSubDelResp | | |
| 3724 | // | unsuccess | | |
| 3725 | // |<----------------| | |
| 3726 | // | | SubResp | |
| 3727 | // | |<-------------| |
| 3728 | // | RESTNotif1 | | |
| 3729 | // |<----------------| | |
| 3730 | // | | | |
| 3731 | // | [SUBS DELETE] | |
| 3732 | // | | | |
| 3733 | // |
| 3734 | //----------------------------------------------------------------------------- |
| 3735 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3736 | |
| 3737 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3738 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3739 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3740 | Counter{cSubReqToE2, 1}, |
| 3741 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3742 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3743 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3744 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3745 | Counter{cSubDelReqToE2, 1}, |
| 3746 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3747 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3748 | }) |
| 3749 | |
| 3750 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3751 | |
| 3752 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3753 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3754 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3755 | |
| 3756 | // Del. This will fail as processing of the subscription |
| 3757 | // is still ongoing in submgr. Deletion is not allowed before |
| 3758 | // subscription creation has been completed. |
| 3759 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3760 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3761 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3762 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3763 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3764 | |
| 3765 | // Retry del |
| 3766 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3767 | |
| 3768 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3769 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3770 | |
| 3771 | // Wait that subs is cleaned |
| 3772 | waitSubsCleanup(t, e2SubsId, 10) |
| 3773 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3774 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3775 | } |
| 3776 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3777 | //----------------------------------------------------------------------------- |
| 3778 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 3779 | // |
| 3780 | // stub stub stub |
| 3781 | // +-------+ +-------+ +---------+ +---------+ |
| 3782 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3783 | // +-------+ +-------+ +---------+ +---------+ |
| 3784 | // | | | | |
| 3785 | // | | RESTSubReq1 | | |
| 3786 | // | |------------->| | |
| 3787 | // | | RESTSubResp1 | | |
| 3788 | // | |<-------------| | |
| 3789 | // | | | | |
| 3790 | // | | | SubReq1 | |
| 3791 | // | | |------------->| |
| 3792 | // | | | | |
| 3793 | // | RESTSubReq2 | | |
| 3794 | // |------------------------>| | |
| 3795 | // | RESTSubResp2 | | |
| 3796 | // |<------------------------| | |
| 3797 | // | | | | |
| 3798 | // | | | SubReq2 | |
| 3799 | // | | |------------->| |
| 3800 | // | | | | |
| 3801 | // | | | SubResp1 | |
| 3802 | // | | |<-------------| |
| 3803 | // | | RESTNotif1 | | |
| 3804 | // | |<-------------| | |
| 3805 | // | | | | |
| 3806 | // | | | SubResp2 | |
| 3807 | // | | |<-------------| |
| 3808 | // | RESTNotif2 | | |
| 3809 | // |<------------------------| | |
| 3810 | // | | | | |
| 3811 | // | | [SUBS 1 DELETE] | |
| 3812 | // | | | | |
| 3813 | // | | [SUBS 2 DELETE] | |
| 3814 | // | | | | |
| 3815 | // |
| 3816 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3817 | |
| 3818 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3819 | |
| 3820 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3821 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3822 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3823 | Counter{cSubReqToE2, 2}, |
| 3824 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3825 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3826 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3827 | Counter{cSubDelReqToE2, 2}, |
| 3828 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3829 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3830 | }) |
| 3831 | |
| 3832 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3833 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3834 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3835 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3836 | |
| 3837 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3838 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3839 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3840 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3841 | |
| 3842 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3843 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3844 | |
| 3845 | //XappConn1 receives both of the responses |
| 3846 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3847 | |
| 3848 | //Resp1 |
| 3849 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3850 | //Resp2 |
| 3851 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3852 | |
| 3853 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3854 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3855 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3856 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3857 | |
| 3858 | //Del1 |
| 3859 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3860 | //Del2 |
| 3861 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3862 | |
| 3863 | //Wait that subs is cleaned |
| 3864 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3865 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3866 | |
| 3867 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3868 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3869 | } |
| 3870 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3871 | //----------------------------------------------------------------------------- |
| 3872 | // TestRESTSameSubsDiffRan |
| 3873 | // Same subscription to different RANs |
| 3874 | // |
| 3875 | // stub stub |
| 3876 | // +-------+ +---------+ +---------+ |
| 3877 | // | xapp | | submgr | | e2term | |
| 3878 | // +-------+ +---------+ +---------+ |
| 3879 | // | | | |
| 3880 | // | RESTSubReq(r1) | | |
| 3881 | // |---------------->| | |
| 3882 | // | RESTSubResp(r1) | | |
| 3883 | // |<----------------| | |
| 3884 | // | | | |
| 3885 | // | | SubReq(r1) | |
| 3886 | // | |------------->| |
| 3887 | // | | | |
| 3888 | // | | SubResp(r1) | |
| 3889 | // | |<-------------| |
| 3890 | // | | | |
| 3891 | // | RESTNotif(r1) | | |
| 3892 | // |<----------------| | |
| 3893 | // | | | |
| 3894 | // | RESTSubReq(r2) | | |
| 3895 | // |---------------->| | |
| 3896 | // | | | |
| 3897 | // | RESTSubResp(r2) | | |
| 3898 | // |<----------------| | |
| 3899 | // | | SubReq(r2) | |
| 3900 | // | |------------->| |
| 3901 | // | | | |
| 3902 | // | | SubResp(r2) | |
| 3903 | // | |<-------------| |
| 3904 | // | | | |
| 3905 | // | RESTNotif(r2) | | |
| 3906 | // |<----------------| | |
| 3907 | // | | | |
| 3908 | // | [SUBS r1 DELETE] | |
| 3909 | // | | | |
| 3910 | // | [SUBS r2 DELETE] | |
| 3911 | // | | | |
| 3912 | // |
| 3913 | //----------------------------------------------------------------------------- |
| 3914 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3915 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3916 | |
| 3917 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3918 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3919 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3920 | Counter{cSubReqToE2, 2}, |
| 3921 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3922 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3923 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3924 | Counter{cSubDelReqToE2, 2}, |
| 3925 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3926 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3927 | }) |
| 3928 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3929 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3930 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3931 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3932 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3933 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3934 | params.SetMeid("RAN_NAME_2") |
| 3935 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3936 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3937 | |
| 3938 | //Del1 |
| 3939 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3940 | //Del2 |
| 3941 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3942 | |
| 3943 | //Wait that subs is cleaned |
| 3944 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3945 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3946 | |
| 3947 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3948 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3949 | } |
| 3950 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 3951 | //----------------------------------------------------------------------------- |
| 3952 | // TestRESTSubReqRetryInSubmgr |
| 3953 | // |
| 3954 | // stub stub |
| 3955 | // +-------+ +---------+ +---------+ |
| 3956 | // | xapp | | submgr | | e2term | |
| 3957 | // +-------+ +---------+ +---------+ |
| 3958 | // | | | |
| 3959 | // | RESTSubReq | | |
| 3960 | // |---------------->| | |
| 3961 | // | RESTSubResp | | |
| 3962 | // |<----------------| | |
| 3963 | // | | SubReq | |
| 3964 | // | | | |
| 3965 | // | | | |
| 3966 | // | | SubReq | |
| 3967 | // | |------------->| |
| 3968 | // | | SubResp | |
| 3969 | // | |<-------------| |
| 3970 | // | | | |
| 3971 | // | RESTNotif | | |
| 3972 | // |<----------------| | |
| 3973 | // | | | |
| 3974 | // | [SUBS DELETE] | |
| 3975 | // | | | |
| 3976 | // |
| 3977 | //----------------------------------------------------------------------------- |
| 3978 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3979 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3980 | |
| 3981 | // Init counter check |
| 3982 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3983 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3984 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3985 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3986 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3987 | Counter{cSubReReqToE2, 1}, |
| 3988 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3989 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3990 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3991 | Counter{cSubDelReqToE2, 1}, |
| 3992 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3993 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3994 | }) |
| 3995 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3996 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3997 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3998 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3999 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4000 | |
| 4001 | // Catch the first message and ignore it |
| 4002 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4003 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4004 | |
| 4005 | // The second request is being handled normally |
| 4006 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4007 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4008 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4009 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4010 | |
| 4011 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4012 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4013 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4014 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4015 | |
| 4016 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4017 | //Wait that subs is cleaned |
| 4018 | waitSubsCleanup(t, e2SubsId, 10) |
| 4019 | |
| 4020 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4021 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4022 | } |
| 4023 | |
| 4024 | //----------------------------------------------------------------------------- |
| 4025 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4026 | // |
| 4027 | // stub stub |
| 4028 | // +-------+ +---------+ +---------+ |
| 4029 | // | xapp | | submgr | | e2term | |
| 4030 | // +-------+ +---------+ +---------+ |
| 4031 | // | | | |
| 4032 | // | RESTSubReq | | |
| 4033 | // |---------------->| | |
| 4034 | // | | | |
| 4035 | // | RESTSubResp | | |
| 4036 | // |<----------------| | |
| 4037 | // | | SubReq | |
| 4038 | // | |------------->| |
| 4039 | // | | | |
| 4040 | // | | | |
| 4041 | // | | SubReq | |
| 4042 | // | |------------->| |
| 4043 | // | | | |
| 4044 | // | | SubDelReq | |
| 4045 | // | |------------->| |
| 4046 | // | | | |
| 4047 | // | | | |
| 4048 | // | | SubDelReq | |
| 4049 | // | |------------->| |
| 4050 | // | | | |
| 4051 | // | | | |
| 4052 | // | | SubDelResp | |
| 4053 | // | |<-------------| |
| 4054 | // | RESTNotif | | |
| 4055 | // | unsuccess | | |
| 4056 | // |<----------------| | |
| 4057 | // | | | |
| 4058 | // | [SUBS DELETE] | |
| 4059 | // | | | |
| 4060 | // |
| 4061 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4062 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4063 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | |
| 4065 | // Init counter check |
| 4066 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4067 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4068 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4069 | Counter{cSubReqToE2, 1}, |
| 4070 | Counter{cSubReReqToE2, 1}, |
| 4071 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4072 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4073 | Counter{cSubDelReqToE2, 1}, |
| 4074 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4075 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4076 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4077 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4078 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4079 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4080 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4081 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4082 | |
| 4083 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4084 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4085 | |
| 4086 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4087 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4088 | |
| 4089 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4090 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4091 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4092 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4093 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4094 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4095 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4096 | // Wait that subs is cleaned |
| 4097 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4098 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4099 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4100 | } |
| 4101 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4102 | //----------------------------------------------------------------------------- |
| 4103 | // TestREST2eTermNotRespondingToSubReq |
| 4104 | // |
| 4105 | // stub stub |
| 4106 | // +-------+ +---------+ +---------+ |
| 4107 | // | xapp | | submgr | | e2term | |
| 4108 | // +-------+ +---------+ +---------+ |
| 4109 | // | | | |
| 4110 | // | RESTSubReq | | |
| 4111 | // |---------------->| | |
| 4112 | // | RESTSubResp | | |
| 4113 | // |<----------------| | |
| 4114 | // | | SubReq | |
| 4115 | // | |------------->| |
| 4116 | // | | | |
| 4117 | // | | SubReq | |
| 4118 | // | |------------->| |
| 4119 | // | | | |
| 4120 | // | | SubDelReq | |
| 4121 | // | |------------->| |
| 4122 | // | | | |
| 4123 | // | | SubDelReq | |
| 4124 | // | |------------->| |
| 4125 | // | RESTNotif(Unsuccessful) | |
| 4126 | // |<----------------| | |
| 4127 | // | | | |
| 4128 | // | RESTSubDelReq | | |
| 4129 | // |---------------->| | |
| 4130 | // | RESTSubDelResp | | |
| 4131 | // |<----------------| | |
| 4132 | // | | | |
| 4133 | // |
| 4134 | //----------------------------------------------------------------------------- |
| 4135 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4136 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4137 | |
| 4138 | // Init counter check |
| 4139 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4140 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4141 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4142 | Counter{cSubReqToE2, 1}, |
| 4143 | Counter{cSubReReqToE2, 1}, |
| 4144 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4145 | Counter{cSubDelReReqToE2, 1}, |
| 4146 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4147 | Counter{cSubDelReqToE2, 1}, |
| 4148 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4149 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4150 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4151 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4152 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4153 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4154 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4155 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4156 | |
| 4157 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4158 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4159 | |
| 4160 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4161 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4162 | |
| 4163 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4164 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4165 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4166 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4167 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4168 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4169 | |
| 4170 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4171 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4172 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4173 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4174 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4175 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4176 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4177 | } |
| 4178 | |
| 4179 | //----------------------------------------------------------------------------- |
| 4180 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4181 | // |
| 4182 | // stub stub |
| 4183 | // +-------+ +---------+ +---------+ |
| 4184 | // | xapp | | submgr | | e2term | |
| 4185 | // +-------+ +---------+ +---------+ |
| 4186 | // | | | |
| 4187 | // | RESTSubReq | | |
| 4188 | // |---------------->| | |
| 4189 | // | | | |
| 4190 | // | RESTSubResp | | |
| 4191 | // |<----------------| | |
| 4192 | // | | SubReq | |
| 4193 | // | |------------->| |
| 4194 | // | | | |
| 4195 | // | | | |
| 4196 | // | | SubReq | |
| 4197 | // | |------------->| |
| 4198 | // | | | |
| 4199 | // | | SubDelReq | |
| 4200 | // | |------------->| |
| 4201 | // | | | |
| 4202 | // | | | |
| 4203 | // | | SubDelReq | |
| 4204 | // | |------------->| |
| 4205 | // | | | |
| 4206 | // | | | |
| 4207 | // | | SubDelResp | |
| 4208 | // | |<-------------| |
| 4209 | // | RESTNotif | | |
| 4210 | // | unsuccess | | |
| 4211 | // |<----------------| | |
| 4212 | // | | | |
| 4213 | // | [SUBS DELETE] | |
| 4214 | // | | | |
| 4215 | // |
| 4216 | //----------------------------------------------------------------------------- |
| 4217 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4218 | |
| 4219 | // Init counter check |
| 4220 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4221 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4222 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4223 | Counter{cSubReqToE2, 1}, |
| 4224 | Counter{cSubReReqToE2, 1}, |
| 4225 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4226 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4227 | Counter{cSubDelReqToE2, 1}, |
| 4228 | Counter{cSubDelReReqToE2, 1}, |
| 4229 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4230 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4231 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4232 | }) |
| 4233 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4234 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4235 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4236 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4237 | |
| 4238 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4239 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4240 | |
| 4241 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4242 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4243 | |
| 4244 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4245 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4246 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4247 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4248 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4249 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4250 | |
| 4251 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4252 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4253 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4254 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4255 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4256 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4257 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4258 | } |
| 4259 | |
| 4260 | //----------------------------------------------------------------------------- |
| 4261 | // TestRESTSubReqSubFailRespInSubmgr |
| 4262 | // |
| 4263 | // stub stub |
| 4264 | // +-------+ +---------+ +---------+ |
| 4265 | // | xapp | | submgr | | e2term | |
| 4266 | // +-------+ +---------+ +---------+ |
| 4267 | // | | | |
| 4268 | // | RESTSubReq | | |
| 4269 | // |---------------->| | |
| 4270 | // | | | |
| 4271 | // | RESTSubResp | | |
| 4272 | // |<----------------| | |
| 4273 | // | | SubReq | |
| 4274 | // | |------------->| |
| 4275 | // | | | |
| 4276 | // | | SubFail | |
| 4277 | // | |<-------------| |
| 4278 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4279 | // | RESTNotif | | |
| 4280 | // | unsuccess | | |
| 4281 | // |<----------------| | |
| 4282 | // | | | |
| 4283 | // | [SUBS DELETE] | |
| 4284 | // | | | |
| 4285 | // |
| 4286 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4287 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4288 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4289 | |
| 4290 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4291 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4292 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4293 | Counter{cSubReqToE2, 1}, |
| 4294 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4295 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4296 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4297 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4298 | }) |
| 4299 | |
| 4300 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4301 | const e2Timeout int64 = 2 |
| 4302 | const e2RetryCount int64 = 1 |
| 4303 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4304 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4305 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4306 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4307 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4308 | |
| 4309 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4310 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4311 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4312 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4313 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4314 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4315 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4316 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4317 | |
| 4318 | // REST subscription sill there to be deleted |
| 4319 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4320 | |
| 4321 | // Wait that subs is cleaned |
| 4322 | waitSubsCleanup(t, e2SubsId, 10) |
| 4323 | |
| 4324 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4325 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4326 | } |
| 4327 | |
| 4328 | //----------------------------------------------------------------------------- |
| 4329 | // TestRESTSubDelReqRetryInSubmgr |
| 4330 | // |
| 4331 | // stub stub |
| 4332 | // +-------+ +---------+ +---------+ |
| 4333 | // | xapp | | submgr | | e2term | |
| 4334 | // +-------+ +---------+ +---------+ |
| 4335 | // | | | |
| 4336 | // | [SUBS CREATE] | |
| 4337 | // | | | |
| 4338 | // | | | |
| 4339 | // | RESTSubDelReq | | |
| 4340 | // |---------------->| | |
| 4341 | // | | | |
| 4342 | // | RESTSubDelResp | | |
| 4343 | // |<----------------| | |
| 4344 | // | | SubDelReq | |
| 4345 | // | |------------->| |
| 4346 | // | | | |
| 4347 | // | | SubDelReq | |
| 4348 | // | |------------->| |
| 4349 | // | | | |
| 4350 | // | | SubDelResp | |
| 4351 | // | |<-------------| |
| 4352 | // | | | |
| 4353 | // |
| 4354 | //----------------------------------------------------------------------------- |
| 4355 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4356 | |
| 4357 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4358 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4359 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4360 | Counter{cSubReqToE2, 1}, |
| 4361 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4362 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4363 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4364 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4365 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4366 | Counter{cSubDelReReqToE2, 1}, |
| 4367 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4368 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4369 | }) |
| 4370 | // Req |
| 4371 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4372 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4373 | |
| 4374 | // Del |
| 4375 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4376 | |
| 4377 | // E2t: Receive 1st SubsDelReq |
| 4378 | e2termConn1.RecvSubsDelReq(t) |
| 4379 | |
| 4380 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4381 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4382 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4383 | |
| 4384 | //Wait that subs is cleaned |
| 4385 | waitSubsCleanup(t, e2SubsId, 10) |
| 4386 | |
| 4387 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4388 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4389 | } |
| 4390 | |
| 4391 | //----------------------------------------------------------------------------- |
| 4392 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4393 | // |
| 4394 | // stub stub |
| 4395 | // +-------+ +---------+ +---------+ |
| 4396 | // | xapp | | submgr | | e2term | |
| 4397 | // +-------+ +---------+ +---------+ |
| 4398 | // | | | |
| 4399 | // | [SUBS CREATE] | |
| 4400 | // | | | |
| 4401 | // | | | |
| 4402 | // | RESTSubDelReq | | |
| 4403 | // |---------------->| | |
| 4404 | // | | | |
| 4405 | // | RESTSubDelResp | | |
| 4406 | // |<----------------| | |
| 4407 | // | | SubDelReq | |
| 4408 | // | |------------->| |
| 4409 | // | | | |
| 4410 | // | | SubDelReq | |
| 4411 | // | |------------->| |
| 4412 | // | | | |
| 4413 | // | | | |
| 4414 | // |
| 4415 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4416 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4417 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4418 | |
| 4419 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4420 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4421 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4422 | Counter{cSubReqToE2, 1}, |
| 4423 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4424 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4425 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4426 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4427 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4428 | Counter{cSubDelReReqToE2, 1}, |
| 4429 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4430 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4431 | }) |
| 4432 | |
| 4433 | // Req |
| 4434 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4435 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4436 | |
| 4437 | // Del |
| 4438 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4439 | |
| 4440 | // E2t: Receive 1st SubsDelReq |
| 4441 | e2termConn1.RecvSubsDelReq(t) |
| 4442 | |
| 4443 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4444 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4445 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4446 | |
| 4447 | //Wait that subs is cleaned |
| 4448 | waitSubsCleanup(t, e2SubsId, 10) |
| 4449 | |
| 4450 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4451 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4452 | } |
| 4453 | |
| 4454 | //----------------------------------------------------------------------------- |
| 4455 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4456 | // |
| 4457 | // stub stub |
| 4458 | // +-------+ +---------+ +---------+ |
| 4459 | // | xapp | | submgr | | e2term | |
| 4460 | // +-------+ +---------+ +---------+ |
| 4461 | // | | | |
| 4462 | // | [SUBS CREATE] | |
| 4463 | // | | | |
| 4464 | // | | | |
| 4465 | // | RESTSubDelReq | | |
| 4466 | // |---------------->| | |
| 4467 | // | | | |
| 4468 | // | RESTSubDelResp | | |
| 4469 | // |<----------------| | |
| 4470 | // | | SubDelReq | |
| 4471 | // | |------------->| |
| 4472 | // | | | |
| 4473 | // | | SubDelFail | |
| 4474 | // | |<-------------| |
| 4475 | // | | | |
| 4476 | // |
| 4477 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4478 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4479 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4480 | |
| 4481 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4482 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4483 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4484 | Counter{cSubReqToE2, 1}, |
| 4485 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4486 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4487 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4488 | Counter{cSubDelReqToE2, 1}, |
| 4489 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4490 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4491 | }) |
| 4492 | |
| 4493 | // Req |
| 4494 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4495 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4496 | |
| 4497 | // Del |
| 4498 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4499 | |
| 4500 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4501 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4502 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4503 | |
| 4504 | //Wait that subs is cleaned |
| 4505 | waitSubsCleanup(t, e2SubsId, 10) |
| 4506 | |
| 4507 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4508 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4509 | } |
| 4510 | |
| 4511 | //----------------------------------------------------------------------------- |
| 4512 | // TestRESTSubReqAndSubDelOkSameAction |
| 4513 | // |
| 4514 | // stub stub |
| 4515 | // +-------+ +-------+ +---------+ +---------+ |
| 4516 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4517 | // +-------+ +-------+ +---------+ +---------+ |
| 4518 | // | | | | |
| 4519 | // | | RESTSubReq1 | | |
| 4520 | // | |---------------->| | |
| 4521 | // | | | | |
| 4522 | // | | RESTSubResp1 | | |
| 4523 | // | |<----------------| | |
| 4524 | // | | | | |
| 4525 | // | | | SubReq1 | |
| 4526 | // | | |------------->| |
| 4527 | // | | | SubResp1 | |
| 4528 | // | | |<-------------| |
| 4529 | // | | RESTNotif1 | | |
| 4530 | // | |<----------------| | |
| 4531 | // | | | | |
| 4532 | // | RESTSubReq2 | | |
| 4533 | // |------------------------------>| | |
| 4534 | // | | | | |
| 4535 | // | RESTSubResp2 | | |
| 4536 | // |<------------------------------| | |
| 4537 | // | | | | |
| 4538 | // | | RESTNotif2 | | |
| 4539 | // |<------------------------------| | |
| 4540 | // | | | | |
| 4541 | // | | RESTSubDelReq1 | | |
| 4542 | // | |---------------->| | |
| 4543 | // | | | | |
| 4544 | // | | RESTSubDelResp1 | | |
| 4545 | // | |<----------------| | |
| 4546 | // | | | | |
| 4547 | // | RESTSubDelReq2 | | |
| 4548 | // |------------------------------>| | |
| 4549 | // | | | | |
| 4550 | // | RESTSubDelResp2 | | |
| 4551 | // |<------------------------------| | |
| 4552 | // | | | | |
| 4553 | // | | | SubDelReq2 | |
| 4554 | // | | |------------->| |
| 4555 | // | | | | |
| 4556 | // | | | SubDelResp2 | |
| 4557 | // | | |<-------------| |
| 4558 | // | | | | |
| 4559 | // |
| 4560 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4561 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4563 | |
| 4564 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4565 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4566 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4567 | Counter{cSubReqToE2, 1}, |
| 4568 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4569 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4570 | Counter{cMergedSubscriptions, 1}, |
| 4571 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4572 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4573 | Counter{cSubDelReqToE2, 1}, |
| 4574 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4575 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4576 | }) |
| 4577 | |
| 4578 | // Req1 |
| 4579 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4580 | |
| 4581 | //Subs Create |
| 4582 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4583 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4584 | |
| 4585 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4586 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4587 | params.SetMeid("RAN_NAME_1") |
| 4588 | |
| 4589 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4590 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4591 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4592 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4593 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4594 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4595 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4596 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4597 | |
| 4598 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4599 | |
| 4600 | // Del1 |
| 4601 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4602 | |
| 4603 | // Del2 |
| 4604 | deleteXapp2Subscription(t, &restSubId2) |
| 4605 | |
| 4606 | //Wait that subs is cleaned |
| 4607 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4608 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4609 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4610 | } |
| 4611 | |
| 4612 | //----------------------------------------------------------------------------- |
| 4613 | // TestSubReqAndSubDelOkSameActionParallel |
| 4614 | // |
| 4615 | // stub stub stub |
| 4616 | // +-------+ +-------+ +---------+ +---------+ |
| 4617 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4618 | // +-------+ +-------+ +---------+ +---------+ |
| 4619 | // | | | | |
| 4620 | // | | | | |
| 4621 | // | | | | |
| 4622 | // | | SubReq1 | | |
| 4623 | // | |------------->| | |
| 4624 | // | | | | |
| 4625 | // | | | SubReq1 | |
| 4626 | // | | |------------->| |
| 4627 | // | SubReq2 | | |
| 4628 | // |--------------------------->| | |
| 4629 | // | | | SubResp1 | |
| 4630 | // | | |<-------------| |
| 4631 | // | | SubResp1 | | |
| 4632 | // | |<-------------| | |
| 4633 | // | | | SubReq2 | |
| 4634 | // | | |------------->| |
| 4635 | // | | | | |
| 4636 | // | | | SubResp2 | |
| 4637 | // | | |<-------------| |
| 4638 | // | SubResp2 | | |
| 4639 | // |<---------------------------| | |
| 4640 | // | | | | |
| 4641 | // | | SubDelReq 1 | | |
| 4642 | // | |------------->| | |
| 4643 | // | | | | |
| 4644 | // | | SubDelResp 1 | | |
| 4645 | // | |<-------------| | |
| 4646 | // | | | | |
| 4647 | // | SubDelReq 2 | | |
| 4648 | // |--------------------------->| | |
| 4649 | // | | | | |
| 4650 | // | | | SubDelReq 2 | |
| 4651 | // | | |------------->| |
| 4652 | // | | | | |
| 4653 | // | | | SubDelReq 2 | |
| 4654 | // | | |------------->| |
| 4655 | // | | | | |
| 4656 | // | SubDelResp 2 | | |
| 4657 | // |<---------------------------| | |
| 4658 | // |
| 4659 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4660 | |
| 4661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4662 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4663 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4664 | Counter{cSubReqToE2, 2}, |
| 4665 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4666 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4667 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4668 | Counter{cSubDelReqToE2, 2}, |
| 4669 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4670 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4671 | }) |
| 4672 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4673 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4674 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4675 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4676 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4677 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4678 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4679 | |
| 4680 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4681 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4682 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4683 | |
| 4684 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4685 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4686 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4687 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4688 | |
| 4689 | // Del1 |
| 4690 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4691 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4692 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4693 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4694 | |
| 4695 | // Del2 |
| 4696 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4697 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4698 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4699 | |
| 4700 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4701 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4702 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4703 | } |
| 4704 | |
| 4705 | //----------------------------------------------------------------------------- |
| 4706 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4707 | // |
| 4708 | // stub stub stub |
| 4709 | // +-------+ +-------+ +---------+ +---------+ |
| 4710 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4711 | // +-------+ +-------+ +---------+ +---------+ |
| 4712 | // | | | | |
| 4713 | // | | | | |
| 4714 | // | | | | |
| 4715 | // | | RESTSubReq1 | | |
| 4716 | // | |---------------->| | |
| 4717 | // | | | | |
| 4718 | // | | RESTSubResp1 | | |
| 4719 | // | |<----------------| | |
| 4720 | // | | | SubReq1 | |
| 4721 | // | | |------------->| |
| 4722 | // | RESTSubReq2 | | |
| 4723 | // |------------------------------>| | |
| 4724 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4725 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4726 | // |<------------------------------| | |
| 4727 | // | | | SubReq1 | |
| 4728 | // | | |------------->| |
| 4729 | // | | | | |
| 4730 | // | | | | |
| 4731 | // | | | SubDelReq | |
| 4732 | // | | |------------->| |
| 4733 | // | | | | |
| 4734 | // | | | SubDelResp | |
| 4735 | // | | |<-------------| |
| 4736 | // | | RESTNotif1 | | |
| 4737 | // | | unsuccess | | |
| 4738 | // | |<----------------| | |
| 4739 | // | RESTNotif2 | | |
| 4740 | // | | unsuccess | | |
| 4741 | // |<------------------------------| | |
| 4742 | // | | | | |
| 4743 | // | | RESTSubDelReq1 | | |
| 4744 | // | |---------------->| | |
| 4745 | // | | | | |
| 4746 | // | | RESTSubDelResp1 | | |
| 4747 | // | |<----------------| | |
| 4748 | // | | | | |
| 4749 | // | RESTSubDelReq2 | | |
| 4750 | // |------------------------------>| | |
| 4751 | // | | | | |
| 4752 | // | RESTSubDelResp2 | | |
| 4753 | // |<------------------------------| | |
| 4754 | // |
| 4755 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4756 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4757 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4758 | |
| 4759 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4760 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4761 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4762 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4763 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4764 | Counter{cSubReqTimerExpiry, 2}, |
| 4765 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4766 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4767 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4768 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4769 | Counter{cSubDelReqToE2, 1}, |
| 4770 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4771 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4772 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4773 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4774 | |
| 4775 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4776 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4777 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4778 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4779 | |
| 4780 | // Req2 |
| 4781 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4782 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4783 | params2.SetMeid("RAN_NAME_1") |
| 4784 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4785 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4786 | |
| 4787 | //Req1 (retransmitted) |
| 4788 | e2termConn1.RecvSubsReq(t) |
| 4789 | |
| 4790 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4791 | |
| 4792 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4793 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4794 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4795 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4796 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4797 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4798 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4799 | |
| 4800 | // Del1 |
| 4801 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4802 | |
| 4803 | // Del2 |
| 4804 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4805 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4806 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4807 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4808 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4809 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4810 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4811 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4812 | } |
| 4813 | |
| 4814 | //----------------------------------------------------------------------------- |
| 4815 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4816 | // |
| 4817 | // stub stub stub |
| 4818 | // +-------+ +-------+ +---------+ +---------+ |
| 4819 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4820 | // +-------+ +-------+ +---------+ +---------+ |
| 4821 | // | | | | |
| 4822 | // | | | | |
| 4823 | // | | | | |
| 4824 | // | | RESTSubReq1 | | |
| 4825 | // | |---------------->| | |
| 4826 | // | | | | |
| 4827 | // | | RESTSubResp1 | | |
| 4828 | // | |<----------------| | |
| 4829 | // | | | SubReq1 | |
| 4830 | // | | |------------->| |
| 4831 | // | RESTSubReq2 | | |
| 4832 | // |------------------------------>| | |
| 4833 | // | | | | |
| 4834 | // | RESTSubDelResp2 | | |
| 4835 | // |<------------------------------| | |
| 4836 | // | | | SubFail1 | |
| 4837 | // | | |<-------------| |
| 4838 | // | | | | |
| 4839 | // | | RESTNotif1 | | |
| 4840 | // | | unsuccess | | |
| 4841 | // | |<----------------| | |
| 4842 | // | RESTNotif2 | | |
| 4843 | // | | unsuccess | | |
| 4844 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4845 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4846 | // | | RESTSubDelReq1 | | There is no need for xApp to send delete for failed subscriptions but some xApp might do so. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4847 | // | |---------------->| | |
| 4848 | // | | | | |
| 4849 | // | | RESTSubDelResp1 | | |
| 4850 | // | |<----------------| | |
| 4851 | // | | | | |
| 4852 | // | RESTSubDelReq2 | | |
| 4853 | // |------------------------------>| | |
| 4854 | // | | | | |
| 4855 | // | RESTSubDelResp2 | | |
| 4856 | // |<------------------------------| | |
| 4857 | // |
| 4858 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4859 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4860 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4861 | |
| 4862 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4863 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4864 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4865 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4866 | Counter{cSubReqToE2, 1}, |
| 4867 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4868 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4869 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4870 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4871 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4872 | }) |
| 4873 | |
| 4874 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4875 | |
| 4876 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4877 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4878 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4879 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4880 | |
| 4881 | // Req2 |
| 4882 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4883 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4884 | params2.SetMeid("RAN_NAME_1") |
| 4885 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4886 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4887 | |
| 4888 | // E2t: send SubsFail (first) |
| 4889 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4890 | fparams1.Set(crereq1) |
| 4891 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4892 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4893 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4894 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4895 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4896 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4897 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4898 | |
| 4899 | // Del1 |
| 4900 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4901 | |
| 4902 | // Del2 |
| 4903 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4904 | |
| 4905 | //Wait that subs is cleaned |
| 4906 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4907 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4908 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4909 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4910 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4911 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 4912 | //----------------------------------------------------------------------------- |
| 4913 | // TestRESTSubReqPolicyAndSubDelOk |
| 4914 | // |
| 4915 | // stub stub |
| 4916 | // +-------+ +---------+ +---------+ |
| 4917 | // | xapp | | submgr | | e2term | |
| 4918 | // +-------+ +---------+ +---------+ |
| 4919 | // | | | |
| 4920 | // | RESTSubReq | | |
| 4921 | // |--------------->| | |
| 4922 | // | RESTSubResp | | |
| 4923 | // |<---------------| | |
| 4924 | // | | | |
| 4925 | // | | SubReq | |
| 4926 | // | |------------->| |
| 4927 | // | | | |
| 4928 | // | | SubResp | |
| 4929 | // | |<-------------| |
| 4930 | // | | | |
| 4931 | // | RESTNotif | | |
| 4932 | // |<---------------| | |
| 4933 | // | | | |
| 4934 | // | | | |
| 4935 | // | RESTSubDelReq | | |
| 4936 | // |--------------->| | |
| 4937 | // | RESTSubDelResp | | |
| 4938 | // |<---------------| | |
| 4939 | // | | | |
| 4940 | // | | SubDelReq | |
| 4941 | // | |------------->| |
| 4942 | // | | | |
| 4943 | // | | SubDelResp | |
| 4944 | // | |<-------------| |
| 4945 | // | | | |
| 4946 | // |
| 4947 | //----------------------------------------------------------------------------- |
| 4948 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4949 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4950 | |
| 4951 | // Init counter check |
| 4952 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4953 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4954 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4955 | Counter{cSubReqToE2, 1}, |
| 4956 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4957 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4958 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4959 | Counter{cSubDelReqToE2, 1}, |
| 4960 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4961 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4962 | }) |
| 4963 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4964 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4965 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4966 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4967 | |
| 4968 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4969 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4970 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4971 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4972 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4973 | |
| 4974 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4975 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4976 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4977 | |
| 4978 | // Wait that subs is cleaned |
| 4979 | waitSubsCleanup(t, e2SubsId, 10) |
| 4980 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4981 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4982 | } |
| 4983 | |
| 4984 | //----------------------------------------------------------------------------- |
| 4985 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4986 | // |
| 4987 | // stub stub |
| 4988 | // +-------+ +---------+ +---------+ |
| 4989 | // | xapp | | submgr | | e2term | |
| 4990 | // +-------+ +---------+ +---------+ |
| 4991 | // | | | |
| 4992 | // | RESTSubReq | | |
| 4993 | // |---------------->| | |
| 4994 | // | | | |
| 4995 | // | RESTSubResp | | |
| 4996 | // |<----------------| | |
| 4997 | // | | SubReq | |
| 4998 | // | |------------->| |
| 4999 | // | | | |
| 5000 | // | | SubResp | |
| 5001 | // | |<-------------| |
| 5002 | // | | | |
| 5003 | // | RESTNotif | | |
| 5004 | // |<----------------| | |
| 5005 | // | | | |
| 5006 | // | RESTSubReq | | |
| 5007 | // |---------------->| | |
| 5008 | // | | | |
| 5009 | // | RESTSubResp | | |
| 5010 | // |<----------------| | |
| 5011 | // | | SubReq | |
| 5012 | // | |------------->| |
| 5013 | // | | | |
| 5014 | // | | SubResp | |
| 5015 | // | |<-------------| |
| 5016 | // | | | |
| 5017 | // | RESTNotif | | |
| 5018 | // |<----------------| | |
| 5019 | // | | | |
| 5020 | // | RESTSubDelReq | | |
| 5021 | // |---------------->| | |
| 5022 | // | | | |
| 5023 | // | | SubDelReq | |
| 5024 | // | |------------->| |
| 5025 | // | | | |
| 5026 | // | | SubDelResp | |
| 5027 | // | |<-------------| |
| 5028 | // | | | |
| 5029 | // | RESTSubDelResp | | |
| 5030 | // |<----------------| | |
| 5031 | // |
| 5032 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5033 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5034 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5035 | |
| 5036 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5037 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5038 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5039 | Counter{cSubReqToE2, 2}, |
| 5040 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5041 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5042 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5043 | Counter{cSubDelReqToE2, 1}, |
| 5044 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5045 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5046 | }) |
| 5047 | |
| 5048 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5049 | const e2Timeout int64 = 1 |
| 5050 | const e2RetryCount int64 = 0 |
| 5051 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5052 | |
| 5053 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5054 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5055 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5056 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5057 | |
| 5058 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5059 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5060 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5061 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5062 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5063 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5064 | params.SetTimeToWait("w200ms") |
| 5065 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5066 | |
| 5067 | // Del |
| 5068 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5069 | |
| 5070 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5071 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5072 | |
| 5073 | // Wait that subs is cleaned |
| 5074 | waitSubsCleanup(t, e2SubsId, 10) |
| 5075 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5076 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5077 | } |
| 5078 | |
| 5079 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5080 | // TestRESTSubReqPolicyChangeNOk |
| 5081 | // |
| 5082 | // stub stub |
| 5083 | // +-------+ +---------+ +---------+ |
| 5084 | // | xapp | | submgr | | e2term | |
| 5085 | // +-------+ +---------+ +---------+ |
| 5086 | // | | | |
| 5087 | // | RESTSubReq | | |
| 5088 | // |---------------->| | |
| 5089 | // | | | |
| 5090 | // | RESTSubResp | | |
| 5091 | // |<----------------| | |
| 5092 | // | | SubReq | |
| 5093 | // | |------------->| |
| 5094 | // | | | |
| 5095 | // | | SubResp | |
| 5096 | // | |<-------------| |
| 5097 | // | | | |
| 5098 | // | RESTNotif | | |
| 5099 | // |<----------------| | |
| 5100 | // | | | |
| 5101 | // | RESTSubReq | | |
| 5102 | // |---------------->| | |
| 5103 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5104 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5105 | // | | | |
| 5106 | // | RESTSubDelReq | | |
| 5107 | // |---------------->| | |
| 5108 | // | | | |
| 5109 | // | | SubDelReq | |
| 5110 | // | |------------->| |
| 5111 | // | | | |
| 5112 | // | | SubDelResp | |
| 5113 | // | |<-------------| |
| 5114 | // | | | |
| 5115 | // | RESTSubDelResp | | |
| 5116 | // |<----------------| | |
| 5117 | // |
| 5118 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5119 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5120 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5121 | |
| 5122 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5123 | Counter{cRestSubReqFromXapp, 2}, |
| 5124 | Counter{cRestSubRespToXapp, 1}, |
| 5125 | Counter{cSubReqToE2, 1}, |
| 5126 | Counter{cSubRespFromE2, 1}, |
| 5127 | Counter{cRestSubNotifToXapp, 1}, |
| 5128 | Counter{cRestSubFailToXapp, 1}, |
| 5129 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5130 | Counter{cSubDelReqToE2, 1}, |
| 5131 | Counter{cSubDelRespFromE2, 1}, |
| 5132 | Counter{cRestSubDelRespToXapp, 1}, |
| 5133 | }) |
| 5134 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5135 | // Req |
| 5136 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5137 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5138 | |
| 5139 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5140 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5141 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5142 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5143 | params.SetSubscriptionID(&restSubIdUpd) |
| 5144 | params.SetTimeToWait("w200ms") |
| 5145 | |
| 5146 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5147 | assert.Equal(t, restSubId2, "") |
| 5148 | |
| 5149 | // Del |
| 5150 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5151 | |
| 5152 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5153 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5154 | |
| 5155 | // Wait that subs is cleaned |
| 5156 | waitSubsCleanup(t, e2SubsId, 10) |
| 5157 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5158 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5159 | } |
| 5160 | |
| 5161 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5162 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5163 | // |
| 5164 | // stub stub stub |
| 5165 | // +-------+ +---------+ +---------+ +---------+ |
| 5166 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5167 | // +-------+ +---------+ +---------+ +---------+ |
| 5168 | // | | | | |
| 5169 | // | | | | |
| 5170 | // | | | | |
| 5171 | // | RESTSubReq1 | | | |
| 5172 | // |---------------->| | | |
| 5173 | // | | | | |
| 5174 | // | RESTSubResp1 | | | |
| 5175 | // |<----------------| | | |
| 5176 | // | | SubReq1 | | |
| 5177 | // | |------------->| | |
| 5178 | // | | | | |
| 5179 | // | RESTSubReq2 | | | |
| 5180 | // |---------------->| | | |
| 5181 | // | | | | |
| 5182 | // | RESTSubResp2 | | | |
| 5183 | // |<----------------| | | |
| 5184 | // | | SubReq2 | | |
| 5185 | // | |---------------------------->| |
| 5186 | // | | | | |
| 5187 | // | | SubResp1 | | |
| 5188 | // | |<-------------| | |
| 5189 | // | RESTNotif1 | | | |
| 5190 | // |<----------------| | | |
| 5191 | // | | SubResp2 | | |
| 5192 | // | |<----------------------------| |
| 5193 | // | RESTNotif2 | | | |
| 5194 | // |<----------------| | | |
| 5195 | // | | | | |
| 5196 | // | [SUBS 1 DELETE] | | |
| 5197 | // | | | | |
| 5198 | // | [SUBS 2 DELETE] | | |
| 5199 | // | | | | |
| 5200 | // |
| 5201 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5202 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5203 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5204 | |
| 5205 | // Init counter check |
| 5206 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5207 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5208 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5209 | Counter{cSubReqToE2, 2}, |
| 5210 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5211 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5212 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5213 | Counter{cSubDelReqToE2, 2}, |
| 5214 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5215 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5216 | }) |
| 5217 | |
| 5218 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5219 | |
| 5220 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5221 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5222 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5223 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5224 | |
| 5225 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5226 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5227 | params.SetMeid("RAN_NAME_11") |
| 5228 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5229 | // would not work as notification would not be received |
| 5230 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5231 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5232 | |
| 5233 | // Resp1 |
| 5234 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5235 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5236 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5237 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5238 | |
| 5239 | // Resp2 |
| 5240 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5241 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5242 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5243 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5244 | |
| 5245 | // Delete1 |
| 5246 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5247 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5248 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5249 | |
| 5250 | // Wait that subs is cleaned |
| 5251 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5252 | |
| 5253 | // Delete2 |
| 5254 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5255 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5256 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5257 | |
| 5258 | // Wait that subs is cleaned |
| 5259 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5260 | |
| 5261 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5262 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5263 | } |
| 5264 | |
| 5265 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5266 | // TestRESTSubReqInsertAndSubDelOk |
| 5267 | // |
| 5268 | // stub stub |
| 5269 | // +-------+ +---------+ +---------+ |
| 5270 | // | xapp | | submgr | | e2term | |
| 5271 | // +-------+ +---------+ +---------+ |
| 5272 | // | | | |
| 5273 | // | RestSubReq | | |
| 5274 | // |---------------->| | |
| 5275 | // | | | |
| 5276 | // | RESTSubResp | | |
| 5277 | // |<----------------| | |
| 5278 | // | | | |
| 5279 | // | | SubReq | |
| 5280 | // | |------------->| |
| 5281 | // | | | |
| 5282 | // | | SubResp | |
| 5283 | // | |<-------------| |
| 5284 | // | RESTNotif | | |
| 5285 | // |<----------------| | |
| 5286 | // | ... | ... | |
| 5287 | // | | | |
| 5288 | // | RESTSubDelReq | | |
| 5289 | // |---------------->| | |
| 5290 | // | | | |
| 5291 | // | | SubDelReq | |
| 5292 | // | |------------->| |
| 5293 | // | | | |
| 5294 | // | | SubDelResp | |
| 5295 | // | |<-------------| |
| 5296 | // | | | |
| 5297 | // | RESTSubDelResp| | |
| 5298 | // |<----------------| | |
| 5299 | // |
| 5300 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5301 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5302 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5303 | |
| 5304 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5305 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5306 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5307 | Counter{cSubReqToE2, 1}, |
| 5308 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5309 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5310 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5311 | Counter{cSubDelReqToE2, 1}, |
| 5312 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5313 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5314 | }) |
| 5315 | |
| 5316 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5317 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5318 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5319 | params.SetSubActionTypes("insert") |
| 5320 | |
| 5321 | // Req |
| 5322 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5323 | |
| 5324 | // Del |
| 5325 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5326 | |
| 5327 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5328 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5329 | |
| 5330 | // Wait that subs is cleaned |
| 5331 | waitSubsCleanup(t, e2SubsId, 10) |
| 5332 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5333 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5334 | } |
| 5335 | |
| 5336 | //----------------------------------------------------------------------------- |
| 5337 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5338 | // |
| 5339 | // stub stub |
| 5340 | // +-------+ +---------+ +---------+ |
| 5341 | // | xapp | | submgr | | e2term | |
| 5342 | // +-------+ +---------+ +---------+ |
| 5343 | // | | | |
| 5344 | // | RESTSubReq | | |
| 5345 | // |------------->| | |
| 5346 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5347 | // | RESTSubResp | | |
| 5348 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5349 | // | | SubReq | |
| 5350 | // | |------------->| |
| 5351 | // | | | |
| 5352 | // | | SubResp | |
| 5353 | // | <----| |
| 5354 | // | | |
| 5355 | // | Submgr restart | |
| 5356 | // | | |
| 5357 | // | | | |
| 5358 | // | | SubDelReq | |
| 5359 | // | |------------->| |
| 5360 | // | | | |
| 5361 | // | | SubDelResp | |
| 5362 | // | |<-------------| |
| 5363 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5364 | // | RESTNotif | | |
| 5365 | // | unsuccess | | |
| 5366 | // |<-------------| | |
| 5367 | // | | | |
| 5368 | // | RESTSubDelReq| | |
| 5369 | // |------------->| | |
| 5370 | // | | | |
| 5371 | // |RESTSubDelResp| | |
| 5372 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5373 | // |
| 5374 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5375 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5376 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5377 | |
| 5378 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5379 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5380 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5381 | Counter{cSubReqToE2, 1}, |
| 5382 | Counter{cSubDelReqFromXapp, 1}, |
| 5383 | Counter{cSubDelReqToE2, 1}, |
| 5384 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5385 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5386 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5387 | }) |
| 5388 | |
| 5389 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5390 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5391 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5392 | |
| 5393 | //Req |
| 5394 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5395 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5396 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | |
| 5398 | e2termConn1.RecvSubsReq(t) |
| 5399 | |
| 5400 | mainCtrl.SetResetTestFlag(t, false) |
| 5401 | |
| 5402 | mainCtrl.SimulateRestart(t) |
| 5403 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5404 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5405 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5406 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5407 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5408 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5409 | //Del |
| 5410 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5411 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5412 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5413 | e2termConn1.TestMsgChanEmpty(t) |
| 5414 | mainCtrl.wait_registry_empty(t, 10) |
| 5415 | |
| 5416 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5417 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5418 | } |
| 5419 | |
| 5420 | //----------------------------------------------------------------------------- |
| 5421 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5422 | // |
| 5423 | // stub stub |
| 5424 | // +-------+ +---------+ +---------+ |
| 5425 | // | xapp | | submgr | | e2term | |
| 5426 | // +-------+ +---------+ +---------+ |
| 5427 | // | | | |
| 5428 | // | RESTSubReq | | |
| 5429 | // |---------------->| | |
| 5430 | // | | | |
| 5431 | // | RESTSubResp | | |
| 5432 | // |<----------------| | |
| 5433 | // | | SubReq | |
| 5434 | // | |------------->| |
| 5435 | // | | | |
| 5436 | // | | SubResp | |
| 5437 | // | |<-------------| |
| 5438 | // | | | |
| 5439 | // | RESTNotif | | |
| 5440 | // |<----------------| | |
| 5441 | // | | | |
| 5442 | // | | |
| 5443 | // | Submgr restart | |
| 5444 | // | | | |
| 5445 | // | RESTSubDelReq | | |
| 5446 | // |---------------->| | |
| 5447 | // | | | |
| 5448 | // | | SubDelReq | |
| 5449 | // | |------------->| |
| 5450 | // | | | |
| 5451 | // | | SubDelResp | |
| 5452 | // | |<-------------| |
| 5453 | // | | | |
| 5454 | // | RESTSubDelResp | | |
| 5455 | // |<----------------| | |
| 5456 | // |
| 5457 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5458 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5459 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5460 | |
| 5461 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5462 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5463 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5464 | Counter{cSubReqToE2, 1}, |
| 5465 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5466 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5467 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5468 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5469 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5470 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5471 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5472 | |
| 5473 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5474 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5475 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5476 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5477 | |
| 5478 | // Check subscription |
| 5479 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5480 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5481 | mainCtrl.SimulateRestart(t) |
| 5482 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5483 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5484 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5485 | // That needs to be completed before successful subscription query is possible |
| 5486 | <-time.After(time.Second * 1) |
| 5487 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5488 | // Check subscription |
| 5489 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5490 | |
| 5491 | // Delete subscription |
| 5492 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5493 | |
| 5494 | //Wait that subs is cleaned |
| 5495 | waitSubsCleanup(t, e2SubsId, 10) |
| 5496 | |
| 5497 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5498 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5499 | } |
| 5500 | |
| 5501 | //----------------------------------------------------------------------------- |
| 5502 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5503 | // |
| 5504 | // stub stub |
| 5505 | // +-------+ +-------+ +---------+ +---------+ |
| 5506 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5507 | // +-------+ +-------+ +---------+ +---------+ |
| 5508 | // | | | | |
| 5509 | // | | RESTSubReq1 | | |
| 5510 | // | |---------------->| | |
| 5511 | // | | | | |
| 5512 | // | | RESTSubResp1 | | |
| 5513 | // | |<----------------| | |
| 5514 | // | | | | |
| 5515 | // | | | SubReq1 | |
| 5516 | // | | |------------->| |
| 5517 | // | | | SubResp1 | |
| 5518 | // | | |<-------------| |
| 5519 | // | | RESTNotif1 | | |
| 5520 | // | |<----------------| | |
| 5521 | // | | | | |
| 5522 | // | RESTSubReq2 | | |
| 5523 | // |------------------------------>| | |
| 5524 | // | | | | |
| 5525 | // | RESTSubResp2 | | |
| 5526 | // |<------------------------------| | |
| 5527 | // | | | | |
| 5528 | // | | RESTNotif2 | | |
| 5529 | // |<------------------------------| | |
| 5530 | // | | | | |
| 5531 | // | | Submgr restart | |
| 5532 | // | | | | |
| 5533 | // | | RESTSubDelReq1 | | |
| 5534 | // | |---------------->| | |
| 5535 | // | | | | |
| 5536 | // | | RESTSubDelResp1 | | |
| 5537 | // | |<----------------| | |
| 5538 | // | | | | |
| 5539 | // | | Submgr restart | |
| 5540 | // | | | | |
| 5541 | // | RESTSubDelReq2 | | |
| 5542 | // |------------------------------>| | |
| 5543 | // | | | | |
| 5544 | // | RESTSubDelResp2 | | |
| 5545 | // |<------------------------------| | |
| 5546 | // | | | | |
| 5547 | // | | | SubDelReq2 | |
| 5548 | // | | |------------->| |
| 5549 | // | | | | |
| 5550 | // | | | SubDelResp2 | |
| 5551 | // | | |<-------------| |
| 5552 | // | | | | |
| 5553 | // |
| 5554 | //----------------------------------------------------------------------------- |
| 5555 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5556 | |
| 5557 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5558 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5559 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5560 | Counter{cSubReqToE2, 1}, |
| 5561 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5562 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5563 | Counter{cMergedSubscriptions, 1}, |
| 5564 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5565 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5566 | Counter{cSubDelReqToE2, 1}, |
| 5567 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5568 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5569 | }) |
| 5570 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5571 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5572 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5573 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5574 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5575 | |
| 5576 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5577 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5578 | params.SetMeid("RAN_NAME_1") |
| 5579 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5580 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5581 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5582 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5583 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5584 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5585 | |
| 5586 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5587 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5588 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5589 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5590 | |
| 5591 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5592 | // That needs to be completed before successful subscription delete is possible |
| 5593 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5594 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5595 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5596 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 5597 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5598 | // Above wait does not work correctly anymore as this delay makes this test case work |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5599 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5600 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5601 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5602 | |
| 5603 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5604 | // That needs to be completed before successful subscription query is possible |
| 5605 | <-time.After(time.Second * 1) |
| 5606 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5607 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5608 | |
| 5609 | // Delete subscription 2 |
| 5610 | deleteXapp2Subscription(t, &restSubId2) |
| 5611 | |
| 5612 | //Wait that subs is cleaned |
| 5613 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5614 | |
| 5615 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5616 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5617 | } |
| 5618 | |
| 5619 | //----------------------------------------------------------------------------- |
| 5620 | // TestRESTReportSubReqAndSubDelOk |
| 5621 | // |
| 5622 | // stub stub |
| 5623 | // +-------+ +---------+ +---------+ |
| 5624 | // | xapp | | submgr | | e2term | |
| 5625 | // +-------+ +---------+ +---------+ |
| 5626 | // | | | |
| 5627 | // | RestSubReq | | |
| 5628 | // |---------------->| | |
| 5629 | // | | | |
| 5630 | // | RESTSubResp | | |
| 5631 | // |<----------------| | |
| 5632 | // | | | |
| 5633 | // | | SubReq | |
| 5634 | // | |------------->| |
| 5635 | // | | | |
| 5636 | // | | SubResp | |
| 5637 | // | |<-------------| |
| 5638 | // | RESTNotif | | |
| 5639 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5640 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5641 | // | |------------->| |
| 5642 | // | | | |
| 5643 | // | | SubResp | |
| 5644 | // | |<-------------| |
| 5645 | // | RESTNotif | | |
| 5646 | // |<----------------| | |
| 5647 | // | ... | ... | |
| 5648 | // | | | |
| 5649 | // | | | |
| 5650 | // | RESTSubDelReq | | |
| 5651 | // |---------------->| | |
| 5652 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 5653 | // | RESTSubDelResp| | |
| 5654 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5655 | // | | SubDelReq | |
| 5656 | // | |------------->| |
| 5657 | // | | | |
| 5658 | // | | SubDelResp | |
| 5659 | // | |<-------------| |
| 5660 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5661 | // |
| 5662 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5663 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5664 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5665 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5666 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5667 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5668 | } |
| 5669 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5670 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5671 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5672 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 5673 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5674 | Counter{cRestSubReqFromXapp, 1}, |
| 5675 | Counter{cRestSubRespToXapp, 1}, |
| 5676 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5677 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 5678 | Counter{cRestSubNotifToXapp, 1}, |
| 5679 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5680 | Counter{cRestSubDelRespToXapp, 1}, |
| 5681 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5682 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 5683 | }) |
| 5684 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5685 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5686 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5687 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5688 | |
| 5689 | var e2SubsId []uint32 |
| 5690 | for i := 0; i < subReqCount; i++ { |
| 5691 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5692 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5693 | |
| 5694 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5695 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5696 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5697 | e2SubsId = append(e2SubsId, instanceId) |
| 5698 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5699 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5700 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5701 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5702 | |
| 5703 | } |
| 5704 | |
| 5705 | // Del |
| 5706 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5707 | |
| 5708 | for i := 0; i < subReqCount; i++ { |
| 5709 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5710 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5711 | } |
| 5712 | |
| 5713 | // Wait that subs is cleaned |
| 5714 | for i := 0; i < subReqCount; i++ { |
| 5715 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5716 | } |
| 5717 | |
| 5718 | xappConn1.TestMsgChanEmpty(t) |
| 5719 | e2termConn1.TestMsgChanEmpty(t) |
| 5720 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5721 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 5722 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5723 | } |
| 5724 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5725 | //----------------------------------------------------------------------------- |
| 5726 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 5727 | // |
| 5728 | // stub stub |
| 5729 | // +-------+ +---------+ +---------+ |
| 5730 | // | xapp | | submgr | | e2term | |
| 5731 | // +-------+ +---------+ +---------+ |
| 5732 | // | | | |
| 5733 | // | RestSubReq | | |
| 5734 | // |---------------->| | |
| 5735 | // | | | |
| 5736 | // | RESTSubResp | | |
| 5737 | // |<----------------| | |
| 5738 | // | | | |
| 5739 | // | | SubReq | |
| 5740 | // | |------------->| |
| 5741 | // | | | |
| 5742 | // | | SubResp | |
| 5743 | // | |<-------------| |
| 5744 | // | RESTNotif | | |
| 5745 | // |<----------------| | |
| 5746 | // | | SubReq | |
| 5747 | // | |------------->| |
| 5748 | // | | | |
| 5749 | // | | SubResp | |
| 5750 | // | |<-------------| |
| 5751 | // | RESTNotif | | |
| 5752 | // |<----------------| | |
| 5753 | // | | | |
| 5754 | // | RESTSubDelReq | | |
| 5755 | // |---------------->| | |
| 5756 | // | | | |
| 5757 | // | RESTSubDelResp| | |
| 5758 | // |<----------------| | |
| 5759 | // | | SubDelReq | |
| 5760 | // | |------------->| |
| 5761 | // | | | |
| 5762 | // | | SubDelResp | |
| 5763 | // | |<-------------| |
| 5764 | // | | | |
| 5765 | // | | SubDelReq | |
| 5766 | // | |------------->| |
| 5767 | // | | | |
| 5768 | // | | SubDelResp | |
| 5769 | // | |<-------------| |
| 5770 | // | | | |
| 5771 | // |
| 5772 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5773 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5774 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5775 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5776 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5777 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5778 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5779 | Counter{cSubReqToE2, 2}, |
| 5780 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5781 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5782 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5783 | Counter{cSubDelReqToE2, 2}, |
| 5784 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5785 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5786 | }) |
| 5787 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5788 | const subReqCount int = 2 |
| 5789 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5790 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5791 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5792 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5793 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5794 | |
| 5795 | assert.Equal(t, len(e2SubsIds), 2) |
| 5796 | |
| 5797 | // Del |
| 5798 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5799 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5800 | |
| 5801 | xappConn1.TestMsgChanEmpty(t) |
| 5802 | e2termConn1.TestMsgChanEmpty(t) |
| 5803 | mainCtrl.wait_registry_empty(t, 10) |
| 5804 | |
| 5805 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5806 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5807 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5808 | |
| 5809 | //----------------------------------------------------------------------------- |
| 5810 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 5811 | // |
| 5812 | // stub stub |
| 5813 | // +-------+ +---------+ +---------+ |
| 5814 | // | xapp | | submgr | | e2term | |
| 5815 | // +-------+ +---------+ +---------+ |
| 5816 | // | | | |
| 5817 | // | RestSubReq | | |
| 5818 | // |---------------->| | |
| 5819 | // | | | |
| 5820 | // | RESTSubResp | | |
| 5821 | // |<----------------| | |
| 5822 | // | | | ------ |
| 5823 | // | | SubReq | |
| 5824 | // | |------------->| |
| 5825 | // | | | E2 subscription x 19 |
| 5826 | // | | SubResp | |
| 5827 | // | |<-------------| |
| 5828 | // | RESTNotif | | |
| 5829 | // |<----------------| | |
| 5830 | // | | | ------ |
| 5831 | // | RESTSubDelReq | | |
| 5832 | // |---------------->| | |
| 5833 | // | | | |
| 5834 | // | RESTSubDelResp| | |
| 5835 | // |<----------------| | |
| 5836 | // | | SubDelReq | ------ |
| 5837 | // | |------------->| |
| 5838 | // | | | E2 subscription delete x 19 |
| 5839 | // | | SubDelResp | |
| 5840 | // | |<-------------| |
| 5841 | // | | | ------ |
| 5842 | // | | | |
| 5843 | // |
| 5844 | //----------------------------------------------------------------------------- |
| 5845 | |
| 5846 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5847 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5848 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5849 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5850 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5851 | Counter{cSubReqToE2, 19}, |
| 5852 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5853 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5854 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5855 | Counter{cSubDelReqToE2, 19}, |
| 5856 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5857 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5858 | }) |
| 5859 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5860 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5861 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5862 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5863 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5864 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5865 | |
| 5866 | assert.Equal(t, len(e2SubsIds), 19) |
| 5867 | |
| 5868 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5869 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5870 | |
| 5871 | xappConn1.TestMsgChanEmpty(t) |
| 5872 | e2termConn1.TestMsgChanEmpty(t) |
| 5873 | mainCtrl.wait_registry_empty(t, 10) |
| 5874 | |
| 5875 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5876 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5877 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5878 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5879 | //----------------------------------------------------------------------------- |
| 5880 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 5881 | // |
| 5882 | // stub stub |
| 5883 | // +-------+ +---------+ +---------+ |
| 5884 | // | xapp | | submgr | | e2term | |
| 5885 | // +-------+ +---------+ +---------+ |
| 5886 | // | | | |
| 5887 | // | RestSubReq | | |
| 5888 | // |---------------->| | |
| 5889 | // | | | |
| 5890 | // | RESTSubResp | | |
| 5891 | // |<----------------| | |
| 5892 | // | | | |
| 5893 | // | | SubReq | |
| 5894 | // | |------------->| |
| 5895 | // | | | |
| 5896 | // | | SubResp | |
| 5897 | // | |<-------------| |
| 5898 | // | RESTNotif | | |
| 5899 | // |<----------------| | |
| 5900 | // | | SubReq | |
| 5901 | // | |------------->| |
| 5902 | // | | | |
| 5903 | // | | SubResp | |
| 5904 | // | |<-------------| |
| 5905 | // | RESTNotif | | |
| 5906 | // |<----------------| | |
| 5907 | // | | | |
| 5908 | // | RESTSubDelReq | | |
| 5909 | // |---------------->| | |
| 5910 | // | | | |
| 5911 | // | RESTSubDelResp| | |
| 5912 | // |<----------------| | |
| 5913 | // | | SubDelReq | |
| 5914 | // | |------------->| |
| 5915 | // | | | |
| 5916 | // | | SubDelResp | |
| 5917 | // | |<-------------| |
| 5918 | // | | | |
| 5919 | // | | SubDelReq | |
| 5920 | // | |------------->| |
| 5921 | // | | | |
| 5922 | // | | SubDelResp | |
| 5923 | // | |<-------------| |
| 5924 | // | | | |
| 5925 | // |
| 5926 | //----------------------------------------------------------------------------- |
| 5927 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5928 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5929 | |
| 5930 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5931 | |
| 5932 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5933 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5934 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5935 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5936 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5937 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5938 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5939 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5940 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5941 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5942 | }) |
| 5943 | |
| 5944 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5945 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5946 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5947 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5948 | |
| 5949 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5950 | |
| 5951 | // Del |
| 5952 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5953 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5954 | |
| 5955 | xappConn1.TestMsgChanEmpty(t) |
| 5956 | e2termConn1.TestMsgChanEmpty(t) |
| 5957 | mainCtrl.wait_registry_empty(t, 10) |
| 5958 | |
| 5959 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5960 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5961 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5962 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 5963 | //----------------------------------------------------------------------------- |
| 5964 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 5965 | // |
| 5966 | // stub stub |
| 5967 | // +-------+ +---------+ +---------+ |
| 5968 | // | xapp | | submgr | | e2term | |
| 5969 | // +-------+ +---------+ +---------+ |
| 5970 | // | | | |
| 5971 | // | RestSubReq | | |
| 5972 | // |---------------->| | |
| 5973 | // | | | |
| 5974 | // | RESTSubResp | | |
| 5975 | // |<----------------| | |
| 5976 | // | | | |
| 5977 | // | | SubReq | |
| 5978 | // | |------------->| |
| 5979 | // | | | |
| 5980 | // | | SubResp | |
| 5981 | // | |<-------------| |
| 5982 | // | RESTNotif | | |
| 5983 | // |<----------------| | |
| 5984 | // | | SubReq | |
| 5985 | // | |------------->| |
| 5986 | // | | | |
| 5987 | // | | SubResp | |
| 5988 | // | |<-------------| |
| 5989 | // | RESTNotif | | |
| 5990 | // |<----------------| | |
| 5991 | // | | | |
| 5992 | // | RESTSubDelReq | | |
| 5993 | // |---------------->| | |
| 5994 | // | | | |
| 5995 | // | RESTSubDelResp| | |
| 5996 | // |<----------------| | |
| 5997 | // | | SubDelReq | |
| 5998 | // | |------------->| |
| 5999 | // | | | |
| 6000 | // | | SubDelResp | |
| 6001 | // | |<-------------| |
| 6002 | // | | | |
| 6003 | // | | SubDelReq | |
| 6004 | // | |------------->| |
| 6005 | // | | | |
| 6006 | // | | SubDelResp | |
| 6007 | // | |<-------------| |
| 6008 | // | | | |
| 6009 | // |
| 6010 | //----------------------------------------------------------------------------- |
| 6011 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6012 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6013 | |
| 6014 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6015 | |
| 6016 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6017 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6018 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6019 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6020 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6021 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6022 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6023 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6024 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6025 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6026 | }) |
| 6027 | |
| 6028 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6029 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6030 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6031 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6032 | |
| 6033 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6034 | |
| 6035 | // Del |
| 6036 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6037 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6038 | |
| 6039 | xappConn1.TestMsgChanEmpty(t) |
| 6040 | e2termConn1.TestMsgChanEmpty(t) |
| 6041 | mainCtrl.wait_registry_empty(t, 10) |
| 6042 | |
| 6043 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6044 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6045 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6046 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6047 | //----------------------------------------------------------------------------- |
| 6048 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6049 | // |
| 6050 | // stub stub |
| 6051 | // +-------+ +---------+ +---------+ |
| 6052 | // | xapp | | submgr | | e2term | |
| 6053 | // +-------+ +---------+ +---------+ |
| 6054 | // | | | |
| 6055 | // | RestSubReq | | |
| 6056 | // |---------------->| | |
| 6057 | // | | | |
| 6058 | // | RESTSubResp | | |
| 6059 | // |<----------------| | |
| 6060 | // | | | ------ |
| 6061 | // | | SubReq | |
| 6062 | // | |------------->| |
| 6063 | // | | | E2 subscription x 19 |
| 6064 | // | | SubResp | |
| 6065 | // | |<-------------| |
| 6066 | // | RESTNotif | | |
| 6067 | // |<----------------| | |
| 6068 | // | | | ------ |
| 6069 | // | RESTSubDelReq | | |
| 6070 | // |---------------->| | |
| 6071 | // | | | |
| 6072 | // | RESTSubDelResp| | |
| 6073 | // |<----------------| | |
| 6074 | // | | SubDelReq | ------ |
| 6075 | // | |------------->| |
| 6076 | // | | | E2 subscription delete x 19 |
| 6077 | // | | SubDelResp | |
| 6078 | // | |<-------------| |
| 6079 | // | | | ------ |
| 6080 | // | | | |
| 6081 | // |
| 6082 | //----------------------------------------------------------------------------- |
| 6083 | |
| 6084 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6085 | |
| 6086 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6087 | |
| 6088 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6089 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6090 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6091 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6092 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6093 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6094 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6095 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6096 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6097 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6098 | }) |
| 6099 | |
| 6100 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6101 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6102 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6103 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6104 | |
| 6105 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6106 | |
| 6107 | // Del |
| 6108 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6109 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6110 | |
| 6111 | xappConn1.TestMsgChanEmpty(t) |
| 6112 | e2termConn1.TestMsgChanEmpty(t) |
| 6113 | mainCtrl.wait_registry_empty(t, 10) |
| 6114 | |
| 6115 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6116 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6117 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6118 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6119 | //----------------------------------------------------------------------------- |
| 6120 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6121 | // |
| 6122 | // stub stub stub |
| 6123 | // +-------+ +-------+ +---------+ +---------+ |
| 6124 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6125 | // +-------+ +-------+ +---------+ +---------+ |
| 6126 | // | | | | |
| 6127 | // | | RESTSubReq1 | | |
| 6128 | // | |------------->| | |
| 6129 | // | | RESTSubResp1 | | |
| 6130 | // | |<-------------| | |
| 6131 | // | | | | |
| 6132 | // | | | SubReq1 | |
| 6133 | // | | |------------->| |
| 6134 | // | | | | |
| 6135 | // | RESTSubReq2 | | |
| 6136 | // |------------------------>| | |
| 6137 | // | RESTSubResp2 | | |
| 6138 | // |<------------------------| | |
| 6139 | // | | | | |
| 6140 | // | | | SubReq2 | |
| 6141 | // | | |------------->| |
| 6142 | // | | | | |
| 6143 | // | | | SubResp1 | |
| 6144 | // | | |<-------------| |
| 6145 | // | | RESTNotif1 | | |
| 6146 | // | |<-------------| | |
| 6147 | // | | | | |
| 6148 | // | | | SubResp2 | |
| 6149 | // | | |<-------------| |
| 6150 | // | RESTNotif2 | | |
| 6151 | // |<------------------------| | |
| 6152 | // | | | | |
| 6153 | // | | [SUBS 1 DELETE] | |
| 6154 | // | | | | |
| 6155 | // | | [SUBS 2 DELETE] | |
| 6156 | // | | | | |
| 6157 | // |
| 6158 | //----------------------------------------------------------------------------- |
| 6159 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6160 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6161 | |
| 6162 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6163 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6164 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6165 | Counter{cSubReqToE2, 2}, |
| 6166 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6167 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6168 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6169 | Counter{cSubDelReqToE2, 2}, |
| 6170 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6171 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6172 | }) |
| 6173 | |
| 6174 | // Req1 |
| 6175 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6176 | |
| 6177 | //Subs Create |
| 6178 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6179 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6180 | |
| 6181 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6182 | |
| 6183 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6184 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6185 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6186 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6187 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6188 | |
| 6189 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6190 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6191 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6192 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6193 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6194 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6195 | |
| 6196 | deleteXapp1Subscription(t, &restSubId1) |
| 6197 | deleteXapp2Subscription(t, &restSubId2) |
| 6198 | |
| 6199 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6200 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6201 | |
| 6202 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6203 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6204 | } |
| 6205 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6206 | //----------------------------------------------------------------------------- |
| 6207 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6208 | // |
| 6209 | // stub stub stub |
| 6210 | // +-------+ +-------+ +---------+ +---------+ |
| 6211 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6212 | // +-------+ +-------+ +---------+ +---------+ |
| 6213 | // | | | | |
| 6214 | // | | RESTSubReq1 | | |
| 6215 | // | |------------->| | |
| 6216 | // | | RESTSubResp1 | | |
| 6217 | // | |<-------------| | |
| 6218 | // | | | | |
| 6219 | // | | | SubReq1 | |
| 6220 | // | | |------------->| |
| 6221 | // | | | | |
| 6222 | // | RESTSubReq2 | | |
| 6223 | // |------------------------>| | |
| 6224 | // | RESTSubResp2 | | |
| 6225 | // |<------------------------| | |
| 6226 | // | | | | |
| 6227 | // | | | SubReq2 | |
| 6228 | // | | |------------->| |
| 6229 | // | | | | |
| 6230 | // | | | SubResp1 | |
| 6231 | // | | |<-------------| |
| 6232 | // | | RESTNotif1 | | |
| 6233 | // | |<-------------| | |
| 6234 | // | | | | |
| 6235 | // | | | SubResp2 | |
| 6236 | // | | |<-------------| |
| 6237 | // | RESTNotif2 | | |
| 6238 | // |<------------------------| | |
| 6239 | // | | | | |
| 6240 | // | | [SUBS 1 DELETE] | |
| 6241 | // | | | | |
| 6242 | // | | [SUBS 2 DELETE] | |
| 6243 | // | | | | |
| 6244 | // |
| 6245 | //----------------------------------------------------------------------------- |
| 6246 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6247 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6248 | |
| 6249 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6250 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6251 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6252 | Counter{cSubReqToE2, 2}, |
| 6253 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6254 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6255 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6256 | Counter{cSubDelReqToE2, 2}, |
| 6257 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6258 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6259 | }) |
| 6260 | |
| 6261 | // Req1 |
| 6262 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6263 | |
| 6264 | //Subs Create |
| 6265 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6266 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6267 | |
| 6268 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6269 | |
| 6270 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6271 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6272 | params.SetMeid("RAN_NAME_1") |
| 6273 | |
| 6274 | actionId := int64(1) |
| 6275 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6276 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6277 | subsequestActionType := "continue" |
| 6278 | timeToWait := "w10ms" |
| 6279 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6280 | |
| 6281 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6282 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6283 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6284 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6285 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6286 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6287 | |
| 6288 | deleteXapp1Subscription(t, &restSubId1) |
| 6289 | deleteXapp2Subscription(t, &restSubId2) |
| 6290 | |
| 6291 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6292 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6293 | |
| 6294 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6295 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6296 | } |
| 6297 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6298 | //----------------------------------------------------------------------------- |
| 6299 | // TestRESTSubReqReportSameActionDiffActionID |
| 6300 | // |
| 6301 | // stub stub stub |
| 6302 | // +-------+ +-------+ +---------+ +---------+ |
| 6303 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6304 | // +-------+ +-------+ +---------+ +---------+ |
| 6305 | // | | | | |
| 6306 | // | | RESTSubReq1 | | |
| 6307 | // | |------------->| | |
| 6308 | // | | RESTSubResp1 | | |
| 6309 | // | |<-------------| | |
| 6310 | // | | | | |
| 6311 | // | | | SubReq1 | |
| 6312 | // | | |------------->| |
| 6313 | // | | | | |
| 6314 | // | RESTSubReq2 | | |
| 6315 | // |------------------------>| | |
| 6316 | // | RESTSubResp2 | | |
| 6317 | // |<------------------------| | |
| 6318 | // | | | | |
| 6319 | // | | | SubReq2 | |
| 6320 | // | | |------------->| |
| 6321 | // | | | | |
| 6322 | // | | | SubResp1 | |
| 6323 | // | | |<-------------| |
| 6324 | // | | RESTNotif1 | | |
| 6325 | // | |<-------------| | |
| 6326 | // | | | | |
| 6327 | // | | | SubResp2 | |
| 6328 | // | | |<-------------| |
| 6329 | // | RESTNotif2 | | |
| 6330 | // |<------------------------| | |
| 6331 | // | | | | |
| 6332 | // | | [SUBS 1 DELETE] | |
| 6333 | // | | | | |
| 6334 | // | | [SUBS 2 DELETE] | |
| 6335 | // | | | | |
| 6336 | // |
| 6337 | //----------------------------------------------------------------------------- |
| 6338 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6339 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6340 | |
| 6341 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6342 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6343 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6344 | Counter{cSubReqToE2, 2}, |
| 6345 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6346 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6347 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6348 | Counter{cSubDelReqToE2, 2}, |
| 6349 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6350 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6351 | }) |
| 6352 | |
| 6353 | // Req1 |
| 6354 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6355 | |
| 6356 | //Subs Create |
| 6357 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6358 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6359 | |
| 6360 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6361 | |
| 6362 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6363 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6364 | params.SetMeid("RAN_NAME_1") |
| 6365 | params.SetSubActionIDs(int64(2)) |
| 6366 | |
| 6367 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6368 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6369 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6370 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6371 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6372 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6373 | |
| 6374 | deleteXapp1Subscription(t, &restSubId1) |
| 6375 | deleteXapp2Subscription(t, &restSubId2) |
| 6376 | |
| 6377 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6378 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6379 | |
| 6380 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6381 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6382 | } |
| 6383 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6384 | //----------------------------------------------------------------------------- |
| 6385 | // TestRESTSubReqDiffActionType |
| 6386 | // |
| 6387 | // stub stub stub |
| 6388 | // +-------+ +-------+ +---------+ +---------+ |
| 6389 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6390 | // +-------+ +-------+ +---------+ +---------+ |
| 6391 | // | | | | |
| 6392 | // | | RESTSubReq1 | | |
| 6393 | // | |------------->| | |
| 6394 | // | | RESTSubResp1 | | |
| 6395 | // | |<-------------| | |
| 6396 | // | | | | |
| 6397 | // | | | SubReq1 | |
| 6398 | // | | |------------->| |
| 6399 | // | | | | |
| 6400 | // | RESTSubReq2 | | |
| 6401 | // |------------------------>| | |
| 6402 | // | RESTSubResp2 | | |
| 6403 | // |<------------------------| | |
| 6404 | // | | | | |
| 6405 | // | | | SubReq2 | |
| 6406 | // | | |------------->| |
| 6407 | // | | | | |
| 6408 | // | | | SubResp1 | |
| 6409 | // | | |<-------------| |
| 6410 | // | | RESTNotif1 | | |
| 6411 | // | |<-------------| | |
| 6412 | // | | | | |
| 6413 | // | | | SubResp2 | |
| 6414 | // | | |<-------------| |
| 6415 | // | RESTNotif2 | | |
| 6416 | // |<------------------------| | |
| 6417 | // | | | | |
| 6418 | // | | [SUBS 1 DELETE] | |
| 6419 | // | | | | |
| 6420 | // | | [SUBS 2 DELETE] | |
| 6421 | // | | | | |
| 6422 | // |
| 6423 | //----------------------------------------------------------------------------- |
| 6424 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6425 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6426 | |
| 6427 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6428 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6429 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6430 | Counter{cSubReqToE2, 2}, |
| 6431 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6432 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6433 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6434 | Counter{cSubDelReqToE2, 2}, |
| 6435 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6436 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6437 | }) |
| 6438 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6439 | const e2Timeout int64 = 2 |
| 6440 | const e2RetryCount int64 = 2 |
| 6441 | const routingNeeded bool = true |
| 6442 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6443 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6444 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6445 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6446 | |
| 6447 | //Subs Create |
| 6448 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6449 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6450 | |
| 6451 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6452 | |
| 6453 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6454 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6455 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6456 | params.SetMeid("RAN_NAME_1") |
| 6457 | |
| 6458 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6459 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6460 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6461 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6462 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6463 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6464 | |
| 6465 | deleteXapp1Subscription(t, &restSubId1) |
| 6466 | deleteXapp2Subscription(t, &restSubId2) |
| 6467 | |
| 6468 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6469 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6470 | |
| 6471 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6472 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6473 | } |
| 6474 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6475 | //----------------------------------------------------------------------------- |
| 6476 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 6477 | // |
| 6478 | // stub stub stub |
| 6479 | // +-------+ +-------+ +---------+ +---------+ |
| 6480 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6481 | // +-------+ +-------+ +---------+ +---------+ |
| 6482 | // | | | | |
| 6483 | // | | RESTSubReq1 | | |
| 6484 | // | |------------->| | |
| 6485 | // | | RESTSubResp1 | | |
| 6486 | // | |<-------------| | |
| 6487 | // | | | | |
| 6488 | // | | | SubReq1 | |
| 6489 | // | | |------------->| |
| 6490 | // | | | | |
| 6491 | // | RESTSubReq2 | | |
| 6492 | // |------------------------>| | |
| 6493 | // | RESTSubResp2 | | |
| 6494 | // |<------------------------| | |
| 6495 | // | | | | |
| 6496 | // | | | SubReq2 | |
| 6497 | // | | |------------->| |
| 6498 | // | | | | |
| 6499 | // | | | SubResp1 | |
| 6500 | // | | |<-------------| |
| 6501 | // | | RESTNotif1 | | |
| 6502 | // | |<-------------| | |
| 6503 | // | | | | |
| 6504 | // | | | SubResp2 | |
| 6505 | // | | |<-------------| |
| 6506 | // | RESTNotif2 | | |
| 6507 | // |<------------------------| | |
| 6508 | // | | | | |
| 6509 | // | | [SUBS 1 DELETE] | |
| 6510 | // | | | | |
| 6511 | // | | [SUBS 2 DELETE] | |
| 6512 | // | | | | |
| 6513 | // |
| 6514 | //----------------------------------------------------------------------------- |
| 6515 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6516 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6517 | |
| 6518 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6519 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6520 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6521 | Counter{cSubReqToE2, 2}, |
| 6522 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6523 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6524 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6525 | Counter{cSubDelReqToE2, 2}, |
| 6526 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6527 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6528 | }) |
| 6529 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6530 | const e2Timeout int64 = 2 |
| 6531 | const e2RetryCount int64 = 2 |
| 6532 | const routingNeeded bool = true |
| 6533 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6534 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6535 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6536 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6537 | |
| 6538 | //Subs Create |
| 6539 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6540 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6541 | |
| 6542 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6543 | |
| 6544 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6545 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6546 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6547 | params.SetMeid("RAN_NAME_1") |
| 6548 | |
| 6549 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6550 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6551 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6552 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6553 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6554 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6555 | |
| 6556 | deleteXapp1Subscription(t, &restSubId1) |
| 6557 | deleteXapp2Subscription(t, &restSubId2) |
| 6558 | |
| 6559 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6560 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6561 | |
| 6562 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6563 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6564 | } |
| 6565 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6566 | //----------------------------------------------------------------------------- |
| 6567 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 6568 | // |
| 6569 | // stub stub stub |
| 6570 | // +-------+ +-------+ +---------+ +---------+ |
| 6571 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6572 | // +-------+ +-------+ +---------+ +---------+ |
| 6573 | // | | | | |
| 6574 | // | | RESTSubReq1 | | |
| 6575 | // | |------------->| | |
| 6576 | // | | RESTSubResp1 | | |
| 6577 | // | |<-------------| | |
| 6578 | // | | | | |
| 6579 | // | | | SubReq1 | |
| 6580 | // | | |------------->| |
| 6581 | // | | | | |
| 6582 | // | RESTSubReq2 | | |
| 6583 | // |------------------------>| | |
| 6584 | // | RESTSubResp2 | | |
| 6585 | // |<------------------------| | |
| 6586 | // | | | | |
| 6587 | // | | | SubReq2 | |
| 6588 | // | | |------------->| |
| 6589 | // | | | | |
| 6590 | // | | | SubResp1 | |
| 6591 | // | | |<-------------| |
| 6592 | // | | RESTNotif1 | | |
| 6593 | // | |<-------------| | |
| 6594 | // | | | | |
| 6595 | // | | | SubResp2 | |
| 6596 | // | | |<-------------| |
| 6597 | // | RESTNotif2 | | |
| 6598 | // |<------------------------| | |
| 6599 | // | | | | |
| 6600 | // | | [SUBS 1 DELETE] | |
| 6601 | // | | | | |
| 6602 | // | | [SUBS 2 DELETE] | |
| 6603 | // | | | | |
| 6604 | // |
| 6605 | //----------------------------------------------------------------------------- |
| 6606 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6607 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6608 | |
| 6609 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6610 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6611 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6612 | Counter{cSubReqToE2, 2}, |
| 6613 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6614 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6615 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6616 | Counter{cSubDelReqToE2, 2}, |
| 6617 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6618 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6619 | }) |
| 6620 | |
| 6621 | // Req1 |
| 6622 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6623 | |
| 6624 | //Subs Create |
| 6625 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6626 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6627 | |
| 6628 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6629 | |
| 6630 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6631 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6632 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6633 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6634 | params.SetSubActionDefinition(actionDefinition) |
| 6635 | |
| 6636 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6637 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6638 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6639 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6640 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6641 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6642 | |
| 6643 | deleteXapp1Subscription(t, &restSubId1) |
| 6644 | deleteXapp2Subscription(t, &restSubId2) |
| 6645 | |
| 6646 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6647 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6648 | |
| 6649 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6650 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6651 | } |
| 6652 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6653 | //----------------------------------------------------------------------------- |
| 6654 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 6655 | // |
| 6656 | // stub stub stub |
| 6657 | // +-------+ +-------+ +---------+ +---------+ |
| 6658 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6659 | // +-------+ +-------+ +---------+ +---------+ |
| 6660 | // | | | | |
| 6661 | // | | RESTSubReq1 | | |
| 6662 | // | |------------->| | |
| 6663 | // | | RESTSubResp1 | | |
| 6664 | // | |<-------------| | |
| 6665 | // | | | | |
| 6666 | // | | | SubReq1 | |
| 6667 | // | | |------------->| |
| 6668 | // | | | | |
| 6669 | // | RESTSubReq2 | | |
| 6670 | // |------------------------>| | |
| 6671 | // | RESTSubResp2 | | |
| 6672 | // |<------------------------| | |
| 6673 | // | | | | |
| 6674 | // | | | SubReq2 | |
| 6675 | // | | |------------->| |
| 6676 | // | | | | |
| 6677 | // | | | SubResp1 | |
| 6678 | // | | |<-------------| |
| 6679 | // | | RESTNotif1 | | |
| 6680 | // | |<-------------| | |
| 6681 | // | | | | |
| 6682 | // | | | SubResp2 | |
| 6683 | // | | |<-------------| |
| 6684 | // | RESTNotif2 | | |
| 6685 | // |<------------------------| | |
| 6686 | // | | | | |
| 6687 | // | | [SUBS 1 DELETE] | |
| 6688 | // | | | | |
| 6689 | // | | [SUBS 2 DELETE] | |
| 6690 | // | | | | |
| 6691 | // |
| 6692 | //----------------------------------------------------------------------------- |
| 6693 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6694 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6695 | |
| 6696 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6697 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6698 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6699 | Counter{cSubReqToE2, 2}, |
| 6700 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6701 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6702 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6703 | Counter{cSubDelReqToE2, 2}, |
| 6704 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6705 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6706 | }) |
| 6707 | |
| 6708 | // Req1 |
| 6709 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6710 | |
| 6711 | //Subs Create |
| 6712 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6713 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6714 | |
| 6715 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6716 | |
| 6717 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6718 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6719 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6720 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6721 | params.SetSubActionDefinition(actionDefinition) |
| 6722 | |
| 6723 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6724 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6725 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6726 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6727 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6728 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6729 | |
| 6730 | deleteXapp1Subscription(t, &restSubId1) |
| 6731 | deleteXapp2Subscription(t, &restSubId2) |
| 6732 | |
| 6733 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6734 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6735 | |
| 6736 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6737 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6738 | } |
| 6739 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 6740 | //----------------------------------------------------------------------------- |
| 6741 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 6742 | // |
| 6743 | // stub stub stub |
| 6744 | // +-------+ +-------+ +---------+ +---------+ |
| 6745 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6746 | // +-------+ +-------+ +---------+ +---------+ |
| 6747 | // | | | | |
| 6748 | // | | RESTSubReq1 | | |
| 6749 | // | |------------->| | |
| 6750 | // | | RESTSubResp1 | | |
| 6751 | // | |<-------------| | |
| 6752 | // | | | | |
| 6753 | // | | | SubReq1 | |
| 6754 | // | | |------------->| |
| 6755 | // | | | | |
| 6756 | // | RESTSubReq2 | | |
| 6757 | // |------------------------>| | |
| 6758 | // | RESTSubResp2 | | |
| 6759 | // |<------------------------| | |
| 6760 | // | | | | |
| 6761 | // | | | SubReq2 | |
| 6762 | // | | |------------->| |
| 6763 | // | | | | |
| 6764 | // | | | SubResp1 | |
| 6765 | // | | |<-------------| |
| 6766 | // | | RESTNotif1 | | |
| 6767 | // | |<-------------| | |
| 6768 | // | | | | |
| 6769 | // | | | SubResp2 | |
| 6770 | // | | |<-------------| |
| 6771 | // | RESTNotif2 | | |
| 6772 | // |<------------------------| | |
| 6773 | // | | | | |
| 6774 | // | | [SUBS 1 DELETE] | |
| 6775 | // | | | | |
| 6776 | // | | [SUBS 2 DELETE] | |
| 6777 | // | | | | |
| 6778 | // |
| 6779 | //----------------------------------------------------------------------------- |
| 6780 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6781 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6782 | |
| 6783 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6784 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6785 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6786 | Counter{cSubReqToE2, 2}, |
| 6787 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6788 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6789 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6790 | Counter{cSubDelReqToE2, 2}, |
| 6791 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6792 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6793 | }) |
| 6794 | |
| 6795 | // Req1 |
| 6796 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6797 | |
| 6798 | //Subs Create |
| 6799 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6800 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6801 | |
| 6802 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6803 | |
| 6804 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6805 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6806 | params.SetMeid("RAN_NAME_1") |
| 6807 | params.SetTimeToWait("w200ms") |
| 6808 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6809 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6810 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6811 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6812 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6813 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6814 | |
| 6815 | deleteXapp1Subscription(t, &restSubId1) |
| 6816 | deleteXapp2Subscription(t, &restSubId2) |
| 6817 | |
| 6818 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6819 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6820 | |
| 6821 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6822 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6823 | } |
| 6824 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6825 | //----------------------------------------------------------------------------- |
| 6826 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 6827 | // |
| 6828 | // stub stub |
| 6829 | // +-------+ +---------+ +---------+ |
| 6830 | // | xapp | | submgr | | e2term | |
| 6831 | // +-------+ +---------+ +---------+ |
| 6832 | // | | | |
| 6833 | // | RestSubReq | | |
| 6834 | // |---------------->| | |
| 6835 | // | | | |
| 6836 | // | RESTSubResp | | |
| 6837 | // |<----------------| | |
| 6838 | // | | | |
| 6839 | // | | SubReq | |
| 6840 | // | |------------->| |
| 6841 | // | | | |
| 6842 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6843 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6844 | // | | | |
| 6845 | // | | SubReq | |
| 6846 | // | |------------->| |
| 6847 | // | | | |
| 6848 | // | | SubFail | Duplicated action |
| 6849 | // | |<-------------| |
| 6850 | // | RESTNotif (fail)| | |
| 6851 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6852 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6853 | // | [SUBS DELETE] | |
| 6854 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6855 | // |
| 6856 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6857 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6858 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6859 | |
| 6860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6861 | Counter{cRestSubReqFromXapp, 1}, |
| 6862 | Counter{cRestSubRespToXapp, 1}, |
| 6863 | Counter{cSubReqToE2, 1}, |
| 6864 | Counter{cSubReqTimerExpiry, 1}, |
| 6865 | Counter{cSubReReqToE2, 1}, |
| 6866 | Counter{cSubRespFromE2, 1}, |
| 6867 | Counter{cSubFailFromE2, 1}, |
| 6868 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6869 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6870 | Counter{cRestSubDelRespToXapp, 1}, |
| 6871 | }) |
| 6872 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6873 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6874 | |
| 6875 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6876 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6877 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6878 | |
| 6879 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6880 | // Decode of this response fails which will result resending original request |
| 6881 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 6882 | |
| 6883 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6884 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6885 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6886 | |
| 6887 | // Subscription already created in E2 Node. |
| 6888 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6889 | fparams.Set(crereq) |
| 6890 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6891 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6892 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6893 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6894 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6895 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6896 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6897 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6898 | // Wait that subs is cleaned |
| 6899 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6900 | |
| 6901 | xappConn1.TestMsgChanEmpty(t) |
| 6902 | e2termConn1.TestMsgChanEmpty(t) |
| 6903 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6904 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6905 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6906 | } |
| 6907 | |
| 6908 | //----------------------------------------------------------------------------- |
| 6909 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6910 | // |
| 6911 | // stub stub |
| 6912 | // +-------+ +---------+ +---------+ |
| 6913 | // | xapp | | submgr | | e2term | |
| 6914 | // +-------+ +---------+ +---------+ |
| 6915 | // | | | |
| 6916 | // | RestSubReq | | |
| 6917 | // |---------------->| | |
| 6918 | // | | | |
| 6919 | // | RESTSubResp | | |
| 6920 | // |<----------------| | |
| 6921 | // | | | |
| 6922 | // | | SubReq | |
| 6923 | // | |------------->| |
| 6924 | // | | | |
| 6925 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6926 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6927 | // | | | |
| 6928 | // | | SubReq | |
| 6929 | // | |------------->| |
| 6930 | // | | | |
| 6931 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6932 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6933 | // | RESTNotif (fail)| | |
| 6934 | // |<----------------| | |
| 6935 | // | | SubDelReq | |
| 6936 | // | |------------->| |
| 6937 | // | | | |
| 6938 | // | | SubDelResp | |
| 6939 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6940 | // | | | |
| 6941 | // | [SUBS DELETE] | |
| 6942 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6943 | // |
| 6944 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6945 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6946 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6947 | |
| 6948 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6949 | Counter{cRestSubReqFromXapp, 1}, |
| 6950 | Counter{cRestSubRespToXapp, 1}, |
| 6951 | Counter{cSubReqToE2, 1}, |
| 6952 | Counter{cSubReqTimerExpiry, 2}, |
| 6953 | Counter{cSubReReqToE2, 1}, |
| 6954 | Counter{cSubRespFromE2, 1}, |
| 6955 | Counter{cSubFailFromE2, 1}, |
| 6956 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6957 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6958 | Counter{cRestSubDelRespToXapp, 1}, |
| 6959 | Counter{cSubDelReqToE2, 1}, |
| 6960 | Counter{cSubDelRespFromE2, 1}, |
| 6961 | }) |
| 6962 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6963 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6964 | |
| 6965 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6966 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6967 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6968 | |
| 6969 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6970 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6971 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6972 | orgInstanceId := crereq.RequestId.InstanceId |
| 6973 | crereq.RequestId.InstanceId = 0 |
| 6974 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6975 | |
| 6976 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6977 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6978 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6979 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6980 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6981 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6982 | fparams.Set(crereq) |
| 6983 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6984 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6985 | |
| 6986 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6987 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6988 | |
| 6989 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6990 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6991 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6992 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6993 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6994 | // Wait that subs is cleaned |
| 6995 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6996 | |
| 6997 | xappConn1.TestMsgChanEmpty(t) |
| 6998 | e2termConn1.TestMsgChanEmpty(t) |
| 6999 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7000 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7001 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7002 | } |
| 7003 | |
| 7004 | //----------------------------------------------------------------------------- |
| 7005 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7006 | // |
| 7007 | // stub stub |
| 7008 | // +-------+ +---------+ +---------+ |
| 7009 | // | xapp | | submgr | | e2term | |
| 7010 | // +-------+ +---------+ +---------+ |
| 7011 | // | | | |
| 7012 | // | RestSubReq | | |
| 7013 | // |---------------->| | |
| 7014 | // | | | |
| 7015 | // | RESTSubResp | | |
| 7016 | // |<----------------| | |
| 7017 | // | | | |
| 7018 | // | | SubReq | |
| 7019 | // | |------------->| |
| 7020 | // | | | |
| 7021 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7022 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7023 | // | | | |
| 7024 | // | | SubReq | |
| 7025 | // | |------------->| |
| 7026 | // | | | |
| 7027 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7028 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7029 | // | RESTNotif (fail)| | |
| 7030 | // |<----------------| | |
| 7031 | // | | SubDelReq | |
| 7032 | // | |------------->| |
| 7033 | // | | | |
| 7034 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7035 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7036 | // | | | |
| 7037 | // | | SubDelReq | |
| 7038 | // | |------------->| |
| 7039 | // | | | |
| 7040 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7041 | // | |<-------------| Ongoing transaction not found. |
| 7042 | // | | | |
| 7043 | // | [SUBS DELETE] | |
| 7044 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7045 | // |
| 7046 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7047 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7048 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7049 | |
| 7050 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7051 | Counter{cRestSubReqFromXapp, 1}, |
| 7052 | Counter{cRestSubRespToXapp, 1}, |
| 7053 | Counter{cSubReqToE2, 1}, |
| 7054 | Counter{cSubReqTimerExpiry, 2}, |
| 7055 | Counter{cSubReReqToE2, 1}, |
| 7056 | Counter{cSubRespFromE2, 1}, |
| 7057 | Counter{cSubFailFromE2, 1}, |
| 7058 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7059 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7060 | Counter{cRestSubDelRespToXapp, 1}, |
| 7061 | Counter{cSubDelReqToE2, 1}, |
| 7062 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7063 | Counter{cSubDelReReqToE2, 1}, |
| 7064 | Counter{cSubDelRespFromE2, 2}, |
| 7065 | }) |
| 7066 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7067 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7068 | |
| 7069 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7070 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7071 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7072 | |
| 7073 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7074 | |
| 7075 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7076 | // No transaction exist for this response which will result resending original request |
| 7077 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7078 | |
| 7079 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7080 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7081 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7082 | |
| 7083 | // Subscription already created in E2 Node. |
| 7084 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7085 | fparams.Set(crereq) |
| 7086 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7087 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7088 | |
| 7089 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7090 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7091 | |
| 7092 | // Resending happens because there no transaction |
| 7093 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7094 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7095 | |
| 7096 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7097 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7098 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7099 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7100 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7101 | // Wait that subs is cleaned |
| 7102 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7103 | |
| 7104 | xappConn1.TestMsgChanEmpty(t) |
| 7105 | e2termConn1.TestMsgChanEmpty(t) |
| 7106 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7107 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7108 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7109 | } |
| 7110 | |
| 7111 | //----------------------------------------------------------------------------- |
| 7112 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7113 | // |
| 7114 | // stub stub |
| 7115 | // +-------+ +---------+ +---------+ |
| 7116 | // | xapp | | submgr | | e2term | |
| 7117 | // +-------+ +---------+ +---------+ |
| 7118 | // | | | |
| 7119 | // | RestSubReq | | |
| 7120 | // |---------------->| | |
| 7121 | // | | | |
| 7122 | // | RESTSubResp | | |
| 7123 | // |<----------------| | |
| 7124 | // | | | |
| 7125 | // | | SubReq | |
| 7126 | // | |------------->| |
| 7127 | // | | | |
| 7128 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7129 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7130 | // | | | |
| 7131 | // | | SubReq | |
| 7132 | // | |------------->| |
| 7133 | // | | | |
| 7134 | // | | SubFail | Duplicated action |
| 7135 | // | |<-------------| |
| 7136 | // | RESTNotif (fail)| | |
| 7137 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7138 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7139 | // | [SUBS DELETE] | |
| 7140 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7141 | // |
| 7142 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7143 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7144 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7145 | |
| 7146 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7147 | Counter{cRestSubReqFromXapp, 1}, |
| 7148 | Counter{cRestSubRespToXapp, 1}, |
| 7149 | Counter{cSubReqToE2, 1}, |
| 7150 | Counter{cSubReqTimerExpiry, 1}, |
| 7151 | Counter{cSubReReqToE2, 1}, |
| 7152 | Counter{cSubFailFromE2, 2}, |
| 7153 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7154 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7155 | Counter{cRestSubDelRespToXapp, 1}, |
| 7156 | }) |
| 7157 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7158 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7159 | |
| 7160 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7161 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7162 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7163 | |
| 7164 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7165 | |
| 7166 | // Decode of this response fails which will result resending original request |
| 7167 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7168 | |
| 7169 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7170 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7171 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7172 | |
| 7173 | // Subscription already created in E2 Node. |
| 7174 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7175 | fparams.Set(crereq) |
| 7176 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7177 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7178 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7179 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7180 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7181 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7182 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7183 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7184 | // Wait that subs is cleaned |
| 7185 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7186 | |
| 7187 | xappConn1.TestMsgChanEmpty(t) |
| 7188 | e2termConn1.TestMsgChanEmpty(t) |
| 7189 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7190 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7191 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7192 | } |
| 7193 | |
| 7194 | //----------------------------------------------------------------------------- |
| 7195 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7196 | // |
| 7197 | // stub stub |
| 7198 | // +-------+ +---------+ +---------+ |
| 7199 | // | xapp | | submgr | | e2term | |
| 7200 | // +-------+ +---------+ +---------+ |
| 7201 | // | | | |
| 7202 | // | RestSubReq | | |
| 7203 | // |---------------->| | |
| 7204 | // | | | |
| 7205 | // | RESTSubResp | | |
| 7206 | // |<----------------| | |
| 7207 | // | | | |
| 7208 | // | | SubReq | |
| 7209 | // | |------------->| |
| 7210 | // | | | |
| 7211 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7212 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7213 | // | | | |
| 7214 | // | | SubReq | |
| 7215 | // | |------------->| |
| 7216 | // | | | |
| 7217 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7218 | // | |<-------------|No valid subscription found with subIds [0]. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7219 | // | RESTNotif (fail)| | |
| 7220 | // |<----------------| | |
| 7221 | // | | SubDelReq | |
| 7222 | // | |------------->| |
| 7223 | // | | | |
| 7224 | // | | SubDelResp | |
| 7225 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7226 | // | | | |
| 7227 | // | [SUBS DELETE] | |
| 7228 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7229 | // |
| 7230 | //----------------------------------------------------------------------------- |
| 7231 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7232 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7233 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7234 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7235 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7236 | Counter{cRestSubReqFromXapp, 1}, |
| 7237 | Counter{cRestSubRespToXapp, 1}, |
| 7238 | Counter{cSubReqToE2, 1}, |
| 7239 | Counter{cSubReqTimerExpiry, 2}, |
| 7240 | Counter{cSubReReqToE2, 1}, |
| 7241 | Counter{cSubFailFromE2, 2}, |
| 7242 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7243 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7244 | Counter{cRestSubDelRespToXapp, 1}, |
| 7245 | Counter{cSubDelReqToE2, 1}, |
| 7246 | Counter{cSubDelRespFromE2, 1}, |
| 7247 | }) |
| 7248 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7249 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7250 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7251 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7252 | |
| 7253 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7254 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7255 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7256 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7257 | fparams.Set(crereq) |
| 7258 | fparams.Fail.RequestId.InstanceId = 0 |
| 7259 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7260 | |
| 7261 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7262 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7263 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7264 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7265 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7266 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7267 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7268 | |
| 7269 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7270 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7271 | |
| 7272 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7273 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7274 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7275 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7276 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7277 | // Wait that subs is cleaned |
| 7278 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7279 | |
| 7280 | xappConn1.TestMsgChanEmpty(t) |
| 7281 | e2termConn1.TestMsgChanEmpty(t) |
| 7282 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7283 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7284 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7285 | } |
| 7286 | |
| 7287 | //----------------------------------------------------------------------------- |
| 7288 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7289 | // |
| 7290 | // stub stub |
| 7291 | // +-------+ +---------+ +---------+ |
| 7292 | // | xapp | | submgr | | e2term | |
| 7293 | // +-------+ +---------+ +---------+ |
| 7294 | // | | | |
| 7295 | // | RestSubReq | | |
| 7296 | // |---------------->| | |
| 7297 | // | | | |
| 7298 | // | RESTSubResp | | |
| 7299 | // |<----------------| | |
| 7300 | // | | | |
| 7301 | // | | SubReq | |
| 7302 | // | |------------->| |
| 7303 | // | | | |
| 7304 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7305 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7306 | // | | | |
| 7307 | // | | SubReq | |
| 7308 | // | |------------->| |
| 7309 | // | | | |
| 7310 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7311 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7312 | // | RESTNotif (fail)| | |
| 7313 | // |<----------------| | |
| 7314 | // | | SubDelReq | |
| 7315 | // | |------------->| |
| 7316 | // | | | |
| 7317 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7318 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7319 | // | | | |
| 7320 | // | | SubDelReq | |
| 7321 | // | |------------->| |
| 7322 | // | | | |
| 7323 | // | | SubDelResp | |
| 7324 | // | |<-------------| Ongoing transaction not found. |
| 7325 | // | | | |
| 7326 | // | [SUBS DELETE] | |
| 7327 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7328 | // |
| 7329 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7330 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7331 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7332 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7333 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7334 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7335 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7336 | Counter{cRestSubReqFromXapp, 1}, |
| 7337 | Counter{cRestSubRespToXapp, 1}, |
| 7338 | Counter{cSubReqToE2, 1}, |
| 7339 | Counter{cSubReqTimerExpiry, 2}, |
| 7340 | Counter{cSubReReqToE2, 1}, |
| 7341 | Counter{cSubFailFromE2, 2}, |
| 7342 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7343 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7344 | Counter{cRestSubDelRespToXapp, 1}, |
| 7345 | Counter{cSubDelReqToE2, 1}, |
| 7346 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7347 | Counter{cSubDelReReqToE2, 1}, |
| 7348 | Counter{cSubDelRespFromE2, 2}, |
| 7349 | }) |
| 7350 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7351 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7352 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7353 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7354 | |
| 7355 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7356 | |
| 7357 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7358 | |
| 7359 | // No transaction exist for this response which will result resending original request |
| 7360 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7361 | fparams.Set(crereq) |
| 7362 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7363 | |
| 7364 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7365 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7366 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7367 | |
| 7368 | // Subscription already created in E2 Node. |
| 7369 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7370 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7371 | |
| 7372 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7373 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7374 | |
| 7375 | // Resending happens because there no transaction |
| 7376 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7377 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7378 | |
| 7379 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7380 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7381 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7382 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7383 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7384 | // Wait that subs is cleaned |
| 7385 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7386 | |
| 7387 | xappConn1.TestMsgChanEmpty(t) |
| 7388 | e2termConn1.TestMsgChanEmpty(t) |
| 7389 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7390 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7391 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7392 | } |
| 7393 | |
| 7394 | //----------------------------------------------------------------------------- |
| 7395 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7396 | // |
| 7397 | // stub stub |
| 7398 | // +-------+ +---------+ +---------+ |
| 7399 | // | xapp | | submgr | | e2term | |
| 7400 | // +-------+ +---------+ +---------+ |
| 7401 | // | | | |
| 7402 | // | [SUBS CREATE] | |
| 7403 | // | | | |
| 7404 | // | | | |
| 7405 | // | RESTSubDelReq | | |
| 7406 | // |---------------->| | |
| 7407 | // | | | |
| 7408 | // | RESTSubDelResp | | |
| 7409 | // |<----------------| | |
| 7410 | // | | | |
| 7411 | // | | SubDelReq | |
| 7412 | // | |------------->| |
| 7413 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7414 | // | | SubDelResp | ASN.1 decode fails. |
| 7415 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7416 | // | | | |
| 7417 | // | | SubDelReq | |
| 7418 | // | |------------->| |
| 7419 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7420 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7421 | // | |<-------------| |
| 7422 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7423 | // | [SUBS DELETE] | |
| 7424 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7425 | // |
| 7426 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7427 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7428 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7429 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7430 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7431 | Counter{cRestSubReqFromXapp, 1}, |
| 7432 | Counter{cRestSubRespToXapp, 1}, |
| 7433 | Counter{cSubReqToE2, 1}, |
| 7434 | Counter{cSubRespFromE2, 1}, |
| 7435 | Counter{cRestSubNotifToXapp, 1}, |
| 7436 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7437 | Counter{cRestSubDelRespToXapp, 1}, |
| 7438 | Counter{cSubDelReqToE2, 1}, |
| 7439 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7440 | Counter{cSubDelReReqToE2, 1}, |
| 7441 | Counter{cSubDelFailFromE2, 1}, |
| 7442 | Counter{cSubDelRespFromE2, 1}, |
| 7443 | }) |
| 7444 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7445 | // Req |
| 7446 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7447 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7448 | |
| 7449 | // Del |
| 7450 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7451 | |
| 7452 | // E2t: Receive 1st SubsDelReq |
| 7453 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7454 | |
| 7455 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7456 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7457 | |
| 7458 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7459 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7460 | |
| 7461 | // Subscription does not exist in in E2 Node. |
| 7462 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7463 | |
| 7464 | // Wait that subs is cleaned |
| 7465 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7466 | |
| 7467 | xappConn1.TestMsgChanEmpty(t) |
| 7468 | e2termConn1.TestMsgChanEmpty(t) |
| 7469 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7470 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7471 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7472 | } |
| 7473 | |
| 7474 | //----------------------------------------------------------------------------- |
| 7475 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 7476 | // |
| 7477 | // stub stub |
| 7478 | // +-------+ +---------+ +---------+ |
| 7479 | // | xapp | | submgr | | e2term | |
| 7480 | // +-------+ +---------+ +---------+ |
| 7481 | // | | | |
| 7482 | // | [SUBS CREATE] | |
| 7483 | // | | | |
| 7484 | // | | | |
| 7485 | // | RESTSubDelReq | | |
| 7486 | // |---------------->| | |
| 7487 | // | | | |
| 7488 | // | RESTSubDelResp | | |
| 7489 | // |<----------------| | |
| 7490 | // | | | |
| 7491 | // | | SubDelReq | |
| 7492 | // | |------------->| |
| 7493 | // | | | |
| 7494 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7495 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7496 | // | | | |
| 7497 | // | | SubDelReq | |
| 7498 | // | |------------->| |
| 7499 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7500 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7501 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7502 | // | | | |
| 7503 | // | [SUBS DELETE] | |
| 7504 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7505 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7506 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7507 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7508 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7509 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7510 | Counter{cRestSubReqFromXapp, 1}, |
| 7511 | Counter{cRestSubRespToXapp, 1}, |
| 7512 | Counter{cSubReqToE2, 1}, |
| 7513 | Counter{cSubRespFromE2, 1}, |
| 7514 | Counter{cRestSubNotifToXapp, 1}, |
| 7515 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7516 | Counter{cRestSubDelRespToXapp, 1}, |
| 7517 | Counter{cSubDelReqToE2, 1}, |
| 7518 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7519 | Counter{cSubDelReReqToE2, 1}, |
| 7520 | Counter{cSubDelRespFromE2, 1}, |
| 7521 | Counter{cSubDelFailFromE2, 1}, |
| 7522 | }) |
| 7523 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7524 | // Req |
| 7525 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7526 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7527 | |
| 7528 | // Del |
| 7529 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7530 | |
| 7531 | // E2t: Receive 1st SubsDelReq |
| 7532 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7533 | |
| 7534 | // Unknown instanceId in this response which will result resending original request |
| 7535 | delreq.RequestId.InstanceId = 0 |
| 7536 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7537 | |
| 7538 | // E2t: Receive 2nd SubsDelReq |
| 7539 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7540 | |
| 7541 | // Subscription does not exist in in E2 Node. |
| 7542 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7543 | |
| 7544 | // Wait that subs is cleaned |
| 7545 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7546 | |
| 7547 | xappConn1.TestMsgChanEmpty(t) |
| 7548 | e2termConn1.TestMsgChanEmpty(t) |
| 7549 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7550 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7551 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7552 | } |
| 7553 | |
| 7554 | //----------------------------------------------------------------------------- |
| 7555 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 7556 | // |
| 7557 | // stub stub |
| 7558 | // +-------+ +---------+ +---------+ |
| 7559 | // | xapp | | submgr | | e2term | |
| 7560 | // +-------+ +---------+ +---------+ |
| 7561 | // | | | |
| 7562 | // | [SUBS CREATE] | |
| 7563 | // | | | |
| 7564 | // | | | |
| 7565 | // | RESTSubDelReq | | |
| 7566 | // |---------------->| | |
| 7567 | // | | | |
| 7568 | // | RESTSubDelResp | | |
| 7569 | // |<----------------| | |
| 7570 | // | | | |
| 7571 | // | | SubDelReq | |
| 7572 | // | |------------->| |
| 7573 | // | | | |
| 7574 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7575 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7576 | // | | | |
| 7577 | // | | SubDelReq | |
| 7578 | // | |------------->| |
| 7579 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7580 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7581 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 7582 | // | | | |
| 7583 | // | [SUBS DELETE] | |
| 7584 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7585 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7586 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7587 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7588 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7589 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7590 | Counter{cRestSubReqFromXapp, 1}, |
| 7591 | Counter{cRestSubRespToXapp, 1}, |
| 7592 | Counter{cSubReqToE2, 1}, |
| 7593 | Counter{cSubRespFromE2, 1}, |
| 7594 | Counter{cRestSubNotifToXapp, 1}, |
| 7595 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7596 | Counter{cRestSubDelRespToXapp, 1}, |
| 7597 | Counter{cSubDelReqToE2, 1}, |
| 7598 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7599 | Counter{cSubDelReReqToE2, 1}, |
| 7600 | Counter{cSubDelRespFromE2, 1}, |
| 7601 | Counter{cSubDelFailFromE2, 1}, |
| 7602 | }) |
| 7603 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7604 | // Req |
| 7605 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7606 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7607 | |
| 7608 | // Del |
| 7609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7610 | |
| 7611 | // E2t: Receive 1st SubsDelReq |
| 7612 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7613 | |
| 7614 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 7615 | |
| 7616 | // No transaction exist for this response which will result resending original request |
| 7617 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7618 | |
| 7619 | // E2t: Receive 2nd SubsDelReq |
| 7620 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7621 | |
| 7622 | // Subscription does not exist in in E2 Node. |
| 7623 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7624 | |
| 7625 | // Wait that subs is cleaned |
| 7626 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7627 | |
| 7628 | xappConn1.TestMsgChanEmpty(t) |
| 7629 | e2termConn1.TestMsgChanEmpty(t) |
| 7630 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7631 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7632 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7633 | } |
| 7634 | |
| 7635 | //----------------------------------------------------------------------------- |
| 7636 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 7637 | // |
| 7638 | // stub stub |
| 7639 | // +-------+ +---------+ +---------+ |
| 7640 | // | xapp | | submgr | | e2term | |
| 7641 | // +-------+ +---------+ +---------+ |
| 7642 | // | | | |
| 7643 | // | [SUBS CREATE] | |
| 7644 | // | | | |
| 7645 | // | | | |
| 7646 | // | RESTSubDelReq | | |
| 7647 | // |---------------->| | |
| 7648 | // | | | |
| 7649 | // | RESTSubDelResp | | |
| 7650 | // |<----------------| | |
| 7651 | // | | | |
| 7652 | // | | SubDelReq | |
| 7653 | // | |------------->| |
| 7654 | // | | | |
| 7655 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7656 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7657 | // | | | |
| 7658 | // | | SubDelReq | |
| 7659 | // | |------------->| |
| 7660 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7661 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7662 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7663 | // | | | |
| 7664 | // | [SUBS DELETE] | |
| 7665 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7666 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7667 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7668 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7669 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7670 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7671 | Counter{cRestSubReqFromXapp, 1}, |
| 7672 | Counter{cRestSubRespToXapp, 1}, |
| 7673 | Counter{cSubReqToE2, 1}, |
| 7674 | Counter{cSubRespFromE2, 1}, |
| 7675 | Counter{cRestSubNotifToXapp, 1}, |
| 7676 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7677 | Counter{cRestSubDelRespToXapp, 1}, |
| 7678 | Counter{cSubDelReqToE2, 1}, |
| 7679 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7680 | Counter{cSubDelReReqToE2, 1}, |
| 7681 | Counter{cSubDelFailFromE2, 2}, |
| 7682 | }) |
| 7683 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7684 | // Req |
| 7685 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7686 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7687 | |
| 7688 | // Del |
| 7689 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7690 | |
| 7691 | // E2t: Receive 1st SubsDelReq |
| 7692 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7693 | |
| 7694 | // Decode of this response fails which will result resending original request |
| 7695 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 7696 | |
| 7697 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7698 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7699 | |
| 7700 | // Subscription does not exist in in E2 Node. |
| 7701 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7702 | |
| 7703 | // Wait that subs is cleaned |
| 7704 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7705 | |
| 7706 | xappConn1.TestMsgChanEmpty(t) |
| 7707 | e2termConn1.TestMsgChanEmpty(t) |
| 7708 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7709 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7710 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7711 | } |
| 7712 | |
| 7713 | //----------------------------------------------------------------------------- |
| 7714 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 7715 | // |
| 7716 | // stub stub |
| 7717 | // +-------+ +---------+ +---------+ |
| 7718 | // | xapp | | submgr | | e2term | |
| 7719 | // +-------+ +---------+ +---------+ |
| 7720 | // | | | |
| 7721 | // | [SUBS CREATE] | |
| 7722 | // | | | |
| 7723 | // | | | |
| 7724 | // | RESTSubDelReq | | |
| 7725 | // |---------------->| | |
| 7726 | // | | | |
| 7727 | // | RESTSubDelResp | | |
| 7728 | // |<----------------| | |
| 7729 | // | | | |
| 7730 | // | | SubDelReq | |
| 7731 | // | |------------->| |
| 7732 | // | | | |
| 7733 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7734 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7735 | // | | | |
| 7736 | // | | SubDelReq | |
| 7737 | // | |------------->| |
| 7738 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7739 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7740 | // | |<-------------| No valid subscription found with subIds [0]. |
| 7741 | // | | | |
| 7742 | // | [SUBS DELETE] | |
| 7743 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7744 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7745 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7746 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7747 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7748 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7749 | Counter{cRestSubReqFromXapp, 1}, |
| 7750 | Counter{cRestSubRespToXapp, 1}, |
| 7751 | Counter{cSubReqToE2, 1}, |
| 7752 | Counter{cSubRespFromE2, 1}, |
| 7753 | Counter{cRestSubNotifToXapp, 1}, |
| 7754 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7755 | Counter{cRestSubDelRespToXapp, 1}, |
| 7756 | Counter{cSubDelReqToE2, 1}, |
| 7757 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7758 | Counter{cSubDelReReqToE2, 1}, |
| 7759 | Counter{cSubDelFailFromE2, 2}, |
| 7760 | }) |
| 7761 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7762 | // Req |
| 7763 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7764 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7765 | |
| 7766 | // Del |
| 7767 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7768 | |
| 7769 | // E2t: Receive 1st SubsDelReq |
| 7770 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7771 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7772 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7773 | delreq.RequestId.InstanceId = 0 |
| 7774 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7775 | |
| 7776 | // E2t: Receive 2nd SubsDelReq |
| 7777 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7778 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7779 | // Subscription does not exist in in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7780 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7781 | |
| 7782 | // Wait that subs is cleaned |
| 7783 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7784 | |
| 7785 | xappConn1.TestMsgChanEmpty(t) |
| 7786 | e2termConn1.TestMsgChanEmpty(t) |
| 7787 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7788 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7789 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7790 | } |
| 7791 | |
| 7792 | //----------------------------------------------------------------------------- |
| 7793 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 7794 | // |
| 7795 | // stub stub |
| 7796 | // +-------+ +---------+ +---------+ |
| 7797 | // | xapp | | submgr | | e2term | |
| 7798 | // +-------+ +---------+ +---------+ |
| 7799 | // | | | |
| 7800 | // | [SUBS CREATE] | |
| 7801 | // | | | |
| 7802 | // | | | |
| 7803 | // | RESTSubDelReq | | |
| 7804 | // |---------------->| | |
| 7805 | // | | | |
| 7806 | // | RESTSubDelResp | | |
| 7807 | // |<----------------| | |
| 7808 | // | | | |
| 7809 | // | | SubDelReq | |
| 7810 | // | |------------->| |
| 7811 | // | | | |
| 7812 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7813 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7814 | // | | | |
| 7815 | // | | SubDelReq | |
| 7816 | // | |------------->| |
| 7817 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7818 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7819 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 7820 | // | | | |
| 7821 | // | [SUBS DELETE] | |
| 7822 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7823 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7824 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7825 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7826 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7827 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7828 | Counter{cRestSubReqFromXapp, 1}, |
| 7829 | Counter{cRestSubRespToXapp, 1}, |
| 7830 | Counter{cSubReqToE2, 1}, |
| 7831 | Counter{cSubRespFromE2, 1}, |
| 7832 | Counter{cRestSubNotifToXapp, 1}, |
| 7833 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7834 | Counter{cRestSubDelRespToXapp, 1}, |
| 7835 | Counter{cSubDelReqToE2, 1}, |
| 7836 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7837 | Counter{cSubDelReReqToE2, 1}, |
| 7838 | Counter{cSubDelFailFromE2, 2}, |
| 7839 | }) |
| 7840 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7841 | // Req |
| 7842 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7843 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7844 | |
| 7845 | // Del |
| 7846 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7847 | |
| 7848 | // E2t: Receive 1st SubsDelReq |
| 7849 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7850 | |
| 7851 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 7852 | |
| 7853 | // No transaction exist for this response which will result resending original request |
| 7854 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7855 | |
| 7856 | // E2t: Receive 2nd SubsDelReq |
| 7857 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7858 | |
| 7859 | // Subscription does not exist in in E2 Node. |
| 7860 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7861 | |
| 7862 | // Wait that subs is cleaned |
| 7863 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7864 | |
| 7865 | xappConn1.TestMsgChanEmpty(t) |
| 7866 | e2termConn1.TestMsgChanEmpty(t) |
| 7867 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7868 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7869 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7870 | } |
| 7871 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7872 | //----------------------------------------------------------------------------- |
| 7873 | // TestRESTSubReqFailAsn1PackSubReqError |
| 7874 | // |
| 7875 | // stub stub |
| 7876 | // +-------+ +---------+ +---------+ |
| 7877 | // | xapp | | submgr | | e2term | |
| 7878 | // +-------+ +---------+ +---------+ |
| 7879 | // | | | |
| 7880 | // | RESTSubReq | | |
| 7881 | // |---------------->| | |
| 7882 | // | | | |
| 7883 | // | RESTSubResp | | |
| 7884 | // |<----------------| | |
| 7885 | // | | | |
| 7886 | // | ASN.1 encode fails | |
| 7887 | // | | | |
| 7888 | // | | SubDelReq | |
| 7889 | // | |------------->| |
| 7890 | // | | | |
| 7891 | // | | SubDelFail | |
| 7892 | // | |<-------------| |
| 7893 | // | | | |
| 7894 | // | RESTNotif | | |
| 7895 | // | unsuccess | | |
| 7896 | // |<----------------| | |
| 7897 | // | | | |
| 7898 | // | [SUBS DELETE] | |
| 7899 | // | | | |
| 7900 | // |
| 7901 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7902 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7903 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 7904 | |
| 7905 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7906 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7907 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7908 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7909 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7910 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7911 | }) |
| 7912 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7913 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7914 | |
| 7915 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7916 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7917 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 7918 | |
| 7919 | // Req |
| 7920 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7921 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7922 | |
| 7923 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7924 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7925 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7926 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7927 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7928 | |
| 7929 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7930 | |
| 7931 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7932 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7933 | // Wait that subs is cleaned |
| 7934 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7935 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7936 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7937 | } |
| 7938 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame^] | 7939 | //----------------------------------------------------------------------------- |
| 7940 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 7941 | // |
| 7942 | // stub stub |
| 7943 | // +-------+ +---------+ +---------+ |
| 7944 | // | xapp | | submgr | | e2term | |
| 7945 | // +-------+ +---------+ +---------+ |
| 7946 | // | | | |
| 7947 | // | RESTSubReq | | |
| 7948 | // |---------------->| | |
| 7949 | // | | | |
| 7950 | // | RESTSubResp | | |
| 7951 | // |<----------------| | |
| 7952 | // | | SubReq | |
| 7953 | // | |------------->| |
| 7954 | // | | | |
| 7955 | // | | SubResp | |
| 7956 | // | |<-------------| |
| 7957 | // | | | |
| 7958 | // | RESTNotif | | |
| 7959 | // |<----------------| | |
| 7960 | // | | | |
| 7961 | // | RESTSubReq | | Policy modification |
| 7962 | // |---------------->| | |
| 7963 | // | | | |
| 7964 | // | RESTSubResp | | |
| 7965 | // |<----------------| | |
| 7966 | // | | SubReq | |
| 7967 | // | |------------->| |
| 7968 | // | | | |
| 7969 | // | | | |
| 7970 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 7971 | // |<----------------| | |
| 7972 | // | | | |
| 7973 | // | RESTSubDelReq | | |
| 7974 | // |---------------->| | |
| 7975 | // | | | |
| 7976 | // | | SubDelReq | |
| 7977 | // | |------------->| |
| 7978 | // | | | |
| 7979 | // | | SubDelResp | |
| 7980 | // | |<-------------| |
| 7981 | // | | | |
| 7982 | // | RESTSubDelResp | | |
| 7983 | // |<----------------| | |
| 7984 | // |
| 7985 | //----------------------------------------------------------------------------- |
| 7986 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7987 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7988 | |
| 7989 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7990 | Counter{cRestSubReqFromXapp, 2}, |
| 7991 | Counter{cRestSubRespToXapp, 2}, |
| 7992 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 7993 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7994 | Counter{cSubRespFromE2, 1}, |
| 7995 | Counter{cRestSubNotifToXapp, 1}, |
| 7996 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7997 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7998 | Counter{cSubDelReqToE2, 1}, |
| 7999 | Counter{cSubDelRespFromE2, 1}, |
| 8000 | Counter{cRestSubDelRespToXapp, 1}, |
| 8001 | }) |
| 8002 | |
| 8003 | const e2Timeout int64 = 1 |
| 8004 | const e2RetryCount int64 = 0 |
| 8005 | const routingNeeded bool = false |
| 8006 | |
| 8007 | // Req1 |
| 8008 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8009 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8010 | |
| 8011 | // Subs Create |
| 8012 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8013 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8014 | |
| 8015 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8016 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8017 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8018 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8019 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8020 | |
| 8021 | // Policy change |
| 8022 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8023 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8024 | params.SetSubscriptionID(&restSubId) |
| 8025 | params.SetTimeToWait("w200ms") |
| 8026 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8027 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8028 | |
| 8029 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8030 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8031 | // SubsResp is missing, e2SubsId will be 0 |
| 8032 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8033 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8034 | |
| 8035 | // Del |
| 8036 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8037 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8038 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8039 | |
| 8040 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8041 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8042 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8043 | } |
| 8044 | |
| 8045 | //----------------------------------------------------------------------------- |
| 8046 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8047 | // |
| 8048 | // stub stub |
| 8049 | // +-------+ +---------+ +---------+ |
| 8050 | // | xapp | | submgr | | e2term | |
| 8051 | // +-------+ +---------+ +---------+ |
| 8052 | // | | | |
| 8053 | // | RESTSubReq | | |
| 8054 | // |---------------->| | |
| 8055 | // | | | |
| 8056 | // | RESTSubResp | | |
| 8057 | // |<----------------| | |
| 8058 | // | | SubReq | |
| 8059 | // | |------------->| |
| 8060 | // | | | |
| 8061 | // | | SubResp | |
| 8062 | // | |<-------------| |
| 8063 | // | | | |
| 8064 | // | RESTNotif | | |
| 8065 | // |<----------------| | |
| 8066 | // | | | |
| 8067 | // | RESTSubReq | | |
| 8068 | // |---------------->| | |
| 8069 | // | | | |
| 8070 | // | RESTSubResp | | |
| 8071 | // |<----------------| | |
| 8072 | // | | SubReq | |
| 8073 | // | |------------->| |
| 8074 | // | | |
| 8075 | // | Submgr restart | |
| 8076 | // | | | |
| 8077 | // | RESTSubDelReq | | |
| 8078 | // |---------------->| | |
| 8079 | // | | | |
| 8080 | // | | SubDelReq | |
| 8081 | // | |------------->| |
| 8082 | // | | | |
| 8083 | // | | SubDelResp | |
| 8084 | // | |<-------------| |
| 8085 | // | | | |
| 8086 | // | RESTSubDelResp | | |
| 8087 | // |<----------------| | |
| 8088 | // |
| 8089 | //----------------------------------------------------------------------------- |
| 8090 | |
| 8091 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8092 | |
| 8093 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8094 | Counter{cRestSubReqFromXapp, 2}, |
| 8095 | Counter{cRestSubRespToXapp, 2}, |
| 8096 | Counter{cSubReqToE2, 2}, |
| 8097 | Counter{cSubRespFromE2, 1}, |
| 8098 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8099 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8100 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8101 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8102 | Counter{cRestSubDelRespToXapp, 1}, |
| 8103 | }) |
| 8104 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8105 | const e2Timeout int64 = 1 |
| 8106 | const e2RetryCount int64 = 0 |
| 8107 | const routingNeeded bool = false |
| 8108 | |
| 8109 | // Req1 |
| 8110 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8111 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8112 | // Create subscription |
| 8113 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8114 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8115 | |
| 8116 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8117 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8118 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8119 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8120 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8121 | |
| 8122 | // Check subscription |
| 8123 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8124 | |
| 8125 | // Policy change |
| 8126 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8127 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8128 | params.SetSubscriptionID(&restSubId) |
| 8129 | params.SetTimeToWait("w200ms") |
| 8130 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8131 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8132 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8133 | |
| 8134 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8135 | mainCtrl.SetResetTestFlag(t, false) |
| 8136 | |
| 8137 | // SubsResp is missing due to submgr restart |
| 8138 | |
| 8139 | mainCtrl.SimulateRestart(t) |
| 8140 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8141 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8142 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8143 | // That needs to be completed before successful subscription query is possible |
| 8144 | <-time.After(time.Second * 1) |
| 8145 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8146 | // Check subscription |
| 8147 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8148 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8149 | // Delete subscription |
| 8150 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8151 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8152 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8153 | |
| 8154 | //Wait that subs is cleaned |
| 8155 | waitSubsCleanup(t, e2SubsId, 10) |
| 8156 | |
| 8157 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8158 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8159 | } |
| 8160 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8161 | //////////////////////////////////////////////////////////////////////////////////// |
| 8162 | // Services for UT cases |
| 8163 | //////////////////////////////////////////////////////////////////////////////////// |
| 8164 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8165 | const host string = "localhost" |
| 8166 | |
| 8167 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8168 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8169 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8170 | } |
| 8171 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8172 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8173 | |
| 8174 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8175 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8176 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8177 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8178 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8179 | |
| 8180 | return restSubId, e2SubsId |
| 8181 | } |
| 8182 | |
| 8183 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8184 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8185 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8186 | if meid != "" { |
| 8187 | params.SetMeid(meid) |
| 8188 | } |
| 8189 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8190 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8191 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8192 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8193 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8194 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8195 | |
| 8196 | return restSubId, e2SubsId |
| 8197 | } |
| 8198 | |
| 8199 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8200 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8201 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8202 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8203 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8204 | |
| 8205 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8206 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8207 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8208 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8209 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8210 | |
| 8211 | return restSubId, e2SubsId |
| 8212 | } |
| 8213 | |
| 8214 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8215 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8216 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8217 | |
| 8218 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8219 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8220 | fparams1.Set(crereq1) |
| 8221 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8222 | |
| 8223 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8224 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8225 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8226 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8227 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8228 | |
| 8229 | return restSubId, e2SubsId |
| 8230 | } |
| 8231 | |
| 8232 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8233 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8234 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8235 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8236 | } |
| 8237 | |
| 8238 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8239 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8240 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8241 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8242 | } |
| 8243 | |
| 8244 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8245 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8246 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8247 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8248 | } |
| 8249 | |
| 8250 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8251 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8252 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8253 | assert.Equal(t, meid, resp[0].Meid) |
| 8254 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8255 | } |
| 8256 | |
| 8257 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8258 | //Wait that subs is cleaned |
| 8259 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8260 | |
| 8261 | xappConn1.TestMsgChanEmpty(t) |
| 8262 | xappConn2.TestMsgChanEmpty(t) |
| 8263 | e2termConn1.TestMsgChanEmpty(t) |
| 8264 | mainCtrl.wait_registry_empty(t, timeout) |
| 8265 | } |
| 8266 | |
| 8267 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8268 | |
| 8269 | var e2SubsId []uint32 |
| 8270 | |
| 8271 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8272 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8273 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8274 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8275 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8276 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8277 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8278 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8279 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8280 | <-time.After(100 * time.Millisecond) |
| 8281 | } |
| 8282 | return e2SubsId |
| 8283 | } |
| 8284 | |
| 8285 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8286 | |
| 8287 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8288 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8289 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8290 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8291 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8292 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8293 | <-time.After(100 * time.Millisecond) |
| 8294 | } |
| 8295 | |
| 8296 | // Wait that subs is cleaned |
| 8297 | for i := 0; i < len(e2SubsIds); i++ { |
| 8298 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8299 | } |
| 8300 | |
| 8301 | } |