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 ( |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 23 | //"os" |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 24 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 25 | "testing" |
| 26 | "time" |
| 27 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 31 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 32 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 33 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 34 | ) |
| 35 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 36 | func TestSuiteSetup(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 37 | // The effect of this call shall endure though the UT suite! |
| 38 | // If this causes any issues, the previous interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 39 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 40 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 41 | |
| 42 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 43 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 44 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 45 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 46 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 47 | |
| 48 | // Current UT test cases use these ran names |
| 49 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 50 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 51 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 52 | |
| 53 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 54 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 55 | |
| 56 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 57 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 58 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
| 59 | } |
| 60 | |
| 61 | //----------------------------------------------------------------------------- |
| 62 | // TestRESTSubReqAfterE2ConnBreak |
| 63 | // |
| 64 | // stub stub |
| 65 | // +-------+ +---------+ +---------+ |
| 66 | // | xapp | | submgr | | e2term | |
| 67 | // +-------+ +---------+ +---------+ |
| 68 | // | | | |
| 69 | // | [E2 Conn. DOWN] | |
| 70 | // | | | |
| 71 | // | RESTSubReq | | |
| 72 | // |---------------->| | |
| 73 | // | RESTSubFail | | |
| 74 | // |<----------------| | |
| 75 | // | | | |
| 76 | // |
| 77 | //----------------------------------------------------------------------------- |
| 78 | |
| 79 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
| 80 | CaseBegin("TestRESTSubReqAfterE2ConnBreak") |
| 81 | |
| 82 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 83 | Counter{cRestSubReqFromXapp, 1}, |
| 84 | Counter{cRestReqRejDueE2Down, 1}, |
| 85 | }) |
| 86 | |
| 87 | // E2 disconnect after E2term has received response |
| 88 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 89 | // Req |
| 90 | const subReqCount int = 1 |
| 91 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 92 | xappConn1.SendRESTSubsReq(t, params) |
| 93 | |
| 94 | // Restore E2 connection for following test cases |
| 95 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 96 | |
| 97 | mainCtrl.VerifyCounterValues(t) |
| 98 | } |
| 99 | |
| 100 | //----------------------------------------------------------------------------- |
| 101 | // TestRESTSubReqE2ConnBreak |
| 102 | // |
| 103 | // stub stub |
| 104 | // +-------+ +---------+ +---------+ |
| 105 | // | xapp | | submgr | | e2term | |
| 106 | // +-------+ +---------+ +---------+ |
| 107 | // | | | |
| 108 | // | RESTSubReq | | |
| 109 | // |---------------->| | |
| 110 | // | RESTSubResp | | |
| 111 | // |<----------------| | |
| 112 | // | | SubReq | |
| 113 | // | |------------->| |
| 114 | // | | SubResp | |
| 115 | // | |<-------------| |
| 116 | // | | | |
| 117 | // | [E2 Conn. DOWN] | |
| 118 | // | [Int. SUBS DELETE] | |
| 119 | // | | | |
| 120 | // | RESTNotif(unsuccessful) | |
| 121 | // |<----------------| | |
| 122 | // | | | |
| 123 | // | | | |
| 124 | // |
| 125 | //----------------------------------------------------------------------------- |
| 126 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
| 127 | CaseBegin("TestRESTSubReqE2ConnBreak") |
| 128 | |
| 129 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 130 | Counter{cRestSubReqFromXapp, 1}, |
| 131 | Counter{cRestSubRespToXapp, 1}, |
| 132 | Counter{cSubReqToE2, 1}, |
| 133 | Counter{cSubRespFromE2, 1}, |
| 134 | Counter{cRestSubFailNotifToXapp, 1}, |
| 135 | }) |
| 136 | |
| 137 | // Req |
| 138 | const subReqCount int = 1 |
| 139 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 140 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 141 | |
| 142 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 143 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 144 | |
| 145 | // E2 disconnect after E2term has received response |
| 146 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 147 | |
| 148 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 149 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 150 | |
| 151 | <-time.After(time.Second * 1) |
| 152 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 153 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 154 | |
| 155 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 156 | if err != nil { |
| 157 | xapp.Logger.Error("%v", err) |
| 158 | } else { |
| 159 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 160 | assert.Equal(t, 0, len(register)) |
| 161 | } |
| 162 | |
| 163 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 164 | if err != nil { |
| 165 | xapp.Logger.Error("%v", err) |
| 166 | } else { |
| 167 | assert.Equal(t, 0, len(restSubscriptions)) |
| 168 | } |
| 169 | |
| 170 | // Restore E2 connection for following test cases |
| 171 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 172 | |
| 173 | // Wait that subs is cleaned |
| 174 | waitSubsCleanup(t, e2SubsId, 10) |
| 175 | mainCtrl.VerifyCounterValues(t) |
| 176 | } |
| 177 | |
| 178 | //----------------------------------------------------------------------------- |
| 179 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 180 | // |
| 181 | // stub stub |
| 182 | // +-------+ +---------+ +---------+ |
| 183 | // | xapp | | submgr | | e2term | |
| 184 | // +-------+ +---------+ +---------+ |
| 185 | // | | | |
| 186 | // | [SUBS CREATE] | |
| 187 | // | | | |
| 188 | // | [E2 Conn. DOWN] | |
| 189 | // | | | |
| 190 | // | RESTSubDelReq | | |
| 191 | // |---------------->| | |
| 192 | // | | | |
| 193 | // | RESTSubDelResp | | |
| 194 | // |<----------------| | |
| 195 | // | | | |
| 196 | // | [No valid subscription found] | |
| 197 | // | | | |
| 198 | // |
| 199 | //----------------------------------------------------------------------------- |
| 200 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 201 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 202 | |
| 203 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 204 | Counter{cRestSubReqFromXapp, 1}, |
| 205 | Counter{cRestSubRespToXapp, 1}, |
| 206 | Counter{cSubReqToE2, 1}, |
| 207 | Counter{cSubRespFromE2, 1}, |
| 208 | Counter{cRestSubNotifToXapp, 1}, |
| 209 | Counter{cRestSubDelReqFromXapp, 1}, |
| 210 | Counter{cRestSubDelRespToXapp, 1}, |
| 211 | }) |
| 212 | |
| 213 | // Req |
| 214 | var params *teststube2ap.RESTSubsReqParams = nil |
| 215 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 216 | |
| 217 | // E2 disconnect after E2term has received response |
| 218 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 219 | |
| 220 | // Del |
| 221 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 222 | |
| 223 | <-time.After(time.Second * 1) |
| 224 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 225 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 226 | |
| 227 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 228 | if err != nil { |
| 229 | xapp.Logger.Error("%v", err) |
| 230 | } else { |
| 231 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 232 | assert.Equal(t, 0, len(register)) |
| 233 | } |
| 234 | |
| 235 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 236 | if err != nil { |
| 237 | xapp.Logger.Error("%v", err) |
| 238 | } else { |
| 239 | assert.Equal(t, 0, len(restSubscriptions)) |
| 240 | } |
| 241 | |
| 242 | // Restore E2 connection for following test cases |
| 243 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 244 | |
| 245 | // Wait that subs is cleaned |
| 246 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 247 | |
| 248 | xappConn1.TestMsgChanEmpty(t) |
| 249 | e2termConn1.TestMsgChanEmpty(t) |
| 250 | mainCtrl.wait_registry_empty(t, 10) |
| 251 | mainCtrl.VerifyCounterValues(t) |
| 252 | } |
| 253 | |
| 254 | //----------------------------------------------------------------------------- |
| 255 | // TestRESTOtherE2ConnectionChanges |
| 256 | // |
| 257 | |
| 258 | // stub stub |
| 259 | // +-------+ +---------+ +---------+ |
| 260 | // | xapp | | submgr | | e2term | |
| 261 | // +-------+ +---------+ +---------+ |
| 262 | // | | | |
| 263 | // | [SUBS CREATE] | |
| 264 | // | | | |
| 265 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 266 | // | [E2 CONNECTING] | |
| 267 | // | [E2 SHUTTING_DOWN] | |
| 268 | // | [E2 SHUT_DOWN] | |
| 269 | // | | | |
| 270 | // | [SUBS DELETE] | |
| 271 | // | | | |
| 272 | // |
| 273 | //----------------------------------------------------------------------------- |
| 274 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 275 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 276 | |
| 277 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 278 | Counter{cRestSubReqFromXapp, 1}, |
| 279 | Counter{cRestSubRespToXapp, 1}, |
| 280 | Counter{cSubReqToE2, 1}, |
| 281 | Counter{cSubRespFromE2, 1}, |
| 282 | Counter{cRestSubNotifToXapp, 1}, |
| 283 | Counter{cRestSubDelReqFromXapp, 1}, |
| 284 | Counter{cSubDelReqToE2, 1}, |
| 285 | Counter{cSubDelRespFromE2, 1}, |
| 286 | Counter{cRestSubDelRespToXapp, 1}, |
| 287 | }) |
| 288 | |
| 289 | // Req |
| 290 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 291 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 292 | |
| 293 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 294 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 295 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 296 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 297 | |
| 298 | // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED |
| 299 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 300 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 301 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 302 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 303 | |
| 304 | // Del |
| 305 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 306 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 307 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 308 | |
| 309 | // Restore E2 connection for following test cases |
| 310 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 311 | |
| 312 | // Wait that subs is cleaned |
| 313 | waitSubsCleanup(t, e2SubsId, 10) |
| 314 | mainCtrl.VerifyCounterValues(t) |
| 315 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 316 | |
| 317 | //----------------------------------------------------------------------------- |
| 318 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 319 | // |
| 320 | // stub stub stub |
| 321 | // +-------+ +---------+ +---------+ +---------+ |
| 322 | // | xapp | | submgr | | e2term | | rtmgr | |
| 323 | // +-------+ +---------+ +---------+ +---------+ |
| 324 | // | | | | |
| 325 | // | RESTSubReq | | | |
| 326 | // |---------------->| | | |
| 327 | // | | RouteCreate | | |
| 328 | // | |--------------------------->| // The order of these events may vary |
| 329 | // | | | | |
| 330 | // | RESTSubResp | | | // The order of these events may vary |
| 331 | // |<----------------| | | |
| 332 | // | | RouteResponse| | |
| 333 | // | |<---------------------------| // The order of these events may vary |
| 334 | // | | | | |
| 335 | // | | SubReq | | |
| 336 | // | |------------->| | // The order of these events may vary |
| 337 | // | | | | |
| 338 | // | | SubResp | | |
| 339 | // | |<-------------| | |
| 340 | // | RESTNotif1 | | | |
| 341 | // |<----------------| | | |
| 342 | // | | | | |
| 343 | // | RESTSubDelReq | | | |
| 344 | // |---------------->| | | |
| 345 | // | | SubDelReq | | |
| 346 | // | |------------->| | |
| 347 | // | | | | |
| 348 | // | RESTSubDelResp| | | |
| 349 | // |<----------------| | | |
| 350 | // | | | | |
| 351 | // | | SubDelResp | | |
| 352 | // | |<-------------| | |
| 353 | // | | | | |
| 354 | // | | | | |
| 355 | // |
| 356 | //----------------------------------------------------------------------------- |
| 357 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 358 | |
| 359 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 360 | |
| 361 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 362 | |
| 363 | waitSubsCleanup(t, e2SubsId, 10) |
| 364 | } |
| 365 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 366 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 367 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 368 | // |
| 369 | // stub stub stub |
| 370 | // +-------+ +---------+ +---------+ +---------+ |
| 371 | // | xapp | | submgr | | e2term | | rtmgr | |
| 372 | // +-------+ +---------+ +---------+ +---------+ |
| 373 | // | | | | |
| 374 | // | RESTSubReq | | | |
| 375 | // |---------------->| | | |
| 376 | // | | RouteCreate | | |
| 377 | // | |--------------------------->| // The order of these events may vary |
| 378 | // | | | | |
| 379 | // | RESTSubResp | | | // The order of these events may vary |
| 380 | // |<----------------| | | |
| 381 | // | | RouteResponse| | |
| 382 | // | |<---------------------------| // The order of these events may vary |
| 383 | // | | | | |
| 384 | // | | SubReq | | |
| 385 | // | |------------->| | // The order of these events may vary |
| 386 | // | | | | |
| 387 | // | | SubResp | | |
| 388 | // | |<-------------| | |
| 389 | // | RESTNotif1 | | | |
| 390 | // |<----------------| | | |
| 391 | // | | | | |
| 392 | // | RESTSubDelReq | | | |
| 393 | // |---------------->| | | |
| 394 | // | | | | |
| 395 | // | RESTSubDelResp| | | |
| 396 | // |<----------------| | | |
| 397 | // | | | | |
| 398 | // | | | | |
| 399 | // |
| 400 | //----------------------------------------------------------------------------- |
| 401 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 402 | |
| 403 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 404 | |
| 405 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 406 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 407 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 408 | |
| 409 | waitSubsCleanup(t, e2SubsId, 10) |
| 410 | } |
| 411 | |
| 412 | //----------------------------------------------------------------------------- |
| 413 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 414 | // |
| 415 | // stub stub stub |
| 416 | // +-------+ +---------+ +---------+ +---------+ |
| 417 | // | xapp | | submgr | | e2term | | rtmgr | |
| 418 | // +-------+ +---------+ +---------+ +---------+ |
| 419 | // | | | | |
| 420 | // | RESTSubReq | | | |
| 421 | // |---------------->| | | |
| 422 | // | | RouteCreate | | |
| 423 | // | |--------------------------->| // The order of these events may vary |
| 424 | // | | | | |
| 425 | // | RESTSubResp | | | // The order of these events may vary |
| 426 | // |<----------------| | | |
| 427 | // | | RouteResponse| | |
| 428 | // | |<---------------------------| // The order of these events may vary |
| 429 | // | | | | |
| 430 | // | | SubReq | | |
| 431 | // | |------------->| | // The order of these events may vary |
| 432 | // | | | | |
| 433 | // | | SubResp | | |
| 434 | // | |<-------------| | |
| 435 | // | RESTNotif1 | | | |
| 436 | // |<----------------| | | |
| 437 | // | | | | |
| 438 | // | RESTSubDelReq | | | |
| 439 | // |---------------->| | | |
| 440 | // | | SubDelReq | | |
| 441 | // | |------------->| | |
| 442 | // | | | | |
| 443 | // | RESTSubDelResp| | | |
| 444 | // |<----------------| | | // The order of these events may vary |
| 445 | // | | | | |
| 446 | // | | SubDelResp | | |
| 447 | // | |<-------------| | // 1.st NOK |
| 448 | // | | | | |
| 449 | // | | SubDelReq | | |
| 450 | // | |------------->| | |
| 451 | // | | | | |
| 452 | // | | SubDelResp | | |
| 453 | // | |<-------------| | // 2.nd NOK |
| 454 | // |
| 455 | //----------------------------------------------------------------------------- |
| 456 | |
| 457 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 458 | |
| 459 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 460 | |
| 461 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 462 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 463 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 464 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 465 | |
| 466 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 467 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 468 | |
| 469 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 470 | |
| 471 | waitSubsCleanup(t, e2SubsId, 10) |
| 472 | } |
| 473 | |
| 474 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 475 | // TestSubReqAndRouteNok |
| 476 | // |
| 477 | // stub stub |
| 478 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 479 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 480 | // +-------+ +---------+ +---------+ |
| 481 | // | | | |
| 482 | // | SubReq | | |
| 483 | // |------------->| | |
| 484 | // | | | |
| 485 | // | | RouteCreate | |
| 486 | // | |------------->| |
| 487 | // | | | |
| 488 | // | | RouteCreate | |
| 489 | // | | status:400 | |
| 490 | // | |<-------------| |
| 491 | // | | | |
| 492 | // | [SUBS INT DELETE] | |
| 493 | // | | | |
| 494 | // |
| 495 | //----------------------------------------------------------------------------- |
| 496 | |
| 497 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 498 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 499 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 500 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 501 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 502 | Counter{cSubReqFromXapp, 1}, |
| 503 | Counter{cRouteCreateFail, 1}, |
| 504 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 505 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 506 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 507 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 508 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 509 | waiter.WaitResult(t) |
| 510 | |
| 511 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 512 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 513 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 514 | xappConn1.TestMsgChanEmpty(t) |
| 515 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 516 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 517 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 518 | |
| 519 | <-time.After(1 * time.Second) |
| 520 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 524 | // TestSubReqAndRouteUpdateNok |
| 525 | |
| 526 | // stub stub |
| 527 | // +-------+ +-------+ +---------+ +---------+ |
| 528 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 529 | // +-------+ +-------+ +---------+ +---------+ |
| 530 | // | | | | |
| 531 | // | [SUBS CREATE] | | |
| 532 | // | | | | |
| 533 | // | | | | |
| 534 | // | | | | |
| 535 | // | SubReq (mergeable) | | |
| 536 | // |--------------------------->| | | |
| 537 | // | | | | |
| 538 | // | | | RouteUpdate | |
| 539 | // | | |------------->| |
| 540 | // | | | | |
| 541 | // | | | RouteUpdate | |
| 542 | // | | | status:400 | |
| 543 | // | | |<-------------| |
| 544 | // | | | | |
| 545 | // | [SUBS INT DELETE] | | |
| 546 | // | | | | |
| 547 | // | | | | |
| 548 | // | [SUBS DELETE] | | |
| 549 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 550 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 551 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 552 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 553 | |
| 554 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 555 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 556 | Counter{cSubReqFromXapp, 2}, |
| 557 | Counter{cSubReqToE2, 1}, |
| 558 | Counter{cSubRespFromE2, 1}, |
| 559 | Counter{cSubRespToXapp, 1}, |
| 560 | Counter{cRouteCreateUpdateFail, 1}, |
| 561 | Counter{cSubDelReqFromXapp, 1}, |
| 562 | Counter{cSubDelReqToE2, 1}, |
| 563 | Counter{cSubDelRespFromE2, 1}, |
| 564 | Counter{cSubDelRespToXapp, 1}, |
| 565 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 566 | |
| 567 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 568 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 569 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 570 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 571 | |
| 572 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 573 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 574 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 575 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 576 | |
| 577 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 578 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 579 | xappConn2.SendSubsReq(t, nil, nil) |
| 580 | waiter.WaitResult(t) |
| 581 | |
| 582 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 583 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 584 | |
| 585 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 586 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 587 | |
| 588 | //Wait that subs is cleaned |
| 589 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 590 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 591 | |
| 592 | xappConn1.TestMsgChanEmpty(t) |
| 593 | xappConn2.TestMsgChanEmpty(t) |
| 594 | e2termConn1.TestMsgChanEmpty(t) |
| 595 | mainCtrl.wait_registry_empty(t, 10) |
| 596 | |
| 597 | mainCtrl.VerifyCounterValues(t) |
| 598 | } |
| 599 | |
| 600 | //----------------------------------------------------------------------------- |
| 601 | // TestSubDelReqAndRouteDeleteNok |
| 602 | // |
| 603 | // stub stub |
| 604 | // +-------+ +---------+ +---------+ +---------+ |
| 605 | // | xapp | | submgr | | e2term | | rtmgr | |
| 606 | // +-------+ +---------+ +---------+ +---------+ |
| 607 | // | | | | |
| 608 | // | [SUBS CREATE] | | |
| 609 | // | | | | |
| 610 | // | | | | |
| 611 | // | | | | |
| 612 | // | SubDelReq | | | |
| 613 | // |------------->| | | |
| 614 | // | | SubDelReq | | |
| 615 | // | |------------->| | |
| 616 | // | | SubDelRsp | | |
| 617 | // | |<-------------| | |
| 618 | // | SubDelRsp | | | |
| 619 | // |<-------------| | | |
| 620 | // | | RouteDelete | | |
| 621 | // | |---------------------------->| |
| 622 | // | | | | |
| 623 | // | | RouteDelete | | |
| 624 | // | | status:400 | | |
| 625 | // | |<----------------------------| |
| 626 | // | | | | |
| 627 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 628 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 629 | |
| 630 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 631 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 632 | Counter{cSubReqFromXapp, 1}, |
| 633 | Counter{cSubReqToE2, 1}, |
| 634 | Counter{cSubRespFromE2, 1}, |
| 635 | Counter{cSubRespToXapp, 1}, |
| 636 | Counter{cSubDelReqFromXapp, 1}, |
| 637 | Counter{cRouteDeleteFail, 1}, |
| 638 | Counter{cSubDelReqToE2, 1}, |
| 639 | Counter{cSubDelRespFromE2, 1}, |
| 640 | Counter{cSubDelRespToXapp, 1}, |
| 641 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 642 | |
| 643 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 644 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 645 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 646 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 647 | |
| 648 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 649 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 650 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 651 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 652 | |
| 653 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 654 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 655 | |
| 656 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 657 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 658 | waiter.WaitResult(t) |
| 659 | |
| 660 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 661 | |
| 662 | //Wait that subs is cleaned |
| 663 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 664 | |
| 665 | xappConn1.TestMsgChanEmpty(t) |
| 666 | xappConn2.TestMsgChanEmpty(t) |
| 667 | e2termConn1.TestMsgChanEmpty(t) |
| 668 | mainCtrl.wait_registry_empty(t, 10) |
| 669 | |
| 670 | mainCtrl.VerifyCounterValues(t) |
| 671 | } |
| 672 | |
| 673 | //----------------------------------------------------------------------------- |
| 674 | // TestSubMergeDelAndRouteUpdateNok |
| 675 | // stub stub |
| 676 | // +-------+ +-------+ +---------+ +---------+ |
| 677 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 678 | // +-------+ +-------+ +---------+ +---------+ |
| 679 | // | | | | |
| 680 | // | | | | |
| 681 | // | | | | |
| 682 | // | | SubReq1 | | |
| 683 | // | |------------->| | |
| 684 | // | | | | |
| 685 | // | | | SubReq1 | |
| 686 | // | | |------------->| |
| 687 | // | | | SubResp1 | |
| 688 | // | | |<-------------| |
| 689 | // | | SubResp1 | | |
| 690 | // | |<-------------| | |
| 691 | // | | | | |
| 692 | // | SubReq2 | | |
| 693 | // |--------------------------->| | |
| 694 | // | | | | |
| 695 | // | SubResp2 | | |
| 696 | // |<---------------------------| | |
| 697 | // | | | | |
| 698 | // | | SubDelReq 1 | | |
| 699 | // | |------------->| | |
| 700 | // | | | RouteUpdate | |
| 701 | // | | |-----> rtmgr | |
| 702 | // | | | | |
| 703 | // | | | RouteUpdate | |
| 704 | // | | | status:400 | |
| 705 | // | | |<----- rtmgr | |
| 706 | // | | | | |
| 707 | // | | SubDelResp 1 | | |
| 708 | // | |<-------------| | |
| 709 | // | | | | |
| 710 | // | SubDelReq 2 | | |
| 711 | // |--------------------------->| | |
| 712 | // | | | | |
| 713 | // | | | SubDelReq 2 | |
| 714 | // | | |------------->| |
| 715 | // | | | | |
| 716 | // | | | SubDelReq 2 | |
| 717 | // | | |------------->| |
| 718 | // | | | | |
| 719 | // | SubDelResp 2 | | |
| 720 | // |<---------------------------| | |
| 721 | // |
| 722 | //----------------------------------------------------------------------------- |
| 723 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 724 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 725 | |
| 726 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 727 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 728 | Counter{cSubReqFromXapp, 2}, |
| 729 | Counter{cSubReqToE2, 1}, |
| 730 | Counter{cSubRespFromE2, 1}, |
| 731 | Counter{cSubRespToXapp, 2}, |
| 732 | Counter{cSubDelReqFromXapp, 2}, |
| 733 | Counter{cRouteDeleteUpdateFail, 1}, |
| 734 | Counter{cSubDelReqToE2, 1}, |
| 735 | Counter{cSubDelRespFromE2, 1}, |
| 736 | Counter{cSubDelRespToXapp, 2}, |
| 737 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 738 | |
| 739 | //Req1 |
| 740 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 741 | rparams1.Init() |
| 742 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 743 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 744 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 745 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 746 | |
| 747 | //Req2 |
| 748 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 749 | rparams2.Init() |
| 750 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 751 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 752 | |
| 753 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 754 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 755 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 756 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 757 | |
| 758 | //Del1 |
| 759 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 760 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 761 | waiter.WaitResult(t) |
| 762 | |
| 763 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 764 | |
| 765 | //Del2 |
| 766 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 767 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 768 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 769 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 770 | //Wait that subs is cleaned |
| 771 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 772 | |
| 773 | xappConn1.TestMsgChanEmpty(t) |
| 774 | xappConn2.TestMsgChanEmpty(t) |
| 775 | e2termConn1.TestMsgChanEmpty(t) |
| 776 | mainCtrl.wait_registry_empty(t, 10) |
| 777 | |
| 778 | mainCtrl.VerifyCounterValues(t) |
| 779 | } |
| 780 | |
| 781 | //----------------------------------------------------------------------------- |
| 782 | |
| 783 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 784 | // TestSubReqAndSubDelOk |
| 785 | // |
| 786 | // stub stub |
| 787 | // +-------+ +---------+ +---------+ |
| 788 | // | xapp | | submgr | | e2term | |
| 789 | // +-------+ +---------+ +---------+ |
| 790 | // | | | |
| 791 | // | SubReq | | |
| 792 | // |------------->| | |
| 793 | // | | | |
| 794 | // | | SubReq | |
| 795 | // | |------------->| |
| 796 | // | | | |
| 797 | // | | SubResp | |
| 798 | // | |<-------------| |
| 799 | // | | | |
| 800 | // | SubResp | | |
| 801 | // |<-------------| | |
| 802 | // | | | |
| 803 | // | | | |
| 804 | // | SubDelReq | | |
| 805 | // |------------->| | |
| 806 | // | | | |
| 807 | // | | SubDelReq | |
| 808 | // | |------------->| |
| 809 | // | | | |
| 810 | // | | SubDelResp | |
| 811 | // | |<-------------| |
| 812 | // | | | |
| 813 | // | SubDelResp | | |
| 814 | // |<-------------| | |
| 815 | // |
| 816 | //----------------------------------------------------------------------------- |
| 817 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 818 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 819 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 820 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 821 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 822 | Counter{cSubReqFromXapp, 1}, |
| 823 | Counter{cSubReqToE2, 1}, |
| 824 | Counter{cSubRespFromE2, 1}, |
| 825 | Counter{cSubRespToXapp, 1}, |
| 826 | Counter{cSubDelReqFromXapp, 1}, |
| 827 | Counter{cSubDelReqToE2, 1}, |
| 828 | Counter{cSubDelRespFromE2, 1}, |
| 829 | Counter{cSubDelRespToXapp, 1}, |
| 830 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 831 | |
| 832 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 833 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 834 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 835 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 836 | |
| 837 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 838 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 839 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 840 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 841 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 842 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 843 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 844 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 845 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 847 | |
| 848 | //Wait that subs is cleaned |
| 849 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 850 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 851 | xappConn1.TestMsgChanEmpty(t) |
| 852 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 853 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 854 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 855 | |
| 856 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | //----------------------------------------------------------------------------- |
| 860 | // TestSubReqRetransmission |
| 861 | // |
| 862 | // stub stub |
| 863 | // +-------+ +---------+ +---------+ |
| 864 | // | xapp | | submgr | | e2term | |
| 865 | // +-------+ +---------+ +---------+ |
| 866 | // | | | |
| 867 | // | SubReq | | |
| 868 | // |------------->| | |
| 869 | // | | | |
| 870 | // | | SubReq | |
| 871 | // | |------------->| |
| 872 | // | | | |
| 873 | // | SubReq | | |
| 874 | // | (retrans) | | |
| 875 | // |------------->| | |
| 876 | // | | | |
| 877 | // | | SubResp | |
| 878 | // | |<-------------| |
| 879 | // | | | |
| 880 | // | SubResp | | |
| 881 | // |<-------------| | |
| 882 | // | | | |
| 883 | // | [SUBS DELETE] | |
| 884 | // | | | |
| 885 | // |
| 886 | //----------------------------------------------------------------------------- |
| 887 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 888 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 889 | |
| 890 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 891 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 892 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 893 | |
| 894 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 895 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 896 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 897 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 898 | // hack as there is no real way to see has message be handled. |
| 899 | // Previuos counter check just tells that is has been received by submgr |
| 900 | // --> artificial delay |
| 901 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 902 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 903 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 904 | |
| 905 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 906 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 907 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 908 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 909 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 910 | |
| 911 | //Wait that subs is cleaned |
| 912 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 913 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 914 | xappConn1.TestMsgChanEmpty(t) |
| 915 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 916 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 917 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 918 | } |
| 919 | |
| 920 | //----------------------------------------------------------------------------- |
| 921 | // TestSubDelReqRetransmission |
| 922 | // |
| 923 | // stub stub |
| 924 | // +-------+ +---------+ +---------+ |
| 925 | // | xapp | | submgr | | e2term | |
| 926 | // +-------+ +---------+ +---------+ |
| 927 | // | | | |
| 928 | // | [SUBS CREATE] | |
| 929 | // | | | |
| 930 | // | | | |
| 931 | // | SubDelReq | | |
| 932 | // |------------->| | |
| 933 | // | | | |
| 934 | // | | SubDelReq | |
| 935 | // | |------------->| |
| 936 | // | | | |
| 937 | // | SubDelReq | | |
| 938 | // | (same sub) | | |
| 939 | // | (same xid) | | |
| 940 | // |------------->| | |
| 941 | // | | | |
| 942 | // | | SubDelResp | |
| 943 | // | |<-------------| |
| 944 | // | | | |
| 945 | // | SubDelResp | | |
| 946 | // |<-------------| | |
| 947 | // |
| 948 | //----------------------------------------------------------------------------- |
| 949 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 950 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 951 | |
| 952 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 953 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 954 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 955 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 956 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 957 | |
| 958 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 959 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 960 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 961 | |
| 962 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 963 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 964 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 965 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 966 | // hack as there is no real way to see has message be handled. |
| 967 | // Previuos counter check just tells that is has been received by submgr |
| 968 | // --> artificial delay |
| 969 | <-time.After(1 * time.Second) |
| 970 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 971 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 972 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 973 | |
| 974 | //Wait that subs is cleaned |
| 975 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 976 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 977 | xappConn1.TestMsgChanEmpty(t) |
| 978 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 979 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 980 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 981 | } |
| 982 | |
| 983 | //----------------------------------------------------------------------------- |
| 984 | // TestSubDelReqCollision |
| 985 | // |
| 986 | // stub stub |
| 987 | // +-------+ +---------+ +---------+ |
| 988 | // | xapp | | submgr | | e2term | |
| 989 | // +-------+ +---------+ +---------+ |
| 990 | // | | | |
| 991 | // | [SUBS CREATE] | |
| 992 | // | | | |
| 993 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 994 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 995 | // |------------->| | |
| 996 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 997 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 998 | // | |------------->| |
| 999 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1000 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1001 | // | (same sub) | | |
| 1002 | // | (diff xid) | | |
| 1003 | // |------------->| | |
| 1004 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1005 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | // | |<-------------| |
| 1007 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1008 | // | SubDelResp 1 | | |
| 1009 | // |<-------------| | |
| 1010 | // | | | |
| 1011 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1012 | // |<-------------| | |
| 1013 | // |
| 1014 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1015 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1016 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1017 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1018 | |
| 1019 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1020 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1021 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1022 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1023 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1024 | |
| 1025 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1026 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1027 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1029 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1030 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1031 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1032 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1033 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1034 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1035 | // hack as there is no real way to see has message be handled. |
| 1036 | // Previuos counter check just tells that is has been received by submgr |
| 1037 | // --> artificial delay |
| 1038 | <-time.After(1 * time.Second) |
| 1039 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1040 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1041 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1042 | |
| 1043 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1044 | xappConn1.RecvSubsDelResp(t, nil) |
| 1045 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1046 | |
| 1047 | //Wait that subs is cleaned |
| 1048 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1049 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1050 | xappConn1.TestMsgChanEmpty(t) |
| 1051 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1052 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1053 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | //----------------------------------------------------------------------------- |
| 1057 | // TestSubReqAndSubDelOkTwoParallel |
| 1058 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1059 | // stub stub stub |
| 1060 | // +-------+ +-------+ +---------+ +---------+ |
| 1061 | // | xapp | | xapp | | submgr | | e2term | |
| 1062 | // +-------+ +-------+ +---------+ +---------+ |
| 1063 | // | | | | |
| 1064 | // | | | | |
| 1065 | // | | | | |
| 1066 | // | | SubReq1 | | |
| 1067 | // | |------------->| | |
| 1068 | // | | | | |
| 1069 | // | | | SubReq1 | |
| 1070 | // | | |------------->| |
| 1071 | // | | | | |
| 1072 | // | SubReq2 | | |
| 1073 | // |------------------------>| | |
| 1074 | // | | | | |
| 1075 | // | | | SubReq2 | |
| 1076 | // | | |------------->| |
| 1077 | // | | | | |
| 1078 | // | | | SubResp1 | |
| 1079 | // | | |<-------------| |
| 1080 | // | | SubResp1 | | |
| 1081 | // | |<-------------| | |
| 1082 | // | | | | |
| 1083 | // | | | SubResp2 | |
| 1084 | // | | |<-------------| |
| 1085 | // | SubResp2 | | |
| 1086 | // |<------------------------| | |
| 1087 | // | | | | |
| 1088 | // | | [SUBS 1 DELETE] | |
| 1089 | // | | | | |
| 1090 | // | | [SUBS 2 DELETE] | |
| 1091 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1092 | // |
| 1093 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1094 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1095 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1096 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1097 | |
| 1098 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1099 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1100 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1101 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1102 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1103 | |
| 1104 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1105 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1106 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1107 | |
| 1108 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1109 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1110 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1111 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1112 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1113 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1114 | |
| 1115 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1116 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1117 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1118 | |
| 1119 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1120 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1121 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1122 | |
| 1123 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1124 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1125 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1126 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1127 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1128 | //Wait that subs is cleaned |
| 1129 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1130 | |
| 1131 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1132 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1133 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1134 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1135 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1136 | //Wait that subs is cleaned |
| 1137 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1138 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1139 | xappConn1.TestMsgChanEmpty(t) |
| 1140 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1141 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1142 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | } |
| 1144 | |
| 1145 | //----------------------------------------------------------------------------- |
| 1146 | // TestSameSubsDiffRan |
| 1147 | // Same subscription to different RANs |
| 1148 | // |
| 1149 | // stub stub |
| 1150 | // +-------+ +---------+ +---------+ |
| 1151 | // | xapp | | submgr | | e2term | |
| 1152 | // +-------+ +---------+ +---------+ |
| 1153 | // | | | |
| 1154 | // | | | |
| 1155 | // | | | |
| 1156 | // | SubReq(r1) | | |
| 1157 | // |------------->| | |
| 1158 | // | | | |
| 1159 | // | | SubReq(r1) | |
| 1160 | // | |------------->| |
| 1161 | // | | | |
| 1162 | // | | SubResp(r1) | |
| 1163 | // | |<-------------| |
| 1164 | // | | | |
| 1165 | // | SubResp(r1) | | |
| 1166 | // |<-------------| | |
| 1167 | // | | | |
| 1168 | // | SubReq(r2) | | |
| 1169 | // |------------->| | |
| 1170 | // | | | |
| 1171 | // | | SubReq(r2) | |
| 1172 | // | |------------->| |
| 1173 | // | | | |
| 1174 | // | | SubResp(r2) | |
| 1175 | // | |<-------------| |
| 1176 | // | | | |
| 1177 | // | SubResp(r2) | | |
| 1178 | // |<-------------| | |
| 1179 | // | | | |
| 1180 | // | [SUBS r1 DELETE] | |
| 1181 | // | | | |
| 1182 | // | [SUBS r2 DELETE] | |
| 1183 | // | | | |
| 1184 | // |
| 1185 | //----------------------------------------------------------------------------- |
| 1186 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1187 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1188 | |
| 1189 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1190 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1191 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1192 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1193 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1194 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1195 | |
| 1196 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1197 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1198 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1199 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1200 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1201 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1202 | |
| 1203 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1204 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1205 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1206 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1207 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1208 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1209 | //Wait that subs is cleaned |
| 1210 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1211 | |
| 1212 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1213 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1214 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1215 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1216 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1218 | //Wait that subs is cleaned |
| 1219 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1220 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1221 | xappConn1.TestMsgChanEmpty(t) |
| 1222 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1223 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1224 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | //----------------------------------------------------------------------------- |
| 1228 | // TestSubReqRetryInSubmgr |
| 1229 | // |
| 1230 | // stub stub |
| 1231 | // +-------+ +---------+ +---------+ |
| 1232 | // | xapp | | submgr | | e2term | |
| 1233 | // +-------+ +---------+ +---------+ |
| 1234 | // | | | |
| 1235 | // | SubReq | | |
| 1236 | // |------------->| | |
| 1237 | // | | | |
| 1238 | // | | SubReq | |
| 1239 | // | |------------->| |
| 1240 | // | | | |
| 1241 | // | | | |
| 1242 | // | | SubReq | |
| 1243 | // | |------------->| |
| 1244 | // | | | |
| 1245 | // | | SubResp | |
| 1246 | // | |<-------------| |
| 1247 | // | | | |
| 1248 | // | SubResp | | |
| 1249 | // |<-------------| | |
| 1250 | // | | | |
| 1251 | // | [SUBS DELETE] | |
| 1252 | // | | | |
| 1253 | // |
| 1254 | //----------------------------------------------------------------------------- |
| 1255 | |
| 1256 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1257 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1258 | |
| 1259 | // Init counter check |
| 1260 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1261 | Counter{cSubReqFromXapp, 1}, |
| 1262 | Counter{cSubReqToE2, 1}, |
| 1263 | Counter{cSubReReqToE2, 1}, |
| 1264 | Counter{cSubRespFromE2, 1}, |
| 1265 | Counter{cSubRespToXapp, 1}, |
| 1266 | Counter{cSubDelReqFromXapp, 1}, |
| 1267 | Counter{cSubDelReqToE2, 1}, |
| 1268 | Counter{cSubDelRespFromE2, 1}, |
| 1269 | Counter{cSubDelRespToXapp, 1}, |
| 1270 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1271 | |
| 1272 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1273 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1274 | |
| 1275 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1276 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1277 | |
| 1278 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1279 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1280 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1281 | |
| 1282 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1283 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1284 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1285 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1286 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1287 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1288 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1289 | |
| 1290 | // Wait that subs is cleaned |
| 1291 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1292 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1293 | xappConn1.TestMsgChanEmpty(t) |
| 1294 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1295 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1296 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1297 | |
| 1298 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1299 | } |
| 1300 | |
| 1301 | //----------------------------------------------------------------------------- |
| 1302 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1303 | // |
| 1304 | // stub stub |
| 1305 | // +-------+ +---------+ +---------+ |
| 1306 | // | xapp | | submgr | | e2term | |
| 1307 | // +-------+ +---------+ +---------+ |
| 1308 | // | | | |
| 1309 | // | SubReq | | |
| 1310 | // |------------->| | |
| 1311 | // | | | |
| 1312 | // | | SubReq | |
| 1313 | // | |------------->| |
| 1314 | // | | | |
| 1315 | // | | | |
| 1316 | // | | SubReq | |
| 1317 | // | |------------->| |
| 1318 | // | | | |
| 1319 | // | | SubDelReq | |
| 1320 | // | |------------->| |
| 1321 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1322 | // | | SubDelResp | |
| 1323 | // | |<-------------| |
| 1324 | // | | | |
| 1325 | // |
| 1326 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1328 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1329 | |
| 1330 | // Init counter check |
| 1331 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1332 | Counter{cSubReqFromXapp, 1}, |
| 1333 | Counter{cSubReqToE2, 1}, |
| 1334 | Counter{cSubReReqToE2, 1}, |
| 1335 | Counter{cSubReqTimerExpiry, 2}, |
| 1336 | Counter{cSubDelReqToE2, 1}, |
| 1337 | Counter{cSubDelRespFromE2, 1}, |
| 1338 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1339 | |
| 1340 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1341 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1342 | |
| 1343 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1344 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1345 | |
| 1346 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1347 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1348 | |
| 1349 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1350 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1351 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1352 | |
| 1353 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1354 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1355 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1356 | xappConn1.TestMsgChanEmpty(t) |
| 1357 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1358 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1359 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1360 | |
| 1361 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1362 | } |
| 1363 | |
| 1364 | //----------------------------------------------------------------------------- |
| 1365 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1366 | // |
| 1367 | // stub stub |
| 1368 | // +-------+ +---------+ +---------+ |
| 1369 | // | xapp | | submgr | | e2term | |
| 1370 | // +-------+ +---------+ +---------+ |
| 1371 | // | | | |
| 1372 | // | SubReq | | |
| 1373 | // |------------->| | |
| 1374 | // | | | |
| 1375 | // | | SubReq | |
| 1376 | // | |------------->| |
| 1377 | // | | | |
| 1378 | // | | | |
| 1379 | // | | SubReq | |
| 1380 | // | |------------->| |
| 1381 | // | | | |
| 1382 | // | | SubDelReq | |
| 1383 | // | |------------->| |
| 1384 | // | | | |
| 1385 | // | | | |
| 1386 | // | | SubDelReq | |
| 1387 | // | |------------->| |
| 1388 | // | | | |
| 1389 | // | | | |
| 1390 | // |
| 1391 | //----------------------------------------------------------------------------- |
| 1392 | |
| 1393 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1394 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1395 | |
| 1396 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1397 | Counter{cSubReqFromXapp, 1}, |
| 1398 | Counter{cSubReqToE2, 1}, |
| 1399 | Counter{cSubReReqToE2, 1}, |
| 1400 | Counter{cSubReqTimerExpiry, 2}, |
| 1401 | Counter{cSubDelReqToE2, 1}, |
| 1402 | Counter{cSubDelReReqToE2, 1}, |
| 1403 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1404 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1405 | |
| 1406 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1407 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1408 | |
| 1409 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1410 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1411 | |
| 1412 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1413 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1414 | |
| 1415 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1416 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1417 | |
| 1418 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1419 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1420 | |
| 1421 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1422 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1423 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1424 | xappConn1.TestMsgChanEmpty(t) |
| 1425 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1426 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1427 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1428 | |
| 1429 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1430 | } |
| 1431 | |
| 1432 | //----------------------------------------------------------------------------- |
| 1433 | // TestSubReqSubFailRespInSubmgr |
| 1434 | // |
| 1435 | // stub stub |
| 1436 | // +-------+ +---------+ +---------+ |
| 1437 | // | xapp | | submgr | | e2term | |
| 1438 | // +-------+ +---------+ +---------+ |
| 1439 | // | | | |
| 1440 | // | SubReq | | |
| 1441 | // |------------->| | |
| 1442 | // | | | |
| 1443 | // | | SubReq | |
| 1444 | // | |------------->| |
| 1445 | // | | | |
| 1446 | // | | SubFail | |
| 1447 | // | |<-------------| |
| 1448 | // | | | |
| 1449 | // | SubFail | | |
| 1450 | // |<-------------| | |
| 1451 | // | | | |
| 1452 | // |
| 1453 | //----------------------------------------------------------------------------- |
| 1454 | |
| 1455 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1456 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1457 | |
| 1458 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1459 | Counter{cSubReqFromXapp, 1}, |
| 1460 | Counter{cSubReqToE2, 1}, |
| 1461 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1462 | Counter{cSubFailToXapp, 1}, |
| 1463 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1464 | |
| 1465 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1466 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1467 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1468 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1469 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1470 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1471 | fparams1.Set(crereq1) |
| 1472 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1473 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1474 | // Xapp: Receive SubsFail |
| 1475 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1476 | |
| 1477 | // Wait that subs is cleaned |
| 1478 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1479 | |
| 1480 | xappConn1.TestMsgChanEmpty(t) |
| 1481 | xappConn2.TestMsgChanEmpty(t) |
| 1482 | e2termConn1.TestMsgChanEmpty(t) |
| 1483 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1484 | |
| 1485 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1486 | } |
| 1487 | |
| 1488 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1489 | // TestSubDelReqRetryInSubmgr |
| 1490 | // |
| 1491 | // stub stub |
| 1492 | // +-------+ +---------+ +---------+ |
| 1493 | // | xapp | | submgr | | e2term | |
| 1494 | // +-------+ +---------+ +---------+ |
| 1495 | // | | | |
| 1496 | // | [SUBS CREATE] | |
| 1497 | // | | | |
| 1498 | // | | | |
| 1499 | // | SubDelReq | | |
| 1500 | // |------------->| | |
| 1501 | // | | | |
| 1502 | // | | SubDelReq | |
| 1503 | // | |------------->| |
| 1504 | // | | | |
| 1505 | // | | SubDelReq | |
| 1506 | // | |------------->| |
| 1507 | // | | | |
| 1508 | // | | SubDelResp | |
| 1509 | // | |<-------------| |
| 1510 | // | | | |
| 1511 | // | SubDelResp | | |
| 1512 | // |<-------------| | |
| 1513 | // |
| 1514 | //----------------------------------------------------------------------------- |
| 1515 | |
| 1516 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1517 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1518 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1519 | |
| 1520 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1521 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1522 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1523 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1524 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1525 | |
| 1526 | // Subs Delete |
| 1527 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1528 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1529 | |
| 1530 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1531 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1532 | |
| 1533 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1534 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1535 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1536 | |
| 1537 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1538 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1539 | |
| 1540 | // Wait that subs is cleaned |
| 1541 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1542 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1543 | xappConn1.TestMsgChanEmpty(t) |
| 1544 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1545 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1546 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1547 | } |
| 1548 | |
| 1549 | //----------------------------------------------------------------------------- |
| 1550 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1551 | // |
| 1552 | // stub stub |
| 1553 | // +-------+ +---------+ +---------+ |
| 1554 | // | xapp | | submgr | | e2term | |
| 1555 | // +-------+ +---------+ +---------+ |
| 1556 | // | | | |
| 1557 | // | [SUBS CREATE] | |
| 1558 | // | | | |
| 1559 | // | | | |
| 1560 | // | SubDelReq | | |
| 1561 | // |------------->| | |
| 1562 | // | | | |
| 1563 | // | | SubDelReq | |
| 1564 | // | |------------->| |
| 1565 | // | | | |
| 1566 | // | | SubDelReq | |
| 1567 | // | |------------->| |
| 1568 | // | | | |
| 1569 | // | | | |
| 1570 | // | SubDelResp | | |
| 1571 | // |<-------------| | |
| 1572 | // |
| 1573 | //----------------------------------------------------------------------------- |
| 1574 | |
| 1575 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1576 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1577 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1578 | |
| 1579 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1580 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1581 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1582 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1583 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1584 | |
| 1585 | // Subs Delete |
| 1586 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1587 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1588 | |
| 1589 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1590 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1591 | |
| 1592 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1593 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1594 | |
| 1595 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1596 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1597 | |
| 1598 | // Wait that subs is cleaned |
| 1599 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1600 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1601 | xappConn1.TestMsgChanEmpty(t) |
| 1602 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1603 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1604 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1605 | } |
| 1606 | |
| 1607 | //----------------------------------------------------------------------------- |
| 1608 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1609 | // |
| 1610 | // stub stub |
| 1611 | // +-------+ +---------+ +---------+ |
| 1612 | // | xapp | | submgr | | e2term | |
| 1613 | // +-------+ +---------+ +---------+ |
| 1614 | // | | | |
| 1615 | // | [SUBS CREATE] | |
| 1616 | // | | | |
| 1617 | // | | | |
| 1618 | // | SubDelReq | | |
| 1619 | // |------------->| | |
| 1620 | // | | | |
| 1621 | // | | SubDelReq | |
| 1622 | // | |------------->| |
| 1623 | // | | | |
| 1624 | // | | SubDelFail | |
| 1625 | // | |<-------------| |
| 1626 | // | | | |
| 1627 | // | SubDelResp | | |
| 1628 | // |<-------------| | |
| 1629 | // | | | |
| 1630 | // |
| 1631 | //----------------------------------------------------------------------------- |
| 1632 | |
| 1633 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1634 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1635 | |
| 1636 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1637 | Counter{cSubReqFromXapp, 1}, |
| 1638 | Counter{cSubReqToE2, 1}, |
| 1639 | Counter{cSubRespFromE2, 1}, |
| 1640 | Counter{cSubRespToXapp, 1}, |
| 1641 | Counter{cSubDelReqFromXapp, 1}, |
| 1642 | Counter{cSubDelReqToE2, 1}, |
| 1643 | Counter{cSubDelFailFromE2, 1}, |
| 1644 | Counter{cSubDelRespToXapp, 1}, |
| 1645 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1646 | |
| 1647 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1648 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1649 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1650 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1651 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1652 | |
| 1653 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1654 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1655 | |
| 1656 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1657 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1658 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1659 | |
| 1660 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1661 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1662 | |
| 1663 | // Wait that subs is cleaned |
| 1664 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1665 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1666 | xappConn1.TestMsgChanEmpty(t) |
| 1667 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1668 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1669 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1670 | |
| 1671 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1672 | } |
| 1673 | |
| 1674 | //----------------------------------------------------------------------------- |
| 1675 | // TestSubReqAndSubDelOkSameAction |
| 1676 | // |
| 1677 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1678 | // +-------+ +-------+ +---------+ +---------+ |
| 1679 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1680 | // +-------+ +-------+ +---------+ +---------+ |
| 1681 | // | | | | |
| 1682 | // | | | | |
| 1683 | // | | | | |
| 1684 | // | | SubReq1 | | |
| 1685 | // | |------------->| | |
| 1686 | // | | | | |
| 1687 | // | | | SubReq1 | |
| 1688 | // | | |------------->| |
| 1689 | // | | | SubResp1 | |
| 1690 | // | | |<-------------| |
| 1691 | // | | SubResp1 | | |
| 1692 | // | |<-------------| | |
| 1693 | // | | | | |
| 1694 | // | SubReq2 | | |
| 1695 | // |--------------------------->| | |
| 1696 | // | | | | |
| 1697 | // | SubResp2 | | |
| 1698 | // |<---------------------------| | |
| 1699 | // | | | | |
| 1700 | // | | SubDelReq 1 | | |
| 1701 | // | |------------->| | |
| 1702 | // | | | | |
| 1703 | // | | SubDelResp 1 | | |
| 1704 | // | |<-------------| | |
| 1705 | // | | | | |
| 1706 | // | SubDelReq 2 | | |
| 1707 | // |--------------------------->| | |
| 1708 | // | | | | |
| 1709 | // | | | SubDelReq 2 | |
| 1710 | // | | |------------->| |
| 1711 | // | | | | |
| 1712 | // | | | SubDelReq 2 | |
| 1713 | // | | |------------->| |
| 1714 | // | | | | |
| 1715 | // | SubDelResp 2 | | |
| 1716 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1717 | // |
| 1718 | //----------------------------------------------------------------------------- |
| 1719 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1720 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1721 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1722 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1723 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1724 | Counter{cSubReqFromXapp, 2}, |
| 1725 | Counter{cSubReqToE2, 1}, |
| 1726 | Counter{cSubRespFromE2, 1}, |
| 1727 | Counter{cSubRespToXapp, 2}, |
| 1728 | Counter{cMergedSubscriptions, 1}, |
| 1729 | Counter{cUnmergedSubscriptions, 1}, |
| 1730 | Counter{cSubDelReqFromXapp, 2}, |
| 1731 | Counter{cSubDelReqToE2, 1}, |
| 1732 | Counter{cSubDelRespFromE2, 1}, |
| 1733 | Counter{cSubDelRespToXapp, 2}, |
| 1734 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1735 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1736 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1737 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1738 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1739 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1740 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1741 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1742 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1743 | |
| 1744 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1745 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1746 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1747 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1748 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1749 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1750 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1751 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1752 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1753 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1754 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1755 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1756 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1757 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1758 | |
| 1759 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1760 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1761 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1762 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1763 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1764 | //Wait that subs is cleaned |
| 1765 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1766 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1767 | xappConn1.TestMsgChanEmpty(t) |
| 1768 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1769 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1770 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1771 | |
| 1772 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1773 | } |
| 1774 | |
| 1775 | //----------------------------------------------------------------------------- |
| 1776 | // TestSubReqAndSubDelOkSameActionParallel |
| 1777 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1778 | // stub stub stub |
| 1779 | // +-------+ +-------+ +---------+ +---------+ |
| 1780 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1781 | // +-------+ +-------+ +---------+ +---------+ |
| 1782 | // | | | | |
| 1783 | // | | | | |
| 1784 | // | | | | |
| 1785 | // | | SubReq1 | | |
| 1786 | // | |------------->| | |
| 1787 | // | | | | |
| 1788 | // | | | SubReq1 | |
| 1789 | // | | |------------->| |
| 1790 | // | SubReq2 | | |
| 1791 | // |--------------------------->| | |
| 1792 | // | | | SubResp1 | |
| 1793 | // | | |<-------------| |
| 1794 | // | | SubResp1 | | |
| 1795 | // | |<-------------| | |
| 1796 | // | | | | |
| 1797 | // | SubResp2 | | |
| 1798 | // |<---------------------------| | |
| 1799 | // | | | | |
| 1800 | // | | SubDelReq 1 | | |
| 1801 | // | |------------->| | |
| 1802 | // | | | | |
| 1803 | // | | SubDelResp 1 | | |
| 1804 | // | |<-------------| | |
| 1805 | // | | | | |
| 1806 | // | SubDelReq 2 | | |
| 1807 | // |--------------------------->| | |
| 1808 | // | | | | |
| 1809 | // | | | SubDelReq 2 | |
| 1810 | // | | |------------->| |
| 1811 | // | | | | |
| 1812 | // | | | SubDelReq 2 | |
| 1813 | // | | |------------->| |
| 1814 | // | | | | |
| 1815 | // | SubDelResp 2 | | |
| 1816 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1817 | // |
| 1818 | //----------------------------------------------------------------------------- |
| 1819 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1820 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1821 | |
| 1822 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1823 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1824 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1825 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1826 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1827 | |
| 1828 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1829 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1830 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1831 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1832 | |
| 1833 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1834 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1835 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1836 | |
| 1837 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1838 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1839 | |
| 1840 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1841 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1842 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1843 | |
| 1844 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1845 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1846 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1847 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1848 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1849 | |
| 1850 | //Wait that subs is cleaned |
| 1851 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1852 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1853 | xappConn1.TestMsgChanEmpty(t) |
| 1854 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1855 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1856 | mainCtrl.wait_registry_empty(t, 10) |
| 1857 | } |
| 1858 | |
| 1859 | //----------------------------------------------------------------------------- |
| 1860 | // TestSubReqAndSubDelNokSameActionParallel |
| 1861 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1862 | // stub stub stub |
| 1863 | // +-------+ +-------+ +---------+ +---------+ |
| 1864 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1865 | // +-------+ +-------+ +---------+ +---------+ |
| 1866 | // | | | | |
| 1867 | // | | | | |
| 1868 | // | | | | |
| 1869 | // | | SubReq1 | | |
| 1870 | // | |------------->| | |
| 1871 | // | | | | |
| 1872 | // | | | SubReq1 | |
| 1873 | // | | |------------->| |
| 1874 | // | SubReq2 | | |
| 1875 | // |--------------------------->| | |
| 1876 | // | | | SubFail1 | |
| 1877 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1878 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1879 | // | | SubFail1 | | |
| 1880 | // | |<-------------| | |
| 1881 | // | | | | |
| 1882 | // | SubFail2 | | |
| 1883 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1884 | // |
| 1885 | //----------------------------------------------------------------------------- |
| 1886 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1887 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1888 | |
| 1889 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1890 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1891 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1892 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1893 | |
| 1894 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1895 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1896 | |
| 1897 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1898 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1899 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1900 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1901 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1902 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1903 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1904 | // E2t: send SubsFail (first) |
| 1905 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1906 | fparams1.Set(crereq1) |
| 1907 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1908 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1909 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1910 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1911 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1912 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1913 | |
| 1914 | //Wait that subs is cleaned |
| 1915 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1916 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1917 | xappConn1.TestMsgChanEmpty(t) |
| 1918 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1919 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1920 | mainCtrl.wait_registry_empty(t, 10) |
| 1921 | } |
| 1922 | |
| 1923 | //----------------------------------------------------------------------------- |
| 1924 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1925 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1926 | // stub stub stub |
| 1927 | // +-------+ +-------+ +---------+ +---------+ |
| 1928 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1929 | // +-------+ +-------+ +---------+ +---------+ |
| 1930 | // | | | | |
| 1931 | // | | | | |
| 1932 | // | | | | |
| 1933 | // | | SubReq1 | | |
| 1934 | // | |------------->| | |
| 1935 | // | | | | |
| 1936 | // | | | SubReq1 | |
| 1937 | // | | |------------->| |
| 1938 | // | | SubReq2 | | |
| 1939 | // |--------------------------->| | |
| 1940 | // | | | | |
| 1941 | // | | | SubReq1 | |
| 1942 | // | | |------------->| |
| 1943 | // | | | | |
| 1944 | // | | | | |
| 1945 | // | | | SubDelReq | |
| 1946 | // | | |------------->| |
| 1947 | // | | | | |
| 1948 | // | | | SubDelResp | |
| 1949 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1950 | // |
| 1951 | //----------------------------------------------------------------------------- |
| 1952 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1953 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1954 | |
| 1955 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1956 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1957 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1958 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1959 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1960 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1961 | |
| 1962 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1963 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1964 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1965 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1966 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1967 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1968 | |
| 1969 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1970 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1971 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1972 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1973 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1974 | |
| 1975 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1976 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1977 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1978 | xappConn1.TestMsgChanEmpty(t) |
| 1979 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1980 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1981 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1982 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1983 | |
| 1984 | //----------------------------- Policy cases --------------------------------- |
| 1985 | //----------------------------------------------------------------------------- |
| 1986 | // TestSubReqPolicyAndSubDelOk |
| 1987 | // |
| 1988 | // stub stub |
| 1989 | // +-------+ +---------+ +---------+ |
| 1990 | // | xapp | | submgr | | e2term | |
| 1991 | // +-------+ +---------+ +---------+ |
| 1992 | // | | | |
| 1993 | // | SubReq | | |
| 1994 | // |------------->| | |
| 1995 | // | | | |
| 1996 | // | | SubReq | |
| 1997 | // | |------------->| |
| 1998 | // | | | |
| 1999 | // | | SubResp | |
| 2000 | // | |<-------------| |
| 2001 | // | | | |
| 2002 | // | SubResp | | |
| 2003 | // |<-------------| | |
| 2004 | // | | | |
| 2005 | // | | | |
| 2006 | // | SubDelReq | | |
| 2007 | // |------------->| | |
| 2008 | // | | | |
| 2009 | // | | SubDelReq | |
| 2010 | // | |------------->| |
| 2011 | // | | | |
| 2012 | // | | SubDelResp | |
| 2013 | // | |<-------------| |
| 2014 | // | | | |
| 2015 | // | SubDelResp | | |
| 2016 | // |<-------------| | |
| 2017 | // |
| 2018 | //----------------------------------------------------------------------------- |
| 2019 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2020 | CaseBegin("TestSubReqAndSubDelOk") |
| 2021 | |
| 2022 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2023 | rparams1.Init() |
| 2024 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2025 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2026 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2027 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2028 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2029 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2030 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2031 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2032 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2033 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2034 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2035 | |
| 2036 | //Wait that subs is cleaned |
| 2037 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2038 | |
| 2039 | xappConn1.TestMsgChanEmpty(t) |
| 2040 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2041 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2042 | mainCtrl.wait_registry_empty(t, 10) |
| 2043 | } |
| 2044 | |
| 2045 | //----------------------------------------------------------------------------- |
| 2046 | // TestSubReqPolicyChangeAndSubDelOk |
| 2047 | // |
| 2048 | // stub stub |
| 2049 | // +-------+ +---------+ +---------+ |
| 2050 | // | xapp | | submgr | | e2term | |
| 2051 | // +-------+ +---------+ +---------+ |
| 2052 | // | | | |
| 2053 | // | SubReq | | |
| 2054 | // |------------->| | |
| 2055 | // | | | |
| 2056 | // | | SubReq | |
| 2057 | // | |------------->| |
| 2058 | // | | | |
| 2059 | // | | SubResp | |
| 2060 | // | |<-------------| |
| 2061 | // | | | |
| 2062 | // | SubResp | | |
| 2063 | // |<-------------| | |
| 2064 | // | | | |
| 2065 | // | SubReq | | |
| 2066 | // |------------->| | |
| 2067 | // | | | |
| 2068 | // | | SubReq | |
| 2069 | // | |------------->| |
| 2070 | // | | | |
| 2071 | // | | SubResp | |
| 2072 | // | |<-------------| |
| 2073 | // | | | |
| 2074 | // | SubResp | | |
| 2075 | // |<-------------| | |
| 2076 | // | | | |
| 2077 | // | SubDelReq | | |
| 2078 | // |------------->| | |
| 2079 | // | | | |
| 2080 | // | | SubDelReq | |
| 2081 | // | |------------->| |
| 2082 | // | | | |
| 2083 | // | | SubDelResp | |
| 2084 | // | |<-------------| |
| 2085 | // | | | |
| 2086 | // | SubDelResp | | |
| 2087 | // |<-------------| | |
| 2088 | // |
| 2089 | //----------------------------------------------------------------------------- |
| 2090 | |
| 2091 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2092 | CaseBegin("TestSubReqAndSubDelOk") |
| 2093 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2094 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2095 | rparams1.Init() |
| 2096 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2097 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2098 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2099 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2100 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2101 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2102 | |
| 2103 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2104 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2105 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2106 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2107 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2108 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2109 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2110 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2111 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2112 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2113 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2114 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2115 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2116 | |
| 2117 | //Wait that subs is cleaned |
| 2118 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2119 | |
| 2120 | xappConn1.TestMsgChanEmpty(t) |
| 2121 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2122 | e2termConn1.TestMsgChanEmpty(t) |
| 2123 | mainCtrl.wait_registry_empty(t, 10) |
| 2124 | } |
| 2125 | |
| 2126 | //----------------------------------------------------------------------------- |
| 2127 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2128 | // |
| 2129 | // stub stub stub |
| 2130 | // +-------+ +---------+ +---------+ +---------+ |
| 2131 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2132 | // +-------+ +---------+ +---------+ +---------+ |
| 2133 | // | | | | |
| 2134 | // | | | | |
| 2135 | // | | | | |
| 2136 | // | SubReq1 | | | |
| 2137 | // |------------->| | | |
| 2138 | // | | | | |
| 2139 | // | | SubReq1 | | |
| 2140 | // | |------------->| | |
| 2141 | // | | | | |
| 2142 | // | SubReq2 | | | |
| 2143 | // |------------->| | | |
| 2144 | // | | | | |
| 2145 | // | | SubReq2 | | |
| 2146 | // | |---------------------------->| |
| 2147 | // | | | | |
| 2148 | // | | SubResp1 | | |
| 2149 | // | |<-------------| | |
| 2150 | // | SubResp1 | | | |
| 2151 | // |<-------------| | | |
| 2152 | // | | SubResp2 | | |
| 2153 | // | |<----------------------------| |
| 2154 | // | SubResp2 | | | |
| 2155 | // |<-------------| | | |
| 2156 | // | | | | |
| 2157 | // | [SUBS 1 DELETE] | | |
| 2158 | // | | | | |
| 2159 | // | [SUBS 2 DELETE] | | |
| 2160 | // | | | | |
| 2161 | // |
| 2162 | //----------------------------------------------------------------------------- |
| 2163 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2164 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2165 | |
| 2166 | //Req1 |
| 2167 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2168 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2169 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2170 | |
| 2171 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2172 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2173 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2174 | |
| 2175 | //Resp1 |
| 2176 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2177 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2178 | |
| 2179 | //Resp2 |
| 2180 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2181 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2182 | |
| 2183 | //Del1 |
| 2184 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2185 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2186 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2187 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2188 | //Wait that subs is cleaned |
| 2189 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2190 | |
| 2191 | //Del2 |
| 2192 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2193 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2194 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2195 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2196 | //Wait that subs is cleaned |
| 2197 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2198 | |
| 2199 | xappConn1.TestMsgChanEmpty(t) |
| 2200 | xappConn2.TestMsgChanEmpty(t) |
| 2201 | e2termConn1.TestMsgChanEmpty(t) |
| 2202 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2203 | mainCtrl.wait_registry_empty(t, 10) |
| 2204 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2205 | |
| 2206 | //----------------------------------------------------------------------------- |
| 2207 | // TestSubReqInsertAndSubDelOk |
| 2208 | // |
| 2209 | // stub stub |
| 2210 | // +-------+ +---------+ +---------+ |
| 2211 | // | xapp | | submgr | | e2term | |
| 2212 | // +-------+ +---------+ +---------+ |
| 2213 | // | | | |
| 2214 | // | SubReq | | |
| 2215 | // |------------->| | |
| 2216 | // | | | |
| 2217 | // | | SubReq | |
| 2218 | // | |------------->| |
| 2219 | // | | | |
| 2220 | // | | SubResp | |
| 2221 | // | |<-------------| |
| 2222 | // | | | |
| 2223 | // | SubResp | | |
| 2224 | // |<-------------| | |
| 2225 | // | | | |
| 2226 | // | | | |
| 2227 | // | SubDelReq | | |
| 2228 | // |------------->| | |
| 2229 | // | | | |
| 2230 | // | | SubDelReq | |
| 2231 | // | |------------->| |
| 2232 | // | | | |
| 2233 | // | | SubDelResp | |
| 2234 | // | |<-------------| |
| 2235 | // | | | |
| 2236 | // | SubDelResp | | |
| 2237 | // |<-------------| | |
| 2238 | // |
| 2239 | //----------------------------------------------------------------------------- |
| 2240 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2241 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2242 | |
| 2243 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2244 | rparams1.Init() |
| 2245 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2246 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2247 | |
| 2248 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2249 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2250 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2251 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2252 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2253 | |
| 2254 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2255 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2256 | |
| 2257 | //Wait that subs is cleaned |
| 2258 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2259 | |
| 2260 | xappConn1.TestMsgChanEmpty(t) |
| 2261 | xappConn2.TestMsgChanEmpty(t) |
| 2262 | e2termConn1.TestMsgChanEmpty(t) |
| 2263 | mainCtrl.wait_registry_empty(t, 10) |
| 2264 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2265 | |
| 2266 | //----------------------------------------------------------------------------- |
| 2267 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2268 | // |
| 2269 | // This case simulates case where xApp restarts and starts sending same |
| 2270 | // subscription requests which have already subscribed successfully |
| 2271 | |
| 2272 | // stub stub |
| 2273 | // +-------+ +---------+ +---------+ |
| 2274 | // | xapp | | submgr | | e2term | |
| 2275 | // +-------+ +---------+ +---------+ |
| 2276 | // | | | |
| 2277 | // | SubReq | | |
| 2278 | // |------------->| | |
| 2279 | // | | | |
| 2280 | // | | SubReq | |
| 2281 | // | |------------->| |
| 2282 | // | | | |
| 2283 | // | | SubResp | |
| 2284 | // | |<-------------| |
| 2285 | // | | | |
| 2286 | // | SubResp | | |
| 2287 | // |<-------------| | |
| 2288 | // | | | |
| 2289 | // | xApp restart | | |
| 2290 | // | | | |
| 2291 | // | SubReq | | |
| 2292 | // | (retrans with same xApp generated subid but diff xid) |
| 2293 | // |------------->| | |
| 2294 | // | | | |
| 2295 | // | SubResp | | |
| 2296 | // |<-------------| | |
| 2297 | // | | | |
| 2298 | // | [SUBS DELETE] | |
| 2299 | // | | | |
| 2300 | // |
| 2301 | //----------------------------------------------------------------------------- |
| 2302 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2303 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2304 | |
| 2305 | //Subs Create |
| 2306 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2307 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2308 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2309 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2310 | |
| 2311 | // xApp restart here |
| 2312 | // --> artificial delay |
| 2313 | <-time.After(1 * time.Second) |
| 2314 | |
| 2315 | //Subs Create |
| 2316 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2317 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2318 | |
| 2319 | //Subs Delete |
| 2320 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2321 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2322 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2323 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2324 | |
| 2325 | //Wait that subs is cleaned |
| 2326 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2327 | |
| 2328 | xappConn1.TestMsgChanEmpty(t) |
| 2329 | xappConn2.TestMsgChanEmpty(t) |
| 2330 | e2termConn1.TestMsgChanEmpty(t) |
| 2331 | mainCtrl.wait_registry_empty(t, 10) |
| 2332 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2333 | |
| 2334 | //----------------------------------------------------------------------------- |
| 2335 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2336 | // |
| 2337 | // stub stub |
| 2338 | // +-------+ +---------+ +---------+ |
| 2339 | // | xapp | | submgr | | e2term | |
| 2340 | // +-------+ +---------+ +---------+ |
| 2341 | // | | | |
| 2342 | // | SubReq | | |
| 2343 | // |------------->| | |
| 2344 | // | | | |
| 2345 | // | | SubReq | |
| 2346 | // | |------------->| |
| 2347 | // | | | |
| 2348 | // | | SubResp | |
| 2349 | // | <----| |
| 2350 | // | | |
| 2351 | // | Submgr restart | |
| 2352 | // | | |
| 2353 | // | | | |
| 2354 | // | | SubDelReq | |
| 2355 | // | |------------->| |
| 2356 | // | | | |
| 2357 | // | | SubDelResp | |
| 2358 | // | |<-------------| |
| 2359 | // | | | |
| 2360 | // |
| 2361 | //----------------------------------------------------------------------------- |
| 2362 | |
| 2363 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2364 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2365 | |
| 2366 | // Remove possible existing subscrition |
| 2367 | mainCtrl.removeExistingSubscriptions(t) |
| 2368 | |
| 2369 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2370 | xappConn1.SendSubsReq(t, nil, nil) |
| 2371 | e2termConn1.RecvSubsReq(t) |
| 2372 | mainCtrl.SetResetTestFlag(t, false) |
| 2373 | |
| 2374 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2375 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2376 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2377 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2378 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2379 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2380 | mainCtrl.SimulateRestart(t) |
| 2381 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2382 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2383 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2384 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2385 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2386 | |
| 2387 | // Wait that subs is cleaned |
| 2388 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2389 | |
| 2390 | xappConn1.TestMsgChanEmpty(t) |
| 2391 | xappConn2.TestMsgChanEmpty(t) |
| 2392 | e2termConn1.TestMsgChanEmpty(t) |
| 2393 | mainCtrl.wait_registry_empty(t, 10) |
| 2394 | } |
| 2395 | |
| 2396 | //----------------------------------------------------------------------------- |
| 2397 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2398 | // |
| 2399 | // stub stub |
| 2400 | // +-------+ +---------+ +---------+ |
| 2401 | // | xapp | | submgr | | e2term | |
| 2402 | // +-------+ +---------+ +---------+ |
| 2403 | // | | | |
| 2404 | // | SubReq | | |
| 2405 | // |------------->| | |
| 2406 | // | | | |
| 2407 | // | | SubReq | |
| 2408 | // | |------------->| |
| 2409 | // | | | |
| 2410 | // | | SubResp | |
| 2411 | // | |<-------------| |
| 2412 | // | | | |
| 2413 | // | SubResp | | |
| 2414 | // |<-------------| | |
| 2415 | // | | | |
| 2416 | // | | |
| 2417 | // | Submgr restart | |
| 2418 | // | | |
| 2419 | // | SubDelReq | | |
| 2420 | // |------------->| | |
| 2421 | // | | | |
| 2422 | // | | SubDelReq | |
| 2423 | // | |------------->| |
| 2424 | // | | | |
| 2425 | // | | SubDelResp | |
| 2426 | // | |<-------------| |
| 2427 | // | | | |
| 2428 | // | SubDelResp | | |
| 2429 | // |<-------------| | |
| 2430 | // |
| 2431 | //----------------------------------------------------------------------------- |
| 2432 | |
| 2433 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2434 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2435 | |
| 2436 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2437 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2438 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2439 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2440 | |
| 2441 | // Check subscription |
| 2442 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2443 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2444 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2445 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2446 | |
| 2447 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2448 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2449 | |
| 2450 | // Check that subscription is restored correctly after restart |
| 2451 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2452 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2453 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2454 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2455 | |
| 2456 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2457 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2458 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2459 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2460 | |
| 2461 | //Wait that subs is cleaned |
| 2462 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2463 | |
| 2464 | xappConn1.TestMsgChanEmpty(t) |
| 2465 | xappConn2.TestMsgChanEmpty(t) |
| 2466 | e2termConn1.TestMsgChanEmpty(t) |
| 2467 | mainCtrl.wait_registry_empty(t, 10) |
| 2468 | } |
| 2469 | |
| 2470 | //----------------------------------------------------------------------------- |
| 2471 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2472 | // |
| 2473 | // stub stub |
| 2474 | // +-------+ +-------+ +---------+ +---------+ |
| 2475 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2476 | // +-------+ +-------+ +---------+ +---------+ |
| 2477 | // | | | | |
| 2478 | // | | | | |
| 2479 | // | | | | |
| 2480 | // | | SubReq1 | | |
| 2481 | // | |------------->| | |
| 2482 | // | | | | |
| 2483 | // | | | SubReq1 | |
| 2484 | // | | |------------->| |
| 2485 | // | | | SubResp1 | |
| 2486 | // | | |<-------------| |
| 2487 | // | | SubResp1 | | |
| 2488 | // | |<-------------| | |
| 2489 | // | | | | |
| 2490 | // | | |
| 2491 | // | submgr restart | |
| 2492 | // | | |
| 2493 | // | | | | |
| 2494 | // | | | | |
| 2495 | // | SubReq2 | | |
| 2496 | // |--------------------------->| | |
| 2497 | // | | | | |
| 2498 | // | SubResp2 | | |
| 2499 | // |<---------------------------| | |
| 2500 | // | | | | |
| 2501 | // | | SubDelReq 1 | | |
| 2502 | // | |------------->| | |
| 2503 | // | | | | |
| 2504 | // | | SubDelResp 1 | | |
| 2505 | // | |<-------------| | |
| 2506 | // | | | | |
| 2507 | // | | | | |
| 2508 | // | | |
| 2509 | // | submgr restart | |
| 2510 | // | | |
| 2511 | // | | | | |
| 2512 | // | SubDelReq 2 | | |
| 2513 | // |--------------------------->| | |
| 2514 | // | | | | |
| 2515 | // | | | SubDelReq 2 | |
| 2516 | // | | |------------->| |
| 2517 | // | | | | |
| 2518 | // | | | SubDelReq 2 | |
| 2519 | // | | |------------->| |
| 2520 | // | | | | |
| 2521 | // | SubDelResp 2 | | |
| 2522 | // |<---------------------------| | |
| 2523 | // |
| 2524 | //----------------------------------------------------------------------------- |
| 2525 | |
| 2526 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2527 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2528 | |
| 2529 | //Req1 |
| 2530 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2531 | rparams1.Init() |
| 2532 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2533 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2534 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2535 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2536 | |
| 2537 | //Req2 |
| 2538 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2539 | rparams2.Init() |
| 2540 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2541 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2542 | |
| 2543 | // Check subscription |
| 2544 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2545 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2546 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2547 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2548 | |
| 2549 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2550 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2551 | |
| 2552 | // Check that subscription is restored correctly after restart |
| 2553 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2554 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2555 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2556 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2557 | |
| 2558 | //Del1 |
| 2559 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2560 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2561 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2562 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2563 | |
| 2564 | mainCtrl.SimulateRestart(t) |
| 2565 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2566 | |
| 2567 | //Del2 |
| 2568 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2569 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2570 | |
| 2571 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2572 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2573 | |
| 2574 | //Wait that subs is cleaned |
| 2575 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2576 | |
| 2577 | xappConn1.TestMsgChanEmpty(t) |
| 2578 | xappConn2.TestMsgChanEmpty(t) |
| 2579 | e2termConn1.TestMsgChanEmpty(t) |
| 2580 | mainCtrl.wait_registry_empty(t, 10) |
| 2581 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2582 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2583 | //***************************************************************************** |
| 2584 | // REST interface test cases |
| 2585 | //***************************************************************************** |
| 2586 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2587 | //----------------------------------------------------------------------------- |
| 2588 | // Test debug GET and POST requests |
| 2589 | // |
| 2590 | // curl |
| 2591 | // +-------+ +---------+ |
| 2592 | // | user | | submgr | |
| 2593 | // +-------+ +---------+ |
| 2594 | // | | |
| 2595 | // | GET/POST Req | |
| 2596 | // |------------->| |
| 2597 | // | Resp | |
| 2598 | // |<-------------| |
| 2599 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2600 | func TestGetSubscriptions(t *testing.T) { |
| 2601 | |
| 2602 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2603 | } |
| 2604 | |
| 2605 | func TestGetSymptomData(t *testing.T) { |
| 2606 | |
| 2607 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2608 | } |
| 2609 | |
| 2610 | func TestPostdeleteSubId(t *testing.T) { |
| 2611 | |
| 2612 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2613 | } |
| 2614 | |
| 2615 | func TestPostEmptyDb(t *testing.T) { |
| 2616 | |
| 2617 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2618 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2619 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2620 | func TestGetRestSubscriptions(t *testing.T) { |
| 2621 | |
| 2622 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2623 | } |
| 2624 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2625 | //----------------------------------------------------------------------------- |
| 2626 | // TestRESTSubReqAndRouteNok |
| 2627 | // |
| 2628 | // stub stub |
| 2629 | // +-------+ +---------+ +---------+ |
| 2630 | // | xapp | | submgr | | rtmgr | |
| 2631 | // +-------+ +---------+ +---------+ |
| 2632 | // | | | |
| 2633 | // | RESTSubReq | | |
| 2634 | // |---------------->| | |
| 2635 | // | | | |
| 2636 | // | RESTSubResp | | |
| 2637 | // |<----------------| | |
| 2638 | // | | RouteCreate | |
| 2639 | // | |------------->| |
| 2640 | // | | | |
| 2641 | // | | RouteCreate | |
| 2642 | // | | status:400 | |
| 2643 | // | |(Bad request) | |
| 2644 | // | |<-------------| |
| 2645 | // | RESTNotif | | |
| 2646 | // |<----------------| | |
| 2647 | // | | | |
| 2648 | // | [SUBS INT DELETE] | |
| 2649 | // | | | |
| 2650 | // | RESTSubDelReq | | |
| 2651 | // |---------------->| | |
| 2652 | // | RESTSubDelResp | | |
| 2653 | // |<----------------| | |
| 2654 | // |
| 2655 | //----------------------------------------------------------------------------- |
| 2656 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2657 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2658 | |
| 2659 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2660 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2661 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2662 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2663 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2664 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2665 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2666 | }) |
| 2667 | |
| 2668 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2669 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2670 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2671 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2672 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2673 | |
| 2674 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2675 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2676 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2677 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2678 | waiter.WaitResult(t) |
| 2679 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2680 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2681 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2682 | |
| 2683 | // Del |
| 2684 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2685 | |
| 2686 | // Wait that subs is cleaned |
| 2687 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2688 | waitSubsCleanup(t, e2SubsId, 10) |
| 2689 | mainCtrl.VerifyCounterValues(t) |
| 2690 | } |
| 2691 | |
| 2692 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2693 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2694 | |
| 2695 | //Init counter check |
| 2696 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2697 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2698 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2699 | Counter{cSubReqToE2, 1}, |
| 2700 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2701 | Counter{cRestSubNotifToXapp, 1}, |
| 2702 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2703 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2704 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2705 | Counter{cSubDelReqToE2, 1}, |
| 2706 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2707 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2708 | }) |
| 2709 | |
| 2710 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2711 | |
| 2712 | //Subs Create |
| 2713 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2714 | |
| 2715 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2716 | |
| 2717 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2718 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2719 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2720 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2721 | params.SetMeid("RAN_NAME_1") |
| 2722 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2723 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2724 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2725 | waiter.WaitResult(t) |
| 2726 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2727 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2728 | |
| 2729 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2730 | |
| 2731 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2732 | |
| 2733 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2734 | //Wait that subs is cleaned |
| 2735 | waitSubsCleanup(t, e2SubsId, 10) |
| 2736 | |
| 2737 | mainCtrl.VerifyCounterValues(t) |
| 2738 | } |
| 2739 | |
| 2740 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2741 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2742 | |
| 2743 | // Init counter check |
| 2744 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2745 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2746 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2747 | Counter{cSubReqToE2, 1}, |
| 2748 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2749 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2750 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2751 | Counter{cRouteDeleteFail, 1}, |
| 2752 | Counter{cSubDelReqToE2, 1}, |
| 2753 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2754 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2755 | }) |
| 2756 | |
| 2757 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2758 | |
| 2759 | //Subs Create |
| 2760 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2761 | |
| 2762 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2763 | |
| 2764 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2765 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2766 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2767 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2768 | waiter.WaitResult(t) |
| 2769 | |
| 2770 | waitSubsCleanup(t, e2SubsId, 10) |
| 2771 | |
| 2772 | mainCtrl.VerifyCounterValues(t) |
| 2773 | } |
| 2774 | |
| 2775 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2776 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2777 | |
| 2778 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2779 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2780 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2781 | Counter{cSubReqToE2, 1}, |
| 2782 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2783 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2784 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2785 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2786 | Counter{cSubDelReqToE2, 1}, |
| 2787 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2788 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2789 | }) |
| 2790 | |
| 2791 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2792 | |
| 2793 | //Subs Create |
| 2794 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2795 | |
| 2796 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2797 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2798 | |
| 2799 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2800 | |
| 2801 | //Del1, this shall fail on rtmgr side |
| 2802 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2803 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2804 | waiter.WaitResult(t) |
| 2805 | |
| 2806 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2807 | |
| 2808 | //Del2 |
| 2809 | deleteXapp2Subscription(t, &restSubId2) |
| 2810 | |
| 2811 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2812 | mainCtrl.VerifyCounterValues(t) |
| 2813 | } |
| 2814 | |
| 2815 | //----------------------------------------------------------------------------- |
| 2816 | // TestRESTSubReqRetransmission |
| 2817 | // |
| 2818 | // stub stub |
| 2819 | // +-------+ +---------+ +---------+ |
| 2820 | // | xapp | | submgr | | e2term | |
| 2821 | // +-------+ +---------+ +---------+ |
| 2822 | // | | | |
| 2823 | // | RESTSubReq1 | | |
| 2824 | // |---------------->| | |
| 2825 | // | | | |
| 2826 | // | RESTSubResp | | |
| 2827 | // |<----------------| | |
| 2828 | // | | SubReq1 | |
| 2829 | // | |------------->| |
| 2830 | // | | | |
| 2831 | // | RESTSubReq2 | | |
| 2832 | // | (retrans) | | |
| 2833 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2834 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2835 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2836 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2837 | // | | SubResp1 | |
| 2838 | // | |<-------------| |
| 2839 | // | RESTNotif1 | | |
| 2840 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2841 | // | | | |
| 2842 | // | [SUBS DELETE] | |
| 2843 | // | | | |
| 2844 | // |
| 2845 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2846 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2847 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2848 | CaseBegin("TestRESTSubReqRetransmission") |
| 2849 | |
| 2850 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2851 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2852 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2853 | Counter{cSubReqToE2, 1}, |
| 2854 | Counter{cSubRespFromE2, 1}, |
| 2855 | Counter{cRestSubNotifToXapp, 1}, |
| 2856 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2857 | Counter{cSubDelReqToE2, 1}, |
| 2858 | Counter{cSubDelRespFromE2, 1}, |
| 2859 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2860 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2861 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2862 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2863 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2864 | |
| 2865 | // Subs Create |
| 2866 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2867 | |
| 2868 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2869 | // gets into execution before the rtmgrg responds for the first one. |
| 2870 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2871 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2872 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2873 | xappConn2.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2874 | |
| 2875 | waiter.WaitResult(t) |
| 2876 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2877 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2878 | |
| 2879 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2880 | // the order is not significant he6re. |
| 2881 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2882 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2883 | |
| 2884 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2885 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2886 | |
| 2887 | // Del1 |
| 2888 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2889 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2890 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2891 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2892 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2893 | |
| 2894 | mainCtrl.VerifyCounterValues(t) |
| 2895 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2896 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2897 | //----------------------------------------------------------------------------- |
| 2898 | // stub stub stub |
| 2899 | // +-------+ +---------+ +---------+ +---------+ |
| 2900 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2901 | // +-------+ +---------+ +---------+ +---------+ |
| 2902 | // | | | | |
| 2903 | // | RESTSubReq | | | |
| 2904 | // |---------------->| | | |
| 2905 | // | RESTSubResp | | | |
| 2906 | // |<----------------| | | |
| 2907 | // | | RouteCreate | | |
| 2908 | // | |--------------------------->| |
| 2909 | // | | RouteResponse| | |
| 2910 | // | |<---------------------------| // The order of these events may vary |
| 2911 | // | | SubReq | | |
| 2912 | // | |------------->| | // The order of these events may vary |
| 2913 | // | | SubResp | | |
| 2914 | // | |<-------------| | |
| 2915 | // | RESTNotif1 | | | |
| 2916 | // |<----------------| | | |
| 2917 | // | RESTSubReq | | | |
| 2918 | // | [RETRANS1] | | | |
| 2919 | // |---------------->| | | |
| 2920 | // | RESTNotif1 | | | |
| 2921 | // |<----------------| | | |
| 2922 | // | RESTSubReq | | | |
| 2923 | // | [RETRANS2] | | | |
| 2924 | // |---------------->| | | |
| 2925 | // | RESTNotif1 | | | |
| 2926 | // |<----------------| | | |
| 2927 | // | RESTSubDelReq | | | |
| 2928 | // |---------------->| | | |
| 2929 | // | | SubDelReq | | |
| 2930 | // | |------------->| | |
| 2931 | // | RESTSubDelResp| | | |
| 2932 | // |<----------------| | | |
| 2933 | // | | SubDelResp | | |
| 2934 | // | |<-------------| | |
| 2935 | // | | | | |
| 2936 | // |
| 2937 | //----------------------------------------------------------------------------- |
| 2938 | |
| 2939 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2940 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2941 | |
| 2942 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2943 | Counter{cRestSubReqFromXapp, 3}, |
| 2944 | Counter{cRestSubRespToXapp, 3}, |
| 2945 | Counter{cSubReqToE2, 1}, |
| 2946 | Counter{cSubRespFromE2, 1}, |
| 2947 | Counter{cRestSubNotifToXapp, 3}, |
| 2948 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2949 | Counter{cSubDelReqToE2, 1}, |
| 2950 | Counter{cSubDelRespFromE2, 1}, |
| 2951 | Counter{cRestSubDelRespToXapp, 1}, |
| 2952 | }) |
| 2953 | |
| 2954 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2955 | |
| 2956 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2957 | |
| 2958 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2959 | |
| 2960 | //1.st resend |
| 2961 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2962 | |
| 2963 | assert.Equal(t, restSubId_resend, restSubId) |
| 2964 | |
| 2965 | <-time.After(100 * time.Millisecond) |
| 2966 | |
| 2967 | //2.nd resend |
| 2968 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2969 | |
| 2970 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2971 | |
| 2972 | <-time.After(100 * time.Millisecond) |
| 2973 | |
| 2974 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2975 | |
| 2976 | waitSubsCleanup(t, e2SubsId, 10) |
| 2977 | |
| 2978 | //Wait that subs is cleaned |
| 2979 | mainCtrl.VerifyCounterValues(t) |
| 2980 | } |
| 2981 | |
| 2982 | //----------------------------------------------------------------------------- |
| 2983 | // stub stub stub |
| 2984 | // +-------+ +---------+ +---------+ +---------+ |
| 2985 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2986 | // +-------+ +---------+ +---------+ +---------+ |
| 2987 | // | | | | |
| 2988 | // | RESTSubReq | | | |
| 2989 | // |---------------->| | | |
| 2990 | // | RESTSubResp | | | |
| 2991 | // |<----------------| | | |
| 2992 | // | | RouteCreate | | |
| 2993 | // | |--------------------------->| |
| 2994 | // | | RouteResponse| | |
| 2995 | // | |<---------------------------| // The order of these events may vary |
| 2996 | // | | SubReq | | |
| 2997 | // | |------------->| | // The order of these events may vary |
| 2998 | // | | SubResp | | |
| 2999 | // | |<-------------| | |
| 3000 | // | RESTNotif1 | | | |
| 3001 | // |<----------------| | | |
| 3002 | // | RESTSubReq | | | |
| 3003 | // | [RETRANS, with RESTsubsId] | | |
| 3004 | // |---------------->| | | |
| 3005 | // | RESTNotif1 | | | |
| 3006 | // |<----------------| | | |
| 3007 | // | RESTSubReq | | | |
| 3008 | // | [RETRANS, without RESTsubsId] | | |
| 3009 | // |---------------->| | | |
| 3010 | // | RESTNotif1 | | | |
| 3011 | // |<----------------| | | |
| 3012 | // | RESTSubDelReq | | | |
| 3013 | // |---------------->| | | |
| 3014 | // | | SubDelReq | | |
| 3015 | // | |------------->| | |
| 3016 | // | RESTSubDelResp| | | |
| 3017 | // |<----------------| | | |
| 3018 | // | | SubDelResp | | |
| 3019 | // | |<-------------| | |
| 3020 | // | | | | |
| 3021 | // |
| 3022 | //----------------------------------------------------------------------------- |
| 3023 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3024 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3025 | |
| 3026 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3027 | Counter{cRestSubReqFromXapp, 3}, |
| 3028 | Counter{cRestSubRespToXapp, 3}, |
| 3029 | Counter{cSubReqToE2, 1}, |
| 3030 | Counter{cSubRespFromE2, 1}, |
| 3031 | Counter{cRestSubNotifToXapp, 3}, |
| 3032 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3033 | Counter{cSubDelReqToE2, 1}, |
| 3034 | Counter{cSubDelRespFromE2, 1}, |
| 3035 | Counter{cRestSubDelRespToXapp, 1}, |
| 3036 | }) |
| 3037 | |
| 3038 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3039 | |
| 3040 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3041 | |
| 3042 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3043 | |
| 3044 | <-time.After(100 * time.Millisecond) |
| 3045 | |
| 3046 | //1.st resend with subscription ID |
| 3047 | params.SetSubscriptionID(&restSubId) |
| 3048 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3049 | |
| 3050 | assert.Equal(t, restSubId_resend, restSubId) |
| 3051 | |
| 3052 | <-time.After(100 * time.Millisecond) |
| 3053 | |
| 3054 | //2.nd resend without subscription ID (faking app restart) |
| 3055 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3056 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3057 | |
| 3058 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3059 | |
| 3060 | <-time.After(100 * time.Millisecond) |
| 3061 | |
| 3062 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3063 | |
| 3064 | waitSubsCleanup(t, e2SubsId, 10) |
| 3065 | |
| 3066 | //Wait that subs is cleaned |
| 3067 | mainCtrl.VerifyCounterValues(t) |
| 3068 | } |
| 3069 | |
| 3070 | //----------------------------------------------------------------------------- |
| 3071 | // stub stub stub |
| 3072 | // +-------+ +---------+ +---------+ +---------+ |
| 3073 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3074 | // +-------+ +---------+ +---------+ +---------+ |
| 3075 | // | | | | |
| 3076 | // | RESTSubReq | | | |
| 3077 | // |---------------->| | | |
| 3078 | // | RESTSubResp | | | |
| 3079 | // |<----------------| | | |
| 3080 | // | | RouteCreate | | |
| 3081 | // | |--------------------------->| |
| 3082 | // | | RouteResponse| | |
| 3083 | // | |<---------------------------| |
| 3084 | // | | SubReq | | |
| 3085 | // | |------------->| | |
| 3086 | // | | SubResp | | |
| 3087 | // | |<-------------| | |
| 3088 | // | RESTNotif1 | | | |
| 3089 | // |<----------------| | | |
| 3090 | // | RESTSubReq | | | |
| 3091 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3092 | // |---------------->| | | |
| 3093 | // | RESTNotif1 | | | |
| 3094 | // | [for initial e2 subDetail] | | |
| 3095 | // |<----------------| | | |
| 3096 | // | | RouteCreate | | |
| 3097 | // | |--------------------------->| |
| 3098 | // | | RouteResponse| | |
| 3099 | // | |<---------------------------| |
| 3100 | // | | SubReq | | |
| 3101 | // | |------------->| | |
| 3102 | // | | SubResp | | |
| 3103 | // | |<-------------| | |
| 3104 | // | RESTNotif1 | | | |
| 3105 | // |<----------------| | | |
| 3106 | // | RESTSubReq | | | |
| 3107 | // | [with RESTsubsId initial request] | |
| 3108 | // |---------------->| | | |
| 3109 | // | RESTNotif1 | | | |
| 3110 | // |<----------------| | | |
| 3111 | // | RESTSubDelReq | | | |
| 3112 | // |---------------->| | | |
| 3113 | // | RESTSubDelResp| | | |
| 3114 | // |<----------------| | | |
| 3115 | // | | SubDelReq | | |
| 3116 | // | |------------->| | |
| 3117 | // | | SubDelResp | | |
| 3118 | // | |<-------------| | |
| 3119 | // | | SubDelReq | | |
| 3120 | // | |------------->| | |
| 3121 | // | | SubDelResp | | |
| 3122 | // | |<-------------| | |
| 3123 | // | | | | |
| 3124 | // |
| 3125 | //----------------------------------------------------------------------------- |
| 3126 | |
| 3127 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3128 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3129 | |
| 3130 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3131 | Counter{cRestSubReqFromXapp, 3}, |
| 3132 | Counter{cRestSubRespToXapp, 3}, |
| 3133 | Counter{cSubReqToE2, 2}, |
| 3134 | Counter{cSubRespFromE2, 2}, |
| 3135 | Counter{cRestSubNotifToXapp, 4}, |
| 3136 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3137 | Counter{cSubDelReqToE2, 2}, |
| 3138 | Counter{cSubDelRespFromE2, 2}, |
| 3139 | Counter{cRestSubDelRespToXapp, 1}, |
| 3140 | }) |
| 3141 | |
| 3142 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3143 | |
| 3144 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3145 | |
| 3146 | <-time.After(100 * time.Millisecond) |
| 3147 | |
| 3148 | // Send modified requst, this time with e2 subscriptions. |
| 3149 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3150 | params2.SetSubscriptionID(&restSubId) |
| 3151 | |
| 3152 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3153 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3154 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3155 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3156 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3157 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3158 | |
| 3159 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3160 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3161 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3162 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3163 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3164 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3165 | assert.NotEqual(t, e2SubsId2, 0) |
| 3166 | |
| 3167 | <-time.After(100 * time.Millisecond) |
| 3168 | |
| 3169 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3170 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3171 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3172 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3173 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3174 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3175 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3176 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3177 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3178 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3179 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3180 | // Delete both e2 subscriptions |
| 3181 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3182 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3183 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3184 | |
| 3185 | waitSubsCleanup(t, e2SubsId, 10) |
| 3186 | |
| 3187 | //Wait that subs is cleaned |
| 3188 | mainCtrl.VerifyCounterValues(t) |
| 3189 | } |
| 3190 | |
| 3191 | //----------------------------------------------------------------------------- |
| 3192 | // stub stub stub |
| 3193 | // +-------+ +---------+ +---------+ +---------+ |
| 3194 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3195 | // +-------+ +---------+ +---------+ +---------+ |
| 3196 | // | | | | |
| 3197 | // | RESTSubReq | | | |
| 3198 | // |---------------->| | | |
| 3199 | // | RESTSubResp | | | |
| 3200 | // |<----------------| | | |
| 3201 | // | | RouteCreate | | |
| 3202 | // | |--------------------------->| |
| 3203 | // | | RouteResponse| | |
| 3204 | // | |<---------------------------| |
| 3205 | // | | SubReq | | |
| 3206 | // | |------------->| | |
| 3207 | // | | SubResp | | |
| 3208 | // | |<-------------| | |
| 3209 | // | RESTNotif1 | | | |
| 3210 | // |<----------------| | | |
| 3211 | // | RESTSubReq | | | |
| 3212 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3213 | // |---------------->| | | |
| 3214 | // | RESTNotif1 | | | |
| 3215 | // | [for initial e2 subDetail] | | |
| 3216 | // |<----------------| | | |
| 3217 | // | | RouteCreate | | |
| 3218 | // | |--------------------------->| |
| 3219 | // | | RouteResponse| | |
| 3220 | // | |<---------------------------| |
| 3221 | // | | SubReq | | |
| 3222 | // | |------------->| | |
| 3223 | // | | SubResp | | |
| 3224 | // | |<-------------| | |
| 3225 | // | RESTNotif1 | | | |
| 3226 | // |<----------------| | | |
| 3227 | // | RESTSubReq | | | |
| 3228 | // | [without RESTsubsId initial request] | |
| 3229 | // |---------------->| | | |
| 3230 | // | RESTNotif1 | | | |
| 3231 | // |<----------------| | | |
| 3232 | // | RESTSubDelReq | | | |
| 3233 | // |---------------->| | | |
| 3234 | // | RESTSubDelResp| | | |
| 3235 | // |<----------------| | | |
| 3236 | // | | SubDelReq | | |
| 3237 | // | |------------->| | |
| 3238 | // | | SubDelResp | | |
| 3239 | // | |<-------------| | |
| 3240 | // | | SubDelReq | | |
| 3241 | // | |------------->| | |
| 3242 | // | | SubDelResp | | |
| 3243 | // | |<-------------| | |
| 3244 | // | | | | |
| 3245 | // |
| 3246 | //----------------------------------------------------------------------------- |
| 3247 | |
| 3248 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3249 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3250 | |
| 3251 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3252 | Counter{cRestSubReqFromXapp, 3}, |
| 3253 | Counter{cRestSubRespToXapp, 3}, |
| 3254 | Counter{cSubReqToE2, 2}, |
| 3255 | Counter{cSubRespFromE2, 2}, |
| 3256 | Counter{cRestSubNotifToXapp, 4}, |
| 3257 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3258 | Counter{cSubDelReqToE2, 2}, |
| 3259 | Counter{cSubDelRespFromE2, 2}, |
| 3260 | Counter{cRestSubDelRespToXapp, 1}, |
| 3261 | }) |
| 3262 | |
| 3263 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3264 | |
| 3265 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3266 | |
| 3267 | <-time.After(100 * time.Millisecond) |
| 3268 | |
| 3269 | // Send modified requst, this time with e2 subscriptions. |
| 3270 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3271 | params2.SetSubscriptionID(&restSubId) |
| 3272 | |
| 3273 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3274 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3275 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3276 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3277 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3278 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3279 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3280 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3281 | xappConn1.DecrementRequestCount() |
| 3282 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3283 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3284 | |
| 3285 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3286 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3287 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3288 | assert.NotEqual(t, e2SubsId2, 0) |
| 3289 | |
| 3290 | <-time.After(100 * time.Millisecond) |
| 3291 | |
| 3292 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3293 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3294 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3295 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3296 | // md5sum shall find the original request |
| 3297 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3298 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3299 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3300 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3301 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3302 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3303 | // Delete both e2 subscriptions |
| 3304 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3305 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3306 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3307 | |
| 3308 | waitSubsCleanup(t, e2SubsId, 10) |
| 3309 | |
| 3310 | //Wait that subs is cleaned |
| 3311 | mainCtrl.VerifyCounterValues(t) |
| 3312 | } |
| 3313 | |
| 3314 | //----------------------------------------------------------------------------- |
| 3315 | // stub stub stub |
| 3316 | // +-------+ +---------+ +---------+ +---------+ |
| 3317 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3318 | // +-------+ +---------+ +---------+ +---------+ |
| 3319 | // | | | | |
| 3320 | // | RESTSubReq | | | |
| 3321 | // |---------------->| | | |
| 3322 | // | RESTSubResp | | | |
| 3323 | // |<----------------| | | |
| 3324 | // | | RouteCreate | | |
| 3325 | // | |--------------------------->| |
| 3326 | // | | RouteResponse| | |
| 3327 | // | |<---------------------------| |
| 3328 | // | | SubReq | | |
| 3329 | // | |------------->| | |
| 3330 | // | | SubResp | | |
| 3331 | // | |<-------------| | |
| 3332 | // | RESTNotif1 | | | |
| 3333 | // |<----------------| | | |
| 3334 | // | RESTSubReq | | | |
| 3335 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3336 | // |---------------->| | | |
| 3337 | // | RESTNotif1 | | | |
| 3338 | // | [for initial e2 subDetail] | | |
| 3339 | // |<----------------| | | |
| 3340 | // | | RouteCreate | | |
| 3341 | // | |--------------------------->| |
| 3342 | // | | RouteResponse| | |
| 3343 | // | |<---------------------------| |
| 3344 | // | | SubReq | | |
| 3345 | // | |------------->| | |
| 3346 | // | | SubResp | | |
| 3347 | // | |<-------------| | |
| 3348 | // | RESTNotif1 | | | |
| 3349 | // |<----------------| | | |
| 3350 | // | RESTSubDelReq | | | |
| 3351 | // |---------------->| | | |
| 3352 | // | RESTSubDelResp| | | |
| 3353 | // |<----------------| | | |
| 3354 | // | | SubDelReq | | |
| 3355 | // | |------------->| | |
| 3356 | // | | SubDelResp | | |
| 3357 | // | |<-------------| | |
| 3358 | // | | SubDelReq | | |
| 3359 | // | |------------->| | |
| 3360 | // | | SubDelResp | | |
| 3361 | // | |<-------------| | |
| 3362 | // | RESTSubReq | | | |
| 3363 | // | [with RESTsubsId initial request] | |
| 3364 | // |---------------->| | | |
| 3365 | // | RESTSubResp | | | |
| 3366 | // |<----------------| | | |
| 3367 | // | | RouteCreate | | |
| 3368 | // | |--------------------------->| |
| 3369 | // | | RouteResponse| | |
| 3370 | // | |<---------------------------| |
| 3371 | // | | SubReq | | |
| 3372 | // | |------------->| | |
| 3373 | // | | SubResp | | |
| 3374 | // | |<-------------| | |
| 3375 | // | RESTNotif1 | | | |
| 3376 | // |<----------------| | | |
| 3377 | // | | | | |
| 3378 | // |
| 3379 | //----------------------------------------------------------------------------- |
| 3380 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3381 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3382 | |
| 3383 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3384 | Counter{cRestSubReqFromXapp, 3}, |
| 3385 | Counter{cRestSubRespToXapp, 3}, |
| 3386 | Counter{cSubReqToE2, 3}, |
| 3387 | Counter{cSubRespFromE2, 3}, |
| 3388 | Counter{cRestSubNotifToXapp, 4}, |
| 3389 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3390 | Counter{cSubDelReqToE2, 3}, |
| 3391 | Counter{cSubDelRespFromE2, 3}, |
| 3392 | Counter{cRestSubDelRespToXapp, 2}, |
| 3393 | }) |
| 3394 | |
| 3395 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3396 | |
| 3397 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3398 | |
| 3399 | <-time.After(100 * time.Millisecond) |
| 3400 | |
| 3401 | // Send modified requst, this time with e2 subscriptions. |
| 3402 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3403 | params2.SetSubscriptionID(&restSubId) |
| 3404 | |
| 3405 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3406 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3407 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3408 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3409 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3410 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3411 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3412 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3413 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3414 | |
| 3415 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3416 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3417 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3418 | assert.NotEqual(t, e2SubsId2, 0) |
| 3419 | |
| 3420 | <-time.After(100 * time.Millisecond) |
| 3421 | |
| 3422 | // Delete both e2 subscriptions |
| 3423 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3424 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3425 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3426 | |
| 3427 | waitSubsCleanup(t, e2SubsId, 10) |
| 3428 | |
| 3429 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3430 | // but the restsubscription has been already removed. This shall trigger a |
| 3431 | // fresh create. |
| 3432 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3433 | |
| 3434 | <-time.After(100 * time.Millisecond) |
| 3435 | |
| 3436 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3437 | |
| 3438 | waitSubsCleanup(t, e2SubsId, 10) |
| 3439 | |
| 3440 | //Wait that subs is cleaned |
| 3441 | mainCtrl.VerifyCounterValues(t) |
| 3442 | } |
| 3443 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3444 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3445 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3446 | |
| 3447 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3448 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3449 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3450 | Counter{cSubReqToE2, 1}, |
| 3451 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3452 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3453 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3454 | Counter{cSubDelReqToE2, 1}, |
| 3455 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3456 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3457 | }) |
| 3458 | |
| 3459 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3460 | |
| 3461 | //Subs Create |
| 3462 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3463 | |
| 3464 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3465 | |
| 3466 | //Subs Delete |
| 3467 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3468 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3469 | |
| 3470 | seqBef := mainCtrl.get_msgcounter(t) |
| 3471 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3472 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3473 | |
| 3474 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3475 | |
| 3476 | waitSubsCleanup(t, e2SubsId, 10) |
| 3477 | |
| 3478 | mainCtrl.VerifyCounterValues(t) |
| 3479 | } |
| 3480 | |
| 3481 | //----------------------------------------------------------------------------- |
| 3482 | // TestRESTSubReqDelReq |
| 3483 | // |
| 3484 | // stub stub |
| 3485 | // +-------+ +---------+ +---------+ |
| 3486 | // | xapp | | submgr | | e2term | |
| 3487 | // +-------+ +---------+ +---------+ |
| 3488 | // | | | |
| 3489 | // | RESTSubReq | | |
| 3490 | // |---------------->| | |
| 3491 | // | | | |
| 3492 | // | RESTSubResp | | |
| 3493 | // |<----------------| | |
| 3494 | // | | SubReq | |
| 3495 | // | |------------->| |
| 3496 | // | RESTSubDelReq | | |
| 3497 | // |---------------->| | |
| 3498 | // | RESTSubDelResp | | |
| 3499 | // | unsuccess | | |
| 3500 | // |<----------------| | |
| 3501 | // | | SubResp | |
| 3502 | // | |<-------------| |
| 3503 | // | RESTNotif1 | | |
| 3504 | // |<----------------| | |
| 3505 | // | | | |
| 3506 | // | [SUBS DELETE] | |
| 3507 | // | | | |
| 3508 | // |
| 3509 | //----------------------------------------------------------------------------- |
| 3510 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3511 | CaseBegin("TestRESTSubReqDelReq") |
| 3512 | |
| 3513 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3514 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3515 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3516 | Counter{cSubReqToE2, 1}, |
| 3517 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3518 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3519 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3520 | Counter{cSubDelReqToE2, 1}, |
| 3521 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3522 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3523 | }) |
| 3524 | |
| 3525 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3526 | |
| 3527 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3528 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3529 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3530 | |
| 3531 | // Del. This will fail as processing of the subscription |
| 3532 | // is still ongoing in submgr. Deletion is not allowed before |
| 3533 | // subscription creation has been completed. |
| 3534 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3535 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3536 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3537 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3538 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3539 | |
| 3540 | // Retry del |
| 3541 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3542 | |
| 3543 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3544 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3545 | |
| 3546 | // Wait that subs is cleaned |
| 3547 | waitSubsCleanup(t, e2SubsId, 10) |
| 3548 | mainCtrl.VerifyCounterValues(t) |
| 3549 | |
| 3550 | } |
| 3551 | |
| 3552 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3553 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3554 | } |
| 3555 | |
| 3556 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3557 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3558 | |
| 3559 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3560 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3561 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3562 | Counter{cSubReqToE2, 2}, |
| 3563 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3564 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3565 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3566 | Counter{cSubDelReqToE2, 2}, |
| 3567 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3568 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3569 | }) |
| 3570 | |
| 3571 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3572 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3573 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3574 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3575 | |
| 3576 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3577 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3578 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3579 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3580 | |
| 3581 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3582 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3583 | |
| 3584 | //XappConn1 receives both of the responses |
| 3585 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3586 | |
| 3587 | //Resp1 |
| 3588 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3589 | //Resp2 |
| 3590 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3591 | |
| 3592 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3593 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3594 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3595 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3596 | |
| 3597 | //Del1 |
| 3598 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3599 | //Del2 |
| 3600 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3601 | |
| 3602 | //Wait that subs is cleaned |
| 3603 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3604 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3605 | |
| 3606 | mainCtrl.VerifyCounterValues(t) |
| 3607 | |
| 3608 | } |
| 3609 | |
| 3610 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3611 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3612 | |
| 3613 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3614 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3615 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3616 | Counter{cSubReqToE2, 2}, |
| 3617 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3618 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3619 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3620 | Counter{cSubDelReqToE2, 2}, |
| 3621 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3622 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3623 | }) |
| 3624 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3625 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3626 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3627 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3628 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3629 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3630 | params.SetMeid("RAN_NAME_2") |
| 3631 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3632 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3633 | |
| 3634 | //Del1 |
| 3635 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3636 | //Del2 |
| 3637 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3638 | |
| 3639 | //Wait that subs is cleaned |
| 3640 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3641 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3642 | |
| 3643 | mainCtrl.VerifyCounterValues(t) |
| 3644 | |
| 3645 | } |
| 3646 | |
| 3647 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3648 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3649 | |
| 3650 | // Init counter check |
| 3651 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3652 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3653 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3654 | Counter{cSubReqToE2, 1}, |
| 3655 | Counter{cSubReReqToE2, 1}, |
| 3656 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3657 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3658 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3659 | Counter{cSubDelReqToE2, 1}, |
| 3660 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3661 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3662 | }) |
| 3663 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3664 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3665 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3666 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3667 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3668 | |
| 3669 | // Catch the first message and ignore it |
| 3670 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3671 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3672 | |
| 3673 | // The second request is being handled normally |
| 3674 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3675 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3676 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3677 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3678 | |
| 3679 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3680 | |
| 3681 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3682 | |
| 3683 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3684 | //Wait that subs is cleaned |
| 3685 | waitSubsCleanup(t, e2SubsId, 10) |
| 3686 | |
| 3687 | mainCtrl.VerifyCounterValues(t) |
| 3688 | |
| 3689 | } |
| 3690 | |
| 3691 | //----------------------------------------------------------------------------- |
| 3692 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3693 | // |
| 3694 | // stub stub |
| 3695 | // +-------+ +---------+ +---------+ |
| 3696 | // | xapp | | submgr | | e2term | |
| 3697 | // +-------+ +---------+ +---------+ |
| 3698 | // | | | |
| 3699 | // | RESTSubReq | | |
| 3700 | // |---------------->| | |
| 3701 | // | | | |
| 3702 | // | RESTSubResp | | |
| 3703 | // |<----------------| | |
| 3704 | // | | SubReq | |
| 3705 | // | |------------->| |
| 3706 | // | | | |
| 3707 | // | | | |
| 3708 | // | | SubReq | |
| 3709 | // | |------------->| |
| 3710 | // | | | |
| 3711 | // | | SubDelReq | |
| 3712 | // | |------------->| |
| 3713 | // | | | |
| 3714 | // | | | |
| 3715 | // | | SubDelReq | |
| 3716 | // | |------------->| |
| 3717 | // | | | |
| 3718 | // | | | |
| 3719 | // | | SubDelResp | |
| 3720 | // | |<-------------| |
| 3721 | // | RESTNotif | | |
| 3722 | // | unsuccess | | |
| 3723 | // |<----------------| | |
| 3724 | // | | | |
| 3725 | // | [SUBS DELETE] | |
| 3726 | // | | | |
| 3727 | // |
| 3728 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3729 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3730 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3731 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3732 | |
| 3733 | // Init counter check |
| 3734 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3735 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3736 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3737 | Counter{cSubReqToE2, 1}, |
| 3738 | Counter{cSubReReqToE2, 1}, |
| 3739 | Counter{cSubReqTimerExpiry, 2}, |
| 3740 | Counter{cSubDelReqToE2, 1}, |
| 3741 | Counter{cSubDelRespFromE2, 1}, |
| 3742 | }) |
| 3743 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3744 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3745 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3746 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3747 | |
| 3748 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3749 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3750 | |
| 3751 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3752 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3753 | |
| 3754 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3755 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3756 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3757 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3758 | |
| 3759 | // Wait that subs is cleaned |
| 3760 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 3761 | |
| 3762 | mainCtrl.VerifyCounterValues(t) |
| 3763 | } |
| 3764 | |
| 3765 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3766 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3767 | |
| 3768 | // Init counter check |
| 3769 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3770 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3771 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3772 | Counter{cSubReqToE2, 1}, |
| 3773 | Counter{cSubReReqToE2, 1}, |
| 3774 | Counter{cSubReqTimerExpiry, 2}, |
| 3775 | Counter{cSubDelReqToE2, 1}, |
| 3776 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3777 | }) |
| 3778 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3779 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3780 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3781 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3782 | |
| 3783 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3784 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3785 | |
| 3786 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3787 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3788 | |
| 3789 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3790 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3791 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3792 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3793 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3794 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3795 | |
| 3796 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3797 | |
| 3798 | waitSubsCleanup(t, e2SubsId, 10) |
| 3799 | |
| 3800 | mainCtrl.VerifyCounterValues(t) |
| 3801 | |
| 3802 | } |
| 3803 | |
| 3804 | //----------------------------------------------------------------------------- |
| 3805 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3806 | // |
| 3807 | // stub stub |
| 3808 | // +-------+ +---------+ +---------+ |
| 3809 | // | xapp | | submgr | | e2term | |
| 3810 | // +-------+ +---------+ +---------+ |
| 3811 | // | | | |
| 3812 | // | RESTSubReq | | |
| 3813 | // |---------------->| | |
| 3814 | // | | | |
| 3815 | // | RESTSubResp | | |
| 3816 | // |<----------------| | |
| 3817 | // | | SubReq | |
| 3818 | // | |------------->| |
| 3819 | // | | | |
| 3820 | // | | | |
| 3821 | // | | SubReq | |
| 3822 | // | |------------->| |
| 3823 | // | | | |
| 3824 | // | | SubDelReq | |
| 3825 | // | |------------->| |
| 3826 | // | | | |
| 3827 | // | | | |
| 3828 | // | | SubDelReq | |
| 3829 | // | |------------->| |
| 3830 | // | | | |
| 3831 | // | | | |
| 3832 | // | | SubDelResp | |
| 3833 | // | |<-------------| |
| 3834 | // | RESTNotif | | |
| 3835 | // | unsuccess | | |
| 3836 | // |<----------------| | |
| 3837 | // | | | |
| 3838 | // | [SUBS DELETE] | |
| 3839 | // | | | |
| 3840 | // |
| 3841 | //----------------------------------------------------------------------------- |
| 3842 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3843 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3844 | |
| 3845 | // Init counter check |
| 3846 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3847 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3848 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3849 | Counter{cSubReqToE2, 1}, |
| 3850 | Counter{cSubReReqToE2, 1}, |
| 3851 | Counter{cSubReqTimerExpiry, 2}, |
| 3852 | Counter{cSubDelReqToE2, 1}, |
| 3853 | Counter{cSubDelReReqToE2, 1}, |
| 3854 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3855 | }) |
| 3856 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3857 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3858 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3859 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3860 | |
| 3861 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3862 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3863 | |
| 3864 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3865 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3866 | |
| 3867 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3868 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3869 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3870 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3871 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3872 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3873 | |
| 3874 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3875 | |
| 3876 | waitSubsCleanup(t, e2SubsId, 10) |
| 3877 | |
| 3878 | mainCtrl.VerifyCounterValues(t) |
| 3879 | } |
| 3880 | |
| 3881 | //----------------------------------------------------------------------------- |
| 3882 | // TestRESTSubReqSubFailRespInSubmgr |
| 3883 | // |
| 3884 | // stub stub |
| 3885 | // +-------+ +---------+ +---------+ |
| 3886 | // | xapp | | submgr | | e2term | |
| 3887 | // +-------+ +---------+ +---------+ |
| 3888 | // | | | |
| 3889 | // | RESTSubReq | | |
| 3890 | // |---------------->| | |
| 3891 | // | | | |
| 3892 | // | RESTSubResp | | |
| 3893 | // |<----------------| | |
| 3894 | // | | SubReq | |
| 3895 | // | |------------->| |
| 3896 | // | | | |
| 3897 | // | | SubFail | |
| 3898 | // | |<-------------| |
| 3899 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3900 | // | RESTNotif | | |
| 3901 | // | unsuccess | | |
| 3902 | // |<----------------| | |
| 3903 | // | | | |
| 3904 | // | [SUBS DELETE] | |
| 3905 | // | | | |
| 3906 | // |
| 3907 | //----------------------------------------------------------------------------- |
| 3908 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3909 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3910 | |
| 3911 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3912 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3913 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3914 | Counter{cSubReqToE2, 1}, |
| 3915 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3916 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3917 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3918 | }) |
| 3919 | |
| 3920 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3921 | const e2Timeout int64 = 2 |
| 3922 | const e2RetryCount int64 = 1 |
| 3923 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3924 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3925 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3926 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3927 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3928 | |
| 3929 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3930 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3931 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame^] | 3932 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3933 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3934 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3935 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3936 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3937 | |
| 3938 | // REST subscription sill there to be deleted |
| 3939 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3940 | |
| 3941 | // Wait that subs is cleaned |
| 3942 | waitSubsCleanup(t, e2SubsId, 10) |
| 3943 | |
| 3944 | mainCtrl.VerifyCounterValues(t) |
| 3945 | |
| 3946 | } |
| 3947 | |
| 3948 | //----------------------------------------------------------------------------- |
| 3949 | // TestRESTSubDelReqRetryInSubmgr |
| 3950 | // |
| 3951 | // stub stub |
| 3952 | // +-------+ +---------+ +---------+ |
| 3953 | // | xapp | | submgr | | e2term | |
| 3954 | // +-------+ +---------+ +---------+ |
| 3955 | // | | | |
| 3956 | // | [SUBS CREATE] | |
| 3957 | // | | | |
| 3958 | // | | | |
| 3959 | // | RESTSubDelReq | | |
| 3960 | // |---------------->| | |
| 3961 | // | | | |
| 3962 | // | RESTSubDelResp | | |
| 3963 | // |<----------------| | |
| 3964 | // | | SubDelReq | |
| 3965 | // | |------------->| |
| 3966 | // | | | |
| 3967 | // | | SubDelReq | |
| 3968 | // | |------------->| |
| 3969 | // | | | |
| 3970 | // | | SubDelResp | |
| 3971 | // | |<-------------| |
| 3972 | // | | | |
| 3973 | // |
| 3974 | //----------------------------------------------------------------------------- |
| 3975 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3976 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3977 | |
| 3978 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3979 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3980 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3981 | Counter{cSubReqToE2, 1}, |
| 3982 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3983 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3984 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3985 | Counter{cSubDelReqToE2, 1}, |
| 3986 | Counter{cSubDelReReqToE2, 1}, |
| 3987 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3988 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3989 | }) |
| 3990 | // Req |
| 3991 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3992 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3993 | |
| 3994 | // Del |
| 3995 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3996 | |
| 3997 | // E2t: Receive 1st SubsDelReq |
| 3998 | e2termConn1.RecvSubsDelReq(t) |
| 3999 | |
| 4000 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4001 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4002 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4003 | |
| 4004 | //Wait that subs is cleaned |
| 4005 | waitSubsCleanup(t, e2SubsId, 10) |
| 4006 | |
| 4007 | mainCtrl.VerifyCounterValues(t) |
| 4008 | } |
| 4009 | |
| 4010 | //----------------------------------------------------------------------------- |
| 4011 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4012 | // |
| 4013 | // stub stub |
| 4014 | // +-------+ +---------+ +---------+ |
| 4015 | // | xapp | | submgr | | e2term | |
| 4016 | // +-------+ +---------+ +---------+ |
| 4017 | // | | | |
| 4018 | // | [SUBS CREATE] | |
| 4019 | // | | | |
| 4020 | // | | | |
| 4021 | // | RESTSubDelReq | | |
| 4022 | // |---------------->| | |
| 4023 | // | | | |
| 4024 | // | RESTSubDelResp | | |
| 4025 | // |<----------------| | |
| 4026 | // | | SubDelReq | |
| 4027 | // | |------------->| |
| 4028 | // | | | |
| 4029 | // | | SubDelReq | |
| 4030 | // | |------------->| |
| 4031 | // | | | |
| 4032 | // | | | |
| 4033 | // |
| 4034 | //----------------------------------------------------------------------------- |
| 4035 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4036 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4037 | |
| 4038 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4039 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4040 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4041 | Counter{cSubReqToE2, 1}, |
| 4042 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4043 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4044 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4045 | Counter{cSubDelReqToE2, 1}, |
| 4046 | Counter{cSubDelReReqToE2, 1}, |
| 4047 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4048 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4049 | }) |
| 4050 | |
| 4051 | // Req |
| 4052 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4053 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4054 | |
| 4055 | // Del |
| 4056 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4057 | |
| 4058 | // E2t: Receive 1st SubsDelReq |
| 4059 | e2termConn1.RecvSubsDelReq(t) |
| 4060 | |
| 4061 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4062 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4063 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4064 | |
| 4065 | //Wait that subs is cleaned |
| 4066 | waitSubsCleanup(t, e2SubsId, 10) |
| 4067 | |
| 4068 | mainCtrl.VerifyCounterValues(t) |
| 4069 | } |
| 4070 | |
| 4071 | //----------------------------------------------------------------------------- |
| 4072 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4073 | // |
| 4074 | // stub stub |
| 4075 | // +-------+ +---------+ +---------+ |
| 4076 | // | xapp | | submgr | | e2term | |
| 4077 | // +-------+ +---------+ +---------+ |
| 4078 | // | | | |
| 4079 | // | [SUBS CREATE] | |
| 4080 | // | | | |
| 4081 | // | | | |
| 4082 | // | RESTSubDelReq | | |
| 4083 | // |---------------->| | |
| 4084 | // | | | |
| 4085 | // | RESTSubDelResp | | |
| 4086 | // |<----------------| | |
| 4087 | // | | SubDelReq | |
| 4088 | // | |------------->| |
| 4089 | // | | | |
| 4090 | // | | SubDelFail | |
| 4091 | // | |<-------------| |
| 4092 | // | | | |
| 4093 | // |
| 4094 | //----------------------------------------------------------------------------- |
| 4095 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4096 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4097 | |
| 4098 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4099 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4100 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4101 | Counter{cSubReqToE2, 1}, |
| 4102 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4103 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4104 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4105 | Counter{cSubDelReqToE2, 1}, |
| 4106 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4107 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4108 | }) |
| 4109 | |
| 4110 | // Req |
| 4111 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4112 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4113 | |
| 4114 | // Del |
| 4115 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4116 | |
| 4117 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4118 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4119 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4120 | |
| 4121 | //Wait that subs is cleaned |
| 4122 | waitSubsCleanup(t, e2SubsId, 10) |
| 4123 | |
| 4124 | mainCtrl.VerifyCounterValues(t) |
| 4125 | } |
| 4126 | |
| 4127 | //----------------------------------------------------------------------------- |
| 4128 | // TestRESTSubReqAndSubDelOkSameAction |
| 4129 | // |
| 4130 | // stub stub |
| 4131 | // +-------+ +-------+ +---------+ +---------+ |
| 4132 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4133 | // +-------+ +-------+ +---------+ +---------+ |
| 4134 | // | | | | |
| 4135 | // | | RESTSubReq1 | | |
| 4136 | // | |---------------->| | |
| 4137 | // | | | | |
| 4138 | // | | RESTSubResp1 | | |
| 4139 | // | |<----------------| | |
| 4140 | // | | | | |
| 4141 | // | | | SubReq1 | |
| 4142 | // | | |------------->| |
| 4143 | // | | | SubResp1 | |
| 4144 | // | | |<-------------| |
| 4145 | // | | RESTNotif1 | | |
| 4146 | // | |<----------------| | |
| 4147 | // | | | | |
| 4148 | // | RESTSubReq2 | | |
| 4149 | // |------------------------------>| | |
| 4150 | // | | | | |
| 4151 | // | RESTSubResp2 | | |
| 4152 | // |<------------------------------| | |
| 4153 | // | | | | |
| 4154 | // | | RESTNotif2 | | |
| 4155 | // |<------------------------------| | |
| 4156 | // | | | | |
| 4157 | // | | RESTSubDelReq1 | | |
| 4158 | // | |---------------->| | |
| 4159 | // | | | | |
| 4160 | // | | RESTSubDelResp1 | | |
| 4161 | // | |<----------------| | |
| 4162 | // | | | | |
| 4163 | // | RESTSubDelReq2 | | |
| 4164 | // |------------------------------>| | |
| 4165 | // | | | | |
| 4166 | // | RESTSubDelResp2 | | |
| 4167 | // |<------------------------------| | |
| 4168 | // | | | | |
| 4169 | // | | | SubDelReq2 | |
| 4170 | // | | |------------->| |
| 4171 | // | | | | |
| 4172 | // | | | SubDelResp2 | |
| 4173 | // | | |<-------------| |
| 4174 | // | | | | |
| 4175 | // |
| 4176 | //----------------------------------------------------------------------------- |
| 4177 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4178 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4179 | |
| 4180 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4181 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4182 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4183 | Counter{cSubReqToE2, 1}, |
| 4184 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4185 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4186 | Counter{cMergedSubscriptions, 1}, |
| 4187 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4188 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4189 | Counter{cSubDelReqToE2, 1}, |
| 4190 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4191 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4192 | }) |
| 4193 | |
| 4194 | // Req1 |
| 4195 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4196 | |
| 4197 | //Subs Create |
| 4198 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4199 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4200 | |
| 4201 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4202 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4203 | params.SetMeid("RAN_NAME_1") |
| 4204 | |
| 4205 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4206 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4207 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4208 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4209 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4210 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4211 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4212 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4213 | |
| 4214 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4215 | |
| 4216 | // Del1 |
| 4217 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4218 | |
| 4219 | // Del2 |
| 4220 | deleteXapp2Subscription(t, &restSubId2) |
| 4221 | |
| 4222 | //Wait that subs is cleaned |
| 4223 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4224 | |
| 4225 | mainCtrl.VerifyCounterValues(t) |
| 4226 | } |
| 4227 | |
| 4228 | //----------------------------------------------------------------------------- |
| 4229 | // TestSubReqAndSubDelOkSameActionParallel |
| 4230 | // |
| 4231 | // stub stub stub |
| 4232 | // +-------+ +-------+ +---------+ +---------+ |
| 4233 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4234 | // +-------+ +-------+ +---------+ +---------+ |
| 4235 | // | | | | |
| 4236 | // | | | | |
| 4237 | // | | | | |
| 4238 | // | | SubReq1 | | |
| 4239 | // | |------------->| | |
| 4240 | // | | | | |
| 4241 | // | | | SubReq1 | |
| 4242 | // | | |------------->| |
| 4243 | // | SubReq2 | | |
| 4244 | // |--------------------------->| | |
| 4245 | // | | | SubResp1 | |
| 4246 | // | | |<-------------| |
| 4247 | // | | SubResp1 | | |
| 4248 | // | |<-------------| | |
| 4249 | // | | | SubReq2 | |
| 4250 | // | | |------------->| |
| 4251 | // | | | | |
| 4252 | // | | | SubResp2 | |
| 4253 | // | | |<-------------| |
| 4254 | // | SubResp2 | | |
| 4255 | // |<---------------------------| | |
| 4256 | // | | | | |
| 4257 | // | | SubDelReq 1 | | |
| 4258 | // | |------------->| | |
| 4259 | // | | | | |
| 4260 | // | | SubDelResp 1 | | |
| 4261 | // | |<-------------| | |
| 4262 | // | | | | |
| 4263 | // | SubDelReq 2 | | |
| 4264 | // |--------------------------->| | |
| 4265 | // | | | | |
| 4266 | // | | | SubDelReq 2 | |
| 4267 | // | | |------------->| |
| 4268 | // | | | | |
| 4269 | // | | | SubDelReq 2 | |
| 4270 | // | | |------------->| |
| 4271 | // | | | | |
| 4272 | // | SubDelResp 2 | | |
| 4273 | // |<---------------------------| | |
| 4274 | // |
| 4275 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4276 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4277 | |
| 4278 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4279 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4280 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4281 | Counter{cSubReqToE2, 2}, |
| 4282 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4283 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4284 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4285 | Counter{cSubDelReqToE2, 2}, |
| 4286 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4287 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4288 | }) |
| 4289 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4290 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4291 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4292 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4293 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4294 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4295 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4296 | |
| 4297 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4298 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4299 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4300 | |
| 4301 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4302 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4303 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4304 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4305 | |
| 4306 | // Del1 |
| 4307 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4308 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4309 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4310 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4311 | |
| 4312 | // Del2 |
| 4313 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4314 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4315 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4316 | |
| 4317 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4318 | |
| 4319 | mainCtrl.VerifyCounterValues(t) |
| 4320 | } |
| 4321 | |
| 4322 | //----------------------------------------------------------------------------- |
| 4323 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4324 | // |
| 4325 | // stub stub stub |
| 4326 | // +-------+ +-------+ +---------+ +---------+ |
| 4327 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4328 | // +-------+ +-------+ +---------+ +---------+ |
| 4329 | // | | | | |
| 4330 | // | | | | |
| 4331 | // | | | | |
| 4332 | // | | RESTSubReq1 | | |
| 4333 | // | |---------------->| | |
| 4334 | // | | | | |
| 4335 | // | | RESTSubResp1 | | |
| 4336 | // | |<----------------| | |
| 4337 | // | | | SubReq1 | |
| 4338 | // | | |------------->| |
| 4339 | // | RESTSubReq2 | | |
| 4340 | // |------------------------------>| | |
| 4341 | // | | | | |
| 4342 | // | RESTSubDelResp2 | | |
| 4343 | // |<------------------------------| | |
| 4344 | // | | | SubReq1 | |
| 4345 | // | | |------------->| |
| 4346 | // | | | | |
| 4347 | // | | | | |
| 4348 | // | | | SubDelReq | |
| 4349 | // | | |------------->| |
| 4350 | // | | | | |
| 4351 | // | | | SubDelResp | |
| 4352 | // | | |<-------------| |
| 4353 | // | | RESTNotif1 | | |
| 4354 | // | | unsuccess | | |
| 4355 | // | |<----------------| | |
| 4356 | // | RESTNotif2 | | |
| 4357 | // | | unsuccess | | |
| 4358 | // |<------------------------------| | |
| 4359 | // | | | | |
| 4360 | // | | RESTSubDelReq1 | | |
| 4361 | // | |---------------->| | |
| 4362 | // | | | | |
| 4363 | // | | RESTSubDelResp1 | | |
| 4364 | // | |<----------------| | |
| 4365 | // | | | | |
| 4366 | // | RESTSubDelReq2 | | |
| 4367 | // |------------------------------>| | |
| 4368 | // | | | | |
| 4369 | // | RESTSubDelResp2 | | |
| 4370 | // |<------------------------------| | |
| 4371 | // |
| 4372 | //----------------------------------------------------------------------------- |
| 4373 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4374 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4375 | |
| 4376 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4377 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4378 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4379 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4380 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4381 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | Counter{cSubDelReqToE2, 1}, |
| 4383 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4384 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4385 | }) |
| 4386 | |
| 4387 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4388 | |
| 4389 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4390 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4391 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4392 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4393 | |
| 4394 | // Req2 |
| 4395 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4396 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4397 | params2.SetMeid("RAN_NAME_1") |
| 4398 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4399 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4400 | |
| 4401 | //Req1 (retransmitted) |
| 4402 | e2termConn1.RecvSubsReq(t) |
| 4403 | |
| 4404 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4405 | |
| 4406 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4407 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4408 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4409 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4410 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4411 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4412 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4413 | |
| 4414 | // Del1 |
| 4415 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4416 | |
| 4417 | // Del2 |
| 4418 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4419 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4420 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4421 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4422 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4423 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4424 | |
| 4425 | mainCtrl.VerifyCounterValues(t) |
| 4426 | } |
| 4427 | |
| 4428 | //----------------------------------------------------------------------------- |
| 4429 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4430 | // |
| 4431 | // stub stub stub |
| 4432 | // +-------+ +-------+ +---------+ +---------+ |
| 4433 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4434 | // +-------+ +-------+ +---------+ +---------+ |
| 4435 | // | | | | |
| 4436 | // | | | | |
| 4437 | // | | | | |
| 4438 | // | | RESTSubReq1 | | |
| 4439 | // | |---------------->| | |
| 4440 | // | | | | |
| 4441 | // | | RESTSubResp1 | | |
| 4442 | // | |<----------------| | |
| 4443 | // | | | SubReq1 | |
| 4444 | // | | |------------->| |
| 4445 | // | RESTSubReq2 | | |
| 4446 | // |------------------------------>| | |
| 4447 | // | | | | |
| 4448 | // | RESTSubDelResp2 | | |
| 4449 | // |<------------------------------| | |
| 4450 | // | | | SubFail1 | |
| 4451 | // | | |<-------------| |
| 4452 | // | | | | |
| 4453 | // | | RESTNotif1 | | |
| 4454 | // | | unsuccess | | |
| 4455 | // | |<----------------| | |
| 4456 | // | RESTNotif2 | | |
| 4457 | // | | unsuccess | | |
| 4458 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4459 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame^] | 4460 | // | | 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] | 4461 | // | |---------------->| | |
| 4462 | // | | | | |
| 4463 | // | | RESTSubDelResp1 | | |
| 4464 | // | |<----------------| | |
| 4465 | // | | | | |
| 4466 | // | RESTSubDelReq2 | | |
| 4467 | // |------------------------------>| | |
| 4468 | // | | | | |
| 4469 | // | RESTSubDelResp2 | | |
| 4470 | // |<------------------------------| | |
| 4471 | // |
| 4472 | //----------------------------------------------------------------------------- |
| 4473 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4474 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4475 | |
| 4476 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4477 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4478 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4479 | Counter{cSubReqToE2, 1}, |
| 4480 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4481 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4482 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4483 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4484 | }) |
| 4485 | |
| 4486 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4487 | |
| 4488 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4489 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4490 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4491 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4492 | |
| 4493 | // Req2 |
| 4494 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4495 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4496 | params2.SetMeid("RAN_NAME_1") |
| 4497 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4498 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4499 | |
| 4500 | // E2t: send SubsFail (first) |
| 4501 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4502 | fparams1.Set(crereq1) |
| 4503 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4504 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4505 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4506 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4507 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4508 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4509 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4510 | |
| 4511 | // Del1 |
| 4512 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4513 | |
| 4514 | // Del2 |
| 4515 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4516 | |
| 4517 | //Wait that subs is cleaned |
| 4518 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4519 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4520 | |
| 4521 | mainCtrl.VerifyCounterValues(t) |
| 4522 | } |
| 4523 | |
| 4524 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4525 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4526 | |
| 4527 | // Init counter check |
| 4528 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4529 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4530 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4531 | Counter{cSubReqToE2, 1}, |
| 4532 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4533 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4534 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4535 | Counter{cSubDelReqToE2, 1}, |
| 4536 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4537 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4538 | }) |
| 4539 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4540 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4541 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4542 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | |
| 4544 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4545 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4546 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4547 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4548 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | |
| 4550 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4551 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4552 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4553 | |
| 4554 | // Wait that subs is cleaned |
| 4555 | waitSubsCleanup(t, e2SubsId, 10) |
| 4556 | mainCtrl.VerifyCounterValues(t) |
| 4557 | } |
| 4558 | |
| 4559 | //----------------------------------------------------------------------------- |
| 4560 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4561 | // |
| 4562 | // stub stub |
| 4563 | // +-------+ +---------+ +---------+ |
| 4564 | // | xapp | | submgr | | e2term | |
| 4565 | // +-------+ +---------+ +---------+ |
| 4566 | // | | | |
| 4567 | // | RESTSubReq | | |
| 4568 | // |---------------->| | |
| 4569 | // | | | |
| 4570 | // | RESTSubResp | | |
| 4571 | // |<----------------| | |
| 4572 | // | | SubReq | |
| 4573 | // | |------------->| |
| 4574 | // | | | |
| 4575 | // | | SubResp | |
| 4576 | // | |<-------------| |
| 4577 | // | | | |
| 4578 | // | RESTNotif | | |
| 4579 | // |<----------------| | |
| 4580 | // | | | |
| 4581 | // | RESTSubReq | | |
| 4582 | // |---------------->| | |
| 4583 | // | | | |
| 4584 | // | RESTSubResp | | |
| 4585 | // |<----------------| | |
| 4586 | // | | SubReq | |
| 4587 | // | |------------->| |
| 4588 | // | | | |
| 4589 | // | | SubResp | |
| 4590 | // | |<-------------| |
| 4591 | // | | | |
| 4592 | // | RESTNotif | | |
| 4593 | // |<----------------| | |
| 4594 | // | | | |
| 4595 | // | RESTSubDelReq | | |
| 4596 | // |---------------->| | |
| 4597 | // | | | |
| 4598 | // | | SubDelReq | |
| 4599 | // | |------------->| |
| 4600 | // | | | |
| 4601 | // | | SubDelResp | |
| 4602 | // | |<-------------| |
| 4603 | // | | | |
| 4604 | // | RESTSubDelResp | | |
| 4605 | // |<----------------| | |
| 4606 | // |
| 4607 | //----------------------------------------------------------------------------- |
| 4608 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4609 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4610 | |
| 4611 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4612 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4613 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4614 | Counter{cSubReqToE2, 2}, |
| 4615 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4616 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4617 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4618 | Counter{cSubDelReqToE2, 1}, |
| 4619 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4620 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4621 | }) |
| 4622 | |
| 4623 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4624 | const e2Timeout int64 = 1 |
| 4625 | const e2RetryCount int64 = 0 |
| 4626 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4627 | |
| 4628 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4629 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4630 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4631 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4632 | |
| 4633 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4634 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4635 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4636 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4637 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4638 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4639 | params.SetTimeToWait("w200ms") |
| 4640 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4641 | |
| 4642 | // Del |
| 4643 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4644 | |
| 4645 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4646 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4647 | |
| 4648 | // Wait that subs is cleaned |
| 4649 | waitSubsCleanup(t, e2SubsId, 10) |
| 4650 | mainCtrl.VerifyCounterValues(t) |
| 4651 | } |
| 4652 | |
| 4653 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4654 | // TestRESTSubReqPolicyChangeNOk |
| 4655 | // |
| 4656 | // stub stub |
| 4657 | // +-------+ +---------+ +---------+ |
| 4658 | // | xapp | | submgr | | e2term | |
| 4659 | // +-------+ +---------+ +---------+ |
| 4660 | // | | | |
| 4661 | // | RESTSubReq | | |
| 4662 | // |---------------->| | |
| 4663 | // | | | |
| 4664 | // | RESTSubResp | | |
| 4665 | // |<----------------| | |
| 4666 | // | | SubReq | |
| 4667 | // | |------------->| |
| 4668 | // | | | |
| 4669 | // | | SubResp | |
| 4670 | // | |<-------------| |
| 4671 | // | | | |
| 4672 | // | RESTNotif | | |
| 4673 | // |<----------------| | |
| 4674 | // | | | |
| 4675 | // | RESTSubReq | | |
| 4676 | // |---------------->| | |
| 4677 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4678 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4679 | // | | | |
| 4680 | // | RESTSubDelReq | | |
| 4681 | // |---------------->| | |
| 4682 | // | | | |
| 4683 | // | | SubDelReq | |
| 4684 | // | |------------->| |
| 4685 | // | | | |
| 4686 | // | | SubDelResp | |
| 4687 | // | |<-------------| |
| 4688 | // | | | |
| 4689 | // | RESTSubDelResp | | |
| 4690 | // |<----------------| | |
| 4691 | // |
| 4692 | //----------------------------------------------------------------------------- |
| 4693 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4694 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4695 | |
| 4696 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4697 | Counter{cRestSubReqFromXapp, 2}, |
| 4698 | Counter{cRestSubRespToXapp, 1}, |
| 4699 | Counter{cSubReqToE2, 1}, |
| 4700 | Counter{cSubRespFromE2, 1}, |
| 4701 | Counter{cRestSubNotifToXapp, 1}, |
| 4702 | Counter{cRestSubFailToXapp, 1}, |
| 4703 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4704 | Counter{cSubDelReqToE2, 1}, |
| 4705 | Counter{cSubDelRespFromE2, 1}, |
| 4706 | Counter{cRestSubDelRespToXapp, 1}, |
| 4707 | }) |
| 4708 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4709 | // Req |
| 4710 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4711 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4712 | |
| 4713 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4714 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4715 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4716 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4717 | params.SetSubscriptionID(&restSubIdUpd) |
| 4718 | params.SetTimeToWait("w200ms") |
| 4719 | |
| 4720 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4721 | assert.Equal(t, restSubId2, "") |
| 4722 | |
| 4723 | // Del |
| 4724 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4725 | |
| 4726 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4727 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4728 | |
| 4729 | // Wait that subs is cleaned |
| 4730 | waitSubsCleanup(t, e2SubsId, 10) |
| 4731 | mainCtrl.VerifyCounterValues(t) |
| 4732 | } |
| 4733 | |
| 4734 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4735 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4736 | // |
| 4737 | // stub stub stub |
| 4738 | // +-------+ +---------+ +---------+ +---------+ |
| 4739 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4740 | // +-------+ +---------+ +---------+ +---------+ |
| 4741 | // | | | | |
| 4742 | // | | | | |
| 4743 | // | | | | |
| 4744 | // | RESTSubReq1 | | | |
| 4745 | // |---------------->| | | |
| 4746 | // | | | | |
| 4747 | // | RESTSubResp1 | | | |
| 4748 | // |<----------------| | | |
| 4749 | // | | SubReq1 | | |
| 4750 | // | |------------->| | |
| 4751 | // | | | | |
| 4752 | // | RESTSubReq2 | | | |
| 4753 | // |---------------->| | | |
| 4754 | // | | | | |
| 4755 | // | RESTSubResp2 | | | |
| 4756 | // |<----------------| | | |
| 4757 | // | | SubReq2 | | |
| 4758 | // | |---------------------------->| |
| 4759 | // | | | | |
| 4760 | // | | SubResp1 | | |
| 4761 | // | |<-------------| | |
| 4762 | // | RESTNotif1 | | | |
| 4763 | // |<----------------| | | |
| 4764 | // | | SubResp2 | | |
| 4765 | // | |<----------------------------| |
| 4766 | // | RESTNotif2 | | | |
| 4767 | // |<----------------| | | |
| 4768 | // | | | | |
| 4769 | // | [SUBS 1 DELETE] | | |
| 4770 | // | | | | |
| 4771 | // | [SUBS 2 DELETE] | | |
| 4772 | // | | | | |
| 4773 | // |
| 4774 | //----------------------------------------------------------------------------- |
| 4775 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4776 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4777 | |
| 4778 | // Init counter check |
| 4779 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4780 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4781 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4782 | Counter{cSubReqToE2, 2}, |
| 4783 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4784 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4785 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4786 | Counter{cSubDelReqToE2, 2}, |
| 4787 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4788 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4789 | }) |
| 4790 | |
| 4791 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4792 | |
| 4793 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4794 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4795 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4796 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4797 | |
| 4798 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4799 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4800 | params.SetMeid("RAN_NAME_11") |
| 4801 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4802 | // would not work as notification would not be received |
| 4803 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4804 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4805 | |
| 4806 | // Resp1 |
| 4807 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4808 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4809 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4810 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4811 | |
| 4812 | // Resp2 |
| 4813 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4814 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4815 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4816 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4817 | |
| 4818 | // Delete1 |
| 4819 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4820 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4821 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4822 | |
| 4823 | // Wait that subs is cleaned |
| 4824 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4825 | |
| 4826 | // Delete2 |
| 4827 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4828 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4829 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4830 | |
| 4831 | // Wait that subs is cleaned |
| 4832 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4833 | |
| 4834 | mainCtrl.VerifyCounterValues(t) |
| 4835 | } |
| 4836 | |
| 4837 | //----------------------------------------------------------------------------- |
| 4838 | // TestRESTSubReqAsn1EncodeFail |
| 4839 | // |
| 4840 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4841 | // stub stub |
| 4842 | // +-------+ +---------+ +---------+ |
| 4843 | // | xapp | | submgr | | e2term | |
| 4844 | // +-------+ +---------+ +---------+ |
| 4845 | // | | | |
| 4846 | // | RESTSubReq | | |
| 4847 | // |---------------->| | |
| 4848 | // | | | |
| 4849 | // | RESTSubResp | | |
| 4850 | // |<----------------| | |
| 4851 | // | RESTSubDelReq | | |
| 4852 | // |---------------->| | |
| 4853 | // | RESTSubDelResp | | |
| 4854 | // | unsuccess | | |
| 4855 | // |<----------------| | |
| 4856 | // | | | |
| 4857 | // |
| 4858 | //----------------------------------------------------------------------------- |
| 4859 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4860 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4861 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4862 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4863 | |
| 4864 | } |
| 4865 | |
| 4866 | //----------------------------------------------------------------------------- |
| 4867 | // TestRESTSubReqInsertAndSubDelOk |
| 4868 | // |
| 4869 | // stub stub |
| 4870 | // +-------+ +---------+ +---------+ |
| 4871 | // | xapp | | submgr | | e2term | |
| 4872 | // +-------+ +---------+ +---------+ |
| 4873 | // | | | |
| 4874 | // | RestSubReq | | |
| 4875 | // |---------------->| | |
| 4876 | // | | | |
| 4877 | // | RESTSubResp | | |
| 4878 | // |<----------------| | |
| 4879 | // | | | |
| 4880 | // | | SubReq | |
| 4881 | // | |------------->| |
| 4882 | // | | | |
| 4883 | // | | SubResp | |
| 4884 | // | |<-------------| |
| 4885 | // | RESTNotif | | |
| 4886 | // |<----------------| | |
| 4887 | // | ... | ... | |
| 4888 | // | | | |
| 4889 | // | RESTSubDelReq | | |
| 4890 | // |---------------->| | |
| 4891 | // | | | |
| 4892 | // | | SubDelReq | |
| 4893 | // | |------------->| |
| 4894 | // | | | |
| 4895 | // | | SubDelResp | |
| 4896 | // | |<-------------| |
| 4897 | // | | | |
| 4898 | // | RESTSubDelResp| | |
| 4899 | // |<----------------| | |
| 4900 | // |
| 4901 | //----------------------------------------------------------------------------- |
| 4902 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4903 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4904 | |
| 4905 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4906 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4907 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4908 | Counter{cSubReqToE2, 1}, |
| 4909 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4910 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4911 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4912 | Counter{cSubDelReqToE2, 1}, |
| 4913 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4914 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4915 | }) |
| 4916 | |
| 4917 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4918 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4919 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4920 | params.SetSubActionTypes("insert") |
| 4921 | |
| 4922 | // Req |
| 4923 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4924 | |
| 4925 | // Del |
| 4926 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4927 | |
| 4928 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4929 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4930 | |
| 4931 | // Wait that subs is cleaned |
| 4932 | waitSubsCleanup(t, e2SubsId, 10) |
| 4933 | mainCtrl.VerifyCounterValues(t) |
| 4934 | } |
| 4935 | |
| 4936 | //----------------------------------------------------------------------------- |
| 4937 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4938 | // |
| 4939 | // stub stub |
| 4940 | // +-------+ +---------+ +---------+ |
| 4941 | // | xapp | | submgr | | e2term | |
| 4942 | // +-------+ +---------+ +---------+ |
| 4943 | // | | | |
| 4944 | // | RESTSubReq | | |
| 4945 | // |------------->| | |
| 4946 | // | | | |
| 4947 | // | | SubReq | |
| 4948 | // | |------------->| |
| 4949 | // | | | |
| 4950 | // | | SubResp | |
| 4951 | // | <----| |
| 4952 | // | | |
| 4953 | // | Submgr restart | |
| 4954 | // | | |
| 4955 | // | | | |
| 4956 | // | | SubDelReq | |
| 4957 | // | |------------->| |
| 4958 | // | | | |
| 4959 | // | | SubDelResp | |
| 4960 | // | |<-------------| |
| 4961 | // | | | |
| 4962 | // |
| 4963 | //----------------------------------------------------------------------------- |
| 4964 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4965 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4966 | |
| 4967 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4968 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4969 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4970 | Counter{cSubReqToE2, 1}, |
| 4971 | Counter{cSubDelReqFromXapp, 1}, |
| 4972 | Counter{cSubDelReqToE2, 1}, |
| 4973 | Counter{cSubDelRespFromE2, 1}, |
| 4974 | }) |
| 4975 | |
| 4976 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4977 | |
| 4978 | // Remove possible existing subscription |
| 4979 | mainCtrl.removeExistingSubscriptions(t) |
| 4980 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4981 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4982 | |
| 4983 | //Req |
| 4984 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4985 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4986 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4987 | |
| 4988 | e2termConn1.RecvSubsReq(t) |
| 4989 | |
| 4990 | mainCtrl.SetResetTestFlag(t, false) |
| 4991 | |
| 4992 | mainCtrl.SimulateRestart(t) |
| 4993 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4994 | |
| 4995 | //Del |
| 4996 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4997 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4998 | |
| 4999 | xappConn1.TestMsgChanEmpty(t) |
| 5000 | xappConn2.TestMsgChanEmpty(t) |
| 5001 | e2termConn1.TestMsgChanEmpty(t) |
| 5002 | mainCtrl.wait_registry_empty(t, 10) |
| 5003 | |
| 5004 | mainCtrl.VerifyCounterValues(t) |
| 5005 | } |
| 5006 | |
| 5007 | //----------------------------------------------------------------------------- |
| 5008 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5009 | // |
| 5010 | // stub stub |
| 5011 | // +-------+ +---------+ +---------+ |
| 5012 | // | xapp | | submgr | | e2term | |
| 5013 | // +-------+ +---------+ +---------+ |
| 5014 | // | | | |
| 5015 | // | RESTSubReq | | |
| 5016 | // |---------------->| | |
| 5017 | // | | | |
| 5018 | // | RESTSubResp | | |
| 5019 | // |<----------------| | |
| 5020 | // | | SubReq | |
| 5021 | // | |------------->| |
| 5022 | // | | | |
| 5023 | // | | SubResp | |
| 5024 | // | |<-------------| |
| 5025 | // | | | |
| 5026 | // | RESTNotif | | |
| 5027 | // |<----------------| | |
| 5028 | // | | | |
| 5029 | // | | |
| 5030 | // | Submgr restart | |
| 5031 | // | | | |
| 5032 | // | RESTSubDelReq | | |
| 5033 | // |---------------->| | |
| 5034 | // | | | |
| 5035 | // | | SubDelReq | |
| 5036 | // | |------------->| |
| 5037 | // | | | |
| 5038 | // | | SubDelResp | |
| 5039 | // | |<-------------| |
| 5040 | // | | | |
| 5041 | // | RESTSubDelResp | | |
| 5042 | // |<----------------| | |
| 5043 | // |
| 5044 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5045 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5046 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5047 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5048 | |
| 5049 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5050 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5051 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5052 | Counter{cSubReqToE2, 1}, |
| 5053 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5054 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5055 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5056 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5057 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5058 | }) |
| 5059 | |
| 5060 | // Remove possible existing subscription |
| 5061 | mainCtrl.removeExistingSubscriptions(t) |
| 5062 | |
| 5063 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5064 | |
| 5065 | // Create subscription |
| 5066 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5067 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5068 | |
| 5069 | // Check subscription |
| 5070 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5071 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5072 | mainCtrl.SimulateRestart(t) |
| 5073 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5074 | |
| 5075 | // Check subscription |
| 5076 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5077 | |
| 5078 | // Delete subscription |
| 5079 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5080 | |
| 5081 | //Wait that subs is cleaned |
| 5082 | waitSubsCleanup(t, e2SubsId, 10) |
| 5083 | |
| 5084 | mainCtrl.VerifyCounterValues(t) |
| 5085 | } |
| 5086 | |
| 5087 | //----------------------------------------------------------------------------- |
| 5088 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5089 | // |
| 5090 | // stub stub |
| 5091 | // +-------+ +-------+ +---------+ +---------+ |
| 5092 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5093 | // +-------+ +-------+ +---------+ +---------+ |
| 5094 | // | | | | |
| 5095 | // | | RESTSubReq1 | | |
| 5096 | // | |---------------->| | |
| 5097 | // | | | | |
| 5098 | // | | RESTSubResp1 | | |
| 5099 | // | |<----------------| | |
| 5100 | // | | | | |
| 5101 | // | | | SubReq1 | |
| 5102 | // | | |------------->| |
| 5103 | // | | | SubResp1 | |
| 5104 | // | | |<-------------| |
| 5105 | // | | RESTNotif1 | | |
| 5106 | // | |<----------------| | |
| 5107 | // | | | | |
| 5108 | // | RESTSubReq2 | | |
| 5109 | // |------------------------------>| | |
| 5110 | // | | | | |
| 5111 | // | RESTSubResp2 | | |
| 5112 | // |<------------------------------| | |
| 5113 | // | | | | |
| 5114 | // | | RESTNotif2 | | |
| 5115 | // |<------------------------------| | |
| 5116 | // | | | | |
| 5117 | // | | Submgr restart | |
| 5118 | // | | | | |
| 5119 | // | | RESTSubDelReq1 | | |
| 5120 | // | |---------------->| | |
| 5121 | // | | | | |
| 5122 | // | | RESTSubDelResp1 | | |
| 5123 | // | |<----------------| | |
| 5124 | // | | | | |
| 5125 | // | | Submgr restart | |
| 5126 | // | | | | |
| 5127 | // | RESTSubDelReq2 | | |
| 5128 | // |------------------------------>| | |
| 5129 | // | | | | |
| 5130 | // | RESTSubDelResp2 | | |
| 5131 | // |<------------------------------| | |
| 5132 | // | | | | |
| 5133 | // | | | SubDelReq2 | |
| 5134 | // | | |------------->| |
| 5135 | // | | | | |
| 5136 | // | | | SubDelResp2 | |
| 5137 | // | | |<-------------| |
| 5138 | // | | | | |
| 5139 | // |
| 5140 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5141 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5142 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5143 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5144 | |
| 5145 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5146 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5147 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5148 | Counter{cSubReqToE2, 1}, |
| 5149 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5150 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5151 | Counter{cMergedSubscriptions, 1}, |
| 5152 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5153 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5154 | Counter{cSubDelReqToE2, 1}, |
| 5155 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5156 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5157 | }) |
| 5158 | |
| 5159 | // Remove possible existing subscription |
| 5160 | mainCtrl.removeExistingSubscriptions(t) |
| 5161 | |
| 5162 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5163 | |
| 5164 | // Create subscription 1 |
| 5165 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5166 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5167 | |
| 5168 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5169 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5170 | params.SetMeid("RAN_NAME_1") |
| 5171 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5172 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5173 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5174 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5175 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5176 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5177 | |
| 5178 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5179 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5180 | mainCtrl.SimulateRestart(t) |
| 5181 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5182 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5183 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 5184 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5185 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5186 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5187 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5188 | mainCtrl.SimulateRestart(t) |
| 5189 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5190 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5191 | |
| 5192 | // Delete subscription 2 |
| 5193 | deleteXapp2Subscription(t, &restSubId2) |
| 5194 | |
| 5195 | //Wait that subs is cleaned |
| 5196 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5197 | |
| 5198 | mainCtrl.VerifyCounterValues(t) |
| 5199 | } |
| 5200 | |
| 5201 | //----------------------------------------------------------------------------- |
| 5202 | // TestRESTReportSubReqAndSubDelOk |
| 5203 | // |
| 5204 | // stub stub |
| 5205 | // +-------+ +---------+ +---------+ |
| 5206 | // | xapp | | submgr | | e2term | |
| 5207 | // +-------+ +---------+ +---------+ |
| 5208 | // | | | |
| 5209 | // | RestSubReq | | |
| 5210 | // |---------------->| | |
| 5211 | // | | | |
| 5212 | // | RESTSubResp | | |
| 5213 | // |<----------------| | |
| 5214 | // | | | |
| 5215 | // | | SubReq | |
| 5216 | // | |------------->| |
| 5217 | // | | | |
| 5218 | // | | SubResp | |
| 5219 | // | |<-------------| |
| 5220 | // | RESTNotif | | |
| 5221 | // |<----------------| | |
| 5222 | // | | SubReq | |
| 5223 | // | |------------->| |
| 5224 | // | | | |
| 5225 | // | | SubResp | |
| 5226 | // | |<-------------| |
| 5227 | // | RESTNotif | | |
| 5228 | // |<----------------| | |
| 5229 | // | ... | ... | |
| 5230 | // | | | |
| 5231 | // | | | |
| 5232 | // | RESTSubDelReq | | |
| 5233 | // |---------------->| | |
| 5234 | // | | | |
| 5235 | // | | SubDelReq | |
| 5236 | // | |------------->| |
| 5237 | // | | | |
| 5238 | // | | SubDelResp | |
| 5239 | // | |<-------------| |
| 5240 | // | | | |
| 5241 | // | RESTSubDelResp| | |
| 5242 | // |<----------------| | |
| 5243 | // |
| 5244 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5245 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5246 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5247 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5248 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5249 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5250 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5251 | } |
| 5252 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5253 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5254 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5255 | |
| 5256 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5257 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5258 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5259 | |
| 5260 | var e2SubsId []uint32 |
| 5261 | for i := 0; i < subReqCount; i++ { |
| 5262 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5263 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5264 | |
| 5265 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5266 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5267 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5268 | e2SubsId = append(e2SubsId, instanceId) |
| 5269 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5270 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5271 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5272 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5273 | |
| 5274 | } |
| 5275 | |
| 5276 | // Del |
| 5277 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5278 | |
| 5279 | for i := 0; i < subReqCount; i++ { |
| 5280 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5281 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5282 | } |
| 5283 | |
| 5284 | // Wait that subs is cleaned |
| 5285 | for i := 0; i < subReqCount; i++ { |
| 5286 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5287 | } |
| 5288 | |
| 5289 | xappConn1.TestMsgChanEmpty(t) |
| 5290 | e2termConn1.TestMsgChanEmpty(t) |
| 5291 | mainCtrl.wait_registry_empty(t, 10) |
| 5292 | } |
| 5293 | |
| 5294 | /* |
| 5295 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 5296 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5297 | |
| 5298 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5299 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5300 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5301 | |
| 5302 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5303 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5304 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5305 | } |
| 5306 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5307 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5308 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5309 | |
| 5310 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5311 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5312 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5313 | |
| 5314 | var e2SubsId []uint32 |
| 5315 | for i := 0; i < subReqCount; i++ { |
| 5316 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5317 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5318 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5319 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5320 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5321 | e2SubsId = append(e2SubsId, instanceId) |
| 5322 | } |
| 5323 | |
| 5324 | // Del |
| 5325 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5326 | |
| 5327 | for i := 0; i < subReqCount; i++ { |
| 5328 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5329 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5330 | } |
| 5331 | |
| 5332 | // Wait that subs is cleaned |
| 5333 | for i := 0; i < subReqCount; i++ { |
| 5334 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5335 | } |
| 5336 | xappConn1.TestMsgChanEmpty(t) |
| 5337 | e2termConn1.TestMsgChanEmpty(t) |
| 5338 | mainCtrl.wait_registry_empty(t, 10) |
| 5339 | } |
| 5340 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5341 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5342 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5343 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5344 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5345 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5346 | Counter{cSubReqToE2, 2}, |
| 5347 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5348 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5349 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5350 | Counter{cSubDelReqToE2, 2}, |
| 5351 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5352 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5353 | }) |
| 5354 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5355 | const subReqCount int = 2 |
| 5356 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5357 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5358 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5359 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5360 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5361 | |
| 5362 | assert.Equal(t, len(e2SubsIds), 2) |
| 5363 | |
| 5364 | // Del |
| 5365 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5366 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5367 | |
| 5368 | xappConn1.TestMsgChanEmpty(t) |
| 5369 | e2termConn1.TestMsgChanEmpty(t) |
| 5370 | mainCtrl.wait_registry_empty(t, 10) |
| 5371 | |
| 5372 | mainCtrl.VerifyCounterValues(t) |
| 5373 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5374 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5375 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5376 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5377 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5378 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5379 | Counter{cSubReqToE2, 19}, |
| 5380 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5381 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5382 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5383 | Counter{cSubDelReqToE2, 19}, |
| 5384 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5385 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5386 | }) |
| 5387 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5388 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5389 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5390 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5391 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5392 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5393 | |
| 5394 | assert.Equal(t, len(e2SubsIds), 19) |
| 5395 | |
| 5396 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5397 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5398 | |
| 5399 | xappConn1.TestMsgChanEmpty(t) |
| 5400 | e2termConn1.TestMsgChanEmpty(t) |
| 5401 | mainCtrl.wait_registry_empty(t, 10) |
| 5402 | |
| 5403 | mainCtrl.VerifyCounterValues(t) |
| 5404 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5405 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5406 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5407 | |
| 5408 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5409 | |
| 5410 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5411 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5412 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5413 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5414 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5415 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5416 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5417 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5418 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5419 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5420 | }) |
| 5421 | |
| 5422 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5423 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5424 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5425 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5426 | |
| 5427 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5428 | |
| 5429 | // Del |
| 5430 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5431 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5432 | |
| 5433 | xappConn1.TestMsgChanEmpty(t) |
| 5434 | e2termConn1.TestMsgChanEmpty(t) |
| 5435 | mainCtrl.wait_registry_empty(t, 10) |
| 5436 | |
| 5437 | mainCtrl.VerifyCounterValues(t) |
| 5438 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5439 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5440 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5441 | |
| 5442 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5443 | |
| 5444 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5445 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5446 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5447 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5448 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5449 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5450 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5451 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5452 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5453 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5454 | }) |
| 5455 | |
| 5456 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5457 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5458 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5459 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5460 | |
| 5461 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5462 | |
| 5463 | // Del |
| 5464 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5465 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5466 | |
| 5467 | xappConn1.TestMsgChanEmpty(t) |
| 5468 | e2termConn1.TestMsgChanEmpty(t) |
| 5469 | mainCtrl.wait_registry_empty(t, 10) |
| 5470 | |
| 5471 | mainCtrl.VerifyCounterValues(t) |
| 5472 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5473 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5474 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5475 | |
| 5476 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5477 | |
| 5478 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5479 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5480 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5481 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5482 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5483 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5484 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5485 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5486 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5487 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5488 | }) |
| 5489 | |
| 5490 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5491 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5492 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5493 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5494 | |
| 5495 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5496 | |
| 5497 | // Del |
| 5498 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5499 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5500 | |
| 5501 | xappConn1.TestMsgChanEmpty(t) |
| 5502 | e2termConn1.TestMsgChanEmpty(t) |
| 5503 | mainCtrl.wait_registry_empty(t, 10) |
| 5504 | |
| 5505 | mainCtrl.VerifyCounterValues(t) |
| 5506 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5507 | |
| 5508 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5509 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5510 | |
| 5511 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5512 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5513 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5514 | Counter{cSubReqToE2, 2}, |
| 5515 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5516 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5517 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5518 | Counter{cSubDelReqToE2, 2}, |
| 5519 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5520 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5521 | }) |
| 5522 | |
| 5523 | // Req1 |
| 5524 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5525 | |
| 5526 | //Subs Create |
| 5527 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5528 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5529 | |
| 5530 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5531 | |
| 5532 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5533 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5534 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5535 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5536 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5537 | |
| 5538 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5539 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5540 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5541 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5542 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5543 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5544 | |
| 5545 | deleteXapp1Subscription(t, &restSubId1) |
| 5546 | deleteXapp2Subscription(t, &restSubId2) |
| 5547 | |
| 5548 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5549 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5550 | |
| 5551 | mainCtrl.VerifyCounterValues(t) |
| 5552 | |
| 5553 | } |
| 5554 | |
| 5555 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5556 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5557 | |
| 5558 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5559 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5560 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5561 | Counter{cSubReqToE2, 2}, |
| 5562 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5563 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5564 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5565 | Counter{cSubDelReqToE2, 2}, |
| 5566 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5567 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5568 | }) |
| 5569 | |
| 5570 | // Req1 |
| 5571 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5572 | |
| 5573 | //Subs Create |
| 5574 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5575 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5576 | |
| 5577 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5578 | |
| 5579 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5580 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5581 | params.SetMeid("RAN_NAME_1") |
| 5582 | |
| 5583 | actionId := int64(1) |
| 5584 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5585 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5586 | subsequestActionType := "continue" |
| 5587 | timeToWait := "w10ms" |
| 5588 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5589 | |
| 5590 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5591 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5592 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5593 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5594 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5595 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5596 | |
| 5597 | deleteXapp1Subscription(t, &restSubId1) |
| 5598 | deleteXapp2Subscription(t, &restSubId2) |
| 5599 | |
| 5600 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5601 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5602 | |
| 5603 | mainCtrl.VerifyCounterValues(t) |
| 5604 | |
| 5605 | } |
| 5606 | |
| 5607 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5608 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5609 | |
| 5610 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5611 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5612 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5613 | Counter{cSubReqToE2, 2}, |
| 5614 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5615 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5616 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5617 | Counter{cSubDelReqToE2, 2}, |
| 5618 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5619 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5620 | }) |
| 5621 | |
| 5622 | // Req1 |
| 5623 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5624 | |
| 5625 | //Subs Create |
| 5626 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5627 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5628 | |
| 5629 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5630 | |
| 5631 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5632 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5633 | params.SetMeid("RAN_NAME_1") |
| 5634 | params.SetSubActionIDs(int64(2)) |
| 5635 | |
| 5636 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5637 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5638 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5639 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5640 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5641 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5642 | |
| 5643 | deleteXapp1Subscription(t, &restSubId1) |
| 5644 | deleteXapp2Subscription(t, &restSubId2) |
| 5645 | |
| 5646 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5647 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5648 | |
| 5649 | mainCtrl.VerifyCounterValues(t) |
| 5650 | |
| 5651 | } |
| 5652 | |
| 5653 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5654 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5655 | |
| 5656 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5657 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5658 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5659 | Counter{cSubReqToE2, 2}, |
| 5660 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5661 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5662 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5663 | Counter{cSubDelReqToE2, 2}, |
| 5664 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5665 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5666 | }) |
| 5667 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5668 | const e2Timeout int64 = 2 |
| 5669 | const e2RetryCount int64 = 2 |
| 5670 | const routingNeeded bool = true |
| 5671 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5672 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5673 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5674 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5675 | |
| 5676 | //Subs Create |
| 5677 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5678 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5679 | |
| 5680 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5681 | |
| 5682 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5683 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5684 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5685 | params.SetMeid("RAN_NAME_1") |
| 5686 | |
| 5687 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5688 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5689 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5690 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5691 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5692 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5693 | |
| 5694 | deleteXapp1Subscription(t, &restSubId1) |
| 5695 | deleteXapp2Subscription(t, &restSubId2) |
| 5696 | |
| 5697 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5698 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5699 | |
| 5700 | mainCtrl.VerifyCounterValues(t) |
| 5701 | |
| 5702 | } |
| 5703 | |
| 5704 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5705 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5706 | |
| 5707 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5708 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5709 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5710 | Counter{cSubReqToE2, 2}, |
| 5711 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5712 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5713 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5714 | Counter{cSubDelReqToE2, 2}, |
| 5715 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5716 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5717 | }) |
| 5718 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5719 | const e2Timeout int64 = 2 |
| 5720 | const e2RetryCount int64 = 2 |
| 5721 | const routingNeeded bool = true |
| 5722 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5723 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5724 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5725 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5726 | |
| 5727 | //Subs Create |
| 5728 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5729 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5730 | |
| 5731 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5732 | |
| 5733 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5734 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5735 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5736 | params.SetMeid("RAN_NAME_1") |
| 5737 | |
| 5738 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5739 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5740 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5741 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5742 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5743 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5744 | |
| 5745 | deleteXapp1Subscription(t, &restSubId1) |
| 5746 | deleteXapp2Subscription(t, &restSubId2) |
| 5747 | |
| 5748 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5749 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5750 | |
| 5751 | mainCtrl.VerifyCounterValues(t) |
| 5752 | |
| 5753 | } |
| 5754 | |
| 5755 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5756 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5757 | |
| 5758 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5759 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5760 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5761 | Counter{cSubReqToE2, 2}, |
| 5762 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5763 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5764 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5765 | Counter{cSubDelReqToE2, 2}, |
| 5766 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5767 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5768 | }) |
| 5769 | |
| 5770 | // Req1 |
| 5771 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5772 | |
| 5773 | //Subs Create |
| 5774 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5775 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5776 | |
| 5777 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5778 | |
| 5779 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5780 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5781 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5782 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5783 | params.SetSubActionDefinition(actionDefinition) |
| 5784 | |
| 5785 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5786 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5787 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5788 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5789 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5790 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5791 | |
| 5792 | deleteXapp1Subscription(t, &restSubId1) |
| 5793 | deleteXapp2Subscription(t, &restSubId2) |
| 5794 | |
| 5795 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5796 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5797 | |
| 5798 | mainCtrl.VerifyCounterValues(t) |
| 5799 | |
| 5800 | } |
| 5801 | |
| 5802 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5803 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5804 | |
| 5805 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5806 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5807 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5808 | Counter{cSubReqToE2, 2}, |
| 5809 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5810 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5811 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5812 | Counter{cSubDelReqToE2, 2}, |
| 5813 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5814 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5815 | }) |
| 5816 | |
| 5817 | // Req1 |
| 5818 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5819 | |
| 5820 | //Subs Create |
| 5821 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5822 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5823 | |
| 5824 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5825 | |
| 5826 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5827 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5828 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5829 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5830 | params.SetSubActionDefinition(actionDefinition) |
| 5831 | |
| 5832 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5833 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5834 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5835 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5836 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5837 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5838 | |
| 5839 | deleteXapp1Subscription(t, &restSubId1) |
| 5840 | deleteXapp2Subscription(t, &restSubId2) |
| 5841 | |
| 5842 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5843 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5844 | |
| 5845 | mainCtrl.VerifyCounterValues(t) |
| 5846 | |
| 5847 | } |
| 5848 | |
| 5849 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5850 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5851 | |
| 5852 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5853 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5854 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5855 | Counter{cSubReqToE2, 2}, |
| 5856 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5857 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5858 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5859 | Counter{cSubDelReqToE2, 2}, |
| 5860 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5861 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5862 | }) |
| 5863 | |
| 5864 | // Req1 |
| 5865 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5866 | |
| 5867 | //Subs Create |
| 5868 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5869 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5870 | |
| 5871 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5872 | |
| 5873 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5874 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5875 | params.SetMeid("RAN_NAME_1") |
| 5876 | params.SetTimeToWait("w200ms") |
| 5877 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5878 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5879 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5880 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5881 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5882 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5883 | |
| 5884 | deleteXapp1Subscription(t, &restSubId1) |
| 5885 | deleteXapp2Subscription(t, &restSubId2) |
| 5886 | |
| 5887 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5888 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5889 | |
| 5890 | mainCtrl.VerifyCounterValues(t) |
| 5891 | |
| 5892 | } |
| 5893 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5894 | //----------------------------------------------------------------------------- |
| 5895 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5896 | // |
| 5897 | // stub stub |
| 5898 | // +-------+ +---------+ +---------+ |
| 5899 | // | xapp | | submgr | | e2term | |
| 5900 | // +-------+ +---------+ +---------+ |
| 5901 | // | | | |
| 5902 | // | RestSubReq | | |
| 5903 | // |---------------->| | |
| 5904 | // | | | |
| 5905 | // | RESTSubResp | | |
| 5906 | // |<----------------| | |
| 5907 | // | | | |
| 5908 | // | | SubReq | |
| 5909 | // | |------------->| |
| 5910 | // | | | |
| 5911 | // | | SubResp | ASN.1 decode fails |
| 5912 | // | |<-------------| |
| 5913 | // | | | |
| 5914 | // | | SubReq | |
| 5915 | // | |------------->| |
| 5916 | // | | | |
| 5917 | // | | SubFail | Duplicated action |
| 5918 | // | |<-------------| |
| 5919 | // | RESTNotif (fail)| | |
| 5920 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5921 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5922 | // |
| 5923 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5924 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5925 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5926 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5927 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5928 | |
| 5929 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5930 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5931 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5932 | |
| 5933 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5934 | // Decode of this response fails which will result resending original request |
| 5935 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5936 | |
| 5937 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5938 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5939 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5940 | |
| 5941 | // Subscription already created in E2 Node. |
| 5942 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5943 | fparams.Set(crereq) |
| 5944 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5945 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5946 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5947 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5948 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5949 | |
| 5950 | // Wait that subs is cleaned |
| 5951 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5952 | |
| 5953 | xappConn1.TestMsgChanEmpty(t) |
| 5954 | e2termConn1.TestMsgChanEmpty(t) |
| 5955 | mainCtrl.wait_registry_empty(t, 10) |
| 5956 | } |
| 5957 | |
| 5958 | //----------------------------------------------------------------------------- |
| 5959 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5960 | // |
| 5961 | // stub stub |
| 5962 | // +-------+ +---------+ +---------+ |
| 5963 | // | xapp | | submgr | | e2term | |
| 5964 | // +-------+ +---------+ +---------+ |
| 5965 | // | | | |
| 5966 | // | RestSubReq | | |
| 5967 | // |---------------->| | |
| 5968 | // | | | |
| 5969 | // | RESTSubResp | | |
| 5970 | // |<----------------| | |
| 5971 | // | | | |
| 5972 | // | | SubReq | |
| 5973 | // | |------------->| |
| 5974 | // | | | |
| 5975 | // | | SubResp | Unknown instanceId |
| 5976 | // | |<-------------| |
| 5977 | // | | | |
| 5978 | // | | SubReq | |
| 5979 | // | |------------->| |
| 5980 | // | | | |
| 5981 | // | | SubFail | Duplicated action |
| 5982 | // | |<-------------| |
| 5983 | // | RESTNotif (fail)| | |
| 5984 | // |<----------------| | |
| 5985 | // | | SubDelReq | |
| 5986 | // | |------------->| |
| 5987 | // | | | |
| 5988 | // | | SubDelResp | |
| 5989 | // | |<-------------| |
| 5990 | // |
| 5991 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5992 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5993 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5994 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5995 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5996 | |
| 5997 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5998 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5999 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6000 | |
| 6001 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6002 | |
| 6003 | // Unknown instanceId in this response which will result resending original request |
| 6004 | orgInstanceId := crereq.RequestId.InstanceId |
| 6005 | crereq.RequestId.InstanceId = 0 |
| 6006 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6007 | |
| 6008 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6009 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6010 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6011 | |
| 6012 | // Subscription already created in E2 Node. |
| 6013 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6014 | fparams.Set(crereq) |
| 6015 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6016 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6017 | |
| 6018 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6019 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6020 | |
| 6021 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6022 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6023 | |
| 6024 | // Wait that subs is cleaned |
| 6025 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6026 | |
| 6027 | xappConn1.TestMsgChanEmpty(t) |
| 6028 | e2termConn1.TestMsgChanEmpty(t) |
| 6029 | mainCtrl.wait_registry_empty(t, 10) |
| 6030 | } |
| 6031 | |
| 6032 | //----------------------------------------------------------------------------- |
| 6033 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6034 | // |
| 6035 | // stub stub |
| 6036 | // +-------+ +---------+ +---------+ |
| 6037 | // | xapp | | submgr | | e2term | |
| 6038 | // +-------+ +---------+ +---------+ |
| 6039 | // | | | |
| 6040 | // | RestSubReq | | |
| 6041 | // |---------------->| | |
| 6042 | // | | | |
| 6043 | // | RESTSubResp | | |
| 6044 | // |<----------------| | |
| 6045 | // | | | |
| 6046 | // | | SubReq | |
| 6047 | // | |------------->| |
| 6048 | // | | | |
| 6049 | // | | SubResp | No transaction for the response |
| 6050 | // | |<-------------| |
| 6051 | // | | | |
| 6052 | // | | SubReq | |
| 6053 | // | |------------->| |
| 6054 | // | | | |
| 6055 | // | | SubFail | Duplicated action |
| 6056 | // | |<-------------| |
| 6057 | // | RESTNotif (fail)| | |
| 6058 | // |<----------------| | |
| 6059 | // | | SubDelReq | |
| 6060 | // | |------------->| |
| 6061 | // | | | |
| 6062 | // | | SubDelResp | |
| 6063 | // | |<-------------| |
| 6064 | // | | | |
| 6065 | // | | SubDelReq | |
| 6066 | // | |------------->| |
| 6067 | // | | | |
| 6068 | // | | SubDelResp | |
| 6069 | // | |<-------------| |
| 6070 | // |
| 6071 | //----------------------------------------------------------------------------- |
| 6072 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6073 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6074 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6075 | |
| 6076 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6077 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6078 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6079 | |
| 6080 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6081 | |
| 6082 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6083 | // No transaction exist for this response which will result resending original request |
| 6084 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6085 | |
| 6086 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6087 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6088 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6089 | |
| 6090 | // Subscription already created in E2 Node. |
| 6091 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6092 | fparams.Set(crereq) |
| 6093 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6094 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6095 | |
| 6096 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6097 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6098 | |
| 6099 | // Resending happens because there no transaction |
| 6100 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6101 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6102 | |
| 6103 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6104 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6105 | |
| 6106 | // Wait that subs is cleaned |
| 6107 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6108 | |
| 6109 | xappConn1.TestMsgChanEmpty(t) |
| 6110 | e2termConn1.TestMsgChanEmpty(t) |
| 6111 | mainCtrl.wait_registry_empty(t, 10) |
| 6112 | |
| 6113 | } |
| 6114 | |
| 6115 | //----------------------------------------------------------------------------- |
| 6116 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6117 | // |
| 6118 | // stub stub |
| 6119 | // +-------+ +---------+ +---------+ |
| 6120 | // | xapp | | submgr | | e2term | |
| 6121 | // +-------+ +---------+ +---------+ |
| 6122 | // | | | |
| 6123 | // | RestSubReq | | |
| 6124 | // |---------------->| | |
| 6125 | // | | | |
| 6126 | // | RESTSubResp | | |
| 6127 | // |<----------------| | |
| 6128 | // | | | |
| 6129 | // | | SubReq | |
| 6130 | // | |------------->| |
| 6131 | // | | | |
| 6132 | // | | SubFail | ASN.1 decode fails |
| 6133 | // | |<-------------| |
| 6134 | // | | | |
| 6135 | // | | SubReq | |
| 6136 | // | |------------->| |
| 6137 | // | | | |
| 6138 | // | | SubFail | Duplicated action |
| 6139 | // | |<-------------| |
| 6140 | // | RESTNotif (fail)| | |
| 6141 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6142 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6143 | // |
| 6144 | //----------------------------------------------------------------------------- |
| 6145 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6146 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6147 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6148 | |
| 6149 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6150 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6151 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6152 | |
| 6153 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6154 | |
| 6155 | // Decode of this response fails which will result resending original request |
| 6156 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6157 | |
| 6158 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6159 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6160 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6161 | |
| 6162 | // Subscription already created in E2 Node. |
| 6163 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6164 | fparams.Set(crereq) |
| 6165 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6166 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6167 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6168 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6169 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6170 | |
| 6171 | // Wait that subs is cleaned |
| 6172 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6173 | |
| 6174 | xappConn1.TestMsgChanEmpty(t) |
| 6175 | e2termConn1.TestMsgChanEmpty(t) |
| 6176 | mainCtrl.wait_registry_empty(t, 10) |
| 6177 | } |
| 6178 | |
| 6179 | //----------------------------------------------------------------------------- |
| 6180 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6181 | // |
| 6182 | // stub stub |
| 6183 | // +-------+ +---------+ +---------+ |
| 6184 | // | xapp | | submgr | | e2term | |
| 6185 | // +-------+ +---------+ +---------+ |
| 6186 | // | | | |
| 6187 | // | RestSubReq | | |
| 6188 | // |---------------->| | |
| 6189 | // | | | |
| 6190 | // | RESTSubResp | | |
| 6191 | // |<----------------| | |
| 6192 | // | | | |
| 6193 | // | | SubReq | |
| 6194 | // | |------------->| |
| 6195 | // | | | |
| 6196 | // | | SubFail | Unknown instanceId |
| 6197 | // | |<-------------| |
| 6198 | // | | | |
| 6199 | // | | SubReq | |
| 6200 | // | |------------->| |
| 6201 | // | | | |
| 6202 | // | | SubFail | Duplicated action |
| 6203 | // | |<-------------| |
| 6204 | // | RESTNotif (fail)| | |
| 6205 | // |<----------------| | |
| 6206 | // | | SubDelReq | |
| 6207 | // | |------------->| |
| 6208 | // | | | |
| 6209 | // | | SubDelResp | |
| 6210 | // | |<-------------| |
| 6211 | // |
| 6212 | //----------------------------------------------------------------------------- |
| 6213 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6214 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6215 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6216 | |
| 6217 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6218 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6219 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6220 | |
| 6221 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6222 | |
| 6223 | // Unknown instanceId in this response which will result resending original request |
| 6224 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6225 | fparams.Set(crereq) |
| 6226 | fparams.Fail.RequestId.InstanceId = 0 |
| 6227 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6228 | |
| 6229 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6230 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6231 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6232 | |
| 6233 | // Subscription already created in E2 Node. |
| 6234 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6235 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6236 | |
| 6237 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6238 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6239 | |
| 6240 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6241 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6242 | |
| 6243 | // Wait that subs is cleaned |
| 6244 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6245 | |
| 6246 | xappConn1.TestMsgChanEmpty(t) |
| 6247 | e2termConn1.TestMsgChanEmpty(t) |
| 6248 | mainCtrl.wait_registry_empty(t, 10) |
| 6249 | } |
| 6250 | |
| 6251 | //----------------------------------------------------------------------------- |
| 6252 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6253 | // |
| 6254 | // stub stub |
| 6255 | // +-------+ +---------+ +---------+ |
| 6256 | // | xapp | | submgr | | e2term | |
| 6257 | // +-------+ +---------+ +---------+ |
| 6258 | // | | | |
| 6259 | // | RestSubReq | | |
| 6260 | // |---------------->| | |
| 6261 | // | | | |
| 6262 | // | RESTSubResp | | |
| 6263 | // |<----------------| | |
| 6264 | // | | | |
| 6265 | // | | SubReq | |
| 6266 | // | |------------->| |
| 6267 | // | | | |
| 6268 | // | | SubFail | No transaction for the response |
| 6269 | // | |<-------------| |
| 6270 | // | | | |
| 6271 | // | | SubReq | |
| 6272 | // | |------------->| |
| 6273 | // | | | |
| 6274 | // | | SubFail | Duplicated action |
| 6275 | // | |<-------------| |
| 6276 | // | RESTNotif (fail)| | |
| 6277 | // |<----------------| | |
| 6278 | // | | SubDelReq | |
| 6279 | // | |------------->| |
| 6280 | // | | | |
| 6281 | // | | SubDelResp | |
| 6282 | // | |<-------------| |
| 6283 | // |
| 6284 | //----------------------------------------------------------------------------- |
| 6285 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6286 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6287 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6288 | |
| 6289 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6290 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6291 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6292 | |
| 6293 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6294 | |
| 6295 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6296 | |
| 6297 | // No transaction exist for this response which will result resending original request |
| 6298 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6299 | fparams.Set(crereq) |
| 6300 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6301 | |
| 6302 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6303 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6304 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6305 | |
| 6306 | // Subscription already created in E2 Node. |
| 6307 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6308 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6309 | |
| 6310 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6311 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6312 | |
| 6313 | // Resending happens because there no transaction |
| 6314 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6315 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6316 | |
| 6317 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6318 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6319 | |
| 6320 | // Wait that subs is cleaned |
| 6321 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6322 | |
| 6323 | xappConn1.TestMsgChanEmpty(t) |
| 6324 | e2termConn1.TestMsgChanEmpty(t) |
| 6325 | mainCtrl.wait_registry_empty(t, 10) |
| 6326 | } |
| 6327 | |
| 6328 | //----------------------------------------------------------------------------- |
| 6329 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6330 | // |
| 6331 | // stub stub |
| 6332 | // +-------+ +---------+ +---------+ |
| 6333 | // | xapp | | submgr | | e2term | |
| 6334 | // +-------+ +---------+ +---------+ |
| 6335 | // | | | |
| 6336 | // | [SUBS CREATE] | |
| 6337 | // | | | |
| 6338 | // | | | |
| 6339 | // | RESTSubDelReq | | |
| 6340 | // |---------------->| | |
| 6341 | // | | | |
| 6342 | // | RESTSubDelResp | | |
| 6343 | // |<----------------| | |
| 6344 | // | | | |
| 6345 | // | | SubDelReq | |
| 6346 | // | |------------->| |
| 6347 | // | | | |
| 6348 | // | | SubDelResp | ASN.1 decode fails |
| 6349 | // | |<-------------| |
| 6350 | // | | | |
| 6351 | // | | SubDelReq | |
| 6352 | // | |------------->| |
| 6353 | // | | | |
| 6354 | // | | SubDelFail | Subscription does exist any more |
| 6355 | // | |<-------------| |
| 6356 | // | | | |
| 6357 | // |
| 6358 | //----------------------------------------------------------------------------- |
| 6359 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6360 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6361 | |
| 6362 | // Req |
| 6363 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6364 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6365 | |
| 6366 | // Del |
| 6367 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6368 | |
| 6369 | // E2t: Receive 1st SubsDelReq |
| 6370 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6371 | |
| 6372 | // Decode of this response fails which will result resending original request |
| 6373 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6374 | |
| 6375 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6376 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6377 | |
| 6378 | // Subscription does not exist in in E2 Node. |
| 6379 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6380 | |
| 6381 | // Wait that subs is cleaned |
| 6382 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6383 | |
| 6384 | xappConn1.TestMsgChanEmpty(t) |
| 6385 | e2termConn1.TestMsgChanEmpty(t) |
| 6386 | mainCtrl.wait_registry_empty(t, 10) |
| 6387 | } |
| 6388 | |
| 6389 | //----------------------------------------------------------------------------- |
| 6390 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6391 | // |
| 6392 | // stub stub |
| 6393 | // +-------+ +---------+ +---------+ |
| 6394 | // | xapp | | submgr | | e2term | |
| 6395 | // +-------+ +---------+ +---------+ |
| 6396 | // | | | |
| 6397 | // | [SUBS CREATE] | |
| 6398 | // | | | |
| 6399 | // | | | |
| 6400 | // | RESTSubDelReq | | |
| 6401 | // |---------------->| | |
| 6402 | // | | | |
| 6403 | // | RESTSubDelResp | | |
| 6404 | // |<----------------| | |
| 6405 | // | | | |
| 6406 | // | | SubDelReq | |
| 6407 | // | |------------->| |
| 6408 | // | | | |
| 6409 | // | | SubDelResp | Unknown instanceId |
| 6410 | // | |<-------------| |
| 6411 | // | | | |
| 6412 | // | | SubDelReq | |
| 6413 | // | |------------->| |
| 6414 | // | | | |
| 6415 | // | | SubDelFail | Subscription does exist any more |
| 6416 | // | |<-------------| |
| 6417 | // |
| 6418 | //----------------------------------------------------------------------------- |
| 6419 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6420 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6421 | |
| 6422 | // Req |
| 6423 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6424 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6425 | |
| 6426 | // Del |
| 6427 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6428 | |
| 6429 | // E2t: Receive 1st SubsDelReq |
| 6430 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6431 | |
| 6432 | // Unknown instanceId in this response which will result resending original request |
| 6433 | delreq.RequestId.InstanceId = 0 |
| 6434 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6435 | |
| 6436 | // E2t: Receive 2nd SubsDelReq |
| 6437 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6438 | |
| 6439 | // Subscription does not exist in in E2 Node. |
| 6440 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6441 | |
| 6442 | // Wait that subs is cleaned |
| 6443 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6444 | |
| 6445 | xappConn1.TestMsgChanEmpty(t) |
| 6446 | e2termConn1.TestMsgChanEmpty(t) |
| 6447 | mainCtrl.wait_registry_empty(t, 10) |
| 6448 | } |
| 6449 | |
| 6450 | //----------------------------------------------------------------------------- |
| 6451 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6452 | // |
| 6453 | // stub stub |
| 6454 | // +-------+ +---------+ +---------+ |
| 6455 | // | xapp | | submgr | | e2term | |
| 6456 | // +-------+ +---------+ +---------+ |
| 6457 | // | | | |
| 6458 | // | [SUBS CREATE] | |
| 6459 | // | | | |
| 6460 | // | | | |
| 6461 | // | RESTSubDelReq | | |
| 6462 | // |---------------->| | |
| 6463 | // | | | |
| 6464 | // | RESTSubDelResp | | |
| 6465 | // |<----------------| | |
| 6466 | // | | | |
| 6467 | // | | SubDelReq | |
| 6468 | // | |------------->| |
| 6469 | // | | | |
| 6470 | // | | SubDelResp | No transaction for the response |
| 6471 | // | |<-------------| |
| 6472 | // | | | |
| 6473 | // | | SubDelReq | |
| 6474 | // | |------------->| |
| 6475 | // | | | |
| 6476 | // | | SubDelFail | Subscription does exist any more |
| 6477 | // | |<-------------| |
| 6478 | // |
| 6479 | //----------------------------------------------------------------------------- |
| 6480 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6481 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6482 | |
| 6483 | // Req |
| 6484 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6485 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6486 | |
| 6487 | // Del |
| 6488 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6489 | |
| 6490 | // E2t: Receive 1st SubsDelReq |
| 6491 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6492 | |
| 6493 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6494 | |
| 6495 | // No transaction exist for this response which will result resending original request |
| 6496 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6497 | |
| 6498 | // E2t: Receive 2nd SubsDelReq |
| 6499 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6500 | |
| 6501 | // Subscription does not exist in in E2 Node. |
| 6502 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6503 | |
| 6504 | // Wait that subs is cleaned |
| 6505 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6506 | |
| 6507 | xappConn1.TestMsgChanEmpty(t) |
| 6508 | e2termConn1.TestMsgChanEmpty(t) |
| 6509 | mainCtrl.wait_registry_empty(t, 10) |
| 6510 | } |
| 6511 | |
| 6512 | //----------------------------------------------------------------------------- |
| 6513 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6514 | // |
| 6515 | // stub stub |
| 6516 | // +-------+ +---------+ +---------+ |
| 6517 | // | xapp | | submgr | | e2term | |
| 6518 | // +-------+ +---------+ +---------+ |
| 6519 | // | | | |
| 6520 | // | [SUBS CREATE] | |
| 6521 | // | | | |
| 6522 | // | | | |
| 6523 | // | RESTSubDelReq | | |
| 6524 | // |---------------->| | |
| 6525 | // | | | |
| 6526 | // | RESTSubDelResp | | |
| 6527 | // |<----------------| | |
| 6528 | // | | | |
| 6529 | // | | SubDelReq | |
| 6530 | // | |------------->| |
| 6531 | // | | | |
| 6532 | // | | SubDelFail | ASN.1 decode fails |
| 6533 | // | |<-------------| |
| 6534 | // | | | |
| 6535 | // | | SubDelReq | |
| 6536 | // | |------------->| |
| 6537 | // | | | |
| 6538 | // | | SubDelFail | Subscription does exist any more |
| 6539 | // | |<-------------| |
| 6540 | // |
| 6541 | //----------------------------------------------------------------------------- |
| 6542 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6543 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6544 | |
| 6545 | // Req |
| 6546 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6547 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6548 | |
| 6549 | // Del |
| 6550 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6551 | |
| 6552 | // E2t: Receive 1st SubsDelReq |
| 6553 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6554 | |
| 6555 | // Decode of this response fails which will result resending original request |
| 6556 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6557 | |
| 6558 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6559 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6560 | |
| 6561 | // Subscription does not exist in in E2 Node. |
| 6562 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6563 | |
| 6564 | // Wait that subs is cleaned |
| 6565 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6566 | |
| 6567 | xappConn1.TestMsgChanEmpty(t) |
| 6568 | e2termConn1.TestMsgChanEmpty(t) |
| 6569 | mainCtrl.wait_registry_empty(t, 10) |
| 6570 | } |
| 6571 | |
| 6572 | //----------------------------------------------------------------------------- |
| 6573 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6574 | // |
| 6575 | // stub stub |
| 6576 | // +-------+ +---------+ +---------+ |
| 6577 | // | xapp | | submgr | | e2term | |
| 6578 | // +-------+ +---------+ +---------+ |
| 6579 | // | | | |
| 6580 | // | [SUBS CREATE] | |
| 6581 | // | | | |
| 6582 | // | | | |
| 6583 | // | RESTSubDelReq | | |
| 6584 | // |---------------->| | |
| 6585 | // | | | |
| 6586 | // | RESTSubDelResp | | |
| 6587 | // |<----------------| | |
| 6588 | // | | | |
| 6589 | // | | SubDelReq | |
| 6590 | // | |------------->| |
| 6591 | // | | | |
| 6592 | // | | SubDelFail | Unknown instanceId |
| 6593 | // | |<-------------| |
| 6594 | // | | | |
| 6595 | // | | SubDelReq | |
| 6596 | // | |------------->| |
| 6597 | // | | | |
| 6598 | // | | SubDelFail | Subscription does exist any more |
| 6599 | // | |<-------------| |
| 6600 | // |
| 6601 | //----------------------------------------------------------------------------- |
| 6602 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6603 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6604 | |
| 6605 | // Req |
| 6606 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6607 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6608 | |
| 6609 | // Del |
| 6610 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6611 | |
| 6612 | // E2t: Receive 1st SubsDelReq |
| 6613 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6614 | |
| 6615 | // Unknown instanceId in this response which will result resending original request |
| 6616 | delreq.RequestId.InstanceId = 0 |
| 6617 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6618 | |
| 6619 | // E2t: Receive 2nd SubsDelReq |
| 6620 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6621 | |
| 6622 | // Subscription does not exist in in E2 Node. |
| 6623 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6624 | |
| 6625 | // Wait that subs is cleaned |
| 6626 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6627 | |
| 6628 | xappConn1.TestMsgChanEmpty(t) |
| 6629 | e2termConn1.TestMsgChanEmpty(t) |
| 6630 | mainCtrl.wait_registry_empty(t, 10) |
| 6631 | } |
| 6632 | |
| 6633 | //----------------------------------------------------------------------------- |
| 6634 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6635 | // |
| 6636 | // stub stub |
| 6637 | // +-------+ +---------+ +---------+ |
| 6638 | // | xapp | | submgr | | e2term | |
| 6639 | // +-------+ +---------+ +---------+ |
| 6640 | // | | | |
| 6641 | // | [SUBS CREATE] | |
| 6642 | // | | | |
| 6643 | // | | | |
| 6644 | // | RESTSubDelReq | | |
| 6645 | // |---------------->| | |
| 6646 | // | | | |
| 6647 | // | RESTSubDelResp | | |
| 6648 | // |<----------------| | |
| 6649 | // | | | |
| 6650 | // | | SubDelReq | |
| 6651 | // | |------------->| |
| 6652 | // | | | |
| 6653 | // | | SubDelFail | No transaction for the response |
| 6654 | // | |<-------------| |
| 6655 | // | | | |
| 6656 | // | | SubDelReq | |
| 6657 | // | |------------->| |
| 6658 | // | | | |
| 6659 | // | | SubDelFail | Subscription does exist any more |
| 6660 | // | |<-------------| |
| 6661 | // |
| 6662 | //----------------------------------------------------------------------------- |
| 6663 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6664 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6665 | |
| 6666 | // Req |
| 6667 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6668 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6669 | |
| 6670 | // Del |
| 6671 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6672 | |
| 6673 | // E2t: Receive 1st SubsDelReq |
| 6674 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6675 | |
| 6676 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6677 | |
| 6678 | // No transaction exist for this response which will result resending original request |
| 6679 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6680 | |
| 6681 | // E2t: Receive 2nd SubsDelReq |
| 6682 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6683 | |
| 6684 | // Subscription does not exist in in E2 Node. |
| 6685 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6686 | |
| 6687 | // Wait that subs is cleaned |
| 6688 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6689 | |
| 6690 | xappConn1.TestMsgChanEmpty(t) |
| 6691 | e2termConn1.TestMsgChanEmpty(t) |
| 6692 | mainCtrl.wait_registry_empty(t, 10) |
| 6693 | } |
| 6694 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6695 | //----------------------------------------------------------------------------- |
| 6696 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6697 | // |
| 6698 | // stub stub |
| 6699 | // +-------+ +---------+ +---------+ |
| 6700 | // | xapp | | submgr | | e2term | |
| 6701 | // +-------+ +---------+ +---------+ |
| 6702 | // | | | |
| 6703 | // | RESTSubReq | | |
| 6704 | // |---------------->| | |
| 6705 | // | | | |
| 6706 | // | RESTSubResp | | |
| 6707 | // |<----------------| | |
| 6708 | // | | | |
| 6709 | // | ASN.1 encode fails | |
| 6710 | // | | | |
| 6711 | // | | SubDelReq | |
| 6712 | // | |------------->| |
| 6713 | // | | | |
| 6714 | // | | SubDelFail | |
| 6715 | // | |<-------------| |
| 6716 | // | | | |
| 6717 | // | RESTNotif | | |
| 6718 | // | unsuccess | | |
| 6719 | // |<----------------| | |
| 6720 | // | | | |
| 6721 | // | [SUBS DELETE] | |
| 6722 | // | | | |
| 6723 | // |
| 6724 | //----------------------------------------------------------------------------- |
| 6725 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6726 | |
| 6727 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6728 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6729 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6730 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6731 | }) |
| 6732 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6733 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6734 | |
| 6735 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6736 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6737 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6738 | |
| 6739 | // Req |
| 6740 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6741 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6742 | |
| 6743 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6744 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6745 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6746 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6747 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6748 | |
| 6749 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 6750 | // Wait that subs is cleaned |
| 6751 | waitSubsCleanup(t, e2SubsId, 10) |
| 6752 | mainCtrl.VerifyCounterValues(t) |
| 6753 | } |
| 6754 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6755 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6756 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6757 | |
| 6758 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6759 | Counter{cRestSubReqFromXapp, 2}, |
| 6760 | Counter{cRestSubRespToXapp, 2}, |
| 6761 | Counter{cSubReqToE2, 2}, |
| 6762 | Counter{cSubRespFromE2, 1}, |
| 6763 | Counter{cRestSubNotifToXapp, 1}, |
| 6764 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6765 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6766 | Counter{cSubDelReqToE2, 1}, |
| 6767 | Counter{cSubDelRespFromE2, 1}, |
| 6768 | Counter{cRestSubDelRespToXapp, 1}, |
| 6769 | }) |
| 6770 | |
| 6771 | const e2Timeout int64 = 1 |
| 6772 | const e2RetryCount int64 = 0 |
| 6773 | const routingNeeded bool = false |
| 6774 | |
| 6775 | // Req1 |
| 6776 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6777 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6778 | |
| 6779 | // Subs Create |
| 6780 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6781 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6782 | |
| 6783 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6784 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6785 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6786 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6787 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6788 | |
| 6789 | // Policy change |
| 6790 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6791 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6792 | params.SetSubscriptionID(&restSubId) |
| 6793 | params.SetTimeToWait("w200ms") |
| 6794 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6795 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6796 | |
| 6797 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6798 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6799 | // SubsResp is missing, e2SubsId will be 0 |
| 6800 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6801 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6802 | |
| 6803 | // Del |
| 6804 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6805 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6806 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6807 | |
| 6808 | waitSubsCleanup(t, e2SubsId, 10) |
| 6809 | |
| 6810 | mainCtrl.VerifyCounterValues(t) |
| 6811 | } |
| 6812 | |
| 6813 | //----------------------------------------------------------------------------- |
| 6814 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6815 | // |
| 6816 | // stub stub |
| 6817 | // +-------+ +---------+ +---------+ |
| 6818 | // | xapp | | submgr | | e2term | |
| 6819 | // +-------+ +---------+ +---------+ |
| 6820 | // | | | |
| 6821 | // | RESTSubReq | | |
| 6822 | // |---------------->| | |
| 6823 | // | | | |
| 6824 | // | RESTSubResp | | |
| 6825 | // |<----------------| | |
| 6826 | // | | SubReq | |
| 6827 | // | |------------->| |
| 6828 | // | | | |
| 6829 | // | | SubResp | |
| 6830 | // | |<-------------| |
| 6831 | // | | | |
| 6832 | // | RESTNotif | | |
| 6833 | // |<----------------| | |
| 6834 | // | | | |
| 6835 | // | RESTSubReq | | |
| 6836 | // |---------------->| | |
| 6837 | // | | | |
| 6838 | // | RESTSubResp | | |
| 6839 | // |<----------------| | |
| 6840 | // | | SubReq | |
| 6841 | // | |------------->| |
| 6842 | // | | |
| 6843 | // | Submgr restart | |
| 6844 | // | | | |
| 6845 | // | RESTSubDelReq | | |
| 6846 | // |---------------->| | |
| 6847 | // | | | |
| 6848 | // | | SubDelReq | |
| 6849 | // | |------------->| |
| 6850 | // | | | |
| 6851 | // | | SubDelResp | |
| 6852 | // | |<-------------| |
| 6853 | // | | | |
| 6854 | // | RESTSubDelResp | | |
| 6855 | // |<----------------| | |
| 6856 | // |
| 6857 | //----------------------------------------------------------------------------- |
| 6858 | |
| 6859 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6860 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6861 | |
| 6862 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6863 | Counter{cRestSubReqFromXapp, 2}, |
| 6864 | Counter{cRestSubRespToXapp, 2}, |
| 6865 | Counter{cSubReqToE2, 2}, |
| 6866 | Counter{cSubRespFromE2, 1}, |
| 6867 | Counter{cRestSubNotifToXapp, 1}, |
| 6868 | Counter{cRestSubNotifToXapp, 1}, |
| 6869 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6870 | Counter{cSubDelReqToE2, 1}, |
| 6871 | Counter{cRestSubDelRespToXapp, 1}, |
| 6872 | }) |
| 6873 | |
| 6874 | // Remove possible existing subscription |
| 6875 | mainCtrl.removeExistingSubscriptions(t) |
| 6876 | |
| 6877 | const e2Timeout int64 = 1 |
| 6878 | const e2RetryCount int64 = 0 |
| 6879 | const routingNeeded bool = false |
| 6880 | |
| 6881 | // Req1 |
| 6882 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6883 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6884 | // Create subscription |
| 6885 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6886 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6887 | |
| 6888 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6889 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6890 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6891 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6892 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6893 | |
| 6894 | // Check subscription |
| 6895 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6896 | |
| 6897 | // Policy change |
| 6898 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6899 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6900 | params.SetSubscriptionID(&restSubId) |
| 6901 | params.SetTimeToWait("w200ms") |
| 6902 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 6903 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6904 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6905 | |
| 6906 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6907 | mainCtrl.SetResetTestFlag(t, false) |
| 6908 | |
| 6909 | // SubsResp is missing due to submgr restart |
| 6910 | |
| 6911 | mainCtrl.SimulateRestart(t) |
| 6912 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 6913 | |
| 6914 | // Check subscription |
| 6915 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6916 | |
| 6917 | xapp.Logger.Debug("Here 1") |
| 6918 | //<-time.After(3 * time.Second) |
| 6919 | xapp.Logger.Debug("Here 2") |
| 6920 | |
| 6921 | // Delete subscription |
| 6922 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6923 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6924 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6925 | |
| 6926 | //Wait that subs is cleaned |
| 6927 | waitSubsCleanup(t, e2SubsId, 10) |
| 6928 | |
| 6929 | mainCtrl.VerifyCounterValues(t) |
| 6930 | } |
| 6931 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6932 | //////////////////////////////////////////////////////////////////////////////////// |
| 6933 | // Services for UT cases |
| 6934 | //////////////////////////////////////////////////////////////////////////////////// |
| 6935 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6936 | const host string = "localhost" |
| 6937 | |
| 6938 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6939 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6940 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6941 | } |
| 6942 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6943 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6944 | |
| 6945 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 6946 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6947 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 6948 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6949 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6950 | |
| 6951 | return restSubId, e2SubsId |
| 6952 | } |
| 6953 | |
| 6954 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 6955 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6956 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6957 | if meid != "" { |
| 6958 | params.SetMeid(meid) |
| 6959 | } |
| 6960 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 6961 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 6962 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6963 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6964 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6965 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6966 | |
| 6967 | return restSubId, e2SubsId |
| 6968 | } |
| 6969 | |
| 6970 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6971 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6972 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6973 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6974 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6975 | |
| 6976 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6977 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6978 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6979 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6980 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6981 | |
| 6982 | return restSubId, e2SubsId |
| 6983 | } |
| 6984 | |
| 6985 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6986 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6987 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6988 | |
| 6989 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6990 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 6991 | fparams1.Set(crereq1) |
| 6992 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 6993 | |
| 6994 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 6995 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6996 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 6997 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6998 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6999 | |
| 7000 | return restSubId, e2SubsId |
| 7001 | } |
| 7002 | |
| 7003 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7004 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7005 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7006 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7007 | } |
| 7008 | |
| 7009 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7010 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7011 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7012 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7013 | } |
| 7014 | |
| 7015 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7016 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7017 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7018 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7019 | } |
| 7020 | |
| 7021 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7022 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 7023 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 7024 | assert.Equal(t, resp[0].Meid, meid) |
| 7025 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 7026 | } |
| 7027 | |
| 7028 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7029 | //Wait that subs is cleaned |
| 7030 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7031 | |
| 7032 | xappConn1.TestMsgChanEmpty(t) |
| 7033 | xappConn2.TestMsgChanEmpty(t) |
| 7034 | e2termConn1.TestMsgChanEmpty(t) |
| 7035 | mainCtrl.wait_registry_empty(t, timeout) |
| 7036 | } |
| 7037 | |
| 7038 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7039 | |
| 7040 | var e2SubsId []uint32 |
| 7041 | |
| 7042 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7043 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7044 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7045 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7046 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7047 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7048 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7049 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7050 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7051 | <-time.After(100 * time.Millisecond) |
| 7052 | } |
| 7053 | return e2SubsId |
| 7054 | } |
| 7055 | |
| 7056 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7057 | |
| 7058 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7059 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7060 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7061 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7062 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7063 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7064 | <-time.After(100 * time.Millisecond) |
| 7065 | } |
| 7066 | |
| 7067 | // Wait that subs is cleaned |
| 7068 | for i := 0; i < len(e2SubsIds); i++ { |
| 7069 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7070 | } |
| 7071 | |
| 7072 | } |