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 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1449 | // | | SubDelReq | |
| 1450 | // | |------------->| |
| 1451 | // | | | |
| 1452 | // | | SubDelResp | |
| 1453 | // | |<-------------| |
| 1454 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1455 | // | SubFail | | |
| 1456 | // |<-------------| | |
| 1457 | // | | | |
| 1458 | // |
| 1459 | //----------------------------------------------------------------------------- |
| 1460 | |
| 1461 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1462 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1463 | |
| 1464 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1465 | Counter{cSubReqFromXapp, 1}, |
| 1466 | Counter{cSubReqToE2, 1}, |
| 1467 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1468 | Counter{cSubFailToXapp, 1}, |
| 1469 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1470 | |
| 1471 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1472 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1473 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1474 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1475 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1476 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1477 | fparams1.Set(crereq1) |
| 1478 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1479 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1480 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1481 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1482 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1483 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1484 | // Xapp: Receive SubsFail |
| 1485 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1486 | |
| 1487 | // Wait that subs is cleaned |
| 1488 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1489 | |
| 1490 | xappConn1.TestMsgChanEmpty(t) |
| 1491 | xappConn2.TestMsgChanEmpty(t) |
| 1492 | e2termConn1.TestMsgChanEmpty(t) |
| 1493 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1494 | |
| 1495 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1496 | } |
| 1497 | |
| 1498 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1499 | // TestSubDelReqRetryInSubmgr |
| 1500 | // |
| 1501 | // stub stub |
| 1502 | // +-------+ +---------+ +---------+ |
| 1503 | // | xapp | | submgr | | e2term | |
| 1504 | // +-------+ +---------+ +---------+ |
| 1505 | // | | | |
| 1506 | // | [SUBS CREATE] | |
| 1507 | // | | | |
| 1508 | // | | | |
| 1509 | // | SubDelReq | | |
| 1510 | // |------------->| | |
| 1511 | // | | | |
| 1512 | // | | SubDelReq | |
| 1513 | // | |------------->| |
| 1514 | // | | | |
| 1515 | // | | SubDelReq | |
| 1516 | // | |------------->| |
| 1517 | // | | | |
| 1518 | // | | SubDelResp | |
| 1519 | // | |<-------------| |
| 1520 | // | | | |
| 1521 | // | SubDelResp | | |
| 1522 | // |<-------------| | |
| 1523 | // |
| 1524 | //----------------------------------------------------------------------------- |
| 1525 | |
| 1526 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1527 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1528 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1529 | |
| 1530 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1531 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1532 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1533 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1534 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1535 | |
| 1536 | // Subs Delete |
| 1537 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1538 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1539 | |
| 1540 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1541 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1542 | |
| 1543 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1544 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1545 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1546 | |
| 1547 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1548 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1549 | |
| 1550 | // Wait that subs is cleaned |
| 1551 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1552 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1553 | xappConn1.TestMsgChanEmpty(t) |
| 1554 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1555 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1556 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1557 | } |
| 1558 | |
| 1559 | //----------------------------------------------------------------------------- |
| 1560 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1561 | // |
| 1562 | // stub stub |
| 1563 | // +-------+ +---------+ +---------+ |
| 1564 | // | xapp | | submgr | | e2term | |
| 1565 | // +-------+ +---------+ +---------+ |
| 1566 | // | | | |
| 1567 | // | [SUBS CREATE] | |
| 1568 | // | | | |
| 1569 | // | | | |
| 1570 | // | SubDelReq | | |
| 1571 | // |------------->| | |
| 1572 | // | | | |
| 1573 | // | | SubDelReq | |
| 1574 | // | |------------->| |
| 1575 | // | | | |
| 1576 | // | | SubDelReq | |
| 1577 | // | |------------->| |
| 1578 | // | | | |
| 1579 | // | | | |
| 1580 | // | SubDelResp | | |
| 1581 | // |<-------------| | |
| 1582 | // |
| 1583 | //----------------------------------------------------------------------------- |
| 1584 | |
| 1585 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1586 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1587 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1588 | |
| 1589 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1590 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1591 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1592 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1593 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1594 | |
| 1595 | // Subs Delete |
| 1596 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1597 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1598 | |
| 1599 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1600 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1601 | |
| 1602 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1603 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1604 | |
| 1605 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1606 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1607 | |
| 1608 | // Wait that subs is cleaned |
| 1609 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1610 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1611 | xappConn1.TestMsgChanEmpty(t) |
| 1612 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1613 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1614 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1615 | } |
| 1616 | |
| 1617 | //----------------------------------------------------------------------------- |
| 1618 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1619 | // |
| 1620 | // stub stub |
| 1621 | // +-------+ +---------+ +---------+ |
| 1622 | // | xapp | | submgr | | e2term | |
| 1623 | // +-------+ +---------+ +---------+ |
| 1624 | // | | | |
| 1625 | // | [SUBS CREATE] | |
| 1626 | // | | | |
| 1627 | // | | | |
| 1628 | // | SubDelReq | | |
| 1629 | // |------------->| | |
| 1630 | // | | | |
| 1631 | // | | SubDelReq | |
| 1632 | // | |------------->| |
| 1633 | // | | | |
| 1634 | // | | SubDelFail | |
| 1635 | // | |<-------------| |
| 1636 | // | | | |
| 1637 | // | SubDelResp | | |
| 1638 | // |<-------------| | |
| 1639 | // | | | |
| 1640 | // |
| 1641 | //----------------------------------------------------------------------------- |
| 1642 | |
| 1643 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1644 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1645 | |
| 1646 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1647 | Counter{cSubReqFromXapp, 1}, |
| 1648 | Counter{cSubReqToE2, 1}, |
| 1649 | Counter{cSubRespFromE2, 1}, |
| 1650 | Counter{cSubRespToXapp, 1}, |
| 1651 | Counter{cSubDelReqFromXapp, 1}, |
| 1652 | Counter{cSubDelReqToE2, 1}, |
| 1653 | Counter{cSubDelFailFromE2, 1}, |
| 1654 | Counter{cSubDelRespToXapp, 1}, |
| 1655 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1656 | |
| 1657 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1658 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1659 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1660 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1661 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1662 | |
| 1663 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1664 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1665 | |
| 1666 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1667 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1668 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1669 | |
| 1670 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1671 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1672 | |
| 1673 | // Wait that subs is cleaned |
| 1674 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1675 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1676 | xappConn1.TestMsgChanEmpty(t) |
| 1677 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1678 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1679 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1680 | |
| 1681 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1682 | } |
| 1683 | |
| 1684 | //----------------------------------------------------------------------------- |
| 1685 | // TestSubReqAndSubDelOkSameAction |
| 1686 | // |
| 1687 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1688 | // +-------+ +-------+ +---------+ +---------+ |
| 1689 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1690 | // +-------+ +-------+ +---------+ +---------+ |
| 1691 | // | | | | |
| 1692 | // | | | | |
| 1693 | // | | | | |
| 1694 | // | | SubReq1 | | |
| 1695 | // | |------------->| | |
| 1696 | // | | | | |
| 1697 | // | | | SubReq1 | |
| 1698 | // | | |------------->| |
| 1699 | // | | | SubResp1 | |
| 1700 | // | | |<-------------| |
| 1701 | // | | SubResp1 | | |
| 1702 | // | |<-------------| | |
| 1703 | // | | | | |
| 1704 | // | SubReq2 | | |
| 1705 | // |--------------------------->| | |
| 1706 | // | | | | |
| 1707 | // | SubResp2 | | |
| 1708 | // |<---------------------------| | |
| 1709 | // | | | | |
| 1710 | // | | SubDelReq 1 | | |
| 1711 | // | |------------->| | |
| 1712 | // | | | | |
| 1713 | // | | SubDelResp 1 | | |
| 1714 | // | |<-------------| | |
| 1715 | // | | | | |
| 1716 | // | SubDelReq 2 | | |
| 1717 | // |--------------------------->| | |
| 1718 | // | | | | |
| 1719 | // | | | SubDelReq 2 | |
| 1720 | // | | |------------->| |
| 1721 | // | | | | |
| 1722 | // | | | SubDelReq 2 | |
| 1723 | // | | |------------->| |
| 1724 | // | | | | |
| 1725 | // | SubDelResp 2 | | |
| 1726 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1727 | // |
| 1728 | //----------------------------------------------------------------------------- |
| 1729 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1730 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1731 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1732 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1733 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1734 | Counter{cSubReqFromXapp, 2}, |
| 1735 | Counter{cSubReqToE2, 1}, |
| 1736 | Counter{cSubRespFromE2, 1}, |
| 1737 | Counter{cSubRespToXapp, 2}, |
| 1738 | Counter{cMergedSubscriptions, 1}, |
| 1739 | Counter{cUnmergedSubscriptions, 1}, |
| 1740 | Counter{cSubDelReqFromXapp, 2}, |
| 1741 | Counter{cSubDelReqToE2, 1}, |
| 1742 | Counter{cSubDelRespFromE2, 1}, |
| 1743 | Counter{cSubDelRespToXapp, 2}, |
| 1744 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1745 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1746 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1747 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1748 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1749 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1750 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1751 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1752 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1753 | |
| 1754 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1755 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1756 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1757 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1758 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1759 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1760 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1761 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1762 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1763 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1764 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1765 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1766 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1767 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1769 | //e2termConn1.RecvSubsDelReq(t) |
| 1770 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1771 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1772 | //Wait that subs is cleaned |
| 1773 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1774 | |
| 1775 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1776 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1777 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1778 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1779 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1780 | //Wait that subs is cleaned |
| 1781 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1782 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1783 | xappConn1.TestMsgChanEmpty(t) |
| 1784 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1785 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1786 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1787 | |
| 1788 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1789 | } |
| 1790 | |
| 1791 | //----------------------------------------------------------------------------- |
| 1792 | // TestSubReqAndSubDelOkSameActionParallel |
| 1793 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1794 | // stub stub stub |
| 1795 | // +-------+ +-------+ +---------+ +---------+ |
| 1796 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1797 | // +-------+ +-------+ +---------+ +---------+ |
| 1798 | // | | | | |
| 1799 | // | | | | |
| 1800 | // | | | | |
| 1801 | // | | SubReq1 | | |
| 1802 | // | |------------->| | |
| 1803 | // | | | | |
| 1804 | // | | | SubReq1 | |
| 1805 | // | | |------------->| |
| 1806 | // | SubReq2 | | |
| 1807 | // |--------------------------->| | |
| 1808 | // | | | SubResp1 | |
| 1809 | // | | |<-------------| |
| 1810 | // | | SubResp1 | | |
| 1811 | // | |<-------------| | |
| 1812 | // | | | | |
| 1813 | // | SubResp2 | | |
| 1814 | // |<---------------------------| | |
| 1815 | // | | | | |
| 1816 | // | | SubDelReq 1 | | |
| 1817 | // | |------------->| | |
| 1818 | // | | | | |
| 1819 | // | | SubDelResp 1 | | |
| 1820 | // | |<-------------| | |
| 1821 | // | | | | |
| 1822 | // | SubDelReq 2 | | |
| 1823 | // |--------------------------->| | |
| 1824 | // | | | | |
| 1825 | // | | | SubDelReq 2 | |
| 1826 | // | | |------------->| |
| 1827 | // | | | | |
| 1828 | // | | | SubDelReq 2 | |
| 1829 | // | | |------------->| |
| 1830 | // | | | | |
| 1831 | // | SubDelResp 2 | | |
| 1832 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1833 | // |
| 1834 | //----------------------------------------------------------------------------- |
| 1835 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1836 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1837 | |
| 1838 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1839 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1840 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1841 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1842 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1843 | |
| 1844 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1845 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1846 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1847 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1848 | |
| 1849 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1850 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1851 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1852 | |
| 1853 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1854 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1855 | |
| 1856 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1857 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1858 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1859 | |
| 1860 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1861 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1862 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1863 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1864 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1865 | |
| 1866 | //Wait that subs is cleaned |
| 1867 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1868 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1869 | xappConn1.TestMsgChanEmpty(t) |
| 1870 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1871 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1872 | mainCtrl.wait_registry_empty(t, 10) |
| 1873 | } |
| 1874 | |
| 1875 | //----------------------------------------------------------------------------- |
| 1876 | // TestSubReqAndSubDelNokSameActionParallel |
| 1877 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1878 | // stub stub stub |
| 1879 | // +-------+ +-------+ +---------+ +---------+ |
| 1880 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1881 | // +-------+ +-------+ +---------+ +---------+ |
| 1882 | // | | | | |
| 1883 | // | | | | |
| 1884 | // | | | | |
| 1885 | // | | SubReq1 | | |
| 1886 | // | |------------->| | |
| 1887 | // | | | | |
| 1888 | // | | | SubReq1 | |
| 1889 | // | | |------------->| |
| 1890 | // | SubReq2 | | |
| 1891 | // |--------------------------->| | |
| 1892 | // | | | SubFail1 | |
| 1893 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1894 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1895 | // | | | SubDelReq | |
| 1896 | // | | |------------->| |
| 1897 | // | | | SubDelResp | |
| 1898 | // | | |<-------------| |
| 1899 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1900 | // | | SubFail1 | | |
| 1901 | // | |<-------------| | |
| 1902 | // | | | | |
| 1903 | // | SubFail2 | | |
| 1904 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1905 | // |
| 1906 | //----------------------------------------------------------------------------- |
| 1907 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1908 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1909 | |
| 1910 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1911 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1912 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1913 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1914 | |
| 1915 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1916 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1917 | |
| 1918 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1919 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1920 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1921 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1922 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1923 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1924 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1925 | // E2t: send SubsFail (first) |
| 1926 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1927 | fparams1.Set(crereq1) |
| 1928 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1929 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1930 | // E2t: internal delete |
| 1931 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1932 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1933 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1934 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1935 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1936 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1937 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1938 | |
| 1939 | //Wait that subs is cleaned |
| 1940 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1941 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1942 | xappConn1.TestMsgChanEmpty(t) |
| 1943 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1944 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1945 | mainCtrl.wait_registry_empty(t, 10) |
| 1946 | } |
| 1947 | |
| 1948 | //----------------------------------------------------------------------------- |
| 1949 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1950 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1951 | // stub stub stub |
| 1952 | // +-------+ +-------+ +---------+ +---------+ |
| 1953 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1954 | // +-------+ +-------+ +---------+ +---------+ |
| 1955 | // | | | | |
| 1956 | // | | | | |
| 1957 | // | | | | |
| 1958 | // | | SubReq1 | | |
| 1959 | // | |------------->| | |
| 1960 | // | | | | |
| 1961 | // | | | SubReq1 | |
| 1962 | // | | |------------->| |
| 1963 | // | | SubReq2 | | |
| 1964 | // |--------------------------->| | |
| 1965 | // | | | | |
| 1966 | // | | | SubReq1 | |
| 1967 | // | | |------------->| |
| 1968 | // | | | | |
| 1969 | // | | | | |
| 1970 | // | | | SubDelReq | |
| 1971 | // | | |------------->| |
| 1972 | // | | | | |
| 1973 | // | | | SubDelResp | |
| 1974 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1975 | // |
| 1976 | //----------------------------------------------------------------------------- |
| 1977 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1978 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1979 | |
| 1980 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1981 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1982 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1983 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1984 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1985 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1986 | |
| 1987 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1988 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1989 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1990 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1991 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1992 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1993 | |
| 1994 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1995 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1996 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1997 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1998 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1999 | |
| 2000 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2001 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2002 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2003 | xappConn1.TestMsgChanEmpty(t) |
| 2004 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2005 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2006 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2007 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2008 | |
| 2009 | //----------------------------- Policy cases --------------------------------- |
| 2010 | //----------------------------------------------------------------------------- |
| 2011 | // TestSubReqPolicyAndSubDelOk |
| 2012 | // |
| 2013 | // stub stub |
| 2014 | // +-------+ +---------+ +---------+ |
| 2015 | // | xapp | | submgr | | e2term | |
| 2016 | // +-------+ +---------+ +---------+ |
| 2017 | // | | | |
| 2018 | // | SubReq | | |
| 2019 | // |------------->| | |
| 2020 | // | | | |
| 2021 | // | | SubReq | |
| 2022 | // | |------------->| |
| 2023 | // | | | |
| 2024 | // | | SubResp | |
| 2025 | // | |<-------------| |
| 2026 | // | | | |
| 2027 | // | SubResp | | |
| 2028 | // |<-------------| | |
| 2029 | // | | | |
| 2030 | // | | | |
| 2031 | // | SubDelReq | | |
| 2032 | // |------------->| | |
| 2033 | // | | | |
| 2034 | // | | SubDelReq | |
| 2035 | // | |------------->| |
| 2036 | // | | | |
| 2037 | // | | SubDelResp | |
| 2038 | // | |<-------------| |
| 2039 | // | | | |
| 2040 | // | SubDelResp | | |
| 2041 | // |<-------------| | |
| 2042 | // |
| 2043 | //----------------------------------------------------------------------------- |
| 2044 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2045 | CaseBegin("TestSubReqAndSubDelOk") |
| 2046 | |
| 2047 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2048 | rparams1.Init() |
| 2049 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2050 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2051 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2052 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2053 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2054 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2055 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2056 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2057 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2059 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2060 | |
| 2061 | //Wait that subs is cleaned |
| 2062 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2063 | |
| 2064 | xappConn1.TestMsgChanEmpty(t) |
| 2065 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2066 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2067 | mainCtrl.wait_registry_empty(t, 10) |
| 2068 | } |
| 2069 | |
| 2070 | //----------------------------------------------------------------------------- |
| 2071 | // TestSubReqPolicyChangeAndSubDelOk |
| 2072 | // |
| 2073 | // stub stub |
| 2074 | // +-------+ +---------+ +---------+ |
| 2075 | // | xapp | | submgr | | e2term | |
| 2076 | // +-------+ +---------+ +---------+ |
| 2077 | // | | | |
| 2078 | // | SubReq | | |
| 2079 | // |------------->| | |
| 2080 | // | | | |
| 2081 | // | | SubReq | |
| 2082 | // | |------------->| |
| 2083 | // | | | |
| 2084 | // | | SubResp | |
| 2085 | // | |<-------------| |
| 2086 | // | | | |
| 2087 | // | SubResp | | |
| 2088 | // |<-------------| | |
| 2089 | // | | | |
| 2090 | // | SubReq | | |
| 2091 | // |------------->| | |
| 2092 | // | | | |
| 2093 | // | | SubReq | |
| 2094 | // | |------------->| |
| 2095 | // | | | |
| 2096 | // | | SubResp | |
| 2097 | // | |<-------------| |
| 2098 | // | | | |
| 2099 | // | SubResp | | |
| 2100 | // |<-------------| | |
| 2101 | // | | | |
| 2102 | // | SubDelReq | | |
| 2103 | // |------------->| | |
| 2104 | // | | | |
| 2105 | // | | SubDelReq | |
| 2106 | // | |------------->| |
| 2107 | // | | | |
| 2108 | // | | SubDelResp | |
| 2109 | // | |<-------------| |
| 2110 | // | | | |
| 2111 | // | SubDelResp | | |
| 2112 | // |<-------------| | |
| 2113 | // |
| 2114 | //----------------------------------------------------------------------------- |
| 2115 | |
| 2116 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2117 | CaseBegin("TestSubReqAndSubDelOk") |
| 2118 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2119 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2120 | rparams1.Init() |
| 2121 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2122 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2123 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2124 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2125 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2126 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2127 | |
| 2128 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2129 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2130 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2131 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2132 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2133 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2134 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2135 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2136 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2138 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2139 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2140 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2141 | |
| 2142 | //Wait that subs is cleaned |
| 2143 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2144 | |
| 2145 | xappConn1.TestMsgChanEmpty(t) |
| 2146 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2147 | e2termConn1.TestMsgChanEmpty(t) |
| 2148 | mainCtrl.wait_registry_empty(t, 10) |
| 2149 | } |
| 2150 | |
| 2151 | //----------------------------------------------------------------------------- |
| 2152 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2153 | // |
| 2154 | // stub stub stub |
| 2155 | // +-------+ +---------+ +---------+ +---------+ |
| 2156 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2157 | // +-------+ +---------+ +---------+ +---------+ |
| 2158 | // | | | | |
| 2159 | // | | | | |
| 2160 | // | | | | |
| 2161 | // | SubReq1 | | | |
| 2162 | // |------------->| | | |
| 2163 | // | | | | |
| 2164 | // | | SubReq1 | | |
| 2165 | // | |------------->| | |
| 2166 | // | | | | |
| 2167 | // | SubReq2 | | | |
| 2168 | // |------------->| | | |
| 2169 | // | | | | |
| 2170 | // | | SubReq2 | | |
| 2171 | // | |---------------------------->| |
| 2172 | // | | | | |
| 2173 | // | | SubResp1 | | |
| 2174 | // | |<-------------| | |
| 2175 | // | SubResp1 | | | |
| 2176 | // |<-------------| | | |
| 2177 | // | | SubResp2 | | |
| 2178 | // | |<----------------------------| |
| 2179 | // | SubResp2 | | | |
| 2180 | // |<-------------| | | |
| 2181 | // | | | | |
| 2182 | // | [SUBS 1 DELETE] | | |
| 2183 | // | | | | |
| 2184 | // | [SUBS 2 DELETE] | | |
| 2185 | // | | | | |
| 2186 | // |
| 2187 | //----------------------------------------------------------------------------- |
| 2188 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2189 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2190 | |
| 2191 | //Req1 |
| 2192 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2193 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2194 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2195 | |
| 2196 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2197 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2198 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2199 | |
| 2200 | //Resp1 |
| 2201 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2202 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2203 | |
| 2204 | //Resp2 |
| 2205 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2206 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2207 | |
| 2208 | //Del1 |
| 2209 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2212 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2213 | //Wait that subs is cleaned |
| 2214 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2215 | |
| 2216 | //Del2 |
| 2217 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2218 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2219 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2220 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2221 | //Wait that subs is cleaned |
| 2222 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2223 | |
| 2224 | xappConn1.TestMsgChanEmpty(t) |
| 2225 | xappConn2.TestMsgChanEmpty(t) |
| 2226 | e2termConn1.TestMsgChanEmpty(t) |
| 2227 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2228 | mainCtrl.wait_registry_empty(t, 10) |
| 2229 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2230 | |
| 2231 | //----------------------------------------------------------------------------- |
| 2232 | // TestSubReqInsertAndSubDelOk |
| 2233 | // |
| 2234 | // stub stub |
| 2235 | // +-------+ +---------+ +---------+ |
| 2236 | // | xapp | | submgr | | e2term | |
| 2237 | // +-------+ +---------+ +---------+ |
| 2238 | // | | | |
| 2239 | // | SubReq | | |
| 2240 | // |------------->| | |
| 2241 | // | | | |
| 2242 | // | | SubReq | |
| 2243 | // | |------------->| |
| 2244 | // | | | |
| 2245 | // | | SubResp | |
| 2246 | // | |<-------------| |
| 2247 | // | | | |
| 2248 | // | SubResp | | |
| 2249 | // |<-------------| | |
| 2250 | // | | | |
| 2251 | // | | | |
| 2252 | // | SubDelReq | | |
| 2253 | // |------------->| | |
| 2254 | // | | | |
| 2255 | // | | SubDelReq | |
| 2256 | // | |------------->| |
| 2257 | // | | | |
| 2258 | // | | SubDelResp | |
| 2259 | // | |<-------------| |
| 2260 | // | | | |
| 2261 | // | SubDelResp | | |
| 2262 | // |<-------------| | |
| 2263 | // |
| 2264 | //----------------------------------------------------------------------------- |
| 2265 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2266 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2267 | |
| 2268 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2269 | rparams1.Init() |
| 2270 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2271 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2272 | |
| 2273 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2274 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2275 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2276 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2277 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2278 | |
| 2279 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2280 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2281 | |
| 2282 | //Wait that subs is cleaned |
| 2283 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2284 | |
| 2285 | xappConn1.TestMsgChanEmpty(t) |
| 2286 | xappConn2.TestMsgChanEmpty(t) |
| 2287 | e2termConn1.TestMsgChanEmpty(t) |
| 2288 | mainCtrl.wait_registry_empty(t, 10) |
| 2289 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2290 | |
| 2291 | //----------------------------------------------------------------------------- |
| 2292 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2293 | // |
| 2294 | // This case simulates case where xApp restarts and starts sending same |
| 2295 | // subscription requests which have already subscribed successfully |
| 2296 | |
| 2297 | // stub stub |
| 2298 | // +-------+ +---------+ +---------+ |
| 2299 | // | xapp | | submgr | | e2term | |
| 2300 | // +-------+ +---------+ +---------+ |
| 2301 | // | | | |
| 2302 | // | SubReq | | |
| 2303 | // |------------->| | |
| 2304 | // | | | |
| 2305 | // | | SubReq | |
| 2306 | // | |------------->| |
| 2307 | // | | | |
| 2308 | // | | SubResp | |
| 2309 | // | |<-------------| |
| 2310 | // | | | |
| 2311 | // | SubResp | | |
| 2312 | // |<-------------| | |
| 2313 | // | | | |
| 2314 | // | xApp restart | | |
| 2315 | // | | | |
| 2316 | // | SubReq | | |
| 2317 | // | (retrans with same xApp generated subid but diff xid) |
| 2318 | // |------------->| | |
| 2319 | // | | | |
| 2320 | // | SubResp | | |
| 2321 | // |<-------------| | |
| 2322 | // | | | |
| 2323 | // | [SUBS DELETE] | |
| 2324 | // | | | |
| 2325 | // |
| 2326 | //----------------------------------------------------------------------------- |
| 2327 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2328 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2329 | |
| 2330 | //Subs Create |
| 2331 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2332 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2333 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2334 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2335 | |
| 2336 | // xApp restart here |
| 2337 | // --> artificial delay |
| 2338 | <-time.After(1 * time.Second) |
| 2339 | |
| 2340 | //Subs Create |
| 2341 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2342 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2343 | |
| 2344 | //Subs Delete |
| 2345 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2346 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2347 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2348 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2349 | |
| 2350 | //Wait that subs is cleaned |
| 2351 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2352 | |
| 2353 | xappConn1.TestMsgChanEmpty(t) |
| 2354 | xappConn2.TestMsgChanEmpty(t) |
| 2355 | e2termConn1.TestMsgChanEmpty(t) |
| 2356 | mainCtrl.wait_registry_empty(t, 10) |
| 2357 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2358 | |
| 2359 | //----------------------------------------------------------------------------- |
| 2360 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2361 | // |
| 2362 | // stub stub |
| 2363 | // +-------+ +---------+ +---------+ |
| 2364 | // | xapp | | submgr | | e2term | |
| 2365 | // +-------+ +---------+ +---------+ |
| 2366 | // | | | |
| 2367 | // | SubReq | | |
| 2368 | // |------------->| | |
| 2369 | // | | | |
| 2370 | // | | SubReq | |
| 2371 | // | |------------->| |
| 2372 | // | | | |
| 2373 | // | | SubResp | |
| 2374 | // | <----| |
| 2375 | // | | |
| 2376 | // | Submgr restart | |
| 2377 | // | | |
| 2378 | // | | | |
| 2379 | // | | SubDelReq | |
| 2380 | // | |------------->| |
| 2381 | // | | | |
| 2382 | // | | SubDelResp | |
| 2383 | // | |<-------------| |
| 2384 | // | | | |
| 2385 | // |
| 2386 | //----------------------------------------------------------------------------- |
| 2387 | |
| 2388 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2389 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2390 | |
| 2391 | // Remove possible existing subscrition |
| 2392 | mainCtrl.removeExistingSubscriptions(t) |
| 2393 | |
| 2394 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2395 | xappConn1.SendSubsReq(t, nil, nil) |
| 2396 | e2termConn1.RecvSubsReq(t) |
| 2397 | mainCtrl.SetResetTestFlag(t, false) |
| 2398 | |
| 2399 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2400 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2401 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2402 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2403 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2404 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2405 | mainCtrl.SimulateRestart(t) |
| 2406 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2407 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2408 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2409 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2410 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2411 | |
| 2412 | // Wait that subs is cleaned |
| 2413 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2414 | |
| 2415 | xappConn1.TestMsgChanEmpty(t) |
| 2416 | xappConn2.TestMsgChanEmpty(t) |
| 2417 | e2termConn1.TestMsgChanEmpty(t) |
| 2418 | mainCtrl.wait_registry_empty(t, 10) |
| 2419 | } |
| 2420 | |
| 2421 | //----------------------------------------------------------------------------- |
| 2422 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2423 | // |
| 2424 | // stub stub |
| 2425 | // +-------+ +---------+ +---------+ |
| 2426 | // | xapp | | submgr | | e2term | |
| 2427 | // +-------+ +---------+ +---------+ |
| 2428 | // | | | |
| 2429 | // | SubReq | | |
| 2430 | // |------------->| | |
| 2431 | // | | | |
| 2432 | // | | SubReq | |
| 2433 | // | |------------->| |
| 2434 | // | | | |
| 2435 | // | | SubResp | |
| 2436 | // | |<-------------| |
| 2437 | // | | | |
| 2438 | // | SubResp | | |
| 2439 | // |<-------------| | |
| 2440 | // | | | |
| 2441 | // | | |
| 2442 | // | Submgr restart | |
| 2443 | // | | |
| 2444 | // | SubDelReq | | |
| 2445 | // |------------->| | |
| 2446 | // | | | |
| 2447 | // | | SubDelReq | |
| 2448 | // | |------------->| |
| 2449 | // | | | |
| 2450 | // | | SubDelResp | |
| 2451 | // | |<-------------| |
| 2452 | // | | | |
| 2453 | // | SubDelResp | | |
| 2454 | // |<-------------| | |
| 2455 | // |
| 2456 | //----------------------------------------------------------------------------- |
| 2457 | |
| 2458 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2459 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2460 | |
| 2461 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2462 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2463 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2464 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2465 | |
| 2466 | // Check subscription |
| 2467 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2468 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2469 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2470 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2471 | |
| 2472 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2473 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2474 | |
| 2475 | // Check that subscription is restored correctly after restart |
| 2476 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2477 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2478 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2479 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2480 | |
| 2481 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2482 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2483 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2484 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2485 | |
| 2486 | //Wait that subs is cleaned |
| 2487 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2488 | |
| 2489 | xappConn1.TestMsgChanEmpty(t) |
| 2490 | xappConn2.TestMsgChanEmpty(t) |
| 2491 | e2termConn1.TestMsgChanEmpty(t) |
| 2492 | mainCtrl.wait_registry_empty(t, 10) |
| 2493 | } |
| 2494 | |
| 2495 | //----------------------------------------------------------------------------- |
| 2496 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2497 | // |
| 2498 | // stub stub |
| 2499 | // +-------+ +-------+ +---------+ +---------+ |
| 2500 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2501 | // +-------+ +-------+ +---------+ +---------+ |
| 2502 | // | | | | |
| 2503 | // | | | | |
| 2504 | // | | | | |
| 2505 | // | | SubReq1 | | |
| 2506 | // | |------------->| | |
| 2507 | // | | | | |
| 2508 | // | | | SubReq1 | |
| 2509 | // | | |------------->| |
| 2510 | // | | | SubResp1 | |
| 2511 | // | | |<-------------| |
| 2512 | // | | SubResp1 | | |
| 2513 | // | |<-------------| | |
| 2514 | // | | | | |
| 2515 | // | | |
| 2516 | // | submgr restart | |
| 2517 | // | | |
| 2518 | // | | | | |
| 2519 | // | | | | |
| 2520 | // | SubReq2 | | |
| 2521 | // |--------------------------->| | |
| 2522 | // | | | | |
| 2523 | // | SubResp2 | | |
| 2524 | // |<---------------------------| | |
| 2525 | // | | | | |
| 2526 | // | | SubDelReq 1 | | |
| 2527 | // | |------------->| | |
| 2528 | // | | | | |
| 2529 | // | | SubDelResp 1 | | |
| 2530 | // | |<-------------| | |
| 2531 | // | | | | |
| 2532 | // | | | | |
| 2533 | // | | |
| 2534 | // | submgr restart | |
| 2535 | // | | |
| 2536 | // | | | | |
| 2537 | // | SubDelReq 2 | | |
| 2538 | // |--------------------------->| | |
| 2539 | // | | | | |
| 2540 | // | | | SubDelReq 2 | |
| 2541 | // | | |------------->| |
| 2542 | // | | | | |
| 2543 | // | | | SubDelReq 2 | |
| 2544 | // | | |------------->| |
| 2545 | // | | | | |
| 2546 | // | SubDelResp 2 | | |
| 2547 | // |<---------------------------| | |
| 2548 | // |
| 2549 | //----------------------------------------------------------------------------- |
| 2550 | |
| 2551 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2552 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2553 | |
| 2554 | //Req1 |
| 2555 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2556 | rparams1.Init() |
| 2557 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2558 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2559 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2560 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2561 | |
| 2562 | //Req2 |
| 2563 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2564 | rparams2.Init() |
| 2565 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2566 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2567 | |
| 2568 | // Check subscription |
| 2569 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2570 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2571 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2572 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2573 | |
| 2574 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2575 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2576 | |
| 2577 | // Check that subscription is restored correctly after restart |
| 2578 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2579 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2580 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2581 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2582 | |
| 2583 | //Del1 |
| 2584 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2585 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2586 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2587 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2588 | |
| 2589 | mainCtrl.SimulateRestart(t) |
| 2590 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2591 | |
| 2592 | //Del2 |
| 2593 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2594 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2595 | |
| 2596 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2597 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2598 | |
| 2599 | //Wait that subs is cleaned |
| 2600 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2601 | |
| 2602 | xappConn1.TestMsgChanEmpty(t) |
| 2603 | xappConn2.TestMsgChanEmpty(t) |
| 2604 | e2termConn1.TestMsgChanEmpty(t) |
| 2605 | mainCtrl.wait_registry_empty(t, 10) |
| 2606 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2607 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2608 | //***************************************************************************** |
| 2609 | // REST interface test cases |
| 2610 | //***************************************************************************** |
| 2611 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2612 | //----------------------------------------------------------------------------- |
| 2613 | // Test debug GET and POST requests |
| 2614 | // |
| 2615 | // curl |
| 2616 | // +-------+ +---------+ |
| 2617 | // | user | | submgr | |
| 2618 | // +-------+ +---------+ |
| 2619 | // | | |
| 2620 | // | GET/POST Req | |
| 2621 | // |------------->| |
| 2622 | // | Resp | |
| 2623 | // |<-------------| |
| 2624 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2625 | func TestGetSubscriptions(t *testing.T) { |
| 2626 | |
| 2627 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2628 | } |
| 2629 | |
| 2630 | func TestGetSymptomData(t *testing.T) { |
| 2631 | |
| 2632 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2633 | } |
| 2634 | |
| 2635 | func TestPostdeleteSubId(t *testing.T) { |
| 2636 | |
| 2637 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2638 | } |
| 2639 | |
| 2640 | func TestPostEmptyDb(t *testing.T) { |
| 2641 | |
| 2642 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2643 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2644 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2645 | func TestGetRestSubscriptions(t *testing.T) { |
| 2646 | |
| 2647 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2648 | } |
| 2649 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2650 | //----------------------------------------------------------------------------- |
| 2651 | // TestRESTSubReqAndRouteNok |
| 2652 | // |
| 2653 | // stub stub |
| 2654 | // +-------+ +---------+ +---------+ |
| 2655 | // | xapp | | submgr | | rtmgr | |
| 2656 | // +-------+ +---------+ +---------+ |
| 2657 | // | | | |
| 2658 | // | RESTSubReq | | |
| 2659 | // |---------------->| | |
| 2660 | // | | | |
| 2661 | // | RESTSubResp | | |
| 2662 | // |<----------------| | |
| 2663 | // | | RouteCreate | |
| 2664 | // | |------------->| |
| 2665 | // | | | |
| 2666 | // | | RouteCreate | |
| 2667 | // | | status:400 | |
| 2668 | // | |(Bad request) | |
| 2669 | // | |<-------------| |
| 2670 | // | RESTNotif | | |
| 2671 | // |<----------------| | |
| 2672 | // | | | |
| 2673 | // | [SUBS INT DELETE] | |
| 2674 | // | | | |
| 2675 | // | RESTSubDelReq | | |
| 2676 | // |---------------->| | |
| 2677 | // | RESTSubDelResp | | |
| 2678 | // |<----------------| | |
| 2679 | // |
| 2680 | //----------------------------------------------------------------------------- |
| 2681 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2682 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2683 | |
| 2684 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2685 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2686 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2687 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2688 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2689 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2690 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2691 | }) |
| 2692 | |
| 2693 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2694 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2695 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2696 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2697 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2698 | |
| 2699 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2700 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2701 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2702 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2703 | waiter.WaitResult(t) |
| 2704 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2705 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2706 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2707 | |
| 2708 | // Del |
| 2709 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2710 | |
| 2711 | // Wait that subs is cleaned |
| 2712 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2713 | waitSubsCleanup(t, e2SubsId, 10) |
| 2714 | mainCtrl.VerifyCounterValues(t) |
| 2715 | } |
| 2716 | |
| 2717 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2718 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2719 | |
| 2720 | //Init counter check |
| 2721 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2722 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2723 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2724 | Counter{cSubReqToE2, 1}, |
| 2725 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2726 | Counter{cRestSubNotifToXapp, 1}, |
| 2727 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2728 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2729 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2730 | Counter{cSubDelReqToE2, 1}, |
| 2731 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2732 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2733 | }) |
| 2734 | |
| 2735 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2736 | |
| 2737 | //Subs Create |
| 2738 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2739 | |
| 2740 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2741 | |
| 2742 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2743 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2744 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2745 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2746 | params.SetMeid("RAN_NAME_1") |
| 2747 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2748 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2749 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2750 | waiter.WaitResult(t) |
| 2751 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2752 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2753 | |
| 2754 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2755 | |
| 2756 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2757 | |
| 2758 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2759 | //Wait that subs is cleaned |
| 2760 | waitSubsCleanup(t, e2SubsId, 10) |
| 2761 | |
| 2762 | mainCtrl.VerifyCounterValues(t) |
| 2763 | } |
| 2764 | |
| 2765 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2766 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2767 | |
| 2768 | // Init counter check |
| 2769 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2770 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2771 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2772 | Counter{cSubReqToE2, 1}, |
| 2773 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2774 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2775 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2776 | Counter{cRouteDeleteFail, 1}, |
| 2777 | Counter{cSubDelReqToE2, 1}, |
| 2778 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2779 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2780 | }) |
| 2781 | |
| 2782 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2783 | |
| 2784 | //Subs Create |
| 2785 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2786 | |
| 2787 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2788 | |
| 2789 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2790 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2791 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2792 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2793 | waiter.WaitResult(t) |
| 2794 | |
| 2795 | waitSubsCleanup(t, e2SubsId, 10) |
| 2796 | |
| 2797 | mainCtrl.VerifyCounterValues(t) |
| 2798 | } |
| 2799 | |
| 2800 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2801 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2802 | |
| 2803 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2804 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2805 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2806 | Counter{cSubReqToE2, 1}, |
| 2807 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2808 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2809 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2810 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2811 | Counter{cSubDelReqToE2, 1}, |
| 2812 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2813 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2814 | }) |
| 2815 | |
| 2816 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2817 | |
| 2818 | //Subs Create |
| 2819 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2820 | |
| 2821 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2822 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2823 | |
| 2824 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2825 | |
| 2826 | //Del1, this shall fail on rtmgr side |
| 2827 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2828 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2829 | waiter.WaitResult(t) |
| 2830 | |
| 2831 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2832 | |
| 2833 | //Del2 |
| 2834 | deleteXapp2Subscription(t, &restSubId2) |
| 2835 | |
| 2836 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2837 | |
| 2838 | mainCtrl.VerifyCounterValues(t) |
| 2839 | } |
| 2840 | |
| 2841 | //----------------------------------------------------------------------------- |
| 2842 | // TestRESTSubReqRetransmission |
| 2843 | // |
| 2844 | // stub stub |
| 2845 | // +-------+ +---------+ +---------+ |
| 2846 | // | xapp | | submgr | | e2term | |
| 2847 | // +-------+ +---------+ +---------+ |
| 2848 | // | | | |
| 2849 | // | RESTSubReq1 | | |
| 2850 | // |---------------->| | |
| 2851 | // | | | |
| 2852 | // | RESTSubResp | | |
| 2853 | // |<----------------| | |
| 2854 | // | | SubReq1 | |
| 2855 | // | |------------->| |
| 2856 | // | | | |
| 2857 | // | RESTSubReq2 | | |
| 2858 | // | (retrans) | | |
| 2859 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2860 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2861 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2862 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2863 | // | | SubResp1 | |
| 2864 | // | |<-------------| |
| 2865 | // | RESTNotif1 | | |
| 2866 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2867 | // | | | |
| 2868 | // | [SUBS DELETE] | |
| 2869 | // | | | |
| 2870 | // |
| 2871 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2872 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2873 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2874 | CaseBegin("TestRESTSubReqRetransmission") |
| 2875 | |
| 2876 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2877 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2878 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2879 | Counter{cSubReqToE2, 1}, |
| 2880 | Counter{cSubRespFromE2, 1}, |
| 2881 | Counter{cRestSubNotifToXapp, 1}, |
| 2882 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2883 | Counter{cSubDelReqToE2, 1}, |
| 2884 | Counter{cSubDelRespFromE2, 1}, |
| 2885 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2886 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2887 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2888 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2889 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2890 | |
| 2891 | // Subs Create |
| 2892 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2893 | |
| 2894 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2895 | // gets into execution before the rtmgrg responds for the first one. |
| 2896 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2897 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2898 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2899 | xappConn2.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2900 | |
| 2901 | waiter.WaitResult(t) |
| 2902 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2903 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2904 | |
| 2905 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2906 | // the order is not significant he6re. |
| 2907 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2908 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2909 | |
| 2910 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2911 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2912 | |
| 2913 | // Del1 |
| 2914 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2915 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2916 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2917 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2918 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2919 | |
| 2920 | mainCtrl.VerifyCounterValues(t) |
| 2921 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2922 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2923 | //----------------------------------------------------------------------------- |
| 2924 | // stub stub stub |
| 2925 | // +-------+ +---------+ +---------+ +---------+ |
| 2926 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2927 | // +-------+ +---------+ +---------+ +---------+ |
| 2928 | // | | | | |
| 2929 | // | RESTSubReq | | | |
| 2930 | // |---------------->| | | |
| 2931 | // | RESTSubResp | | | |
| 2932 | // |<----------------| | | |
| 2933 | // | | RouteCreate | | |
| 2934 | // | |--------------------------->| |
| 2935 | // | | RouteResponse| | |
| 2936 | // | |<---------------------------| // The order of these events may vary |
| 2937 | // | | SubReq | | |
| 2938 | // | |------------->| | // The order of these events may vary |
| 2939 | // | | SubResp | | |
| 2940 | // | |<-------------| | |
| 2941 | // | RESTNotif1 | | | |
| 2942 | // |<----------------| | | |
| 2943 | // | RESTSubReq | | | |
| 2944 | // | [RETRANS1] | | | |
| 2945 | // |---------------->| | | |
| 2946 | // | RESTNotif1 | | | |
| 2947 | // |<----------------| | | |
| 2948 | // | RESTSubReq | | | |
| 2949 | // | [RETRANS2] | | | |
| 2950 | // |---------------->| | | |
| 2951 | // | RESTNotif1 | | | |
| 2952 | // |<----------------| | | |
| 2953 | // | RESTSubDelReq | | | |
| 2954 | // |---------------->| | | |
| 2955 | // | | SubDelReq | | |
| 2956 | // | |------------->| | |
| 2957 | // | RESTSubDelResp| | | |
| 2958 | // |<----------------| | | |
| 2959 | // | | SubDelResp | | |
| 2960 | // | |<-------------| | |
| 2961 | // | | | | |
| 2962 | // |
| 2963 | //----------------------------------------------------------------------------- |
| 2964 | |
| 2965 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2966 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2967 | |
| 2968 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2969 | Counter{cRestSubReqFromXapp, 3}, |
| 2970 | Counter{cRestSubRespToXapp, 3}, |
| 2971 | Counter{cSubReqToE2, 1}, |
| 2972 | Counter{cSubRespFromE2, 1}, |
| 2973 | Counter{cRestSubNotifToXapp, 3}, |
| 2974 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2975 | Counter{cSubDelReqToE2, 1}, |
| 2976 | Counter{cSubDelRespFromE2, 1}, |
| 2977 | Counter{cRestSubDelRespToXapp, 1}, |
| 2978 | }) |
| 2979 | |
| 2980 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2981 | |
| 2982 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2983 | |
| 2984 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2985 | |
| 2986 | //1.st resend |
| 2987 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2988 | |
| 2989 | assert.Equal(t, restSubId_resend, restSubId) |
| 2990 | |
| 2991 | <-time.After(100 * time.Millisecond) |
| 2992 | |
| 2993 | //2.nd resend |
| 2994 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2995 | |
| 2996 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2997 | |
| 2998 | <-time.After(100 * time.Millisecond) |
| 2999 | |
| 3000 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3001 | |
| 3002 | waitSubsCleanup(t, e2SubsId, 10) |
| 3003 | |
| 3004 | //Wait that subs is cleaned |
| 3005 | mainCtrl.VerifyCounterValues(t) |
| 3006 | } |
| 3007 | |
| 3008 | //----------------------------------------------------------------------------- |
| 3009 | // stub stub stub |
| 3010 | // +-------+ +---------+ +---------+ +---------+ |
| 3011 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3012 | // +-------+ +---------+ +---------+ +---------+ |
| 3013 | // | | | | |
| 3014 | // | RESTSubReq | | | |
| 3015 | // |---------------->| | | |
| 3016 | // | RESTSubResp | | | |
| 3017 | // |<----------------| | | |
| 3018 | // | | RouteCreate | | |
| 3019 | // | |--------------------------->| |
| 3020 | // | | RouteResponse| | |
| 3021 | // | |<---------------------------| // The order of these events may vary |
| 3022 | // | | SubReq | | |
| 3023 | // | |------------->| | // The order of these events may vary |
| 3024 | // | | SubResp | | |
| 3025 | // | |<-------------| | |
| 3026 | // | RESTNotif1 | | | |
| 3027 | // |<----------------| | | |
| 3028 | // | RESTSubReq | | | |
| 3029 | // | [RETRANS, with RESTsubsId] | | |
| 3030 | // |---------------->| | | |
| 3031 | // | RESTNotif1 | | | |
| 3032 | // |<----------------| | | |
| 3033 | // | RESTSubReq | | | |
| 3034 | // | [RETRANS, without RESTsubsId] | | |
| 3035 | // |---------------->| | | |
| 3036 | // | RESTNotif1 | | | |
| 3037 | // |<----------------| | | |
| 3038 | // | RESTSubDelReq | | | |
| 3039 | // |---------------->| | | |
| 3040 | // | | SubDelReq | | |
| 3041 | // | |------------->| | |
| 3042 | // | RESTSubDelResp| | | |
| 3043 | // |<----------------| | | |
| 3044 | // | | SubDelResp | | |
| 3045 | // | |<-------------| | |
| 3046 | // | | | | |
| 3047 | // |
| 3048 | //----------------------------------------------------------------------------- |
| 3049 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3050 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3051 | |
| 3052 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3053 | Counter{cRestSubReqFromXapp, 3}, |
| 3054 | Counter{cRestSubRespToXapp, 3}, |
| 3055 | Counter{cSubReqToE2, 1}, |
| 3056 | Counter{cSubRespFromE2, 1}, |
| 3057 | Counter{cRestSubNotifToXapp, 3}, |
| 3058 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3059 | Counter{cSubDelReqToE2, 1}, |
| 3060 | Counter{cSubDelRespFromE2, 1}, |
| 3061 | Counter{cRestSubDelRespToXapp, 1}, |
| 3062 | }) |
| 3063 | |
| 3064 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3065 | |
| 3066 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3067 | |
| 3068 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3069 | |
| 3070 | <-time.After(100 * time.Millisecond) |
| 3071 | |
| 3072 | //1.st resend with subscription ID |
| 3073 | params.SetSubscriptionID(&restSubId) |
| 3074 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3075 | |
| 3076 | assert.Equal(t, restSubId_resend, restSubId) |
| 3077 | |
| 3078 | <-time.After(100 * time.Millisecond) |
| 3079 | |
| 3080 | //2.nd resend without subscription ID (faking app restart) |
| 3081 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3082 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3083 | |
| 3084 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3085 | |
| 3086 | <-time.After(100 * time.Millisecond) |
| 3087 | |
| 3088 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3089 | |
| 3090 | waitSubsCleanup(t, e2SubsId, 10) |
| 3091 | |
| 3092 | //Wait that subs is cleaned |
| 3093 | mainCtrl.VerifyCounterValues(t) |
| 3094 | } |
| 3095 | |
| 3096 | //----------------------------------------------------------------------------- |
| 3097 | // stub stub stub |
| 3098 | // +-------+ +---------+ +---------+ +---------+ |
| 3099 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3100 | // +-------+ +---------+ +---------+ +---------+ |
| 3101 | // | | | | |
| 3102 | // | RESTSubReq | | | |
| 3103 | // |---------------->| | | |
| 3104 | // | RESTSubResp | | | |
| 3105 | // |<----------------| | | |
| 3106 | // | | RouteCreate | | |
| 3107 | // | |--------------------------->| |
| 3108 | // | | RouteResponse| | |
| 3109 | // | |<---------------------------| |
| 3110 | // | | SubReq | | |
| 3111 | // | |------------->| | |
| 3112 | // | | SubResp | | |
| 3113 | // | |<-------------| | |
| 3114 | // | RESTNotif1 | | | |
| 3115 | // |<----------------| | | |
| 3116 | // | RESTSubReq | | | |
| 3117 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3118 | // |---------------->| | | |
| 3119 | // | RESTNotif1 | | | |
| 3120 | // | [for initial e2 subDetail] | | |
| 3121 | // |<----------------| | | |
| 3122 | // | | RouteCreate | | |
| 3123 | // | |--------------------------->| |
| 3124 | // | | RouteResponse| | |
| 3125 | // | |<---------------------------| |
| 3126 | // | | SubReq | | |
| 3127 | // | |------------->| | |
| 3128 | // | | SubResp | | |
| 3129 | // | |<-------------| | |
| 3130 | // | RESTNotif1 | | | |
| 3131 | // |<----------------| | | |
| 3132 | // | RESTSubReq | | | |
| 3133 | // | [with RESTsubsId initial request] | |
| 3134 | // |---------------->| | | |
| 3135 | // | RESTNotif1 | | | |
| 3136 | // |<----------------| | | |
| 3137 | // | RESTSubDelReq | | | |
| 3138 | // |---------------->| | | |
| 3139 | // | RESTSubDelResp| | | |
| 3140 | // |<----------------| | | |
| 3141 | // | | SubDelReq | | |
| 3142 | // | |------------->| | |
| 3143 | // | | SubDelResp | | |
| 3144 | // | |<-------------| | |
| 3145 | // | | SubDelReq | | |
| 3146 | // | |------------->| | |
| 3147 | // | | SubDelResp | | |
| 3148 | // | |<-------------| | |
| 3149 | // | | | | |
| 3150 | // |
| 3151 | //----------------------------------------------------------------------------- |
| 3152 | |
| 3153 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3154 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3155 | |
| 3156 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3157 | Counter{cRestSubReqFromXapp, 3}, |
| 3158 | Counter{cRestSubRespToXapp, 3}, |
| 3159 | Counter{cSubReqToE2, 2}, |
| 3160 | Counter{cSubRespFromE2, 2}, |
| 3161 | Counter{cRestSubNotifToXapp, 4}, |
| 3162 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3163 | Counter{cSubDelReqToE2, 2}, |
| 3164 | Counter{cSubDelRespFromE2, 2}, |
| 3165 | Counter{cRestSubDelRespToXapp, 1}, |
| 3166 | }) |
| 3167 | |
| 3168 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3169 | |
| 3170 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3171 | |
| 3172 | <-time.After(100 * time.Millisecond) |
| 3173 | |
| 3174 | // Send modified requst, this time with e2 subscriptions. |
| 3175 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3176 | params2.SetSubscriptionID(&restSubId) |
| 3177 | |
| 3178 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3179 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3180 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3181 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3182 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3183 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3184 | |
| 3185 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3186 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3187 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3188 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3189 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3190 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3191 | assert.NotEqual(t, e2SubsId2, 0) |
| 3192 | |
| 3193 | <-time.After(100 * time.Millisecond) |
| 3194 | |
| 3195 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3196 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3197 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3198 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3199 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3200 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3201 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3202 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3203 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3204 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3205 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3206 | // Delete both e2 subscriptions |
| 3207 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3208 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3209 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3210 | |
| 3211 | waitSubsCleanup(t, e2SubsId, 10) |
| 3212 | |
| 3213 | //Wait that subs is cleaned |
| 3214 | mainCtrl.VerifyCounterValues(t) |
| 3215 | } |
| 3216 | |
| 3217 | //----------------------------------------------------------------------------- |
| 3218 | // stub stub stub |
| 3219 | // +-------+ +---------+ +---------+ +---------+ |
| 3220 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3221 | // +-------+ +---------+ +---------+ +---------+ |
| 3222 | // | | | | |
| 3223 | // | RESTSubReq | | | |
| 3224 | // |---------------->| | | |
| 3225 | // | RESTSubResp | | | |
| 3226 | // |<----------------| | | |
| 3227 | // | | RouteCreate | | |
| 3228 | // | |--------------------------->| |
| 3229 | // | | RouteResponse| | |
| 3230 | // | |<---------------------------| |
| 3231 | // | | SubReq | | |
| 3232 | // | |------------->| | |
| 3233 | // | | SubResp | | |
| 3234 | // | |<-------------| | |
| 3235 | // | RESTNotif1 | | | |
| 3236 | // |<----------------| | | |
| 3237 | // | RESTSubReq | | | |
| 3238 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3239 | // |---------------->| | | |
| 3240 | // | RESTNotif1 | | | |
| 3241 | // | [for initial e2 subDetail] | | |
| 3242 | // |<----------------| | | |
| 3243 | // | | RouteCreate | | |
| 3244 | // | |--------------------------->| |
| 3245 | // | | RouteResponse| | |
| 3246 | // | |<---------------------------| |
| 3247 | // | | SubReq | | |
| 3248 | // | |------------->| | |
| 3249 | // | | SubResp | | |
| 3250 | // | |<-------------| | |
| 3251 | // | RESTNotif1 | | | |
| 3252 | // |<----------------| | | |
| 3253 | // | RESTSubReq | | | |
| 3254 | // | [without RESTsubsId initial request] | |
| 3255 | // |---------------->| | | |
| 3256 | // | RESTNotif1 | | | |
| 3257 | // |<----------------| | | |
| 3258 | // | RESTSubDelReq | | | |
| 3259 | // |---------------->| | | |
| 3260 | // | RESTSubDelResp| | | |
| 3261 | // |<----------------| | | |
| 3262 | // | | SubDelReq | | |
| 3263 | // | |------------->| | |
| 3264 | // | | SubDelResp | | |
| 3265 | // | |<-------------| | |
| 3266 | // | | SubDelReq | | |
| 3267 | // | |------------->| | |
| 3268 | // | | SubDelResp | | |
| 3269 | // | |<-------------| | |
| 3270 | // | | | | |
| 3271 | // |
| 3272 | //----------------------------------------------------------------------------- |
| 3273 | |
| 3274 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3275 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3276 | |
| 3277 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3278 | Counter{cRestSubReqFromXapp, 3}, |
| 3279 | Counter{cRestSubRespToXapp, 3}, |
| 3280 | Counter{cSubReqToE2, 2}, |
| 3281 | Counter{cSubRespFromE2, 2}, |
| 3282 | Counter{cRestSubNotifToXapp, 4}, |
| 3283 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3284 | Counter{cSubDelReqToE2, 2}, |
| 3285 | Counter{cSubDelRespFromE2, 2}, |
| 3286 | Counter{cRestSubDelRespToXapp, 1}, |
| 3287 | }) |
| 3288 | |
| 3289 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3290 | |
| 3291 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3292 | |
| 3293 | <-time.After(100 * time.Millisecond) |
| 3294 | |
| 3295 | // Send modified requst, this time with e2 subscriptions. |
| 3296 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3297 | params2.SetSubscriptionID(&restSubId) |
| 3298 | |
| 3299 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3300 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3301 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3302 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3303 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3304 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3305 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3306 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3307 | xappConn1.DecrementRequestCount() |
| 3308 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3309 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3310 | |
| 3311 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3312 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3313 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3314 | assert.NotEqual(t, e2SubsId2, 0) |
| 3315 | |
| 3316 | <-time.After(100 * time.Millisecond) |
| 3317 | |
| 3318 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3319 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3320 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3321 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3322 | // md5sum shall find the original request |
| 3323 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3324 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3325 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3326 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3327 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3328 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3329 | // Delete both e2 subscriptions |
| 3330 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3331 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3332 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3333 | |
| 3334 | waitSubsCleanup(t, e2SubsId, 10) |
| 3335 | |
| 3336 | //Wait that subs is cleaned |
| 3337 | mainCtrl.VerifyCounterValues(t) |
| 3338 | } |
| 3339 | |
| 3340 | //----------------------------------------------------------------------------- |
| 3341 | // stub stub stub |
| 3342 | // +-------+ +---------+ +---------+ +---------+ |
| 3343 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3344 | // +-------+ +---------+ +---------+ +---------+ |
| 3345 | // | | | | |
| 3346 | // | RESTSubReq | | | |
| 3347 | // |---------------->| | | |
| 3348 | // | RESTSubResp | | | |
| 3349 | // |<----------------| | | |
| 3350 | // | | RouteCreate | | |
| 3351 | // | |--------------------------->| |
| 3352 | // | | RouteResponse| | |
| 3353 | // | |<---------------------------| |
| 3354 | // | | SubReq | | |
| 3355 | // | |------------->| | |
| 3356 | // | | SubResp | | |
| 3357 | // | |<-------------| | |
| 3358 | // | RESTNotif1 | | | |
| 3359 | // |<----------------| | | |
| 3360 | // | RESTSubReq | | | |
| 3361 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3362 | // |---------------->| | | |
| 3363 | // | RESTNotif1 | | | |
| 3364 | // | [for initial e2 subDetail] | | |
| 3365 | // |<----------------| | | |
| 3366 | // | | RouteCreate | | |
| 3367 | // | |--------------------------->| |
| 3368 | // | | RouteResponse| | |
| 3369 | // | |<---------------------------| |
| 3370 | // | | SubReq | | |
| 3371 | // | |------------->| | |
| 3372 | // | | SubResp | | |
| 3373 | // | |<-------------| | |
| 3374 | // | RESTNotif1 | | | |
| 3375 | // |<----------------| | | |
| 3376 | // | RESTSubDelReq | | | |
| 3377 | // |---------------->| | | |
| 3378 | // | RESTSubDelResp| | | |
| 3379 | // |<----------------| | | |
| 3380 | // | | SubDelReq | | |
| 3381 | // | |------------->| | |
| 3382 | // | | SubDelResp | | |
| 3383 | // | |<-------------| | |
| 3384 | // | | SubDelReq | | |
| 3385 | // | |------------->| | |
| 3386 | // | | SubDelResp | | |
| 3387 | // | |<-------------| | |
| 3388 | // | RESTSubReq | | | |
| 3389 | // | [with RESTsubsId initial request] | |
| 3390 | // |---------------->| | | |
| 3391 | // | RESTSubResp | | | |
| 3392 | // |<----------------| | | |
| 3393 | // | | RouteCreate | | |
| 3394 | // | |--------------------------->| |
| 3395 | // | | RouteResponse| | |
| 3396 | // | |<---------------------------| |
| 3397 | // | | SubReq | | |
| 3398 | // | |------------->| | |
| 3399 | // | | SubResp | | |
| 3400 | // | |<-------------| | |
| 3401 | // | RESTNotif1 | | | |
| 3402 | // |<----------------| | | |
| 3403 | // | | | | |
| 3404 | // |
| 3405 | //----------------------------------------------------------------------------- |
| 3406 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3407 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3408 | |
| 3409 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3410 | Counter{cRestSubReqFromXapp, 3}, |
| 3411 | Counter{cRestSubRespToXapp, 3}, |
| 3412 | Counter{cSubReqToE2, 3}, |
| 3413 | Counter{cSubRespFromE2, 3}, |
| 3414 | Counter{cRestSubNotifToXapp, 4}, |
| 3415 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3416 | Counter{cSubDelReqToE2, 3}, |
| 3417 | Counter{cSubDelRespFromE2, 3}, |
| 3418 | Counter{cRestSubDelRespToXapp, 2}, |
| 3419 | }) |
| 3420 | |
| 3421 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3422 | |
| 3423 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3424 | |
| 3425 | <-time.After(100 * time.Millisecond) |
| 3426 | |
| 3427 | // Send modified requst, this time with e2 subscriptions. |
| 3428 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3429 | params2.SetSubscriptionID(&restSubId) |
| 3430 | |
| 3431 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3432 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3433 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3434 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3435 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3436 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3437 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3438 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3439 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3440 | |
| 3441 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3442 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3443 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3444 | assert.NotEqual(t, e2SubsId2, 0) |
| 3445 | |
| 3446 | <-time.After(100 * time.Millisecond) |
| 3447 | |
| 3448 | // Delete both e2 subscriptions |
| 3449 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3450 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3451 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3452 | |
| 3453 | waitSubsCleanup(t, e2SubsId, 10) |
| 3454 | |
| 3455 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3456 | // but the restsubscription has been already removed. This shall trigger a |
| 3457 | // fresh create. |
| 3458 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3459 | |
| 3460 | <-time.After(100 * time.Millisecond) |
| 3461 | |
| 3462 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3463 | |
| 3464 | waitSubsCleanup(t, e2SubsId, 10) |
| 3465 | |
| 3466 | //Wait that subs is cleaned |
| 3467 | mainCtrl.VerifyCounterValues(t) |
| 3468 | } |
| 3469 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3470 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3471 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3472 | |
| 3473 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3474 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3475 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3476 | Counter{cSubReqToE2, 1}, |
| 3477 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3478 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3479 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3480 | Counter{cSubDelReqToE2, 1}, |
| 3481 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3482 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3483 | }) |
| 3484 | |
| 3485 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3486 | |
| 3487 | //Subs Create |
| 3488 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3489 | |
| 3490 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3491 | |
| 3492 | //Subs Delete |
| 3493 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3494 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3495 | |
| 3496 | seqBef := mainCtrl.get_msgcounter(t) |
| 3497 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3498 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3499 | |
| 3500 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3501 | |
| 3502 | waitSubsCleanup(t, e2SubsId, 10) |
| 3503 | |
| 3504 | mainCtrl.VerifyCounterValues(t) |
| 3505 | } |
| 3506 | |
| 3507 | //----------------------------------------------------------------------------- |
| 3508 | // TestRESTSubReqDelReq |
| 3509 | // |
| 3510 | // stub stub |
| 3511 | // +-------+ +---------+ +---------+ |
| 3512 | // | xapp | | submgr | | e2term | |
| 3513 | // +-------+ +---------+ +---------+ |
| 3514 | // | | | |
| 3515 | // | RESTSubReq | | |
| 3516 | // |---------------->| | |
| 3517 | // | | | |
| 3518 | // | RESTSubResp | | |
| 3519 | // |<----------------| | |
| 3520 | // | | SubReq | |
| 3521 | // | |------------->| |
| 3522 | // | RESTSubDelReq | | |
| 3523 | // |---------------->| | |
| 3524 | // | RESTSubDelResp | | |
| 3525 | // | unsuccess | | |
| 3526 | // |<----------------| | |
| 3527 | // | | SubResp | |
| 3528 | // | |<-------------| |
| 3529 | // | RESTNotif1 | | |
| 3530 | // |<----------------| | |
| 3531 | // | | | |
| 3532 | // | [SUBS DELETE] | |
| 3533 | // | | | |
| 3534 | // |
| 3535 | //----------------------------------------------------------------------------- |
| 3536 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3537 | CaseBegin("TestRESTSubReqDelReq") |
| 3538 | |
| 3539 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3540 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3541 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3542 | Counter{cSubReqToE2, 1}, |
| 3543 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3544 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3545 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3546 | Counter{cSubDelReqToE2, 1}, |
| 3547 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3548 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3549 | }) |
| 3550 | |
| 3551 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3552 | |
| 3553 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3554 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3555 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3556 | |
| 3557 | // Del. This will fail as processing of the subscription |
| 3558 | // is still ongoing in submgr. Deletion is not allowed before |
| 3559 | // subscription creation has been completed. |
| 3560 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3561 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3562 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3563 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3564 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3565 | |
| 3566 | // Retry del |
| 3567 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3568 | |
| 3569 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3570 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3571 | |
| 3572 | // Wait that subs is cleaned |
| 3573 | waitSubsCleanup(t, e2SubsId, 10) |
| 3574 | mainCtrl.VerifyCounterValues(t) |
| 3575 | |
| 3576 | } |
| 3577 | |
| 3578 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3579 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3580 | } |
| 3581 | |
| 3582 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3583 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3584 | |
| 3585 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3586 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3587 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3588 | Counter{cSubReqToE2, 2}, |
| 3589 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3590 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3591 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3592 | Counter{cSubDelReqToE2, 2}, |
| 3593 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3594 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3595 | }) |
| 3596 | |
| 3597 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3598 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3599 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3600 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3601 | |
| 3602 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3603 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3604 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3605 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3606 | |
| 3607 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3608 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3609 | |
| 3610 | //XappConn1 receives both of the responses |
| 3611 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3612 | |
| 3613 | //Resp1 |
| 3614 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3615 | //Resp2 |
| 3616 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3617 | |
| 3618 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3619 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3620 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3621 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3622 | |
| 3623 | //Del1 |
| 3624 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3625 | //Del2 |
| 3626 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3627 | |
| 3628 | //Wait that subs is cleaned |
| 3629 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3630 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3631 | |
| 3632 | mainCtrl.VerifyCounterValues(t) |
| 3633 | |
| 3634 | } |
| 3635 | |
| 3636 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3637 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3638 | |
| 3639 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3640 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3641 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3642 | Counter{cSubReqToE2, 2}, |
| 3643 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3644 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3645 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3646 | Counter{cSubDelReqToE2, 2}, |
| 3647 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3648 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3649 | }) |
| 3650 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3651 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3652 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3653 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3654 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3655 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3656 | params.SetMeid("RAN_NAME_2") |
| 3657 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3658 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3659 | |
| 3660 | //Del1 |
| 3661 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3662 | //Del2 |
| 3663 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3664 | |
| 3665 | //Wait that subs is cleaned |
| 3666 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3667 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3668 | |
| 3669 | mainCtrl.VerifyCounterValues(t) |
| 3670 | |
| 3671 | } |
| 3672 | |
| 3673 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3674 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3675 | |
| 3676 | // Init counter check |
| 3677 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3678 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3679 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3680 | Counter{cSubReqToE2, 1}, |
| 3681 | Counter{cSubReReqToE2, 1}, |
| 3682 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3683 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3684 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3685 | Counter{cSubDelReqToE2, 1}, |
| 3686 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3687 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3688 | }) |
| 3689 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3690 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3691 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3692 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3693 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3694 | |
| 3695 | // Catch the first message and ignore it |
| 3696 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3697 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3698 | |
| 3699 | // The second request is being handled normally |
| 3700 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3701 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3702 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3703 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3704 | |
| 3705 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3706 | |
| 3707 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3708 | |
| 3709 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3710 | //Wait that subs is cleaned |
| 3711 | waitSubsCleanup(t, e2SubsId, 10) |
| 3712 | |
| 3713 | mainCtrl.VerifyCounterValues(t) |
| 3714 | |
| 3715 | } |
| 3716 | |
| 3717 | //----------------------------------------------------------------------------- |
| 3718 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3719 | // |
| 3720 | // stub stub |
| 3721 | // +-------+ +---------+ +---------+ |
| 3722 | // | xapp | | submgr | | e2term | |
| 3723 | // +-------+ +---------+ +---------+ |
| 3724 | // | | | |
| 3725 | // | RESTSubReq | | |
| 3726 | // |---------------->| | |
| 3727 | // | | | |
| 3728 | // | RESTSubResp | | |
| 3729 | // |<----------------| | |
| 3730 | // | | SubReq | |
| 3731 | // | |------------->| |
| 3732 | // | | | |
| 3733 | // | | | |
| 3734 | // | | SubReq | |
| 3735 | // | |------------->| |
| 3736 | // | | | |
| 3737 | // | | SubDelReq | |
| 3738 | // | |------------->| |
| 3739 | // | | | |
| 3740 | // | | | |
| 3741 | // | | SubDelReq | |
| 3742 | // | |------------->| |
| 3743 | // | | | |
| 3744 | // | | | |
| 3745 | // | | SubDelResp | |
| 3746 | // | |<-------------| |
| 3747 | // | RESTNotif | | |
| 3748 | // | unsuccess | | |
| 3749 | // |<----------------| | |
| 3750 | // | | | |
| 3751 | // | [SUBS DELETE] | |
| 3752 | // | | | |
| 3753 | // |
| 3754 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3755 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3756 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3757 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3758 | |
| 3759 | // Init counter check |
| 3760 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3761 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3762 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3763 | Counter{cSubReqToE2, 1}, |
| 3764 | Counter{cSubReReqToE2, 1}, |
| 3765 | Counter{cSubReqTimerExpiry, 2}, |
| 3766 | Counter{cSubDelReqToE2, 1}, |
| 3767 | Counter{cSubDelRespFromE2, 1}, |
| 3768 | }) |
| 3769 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3770 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3771 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3772 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3773 | |
| 3774 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3775 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3776 | |
| 3777 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3778 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3779 | |
| 3780 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3781 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3782 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3783 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3784 | |
| 3785 | // Wait that subs is cleaned |
| 3786 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 3787 | |
| 3788 | mainCtrl.VerifyCounterValues(t) |
| 3789 | } |
| 3790 | |
| 3791 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3792 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3793 | |
| 3794 | // Init counter check |
| 3795 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3796 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3797 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3798 | Counter{cSubReqToE2, 1}, |
| 3799 | Counter{cSubReReqToE2, 1}, |
| 3800 | Counter{cSubReqTimerExpiry, 2}, |
| 3801 | Counter{cSubDelReqToE2, 1}, |
| 3802 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3803 | }) |
| 3804 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3805 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3806 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3807 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3808 | |
| 3809 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3810 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3811 | |
| 3812 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3813 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3814 | |
| 3815 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3816 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3817 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3818 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3819 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3820 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3821 | |
| 3822 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3823 | |
| 3824 | waitSubsCleanup(t, e2SubsId, 10) |
| 3825 | |
| 3826 | mainCtrl.VerifyCounterValues(t) |
| 3827 | |
| 3828 | } |
| 3829 | |
| 3830 | //----------------------------------------------------------------------------- |
| 3831 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3832 | // |
| 3833 | // stub stub |
| 3834 | // +-------+ +---------+ +---------+ |
| 3835 | // | xapp | | submgr | | e2term | |
| 3836 | // +-------+ +---------+ +---------+ |
| 3837 | // | | | |
| 3838 | // | RESTSubReq | | |
| 3839 | // |---------------->| | |
| 3840 | // | | | |
| 3841 | // | RESTSubResp | | |
| 3842 | // |<----------------| | |
| 3843 | // | | SubReq | |
| 3844 | // | |------------->| |
| 3845 | // | | | |
| 3846 | // | | | |
| 3847 | // | | SubReq | |
| 3848 | // | |------------->| |
| 3849 | // | | | |
| 3850 | // | | SubDelReq | |
| 3851 | // | |------------->| |
| 3852 | // | | | |
| 3853 | // | | | |
| 3854 | // | | SubDelReq | |
| 3855 | // | |------------->| |
| 3856 | // | | | |
| 3857 | // | | | |
| 3858 | // | | SubDelResp | |
| 3859 | // | |<-------------| |
| 3860 | // | RESTNotif | | |
| 3861 | // | unsuccess | | |
| 3862 | // |<----------------| | |
| 3863 | // | | | |
| 3864 | // | [SUBS DELETE] | |
| 3865 | // | | | |
| 3866 | // |
| 3867 | //----------------------------------------------------------------------------- |
| 3868 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3869 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3870 | |
| 3871 | // Init counter check |
| 3872 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3873 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3874 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3875 | Counter{cSubReqToE2, 1}, |
| 3876 | Counter{cSubReReqToE2, 1}, |
| 3877 | Counter{cSubReqTimerExpiry, 2}, |
| 3878 | Counter{cSubDelReqToE2, 1}, |
| 3879 | Counter{cSubDelReReqToE2, 1}, |
| 3880 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3881 | }) |
| 3882 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3883 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3884 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3885 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3886 | |
| 3887 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3888 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3889 | |
| 3890 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3891 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3892 | |
| 3893 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3894 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3895 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3896 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3897 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3898 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3899 | |
| 3900 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3901 | |
| 3902 | waitSubsCleanup(t, e2SubsId, 10) |
| 3903 | |
| 3904 | mainCtrl.VerifyCounterValues(t) |
| 3905 | } |
| 3906 | |
| 3907 | //----------------------------------------------------------------------------- |
| 3908 | // TestRESTSubReqSubFailRespInSubmgr |
| 3909 | // |
| 3910 | // stub stub |
| 3911 | // +-------+ +---------+ +---------+ |
| 3912 | // | xapp | | submgr | | e2term | |
| 3913 | // +-------+ +---------+ +---------+ |
| 3914 | // | | | |
| 3915 | // | RESTSubReq | | |
| 3916 | // |---------------->| | |
| 3917 | // | | | |
| 3918 | // | RESTSubResp | | |
| 3919 | // |<----------------| | |
| 3920 | // | | SubReq | |
| 3921 | // | |------------->| |
| 3922 | // | | | |
| 3923 | // | | SubFail | |
| 3924 | // | |<-------------| |
| 3925 | // | | | |
| 3926 | // | | SubDelReq | |
| 3927 | // | |------------->| |
| 3928 | // | | | |
| 3929 | // | | SubDelResp | |
| 3930 | // | |<-------------| |
| 3931 | // | | | |
| 3932 | // | RESTNotif | | |
| 3933 | // | unsuccess | | |
| 3934 | // |<----------------| | |
| 3935 | // | | | |
| 3936 | // | [SUBS DELETE] | |
| 3937 | // | | | |
| 3938 | // |
| 3939 | //----------------------------------------------------------------------------- |
| 3940 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3941 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3942 | |
| 3943 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3944 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3945 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3946 | Counter{cSubReqToE2, 1}, |
| 3947 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3948 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3949 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3950 | }) |
| 3951 | |
| 3952 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3953 | const e2Timeout int64 = 2 |
| 3954 | const e2RetryCount int64 = 1 |
| 3955 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3956 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3957 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3958 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3959 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3960 | |
| 3961 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3962 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3963 | fparams1.Set(crereq1) |
| 3964 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3965 | |
| 3966 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3967 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3968 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3969 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3970 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3971 | |
| 3972 | // REST subscription sill there to be deleted |
| 3973 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3974 | |
| 3975 | // Wait that subs is cleaned |
| 3976 | waitSubsCleanup(t, e2SubsId, 10) |
| 3977 | |
| 3978 | mainCtrl.VerifyCounterValues(t) |
| 3979 | |
| 3980 | } |
| 3981 | |
| 3982 | //----------------------------------------------------------------------------- |
| 3983 | // TestRESTSubDelReqRetryInSubmgr |
| 3984 | // |
| 3985 | // stub stub |
| 3986 | // +-------+ +---------+ +---------+ |
| 3987 | // | xapp | | submgr | | e2term | |
| 3988 | // +-------+ +---------+ +---------+ |
| 3989 | // | | | |
| 3990 | // | [SUBS CREATE] | |
| 3991 | // | | | |
| 3992 | // | | | |
| 3993 | // | RESTSubDelReq | | |
| 3994 | // |---------------->| | |
| 3995 | // | | | |
| 3996 | // | RESTSubDelResp | | |
| 3997 | // |<----------------| | |
| 3998 | // | | SubDelReq | |
| 3999 | // | |------------->| |
| 4000 | // | | | |
| 4001 | // | | SubDelReq | |
| 4002 | // | |------------->| |
| 4003 | // | | | |
| 4004 | // | | SubDelResp | |
| 4005 | // | |<-------------| |
| 4006 | // | | | |
| 4007 | // |
| 4008 | //----------------------------------------------------------------------------- |
| 4009 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 4010 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 4011 | |
| 4012 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4013 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4014 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4015 | Counter{cSubReqToE2, 1}, |
| 4016 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4017 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4018 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4019 | Counter{cSubDelReqToE2, 1}, |
| 4020 | Counter{cSubDelReReqToE2, 1}, |
| 4021 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4022 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4023 | }) |
| 4024 | // Req |
| 4025 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4026 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4027 | |
| 4028 | // Del |
| 4029 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4030 | |
| 4031 | // E2t: Receive 1st SubsDelReq |
| 4032 | e2termConn1.RecvSubsDelReq(t) |
| 4033 | |
| 4034 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4035 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4036 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4037 | |
| 4038 | //Wait that subs is cleaned |
| 4039 | waitSubsCleanup(t, e2SubsId, 10) |
| 4040 | |
| 4041 | mainCtrl.VerifyCounterValues(t) |
| 4042 | } |
| 4043 | |
| 4044 | //----------------------------------------------------------------------------- |
| 4045 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4046 | // |
| 4047 | // stub stub |
| 4048 | // +-------+ +---------+ +---------+ |
| 4049 | // | xapp | | submgr | | e2term | |
| 4050 | // +-------+ +---------+ +---------+ |
| 4051 | // | | | |
| 4052 | // | [SUBS CREATE] | |
| 4053 | // | | | |
| 4054 | // | | | |
| 4055 | // | RESTSubDelReq | | |
| 4056 | // |---------------->| | |
| 4057 | // | | | |
| 4058 | // | RESTSubDelResp | | |
| 4059 | // |<----------------| | |
| 4060 | // | | SubDelReq | |
| 4061 | // | |------------->| |
| 4062 | // | | | |
| 4063 | // | | SubDelReq | |
| 4064 | // | |------------->| |
| 4065 | // | | | |
| 4066 | // | | | |
| 4067 | // |
| 4068 | //----------------------------------------------------------------------------- |
| 4069 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4070 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4071 | |
| 4072 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4073 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4074 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4075 | Counter{cSubReqToE2, 1}, |
| 4076 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4077 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4078 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4079 | Counter{cSubDelReqToE2, 1}, |
| 4080 | Counter{cSubDelReReqToE2, 1}, |
| 4081 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4082 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4083 | }) |
| 4084 | |
| 4085 | // Req |
| 4086 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4087 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4088 | |
| 4089 | // Del |
| 4090 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4091 | |
| 4092 | // E2t: Receive 1st SubsDelReq |
| 4093 | e2termConn1.RecvSubsDelReq(t) |
| 4094 | |
| 4095 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4096 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4097 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4098 | |
| 4099 | //Wait that subs is cleaned |
| 4100 | waitSubsCleanup(t, e2SubsId, 10) |
| 4101 | |
| 4102 | mainCtrl.VerifyCounterValues(t) |
| 4103 | } |
| 4104 | |
| 4105 | //----------------------------------------------------------------------------- |
| 4106 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4107 | // |
| 4108 | // stub stub |
| 4109 | // +-------+ +---------+ +---------+ |
| 4110 | // | xapp | | submgr | | e2term | |
| 4111 | // +-------+ +---------+ +---------+ |
| 4112 | // | | | |
| 4113 | // | [SUBS CREATE] | |
| 4114 | // | | | |
| 4115 | // | | | |
| 4116 | // | RESTSubDelReq | | |
| 4117 | // |---------------->| | |
| 4118 | // | | | |
| 4119 | // | RESTSubDelResp | | |
| 4120 | // |<----------------| | |
| 4121 | // | | SubDelReq | |
| 4122 | // | |------------->| |
| 4123 | // | | | |
| 4124 | // | | SubDelFail | |
| 4125 | // | |<-------------| |
| 4126 | // | | | |
| 4127 | // |
| 4128 | //----------------------------------------------------------------------------- |
| 4129 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4130 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4131 | |
| 4132 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4133 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4134 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4135 | Counter{cSubReqToE2, 1}, |
| 4136 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4137 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4138 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4139 | Counter{cSubDelReqToE2, 1}, |
| 4140 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4141 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4142 | }) |
| 4143 | |
| 4144 | // Req |
| 4145 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4146 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4147 | |
| 4148 | // Del |
| 4149 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4150 | |
| 4151 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4152 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4153 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4154 | |
| 4155 | //Wait that subs is cleaned |
| 4156 | waitSubsCleanup(t, e2SubsId, 10) |
| 4157 | |
| 4158 | mainCtrl.VerifyCounterValues(t) |
| 4159 | } |
| 4160 | |
| 4161 | //----------------------------------------------------------------------------- |
| 4162 | // TestRESTSubReqAndSubDelOkSameAction |
| 4163 | // |
| 4164 | // stub stub |
| 4165 | // +-------+ +-------+ +---------+ +---------+ |
| 4166 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4167 | // +-------+ +-------+ +---------+ +---------+ |
| 4168 | // | | | | |
| 4169 | // | | RESTSubReq1 | | |
| 4170 | // | |---------------->| | |
| 4171 | // | | | | |
| 4172 | // | | RESTSubResp1 | | |
| 4173 | // | |<----------------| | |
| 4174 | // | | | | |
| 4175 | // | | | SubReq1 | |
| 4176 | // | | |------------->| |
| 4177 | // | | | SubResp1 | |
| 4178 | // | | |<-------------| |
| 4179 | // | | RESTNotif1 | | |
| 4180 | // | |<----------------| | |
| 4181 | // | | | | |
| 4182 | // | RESTSubReq2 | | |
| 4183 | // |------------------------------>| | |
| 4184 | // | | | | |
| 4185 | // | RESTSubResp2 | | |
| 4186 | // |<------------------------------| | |
| 4187 | // | | | | |
| 4188 | // | | RESTNotif2 | | |
| 4189 | // |<------------------------------| | |
| 4190 | // | | | | |
| 4191 | // | | RESTSubDelReq1 | | |
| 4192 | // | |---------------->| | |
| 4193 | // | | | | |
| 4194 | // | | RESTSubDelResp1 | | |
| 4195 | // | |<----------------| | |
| 4196 | // | | | | |
| 4197 | // | RESTSubDelReq2 | | |
| 4198 | // |------------------------------>| | |
| 4199 | // | | | | |
| 4200 | // | RESTSubDelResp2 | | |
| 4201 | // |<------------------------------| | |
| 4202 | // | | | | |
| 4203 | // | | | SubDelReq2 | |
| 4204 | // | | |------------->| |
| 4205 | // | | | | |
| 4206 | // | | | SubDelResp2 | |
| 4207 | // | | |<-------------| |
| 4208 | // | | | | |
| 4209 | // |
| 4210 | //----------------------------------------------------------------------------- |
| 4211 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4212 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4213 | |
| 4214 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4215 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4216 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4217 | Counter{cSubReqToE2, 1}, |
| 4218 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4219 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4220 | Counter{cMergedSubscriptions, 1}, |
| 4221 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4222 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4223 | Counter{cSubDelReqToE2, 1}, |
| 4224 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4225 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4226 | }) |
| 4227 | |
| 4228 | // Req1 |
| 4229 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4230 | |
| 4231 | //Subs Create |
| 4232 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4233 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4234 | |
| 4235 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4236 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4237 | params.SetMeid("RAN_NAME_1") |
| 4238 | |
| 4239 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4240 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4241 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4242 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4243 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4244 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4245 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4246 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4247 | |
| 4248 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4249 | |
| 4250 | // Del1 |
| 4251 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4252 | |
| 4253 | // Del2 |
| 4254 | deleteXapp2Subscription(t, &restSubId2) |
| 4255 | |
| 4256 | //Wait that subs is cleaned |
| 4257 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4258 | |
| 4259 | mainCtrl.VerifyCounterValues(t) |
| 4260 | } |
| 4261 | |
| 4262 | //----------------------------------------------------------------------------- |
| 4263 | // TestSubReqAndSubDelOkSameActionParallel |
| 4264 | // |
| 4265 | // stub stub stub |
| 4266 | // +-------+ +-------+ +---------+ +---------+ |
| 4267 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4268 | // +-------+ +-------+ +---------+ +---------+ |
| 4269 | // | | | | |
| 4270 | // | | | | |
| 4271 | // | | | | |
| 4272 | // | | SubReq1 | | |
| 4273 | // | |------------->| | |
| 4274 | // | | | | |
| 4275 | // | | | SubReq1 | |
| 4276 | // | | |------------->| |
| 4277 | // | SubReq2 | | |
| 4278 | // |--------------------------->| | |
| 4279 | // | | | SubResp1 | |
| 4280 | // | | |<-------------| |
| 4281 | // | | SubResp1 | | |
| 4282 | // | |<-------------| | |
| 4283 | // | | | SubReq2 | |
| 4284 | // | | |------------->| |
| 4285 | // | | | | |
| 4286 | // | | | SubResp2 | |
| 4287 | // | | |<-------------| |
| 4288 | // | SubResp2 | | |
| 4289 | // |<---------------------------| | |
| 4290 | // | | | | |
| 4291 | // | | SubDelReq 1 | | |
| 4292 | // | |------------->| | |
| 4293 | // | | | | |
| 4294 | // | | SubDelResp 1 | | |
| 4295 | // | |<-------------| | |
| 4296 | // | | | | |
| 4297 | // | SubDelReq 2 | | |
| 4298 | // |--------------------------->| | |
| 4299 | // | | | | |
| 4300 | // | | | SubDelReq 2 | |
| 4301 | // | | |------------->| |
| 4302 | // | | | | |
| 4303 | // | | | SubDelReq 2 | |
| 4304 | // | | |------------->| |
| 4305 | // | | | | |
| 4306 | // | SubDelResp 2 | | |
| 4307 | // |<---------------------------| | |
| 4308 | // |
| 4309 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4310 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4311 | |
| 4312 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4313 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4314 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4315 | Counter{cSubReqToE2, 2}, |
| 4316 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4317 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4318 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4319 | Counter{cSubDelReqToE2, 2}, |
| 4320 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4321 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4322 | }) |
| 4323 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4324 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4325 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4326 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4327 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4328 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4329 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4330 | |
| 4331 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4332 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4333 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4334 | |
| 4335 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4336 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4337 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4338 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4339 | |
| 4340 | // Del1 |
| 4341 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4342 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4343 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4344 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4345 | |
| 4346 | // Del2 |
| 4347 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4348 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4349 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4350 | |
| 4351 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4352 | |
| 4353 | mainCtrl.VerifyCounterValues(t) |
| 4354 | } |
| 4355 | |
| 4356 | //----------------------------------------------------------------------------- |
| 4357 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4358 | // |
| 4359 | // stub stub stub |
| 4360 | // +-------+ +-------+ +---------+ +---------+ |
| 4361 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4362 | // +-------+ +-------+ +---------+ +---------+ |
| 4363 | // | | | | |
| 4364 | // | | | | |
| 4365 | // | | | | |
| 4366 | // | | RESTSubReq1 | | |
| 4367 | // | |---------------->| | |
| 4368 | // | | | | |
| 4369 | // | | RESTSubResp1 | | |
| 4370 | // | |<----------------| | |
| 4371 | // | | | SubReq1 | |
| 4372 | // | | |------------->| |
| 4373 | // | RESTSubReq2 | | |
| 4374 | // |------------------------------>| | |
| 4375 | // | | | | |
| 4376 | // | RESTSubDelResp2 | | |
| 4377 | // |<------------------------------| | |
| 4378 | // | | | SubReq1 | |
| 4379 | // | | |------------->| |
| 4380 | // | | | | |
| 4381 | // | | | | |
| 4382 | // | | | SubDelReq | |
| 4383 | // | | |------------->| |
| 4384 | // | | | | |
| 4385 | // | | | SubDelResp | |
| 4386 | // | | |<-------------| |
| 4387 | // | | RESTNotif1 | | |
| 4388 | // | | unsuccess | | |
| 4389 | // | |<----------------| | |
| 4390 | // | RESTNotif2 | | |
| 4391 | // | | unsuccess | | |
| 4392 | // |<------------------------------| | |
| 4393 | // | | | | |
| 4394 | // | | RESTSubDelReq1 | | |
| 4395 | // | |---------------->| | |
| 4396 | // | | | | |
| 4397 | // | | RESTSubDelResp1 | | |
| 4398 | // | |<----------------| | |
| 4399 | // | | | | |
| 4400 | // | RESTSubDelReq2 | | |
| 4401 | // |------------------------------>| | |
| 4402 | // | | | | |
| 4403 | // | RESTSubDelResp2 | | |
| 4404 | // |<------------------------------| | |
| 4405 | // |
| 4406 | //----------------------------------------------------------------------------- |
| 4407 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4408 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4409 | |
| 4410 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4411 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4412 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4413 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4414 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4415 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4416 | Counter{cSubDelReqToE2, 1}, |
| 4417 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4418 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4419 | }) |
| 4420 | |
| 4421 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4422 | |
| 4423 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4424 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4425 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4426 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4427 | |
| 4428 | // Req2 |
| 4429 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4430 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4431 | params2.SetMeid("RAN_NAME_1") |
| 4432 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4433 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4434 | |
| 4435 | //Req1 (retransmitted) |
| 4436 | e2termConn1.RecvSubsReq(t) |
| 4437 | |
| 4438 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4439 | |
| 4440 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4441 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4442 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4443 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4444 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4445 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4446 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4447 | |
| 4448 | // Del1 |
| 4449 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4450 | |
| 4451 | // Del2 |
| 4452 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4453 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4454 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4455 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4456 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4457 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | |
| 4459 | mainCtrl.VerifyCounterValues(t) |
| 4460 | } |
| 4461 | |
| 4462 | //----------------------------------------------------------------------------- |
| 4463 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4464 | // |
| 4465 | // stub stub stub |
| 4466 | // +-------+ +-------+ +---------+ +---------+ |
| 4467 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4468 | // +-------+ +-------+ +---------+ +---------+ |
| 4469 | // | | | | |
| 4470 | // | | | | |
| 4471 | // | | | | |
| 4472 | // | | RESTSubReq1 | | |
| 4473 | // | |---------------->| | |
| 4474 | // | | | | |
| 4475 | // | | RESTSubResp1 | | |
| 4476 | // | |<----------------| | |
| 4477 | // | | | SubReq1 | |
| 4478 | // | | |------------->| |
| 4479 | // | RESTSubReq2 | | |
| 4480 | // |------------------------------>| | |
| 4481 | // | | | | |
| 4482 | // | RESTSubDelResp2 | | |
| 4483 | // |<------------------------------| | |
| 4484 | // | | | SubFail1 | |
| 4485 | // | | |<-------------| |
| 4486 | // | | | | |
| 4487 | // | | RESTNotif1 | | |
| 4488 | // | | unsuccess | | |
| 4489 | // | |<----------------| | |
| 4490 | // | RESTNotif2 | | |
| 4491 | // | | unsuccess | | |
| 4492 | // |<------------------------------| | |
| 4493 | // | | | SubDelReq | |
| 4494 | // | | |------------->| |
| 4495 | // | | | SubDelResp | |
| 4496 | // | | |<-------------| |
| 4497 | // | | | | |
| 4498 | // | | RESTSubDelReq1 | | |
| 4499 | // | |---------------->| | |
| 4500 | // | | | | |
| 4501 | // | | RESTSubDelResp1 | | |
| 4502 | // | |<----------------| | |
| 4503 | // | | | | |
| 4504 | // | RESTSubDelReq2 | | |
| 4505 | // |------------------------------>| | |
| 4506 | // | | | | |
| 4507 | // | RESTSubDelResp2 | | |
| 4508 | // |<------------------------------| | |
| 4509 | // |
| 4510 | //----------------------------------------------------------------------------- |
| 4511 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4512 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4513 | |
| 4514 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4515 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4516 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4517 | Counter{cSubReqToE2, 1}, |
| 4518 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4519 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4520 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4521 | Counter{cSubDelReqToE2, 1}, |
| 4522 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4523 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4524 | }) |
| 4525 | |
| 4526 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4527 | |
| 4528 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4529 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4530 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4531 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4532 | |
| 4533 | // Req2 |
| 4534 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4535 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | params2.SetMeid("RAN_NAME_1") |
| 4537 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4538 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4539 | |
| 4540 | // E2t: send SubsFail (first) |
| 4541 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4542 | fparams1.Set(crereq1) |
| 4543 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4544 | |
| 4545 | // E2t: internal delete |
| 4546 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4547 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4548 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4549 | |
| 4550 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4551 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4552 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4553 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4554 | |
| 4555 | // Del1 |
| 4556 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4557 | |
| 4558 | // Del2 |
| 4559 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4560 | |
| 4561 | //Wait that subs is cleaned |
| 4562 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4563 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4564 | |
| 4565 | mainCtrl.VerifyCounterValues(t) |
| 4566 | } |
| 4567 | |
| 4568 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4569 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4570 | |
| 4571 | // Init counter check |
| 4572 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4573 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4574 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4575 | Counter{cSubReqToE2, 1}, |
| 4576 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4577 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4578 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | Counter{cSubDelReqToE2, 1}, |
| 4580 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4581 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4582 | }) |
| 4583 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4584 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4585 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4586 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4587 | |
| 4588 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4589 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4590 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4591 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4592 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4593 | |
| 4594 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4595 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4596 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4597 | |
| 4598 | // Wait that subs is cleaned |
| 4599 | waitSubsCleanup(t, e2SubsId, 10) |
| 4600 | mainCtrl.VerifyCounterValues(t) |
| 4601 | } |
| 4602 | |
| 4603 | //----------------------------------------------------------------------------- |
| 4604 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4605 | // |
| 4606 | // stub stub |
| 4607 | // +-------+ +---------+ +---------+ |
| 4608 | // | xapp | | submgr | | e2term | |
| 4609 | // +-------+ +---------+ +---------+ |
| 4610 | // | | | |
| 4611 | // | RESTSubReq | | |
| 4612 | // |---------------->| | |
| 4613 | // | | | |
| 4614 | // | RESTSubResp | | |
| 4615 | // |<----------------| | |
| 4616 | // | | SubReq | |
| 4617 | // | |------------->| |
| 4618 | // | | | |
| 4619 | // | | SubResp | |
| 4620 | // | |<-------------| |
| 4621 | // | | | |
| 4622 | // | RESTNotif | | |
| 4623 | // |<----------------| | |
| 4624 | // | | | |
| 4625 | // | RESTSubReq | | |
| 4626 | // |---------------->| | |
| 4627 | // | | | |
| 4628 | // | RESTSubResp | | |
| 4629 | // |<----------------| | |
| 4630 | // | | SubReq | |
| 4631 | // | |------------->| |
| 4632 | // | | | |
| 4633 | // | | SubResp | |
| 4634 | // | |<-------------| |
| 4635 | // | | | |
| 4636 | // | RESTNotif | | |
| 4637 | // |<----------------| | |
| 4638 | // | | | |
| 4639 | // | RESTSubDelReq | | |
| 4640 | // |---------------->| | |
| 4641 | // | | | |
| 4642 | // | | SubDelReq | |
| 4643 | // | |------------->| |
| 4644 | // | | | |
| 4645 | // | | SubDelResp | |
| 4646 | // | |<-------------| |
| 4647 | // | | | |
| 4648 | // | RESTSubDelResp | | |
| 4649 | // |<----------------| | |
| 4650 | // |
| 4651 | //----------------------------------------------------------------------------- |
| 4652 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4653 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4654 | |
| 4655 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4656 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4657 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4658 | Counter{cSubReqToE2, 2}, |
| 4659 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4660 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4661 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4662 | Counter{cSubDelReqToE2, 1}, |
| 4663 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4664 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4665 | }) |
| 4666 | |
| 4667 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4668 | const e2Timeout int64 = 1 |
| 4669 | const e2RetryCount int64 = 0 |
| 4670 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4671 | |
| 4672 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4673 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4674 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4675 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4676 | |
| 4677 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4678 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4679 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4680 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4681 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4682 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4683 | params.SetTimeToWait("w200ms") |
| 4684 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4685 | |
| 4686 | // Del |
| 4687 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4688 | |
| 4689 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4690 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4691 | |
| 4692 | // Wait that subs is cleaned |
| 4693 | waitSubsCleanup(t, e2SubsId, 10) |
| 4694 | mainCtrl.VerifyCounterValues(t) |
| 4695 | } |
| 4696 | |
| 4697 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4698 | // TestRESTSubReqPolicyChangeNOk |
| 4699 | // |
| 4700 | // stub stub |
| 4701 | // +-------+ +---------+ +---------+ |
| 4702 | // | xapp | | submgr | | e2term | |
| 4703 | // +-------+ +---------+ +---------+ |
| 4704 | // | | | |
| 4705 | // | RESTSubReq | | |
| 4706 | // |---------------->| | |
| 4707 | // | | | |
| 4708 | // | RESTSubResp | | |
| 4709 | // |<----------------| | |
| 4710 | // | | SubReq | |
| 4711 | // | |------------->| |
| 4712 | // | | | |
| 4713 | // | | SubResp | |
| 4714 | // | |<-------------| |
| 4715 | // | | | |
| 4716 | // | RESTNotif | | |
| 4717 | // |<----------------| | |
| 4718 | // | | | |
| 4719 | // | RESTSubReq | | |
| 4720 | // |---------------->| | |
| 4721 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4722 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4723 | // | | | |
| 4724 | // | RESTSubDelReq | | |
| 4725 | // |---------------->| | |
| 4726 | // | | | |
| 4727 | // | | SubDelReq | |
| 4728 | // | |------------->| |
| 4729 | // | | | |
| 4730 | // | | SubDelResp | |
| 4731 | // | |<-------------| |
| 4732 | // | | | |
| 4733 | // | RESTSubDelResp | | |
| 4734 | // |<----------------| | |
| 4735 | // |
| 4736 | //----------------------------------------------------------------------------- |
| 4737 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4738 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4739 | |
| 4740 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4741 | Counter{cRestSubReqFromXapp, 2}, |
| 4742 | Counter{cRestSubRespToXapp, 1}, |
| 4743 | Counter{cSubReqToE2, 1}, |
| 4744 | Counter{cSubRespFromE2, 1}, |
| 4745 | Counter{cRestSubNotifToXapp, 1}, |
| 4746 | Counter{cRestSubFailToXapp, 1}, |
| 4747 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4748 | Counter{cSubDelReqToE2, 1}, |
| 4749 | Counter{cSubDelRespFromE2, 1}, |
| 4750 | Counter{cRestSubDelRespToXapp, 1}, |
| 4751 | }) |
| 4752 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4753 | // Req |
| 4754 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4755 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4756 | |
| 4757 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4758 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4759 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4760 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4761 | params.SetSubscriptionID(&restSubIdUpd) |
| 4762 | params.SetTimeToWait("w200ms") |
| 4763 | |
| 4764 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4765 | assert.Equal(t, restSubId2, "") |
| 4766 | |
| 4767 | // Del |
| 4768 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4769 | |
| 4770 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4771 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4772 | |
| 4773 | // Wait that subs is cleaned |
| 4774 | waitSubsCleanup(t, e2SubsId, 10) |
| 4775 | mainCtrl.VerifyCounterValues(t) |
| 4776 | } |
| 4777 | |
| 4778 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4779 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4780 | // |
| 4781 | // stub stub stub |
| 4782 | // +-------+ +---------+ +---------+ +---------+ |
| 4783 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4784 | // +-------+ +---------+ +---------+ +---------+ |
| 4785 | // | | | | |
| 4786 | // | | | | |
| 4787 | // | | | | |
| 4788 | // | RESTSubReq1 | | | |
| 4789 | // |---------------->| | | |
| 4790 | // | | | | |
| 4791 | // | RESTSubResp1 | | | |
| 4792 | // |<----------------| | | |
| 4793 | // | | SubReq1 | | |
| 4794 | // | |------------->| | |
| 4795 | // | | | | |
| 4796 | // | RESTSubReq2 | | | |
| 4797 | // |---------------->| | | |
| 4798 | // | | | | |
| 4799 | // | RESTSubResp2 | | | |
| 4800 | // |<----------------| | | |
| 4801 | // | | SubReq2 | | |
| 4802 | // | |---------------------------->| |
| 4803 | // | | | | |
| 4804 | // | | SubResp1 | | |
| 4805 | // | |<-------------| | |
| 4806 | // | RESTNotif1 | | | |
| 4807 | // |<----------------| | | |
| 4808 | // | | SubResp2 | | |
| 4809 | // | |<----------------------------| |
| 4810 | // | RESTNotif2 | | | |
| 4811 | // |<----------------| | | |
| 4812 | // | | | | |
| 4813 | // | [SUBS 1 DELETE] | | |
| 4814 | // | | | | |
| 4815 | // | [SUBS 2 DELETE] | | |
| 4816 | // | | | | |
| 4817 | // |
| 4818 | //----------------------------------------------------------------------------- |
| 4819 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4820 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4821 | |
| 4822 | // Init counter check |
| 4823 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4824 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4825 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4826 | Counter{cSubReqToE2, 2}, |
| 4827 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4828 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4829 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4830 | Counter{cSubDelReqToE2, 2}, |
| 4831 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4832 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4833 | }) |
| 4834 | |
| 4835 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4836 | |
| 4837 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4838 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4839 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4840 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4841 | |
| 4842 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4843 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4844 | params.SetMeid("RAN_NAME_11") |
| 4845 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4846 | // would not work as notification would not be received |
| 4847 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4848 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4849 | |
| 4850 | // Resp1 |
| 4851 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4852 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4853 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4854 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4855 | |
| 4856 | // Resp2 |
| 4857 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4858 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4859 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4860 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4861 | |
| 4862 | // Delete1 |
| 4863 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4864 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4865 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4866 | |
| 4867 | // Wait that subs is cleaned |
| 4868 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4869 | |
| 4870 | // Delete2 |
| 4871 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4872 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4873 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4874 | |
| 4875 | // Wait that subs is cleaned |
| 4876 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4877 | |
| 4878 | mainCtrl.VerifyCounterValues(t) |
| 4879 | } |
| 4880 | |
| 4881 | //----------------------------------------------------------------------------- |
| 4882 | // TestRESTSubReqAsn1EncodeFail |
| 4883 | // |
| 4884 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4885 | // stub stub |
| 4886 | // +-------+ +---------+ +---------+ |
| 4887 | // | xapp | | submgr | | e2term | |
| 4888 | // +-------+ +---------+ +---------+ |
| 4889 | // | | | |
| 4890 | // | RESTSubReq | | |
| 4891 | // |---------------->| | |
| 4892 | // | | | |
| 4893 | // | RESTSubResp | | |
| 4894 | // |<----------------| | |
| 4895 | // | RESTSubDelReq | | |
| 4896 | // |---------------->| | |
| 4897 | // | RESTSubDelResp | | |
| 4898 | // | unsuccess | | |
| 4899 | // |<----------------| | |
| 4900 | // | | | |
| 4901 | // |
| 4902 | //----------------------------------------------------------------------------- |
| 4903 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4904 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4905 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4906 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4907 | |
| 4908 | } |
| 4909 | |
| 4910 | //----------------------------------------------------------------------------- |
| 4911 | // TestRESTSubReqInsertAndSubDelOk |
| 4912 | // |
| 4913 | // stub stub |
| 4914 | // +-------+ +---------+ +---------+ |
| 4915 | // | xapp | | submgr | | e2term | |
| 4916 | // +-------+ +---------+ +---------+ |
| 4917 | // | | | |
| 4918 | // | RestSubReq | | |
| 4919 | // |---------------->| | |
| 4920 | // | | | |
| 4921 | // | RESTSubResp | | |
| 4922 | // |<----------------| | |
| 4923 | // | | | |
| 4924 | // | | SubReq | |
| 4925 | // | |------------->| |
| 4926 | // | | | |
| 4927 | // | | SubResp | |
| 4928 | // | |<-------------| |
| 4929 | // | RESTNotif | | |
| 4930 | // |<----------------| | |
| 4931 | // | ... | ... | |
| 4932 | // | | | |
| 4933 | // | RESTSubDelReq | | |
| 4934 | // |---------------->| | |
| 4935 | // | | | |
| 4936 | // | | SubDelReq | |
| 4937 | // | |------------->| |
| 4938 | // | | | |
| 4939 | // | | SubDelResp | |
| 4940 | // | |<-------------| |
| 4941 | // | | | |
| 4942 | // | RESTSubDelResp| | |
| 4943 | // |<----------------| | |
| 4944 | // |
| 4945 | //----------------------------------------------------------------------------- |
| 4946 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4947 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4948 | |
| 4949 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4950 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4951 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4952 | Counter{cSubReqToE2, 1}, |
| 4953 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4954 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4955 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4956 | Counter{cSubDelReqToE2, 1}, |
| 4957 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4958 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4959 | }) |
| 4960 | |
| 4961 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4962 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4963 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4964 | params.SetSubActionTypes("insert") |
| 4965 | |
| 4966 | // Req |
| 4967 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4968 | |
| 4969 | // Del |
| 4970 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4971 | |
| 4972 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4973 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4974 | |
| 4975 | // Wait that subs is cleaned |
| 4976 | waitSubsCleanup(t, e2SubsId, 10) |
| 4977 | mainCtrl.VerifyCounterValues(t) |
| 4978 | } |
| 4979 | |
| 4980 | //----------------------------------------------------------------------------- |
| 4981 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4982 | // |
| 4983 | // stub stub |
| 4984 | // +-------+ +---------+ +---------+ |
| 4985 | // | xapp | | submgr | | e2term | |
| 4986 | // +-------+ +---------+ +---------+ |
| 4987 | // | | | |
| 4988 | // | RESTSubReq | | |
| 4989 | // |------------->| | |
| 4990 | // | | | |
| 4991 | // | | SubReq | |
| 4992 | // | |------------->| |
| 4993 | // | | | |
| 4994 | // | | SubResp | |
| 4995 | // | <----| |
| 4996 | // | | |
| 4997 | // | Submgr restart | |
| 4998 | // | | |
| 4999 | // | | | |
| 5000 | // | | SubDelReq | |
| 5001 | // | |------------->| |
| 5002 | // | | | |
| 5003 | // | | SubDelResp | |
| 5004 | // | |<-------------| |
| 5005 | // | | | |
| 5006 | // |
| 5007 | //----------------------------------------------------------------------------- |
| 5008 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5009 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 5010 | |
| 5011 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5012 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5013 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5014 | Counter{cSubReqToE2, 1}, |
| 5015 | Counter{cSubDelReqFromXapp, 1}, |
| 5016 | Counter{cSubDelReqToE2, 1}, |
| 5017 | Counter{cSubDelRespFromE2, 1}, |
| 5018 | }) |
| 5019 | |
| 5020 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5021 | |
| 5022 | // Remove possible existing subscription |
| 5023 | mainCtrl.removeExistingSubscriptions(t) |
| 5024 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5025 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5026 | |
| 5027 | //Req |
| 5028 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5029 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5030 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5031 | |
| 5032 | e2termConn1.RecvSubsReq(t) |
| 5033 | |
| 5034 | mainCtrl.SetResetTestFlag(t, false) |
| 5035 | |
| 5036 | mainCtrl.SimulateRestart(t) |
| 5037 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5038 | |
| 5039 | //Del |
| 5040 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5041 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5042 | |
| 5043 | xappConn1.TestMsgChanEmpty(t) |
| 5044 | xappConn2.TestMsgChanEmpty(t) |
| 5045 | e2termConn1.TestMsgChanEmpty(t) |
| 5046 | mainCtrl.wait_registry_empty(t, 10) |
| 5047 | |
| 5048 | mainCtrl.VerifyCounterValues(t) |
| 5049 | } |
| 5050 | |
| 5051 | //----------------------------------------------------------------------------- |
| 5052 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5053 | // |
| 5054 | // stub stub |
| 5055 | // +-------+ +---------+ +---------+ |
| 5056 | // | xapp | | submgr | | e2term | |
| 5057 | // +-------+ +---------+ +---------+ |
| 5058 | // | | | |
| 5059 | // | RESTSubReq | | |
| 5060 | // |---------------->| | |
| 5061 | // | | | |
| 5062 | // | RESTSubResp | | |
| 5063 | // |<----------------| | |
| 5064 | // | | SubReq | |
| 5065 | // | |------------->| |
| 5066 | // | | | |
| 5067 | // | | SubResp | |
| 5068 | // | |<-------------| |
| 5069 | // | | | |
| 5070 | // | RESTNotif | | |
| 5071 | // |<----------------| | |
| 5072 | // | | | |
| 5073 | // | | |
| 5074 | // | Submgr restart | |
| 5075 | // | | | |
| 5076 | // | RESTSubDelReq | | |
| 5077 | // |---------------->| | |
| 5078 | // | | | |
| 5079 | // | | SubDelReq | |
| 5080 | // | |------------->| |
| 5081 | // | | | |
| 5082 | // | | SubDelResp | |
| 5083 | // | |<-------------| |
| 5084 | // | | | |
| 5085 | // | RESTSubDelResp | | |
| 5086 | // |<----------------| | |
| 5087 | // |
| 5088 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5089 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5090 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5091 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5092 | |
| 5093 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5094 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5095 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5096 | Counter{cSubReqToE2, 1}, |
| 5097 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5098 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5099 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5100 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5101 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5102 | }) |
| 5103 | |
| 5104 | // Remove possible existing subscription |
| 5105 | mainCtrl.removeExistingSubscriptions(t) |
| 5106 | |
| 5107 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5108 | |
| 5109 | // Create subscription |
| 5110 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5111 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5112 | |
| 5113 | // Check subscription |
| 5114 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5115 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5116 | mainCtrl.SimulateRestart(t) |
| 5117 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5118 | |
| 5119 | // Check subscription |
| 5120 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5121 | |
| 5122 | // Delete subscription |
| 5123 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5124 | |
| 5125 | //Wait that subs is cleaned |
| 5126 | waitSubsCleanup(t, e2SubsId, 10) |
| 5127 | |
| 5128 | mainCtrl.VerifyCounterValues(t) |
| 5129 | } |
| 5130 | |
| 5131 | //----------------------------------------------------------------------------- |
| 5132 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5133 | // |
| 5134 | // stub stub |
| 5135 | // +-------+ +-------+ +---------+ +---------+ |
| 5136 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5137 | // +-------+ +-------+ +---------+ +---------+ |
| 5138 | // | | | | |
| 5139 | // | | RESTSubReq1 | | |
| 5140 | // | |---------------->| | |
| 5141 | // | | | | |
| 5142 | // | | RESTSubResp1 | | |
| 5143 | // | |<----------------| | |
| 5144 | // | | | | |
| 5145 | // | | | SubReq1 | |
| 5146 | // | | |------------->| |
| 5147 | // | | | SubResp1 | |
| 5148 | // | | |<-------------| |
| 5149 | // | | RESTNotif1 | | |
| 5150 | // | |<----------------| | |
| 5151 | // | | | | |
| 5152 | // | RESTSubReq2 | | |
| 5153 | // |------------------------------>| | |
| 5154 | // | | | | |
| 5155 | // | RESTSubResp2 | | |
| 5156 | // |<------------------------------| | |
| 5157 | // | | | | |
| 5158 | // | | RESTNotif2 | | |
| 5159 | // |<------------------------------| | |
| 5160 | // | | | | |
| 5161 | // | | Submgr restart | |
| 5162 | // | | | | |
| 5163 | // | | RESTSubDelReq1 | | |
| 5164 | // | |---------------->| | |
| 5165 | // | | | | |
| 5166 | // | | RESTSubDelResp1 | | |
| 5167 | // | |<----------------| | |
| 5168 | // | | | | |
| 5169 | // | | Submgr restart | |
| 5170 | // | | | | |
| 5171 | // | RESTSubDelReq2 | | |
| 5172 | // |------------------------------>| | |
| 5173 | // | | | | |
| 5174 | // | RESTSubDelResp2 | | |
| 5175 | // |<------------------------------| | |
| 5176 | // | | | | |
| 5177 | // | | | SubDelReq2 | |
| 5178 | // | | |------------->| |
| 5179 | // | | | | |
| 5180 | // | | | SubDelResp2 | |
| 5181 | // | | |<-------------| |
| 5182 | // | | | | |
| 5183 | // |
| 5184 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5185 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5186 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5187 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5188 | |
| 5189 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5190 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5191 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5192 | Counter{cSubReqToE2, 1}, |
| 5193 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5194 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5195 | Counter{cMergedSubscriptions, 1}, |
| 5196 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5197 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5198 | Counter{cSubDelReqToE2, 1}, |
| 5199 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5200 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5201 | }) |
| 5202 | |
| 5203 | // Remove possible existing subscription |
| 5204 | mainCtrl.removeExistingSubscriptions(t) |
| 5205 | |
| 5206 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5207 | |
| 5208 | // Create subscription 1 |
| 5209 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5210 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5211 | |
| 5212 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5213 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5214 | params.SetMeid("RAN_NAME_1") |
| 5215 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5216 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5217 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5218 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5219 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5220 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5221 | |
| 5222 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5223 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5224 | mainCtrl.SimulateRestart(t) |
| 5225 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5226 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5227 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 5228 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5229 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5230 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5231 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5232 | mainCtrl.SimulateRestart(t) |
| 5233 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5234 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5235 | |
| 5236 | // Delete subscription 2 |
| 5237 | deleteXapp2Subscription(t, &restSubId2) |
| 5238 | |
| 5239 | //Wait that subs is cleaned |
| 5240 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5241 | |
| 5242 | mainCtrl.VerifyCounterValues(t) |
| 5243 | } |
| 5244 | |
| 5245 | //----------------------------------------------------------------------------- |
| 5246 | // TestRESTReportSubReqAndSubDelOk |
| 5247 | // |
| 5248 | // stub stub |
| 5249 | // +-------+ +---------+ +---------+ |
| 5250 | // | xapp | | submgr | | e2term | |
| 5251 | // +-------+ +---------+ +---------+ |
| 5252 | // | | | |
| 5253 | // | RestSubReq | | |
| 5254 | // |---------------->| | |
| 5255 | // | | | |
| 5256 | // | RESTSubResp | | |
| 5257 | // |<----------------| | |
| 5258 | // | | | |
| 5259 | // | | SubReq | |
| 5260 | // | |------------->| |
| 5261 | // | | | |
| 5262 | // | | SubResp | |
| 5263 | // | |<-------------| |
| 5264 | // | RESTNotif | | |
| 5265 | // |<----------------| | |
| 5266 | // | | SubReq | |
| 5267 | // | |------------->| |
| 5268 | // | | | |
| 5269 | // | | SubResp | |
| 5270 | // | |<-------------| |
| 5271 | // | RESTNotif | | |
| 5272 | // |<----------------| | |
| 5273 | // | ... | ... | |
| 5274 | // | | | |
| 5275 | // | | | |
| 5276 | // | RESTSubDelReq | | |
| 5277 | // |---------------->| | |
| 5278 | // | | | |
| 5279 | // | | SubDelReq | |
| 5280 | // | |------------->| |
| 5281 | // | | | |
| 5282 | // | | SubDelResp | |
| 5283 | // | |<-------------| |
| 5284 | // | | | |
| 5285 | // | RESTSubDelResp| | |
| 5286 | // |<----------------| | |
| 5287 | // |
| 5288 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5289 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5290 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5291 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5292 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5293 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5294 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5295 | } |
| 5296 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5297 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5298 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5299 | |
| 5300 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5301 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5302 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5303 | |
| 5304 | var e2SubsId []uint32 |
| 5305 | for i := 0; i < subReqCount; i++ { |
| 5306 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5307 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5308 | |
| 5309 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5310 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5311 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5312 | e2SubsId = append(e2SubsId, instanceId) |
| 5313 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5314 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5315 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5316 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5317 | |
| 5318 | } |
| 5319 | |
| 5320 | // Del |
| 5321 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5322 | |
| 5323 | for i := 0; i < subReqCount; i++ { |
| 5324 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5325 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5326 | } |
| 5327 | |
| 5328 | // Wait that subs is cleaned |
| 5329 | for i := 0; i < subReqCount; i++ { |
| 5330 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5331 | } |
| 5332 | |
| 5333 | xappConn1.TestMsgChanEmpty(t) |
| 5334 | e2termConn1.TestMsgChanEmpty(t) |
| 5335 | mainCtrl.wait_registry_empty(t, 10) |
| 5336 | } |
| 5337 | |
| 5338 | /* |
| 5339 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 5340 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5341 | |
| 5342 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5343 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5344 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5345 | |
| 5346 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5347 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5348 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5349 | } |
| 5350 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5351 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5352 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5353 | |
| 5354 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5355 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5356 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5357 | |
| 5358 | var e2SubsId []uint32 |
| 5359 | for i := 0; i < subReqCount; i++ { |
| 5360 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5361 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5362 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5363 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5364 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5365 | e2SubsId = append(e2SubsId, instanceId) |
| 5366 | } |
| 5367 | |
| 5368 | // Del |
| 5369 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5370 | |
| 5371 | for i := 0; i < subReqCount; i++ { |
| 5372 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5373 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5374 | } |
| 5375 | |
| 5376 | // Wait that subs is cleaned |
| 5377 | for i := 0; i < subReqCount; i++ { |
| 5378 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5379 | } |
| 5380 | xappConn1.TestMsgChanEmpty(t) |
| 5381 | e2termConn1.TestMsgChanEmpty(t) |
| 5382 | mainCtrl.wait_registry_empty(t, 10) |
| 5383 | } |
| 5384 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5385 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5386 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5387 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5388 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5389 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5390 | Counter{cSubReqToE2, 2}, |
| 5391 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5392 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5393 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5394 | Counter{cSubDelReqToE2, 2}, |
| 5395 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5396 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | }) |
| 5398 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5399 | const subReqCount int = 2 |
| 5400 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5401 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5402 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5403 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5404 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5405 | |
| 5406 | assert.Equal(t, len(e2SubsIds), 2) |
| 5407 | |
| 5408 | // Del |
| 5409 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5410 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5411 | |
| 5412 | xappConn1.TestMsgChanEmpty(t) |
| 5413 | e2termConn1.TestMsgChanEmpty(t) |
| 5414 | mainCtrl.wait_registry_empty(t, 10) |
| 5415 | |
| 5416 | mainCtrl.VerifyCounterValues(t) |
| 5417 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5418 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5419 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5420 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5421 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5422 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5423 | Counter{cSubReqToE2, 19}, |
| 5424 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5425 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5426 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5427 | Counter{cSubDelReqToE2, 19}, |
| 5428 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5429 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5430 | }) |
| 5431 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5432 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5433 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5434 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5435 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5436 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5437 | |
| 5438 | assert.Equal(t, len(e2SubsIds), 19) |
| 5439 | |
| 5440 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5441 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5442 | |
| 5443 | xappConn1.TestMsgChanEmpty(t) |
| 5444 | e2termConn1.TestMsgChanEmpty(t) |
| 5445 | mainCtrl.wait_registry_empty(t, 10) |
| 5446 | |
| 5447 | mainCtrl.VerifyCounterValues(t) |
| 5448 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5449 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5450 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5451 | |
| 5452 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5453 | |
| 5454 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5455 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5456 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5457 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5458 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5459 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5460 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5461 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5462 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5463 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5464 | }) |
| 5465 | |
| 5466 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5467 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5468 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5469 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5470 | |
| 5471 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5472 | |
| 5473 | // Del |
| 5474 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5475 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5476 | |
| 5477 | xappConn1.TestMsgChanEmpty(t) |
| 5478 | e2termConn1.TestMsgChanEmpty(t) |
| 5479 | mainCtrl.wait_registry_empty(t, 10) |
| 5480 | |
| 5481 | mainCtrl.VerifyCounterValues(t) |
| 5482 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5483 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5484 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5485 | |
| 5486 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5487 | |
| 5488 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5489 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5490 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5491 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5492 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5493 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5494 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5495 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5496 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5497 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5498 | }) |
| 5499 | |
| 5500 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5501 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5502 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5503 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5504 | |
| 5505 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5506 | |
| 5507 | // Del |
| 5508 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5509 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5510 | |
| 5511 | xappConn1.TestMsgChanEmpty(t) |
| 5512 | e2termConn1.TestMsgChanEmpty(t) |
| 5513 | mainCtrl.wait_registry_empty(t, 10) |
| 5514 | |
| 5515 | mainCtrl.VerifyCounterValues(t) |
| 5516 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5517 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5518 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5519 | |
| 5520 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5521 | |
| 5522 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5523 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5524 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5525 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5526 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5527 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5528 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5529 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5530 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5531 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5532 | }) |
| 5533 | |
| 5534 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5535 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5536 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5537 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5538 | |
| 5539 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5540 | |
| 5541 | // Del |
| 5542 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5543 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5544 | |
| 5545 | xappConn1.TestMsgChanEmpty(t) |
| 5546 | e2termConn1.TestMsgChanEmpty(t) |
| 5547 | mainCtrl.wait_registry_empty(t, 10) |
| 5548 | |
| 5549 | mainCtrl.VerifyCounterValues(t) |
| 5550 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5551 | |
| 5552 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5553 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5554 | |
| 5555 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5556 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5557 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5558 | Counter{cSubReqToE2, 2}, |
| 5559 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5560 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5561 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5562 | Counter{cSubDelReqToE2, 2}, |
| 5563 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5564 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5565 | }) |
| 5566 | |
| 5567 | // Req1 |
| 5568 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5569 | |
| 5570 | //Subs Create |
| 5571 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5572 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5573 | |
| 5574 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5575 | |
| 5576 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5577 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5578 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5579 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5580 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5581 | |
| 5582 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5583 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5584 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5585 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5586 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5587 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5588 | |
| 5589 | deleteXapp1Subscription(t, &restSubId1) |
| 5590 | deleteXapp2Subscription(t, &restSubId2) |
| 5591 | |
| 5592 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5593 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5594 | |
| 5595 | mainCtrl.VerifyCounterValues(t) |
| 5596 | |
| 5597 | } |
| 5598 | |
| 5599 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5600 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5601 | |
| 5602 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5603 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5604 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5605 | Counter{cSubReqToE2, 2}, |
| 5606 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5607 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5608 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5609 | Counter{cSubDelReqToE2, 2}, |
| 5610 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5611 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5612 | }) |
| 5613 | |
| 5614 | // Req1 |
| 5615 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5616 | |
| 5617 | //Subs Create |
| 5618 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5619 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5620 | |
| 5621 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5622 | |
| 5623 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5624 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5625 | params.SetMeid("RAN_NAME_1") |
| 5626 | |
| 5627 | actionId := int64(1) |
| 5628 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5629 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5630 | subsequestActionType := "continue" |
| 5631 | timeToWait := "w10ms" |
| 5632 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5633 | |
| 5634 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5635 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5636 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5637 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5638 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5639 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5640 | |
| 5641 | deleteXapp1Subscription(t, &restSubId1) |
| 5642 | deleteXapp2Subscription(t, &restSubId2) |
| 5643 | |
| 5644 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5645 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5646 | |
| 5647 | mainCtrl.VerifyCounterValues(t) |
| 5648 | |
| 5649 | } |
| 5650 | |
| 5651 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5652 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5653 | |
| 5654 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5655 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5656 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5657 | Counter{cSubReqToE2, 2}, |
| 5658 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5659 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5660 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5661 | Counter{cSubDelReqToE2, 2}, |
| 5662 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5663 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5664 | }) |
| 5665 | |
| 5666 | // Req1 |
| 5667 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5668 | |
| 5669 | //Subs Create |
| 5670 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5671 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5672 | |
| 5673 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5674 | |
| 5675 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5676 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5677 | params.SetMeid("RAN_NAME_1") |
| 5678 | params.SetSubActionIDs(int64(2)) |
| 5679 | |
| 5680 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5681 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5682 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5683 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5684 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5685 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5686 | |
| 5687 | deleteXapp1Subscription(t, &restSubId1) |
| 5688 | deleteXapp2Subscription(t, &restSubId2) |
| 5689 | |
| 5690 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5691 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5692 | |
| 5693 | mainCtrl.VerifyCounterValues(t) |
| 5694 | |
| 5695 | } |
| 5696 | |
| 5697 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5698 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5699 | |
| 5700 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5701 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5702 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5703 | Counter{cSubReqToE2, 2}, |
| 5704 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5705 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5706 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5707 | Counter{cSubDelReqToE2, 2}, |
| 5708 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5709 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5710 | }) |
| 5711 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5712 | const e2Timeout int64 = 2 |
| 5713 | const e2RetryCount int64 = 2 |
| 5714 | const routingNeeded bool = true |
| 5715 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5716 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5717 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5718 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5719 | |
| 5720 | //Subs Create |
| 5721 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5722 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5723 | |
| 5724 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5725 | |
| 5726 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5727 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5728 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5729 | params.SetMeid("RAN_NAME_1") |
| 5730 | |
| 5731 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5732 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5733 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5734 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5735 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5736 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5737 | |
| 5738 | deleteXapp1Subscription(t, &restSubId1) |
| 5739 | deleteXapp2Subscription(t, &restSubId2) |
| 5740 | |
| 5741 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5742 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5743 | |
| 5744 | mainCtrl.VerifyCounterValues(t) |
| 5745 | |
| 5746 | } |
| 5747 | |
| 5748 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5749 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5750 | |
| 5751 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5752 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5753 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5754 | Counter{cSubReqToE2, 2}, |
| 5755 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5756 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5757 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5758 | Counter{cSubDelReqToE2, 2}, |
| 5759 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5760 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5761 | }) |
| 5762 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5763 | const e2Timeout int64 = 2 |
| 5764 | const e2RetryCount int64 = 2 |
| 5765 | const routingNeeded bool = true |
| 5766 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5767 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5768 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5769 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5770 | |
| 5771 | //Subs Create |
| 5772 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5773 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5774 | |
| 5775 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5776 | |
| 5777 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5778 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5779 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5780 | params.SetMeid("RAN_NAME_1") |
| 5781 | |
| 5782 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5783 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5784 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5785 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5786 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5787 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5788 | |
| 5789 | deleteXapp1Subscription(t, &restSubId1) |
| 5790 | deleteXapp2Subscription(t, &restSubId2) |
| 5791 | |
| 5792 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5793 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5794 | |
| 5795 | mainCtrl.VerifyCounterValues(t) |
| 5796 | |
| 5797 | } |
| 5798 | |
| 5799 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5800 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5801 | |
| 5802 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5803 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5804 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5805 | Counter{cSubReqToE2, 2}, |
| 5806 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5807 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5808 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5809 | Counter{cSubDelReqToE2, 2}, |
| 5810 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5811 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5812 | }) |
| 5813 | |
| 5814 | // Req1 |
| 5815 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5816 | |
| 5817 | //Subs Create |
| 5818 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5819 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5820 | |
| 5821 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5822 | |
| 5823 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5824 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5825 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5826 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5827 | params.SetSubActionDefinition(actionDefinition) |
| 5828 | |
| 5829 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5830 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5831 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5832 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5833 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5834 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5835 | |
| 5836 | deleteXapp1Subscription(t, &restSubId1) |
| 5837 | deleteXapp2Subscription(t, &restSubId2) |
| 5838 | |
| 5839 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5840 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5841 | |
| 5842 | mainCtrl.VerifyCounterValues(t) |
| 5843 | |
| 5844 | } |
| 5845 | |
| 5846 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5847 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5848 | |
| 5849 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5850 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5851 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5852 | Counter{cSubReqToE2, 2}, |
| 5853 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5854 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5855 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5856 | Counter{cSubDelReqToE2, 2}, |
| 5857 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5858 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5859 | }) |
| 5860 | |
| 5861 | // Req1 |
| 5862 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5863 | |
| 5864 | //Subs Create |
| 5865 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5866 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5867 | |
| 5868 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5869 | |
| 5870 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5871 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5872 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5873 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5874 | params.SetSubActionDefinition(actionDefinition) |
| 5875 | |
| 5876 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5877 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5878 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5879 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5880 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5881 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5882 | |
| 5883 | deleteXapp1Subscription(t, &restSubId1) |
| 5884 | deleteXapp2Subscription(t, &restSubId2) |
| 5885 | |
| 5886 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5887 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5888 | |
| 5889 | mainCtrl.VerifyCounterValues(t) |
| 5890 | |
| 5891 | } |
| 5892 | |
| 5893 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5894 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5895 | |
| 5896 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5897 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5898 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5899 | Counter{cSubReqToE2, 2}, |
| 5900 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5901 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5902 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5903 | Counter{cSubDelReqToE2, 2}, |
| 5904 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5905 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5906 | }) |
| 5907 | |
| 5908 | // Req1 |
| 5909 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5910 | |
| 5911 | //Subs Create |
| 5912 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5913 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5914 | |
| 5915 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5916 | |
| 5917 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5918 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5919 | params.SetMeid("RAN_NAME_1") |
| 5920 | params.SetTimeToWait("w200ms") |
| 5921 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5922 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5923 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5924 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5925 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5926 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5927 | |
| 5928 | deleteXapp1Subscription(t, &restSubId1) |
| 5929 | deleteXapp2Subscription(t, &restSubId2) |
| 5930 | |
| 5931 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5932 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5933 | |
| 5934 | mainCtrl.VerifyCounterValues(t) |
| 5935 | |
| 5936 | } |
| 5937 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5938 | //----------------------------------------------------------------------------- |
| 5939 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5940 | // |
| 5941 | // stub stub |
| 5942 | // +-------+ +---------+ +---------+ |
| 5943 | // | xapp | | submgr | | e2term | |
| 5944 | // +-------+ +---------+ +---------+ |
| 5945 | // | | | |
| 5946 | // | RestSubReq | | |
| 5947 | // |---------------->| | |
| 5948 | // | | | |
| 5949 | // | RESTSubResp | | |
| 5950 | // |<----------------| | |
| 5951 | // | | | |
| 5952 | // | | SubReq | |
| 5953 | // | |------------->| |
| 5954 | // | | | |
| 5955 | // | | SubResp | ASN.1 decode fails |
| 5956 | // | |<-------------| |
| 5957 | // | | | |
| 5958 | // | | SubReq | |
| 5959 | // | |------------->| |
| 5960 | // | | | |
| 5961 | // | | SubFail | Duplicated action |
| 5962 | // | |<-------------| |
| 5963 | // | RESTNotif (fail)| | |
| 5964 | // |<----------------| | |
| 5965 | // | | SubDelReq | |
| 5966 | // | |------------->| |
| 5967 | // | | | |
| 5968 | // | | SubDelResp | |
| 5969 | // | |<-------------| |
| 5970 | // |
| 5971 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5972 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5973 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5974 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5975 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5976 | |
| 5977 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5978 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5979 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5980 | |
| 5981 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5982 | // Decode of this response fails which will result resending original request |
| 5983 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5984 | |
| 5985 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5986 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5987 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5988 | |
| 5989 | // Subscription already created in E2 Node. |
| 5990 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5991 | fparams.Set(crereq) |
| 5992 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5993 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5994 | |
| 5995 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5996 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5997 | |
| 5998 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5999 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6000 | |
| 6001 | // Wait that subs is cleaned |
| 6002 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6003 | |
| 6004 | xappConn1.TestMsgChanEmpty(t) |
| 6005 | e2termConn1.TestMsgChanEmpty(t) |
| 6006 | mainCtrl.wait_registry_empty(t, 10) |
| 6007 | } |
| 6008 | |
| 6009 | //----------------------------------------------------------------------------- |
| 6010 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6011 | // |
| 6012 | // stub stub |
| 6013 | // +-------+ +---------+ +---------+ |
| 6014 | // | xapp | | submgr | | e2term | |
| 6015 | // +-------+ +---------+ +---------+ |
| 6016 | // | | | |
| 6017 | // | RestSubReq | | |
| 6018 | // |---------------->| | |
| 6019 | // | | | |
| 6020 | // | RESTSubResp | | |
| 6021 | // |<----------------| | |
| 6022 | // | | | |
| 6023 | // | | SubReq | |
| 6024 | // | |------------->| |
| 6025 | // | | | |
| 6026 | // | | SubResp | Unknown instanceId |
| 6027 | // | |<-------------| |
| 6028 | // | | | |
| 6029 | // | | SubReq | |
| 6030 | // | |------------->| |
| 6031 | // | | | |
| 6032 | // | | SubFail | Duplicated action |
| 6033 | // | |<-------------| |
| 6034 | // | RESTNotif (fail)| | |
| 6035 | // |<----------------| | |
| 6036 | // | | SubDelReq | |
| 6037 | // | |------------->| |
| 6038 | // | | | |
| 6039 | // | | SubDelResp | |
| 6040 | // | |<-------------| |
| 6041 | // |
| 6042 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6043 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6044 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6045 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 6046 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6047 | |
| 6048 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6049 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6050 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6051 | |
| 6052 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6053 | |
| 6054 | // Unknown instanceId in this response which will result resending original request |
| 6055 | orgInstanceId := crereq.RequestId.InstanceId |
| 6056 | crereq.RequestId.InstanceId = 0 |
| 6057 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6058 | |
| 6059 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6060 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6061 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6062 | |
| 6063 | // Subscription already created in E2 Node. |
| 6064 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6065 | fparams.Set(crereq) |
| 6066 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6067 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6068 | |
| 6069 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6070 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6071 | |
| 6072 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6073 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6074 | |
| 6075 | // Wait that subs is cleaned |
| 6076 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6077 | |
| 6078 | xappConn1.TestMsgChanEmpty(t) |
| 6079 | e2termConn1.TestMsgChanEmpty(t) |
| 6080 | mainCtrl.wait_registry_empty(t, 10) |
| 6081 | } |
| 6082 | |
| 6083 | //----------------------------------------------------------------------------- |
| 6084 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6085 | // |
| 6086 | // stub stub |
| 6087 | // +-------+ +---------+ +---------+ |
| 6088 | // | xapp | | submgr | | e2term | |
| 6089 | // +-------+ +---------+ +---------+ |
| 6090 | // | | | |
| 6091 | // | RestSubReq | | |
| 6092 | // |---------------->| | |
| 6093 | // | | | |
| 6094 | // | RESTSubResp | | |
| 6095 | // |<----------------| | |
| 6096 | // | | | |
| 6097 | // | | SubReq | |
| 6098 | // | |------------->| |
| 6099 | // | | | |
| 6100 | // | | SubResp | No transaction for the response |
| 6101 | // | |<-------------| |
| 6102 | // | | | |
| 6103 | // | | SubReq | |
| 6104 | // | |------------->| |
| 6105 | // | | | |
| 6106 | // | | SubFail | Duplicated action |
| 6107 | // | |<-------------| |
| 6108 | // | RESTNotif (fail)| | |
| 6109 | // |<----------------| | |
| 6110 | // | | SubDelReq | |
| 6111 | // | |------------->| |
| 6112 | // | | | |
| 6113 | // | | SubDelResp | |
| 6114 | // | |<-------------| |
| 6115 | // | | | |
| 6116 | // | | SubDelReq | |
| 6117 | // | |------------->| |
| 6118 | // | | | |
| 6119 | // | | SubDelResp | |
| 6120 | // | |<-------------| |
| 6121 | // |
| 6122 | //----------------------------------------------------------------------------- |
| 6123 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6124 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6125 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6126 | |
| 6127 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6128 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6129 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6130 | |
| 6131 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6132 | |
| 6133 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6134 | // No transaction exist for this response which will result resending original request |
| 6135 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6136 | |
| 6137 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6138 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6139 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6140 | |
| 6141 | // Subscription already created in E2 Node. |
| 6142 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6143 | fparams.Set(crereq) |
| 6144 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6145 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6146 | |
| 6147 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6148 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6149 | |
| 6150 | // Resending happens because there no transaction |
| 6151 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6152 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6153 | |
| 6154 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6155 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6156 | |
| 6157 | // Wait that subs is cleaned |
| 6158 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6159 | |
| 6160 | xappConn1.TestMsgChanEmpty(t) |
| 6161 | e2termConn1.TestMsgChanEmpty(t) |
| 6162 | mainCtrl.wait_registry_empty(t, 10) |
| 6163 | |
| 6164 | } |
| 6165 | |
| 6166 | //----------------------------------------------------------------------------- |
| 6167 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6168 | // |
| 6169 | // stub stub |
| 6170 | // +-------+ +---------+ +---------+ |
| 6171 | // | xapp | | submgr | | e2term | |
| 6172 | // +-------+ +---------+ +---------+ |
| 6173 | // | | | |
| 6174 | // | RestSubReq | | |
| 6175 | // |---------------->| | |
| 6176 | // | | | |
| 6177 | // | RESTSubResp | | |
| 6178 | // |<----------------| | |
| 6179 | // | | | |
| 6180 | // | | SubReq | |
| 6181 | // | |------------->| |
| 6182 | // | | | |
| 6183 | // | | SubFail | ASN.1 decode fails |
| 6184 | // | |<-------------| |
| 6185 | // | | | |
| 6186 | // | | SubReq | |
| 6187 | // | |------------->| |
| 6188 | // | | | |
| 6189 | // | | SubFail | Duplicated action |
| 6190 | // | |<-------------| |
| 6191 | // | RESTNotif (fail)| | |
| 6192 | // |<----------------| | |
| 6193 | // | | SubDelReq | |
| 6194 | // | |------------->| |
| 6195 | // | | | |
| 6196 | // | | SubDelResp | |
| 6197 | // | |<-------------| |
| 6198 | // |
| 6199 | //----------------------------------------------------------------------------- |
| 6200 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6201 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6202 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6203 | |
| 6204 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6205 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6206 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6207 | |
| 6208 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6209 | |
| 6210 | // Decode of this response fails which will result resending original request |
| 6211 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6212 | |
| 6213 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6214 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6215 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6216 | |
| 6217 | // Subscription already created in E2 Node. |
| 6218 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6219 | fparams.Set(crereq) |
| 6220 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6221 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6222 | |
| 6223 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6224 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6225 | |
| 6226 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6227 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6228 | |
| 6229 | // Wait that subs is cleaned |
| 6230 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6231 | |
| 6232 | xappConn1.TestMsgChanEmpty(t) |
| 6233 | e2termConn1.TestMsgChanEmpty(t) |
| 6234 | mainCtrl.wait_registry_empty(t, 10) |
| 6235 | } |
| 6236 | |
| 6237 | //----------------------------------------------------------------------------- |
| 6238 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6239 | // |
| 6240 | // stub stub |
| 6241 | // +-------+ +---------+ +---------+ |
| 6242 | // | xapp | | submgr | | e2term | |
| 6243 | // +-------+ +---------+ +---------+ |
| 6244 | // | | | |
| 6245 | // | RestSubReq | | |
| 6246 | // |---------------->| | |
| 6247 | // | | | |
| 6248 | // | RESTSubResp | | |
| 6249 | // |<----------------| | |
| 6250 | // | | | |
| 6251 | // | | SubReq | |
| 6252 | // | |------------->| |
| 6253 | // | | | |
| 6254 | // | | SubFail | Unknown instanceId |
| 6255 | // | |<-------------| |
| 6256 | // | | | |
| 6257 | // | | SubReq | |
| 6258 | // | |------------->| |
| 6259 | // | | | |
| 6260 | // | | SubFail | Duplicated action |
| 6261 | // | |<-------------| |
| 6262 | // | RESTNotif (fail)| | |
| 6263 | // |<----------------| | |
| 6264 | // | | SubDelReq | |
| 6265 | // | |------------->| |
| 6266 | // | | | |
| 6267 | // | | SubDelResp | |
| 6268 | // | |<-------------| |
| 6269 | // |
| 6270 | //----------------------------------------------------------------------------- |
| 6271 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6272 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6273 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6274 | |
| 6275 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6276 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6277 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6278 | |
| 6279 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6280 | |
| 6281 | // Unknown instanceId in this response which will result resending original request |
| 6282 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6283 | fparams.Set(crereq) |
| 6284 | fparams.Fail.RequestId.InstanceId = 0 |
| 6285 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6286 | |
| 6287 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6288 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6289 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6290 | |
| 6291 | // Subscription already created in E2 Node. |
| 6292 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6293 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6294 | |
| 6295 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6296 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6297 | |
| 6298 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6299 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6300 | |
| 6301 | // Wait that subs is cleaned |
| 6302 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6303 | |
| 6304 | xappConn1.TestMsgChanEmpty(t) |
| 6305 | e2termConn1.TestMsgChanEmpty(t) |
| 6306 | mainCtrl.wait_registry_empty(t, 10) |
| 6307 | } |
| 6308 | |
| 6309 | //----------------------------------------------------------------------------- |
| 6310 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6311 | // |
| 6312 | // stub stub |
| 6313 | // +-------+ +---------+ +---------+ |
| 6314 | // | xapp | | submgr | | e2term | |
| 6315 | // +-------+ +---------+ +---------+ |
| 6316 | // | | | |
| 6317 | // | RestSubReq | | |
| 6318 | // |---------------->| | |
| 6319 | // | | | |
| 6320 | // | RESTSubResp | | |
| 6321 | // |<----------------| | |
| 6322 | // | | | |
| 6323 | // | | SubReq | |
| 6324 | // | |------------->| |
| 6325 | // | | | |
| 6326 | // | | SubFail | No transaction for the response |
| 6327 | // | |<-------------| |
| 6328 | // | | | |
| 6329 | // | | SubReq | |
| 6330 | // | |------------->| |
| 6331 | // | | | |
| 6332 | // | | SubFail | Duplicated action |
| 6333 | // | |<-------------| |
| 6334 | // | RESTNotif (fail)| | |
| 6335 | // |<----------------| | |
| 6336 | // | | SubDelReq | |
| 6337 | // | |------------->| |
| 6338 | // | | | |
| 6339 | // | | SubDelResp | |
| 6340 | // | |<-------------| |
| 6341 | // |
| 6342 | //----------------------------------------------------------------------------- |
| 6343 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6344 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6345 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6346 | |
| 6347 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6348 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6349 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6350 | |
| 6351 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6352 | |
| 6353 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6354 | |
| 6355 | // No transaction exist for this response which will result resending original request |
| 6356 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6357 | fparams.Set(crereq) |
| 6358 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6359 | |
| 6360 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6361 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6362 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6363 | |
| 6364 | // Subscription already created in E2 Node. |
| 6365 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6366 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6367 | |
| 6368 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6369 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6370 | |
| 6371 | // Resending happens because there no transaction |
| 6372 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6373 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6374 | |
| 6375 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6376 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6377 | |
| 6378 | // Wait that subs is cleaned |
| 6379 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6380 | |
| 6381 | xappConn1.TestMsgChanEmpty(t) |
| 6382 | e2termConn1.TestMsgChanEmpty(t) |
| 6383 | mainCtrl.wait_registry_empty(t, 10) |
| 6384 | } |
| 6385 | |
| 6386 | //----------------------------------------------------------------------------- |
| 6387 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6388 | // |
| 6389 | // stub stub |
| 6390 | // +-------+ +---------+ +---------+ |
| 6391 | // | xapp | | submgr | | e2term | |
| 6392 | // +-------+ +---------+ +---------+ |
| 6393 | // | | | |
| 6394 | // | [SUBS CREATE] | |
| 6395 | // | | | |
| 6396 | // | | | |
| 6397 | // | RESTSubDelReq | | |
| 6398 | // |---------------->| | |
| 6399 | // | | | |
| 6400 | // | RESTSubDelResp | | |
| 6401 | // |<----------------| | |
| 6402 | // | | | |
| 6403 | // | | SubDelReq | |
| 6404 | // | |------------->| |
| 6405 | // | | | |
| 6406 | // | | SubDelResp | ASN.1 decode fails |
| 6407 | // | |<-------------| |
| 6408 | // | | | |
| 6409 | // | | SubDelReq | |
| 6410 | // | |------------->| |
| 6411 | // | | | |
| 6412 | // | | SubDelFail | Subscription does exist any more |
| 6413 | // | |<-------------| |
| 6414 | // | | | |
| 6415 | // |
| 6416 | //----------------------------------------------------------------------------- |
| 6417 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6418 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6419 | |
| 6420 | // Req |
| 6421 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6422 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6423 | |
| 6424 | // Del |
| 6425 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6426 | |
| 6427 | // E2t: Receive 1st SubsDelReq |
| 6428 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6429 | |
| 6430 | // Decode of this response fails which will result resending original request |
| 6431 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6432 | |
| 6433 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6434 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6435 | |
| 6436 | // Subscription does not exist in in E2 Node. |
| 6437 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6438 | |
| 6439 | // Wait that subs is cleaned |
| 6440 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6441 | |
| 6442 | xappConn1.TestMsgChanEmpty(t) |
| 6443 | e2termConn1.TestMsgChanEmpty(t) |
| 6444 | mainCtrl.wait_registry_empty(t, 10) |
| 6445 | } |
| 6446 | |
| 6447 | //----------------------------------------------------------------------------- |
| 6448 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6449 | // |
| 6450 | // stub stub |
| 6451 | // +-------+ +---------+ +---------+ |
| 6452 | // | xapp | | submgr | | e2term | |
| 6453 | // +-------+ +---------+ +---------+ |
| 6454 | // | | | |
| 6455 | // | [SUBS CREATE] | |
| 6456 | // | | | |
| 6457 | // | | | |
| 6458 | // | RESTSubDelReq | | |
| 6459 | // |---------------->| | |
| 6460 | // | | | |
| 6461 | // | RESTSubDelResp | | |
| 6462 | // |<----------------| | |
| 6463 | // | | | |
| 6464 | // | | SubDelReq | |
| 6465 | // | |------------->| |
| 6466 | // | | | |
| 6467 | // | | SubDelResp | Unknown instanceId |
| 6468 | // | |<-------------| |
| 6469 | // | | | |
| 6470 | // | | SubDelReq | |
| 6471 | // | |------------->| |
| 6472 | // | | | |
| 6473 | // | | SubDelFail | Subscription does exist any more |
| 6474 | // | |<-------------| |
| 6475 | // |
| 6476 | //----------------------------------------------------------------------------- |
| 6477 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6478 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6479 | |
| 6480 | // Req |
| 6481 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6482 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6483 | |
| 6484 | // Del |
| 6485 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6486 | |
| 6487 | // E2t: Receive 1st SubsDelReq |
| 6488 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6489 | |
| 6490 | // Unknown instanceId in this response which will result resending original request |
| 6491 | delreq.RequestId.InstanceId = 0 |
| 6492 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6493 | |
| 6494 | // E2t: Receive 2nd SubsDelReq |
| 6495 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6496 | |
| 6497 | // Subscription does not exist in in E2 Node. |
| 6498 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6499 | |
| 6500 | // Wait that subs is cleaned |
| 6501 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6502 | |
| 6503 | xappConn1.TestMsgChanEmpty(t) |
| 6504 | e2termConn1.TestMsgChanEmpty(t) |
| 6505 | mainCtrl.wait_registry_empty(t, 10) |
| 6506 | } |
| 6507 | |
| 6508 | //----------------------------------------------------------------------------- |
| 6509 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6510 | // |
| 6511 | // stub stub |
| 6512 | // +-------+ +---------+ +---------+ |
| 6513 | // | xapp | | submgr | | e2term | |
| 6514 | // +-------+ +---------+ +---------+ |
| 6515 | // | | | |
| 6516 | // | [SUBS CREATE] | |
| 6517 | // | | | |
| 6518 | // | | | |
| 6519 | // | RESTSubDelReq | | |
| 6520 | // |---------------->| | |
| 6521 | // | | | |
| 6522 | // | RESTSubDelResp | | |
| 6523 | // |<----------------| | |
| 6524 | // | | | |
| 6525 | // | | SubDelReq | |
| 6526 | // | |------------->| |
| 6527 | // | | | |
| 6528 | // | | SubDelResp | No transaction for the response |
| 6529 | // | |<-------------| |
| 6530 | // | | | |
| 6531 | // | | SubDelReq | |
| 6532 | // | |------------->| |
| 6533 | // | | | |
| 6534 | // | | SubDelFail | Subscription does exist any more |
| 6535 | // | |<-------------| |
| 6536 | // |
| 6537 | //----------------------------------------------------------------------------- |
| 6538 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6539 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6540 | |
| 6541 | // Req |
| 6542 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6543 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6544 | |
| 6545 | // Del |
| 6546 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6547 | |
| 6548 | // E2t: Receive 1st SubsDelReq |
| 6549 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6550 | |
| 6551 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6552 | |
| 6553 | // No transaction exist for this response which will result resending original request |
| 6554 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6555 | |
| 6556 | // E2t: Receive 2nd SubsDelReq |
| 6557 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6558 | |
| 6559 | // Subscription does not exist in in E2 Node. |
| 6560 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6561 | |
| 6562 | // Wait that subs is cleaned |
| 6563 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6564 | |
| 6565 | xappConn1.TestMsgChanEmpty(t) |
| 6566 | e2termConn1.TestMsgChanEmpty(t) |
| 6567 | mainCtrl.wait_registry_empty(t, 10) |
| 6568 | } |
| 6569 | |
| 6570 | //----------------------------------------------------------------------------- |
| 6571 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6572 | // |
| 6573 | // stub stub |
| 6574 | // +-------+ +---------+ +---------+ |
| 6575 | // | xapp | | submgr | | e2term | |
| 6576 | // +-------+ +---------+ +---------+ |
| 6577 | // | | | |
| 6578 | // | [SUBS CREATE] | |
| 6579 | // | | | |
| 6580 | // | | | |
| 6581 | // | RESTSubDelReq | | |
| 6582 | // |---------------->| | |
| 6583 | // | | | |
| 6584 | // | RESTSubDelResp | | |
| 6585 | // |<----------------| | |
| 6586 | // | | | |
| 6587 | // | | SubDelReq | |
| 6588 | // | |------------->| |
| 6589 | // | | | |
| 6590 | // | | SubDelFail | ASN.1 decode fails |
| 6591 | // | |<-------------| |
| 6592 | // | | | |
| 6593 | // | | SubDelReq | |
| 6594 | // | |------------->| |
| 6595 | // | | | |
| 6596 | // | | SubDelFail | Subscription does exist any more |
| 6597 | // | |<-------------| |
| 6598 | // |
| 6599 | //----------------------------------------------------------------------------- |
| 6600 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6601 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6602 | |
| 6603 | // Req |
| 6604 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6605 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6606 | |
| 6607 | // Del |
| 6608 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6609 | |
| 6610 | // E2t: Receive 1st SubsDelReq |
| 6611 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6612 | |
| 6613 | // Decode of this response fails which will result resending original request |
| 6614 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6615 | |
| 6616 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6617 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6618 | |
| 6619 | // Subscription does not exist in in E2 Node. |
| 6620 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6621 | |
| 6622 | // Wait that subs is cleaned |
| 6623 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6624 | |
| 6625 | xappConn1.TestMsgChanEmpty(t) |
| 6626 | e2termConn1.TestMsgChanEmpty(t) |
| 6627 | mainCtrl.wait_registry_empty(t, 10) |
| 6628 | } |
| 6629 | |
| 6630 | //----------------------------------------------------------------------------- |
| 6631 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6632 | // |
| 6633 | // stub stub |
| 6634 | // +-------+ +---------+ +---------+ |
| 6635 | // | xapp | | submgr | | e2term | |
| 6636 | // +-------+ +---------+ +---------+ |
| 6637 | // | | | |
| 6638 | // | [SUBS CREATE] | |
| 6639 | // | | | |
| 6640 | // | | | |
| 6641 | // | RESTSubDelReq | | |
| 6642 | // |---------------->| | |
| 6643 | // | | | |
| 6644 | // | RESTSubDelResp | | |
| 6645 | // |<----------------| | |
| 6646 | // | | | |
| 6647 | // | | SubDelReq | |
| 6648 | // | |------------->| |
| 6649 | // | | | |
| 6650 | // | | SubDelFail | Unknown instanceId |
| 6651 | // | |<-------------| |
| 6652 | // | | | |
| 6653 | // | | SubDelReq | |
| 6654 | // | |------------->| |
| 6655 | // | | | |
| 6656 | // | | SubDelFail | Subscription does exist any more |
| 6657 | // | |<-------------| |
| 6658 | // |
| 6659 | //----------------------------------------------------------------------------- |
| 6660 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6661 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6662 | |
| 6663 | // Req |
| 6664 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6665 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6666 | |
| 6667 | // Del |
| 6668 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6669 | |
| 6670 | // E2t: Receive 1st SubsDelReq |
| 6671 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6672 | |
| 6673 | // Unknown instanceId in this response which will result resending original request |
| 6674 | delreq.RequestId.InstanceId = 0 |
| 6675 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6676 | |
| 6677 | // E2t: Receive 2nd SubsDelReq |
| 6678 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6679 | |
| 6680 | // Subscription does not exist in in E2 Node. |
| 6681 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6682 | |
| 6683 | // Wait that subs is cleaned |
| 6684 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6685 | |
| 6686 | xappConn1.TestMsgChanEmpty(t) |
| 6687 | e2termConn1.TestMsgChanEmpty(t) |
| 6688 | mainCtrl.wait_registry_empty(t, 10) |
| 6689 | } |
| 6690 | |
| 6691 | //----------------------------------------------------------------------------- |
| 6692 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6693 | // |
| 6694 | // stub stub |
| 6695 | // +-------+ +---------+ +---------+ |
| 6696 | // | xapp | | submgr | | e2term | |
| 6697 | // +-------+ +---------+ +---------+ |
| 6698 | // | | | |
| 6699 | // | [SUBS CREATE] | |
| 6700 | // | | | |
| 6701 | // | | | |
| 6702 | // | RESTSubDelReq | | |
| 6703 | // |---------------->| | |
| 6704 | // | | | |
| 6705 | // | RESTSubDelResp | | |
| 6706 | // |<----------------| | |
| 6707 | // | | | |
| 6708 | // | | SubDelReq | |
| 6709 | // | |------------->| |
| 6710 | // | | | |
| 6711 | // | | SubDelFail | No transaction for the response |
| 6712 | // | |<-------------| |
| 6713 | // | | | |
| 6714 | // | | SubDelReq | |
| 6715 | // | |------------->| |
| 6716 | // | | | |
| 6717 | // | | SubDelFail | Subscription does exist any more |
| 6718 | // | |<-------------| |
| 6719 | // |
| 6720 | //----------------------------------------------------------------------------- |
| 6721 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6722 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6723 | |
| 6724 | // Req |
| 6725 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6726 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6727 | |
| 6728 | // Del |
| 6729 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6730 | |
| 6731 | // E2t: Receive 1st SubsDelReq |
| 6732 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6733 | |
| 6734 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6735 | |
| 6736 | // No transaction exist for this response which will result resending original request |
| 6737 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6738 | |
| 6739 | // E2t: Receive 2nd SubsDelReq |
| 6740 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6741 | |
| 6742 | // Subscription does not exist in in E2 Node. |
| 6743 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6744 | |
| 6745 | // Wait that subs is cleaned |
| 6746 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6747 | |
| 6748 | xappConn1.TestMsgChanEmpty(t) |
| 6749 | e2termConn1.TestMsgChanEmpty(t) |
| 6750 | mainCtrl.wait_registry_empty(t, 10) |
| 6751 | } |
| 6752 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6753 | //----------------------------------------------------------------------------- |
| 6754 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6755 | // |
| 6756 | // stub stub |
| 6757 | // +-------+ +---------+ +---------+ |
| 6758 | // | xapp | | submgr | | e2term | |
| 6759 | // +-------+ +---------+ +---------+ |
| 6760 | // | | | |
| 6761 | // | RESTSubReq | | |
| 6762 | // |---------------->| | |
| 6763 | // | | | |
| 6764 | // | RESTSubResp | | |
| 6765 | // |<----------------| | |
| 6766 | // | | | |
| 6767 | // | ASN.1 encode fails | |
| 6768 | // | | | |
| 6769 | // | | SubDelReq | |
| 6770 | // | |------------->| |
| 6771 | // | | | |
| 6772 | // | | SubDelFail | |
| 6773 | // | |<-------------| |
| 6774 | // | | | |
| 6775 | // | RESTNotif | | |
| 6776 | // | unsuccess | | |
| 6777 | // |<----------------| | |
| 6778 | // | | | |
| 6779 | // | [SUBS DELETE] | |
| 6780 | // | | | |
| 6781 | // |
| 6782 | //----------------------------------------------------------------------------- |
| 6783 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6784 | |
| 6785 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6786 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6787 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6788 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6789 | }) |
| 6790 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6791 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6792 | |
| 6793 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6794 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6795 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6796 | |
| 6797 | // Req |
| 6798 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6799 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6800 | |
| 6801 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6802 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6803 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6804 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6805 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6806 | |
| 6807 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 6808 | // Wait that subs is cleaned |
| 6809 | waitSubsCleanup(t, e2SubsId, 10) |
| 6810 | mainCtrl.VerifyCounterValues(t) |
| 6811 | } |
| 6812 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6813 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6814 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6815 | |
| 6816 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6817 | Counter{cRestSubReqFromXapp, 2}, |
| 6818 | Counter{cRestSubRespToXapp, 2}, |
| 6819 | Counter{cSubReqToE2, 2}, |
| 6820 | Counter{cSubRespFromE2, 1}, |
| 6821 | Counter{cRestSubNotifToXapp, 1}, |
| 6822 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6823 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6824 | Counter{cSubDelReqToE2, 1}, |
| 6825 | Counter{cSubDelRespFromE2, 1}, |
| 6826 | Counter{cRestSubDelRespToXapp, 1}, |
| 6827 | }) |
| 6828 | |
| 6829 | const e2Timeout int64 = 1 |
| 6830 | const e2RetryCount int64 = 0 |
| 6831 | const routingNeeded bool = false |
| 6832 | |
| 6833 | // Req1 |
| 6834 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6835 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6836 | |
| 6837 | // Subs Create |
| 6838 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6839 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6840 | |
| 6841 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6842 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6843 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6844 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6845 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6846 | |
| 6847 | // Policy change |
| 6848 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6849 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6850 | params.SetSubscriptionID(&restSubId) |
| 6851 | params.SetTimeToWait("w200ms") |
| 6852 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6853 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6854 | |
| 6855 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6856 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6857 | // SubsResp is missing, e2SubsId will be 0 |
| 6858 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6859 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6860 | |
| 6861 | // Del |
| 6862 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6863 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6864 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6865 | |
| 6866 | waitSubsCleanup(t, e2SubsId, 10) |
| 6867 | |
| 6868 | mainCtrl.VerifyCounterValues(t) |
| 6869 | } |
| 6870 | |
| 6871 | //----------------------------------------------------------------------------- |
| 6872 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6873 | // |
| 6874 | // stub stub |
| 6875 | // +-------+ +---------+ +---------+ |
| 6876 | // | xapp | | submgr | | e2term | |
| 6877 | // +-------+ +---------+ +---------+ |
| 6878 | // | | | |
| 6879 | // | RESTSubReq | | |
| 6880 | // |---------------->| | |
| 6881 | // | | | |
| 6882 | // | RESTSubResp | | |
| 6883 | // |<----------------| | |
| 6884 | // | | SubReq | |
| 6885 | // | |------------->| |
| 6886 | // | | | |
| 6887 | // | | SubResp | |
| 6888 | // | |<-------------| |
| 6889 | // | | | |
| 6890 | // | RESTNotif | | |
| 6891 | // |<----------------| | |
| 6892 | // | | | |
| 6893 | // | RESTSubReq | | |
| 6894 | // |---------------->| | |
| 6895 | // | | | |
| 6896 | // | RESTSubResp | | |
| 6897 | // |<----------------| | |
| 6898 | // | | SubReq | |
| 6899 | // | |------------->| |
| 6900 | // | | |
| 6901 | // | Submgr restart | |
| 6902 | // | | | |
| 6903 | // | RESTSubDelReq | | |
| 6904 | // |---------------->| | |
| 6905 | // | | | |
| 6906 | // | | SubDelReq | |
| 6907 | // | |------------->| |
| 6908 | // | | | |
| 6909 | // | | SubDelResp | |
| 6910 | // | |<-------------| |
| 6911 | // | | | |
| 6912 | // | RESTSubDelResp | | |
| 6913 | // |<----------------| | |
| 6914 | // |
| 6915 | //----------------------------------------------------------------------------- |
| 6916 | |
| 6917 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6918 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6919 | |
| 6920 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6921 | Counter{cRestSubReqFromXapp, 2}, |
| 6922 | Counter{cRestSubRespToXapp, 2}, |
| 6923 | Counter{cSubReqToE2, 2}, |
| 6924 | Counter{cSubRespFromE2, 1}, |
| 6925 | Counter{cRestSubNotifToXapp, 1}, |
| 6926 | Counter{cRestSubNotifToXapp, 1}, |
| 6927 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6928 | Counter{cSubDelReqToE2, 1}, |
| 6929 | Counter{cRestSubDelRespToXapp, 1}, |
| 6930 | }) |
| 6931 | |
| 6932 | // Remove possible existing subscription |
| 6933 | mainCtrl.removeExistingSubscriptions(t) |
| 6934 | |
| 6935 | const e2Timeout int64 = 1 |
| 6936 | const e2RetryCount int64 = 0 |
| 6937 | const routingNeeded bool = false |
| 6938 | |
| 6939 | // Req1 |
| 6940 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6941 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6942 | // Create subscription |
| 6943 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6944 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6945 | |
| 6946 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6947 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6948 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6949 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6950 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6951 | |
| 6952 | // Check subscription |
| 6953 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6954 | |
| 6955 | // Policy change |
| 6956 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6957 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6958 | params.SetSubscriptionID(&restSubId) |
| 6959 | params.SetTimeToWait("w200ms") |
| 6960 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 6961 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6962 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6963 | |
| 6964 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6965 | mainCtrl.SetResetTestFlag(t, false) |
| 6966 | |
| 6967 | // SubsResp is missing due to submgr restart |
| 6968 | |
| 6969 | mainCtrl.SimulateRestart(t) |
| 6970 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 6971 | |
| 6972 | // Check subscription |
| 6973 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6974 | |
| 6975 | xapp.Logger.Debug("Here 1") |
| 6976 | //<-time.After(3 * time.Second) |
| 6977 | xapp.Logger.Debug("Here 2") |
| 6978 | |
| 6979 | // Delete subscription |
| 6980 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6981 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6982 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6983 | |
| 6984 | //Wait that subs is cleaned |
| 6985 | waitSubsCleanup(t, e2SubsId, 10) |
| 6986 | |
| 6987 | mainCtrl.VerifyCounterValues(t) |
| 6988 | } |
| 6989 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6990 | //////////////////////////////////////////////////////////////////////////////////// |
| 6991 | // Services for UT cases |
| 6992 | //////////////////////////////////////////////////////////////////////////////////// |
| 6993 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6994 | const host string = "localhost" |
| 6995 | |
| 6996 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6997 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6998 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6999 | } |
| 7000 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7001 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7002 | |
| 7003 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 7004 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7005 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 7006 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7007 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7008 | |
| 7009 | return restSubId, e2SubsId |
| 7010 | } |
| 7011 | |
| 7012 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 7013 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7014 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7015 | if meid != "" { |
| 7016 | params.SetMeid(meid) |
| 7017 | } |
| 7018 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 7019 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 7020 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7021 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7022 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7023 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7024 | |
| 7025 | return restSubId, e2SubsId |
| 7026 | } |
| 7027 | |
| 7028 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7029 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7030 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7031 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7032 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7033 | |
| 7034 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7035 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7036 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7037 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7038 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7039 | |
| 7040 | return restSubId, e2SubsId |
| 7041 | } |
| 7042 | |
| 7043 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7044 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7045 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7046 | |
| 7047 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7048 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7049 | fparams1.Set(crereq1) |
| 7050 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7051 | |
| 7052 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7053 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7054 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7055 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7056 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7057 | |
| 7058 | return restSubId, e2SubsId |
| 7059 | } |
| 7060 | |
| 7061 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7062 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7063 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7064 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7065 | } |
| 7066 | |
| 7067 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7068 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7069 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7070 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7071 | } |
| 7072 | |
| 7073 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7074 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7075 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7076 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7077 | } |
| 7078 | |
| 7079 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7080 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 7081 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 7082 | assert.Equal(t, resp[0].Meid, meid) |
| 7083 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 7084 | } |
| 7085 | |
| 7086 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7087 | //Wait that subs is cleaned |
| 7088 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7089 | |
| 7090 | xappConn1.TestMsgChanEmpty(t) |
| 7091 | xappConn2.TestMsgChanEmpty(t) |
| 7092 | e2termConn1.TestMsgChanEmpty(t) |
| 7093 | mainCtrl.wait_registry_empty(t, timeout) |
| 7094 | } |
| 7095 | |
| 7096 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7097 | |
| 7098 | var e2SubsId []uint32 |
| 7099 | |
| 7100 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7101 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7102 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7103 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7104 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7105 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7106 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7107 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7108 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7109 | <-time.After(100 * time.Millisecond) |
| 7110 | } |
| 7111 | return e2SubsId |
| 7112 | } |
| 7113 | |
| 7114 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7115 | |
| 7116 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7117 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7118 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7119 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7120 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7121 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7122 | <-time.After(100 * time.Millisecond) |
| 7123 | } |
| 7124 | |
| 7125 | // Wait that subs is cleaned |
| 7126 | for i := 0; i < len(e2SubsIds); i++ { |
| 7127 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7128 | } |
| 7129 | |
| 7130 | } |