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 | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 42 | mainCtrl.InitAllCounterMap() |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 43 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 44 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 45 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 46 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 47 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 48 | |
| 49 | // Current UT test cases use these ran names |
| 50 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 51 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 52 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 53 | |
| 54 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 55 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 56 | |
| 57 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 58 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 59 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
| 60 | } |
| 61 | |
| 62 | //----------------------------------------------------------------------------- |
| 63 | // TestRESTSubReqAfterE2ConnBreak |
| 64 | // |
| 65 | // stub stub |
| 66 | // +-------+ +---------+ +---------+ |
| 67 | // | xapp | | submgr | | e2term | |
| 68 | // +-------+ +---------+ +---------+ |
| 69 | // | | | |
| 70 | // | [E2 Conn. DOWN] | |
| 71 | // | | | |
| 72 | // | RESTSubReq | | |
| 73 | // |---------------->| | |
| 74 | // | RESTSubFail | | |
| 75 | // |<----------------| | |
| 76 | // | | | |
| 77 | // |
| 78 | //----------------------------------------------------------------------------- |
| 79 | |
| 80 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
| 81 | CaseBegin("TestRESTSubReqAfterE2ConnBreak") |
| 82 | |
| 83 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 84 | Counter{cRestSubReqFromXapp, 1}, |
| 85 | Counter{cRestReqRejDueE2Down, 1}, |
| 86 | }) |
| 87 | |
| 88 | // E2 disconnect after E2term has received response |
| 89 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 90 | // Req |
| 91 | const subReqCount int = 1 |
| 92 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 93 | xappConn1.SendRESTSubsReq(t, params) |
| 94 | |
| 95 | // Restore E2 connection for following test cases |
| 96 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 97 | |
| 98 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 99 | //os.Exit(1) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | //----------------------------------------------------------------------------- |
| 103 | // TestRESTSubReqE2ConnBreak |
| 104 | // |
| 105 | // stub stub |
| 106 | // +-------+ +---------+ +---------+ |
| 107 | // | xapp | | submgr | | e2term | |
| 108 | // +-------+ +---------+ +---------+ |
| 109 | // | | | |
| 110 | // | RESTSubReq | | |
| 111 | // |---------------->| | |
| 112 | // | RESTSubResp | | |
| 113 | // |<----------------| | |
| 114 | // | | SubReq | |
| 115 | // | |------------->| |
| 116 | // | | SubResp | |
| 117 | // | |<-------------| |
| 118 | // | | | |
| 119 | // | [E2 Conn. DOWN] | |
| 120 | // | [Int. SUBS DELETE] | |
| 121 | // | | | |
| 122 | // | RESTNotif(unsuccessful) | |
| 123 | // |<----------------| | |
| 124 | // | | | |
| 125 | // | | | |
| 126 | // |
| 127 | //----------------------------------------------------------------------------- |
| 128 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
| 129 | CaseBegin("TestRESTSubReqE2ConnBreak") |
| 130 | |
| 131 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 132 | Counter{cRestSubReqFromXapp, 1}, |
| 133 | Counter{cRestSubRespToXapp, 1}, |
| 134 | Counter{cSubReqToE2, 1}, |
| 135 | Counter{cSubRespFromE2, 1}, |
| 136 | Counter{cRestSubFailNotifToXapp, 1}, |
| 137 | }) |
| 138 | |
| 139 | // Req |
| 140 | const subReqCount int = 1 |
| 141 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 142 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 143 | |
| 144 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 145 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 146 | |
| 147 | // E2 disconnect after E2term has received response |
| 148 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 149 | |
| 150 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 151 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 152 | |
| 153 | <-time.After(time.Second * 1) |
| 154 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 155 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 156 | |
| 157 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 158 | if err != nil { |
| 159 | xapp.Logger.Error("%v", err) |
| 160 | } else { |
| 161 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 162 | assert.Equal(t, 0, len(register)) |
| 163 | } |
| 164 | |
| 165 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 166 | if err != nil { |
| 167 | xapp.Logger.Error("%v", err) |
| 168 | } else { |
| 169 | assert.Equal(t, 0, len(restSubscriptions)) |
| 170 | } |
| 171 | |
| 172 | // Restore E2 connection for following test cases |
| 173 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 174 | |
| 175 | // Wait that subs is cleaned |
| 176 | waitSubsCleanup(t, e2SubsId, 10) |
| 177 | mainCtrl.VerifyCounterValues(t) |
| 178 | } |
| 179 | |
| 180 | //----------------------------------------------------------------------------- |
| 181 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 182 | // |
| 183 | // stub stub |
| 184 | // +-------+ +---------+ +---------+ |
| 185 | // | xapp | | submgr | | e2term | |
| 186 | // +-------+ +---------+ +---------+ |
| 187 | // | | | |
| 188 | // | [SUBS CREATE] | |
| 189 | // | | | |
| 190 | // | [E2 Conn. DOWN] | |
| 191 | // | | | |
| 192 | // | RESTSubDelReq | | |
| 193 | // |---------------->| | |
| 194 | // | | | |
| 195 | // | RESTSubDelResp | | |
| 196 | // |<----------------| | |
| 197 | // | | | |
| 198 | // | [No valid subscription found] | |
| 199 | // | | | |
| 200 | // |
| 201 | //----------------------------------------------------------------------------- |
| 202 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 203 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 204 | |
| 205 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 206 | Counter{cRestSubReqFromXapp, 1}, |
| 207 | Counter{cRestSubRespToXapp, 1}, |
| 208 | Counter{cSubReqToE2, 1}, |
| 209 | Counter{cSubRespFromE2, 1}, |
| 210 | Counter{cRestSubNotifToXapp, 1}, |
| 211 | Counter{cRestSubDelReqFromXapp, 1}, |
| 212 | Counter{cRestSubDelRespToXapp, 1}, |
| 213 | }) |
| 214 | |
| 215 | // Req |
| 216 | var params *teststube2ap.RESTSubsReqParams = nil |
| 217 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 218 | |
| 219 | // E2 disconnect after E2term has received response |
| 220 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 221 | |
| 222 | // Del |
| 223 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 224 | |
| 225 | <-time.After(time.Second * 1) |
| 226 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 227 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 228 | |
| 229 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 230 | if err != nil { |
| 231 | xapp.Logger.Error("%v", err) |
| 232 | } else { |
| 233 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 234 | assert.Equal(t, 0, len(register)) |
| 235 | } |
| 236 | |
| 237 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 238 | if err != nil { |
| 239 | xapp.Logger.Error("%v", err) |
| 240 | } else { |
| 241 | assert.Equal(t, 0, len(restSubscriptions)) |
| 242 | } |
| 243 | |
| 244 | // Restore E2 connection for following test cases |
| 245 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 246 | |
| 247 | // Wait that subs is cleaned |
| 248 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 249 | |
| 250 | xappConn1.TestMsgChanEmpty(t) |
| 251 | e2termConn1.TestMsgChanEmpty(t) |
| 252 | mainCtrl.wait_registry_empty(t, 10) |
| 253 | mainCtrl.VerifyCounterValues(t) |
| 254 | } |
| 255 | |
| 256 | //----------------------------------------------------------------------------- |
| 257 | // TestRESTOtherE2ConnectionChanges |
| 258 | // |
| 259 | |
| 260 | // stub stub |
| 261 | // +-------+ +---------+ +---------+ |
| 262 | // | xapp | | submgr | | e2term | |
| 263 | // +-------+ +---------+ +---------+ |
| 264 | // | | | |
| 265 | // | [SUBS CREATE] | |
| 266 | // | | | |
| 267 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 268 | // | [E2 CONNECTING] | |
| 269 | // | [E2 SHUTTING_DOWN] | |
| 270 | // | [E2 SHUT_DOWN] | |
| 271 | // | | | |
| 272 | // | [SUBS DELETE] | |
| 273 | // | | | |
| 274 | // |
| 275 | //----------------------------------------------------------------------------- |
| 276 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 277 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 278 | |
| 279 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 280 | Counter{cRestSubReqFromXapp, 1}, |
| 281 | Counter{cRestSubRespToXapp, 1}, |
| 282 | Counter{cSubReqToE2, 1}, |
| 283 | Counter{cSubRespFromE2, 1}, |
| 284 | Counter{cRestSubNotifToXapp, 1}, |
| 285 | Counter{cRestSubDelReqFromXapp, 1}, |
| 286 | Counter{cSubDelReqToE2, 1}, |
| 287 | Counter{cSubDelRespFromE2, 1}, |
| 288 | Counter{cRestSubDelRespToXapp, 1}, |
| 289 | }) |
| 290 | |
| 291 | // Req |
| 292 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 293 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 294 | |
| 295 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 296 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 297 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 298 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 299 | |
| 300 | // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED |
| 301 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 302 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 303 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 304 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 305 | |
| 306 | // Del |
| 307 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 308 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 309 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 310 | |
| 311 | // Restore E2 connection for following test cases |
| 312 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 313 | |
| 314 | // Wait that subs is cleaned |
| 315 | waitSubsCleanup(t, e2SubsId, 10) |
| 316 | mainCtrl.VerifyCounterValues(t) |
| 317 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 318 | |
| 319 | //----------------------------------------------------------------------------- |
| 320 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 321 | // |
| 322 | // stub stub stub |
| 323 | // +-------+ +---------+ +---------+ +---------+ |
| 324 | // | xapp | | submgr | | e2term | | rtmgr | |
| 325 | // +-------+ +---------+ +---------+ +---------+ |
| 326 | // | | | | |
| 327 | // | RESTSubReq | | | |
| 328 | // |---------------->| | | |
| 329 | // | | RouteCreate | | |
| 330 | // | |--------------------------->| // The order of these events may vary |
| 331 | // | | | | |
| 332 | // | RESTSubResp | | | // The order of these events may vary |
| 333 | // |<----------------| | | |
| 334 | // | | RouteResponse| | |
| 335 | // | |<---------------------------| // The order of these events may vary |
| 336 | // | | | | |
| 337 | // | | SubReq | | |
| 338 | // | |------------->| | // The order of these events may vary |
| 339 | // | | | | |
| 340 | // | | SubResp | | |
| 341 | // | |<-------------| | |
| 342 | // | RESTNotif1 | | | |
| 343 | // |<----------------| | | |
| 344 | // | | | | |
| 345 | // | RESTSubDelReq | | | |
| 346 | // |---------------->| | | |
| 347 | // | | SubDelReq | | |
| 348 | // | |------------->| | |
| 349 | // | | | | |
| 350 | // | RESTSubDelResp| | | |
| 351 | // |<----------------| | | |
| 352 | // | | | | |
| 353 | // | | SubDelResp | | |
| 354 | // | |<-------------| | |
| 355 | // | | | | |
| 356 | // | | | | |
| 357 | // |
| 358 | //----------------------------------------------------------------------------- |
| 359 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 360 | |
| 361 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 362 | |
| 363 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 364 | |
| 365 | waitSubsCleanup(t, e2SubsId, 10) |
| 366 | } |
| 367 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 368 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 369 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 370 | // |
| 371 | // stub stub stub |
| 372 | // +-------+ +---------+ +---------+ +---------+ |
| 373 | // | xapp | | submgr | | e2term | | rtmgr | |
| 374 | // +-------+ +---------+ +---------+ +---------+ |
| 375 | // | | | | |
| 376 | // | RESTSubReq | | | |
| 377 | // |---------------->| | | |
| 378 | // | | RouteCreate | | |
| 379 | // | |--------------------------->| // The order of these events may vary |
| 380 | // | | | | |
| 381 | // | RESTSubResp | | | // The order of these events may vary |
| 382 | // |<----------------| | | |
| 383 | // | | RouteResponse| | |
| 384 | // | |<---------------------------| // The order of these events may vary |
| 385 | // | | | | |
| 386 | // | | SubReq | | |
| 387 | // | |------------->| | // The order of these events may vary |
| 388 | // | | | | |
| 389 | // | | SubResp | | |
| 390 | // | |<-------------| | |
| 391 | // | RESTNotif1 | | | |
| 392 | // |<----------------| | | |
| 393 | // | | | | |
| 394 | // | RESTSubDelReq | | | |
| 395 | // |---------------->| | | |
| 396 | // | | | | |
| 397 | // | RESTSubDelResp| | | |
| 398 | // |<----------------| | | |
| 399 | // | | | | |
| 400 | // | | | | |
| 401 | // |
| 402 | //----------------------------------------------------------------------------- |
| 403 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 404 | |
| 405 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 406 | |
| 407 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 408 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 409 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 410 | |
| 411 | waitSubsCleanup(t, e2SubsId, 10) |
| 412 | } |
| 413 | |
| 414 | //----------------------------------------------------------------------------- |
| 415 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 416 | // |
| 417 | // stub stub stub |
| 418 | // +-------+ +---------+ +---------+ +---------+ |
| 419 | // | xapp | | submgr | | e2term | | rtmgr | |
| 420 | // +-------+ +---------+ +---------+ +---------+ |
| 421 | // | | | | |
| 422 | // | RESTSubReq | | | |
| 423 | // |---------------->| | | |
| 424 | // | | RouteCreate | | |
| 425 | // | |--------------------------->| // The order of these events may vary |
| 426 | // | | | | |
| 427 | // | RESTSubResp | | | // The order of these events may vary |
| 428 | // |<----------------| | | |
| 429 | // | | RouteResponse| | |
| 430 | // | |<---------------------------| // The order of these events may vary |
| 431 | // | | | | |
| 432 | // | | SubReq | | |
| 433 | // | |------------->| | // The order of these events may vary |
| 434 | // | | | | |
| 435 | // | | SubResp | | |
| 436 | // | |<-------------| | |
| 437 | // | RESTNotif1 | | | |
| 438 | // |<----------------| | | |
| 439 | // | | | | |
| 440 | // | RESTSubDelReq | | | |
| 441 | // |---------------->| | | |
| 442 | // | | SubDelReq | | |
| 443 | // | |------------->| | |
| 444 | // | | | | |
| 445 | // | RESTSubDelResp| | | |
| 446 | // |<----------------| | | // The order of these events may vary |
| 447 | // | | | | |
| 448 | // | | SubDelResp | | |
| 449 | // | |<-------------| | // 1.st NOK |
| 450 | // | | | | |
| 451 | // | | SubDelReq | | |
| 452 | // | |------------->| | |
| 453 | // | | | | |
| 454 | // | | SubDelResp | | |
| 455 | // | |<-------------| | // 2.nd NOK |
| 456 | // |
| 457 | //----------------------------------------------------------------------------- |
| 458 | |
| 459 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 460 | |
| 461 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 462 | |
| 463 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 464 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 465 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 466 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 467 | |
| 468 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 469 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 470 | |
| 471 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 472 | |
| 473 | waitSubsCleanup(t, e2SubsId, 10) |
| 474 | } |
| 475 | |
| 476 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 477 | // TestSubReqAndRouteNok |
| 478 | // |
| 479 | // stub stub |
| 480 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 481 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 482 | // +-------+ +---------+ +---------+ |
| 483 | // | | | |
| 484 | // | SubReq | | |
| 485 | // |------------->| | |
| 486 | // | | | |
| 487 | // | | RouteCreate | |
| 488 | // | |------------->| |
| 489 | // | | | |
| 490 | // | | RouteCreate | |
| 491 | // | | status:400 | |
| 492 | // | |<-------------| |
| 493 | // | | | |
| 494 | // | [SUBS INT DELETE] | |
| 495 | // | | | |
| 496 | // |
| 497 | //----------------------------------------------------------------------------- |
| 498 | |
| 499 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 500 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 501 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 502 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 503 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 504 | Counter{cSubReqFromXapp, 1}, |
| 505 | Counter{cRouteCreateFail, 1}, |
| 506 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 507 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 508 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 509 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 510 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 511 | waiter.WaitResult(t) |
| 512 | |
| 513 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 514 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 515 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 516 | xappConn1.TestMsgChanEmpty(t) |
| 517 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 518 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 519 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 520 | |
| 521 | <-time.After(1 * time.Second) |
| 522 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 526 | // TestSubReqAndRouteUpdateNok |
| 527 | |
| 528 | // stub stub |
| 529 | // +-------+ +-------+ +---------+ +---------+ |
| 530 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 531 | // +-------+ +-------+ +---------+ +---------+ |
| 532 | // | | | | |
| 533 | // | [SUBS CREATE] | | |
| 534 | // | | | | |
| 535 | // | | | | |
| 536 | // | | | | |
| 537 | // | SubReq (mergeable) | | |
| 538 | // |--------------------------->| | | |
| 539 | // | | | | |
| 540 | // | | | RouteUpdate | |
| 541 | // | | |------------->| |
| 542 | // | | | | |
| 543 | // | | | RouteUpdate | |
| 544 | // | | | status:400 | |
| 545 | // | | |<-------------| |
| 546 | // | | | | |
| 547 | // | [SUBS INT DELETE] | | |
| 548 | // | | | | |
| 549 | // | | | | |
| 550 | // | [SUBS DELETE] | | |
| 551 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 552 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 553 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 554 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 555 | |
| 556 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 557 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 558 | Counter{cSubReqFromXapp, 2}, |
| 559 | Counter{cSubReqToE2, 1}, |
| 560 | Counter{cSubRespFromE2, 1}, |
| 561 | Counter{cSubRespToXapp, 1}, |
| 562 | Counter{cRouteCreateUpdateFail, 1}, |
| 563 | Counter{cSubDelReqFromXapp, 1}, |
| 564 | Counter{cSubDelReqToE2, 1}, |
| 565 | Counter{cSubDelRespFromE2, 1}, |
| 566 | Counter{cSubDelRespToXapp, 1}, |
| 567 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 568 | |
| 569 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 570 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 571 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 572 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 573 | |
| 574 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 575 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 576 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 577 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 578 | |
| 579 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 580 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 581 | xappConn2.SendSubsReq(t, nil, nil) |
| 582 | waiter.WaitResult(t) |
| 583 | |
| 584 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 585 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 586 | |
| 587 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 588 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 589 | |
| 590 | //Wait that subs is cleaned |
| 591 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 592 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 593 | |
| 594 | xappConn1.TestMsgChanEmpty(t) |
| 595 | xappConn2.TestMsgChanEmpty(t) |
| 596 | e2termConn1.TestMsgChanEmpty(t) |
| 597 | mainCtrl.wait_registry_empty(t, 10) |
| 598 | |
| 599 | mainCtrl.VerifyCounterValues(t) |
| 600 | } |
| 601 | |
| 602 | //----------------------------------------------------------------------------- |
| 603 | // TestSubDelReqAndRouteDeleteNok |
| 604 | // |
| 605 | // stub stub |
| 606 | // +-------+ +---------+ +---------+ +---------+ |
| 607 | // | xapp | | submgr | | e2term | | rtmgr | |
| 608 | // +-------+ +---------+ +---------+ +---------+ |
| 609 | // | | | | |
| 610 | // | [SUBS CREATE] | | |
| 611 | // | | | | |
| 612 | // | | | | |
| 613 | // | | | | |
| 614 | // | SubDelReq | | | |
| 615 | // |------------->| | | |
| 616 | // | | SubDelReq | | |
| 617 | // | |------------->| | |
| 618 | // | | SubDelRsp | | |
| 619 | // | |<-------------| | |
| 620 | // | SubDelRsp | | | |
| 621 | // |<-------------| | | |
| 622 | // | | RouteDelete | | |
| 623 | // | |---------------------------->| |
| 624 | // | | | | |
| 625 | // | | RouteDelete | | |
| 626 | // | | status:400 | | |
| 627 | // | |<----------------------------| |
| 628 | // | | | | |
| 629 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 630 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 631 | |
| 632 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 633 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 634 | Counter{cSubReqFromXapp, 1}, |
| 635 | Counter{cSubReqToE2, 1}, |
| 636 | Counter{cSubRespFromE2, 1}, |
| 637 | Counter{cSubRespToXapp, 1}, |
| 638 | Counter{cSubDelReqFromXapp, 1}, |
| 639 | Counter{cRouteDeleteFail, 1}, |
| 640 | Counter{cSubDelReqToE2, 1}, |
| 641 | Counter{cSubDelRespFromE2, 1}, |
| 642 | Counter{cSubDelRespToXapp, 1}, |
| 643 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 644 | |
| 645 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 646 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 647 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 648 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 649 | |
| 650 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 651 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 652 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 653 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 654 | |
| 655 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 656 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 657 | |
| 658 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 659 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 660 | waiter.WaitResult(t) |
| 661 | |
| 662 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 663 | |
| 664 | //Wait that subs is cleaned |
| 665 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 666 | |
| 667 | xappConn1.TestMsgChanEmpty(t) |
| 668 | xappConn2.TestMsgChanEmpty(t) |
| 669 | e2termConn1.TestMsgChanEmpty(t) |
| 670 | mainCtrl.wait_registry_empty(t, 10) |
| 671 | |
| 672 | mainCtrl.VerifyCounterValues(t) |
| 673 | } |
| 674 | |
| 675 | //----------------------------------------------------------------------------- |
| 676 | // TestSubMergeDelAndRouteUpdateNok |
| 677 | // stub stub |
| 678 | // +-------+ +-------+ +---------+ +---------+ |
| 679 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 680 | // +-------+ +-------+ +---------+ +---------+ |
| 681 | // | | | | |
| 682 | // | | | | |
| 683 | // | | | | |
| 684 | // | | SubReq1 | | |
| 685 | // | |------------->| | |
| 686 | // | | | | |
| 687 | // | | | SubReq1 | |
| 688 | // | | |------------->| |
| 689 | // | | | SubResp1 | |
| 690 | // | | |<-------------| |
| 691 | // | | SubResp1 | | |
| 692 | // | |<-------------| | |
| 693 | // | | | | |
| 694 | // | SubReq2 | | |
| 695 | // |--------------------------->| | |
| 696 | // | | | | |
| 697 | // | SubResp2 | | |
| 698 | // |<---------------------------| | |
| 699 | // | | | | |
| 700 | // | | SubDelReq 1 | | |
| 701 | // | |------------->| | |
| 702 | // | | | RouteUpdate | |
| 703 | // | | |-----> rtmgr | |
| 704 | // | | | | |
| 705 | // | | | RouteUpdate | |
| 706 | // | | | status:400 | |
| 707 | // | | |<----- rtmgr | |
| 708 | // | | | | |
| 709 | // | | SubDelResp 1 | | |
| 710 | // | |<-------------| | |
| 711 | // | | | | |
| 712 | // | SubDelReq 2 | | |
| 713 | // |--------------------------->| | |
| 714 | // | | | | |
| 715 | // | | | SubDelReq 2 | |
| 716 | // | | |------------->| |
| 717 | // | | | | |
| 718 | // | | | SubDelReq 2 | |
| 719 | // | | |------------->| |
| 720 | // | | | | |
| 721 | // | SubDelResp 2 | | |
| 722 | // |<---------------------------| | |
| 723 | // |
| 724 | //----------------------------------------------------------------------------- |
| 725 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 726 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 727 | |
| 728 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 729 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 730 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 731 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 732 | Counter{cSubReqToE2, 1}, |
| 733 | Counter{cSubRespFromE2, 1}, |
| 734 | Counter{cSubRespToXapp, 2}, |
| 735 | Counter{cSubDelReqFromXapp, 2}, |
| 736 | Counter{cRouteDeleteUpdateFail, 1}, |
| 737 | Counter{cSubDelReqToE2, 1}, |
| 738 | Counter{cSubDelRespFromE2, 1}, |
| 739 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 740 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 741 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 742 | |
| 743 | //Req1 |
| 744 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 745 | rparams1.Init() |
| 746 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 747 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 748 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 749 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 750 | |
| 751 | //Req2 |
| 752 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 753 | rparams2.Init() |
| 754 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 755 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 756 | |
| 757 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 758 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 759 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 760 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 761 | |
| 762 | //Del1 |
| 763 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 764 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 765 | waiter.WaitResult(t) |
| 766 | |
| 767 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 768 | |
| 769 | //Del2 |
| 770 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 771 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 772 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 773 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 774 | //Wait that subs is cleaned |
| 775 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 776 | |
| 777 | xappConn1.TestMsgChanEmpty(t) |
| 778 | xappConn2.TestMsgChanEmpty(t) |
| 779 | e2termConn1.TestMsgChanEmpty(t) |
| 780 | mainCtrl.wait_registry_empty(t, 10) |
| 781 | |
| 782 | mainCtrl.VerifyCounterValues(t) |
| 783 | } |
| 784 | |
| 785 | //----------------------------------------------------------------------------- |
| 786 | |
| 787 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 788 | // TestSubReqAndSubDelOk |
| 789 | // |
| 790 | // stub stub |
| 791 | // +-------+ +---------+ +---------+ |
| 792 | // | xapp | | submgr | | e2term | |
| 793 | // +-------+ +---------+ +---------+ |
| 794 | // | | | |
| 795 | // | SubReq | | |
| 796 | // |------------->| | |
| 797 | // | | | |
| 798 | // | | SubReq | |
| 799 | // | |------------->| |
| 800 | // | | | |
| 801 | // | | SubResp | |
| 802 | // | |<-------------| |
| 803 | // | | | |
| 804 | // | SubResp | | |
| 805 | // |<-------------| | |
| 806 | // | | | |
| 807 | // | | | |
| 808 | // | SubDelReq | | |
| 809 | // |------------->| | |
| 810 | // | | | |
| 811 | // | | SubDelReq | |
| 812 | // | |------------->| |
| 813 | // | | | |
| 814 | // | | SubDelResp | |
| 815 | // | |<-------------| |
| 816 | // | | | |
| 817 | // | SubDelResp | | |
| 818 | // |<-------------| | |
| 819 | // |
| 820 | //----------------------------------------------------------------------------- |
| 821 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 822 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 823 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 824 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 825 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 826 | Counter{cSubReqFromXapp, 1}, |
| 827 | Counter{cSubReqToE2, 1}, |
| 828 | Counter{cSubRespFromE2, 1}, |
| 829 | Counter{cSubRespToXapp, 1}, |
| 830 | Counter{cSubDelReqFromXapp, 1}, |
| 831 | Counter{cSubDelReqToE2, 1}, |
| 832 | Counter{cSubDelRespFromE2, 1}, |
| 833 | Counter{cSubDelRespToXapp, 1}, |
| 834 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 835 | |
| 836 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 837 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 838 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 839 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 840 | |
| 841 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 842 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 843 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 844 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 845 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 847 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 848 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 849 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 850 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 851 | |
| 852 | //Wait that subs is cleaned |
| 853 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 854 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 855 | xappConn1.TestMsgChanEmpty(t) |
| 856 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 857 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 858 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 859 | |
| 860 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 861 | } |
| 862 | |
| 863 | //----------------------------------------------------------------------------- |
| 864 | // TestSubReqRetransmission |
| 865 | // |
| 866 | // stub stub |
| 867 | // +-------+ +---------+ +---------+ |
| 868 | // | xapp | | submgr | | e2term | |
| 869 | // +-------+ +---------+ +---------+ |
| 870 | // | | | |
| 871 | // | SubReq | | |
| 872 | // |------------->| | |
| 873 | // | | | |
| 874 | // | | SubReq | |
| 875 | // | |------------->| |
| 876 | // | | | |
| 877 | // | SubReq | | |
| 878 | // | (retrans) | | |
| 879 | // |------------->| | |
| 880 | // | | | |
| 881 | // | | SubResp | |
| 882 | // | |<-------------| |
| 883 | // | | | |
| 884 | // | SubResp | | |
| 885 | // |<-------------| | |
| 886 | // | | | |
| 887 | // | [SUBS DELETE] | |
| 888 | // | | | |
| 889 | // |
| 890 | //----------------------------------------------------------------------------- |
| 891 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 892 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 893 | |
| 894 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 895 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 896 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 897 | |
| 898 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 899 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 900 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 901 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 902 | // hack as there is no real way to see has message be handled. |
| 903 | // Previuos counter check just tells that is has been received by submgr |
| 904 | // --> artificial delay |
| 905 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 906 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 907 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 908 | |
| 909 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 910 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 911 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 912 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 913 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 914 | |
| 915 | //Wait that subs is cleaned |
| 916 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 917 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 918 | xappConn1.TestMsgChanEmpty(t) |
| 919 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 920 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 921 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 922 | } |
| 923 | |
| 924 | //----------------------------------------------------------------------------- |
| 925 | // TestSubDelReqRetransmission |
| 926 | // |
| 927 | // stub stub |
| 928 | // +-------+ +---------+ +---------+ |
| 929 | // | xapp | | submgr | | e2term | |
| 930 | // +-------+ +---------+ +---------+ |
| 931 | // | | | |
| 932 | // | [SUBS CREATE] | |
| 933 | // | | | |
| 934 | // | | | |
| 935 | // | SubDelReq | | |
| 936 | // |------------->| | |
| 937 | // | | | |
| 938 | // | | SubDelReq | |
| 939 | // | |------------->| |
| 940 | // | | | |
| 941 | // | SubDelReq | | |
| 942 | // | (same sub) | | |
| 943 | // | (same xid) | | |
| 944 | // |------------->| | |
| 945 | // | | | |
| 946 | // | | SubDelResp | |
| 947 | // | |<-------------| |
| 948 | // | | | |
| 949 | // | SubDelResp | | |
| 950 | // |<-------------| | |
| 951 | // |
| 952 | //----------------------------------------------------------------------------- |
| 953 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 954 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 955 | |
| 956 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 957 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 958 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 959 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 960 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 961 | |
| 962 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 963 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 964 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 965 | |
| 966 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 967 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 968 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 969 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 970 | // hack as there is no real way to see has message be handled. |
| 971 | // Previuos counter check just tells that is has been received by submgr |
| 972 | // --> artificial delay |
| 973 | <-time.After(1 * time.Second) |
| 974 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 975 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 976 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 977 | |
| 978 | //Wait that subs is cleaned |
| 979 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 980 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 981 | xappConn1.TestMsgChanEmpty(t) |
| 982 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 983 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 984 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 985 | } |
| 986 | |
| 987 | //----------------------------------------------------------------------------- |
| 988 | // TestSubDelReqCollision |
| 989 | // |
| 990 | // stub stub |
| 991 | // +-------+ +---------+ +---------+ |
| 992 | // | xapp | | submgr | | e2term | |
| 993 | // +-------+ +---------+ +---------+ |
| 994 | // | | | |
| 995 | // | [SUBS CREATE] | |
| 996 | // | | | |
| 997 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 998 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 999 | // |------------->| | |
| 1000 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1001 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1002 | // | |------------->| |
| 1003 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1004 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1005 | // | (same sub) | | |
| 1006 | // | (diff xid) | | |
| 1007 | // |------------->| | |
| 1008 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1009 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1010 | // | |<-------------| |
| 1011 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1012 | // | SubDelResp 1 | | |
| 1013 | // |<-------------| | |
| 1014 | // | | | |
| 1015 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1016 | // |<-------------| | |
| 1017 | // |
| 1018 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1019 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1020 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1021 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1022 | |
| 1023 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1024 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1025 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1026 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1027 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | |
| 1029 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1030 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1031 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1032 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1033 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1034 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1035 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1036 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1037 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1038 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1039 | // hack as there is no real way to see has message be handled. |
| 1040 | // Previuos counter check just tells that is has been received by submgr |
| 1041 | // --> artificial delay |
| 1042 | <-time.After(1 * time.Second) |
| 1043 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1044 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1045 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1046 | |
| 1047 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1048 | xappConn1.RecvSubsDelResp(t, nil) |
| 1049 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1050 | |
| 1051 | //Wait that subs is cleaned |
| 1052 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1053 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1054 | xappConn1.TestMsgChanEmpty(t) |
| 1055 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1056 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1057 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | //----------------------------------------------------------------------------- |
| 1061 | // TestSubReqAndSubDelOkTwoParallel |
| 1062 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1063 | // stub stub stub |
| 1064 | // +-------+ +-------+ +---------+ +---------+ |
| 1065 | // | xapp | | xapp | | submgr | | e2term | |
| 1066 | // +-------+ +-------+ +---------+ +---------+ |
| 1067 | // | | | | |
| 1068 | // | | | | |
| 1069 | // | | | | |
| 1070 | // | | SubReq1 | | |
| 1071 | // | |------------->| | |
| 1072 | // | | | | |
| 1073 | // | | | SubReq1 | |
| 1074 | // | | |------------->| |
| 1075 | // | | | | |
| 1076 | // | SubReq2 | | |
| 1077 | // |------------------------>| | |
| 1078 | // | | | | |
| 1079 | // | | | SubReq2 | |
| 1080 | // | | |------------->| |
| 1081 | // | | | | |
| 1082 | // | | | SubResp1 | |
| 1083 | // | | |<-------------| |
| 1084 | // | | SubResp1 | | |
| 1085 | // | |<-------------| | |
| 1086 | // | | | | |
| 1087 | // | | | SubResp2 | |
| 1088 | // | | |<-------------| |
| 1089 | // | SubResp2 | | |
| 1090 | // |<------------------------| | |
| 1091 | // | | | | |
| 1092 | // | | [SUBS 1 DELETE] | |
| 1093 | // | | | | |
| 1094 | // | | [SUBS 2 DELETE] | |
| 1095 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1096 | // |
| 1097 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1098 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1099 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1100 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1101 | |
| 1102 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1103 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1104 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1105 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1106 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1107 | |
| 1108 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1109 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1110 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1111 | |
| 1112 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1113 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1114 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1115 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1116 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1117 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1118 | |
| 1119 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1120 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1121 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1122 | |
| 1123 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1124 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1125 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1126 | |
| 1127 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1128 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1129 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1130 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1131 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1132 | //Wait that subs is cleaned |
| 1133 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1134 | |
| 1135 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1137 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1138 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1139 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1140 | //Wait that subs is cleaned |
| 1141 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1142 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1143 | xappConn1.TestMsgChanEmpty(t) |
| 1144 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1146 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | } |
| 1148 | |
| 1149 | //----------------------------------------------------------------------------- |
| 1150 | // TestSameSubsDiffRan |
| 1151 | // Same subscription to different RANs |
| 1152 | // |
| 1153 | // stub stub |
| 1154 | // +-------+ +---------+ +---------+ |
| 1155 | // | xapp | | submgr | | e2term | |
| 1156 | // +-------+ +---------+ +---------+ |
| 1157 | // | | | |
| 1158 | // | | | |
| 1159 | // | | | |
| 1160 | // | SubReq(r1) | | |
| 1161 | // |------------->| | |
| 1162 | // | | | |
| 1163 | // | | SubReq(r1) | |
| 1164 | // | |------------->| |
| 1165 | // | | | |
| 1166 | // | | SubResp(r1) | |
| 1167 | // | |<-------------| |
| 1168 | // | | | |
| 1169 | // | SubResp(r1) | | |
| 1170 | // |<-------------| | |
| 1171 | // | | | |
| 1172 | // | SubReq(r2) | | |
| 1173 | // |------------->| | |
| 1174 | // | | | |
| 1175 | // | | SubReq(r2) | |
| 1176 | // | |------------->| |
| 1177 | // | | | |
| 1178 | // | | SubResp(r2) | |
| 1179 | // | |<-------------| |
| 1180 | // | | | |
| 1181 | // | SubResp(r2) | | |
| 1182 | // |<-------------| | |
| 1183 | // | | | |
| 1184 | // | [SUBS r1 DELETE] | |
| 1185 | // | | | |
| 1186 | // | [SUBS r2 DELETE] | |
| 1187 | // | | | |
| 1188 | // |
| 1189 | //----------------------------------------------------------------------------- |
| 1190 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1191 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1192 | |
| 1193 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1194 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1195 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1196 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1197 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1198 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1199 | |
| 1200 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1201 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1202 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1203 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1204 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1205 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1206 | |
| 1207 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1208 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1209 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1212 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1213 | //Wait that subs is cleaned |
| 1214 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1215 | |
| 1216 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1218 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1219 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1220 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1221 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1222 | //Wait that subs is cleaned |
| 1223 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1224 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1225 | xappConn1.TestMsgChanEmpty(t) |
| 1226 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1227 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1228 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1229 | } |
| 1230 | |
| 1231 | //----------------------------------------------------------------------------- |
| 1232 | // TestSubReqRetryInSubmgr |
| 1233 | // |
| 1234 | // stub stub |
| 1235 | // +-------+ +---------+ +---------+ |
| 1236 | // | xapp | | submgr | | e2term | |
| 1237 | // +-------+ +---------+ +---------+ |
| 1238 | // | | | |
| 1239 | // | SubReq | | |
| 1240 | // |------------->| | |
| 1241 | // | | | |
| 1242 | // | | SubReq | |
| 1243 | // | |------------->| |
| 1244 | // | | | |
| 1245 | // | | | |
| 1246 | // | | SubReq | |
| 1247 | // | |------------->| |
| 1248 | // | | | |
| 1249 | // | | SubResp | |
| 1250 | // | |<-------------| |
| 1251 | // | | | |
| 1252 | // | SubResp | | |
| 1253 | // |<-------------| | |
| 1254 | // | | | |
| 1255 | // | [SUBS DELETE] | |
| 1256 | // | | | |
| 1257 | // |
| 1258 | //----------------------------------------------------------------------------- |
| 1259 | |
| 1260 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1261 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1262 | |
| 1263 | // Init counter check |
| 1264 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1265 | Counter{cSubReqFromXapp, 1}, |
| 1266 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 1267 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1268 | Counter{cSubReReqToE2, 1}, |
| 1269 | Counter{cSubRespFromE2, 1}, |
| 1270 | Counter{cSubRespToXapp, 1}, |
| 1271 | Counter{cSubDelReqFromXapp, 1}, |
| 1272 | Counter{cSubDelReqToE2, 1}, |
| 1273 | Counter{cSubDelRespFromE2, 1}, |
| 1274 | Counter{cSubDelRespToXapp, 1}, |
| 1275 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1276 | |
| 1277 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1278 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1279 | |
| 1280 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1281 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1282 | |
| 1283 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1284 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1285 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1286 | |
| 1287 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1288 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1289 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1290 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1291 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1292 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1293 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1294 | |
| 1295 | // Wait that subs is cleaned |
| 1296 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1297 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1298 | xappConn1.TestMsgChanEmpty(t) |
| 1299 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1300 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1301 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1302 | |
| 1303 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1304 | } |
| 1305 | |
| 1306 | //----------------------------------------------------------------------------- |
| 1307 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1308 | // |
| 1309 | // stub stub |
| 1310 | // +-------+ +---------+ +---------+ |
| 1311 | // | xapp | | submgr | | e2term | |
| 1312 | // +-------+ +---------+ +---------+ |
| 1313 | // | | | |
| 1314 | // | SubReq | | |
| 1315 | // |------------->| | |
| 1316 | // | | | |
| 1317 | // | | SubReq | |
| 1318 | // | |------------->| |
| 1319 | // | | | |
| 1320 | // | | | |
| 1321 | // | | SubReq | |
| 1322 | // | |------------->| |
| 1323 | // | | | |
| 1324 | // | | SubDelReq | |
| 1325 | // | |------------->| |
| 1326 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | // | | SubDelResp | |
| 1328 | // | |<-------------| |
| 1329 | // | | | |
| 1330 | // |
| 1331 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1332 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1333 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1334 | |
| 1335 | // Init counter check |
| 1336 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1337 | Counter{cSubReqFromXapp, 1}, |
| 1338 | Counter{cSubReqToE2, 1}, |
| 1339 | Counter{cSubReReqToE2, 1}, |
| 1340 | Counter{cSubReqTimerExpiry, 2}, |
| 1341 | Counter{cSubDelReqToE2, 1}, |
| 1342 | Counter{cSubDelRespFromE2, 1}, |
| 1343 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1344 | |
| 1345 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1346 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1347 | |
| 1348 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1349 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1350 | |
| 1351 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1352 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1353 | |
| 1354 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1355 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1356 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1357 | |
| 1358 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1359 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1360 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1361 | xappConn1.TestMsgChanEmpty(t) |
| 1362 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1363 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1364 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1365 | |
| 1366 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1367 | } |
| 1368 | |
| 1369 | //----------------------------------------------------------------------------- |
| 1370 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1371 | // |
| 1372 | // stub stub |
| 1373 | // +-------+ +---------+ +---------+ |
| 1374 | // | xapp | | submgr | | e2term | |
| 1375 | // +-------+ +---------+ +---------+ |
| 1376 | // | | | |
| 1377 | // | SubReq | | |
| 1378 | // |------------->| | |
| 1379 | // | | | |
| 1380 | // | | SubReq | |
| 1381 | // | |------------->| |
| 1382 | // | | | |
| 1383 | // | | | |
| 1384 | // | | SubReq | |
| 1385 | // | |------------->| |
| 1386 | // | | | |
| 1387 | // | | SubDelReq | |
| 1388 | // | |------------->| |
| 1389 | // | | | |
| 1390 | // | | | |
| 1391 | // | | SubDelReq | |
| 1392 | // | |------------->| |
| 1393 | // | | | |
| 1394 | // | | | |
| 1395 | // |
| 1396 | //----------------------------------------------------------------------------- |
| 1397 | |
| 1398 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1399 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1400 | |
| 1401 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1402 | Counter{cSubReqFromXapp, 1}, |
| 1403 | Counter{cSubReqToE2, 1}, |
| 1404 | Counter{cSubReReqToE2, 1}, |
| 1405 | Counter{cSubReqTimerExpiry, 2}, |
| 1406 | Counter{cSubDelReqToE2, 1}, |
| 1407 | Counter{cSubDelReReqToE2, 1}, |
| 1408 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1409 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1410 | |
| 1411 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1412 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1413 | |
| 1414 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1415 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1416 | |
| 1417 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1418 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1419 | |
| 1420 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1421 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1422 | |
| 1423 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1424 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1425 | |
| 1426 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1427 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1428 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1429 | xappConn1.TestMsgChanEmpty(t) |
| 1430 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1431 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1432 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1433 | |
| 1434 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1435 | } |
| 1436 | |
| 1437 | //----------------------------------------------------------------------------- |
| 1438 | // TestSubReqSubFailRespInSubmgr |
| 1439 | // |
| 1440 | // stub stub |
| 1441 | // +-------+ +---------+ +---------+ |
| 1442 | // | xapp | | submgr | | e2term | |
| 1443 | // +-------+ +---------+ +---------+ |
| 1444 | // | | | |
| 1445 | // | SubReq | | |
| 1446 | // |------------->| | |
| 1447 | // | | | |
| 1448 | // | | SubReq | |
| 1449 | // | |------------->| |
| 1450 | // | | | |
| 1451 | // | | SubFail | |
| 1452 | // | |<-------------| |
| 1453 | // | | | |
| 1454 | // | SubFail | | |
| 1455 | // |<-------------| | |
| 1456 | // | | | |
| 1457 | // |
| 1458 | //----------------------------------------------------------------------------- |
| 1459 | |
| 1460 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1461 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1462 | |
| 1463 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1464 | Counter{cSubReqFromXapp, 1}, |
| 1465 | Counter{cSubReqToE2, 1}, |
| 1466 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1467 | Counter{cSubFailToXapp, 1}, |
| 1468 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1469 | |
| 1470 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1471 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1472 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1473 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1474 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1475 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1476 | fparams1.Set(crereq1) |
| 1477 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1478 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1479 | // Xapp: Receive SubsFail |
| 1480 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1481 | |
| 1482 | // Wait that subs is cleaned |
| 1483 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1484 | |
| 1485 | xappConn1.TestMsgChanEmpty(t) |
| 1486 | xappConn2.TestMsgChanEmpty(t) |
| 1487 | e2termConn1.TestMsgChanEmpty(t) |
| 1488 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1489 | |
| 1490 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1491 | } |
| 1492 | |
| 1493 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1494 | // TestSubDelReqRetryInSubmgr |
| 1495 | // |
| 1496 | // stub stub |
| 1497 | // +-------+ +---------+ +---------+ |
| 1498 | // | xapp | | submgr | | e2term | |
| 1499 | // +-------+ +---------+ +---------+ |
| 1500 | // | | | |
| 1501 | // | [SUBS CREATE] | |
| 1502 | // | | | |
| 1503 | // | | | |
| 1504 | // | SubDelReq | | |
| 1505 | // |------------->| | |
| 1506 | // | | | |
| 1507 | // | | SubDelReq | |
| 1508 | // | |------------->| |
| 1509 | // | | | |
| 1510 | // | | SubDelReq | |
| 1511 | // | |------------->| |
| 1512 | // | | | |
| 1513 | // | | SubDelResp | |
| 1514 | // | |<-------------| |
| 1515 | // | | | |
| 1516 | // | SubDelResp | | |
| 1517 | // |<-------------| | |
| 1518 | // |
| 1519 | //----------------------------------------------------------------------------- |
| 1520 | |
| 1521 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1522 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1523 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1524 | |
| 1525 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1526 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1527 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1528 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1529 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1530 | |
| 1531 | // Subs Delete |
| 1532 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1533 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1534 | |
| 1535 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1536 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1537 | |
| 1538 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1539 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1540 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1541 | |
| 1542 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1543 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1544 | |
| 1545 | // Wait that subs is cleaned |
| 1546 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1547 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1548 | xappConn1.TestMsgChanEmpty(t) |
| 1549 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1550 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1551 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1552 | } |
| 1553 | |
| 1554 | //----------------------------------------------------------------------------- |
| 1555 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1556 | // |
| 1557 | // stub stub |
| 1558 | // +-------+ +---------+ +---------+ |
| 1559 | // | xapp | | submgr | | e2term | |
| 1560 | // +-------+ +---------+ +---------+ |
| 1561 | // | | | |
| 1562 | // | [SUBS CREATE] | |
| 1563 | // | | | |
| 1564 | // | | | |
| 1565 | // | SubDelReq | | |
| 1566 | // |------------->| | |
| 1567 | // | | | |
| 1568 | // | | SubDelReq | |
| 1569 | // | |------------->| |
| 1570 | // | | | |
| 1571 | // | | SubDelReq | |
| 1572 | // | |------------->| |
| 1573 | // | | | |
| 1574 | // | | | |
| 1575 | // | SubDelResp | | |
| 1576 | // |<-------------| | |
| 1577 | // |
| 1578 | //----------------------------------------------------------------------------- |
| 1579 | |
| 1580 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1581 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1582 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1583 | |
| 1584 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1585 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1586 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1587 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1588 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1589 | |
| 1590 | // Subs Delete |
| 1591 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1592 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1593 | |
| 1594 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1595 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1596 | |
| 1597 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1598 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1599 | |
| 1600 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1601 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1602 | |
| 1603 | // Wait that subs is cleaned |
| 1604 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1605 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1606 | xappConn1.TestMsgChanEmpty(t) |
| 1607 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1608 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1609 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1610 | } |
| 1611 | |
| 1612 | //----------------------------------------------------------------------------- |
| 1613 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1614 | // |
| 1615 | // stub stub |
| 1616 | // +-------+ +---------+ +---------+ |
| 1617 | // | xapp | | submgr | | e2term | |
| 1618 | // +-------+ +---------+ +---------+ |
| 1619 | // | | | |
| 1620 | // | [SUBS CREATE] | |
| 1621 | // | | | |
| 1622 | // | | | |
| 1623 | // | SubDelReq | | |
| 1624 | // |------------->| | |
| 1625 | // | | | |
| 1626 | // | | SubDelReq | |
| 1627 | // | |------------->| |
| 1628 | // | | | |
| 1629 | // | | SubDelFail | |
| 1630 | // | |<-------------| |
| 1631 | // | | | |
| 1632 | // | SubDelResp | | |
| 1633 | // |<-------------| | |
| 1634 | // | | | |
| 1635 | // |
| 1636 | //----------------------------------------------------------------------------- |
| 1637 | |
| 1638 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1639 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1640 | |
| 1641 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1642 | Counter{cSubReqFromXapp, 1}, |
| 1643 | Counter{cSubReqToE2, 1}, |
| 1644 | Counter{cSubRespFromE2, 1}, |
| 1645 | Counter{cSubRespToXapp, 1}, |
| 1646 | Counter{cSubDelReqFromXapp, 1}, |
| 1647 | Counter{cSubDelReqToE2, 1}, |
| 1648 | Counter{cSubDelFailFromE2, 1}, |
| 1649 | Counter{cSubDelRespToXapp, 1}, |
| 1650 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1651 | |
| 1652 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1653 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1654 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1655 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1656 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1657 | |
| 1658 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1659 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1660 | |
| 1661 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1662 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1663 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1664 | |
| 1665 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1666 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1667 | |
| 1668 | // Wait that subs is cleaned |
| 1669 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1670 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1671 | xappConn1.TestMsgChanEmpty(t) |
| 1672 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1673 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1674 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1675 | |
| 1676 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1677 | } |
| 1678 | |
| 1679 | //----------------------------------------------------------------------------- |
| 1680 | // TestSubReqAndSubDelOkSameAction |
| 1681 | // |
| 1682 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1683 | // +-------+ +-------+ +---------+ +---------+ |
| 1684 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1685 | // +-------+ +-------+ +---------+ +---------+ |
| 1686 | // | | | | |
| 1687 | // | | | | |
| 1688 | // | | | | |
| 1689 | // | | SubReq1 | | |
| 1690 | // | |------------->| | |
| 1691 | // | | | | |
| 1692 | // | | | SubReq1 | |
| 1693 | // | | |------------->| |
| 1694 | // | | | SubResp1 | |
| 1695 | // | | |<-------------| |
| 1696 | // | | SubResp1 | | |
| 1697 | // | |<-------------| | |
| 1698 | // | | | | |
| 1699 | // | SubReq2 | | |
| 1700 | // |--------------------------->| | |
| 1701 | // | | | | |
| 1702 | // | SubResp2 | | |
| 1703 | // |<---------------------------| | |
| 1704 | // | | | | |
| 1705 | // | | SubDelReq 1 | | |
| 1706 | // | |------------->| | |
| 1707 | // | | | | |
| 1708 | // | | SubDelResp 1 | | |
| 1709 | // | |<-------------| | |
| 1710 | // | | | | |
| 1711 | // | SubDelReq 2 | | |
| 1712 | // |--------------------------->| | |
| 1713 | // | | | | |
| 1714 | // | | | SubDelReq 2 | |
| 1715 | // | | |------------->| |
| 1716 | // | | | | |
| 1717 | // | | | SubDelReq 2 | |
| 1718 | // | | |------------->| |
| 1719 | // | | | | |
| 1720 | // | SubDelResp 2 | | |
| 1721 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1722 | // |
| 1723 | //----------------------------------------------------------------------------- |
| 1724 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1725 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1726 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1727 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1728 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1729 | Counter{cSubReqFromXapp, 2}, |
| 1730 | Counter{cSubReqToE2, 1}, |
| 1731 | Counter{cSubRespFromE2, 1}, |
| 1732 | Counter{cSubRespToXapp, 2}, |
| 1733 | Counter{cMergedSubscriptions, 1}, |
| 1734 | Counter{cUnmergedSubscriptions, 1}, |
| 1735 | Counter{cSubDelReqFromXapp, 2}, |
| 1736 | Counter{cSubDelReqToE2, 1}, |
| 1737 | Counter{cSubDelRespFromE2, 1}, |
| 1738 | Counter{cSubDelRespToXapp, 2}, |
| 1739 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1740 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1741 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1742 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1743 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1744 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1745 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1746 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1747 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1748 | |
| 1749 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1750 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1751 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1752 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1753 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1754 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1755 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1756 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1757 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1758 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1759 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1760 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1761 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1762 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1763 | |
| 1764 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1765 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1766 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1767 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1769 | //Wait that subs is cleaned |
| 1770 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1771 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | xappConn1.TestMsgChanEmpty(t) |
| 1773 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1774 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1775 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1776 | |
| 1777 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1778 | } |
| 1779 | |
| 1780 | //----------------------------------------------------------------------------- |
| 1781 | // TestSubReqAndSubDelOkSameActionParallel |
| 1782 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1783 | // stub stub stub |
| 1784 | // +-------+ +-------+ +---------+ +---------+ |
| 1785 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1786 | // +-------+ +-------+ +---------+ +---------+ |
| 1787 | // | | | | |
| 1788 | // | | | | |
| 1789 | // | | | | |
| 1790 | // | | SubReq1 | | |
| 1791 | // | |------------->| | |
| 1792 | // | | | | |
| 1793 | // | | | SubReq1 | |
| 1794 | // | | |------------->| |
| 1795 | // | SubReq2 | | |
| 1796 | // |--------------------------->| | |
| 1797 | // | | | SubResp1 | |
| 1798 | // | | |<-------------| |
| 1799 | // | | SubResp1 | | |
| 1800 | // | |<-------------| | |
| 1801 | // | | | | |
| 1802 | // | SubResp2 | | |
| 1803 | // |<---------------------------| | |
| 1804 | // | | | | |
| 1805 | // | | SubDelReq 1 | | |
| 1806 | // | |------------->| | |
| 1807 | // | | | | |
| 1808 | // | | SubDelResp 1 | | |
| 1809 | // | |<-------------| | |
| 1810 | // | | | | |
| 1811 | // | SubDelReq 2 | | |
| 1812 | // |--------------------------->| | |
| 1813 | // | | | | |
| 1814 | // | | | SubDelReq 2 | |
| 1815 | // | | |------------->| |
| 1816 | // | | | | |
| 1817 | // | | | SubDelReq 2 | |
| 1818 | // | | |------------->| |
| 1819 | // | | | | |
| 1820 | // | SubDelResp 2 | | |
| 1821 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1822 | // |
| 1823 | //----------------------------------------------------------------------------- |
| 1824 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1825 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1826 | |
| 1827 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1828 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1829 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1830 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1831 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1832 | |
| 1833 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1834 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1835 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1836 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1837 | |
| 1838 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1839 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1840 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1841 | |
| 1842 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1843 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1844 | |
| 1845 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1846 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1847 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1848 | |
| 1849 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1850 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1851 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1852 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1853 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1854 | |
| 1855 | //Wait that subs is cleaned |
| 1856 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1857 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1858 | xappConn1.TestMsgChanEmpty(t) |
| 1859 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1860 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1861 | mainCtrl.wait_registry_empty(t, 10) |
| 1862 | } |
| 1863 | |
| 1864 | //----------------------------------------------------------------------------- |
| 1865 | // TestSubReqAndSubDelNokSameActionParallel |
| 1866 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1867 | // stub stub stub |
| 1868 | // +-------+ +-------+ +---------+ +---------+ |
| 1869 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1870 | // +-------+ +-------+ +---------+ +---------+ |
| 1871 | // | | | | |
| 1872 | // | | | | |
| 1873 | // | | | | |
| 1874 | // | | SubReq1 | | |
| 1875 | // | |------------->| | |
| 1876 | // | | | | |
| 1877 | // | | | SubReq1 | |
| 1878 | // | | |------------->| |
| 1879 | // | SubReq2 | | |
| 1880 | // |--------------------------->| | |
| 1881 | // | | | SubFail1 | |
| 1882 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1883 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1884 | // | | SubFail1 | | |
| 1885 | // | |<-------------| | |
| 1886 | // | | | | |
| 1887 | // | SubFail2 | | |
| 1888 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1889 | // |
| 1890 | //----------------------------------------------------------------------------- |
| 1891 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1892 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1893 | |
| 1894 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1895 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1896 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1897 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1898 | |
| 1899 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1900 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1901 | |
| 1902 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1903 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1904 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1905 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1906 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1907 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1908 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1909 | // E2t: send SubsFail (first) |
| 1910 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1911 | fparams1.Set(crereq1) |
| 1912 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1913 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1914 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1915 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1916 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1917 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1918 | |
| 1919 | //Wait that subs is cleaned |
| 1920 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1921 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1922 | xappConn1.TestMsgChanEmpty(t) |
| 1923 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1924 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1925 | mainCtrl.wait_registry_empty(t, 10) |
| 1926 | } |
| 1927 | |
| 1928 | //----------------------------------------------------------------------------- |
| 1929 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1930 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1931 | // stub stub stub |
| 1932 | // +-------+ +-------+ +---------+ +---------+ |
| 1933 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1934 | // +-------+ +-------+ +---------+ +---------+ |
| 1935 | // | | | | |
| 1936 | // | | | | |
| 1937 | // | | | | |
| 1938 | // | | SubReq1 | | |
| 1939 | // | |------------->| | |
| 1940 | // | | | | |
| 1941 | // | | | SubReq1 | |
| 1942 | // | | |------------->| |
| 1943 | // | | SubReq2 | | |
| 1944 | // |--------------------------->| | |
| 1945 | // | | | | |
| 1946 | // | | | SubReq1 | |
| 1947 | // | | |------------->| |
| 1948 | // | | | | |
| 1949 | // | | | | |
| 1950 | // | | | SubDelReq | |
| 1951 | // | | |------------->| |
| 1952 | // | | | | |
| 1953 | // | | | SubDelResp | |
| 1954 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1955 | // |
| 1956 | //----------------------------------------------------------------------------- |
| 1957 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1958 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1959 | |
| 1960 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1961 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1962 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1963 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1964 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1965 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1966 | |
| 1967 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1968 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1969 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1970 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1971 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1972 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1973 | |
| 1974 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1975 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1976 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1977 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1978 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1979 | |
| 1980 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1981 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1982 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1983 | xappConn1.TestMsgChanEmpty(t) |
| 1984 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1985 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1986 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1987 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1988 | |
| 1989 | //----------------------------- Policy cases --------------------------------- |
| 1990 | //----------------------------------------------------------------------------- |
| 1991 | // TestSubReqPolicyAndSubDelOk |
| 1992 | // |
| 1993 | // stub stub |
| 1994 | // +-------+ +---------+ +---------+ |
| 1995 | // | xapp | | submgr | | e2term | |
| 1996 | // +-------+ +---------+ +---------+ |
| 1997 | // | | | |
| 1998 | // | SubReq | | |
| 1999 | // |------------->| | |
| 2000 | // | | | |
| 2001 | // | | SubReq | |
| 2002 | // | |------------->| |
| 2003 | // | | | |
| 2004 | // | | SubResp | |
| 2005 | // | |<-------------| |
| 2006 | // | | | |
| 2007 | // | SubResp | | |
| 2008 | // |<-------------| | |
| 2009 | // | | | |
| 2010 | // | | | |
| 2011 | // | SubDelReq | | |
| 2012 | // |------------->| | |
| 2013 | // | | | |
| 2014 | // | | SubDelReq | |
| 2015 | // | |------------->| |
| 2016 | // | | | |
| 2017 | // | | SubDelResp | |
| 2018 | // | |<-------------| |
| 2019 | // | | | |
| 2020 | // | SubDelResp | | |
| 2021 | // |<-------------| | |
| 2022 | // |
| 2023 | //----------------------------------------------------------------------------- |
| 2024 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2025 | CaseBegin("TestSubReqAndSubDelOk") |
| 2026 | |
| 2027 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2028 | rparams1.Init() |
| 2029 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2030 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2031 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2032 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2033 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2034 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2035 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2036 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2037 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2038 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2039 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2040 | |
| 2041 | //Wait that subs is cleaned |
| 2042 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2043 | |
| 2044 | xappConn1.TestMsgChanEmpty(t) |
| 2045 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2046 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2047 | mainCtrl.wait_registry_empty(t, 10) |
| 2048 | } |
| 2049 | |
| 2050 | //----------------------------------------------------------------------------- |
| 2051 | // TestSubReqPolicyChangeAndSubDelOk |
| 2052 | // |
| 2053 | // stub stub |
| 2054 | // +-------+ +---------+ +---------+ |
| 2055 | // | xapp | | submgr | | e2term | |
| 2056 | // +-------+ +---------+ +---------+ |
| 2057 | // | | | |
| 2058 | // | SubReq | | |
| 2059 | // |------------->| | |
| 2060 | // | | | |
| 2061 | // | | SubReq | |
| 2062 | // | |------------->| |
| 2063 | // | | | |
| 2064 | // | | SubResp | |
| 2065 | // | |<-------------| |
| 2066 | // | | | |
| 2067 | // | SubResp | | |
| 2068 | // |<-------------| | |
| 2069 | // | | | |
| 2070 | // | SubReq | | |
| 2071 | // |------------->| | |
| 2072 | // | | | |
| 2073 | // | | SubReq | |
| 2074 | // | |------------->| |
| 2075 | // | | | |
| 2076 | // | | SubResp | |
| 2077 | // | |<-------------| |
| 2078 | // | | | |
| 2079 | // | SubResp | | |
| 2080 | // |<-------------| | |
| 2081 | // | | | |
| 2082 | // | SubDelReq | | |
| 2083 | // |------------->| | |
| 2084 | // | | | |
| 2085 | // | | SubDelReq | |
| 2086 | // | |------------->| |
| 2087 | // | | | |
| 2088 | // | | SubDelResp | |
| 2089 | // | |<-------------| |
| 2090 | // | | | |
| 2091 | // | SubDelResp | | |
| 2092 | // |<-------------| | |
| 2093 | // |
| 2094 | //----------------------------------------------------------------------------- |
| 2095 | |
| 2096 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2097 | CaseBegin("TestSubReqAndSubDelOk") |
| 2098 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2099 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2100 | rparams1.Init() |
| 2101 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2102 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2103 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2104 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2105 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2106 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2107 | |
| 2108 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2109 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2110 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2111 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2112 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2113 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2114 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2115 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2116 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2117 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2118 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2119 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2120 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2121 | |
| 2122 | //Wait that subs is cleaned |
| 2123 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2124 | |
| 2125 | xappConn1.TestMsgChanEmpty(t) |
| 2126 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2127 | e2termConn1.TestMsgChanEmpty(t) |
| 2128 | mainCtrl.wait_registry_empty(t, 10) |
| 2129 | } |
| 2130 | |
| 2131 | //----------------------------------------------------------------------------- |
| 2132 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2133 | // |
| 2134 | // stub stub stub |
| 2135 | // +-------+ +---------+ +---------+ +---------+ |
| 2136 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2137 | // +-------+ +---------+ +---------+ +---------+ |
| 2138 | // | | | | |
| 2139 | // | | | | |
| 2140 | // | | | | |
| 2141 | // | SubReq1 | | | |
| 2142 | // |------------->| | | |
| 2143 | // | | | | |
| 2144 | // | | SubReq1 | | |
| 2145 | // | |------------->| | |
| 2146 | // | | | | |
| 2147 | // | SubReq2 | | | |
| 2148 | // |------------->| | | |
| 2149 | // | | | | |
| 2150 | // | | SubReq2 | | |
| 2151 | // | |---------------------------->| |
| 2152 | // | | | | |
| 2153 | // | | SubResp1 | | |
| 2154 | // | |<-------------| | |
| 2155 | // | SubResp1 | | | |
| 2156 | // |<-------------| | | |
| 2157 | // | | SubResp2 | | |
| 2158 | // | |<----------------------------| |
| 2159 | // | SubResp2 | | | |
| 2160 | // |<-------------| | | |
| 2161 | // | | | | |
| 2162 | // | [SUBS 1 DELETE] | | |
| 2163 | // | | | | |
| 2164 | // | [SUBS 2 DELETE] | | |
| 2165 | // | | | | |
| 2166 | // |
| 2167 | //----------------------------------------------------------------------------- |
| 2168 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2169 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2170 | |
| 2171 | //Req1 |
| 2172 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2173 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2174 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2175 | |
| 2176 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2177 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2178 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2179 | |
| 2180 | //Resp1 |
| 2181 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2182 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2183 | |
| 2184 | //Resp2 |
| 2185 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2186 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2187 | |
| 2188 | //Del1 |
| 2189 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2190 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2191 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2192 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2193 | //Wait that subs is cleaned |
| 2194 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2195 | |
| 2196 | //Del2 |
| 2197 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2198 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2199 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2200 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2201 | //Wait that subs is cleaned |
| 2202 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2203 | |
| 2204 | xappConn1.TestMsgChanEmpty(t) |
| 2205 | xappConn2.TestMsgChanEmpty(t) |
| 2206 | e2termConn1.TestMsgChanEmpty(t) |
| 2207 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2208 | mainCtrl.wait_registry_empty(t, 10) |
| 2209 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2210 | |
| 2211 | //----------------------------------------------------------------------------- |
| 2212 | // TestSubReqInsertAndSubDelOk |
| 2213 | // |
| 2214 | // stub stub |
| 2215 | // +-------+ +---------+ +---------+ |
| 2216 | // | xapp | | submgr | | e2term | |
| 2217 | // +-------+ +---------+ +---------+ |
| 2218 | // | | | |
| 2219 | // | SubReq | | |
| 2220 | // |------------->| | |
| 2221 | // | | | |
| 2222 | // | | SubReq | |
| 2223 | // | |------------->| |
| 2224 | // | | | |
| 2225 | // | | SubResp | |
| 2226 | // | |<-------------| |
| 2227 | // | | | |
| 2228 | // | SubResp | | |
| 2229 | // |<-------------| | |
| 2230 | // | | | |
| 2231 | // | | | |
| 2232 | // | SubDelReq | | |
| 2233 | // |------------->| | |
| 2234 | // | | | |
| 2235 | // | | SubDelReq | |
| 2236 | // | |------------->| |
| 2237 | // | | | |
| 2238 | // | | SubDelResp | |
| 2239 | // | |<-------------| |
| 2240 | // | | | |
| 2241 | // | SubDelResp | | |
| 2242 | // |<-------------| | |
| 2243 | // |
| 2244 | //----------------------------------------------------------------------------- |
| 2245 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2246 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2247 | |
| 2248 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2249 | rparams1.Init() |
| 2250 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2251 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2252 | |
| 2253 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2254 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2255 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2256 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2257 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2258 | |
| 2259 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2260 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2261 | |
| 2262 | //Wait that subs is cleaned |
| 2263 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2264 | |
| 2265 | xappConn1.TestMsgChanEmpty(t) |
| 2266 | xappConn2.TestMsgChanEmpty(t) |
| 2267 | e2termConn1.TestMsgChanEmpty(t) |
| 2268 | mainCtrl.wait_registry_empty(t, 10) |
| 2269 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2270 | |
| 2271 | //----------------------------------------------------------------------------- |
| 2272 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2273 | // |
| 2274 | // This case simulates case where xApp restarts and starts sending same |
| 2275 | // subscription requests which have already subscribed successfully |
| 2276 | |
| 2277 | // stub stub |
| 2278 | // +-------+ +---------+ +---------+ |
| 2279 | // | xapp | | submgr | | e2term | |
| 2280 | // +-------+ +---------+ +---------+ |
| 2281 | // | | | |
| 2282 | // | SubReq | | |
| 2283 | // |------------->| | |
| 2284 | // | | | |
| 2285 | // | | SubReq | |
| 2286 | // | |------------->| |
| 2287 | // | | | |
| 2288 | // | | SubResp | |
| 2289 | // | |<-------------| |
| 2290 | // | | | |
| 2291 | // | SubResp | | |
| 2292 | // |<-------------| | |
| 2293 | // | | | |
| 2294 | // | xApp restart | | |
| 2295 | // | | | |
| 2296 | // | SubReq | | |
| 2297 | // | (retrans with same xApp generated subid but diff xid) |
| 2298 | // |------------->| | |
| 2299 | // | | | |
| 2300 | // | SubResp | | |
| 2301 | // |<-------------| | |
| 2302 | // | | | |
| 2303 | // | [SUBS DELETE] | |
| 2304 | // | | | |
| 2305 | // |
| 2306 | //----------------------------------------------------------------------------- |
| 2307 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2308 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2309 | |
| 2310 | //Subs Create |
| 2311 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2312 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2313 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2314 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2315 | |
| 2316 | // xApp restart here |
| 2317 | // --> artificial delay |
| 2318 | <-time.After(1 * time.Second) |
| 2319 | |
| 2320 | //Subs Create |
| 2321 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2322 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2323 | |
| 2324 | //Subs Delete |
| 2325 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2326 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2327 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2328 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2329 | |
| 2330 | //Wait that subs is cleaned |
| 2331 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2332 | |
| 2333 | xappConn1.TestMsgChanEmpty(t) |
| 2334 | xappConn2.TestMsgChanEmpty(t) |
| 2335 | e2termConn1.TestMsgChanEmpty(t) |
| 2336 | mainCtrl.wait_registry_empty(t, 10) |
| 2337 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2338 | |
| 2339 | //----------------------------------------------------------------------------- |
| 2340 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2341 | // |
| 2342 | // stub stub |
| 2343 | // +-------+ +---------+ +---------+ |
| 2344 | // | xapp | | submgr | | e2term | |
| 2345 | // +-------+ +---------+ +---------+ |
| 2346 | // | | | |
| 2347 | // | SubReq | | |
| 2348 | // |------------->| | |
| 2349 | // | | | |
| 2350 | // | | SubReq | |
| 2351 | // | |------------->| |
| 2352 | // | | | |
| 2353 | // | | SubResp | |
| 2354 | // | <----| |
| 2355 | // | | |
| 2356 | // | Submgr restart | |
| 2357 | // | | |
| 2358 | // | | | |
| 2359 | // | | SubDelReq | |
| 2360 | // | |------------->| |
| 2361 | // | | | |
| 2362 | // | | SubDelResp | |
| 2363 | // | |<-------------| |
| 2364 | // | | | |
| 2365 | // |
| 2366 | //----------------------------------------------------------------------------- |
| 2367 | |
| 2368 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2369 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2370 | |
| 2371 | // Remove possible existing subscrition |
| 2372 | mainCtrl.removeExistingSubscriptions(t) |
| 2373 | |
| 2374 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2375 | xappConn1.SendSubsReq(t, nil, nil) |
| 2376 | e2termConn1.RecvSubsReq(t) |
| 2377 | mainCtrl.SetResetTestFlag(t, false) |
| 2378 | |
| 2379 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2380 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2381 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2382 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2383 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2384 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2385 | mainCtrl.SimulateRestart(t) |
| 2386 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2387 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2388 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2389 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2390 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2391 | |
| 2392 | // Wait that subs is cleaned |
| 2393 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2394 | |
| 2395 | xappConn1.TestMsgChanEmpty(t) |
| 2396 | xappConn2.TestMsgChanEmpty(t) |
| 2397 | e2termConn1.TestMsgChanEmpty(t) |
| 2398 | mainCtrl.wait_registry_empty(t, 10) |
| 2399 | } |
| 2400 | |
| 2401 | //----------------------------------------------------------------------------- |
| 2402 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2403 | // |
| 2404 | // stub stub |
| 2405 | // +-------+ +---------+ +---------+ |
| 2406 | // | xapp | | submgr | | e2term | |
| 2407 | // +-------+ +---------+ +---------+ |
| 2408 | // | | | |
| 2409 | // | SubReq | | |
| 2410 | // |------------->| | |
| 2411 | // | | | |
| 2412 | // | | SubReq | |
| 2413 | // | |------------->| |
| 2414 | // | | | |
| 2415 | // | | SubResp | |
| 2416 | // | |<-------------| |
| 2417 | // | | | |
| 2418 | // | SubResp | | |
| 2419 | // |<-------------| | |
| 2420 | // | | | |
| 2421 | // | | |
| 2422 | // | Submgr restart | |
| 2423 | // | | |
| 2424 | // | SubDelReq | | |
| 2425 | // |------------->| | |
| 2426 | // | | | |
| 2427 | // | | SubDelReq | |
| 2428 | // | |------------->| |
| 2429 | // | | | |
| 2430 | // | | SubDelResp | |
| 2431 | // | |<-------------| |
| 2432 | // | | | |
| 2433 | // | SubDelResp | | |
| 2434 | // |<-------------| | |
| 2435 | // |
| 2436 | //----------------------------------------------------------------------------- |
| 2437 | |
| 2438 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2439 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2440 | |
| 2441 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2442 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2443 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2444 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2445 | |
| 2446 | // Check subscription |
| 2447 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2448 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2449 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2450 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2451 | |
| 2452 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2453 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2454 | |
| 2455 | // Check that subscription is restored correctly after restart |
| 2456 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2457 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2458 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2459 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2460 | |
| 2461 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2462 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2463 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2464 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2465 | |
| 2466 | //Wait that subs is cleaned |
| 2467 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2468 | |
| 2469 | xappConn1.TestMsgChanEmpty(t) |
| 2470 | xappConn2.TestMsgChanEmpty(t) |
| 2471 | e2termConn1.TestMsgChanEmpty(t) |
| 2472 | mainCtrl.wait_registry_empty(t, 10) |
| 2473 | } |
| 2474 | |
| 2475 | //----------------------------------------------------------------------------- |
| 2476 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2477 | // |
| 2478 | // stub stub |
| 2479 | // +-------+ +-------+ +---------+ +---------+ |
| 2480 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2481 | // +-------+ +-------+ +---------+ +---------+ |
| 2482 | // | | | | |
| 2483 | // | | | | |
| 2484 | // | | | | |
| 2485 | // | | SubReq1 | | |
| 2486 | // | |------------->| | |
| 2487 | // | | | | |
| 2488 | // | | | SubReq1 | |
| 2489 | // | | |------------->| |
| 2490 | // | | | SubResp1 | |
| 2491 | // | | |<-------------| |
| 2492 | // | | SubResp1 | | |
| 2493 | // | |<-------------| | |
| 2494 | // | | | | |
| 2495 | // | | |
| 2496 | // | submgr restart | |
| 2497 | // | | |
| 2498 | // | | | | |
| 2499 | // | | | | |
| 2500 | // | SubReq2 | | |
| 2501 | // |--------------------------->| | |
| 2502 | // | | | | |
| 2503 | // | SubResp2 | | |
| 2504 | // |<---------------------------| | |
| 2505 | // | | | | |
| 2506 | // | | SubDelReq 1 | | |
| 2507 | // | |------------->| | |
| 2508 | // | | | | |
| 2509 | // | | SubDelResp 1 | | |
| 2510 | // | |<-------------| | |
| 2511 | // | | | | |
| 2512 | // | | | | |
| 2513 | // | | |
| 2514 | // | submgr restart | |
| 2515 | // | | |
| 2516 | // | | | | |
| 2517 | // | SubDelReq 2 | | |
| 2518 | // |--------------------------->| | |
| 2519 | // | | | | |
| 2520 | // | | | SubDelReq 2 | |
| 2521 | // | | |------------->| |
| 2522 | // | | | | |
| 2523 | // | | | SubDelReq 2 | |
| 2524 | // | | |------------->| |
| 2525 | // | | | | |
| 2526 | // | SubDelResp 2 | | |
| 2527 | // |<---------------------------| | |
| 2528 | // |
| 2529 | //----------------------------------------------------------------------------- |
| 2530 | |
| 2531 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2532 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2533 | |
| 2534 | //Req1 |
| 2535 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2536 | rparams1.Init() |
| 2537 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2538 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2539 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2540 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2541 | |
| 2542 | //Req2 |
| 2543 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2544 | rparams2.Init() |
| 2545 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2546 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2547 | |
| 2548 | // Check subscription |
| 2549 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2550 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2551 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2552 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2553 | |
| 2554 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2555 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2556 | |
| 2557 | // Check that subscription is restored correctly after restart |
| 2558 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2559 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2560 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2561 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2562 | |
| 2563 | //Del1 |
| 2564 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2565 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2566 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2567 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2568 | |
| 2569 | mainCtrl.SimulateRestart(t) |
| 2570 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2571 | |
| 2572 | //Del2 |
| 2573 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2574 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2575 | |
| 2576 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2577 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2578 | |
| 2579 | //Wait that subs is cleaned |
| 2580 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2581 | |
| 2582 | xappConn1.TestMsgChanEmpty(t) |
| 2583 | xappConn2.TestMsgChanEmpty(t) |
| 2584 | e2termConn1.TestMsgChanEmpty(t) |
| 2585 | mainCtrl.wait_registry_empty(t, 10) |
| 2586 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2587 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2588 | //***************************************************************************** |
| 2589 | // REST interface test cases |
| 2590 | //***************************************************************************** |
| 2591 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2592 | //----------------------------------------------------------------------------- |
| 2593 | // Test debug GET and POST requests |
| 2594 | // |
| 2595 | // curl |
| 2596 | // +-------+ +---------+ |
| 2597 | // | user | | submgr | |
| 2598 | // +-------+ +---------+ |
| 2599 | // | | |
| 2600 | // | GET/POST Req | |
| 2601 | // |------------->| |
| 2602 | // | Resp | |
| 2603 | // |<-------------| |
| 2604 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2605 | func TestGetSubscriptions(t *testing.T) { |
| 2606 | |
| 2607 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2608 | } |
| 2609 | |
| 2610 | func TestGetSymptomData(t *testing.T) { |
| 2611 | |
| 2612 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2613 | } |
| 2614 | |
| 2615 | func TestPostdeleteSubId(t *testing.T) { |
| 2616 | |
| 2617 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2618 | } |
| 2619 | |
| 2620 | func TestPostEmptyDb(t *testing.T) { |
| 2621 | |
| 2622 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2623 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2624 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2625 | func TestGetRestSubscriptions(t *testing.T) { |
| 2626 | |
| 2627 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2628 | } |
| 2629 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2630 | //----------------------------------------------------------------------------- |
| 2631 | // TestRESTSubReqAndRouteNok |
| 2632 | // |
| 2633 | // stub stub |
| 2634 | // +-------+ +---------+ +---------+ |
| 2635 | // | xapp | | submgr | | rtmgr | |
| 2636 | // +-------+ +---------+ +---------+ |
| 2637 | // | | | |
| 2638 | // | RESTSubReq | | |
| 2639 | // |---------------->| | |
| 2640 | // | | | |
| 2641 | // | RESTSubResp | | |
| 2642 | // |<----------------| | |
| 2643 | // | | RouteCreate | |
| 2644 | // | |------------->| |
| 2645 | // | | | |
| 2646 | // | | RouteCreate | |
| 2647 | // | | status:400 | |
| 2648 | // | |(Bad request) | |
| 2649 | // | |<-------------| |
| 2650 | // | RESTNotif | | |
| 2651 | // |<----------------| | |
| 2652 | // | | | |
| 2653 | // | [SUBS INT DELETE] | |
| 2654 | // | | | |
| 2655 | // | RESTSubDelReq | | |
| 2656 | // |---------------->| | |
| 2657 | // | RESTSubDelResp | | |
| 2658 | // |<----------------| | |
| 2659 | // |
| 2660 | //----------------------------------------------------------------------------- |
| 2661 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2662 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2663 | |
| 2664 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2665 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2666 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2667 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2668 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2669 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2670 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2671 | }) |
| 2672 | |
| 2673 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2674 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2675 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2676 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2677 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2678 | |
| 2679 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2680 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2681 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2682 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2683 | waiter.WaitResult(t) |
| 2684 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2685 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2686 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2687 | |
| 2688 | // Del |
| 2689 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2690 | |
| 2691 | // Wait that subs is cleaned |
| 2692 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2693 | waitSubsCleanup(t, e2SubsId, 10) |
| 2694 | mainCtrl.VerifyCounterValues(t) |
| 2695 | } |
| 2696 | |
| 2697 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2698 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2699 | |
| 2700 | //Init counter check |
| 2701 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2702 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2703 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2704 | Counter{cSubReqToE2, 1}, |
| 2705 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2706 | Counter{cRestSubNotifToXapp, 1}, |
| 2707 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2708 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2709 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2710 | Counter{cSubDelReqToE2, 1}, |
| 2711 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2712 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2713 | }) |
| 2714 | |
| 2715 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2716 | |
| 2717 | //Subs Create |
| 2718 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2719 | |
| 2720 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2721 | |
| 2722 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2723 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2724 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2725 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2726 | params.SetMeid("RAN_NAME_1") |
| 2727 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2728 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2729 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2730 | waiter.WaitResult(t) |
| 2731 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2732 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2733 | |
| 2734 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2735 | |
| 2736 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2737 | |
| 2738 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2739 | //Wait that subs is cleaned |
| 2740 | waitSubsCleanup(t, e2SubsId, 10) |
| 2741 | |
| 2742 | mainCtrl.VerifyCounterValues(t) |
| 2743 | } |
| 2744 | |
| 2745 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2746 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2747 | |
| 2748 | // Init counter check |
| 2749 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2750 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2751 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2752 | Counter{cSubReqToE2, 1}, |
| 2753 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2754 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2755 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2756 | Counter{cRouteDeleteFail, 1}, |
| 2757 | Counter{cSubDelReqToE2, 1}, |
| 2758 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2759 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2760 | }) |
| 2761 | |
| 2762 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2763 | |
| 2764 | //Subs Create |
| 2765 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2766 | |
| 2767 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2768 | |
| 2769 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2770 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2771 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2772 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2773 | waiter.WaitResult(t) |
| 2774 | |
| 2775 | waitSubsCleanup(t, e2SubsId, 10) |
| 2776 | |
| 2777 | mainCtrl.VerifyCounterValues(t) |
| 2778 | } |
| 2779 | |
| 2780 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2781 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2782 | |
| 2783 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2784 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 2785 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2786 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2787 | Counter{cSubReqToE2, 1}, |
| 2788 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2789 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2790 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2791 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2792 | Counter{cSubDelReqToE2, 1}, |
| 2793 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2794 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 2795 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2796 | }) |
| 2797 | |
| 2798 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2799 | |
| 2800 | //Subs Create |
| 2801 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2802 | |
| 2803 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2804 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2805 | |
| 2806 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2807 | |
| 2808 | //Del1, this shall fail on rtmgr side |
| 2809 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2810 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2811 | waiter.WaitResult(t) |
| 2812 | |
| 2813 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2814 | |
| 2815 | //Del2 |
| 2816 | deleteXapp2Subscription(t, &restSubId2) |
| 2817 | |
| 2818 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2819 | mainCtrl.VerifyCounterValues(t) |
| 2820 | } |
| 2821 | |
| 2822 | //----------------------------------------------------------------------------- |
| 2823 | // TestRESTSubReqRetransmission |
| 2824 | // |
| 2825 | // stub stub |
| 2826 | // +-------+ +---------+ +---------+ |
| 2827 | // | xapp | | submgr | | e2term | |
| 2828 | // +-------+ +---------+ +---------+ |
| 2829 | // | | | |
| 2830 | // | RESTSubReq1 | | |
| 2831 | // |---------------->| | |
| 2832 | // | | | |
| 2833 | // | RESTSubResp | | |
| 2834 | // |<----------------| | |
| 2835 | // | | SubReq1 | |
| 2836 | // | |------------->| |
| 2837 | // | | | |
| 2838 | // | RESTSubReq2 | | |
| 2839 | // | (retrans) | | |
| 2840 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2841 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2842 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2843 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2844 | // | | SubResp1 | |
| 2845 | // | |<-------------| |
| 2846 | // | RESTNotif1 | | |
| 2847 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2848 | // | | | |
| 2849 | // | [SUBS DELETE] | |
| 2850 | // | | | |
| 2851 | // |
| 2852 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2853 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2854 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2855 | CaseBegin("TestRESTSubReqRetransmission") |
| 2856 | |
| 2857 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2858 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2859 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2860 | Counter{cSubReqToE2, 1}, |
| 2861 | Counter{cSubRespFromE2, 1}, |
| 2862 | Counter{cRestSubNotifToXapp, 1}, |
| 2863 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2864 | Counter{cSubDelReqToE2, 1}, |
| 2865 | Counter{cSubDelRespFromE2, 1}, |
| 2866 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2867 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2868 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2869 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2870 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2871 | |
| 2872 | // Subs Create |
| 2873 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2874 | |
| 2875 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2876 | // gets into execution before the rtmgrg responds for the first one. |
| 2877 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2878 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2879 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2880 | xappConn2.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2881 | |
| 2882 | waiter.WaitResult(t) |
| 2883 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2884 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2885 | |
| 2886 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2887 | // the order is not significant he6re. |
| 2888 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2889 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2890 | |
| 2891 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2892 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2893 | |
| 2894 | // Del1 |
| 2895 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2896 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2897 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2898 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2899 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2900 | |
| 2901 | mainCtrl.VerifyCounterValues(t) |
| 2902 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2903 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2904 | //----------------------------------------------------------------------------- |
| 2905 | // stub stub stub |
| 2906 | // +-------+ +---------+ +---------+ +---------+ |
| 2907 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2908 | // +-------+ +---------+ +---------+ +---------+ |
| 2909 | // | | | | |
| 2910 | // | RESTSubReq | | | |
| 2911 | // |---------------->| | | |
| 2912 | // | RESTSubResp | | | |
| 2913 | // |<----------------| | | |
| 2914 | // | | RouteCreate | | |
| 2915 | // | |--------------------------->| |
| 2916 | // | | RouteResponse| | |
| 2917 | // | |<---------------------------| // The order of these events may vary |
| 2918 | // | | SubReq | | |
| 2919 | // | |------------->| | // The order of these events may vary |
| 2920 | // | | SubResp | | |
| 2921 | // | |<-------------| | |
| 2922 | // | RESTNotif1 | | | |
| 2923 | // |<----------------| | | |
| 2924 | // | RESTSubReq | | | |
| 2925 | // | [RETRANS1] | | | |
| 2926 | // |---------------->| | | |
| 2927 | // | RESTNotif1 | | | |
| 2928 | // |<----------------| | | |
| 2929 | // | RESTSubReq | | | |
| 2930 | // | [RETRANS2] | | | |
| 2931 | // |---------------->| | | |
| 2932 | // | RESTNotif1 | | | |
| 2933 | // |<----------------| | | |
| 2934 | // | RESTSubDelReq | | | |
| 2935 | // |---------------->| | | |
| 2936 | // | | SubDelReq | | |
| 2937 | // | |------------->| | |
| 2938 | // | RESTSubDelResp| | | |
| 2939 | // |<----------------| | | |
| 2940 | // | | SubDelResp | | |
| 2941 | // | |<-------------| | |
| 2942 | // | | | | |
| 2943 | // |
| 2944 | //----------------------------------------------------------------------------- |
| 2945 | |
| 2946 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2947 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2948 | |
| 2949 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2950 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 2951 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2952 | Counter{cRestSubRespToXapp, 3}, |
| 2953 | Counter{cSubReqToE2, 1}, |
| 2954 | Counter{cSubRespFromE2, 1}, |
| 2955 | Counter{cRestSubNotifToXapp, 3}, |
| 2956 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2957 | Counter{cSubDelReqToE2, 1}, |
| 2958 | Counter{cSubDelRespFromE2, 1}, |
| 2959 | Counter{cRestSubDelRespToXapp, 1}, |
| 2960 | }) |
| 2961 | |
| 2962 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2963 | |
| 2964 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2965 | |
| 2966 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2967 | |
| 2968 | //1.st resend |
| 2969 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2970 | |
| 2971 | assert.Equal(t, restSubId_resend, restSubId) |
| 2972 | |
| 2973 | <-time.After(100 * time.Millisecond) |
| 2974 | |
| 2975 | //2.nd resend |
| 2976 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2977 | |
| 2978 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2979 | |
| 2980 | <-time.After(100 * time.Millisecond) |
| 2981 | |
| 2982 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2983 | |
| 2984 | waitSubsCleanup(t, e2SubsId, 10) |
| 2985 | |
| 2986 | //Wait that subs is cleaned |
| 2987 | mainCtrl.VerifyCounterValues(t) |
| 2988 | } |
| 2989 | |
| 2990 | //----------------------------------------------------------------------------- |
| 2991 | // stub stub stub |
| 2992 | // +-------+ +---------+ +---------+ +---------+ |
| 2993 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2994 | // +-------+ +---------+ +---------+ +---------+ |
| 2995 | // | | | | |
| 2996 | // | RESTSubReq | | | |
| 2997 | // |---------------->| | | |
| 2998 | // | RESTSubResp | | | |
| 2999 | // |<----------------| | | |
| 3000 | // | | RouteCreate | | |
| 3001 | // | |--------------------------->| |
| 3002 | // | | RouteResponse| | |
| 3003 | // | |<---------------------------| // The order of these events may vary |
| 3004 | // | | SubReq | | |
| 3005 | // | |------------->| | // The order of these events may vary |
| 3006 | // | | SubResp | | |
| 3007 | // | |<-------------| | |
| 3008 | // | RESTNotif1 | | | |
| 3009 | // |<----------------| | | |
| 3010 | // | RESTSubReq | | | |
| 3011 | // | [RETRANS, with RESTsubsId] | | |
| 3012 | // |---------------->| | | |
| 3013 | // | RESTNotif1 | | | |
| 3014 | // |<----------------| | | |
| 3015 | // | RESTSubReq | | | |
| 3016 | // | [RETRANS, without RESTsubsId] | | |
| 3017 | // |---------------->| | | |
| 3018 | // | RESTNotif1 | | | |
| 3019 | // |<----------------| | | |
| 3020 | // | RESTSubDelReq | | | |
| 3021 | // |---------------->| | | |
| 3022 | // | | SubDelReq | | |
| 3023 | // | |------------->| | |
| 3024 | // | RESTSubDelResp| | | |
| 3025 | // |<----------------| | | |
| 3026 | // | | SubDelResp | | |
| 3027 | // | |<-------------| | |
| 3028 | // | | | | |
| 3029 | // |
| 3030 | //----------------------------------------------------------------------------- |
| 3031 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3032 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3033 | |
| 3034 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3035 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3036 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3037 | Counter{cRestSubRespToXapp, 3}, |
| 3038 | Counter{cSubReqToE2, 1}, |
| 3039 | Counter{cSubRespFromE2, 1}, |
| 3040 | Counter{cRestSubNotifToXapp, 3}, |
| 3041 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3042 | Counter{cSubDelReqToE2, 1}, |
| 3043 | Counter{cSubDelRespFromE2, 1}, |
| 3044 | Counter{cRestSubDelRespToXapp, 1}, |
| 3045 | }) |
| 3046 | |
| 3047 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3048 | |
| 3049 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3050 | |
| 3051 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3052 | |
| 3053 | <-time.After(100 * time.Millisecond) |
| 3054 | |
| 3055 | //1.st resend with subscription ID |
| 3056 | params.SetSubscriptionID(&restSubId) |
| 3057 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3058 | |
| 3059 | assert.Equal(t, restSubId_resend, restSubId) |
| 3060 | |
| 3061 | <-time.After(100 * time.Millisecond) |
| 3062 | |
| 3063 | //2.nd resend without subscription ID (faking app restart) |
| 3064 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3065 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3066 | |
| 3067 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3068 | |
| 3069 | <-time.After(100 * time.Millisecond) |
| 3070 | |
| 3071 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3072 | |
| 3073 | waitSubsCleanup(t, e2SubsId, 10) |
| 3074 | |
| 3075 | //Wait that subs is cleaned |
| 3076 | mainCtrl.VerifyCounterValues(t) |
| 3077 | } |
| 3078 | |
| 3079 | //----------------------------------------------------------------------------- |
| 3080 | // stub stub stub |
| 3081 | // +-------+ +---------+ +---------+ +---------+ |
| 3082 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3083 | // +-------+ +---------+ +---------+ +---------+ |
| 3084 | // | | | | |
| 3085 | // | RESTSubReq | | | |
| 3086 | // |---------------->| | | |
| 3087 | // | RESTSubResp | | | |
| 3088 | // |<----------------| | | |
| 3089 | // | | RouteCreate | | |
| 3090 | // | |--------------------------->| |
| 3091 | // | | RouteResponse| | |
| 3092 | // | |<---------------------------| |
| 3093 | // | | SubReq | | |
| 3094 | // | |------------->| | |
| 3095 | // | | SubResp | | |
| 3096 | // | |<-------------| | |
| 3097 | // | RESTNotif1 | | | |
| 3098 | // |<----------------| | | |
| 3099 | // | RESTSubReq | | | |
| 3100 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3101 | // |---------------->| | | |
| 3102 | // | RESTNotif1 | | | |
| 3103 | // | [for initial e2 subDetail] | | |
| 3104 | // |<----------------| | | |
| 3105 | // | | RouteCreate | | |
| 3106 | // | |--------------------------->| |
| 3107 | // | | RouteResponse| | |
| 3108 | // | |<---------------------------| |
| 3109 | // | | SubReq | | |
| 3110 | // | |------------->| | |
| 3111 | // | | SubResp | | |
| 3112 | // | |<-------------| | |
| 3113 | // | RESTNotif1 | | | |
| 3114 | // |<----------------| | | |
| 3115 | // | RESTSubReq | | | |
| 3116 | // | [with RESTsubsId initial request] | |
| 3117 | // |---------------->| | | |
| 3118 | // | RESTNotif1 | | | |
| 3119 | // |<----------------| | | |
| 3120 | // | RESTSubDelReq | | | |
| 3121 | // |---------------->| | | |
| 3122 | // | RESTSubDelResp| | | |
| 3123 | // |<----------------| | | |
| 3124 | // | | SubDelReq | | |
| 3125 | // | |------------->| | |
| 3126 | // | | SubDelResp | | |
| 3127 | // | |<-------------| | |
| 3128 | // | | SubDelReq | | |
| 3129 | // | |------------->| | |
| 3130 | // | | SubDelResp | | |
| 3131 | // | |<-------------| | |
| 3132 | // | | | | |
| 3133 | // |
| 3134 | //----------------------------------------------------------------------------- |
| 3135 | |
| 3136 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3137 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3138 | |
| 3139 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3140 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3141 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3142 | Counter{cRestSubRespToXapp, 3}, |
| 3143 | Counter{cSubReqToE2, 2}, |
| 3144 | Counter{cSubRespFromE2, 2}, |
| 3145 | Counter{cRestSubNotifToXapp, 4}, |
| 3146 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3147 | Counter{cSubDelReqToE2, 2}, |
| 3148 | Counter{cSubDelRespFromE2, 2}, |
| 3149 | Counter{cRestSubDelRespToXapp, 1}, |
| 3150 | }) |
| 3151 | |
| 3152 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3153 | |
| 3154 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3155 | |
| 3156 | <-time.After(100 * time.Millisecond) |
| 3157 | |
| 3158 | // Send modified requst, this time with e2 subscriptions. |
| 3159 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3160 | params2.SetSubscriptionID(&restSubId) |
| 3161 | |
| 3162 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3163 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3164 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3165 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3166 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3167 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3168 | |
| 3169 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3170 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3171 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3172 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3173 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3174 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3175 | assert.NotEqual(t, e2SubsId2, 0) |
| 3176 | |
| 3177 | <-time.After(100 * time.Millisecond) |
| 3178 | |
| 3179 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3180 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3181 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3182 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3183 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3184 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3185 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3186 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3187 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3188 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3189 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3190 | // Delete both e2 subscriptions |
| 3191 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3192 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3193 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3194 | |
| 3195 | waitSubsCleanup(t, e2SubsId, 10) |
| 3196 | |
| 3197 | //Wait that subs is cleaned |
| 3198 | mainCtrl.VerifyCounterValues(t) |
| 3199 | } |
| 3200 | |
| 3201 | //----------------------------------------------------------------------------- |
| 3202 | // stub stub stub |
| 3203 | // +-------+ +---------+ +---------+ +---------+ |
| 3204 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3205 | // +-------+ +---------+ +---------+ +---------+ |
| 3206 | // | | | | |
| 3207 | // | RESTSubReq | | | |
| 3208 | // |---------------->| | | |
| 3209 | // | RESTSubResp | | | |
| 3210 | // |<----------------| | | |
| 3211 | // | | RouteCreate | | |
| 3212 | // | |--------------------------->| |
| 3213 | // | | RouteResponse| | |
| 3214 | // | |<---------------------------| |
| 3215 | // | | SubReq | | |
| 3216 | // | |------------->| | |
| 3217 | // | | SubResp | | |
| 3218 | // | |<-------------| | |
| 3219 | // | RESTNotif1 | | | |
| 3220 | // |<----------------| | | |
| 3221 | // | RESTSubReq | | | |
| 3222 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3223 | // |---------------->| | | |
| 3224 | // | RESTNotif1 | | | |
| 3225 | // | [for initial e2 subDetail] | | |
| 3226 | // |<----------------| | | |
| 3227 | // | | RouteCreate | | |
| 3228 | // | |--------------------------->| |
| 3229 | // | | RouteResponse| | |
| 3230 | // | |<---------------------------| |
| 3231 | // | | SubReq | | |
| 3232 | // | |------------->| | |
| 3233 | // | | SubResp | | |
| 3234 | // | |<-------------| | |
| 3235 | // | RESTNotif1 | | | |
| 3236 | // |<----------------| | | |
| 3237 | // | RESTSubReq | | | |
| 3238 | // | [without RESTsubsId initial request] | |
| 3239 | // |---------------->| | | |
| 3240 | // | RESTNotif1 | | | |
| 3241 | // |<----------------| | | |
| 3242 | // | RESTSubDelReq | | | |
| 3243 | // |---------------->| | | |
| 3244 | // | RESTSubDelResp| | | |
| 3245 | // |<----------------| | | |
| 3246 | // | | SubDelReq | | |
| 3247 | // | |------------->| | |
| 3248 | // | | SubDelResp | | |
| 3249 | // | |<-------------| | |
| 3250 | // | | SubDelReq | | |
| 3251 | // | |------------->| | |
| 3252 | // | | SubDelResp | | |
| 3253 | // | |<-------------| | |
| 3254 | // | | | | |
| 3255 | // |
| 3256 | //----------------------------------------------------------------------------- |
| 3257 | |
| 3258 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3259 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3260 | |
| 3261 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3262 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3263 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3264 | Counter{cRestSubRespToXapp, 3}, |
| 3265 | Counter{cSubReqToE2, 2}, |
| 3266 | Counter{cSubRespFromE2, 2}, |
| 3267 | Counter{cRestSubNotifToXapp, 4}, |
| 3268 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3269 | Counter{cSubDelReqToE2, 2}, |
| 3270 | Counter{cSubDelRespFromE2, 2}, |
| 3271 | Counter{cRestSubDelRespToXapp, 1}, |
| 3272 | }) |
| 3273 | |
| 3274 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3275 | |
| 3276 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3277 | |
| 3278 | <-time.After(100 * time.Millisecond) |
| 3279 | |
| 3280 | // Send modified requst, this time with e2 subscriptions. |
| 3281 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3282 | params2.SetSubscriptionID(&restSubId) |
| 3283 | |
| 3284 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3285 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3286 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3287 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3288 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3289 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3290 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3291 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3292 | xappConn1.DecrementRequestCount() |
| 3293 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3294 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3295 | |
| 3296 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3297 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3298 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3299 | assert.NotEqual(t, e2SubsId2, 0) |
| 3300 | |
| 3301 | <-time.After(100 * time.Millisecond) |
| 3302 | |
| 3303 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3304 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3305 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3306 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3307 | // md5sum shall find the original request |
| 3308 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3309 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3310 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3311 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3312 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3313 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3314 | // Delete both e2 subscriptions |
| 3315 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3316 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3317 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3318 | |
| 3319 | waitSubsCleanup(t, e2SubsId, 10) |
| 3320 | |
| 3321 | //Wait that subs is cleaned |
| 3322 | mainCtrl.VerifyCounterValues(t) |
| 3323 | } |
| 3324 | |
| 3325 | //----------------------------------------------------------------------------- |
| 3326 | // stub stub stub |
| 3327 | // +-------+ +---------+ +---------+ +---------+ |
| 3328 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3329 | // +-------+ +---------+ +---------+ +---------+ |
| 3330 | // | | | | |
| 3331 | // | RESTSubReq | | | |
| 3332 | // |---------------->| | | |
| 3333 | // | RESTSubResp | | | |
| 3334 | // |<----------------| | | |
| 3335 | // | | RouteCreate | | |
| 3336 | // | |--------------------------->| |
| 3337 | // | | RouteResponse| | |
| 3338 | // | |<---------------------------| |
| 3339 | // | | SubReq | | |
| 3340 | // | |------------->| | |
| 3341 | // | | SubResp | | |
| 3342 | // | |<-------------| | |
| 3343 | // | RESTNotif1 | | | |
| 3344 | // |<----------------| | | |
| 3345 | // | RESTSubReq | | | |
| 3346 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3347 | // |---------------->| | | |
| 3348 | // | RESTNotif1 | | | |
| 3349 | // | [for initial e2 subDetail] | | |
| 3350 | // |<----------------| | | |
| 3351 | // | | RouteCreate | | |
| 3352 | // | |--------------------------->| |
| 3353 | // | | RouteResponse| | |
| 3354 | // | |<---------------------------| |
| 3355 | // | | SubReq | | |
| 3356 | // | |------------->| | |
| 3357 | // | | SubResp | | |
| 3358 | // | |<-------------| | |
| 3359 | // | RESTNotif1 | | | |
| 3360 | // |<----------------| | | |
| 3361 | // | RESTSubDelReq | | | |
| 3362 | // |---------------->| | | |
| 3363 | // | RESTSubDelResp| | | |
| 3364 | // |<----------------| | | |
| 3365 | // | | SubDelReq | | |
| 3366 | // | |------------->| | |
| 3367 | // | | SubDelResp | | |
| 3368 | // | |<-------------| | |
| 3369 | // | | SubDelReq | | |
| 3370 | // | |------------->| | |
| 3371 | // | | SubDelResp | | |
| 3372 | // | |<-------------| | |
| 3373 | // | RESTSubReq | | | |
| 3374 | // | [with RESTsubsId initial request] | |
| 3375 | // |---------------->| | | |
| 3376 | // | RESTSubResp | | | |
| 3377 | // |<----------------| | | |
| 3378 | // | | RouteCreate | | |
| 3379 | // | |--------------------------->| |
| 3380 | // | | RouteResponse| | |
| 3381 | // | |<---------------------------| |
| 3382 | // | | SubReq | | |
| 3383 | // | |------------->| | |
| 3384 | // | | SubResp | | |
| 3385 | // | |<-------------| | |
| 3386 | // | RESTNotif1 | | | |
| 3387 | // |<----------------| | | |
| 3388 | // | | | | |
| 3389 | // |
| 3390 | //----------------------------------------------------------------------------- |
| 3391 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3392 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3393 | |
| 3394 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3395 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3396 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3397 | Counter{cRestSubRespToXapp, 3}, |
| 3398 | Counter{cSubReqToE2, 3}, |
| 3399 | Counter{cSubRespFromE2, 3}, |
| 3400 | Counter{cRestSubNotifToXapp, 4}, |
| 3401 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3402 | Counter{cSubDelReqToE2, 3}, |
| 3403 | Counter{cSubDelRespFromE2, 3}, |
| 3404 | Counter{cRestSubDelRespToXapp, 2}, |
| 3405 | }) |
| 3406 | |
| 3407 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3408 | |
| 3409 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3410 | |
| 3411 | <-time.After(100 * time.Millisecond) |
| 3412 | |
| 3413 | // Send modified requst, this time with e2 subscriptions. |
| 3414 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3415 | params2.SetSubscriptionID(&restSubId) |
| 3416 | |
| 3417 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3418 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3419 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3420 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3421 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3422 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3423 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3424 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3425 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3426 | |
| 3427 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3428 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3429 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3430 | assert.NotEqual(t, e2SubsId2, 0) |
| 3431 | |
| 3432 | <-time.After(100 * time.Millisecond) |
| 3433 | |
| 3434 | // Delete both e2 subscriptions |
| 3435 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3436 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3437 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3438 | |
| 3439 | waitSubsCleanup(t, e2SubsId, 10) |
| 3440 | |
| 3441 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3442 | // but the restsubscription has been already removed. This shall trigger a |
| 3443 | // fresh create. |
| 3444 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3445 | |
| 3446 | <-time.After(100 * time.Millisecond) |
| 3447 | |
| 3448 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3449 | |
| 3450 | waitSubsCleanup(t, e2SubsId, 10) |
| 3451 | |
| 3452 | //Wait that subs is cleaned |
| 3453 | mainCtrl.VerifyCounterValues(t) |
| 3454 | } |
| 3455 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3456 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3457 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3458 | |
| 3459 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3460 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3461 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3462 | Counter{cSubReqToE2, 1}, |
| 3463 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3464 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3465 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3466 | Counter{cSubDelReqToE2, 1}, |
| 3467 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3468 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3469 | }) |
| 3470 | |
| 3471 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3472 | |
| 3473 | //Subs Create |
| 3474 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3475 | |
| 3476 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3477 | |
| 3478 | //Subs Delete |
| 3479 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3480 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3481 | |
| 3482 | seqBef := mainCtrl.get_msgcounter(t) |
| 3483 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3484 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3485 | |
| 3486 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3487 | |
| 3488 | waitSubsCleanup(t, e2SubsId, 10) |
| 3489 | |
| 3490 | mainCtrl.VerifyCounterValues(t) |
| 3491 | } |
| 3492 | |
| 3493 | //----------------------------------------------------------------------------- |
| 3494 | // TestRESTSubReqDelReq |
| 3495 | // |
| 3496 | // stub stub |
| 3497 | // +-------+ +---------+ +---------+ |
| 3498 | // | xapp | | submgr | | e2term | |
| 3499 | // +-------+ +---------+ +---------+ |
| 3500 | // | | | |
| 3501 | // | RESTSubReq | | |
| 3502 | // |---------------->| | |
| 3503 | // | | | |
| 3504 | // | RESTSubResp | | |
| 3505 | // |<----------------| | |
| 3506 | // | | SubReq | |
| 3507 | // | |------------->| |
| 3508 | // | RESTSubDelReq | | |
| 3509 | // |---------------->| | |
| 3510 | // | RESTSubDelResp | | |
| 3511 | // | unsuccess | | |
| 3512 | // |<----------------| | |
| 3513 | // | | SubResp | |
| 3514 | // | |<-------------| |
| 3515 | // | RESTNotif1 | | |
| 3516 | // |<----------------| | |
| 3517 | // | | | |
| 3518 | // | [SUBS DELETE] | |
| 3519 | // | | | |
| 3520 | // |
| 3521 | //----------------------------------------------------------------------------- |
| 3522 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3523 | CaseBegin("TestRESTSubReqDelReq") |
| 3524 | |
| 3525 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3526 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3527 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3528 | Counter{cSubReqToE2, 1}, |
| 3529 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3530 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3531 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3532 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3533 | Counter{cSubDelReqToE2, 1}, |
| 3534 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3535 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3536 | }) |
| 3537 | |
| 3538 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3539 | |
| 3540 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3541 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3542 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3543 | |
| 3544 | // Del. This will fail as processing of the subscription |
| 3545 | // is still ongoing in submgr. Deletion is not allowed before |
| 3546 | // subscription creation has been completed. |
| 3547 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3548 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3549 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3550 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3551 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3552 | |
| 3553 | // Retry del |
| 3554 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3555 | |
| 3556 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3557 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3558 | |
| 3559 | // Wait that subs is cleaned |
| 3560 | waitSubsCleanup(t, e2SubsId, 10) |
| 3561 | mainCtrl.VerifyCounterValues(t) |
| 3562 | |
| 3563 | } |
| 3564 | |
| 3565 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3566 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3567 | } |
| 3568 | |
| 3569 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3570 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3571 | |
| 3572 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3573 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3574 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3575 | Counter{cSubReqToE2, 2}, |
| 3576 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3577 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3578 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3579 | Counter{cSubDelReqToE2, 2}, |
| 3580 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3581 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3582 | }) |
| 3583 | |
| 3584 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3585 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3586 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3587 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3588 | |
| 3589 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3590 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3591 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3592 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3593 | |
| 3594 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3595 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3596 | |
| 3597 | //XappConn1 receives both of the responses |
| 3598 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3599 | |
| 3600 | //Resp1 |
| 3601 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3602 | //Resp2 |
| 3603 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3604 | |
| 3605 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3606 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3607 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3608 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3609 | |
| 3610 | //Del1 |
| 3611 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3612 | //Del2 |
| 3613 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3614 | |
| 3615 | //Wait that subs is cleaned |
| 3616 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3617 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3618 | |
| 3619 | mainCtrl.VerifyCounterValues(t) |
| 3620 | |
| 3621 | } |
| 3622 | |
| 3623 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3624 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3625 | |
| 3626 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3627 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3628 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3629 | Counter{cSubReqToE2, 2}, |
| 3630 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3631 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3632 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3633 | Counter{cSubDelReqToE2, 2}, |
| 3634 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3635 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3636 | }) |
| 3637 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3638 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3639 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3640 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3641 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3642 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3643 | params.SetMeid("RAN_NAME_2") |
| 3644 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3645 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3646 | |
| 3647 | //Del1 |
| 3648 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3649 | //Del2 |
| 3650 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3651 | |
| 3652 | //Wait that subs is cleaned |
| 3653 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3654 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3655 | |
| 3656 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3657 | } |
| 3658 | |
| 3659 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3660 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3661 | |
| 3662 | // Init counter check |
| 3663 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3664 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3665 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3666 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3667 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3668 | Counter{cSubReReqToE2, 1}, |
| 3669 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3670 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3671 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3672 | Counter{cSubDelReqToE2, 1}, |
| 3673 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3674 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3675 | }) |
| 3676 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3677 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3678 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3679 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3680 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3681 | |
| 3682 | // Catch the first message and ignore it |
| 3683 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3684 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3685 | |
| 3686 | // The second request is being handled normally |
| 3687 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3688 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3689 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3690 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3691 | |
| 3692 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3693 | |
| 3694 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3695 | |
| 3696 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3697 | //Wait that subs is cleaned |
| 3698 | waitSubsCleanup(t, e2SubsId, 10) |
| 3699 | |
| 3700 | mainCtrl.VerifyCounterValues(t) |
| 3701 | |
| 3702 | } |
| 3703 | |
| 3704 | //----------------------------------------------------------------------------- |
| 3705 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3706 | // |
| 3707 | // stub stub |
| 3708 | // +-------+ +---------+ +---------+ |
| 3709 | // | xapp | | submgr | | e2term | |
| 3710 | // +-------+ +---------+ +---------+ |
| 3711 | // | | | |
| 3712 | // | RESTSubReq | | |
| 3713 | // |---------------->| | |
| 3714 | // | | | |
| 3715 | // | RESTSubResp | | |
| 3716 | // |<----------------| | |
| 3717 | // | | SubReq | |
| 3718 | // | |------------->| |
| 3719 | // | | | |
| 3720 | // | | | |
| 3721 | // | | SubReq | |
| 3722 | // | |------------->| |
| 3723 | // | | | |
| 3724 | // | | SubDelReq | |
| 3725 | // | |------------->| |
| 3726 | // | | | |
| 3727 | // | | | |
| 3728 | // | | SubDelReq | |
| 3729 | // | |------------->| |
| 3730 | // | | | |
| 3731 | // | | | |
| 3732 | // | | SubDelResp | |
| 3733 | // | |<-------------| |
| 3734 | // | RESTNotif | | |
| 3735 | // | unsuccess | | |
| 3736 | // |<----------------| | |
| 3737 | // | | | |
| 3738 | // | [SUBS DELETE] | |
| 3739 | // | | | |
| 3740 | // |
| 3741 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3742 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3743 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3744 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3745 | |
| 3746 | // Init counter check |
| 3747 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3748 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3749 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3750 | Counter{cSubReqToE2, 1}, |
| 3751 | Counter{cSubReReqToE2, 1}, |
| 3752 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3753 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3754 | Counter{cSubDelReqToE2, 1}, |
| 3755 | Counter{cSubDelRespFromE2, 1}, |
| 3756 | }) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3757 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3758 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3759 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3760 | |
| 3761 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3762 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3763 | |
| 3764 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3765 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3766 | |
| 3767 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3768 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3769 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3770 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3771 | |
| 3772 | // Wait that subs is cleaned |
| 3773 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 3774 | |
| 3775 | mainCtrl.VerifyCounterValues(t) |
| 3776 | } |
| 3777 | |
| 3778 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3779 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3780 | |
| 3781 | // Init counter check |
| 3782 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3783 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3784 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3785 | Counter{cSubReqToE2, 1}, |
| 3786 | Counter{cSubReReqToE2, 1}, |
| 3787 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3788 | Counter{cSubDelReReqToE2, 1}, |
| 3789 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3790 | Counter{cSubDelReqToE2, 1}, |
| 3791 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3792 | }) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3793 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3794 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3795 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3796 | |
| 3797 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3798 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3799 | |
| 3800 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3801 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3802 | |
| 3803 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3804 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3805 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3806 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3807 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3808 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3809 | |
| 3810 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3811 | |
| 3812 | waitSubsCleanup(t, e2SubsId, 10) |
| 3813 | |
| 3814 | mainCtrl.VerifyCounterValues(t) |
| 3815 | |
| 3816 | } |
| 3817 | |
| 3818 | //----------------------------------------------------------------------------- |
| 3819 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3820 | // |
| 3821 | // stub stub |
| 3822 | // +-------+ +---------+ +---------+ |
| 3823 | // | xapp | | submgr | | e2term | |
| 3824 | // +-------+ +---------+ +---------+ |
| 3825 | // | | | |
| 3826 | // | RESTSubReq | | |
| 3827 | // |---------------->| | |
| 3828 | // | | | |
| 3829 | // | RESTSubResp | | |
| 3830 | // |<----------------| | |
| 3831 | // | | SubReq | |
| 3832 | // | |------------->| |
| 3833 | // | | | |
| 3834 | // | | | |
| 3835 | // | | SubReq | |
| 3836 | // | |------------->| |
| 3837 | // | | | |
| 3838 | // | | SubDelReq | |
| 3839 | // | |------------->| |
| 3840 | // | | | |
| 3841 | // | | | |
| 3842 | // | | SubDelReq | |
| 3843 | // | |------------->| |
| 3844 | // | | | |
| 3845 | // | | | |
| 3846 | // | | SubDelResp | |
| 3847 | // | |<-------------| |
| 3848 | // | RESTNotif | | |
| 3849 | // | unsuccess | | |
| 3850 | // |<----------------| | |
| 3851 | // | | | |
| 3852 | // | [SUBS DELETE] | |
| 3853 | // | | | |
| 3854 | // |
| 3855 | //----------------------------------------------------------------------------- |
| 3856 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3857 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3858 | |
| 3859 | // Init counter check |
| 3860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3861 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3862 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3863 | Counter{cSubReqToE2, 1}, |
| 3864 | Counter{cSubReReqToE2, 1}, |
| 3865 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3866 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3867 | Counter{cSubDelReqToE2, 1}, |
| 3868 | Counter{cSubDelReReqToE2, 1}, |
| 3869 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3870 | }) |
| 3871 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3872 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3873 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3874 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3875 | |
| 3876 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3877 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3878 | |
| 3879 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3880 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3881 | |
| 3882 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3883 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3884 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3885 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3886 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3887 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3888 | |
| 3889 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3890 | |
| 3891 | waitSubsCleanup(t, e2SubsId, 10) |
| 3892 | |
| 3893 | mainCtrl.VerifyCounterValues(t) |
| 3894 | } |
| 3895 | |
| 3896 | //----------------------------------------------------------------------------- |
| 3897 | // TestRESTSubReqSubFailRespInSubmgr |
| 3898 | // |
| 3899 | // stub stub |
| 3900 | // +-------+ +---------+ +---------+ |
| 3901 | // | xapp | | submgr | | e2term | |
| 3902 | // +-------+ +---------+ +---------+ |
| 3903 | // | | | |
| 3904 | // | RESTSubReq | | |
| 3905 | // |---------------->| | |
| 3906 | // | | | |
| 3907 | // | RESTSubResp | | |
| 3908 | // |<----------------| | |
| 3909 | // | | SubReq | |
| 3910 | // | |------------->| |
| 3911 | // | | | |
| 3912 | // | | SubFail | |
| 3913 | // | |<-------------| |
| 3914 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3915 | // | RESTNotif | | |
| 3916 | // | unsuccess | | |
| 3917 | // |<----------------| | |
| 3918 | // | | | |
| 3919 | // | [SUBS DELETE] | |
| 3920 | // | | | |
| 3921 | // |
| 3922 | //----------------------------------------------------------------------------- |
| 3923 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3924 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3925 | |
| 3926 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3927 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3928 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3929 | Counter{cSubReqToE2, 1}, |
| 3930 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3931 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3932 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 3933 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3934 | }) |
| 3935 | |
| 3936 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3937 | const e2Timeout int64 = 2 |
| 3938 | const e2RetryCount int64 = 1 |
| 3939 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3940 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3941 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3942 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3943 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3944 | |
| 3945 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3946 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3947 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 3948 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3949 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3950 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3951 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3952 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3953 | |
| 3954 | // REST subscription sill there to be deleted |
| 3955 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3956 | |
| 3957 | // Wait that subs is cleaned |
| 3958 | waitSubsCleanup(t, e2SubsId, 10) |
| 3959 | |
| 3960 | mainCtrl.VerifyCounterValues(t) |
| 3961 | |
| 3962 | } |
| 3963 | |
| 3964 | //----------------------------------------------------------------------------- |
| 3965 | // TestRESTSubDelReqRetryInSubmgr |
| 3966 | // |
| 3967 | // stub stub |
| 3968 | // +-------+ +---------+ +---------+ |
| 3969 | // | xapp | | submgr | | e2term | |
| 3970 | // +-------+ +---------+ +---------+ |
| 3971 | // | | | |
| 3972 | // | [SUBS CREATE] | |
| 3973 | // | | | |
| 3974 | // | | | |
| 3975 | // | RESTSubDelReq | | |
| 3976 | // |---------------->| | |
| 3977 | // | | | |
| 3978 | // | RESTSubDelResp | | |
| 3979 | // |<----------------| | |
| 3980 | // | | SubDelReq | |
| 3981 | // | |------------->| |
| 3982 | // | | | |
| 3983 | // | | SubDelReq | |
| 3984 | // | |------------->| |
| 3985 | // | | | |
| 3986 | // | | SubDelResp | |
| 3987 | // | |<-------------| |
| 3988 | // | | | |
| 3989 | // |
| 3990 | //----------------------------------------------------------------------------- |
| 3991 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3992 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3993 | |
| 3994 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3995 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3996 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3997 | Counter{cSubReqToE2, 1}, |
| 3998 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3999 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4000 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4001 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4002 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4003 | Counter{cSubDelReReqToE2, 1}, |
| 4004 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4005 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4006 | }) |
| 4007 | // Req |
| 4008 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4009 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4010 | |
| 4011 | // Del |
| 4012 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4013 | |
| 4014 | // E2t: Receive 1st SubsDelReq |
| 4015 | e2termConn1.RecvSubsDelReq(t) |
| 4016 | |
| 4017 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4018 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4019 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4020 | |
| 4021 | //Wait that subs is cleaned |
| 4022 | waitSubsCleanup(t, e2SubsId, 10) |
| 4023 | |
| 4024 | mainCtrl.VerifyCounterValues(t) |
| 4025 | } |
| 4026 | |
| 4027 | //----------------------------------------------------------------------------- |
| 4028 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4029 | // |
| 4030 | // stub stub |
| 4031 | // +-------+ +---------+ +---------+ |
| 4032 | // | xapp | | submgr | | e2term | |
| 4033 | // +-------+ +---------+ +---------+ |
| 4034 | // | | | |
| 4035 | // | [SUBS CREATE] | |
| 4036 | // | | | |
| 4037 | // | | | |
| 4038 | // | RESTSubDelReq | | |
| 4039 | // |---------------->| | |
| 4040 | // | | | |
| 4041 | // | RESTSubDelResp | | |
| 4042 | // |<----------------| | |
| 4043 | // | | SubDelReq | |
| 4044 | // | |------------->| |
| 4045 | // | | | |
| 4046 | // | | SubDelReq | |
| 4047 | // | |------------->| |
| 4048 | // | | | |
| 4049 | // | | | |
| 4050 | // |
| 4051 | //----------------------------------------------------------------------------- |
| 4052 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4053 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4054 | |
| 4055 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4056 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4057 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4058 | Counter{cSubReqToE2, 1}, |
| 4059 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4060 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4061 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4062 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4063 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | Counter{cSubDelReReqToE2, 1}, |
| 4065 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4066 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4067 | }) |
| 4068 | |
| 4069 | // Req |
| 4070 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4071 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4072 | |
| 4073 | // Del |
| 4074 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4075 | |
| 4076 | // E2t: Receive 1st SubsDelReq |
| 4077 | e2termConn1.RecvSubsDelReq(t) |
| 4078 | |
| 4079 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4080 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4081 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4082 | |
| 4083 | //Wait that subs is cleaned |
| 4084 | waitSubsCleanup(t, e2SubsId, 10) |
| 4085 | |
| 4086 | mainCtrl.VerifyCounterValues(t) |
| 4087 | } |
| 4088 | |
| 4089 | //----------------------------------------------------------------------------- |
| 4090 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4091 | // |
| 4092 | // stub stub |
| 4093 | // +-------+ +---------+ +---------+ |
| 4094 | // | xapp | | submgr | | e2term | |
| 4095 | // +-------+ +---------+ +---------+ |
| 4096 | // | | | |
| 4097 | // | [SUBS CREATE] | |
| 4098 | // | | | |
| 4099 | // | | | |
| 4100 | // | RESTSubDelReq | | |
| 4101 | // |---------------->| | |
| 4102 | // | | | |
| 4103 | // | RESTSubDelResp | | |
| 4104 | // |<----------------| | |
| 4105 | // | | SubDelReq | |
| 4106 | // | |------------->| |
| 4107 | // | | | |
| 4108 | // | | SubDelFail | |
| 4109 | // | |<-------------| |
| 4110 | // | | | |
| 4111 | // |
| 4112 | //----------------------------------------------------------------------------- |
| 4113 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4114 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4115 | |
| 4116 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4117 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4118 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4119 | Counter{cSubReqToE2, 1}, |
| 4120 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4121 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4122 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4123 | Counter{cSubDelReqToE2, 1}, |
| 4124 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4125 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4126 | }) |
| 4127 | |
| 4128 | // Req |
| 4129 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4130 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4131 | |
| 4132 | // Del |
| 4133 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4134 | |
| 4135 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4136 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4137 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4138 | |
| 4139 | //Wait that subs is cleaned |
| 4140 | waitSubsCleanup(t, e2SubsId, 10) |
| 4141 | |
| 4142 | mainCtrl.VerifyCounterValues(t) |
| 4143 | } |
| 4144 | |
| 4145 | //----------------------------------------------------------------------------- |
| 4146 | // TestRESTSubReqAndSubDelOkSameAction |
| 4147 | // |
| 4148 | // stub stub |
| 4149 | // +-------+ +-------+ +---------+ +---------+ |
| 4150 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4151 | // +-------+ +-------+ +---------+ +---------+ |
| 4152 | // | | | | |
| 4153 | // | | RESTSubReq1 | | |
| 4154 | // | |---------------->| | |
| 4155 | // | | | | |
| 4156 | // | | RESTSubResp1 | | |
| 4157 | // | |<----------------| | |
| 4158 | // | | | | |
| 4159 | // | | | SubReq1 | |
| 4160 | // | | |------------->| |
| 4161 | // | | | SubResp1 | |
| 4162 | // | | |<-------------| |
| 4163 | // | | RESTNotif1 | | |
| 4164 | // | |<----------------| | |
| 4165 | // | | | | |
| 4166 | // | RESTSubReq2 | | |
| 4167 | // |------------------------------>| | |
| 4168 | // | | | | |
| 4169 | // | RESTSubResp2 | | |
| 4170 | // |<------------------------------| | |
| 4171 | // | | | | |
| 4172 | // | | RESTNotif2 | | |
| 4173 | // |<------------------------------| | |
| 4174 | // | | | | |
| 4175 | // | | RESTSubDelReq1 | | |
| 4176 | // | |---------------->| | |
| 4177 | // | | | | |
| 4178 | // | | RESTSubDelResp1 | | |
| 4179 | // | |<----------------| | |
| 4180 | // | | | | |
| 4181 | // | RESTSubDelReq2 | | |
| 4182 | // |------------------------------>| | |
| 4183 | // | | | | |
| 4184 | // | RESTSubDelResp2 | | |
| 4185 | // |<------------------------------| | |
| 4186 | // | | | | |
| 4187 | // | | | SubDelReq2 | |
| 4188 | // | | |------------->| |
| 4189 | // | | | | |
| 4190 | // | | | SubDelResp2 | |
| 4191 | // | | |<-------------| |
| 4192 | // | | | | |
| 4193 | // |
| 4194 | //----------------------------------------------------------------------------- |
| 4195 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4196 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4197 | |
| 4198 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4199 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4200 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4201 | Counter{cSubReqToE2, 1}, |
| 4202 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4203 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4204 | Counter{cMergedSubscriptions, 1}, |
| 4205 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4206 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4207 | Counter{cSubDelReqToE2, 1}, |
| 4208 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4209 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4210 | }) |
| 4211 | |
| 4212 | // Req1 |
| 4213 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4214 | |
| 4215 | //Subs Create |
| 4216 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4217 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4218 | |
| 4219 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4220 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4221 | params.SetMeid("RAN_NAME_1") |
| 4222 | |
| 4223 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4224 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4225 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4226 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4227 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4228 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4229 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4230 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4231 | |
| 4232 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4233 | |
| 4234 | // Del1 |
| 4235 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4236 | |
| 4237 | // Del2 |
| 4238 | deleteXapp2Subscription(t, &restSubId2) |
| 4239 | |
| 4240 | //Wait that subs is cleaned |
| 4241 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4242 | |
| 4243 | mainCtrl.VerifyCounterValues(t) |
| 4244 | } |
| 4245 | |
| 4246 | //----------------------------------------------------------------------------- |
| 4247 | // TestSubReqAndSubDelOkSameActionParallel |
| 4248 | // |
| 4249 | // stub stub stub |
| 4250 | // +-------+ +-------+ +---------+ +---------+ |
| 4251 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4252 | // +-------+ +-------+ +---------+ +---------+ |
| 4253 | // | | | | |
| 4254 | // | | | | |
| 4255 | // | | | | |
| 4256 | // | | SubReq1 | | |
| 4257 | // | |------------->| | |
| 4258 | // | | | | |
| 4259 | // | | | SubReq1 | |
| 4260 | // | | |------------->| |
| 4261 | // | SubReq2 | | |
| 4262 | // |--------------------------->| | |
| 4263 | // | | | SubResp1 | |
| 4264 | // | | |<-------------| |
| 4265 | // | | SubResp1 | | |
| 4266 | // | |<-------------| | |
| 4267 | // | | | SubReq2 | |
| 4268 | // | | |------------->| |
| 4269 | // | | | | |
| 4270 | // | | | SubResp2 | |
| 4271 | // | | |<-------------| |
| 4272 | // | SubResp2 | | |
| 4273 | // |<---------------------------| | |
| 4274 | // | | | | |
| 4275 | // | | SubDelReq 1 | | |
| 4276 | // | |------------->| | |
| 4277 | // | | | | |
| 4278 | // | | SubDelResp 1 | | |
| 4279 | // | |<-------------| | |
| 4280 | // | | | | |
| 4281 | // | SubDelReq 2 | | |
| 4282 | // |--------------------------->| | |
| 4283 | // | | | | |
| 4284 | // | | | SubDelReq 2 | |
| 4285 | // | | |------------->| |
| 4286 | // | | | | |
| 4287 | // | | | SubDelReq 2 | |
| 4288 | // | | |------------->| |
| 4289 | // | | | | |
| 4290 | // | SubDelResp 2 | | |
| 4291 | // |<---------------------------| | |
| 4292 | // |
| 4293 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4294 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4295 | |
| 4296 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4297 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4298 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4299 | Counter{cSubReqToE2, 2}, |
| 4300 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4301 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4302 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4303 | Counter{cSubDelReqToE2, 2}, |
| 4304 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4305 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4306 | }) |
| 4307 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4308 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4309 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4310 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4311 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4312 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4313 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4314 | |
| 4315 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4316 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4317 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4318 | |
| 4319 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4320 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4321 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4322 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4323 | |
| 4324 | // Del1 |
| 4325 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4326 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4327 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4328 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4329 | |
| 4330 | // Del2 |
| 4331 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4332 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4333 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4334 | |
| 4335 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4336 | |
| 4337 | mainCtrl.VerifyCounterValues(t) |
| 4338 | } |
| 4339 | |
| 4340 | //----------------------------------------------------------------------------- |
| 4341 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4342 | // |
| 4343 | // stub stub stub |
| 4344 | // +-------+ +-------+ +---------+ +---------+ |
| 4345 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4346 | // +-------+ +-------+ +---------+ +---------+ |
| 4347 | // | | | | |
| 4348 | // | | | | |
| 4349 | // | | | | |
| 4350 | // | | RESTSubReq1 | | |
| 4351 | // | |---------------->| | |
| 4352 | // | | | | |
| 4353 | // | | RESTSubResp1 | | |
| 4354 | // | |<----------------| | |
| 4355 | // | | | SubReq1 | |
| 4356 | // | | |------------->| |
| 4357 | // | RESTSubReq2 | | |
| 4358 | // |------------------------------>| | |
| 4359 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4360 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4361 | // |<------------------------------| | |
| 4362 | // | | | SubReq1 | |
| 4363 | // | | |------------->| |
| 4364 | // | | | | |
| 4365 | // | | | | |
| 4366 | // | | | SubDelReq | |
| 4367 | // | | |------------->| |
| 4368 | // | | | | |
| 4369 | // | | | SubDelResp | |
| 4370 | // | | |<-------------| |
| 4371 | // | | RESTNotif1 | | |
| 4372 | // | | unsuccess | | |
| 4373 | // | |<----------------| | |
| 4374 | // | RESTNotif2 | | |
| 4375 | // | | unsuccess | | |
| 4376 | // |<------------------------------| | |
| 4377 | // | | | | |
| 4378 | // | | RESTSubDelReq1 | | |
| 4379 | // | |---------------->| | |
| 4380 | // | | | | |
| 4381 | // | | RESTSubDelResp1 | | |
| 4382 | // | |<----------------| | |
| 4383 | // | | | | |
| 4384 | // | RESTSubDelReq2 | | |
| 4385 | // |------------------------------>| | |
| 4386 | // | | | | |
| 4387 | // | RESTSubDelResp2 | | |
| 4388 | // |<------------------------------| | |
| 4389 | // |
| 4390 | //----------------------------------------------------------------------------- |
| 4391 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4392 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4393 | |
| 4394 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4395 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4396 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4397 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4398 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4399 | Counter{cSubReqTimerExpiry, 2}, |
| 4400 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4401 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4402 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4403 | Counter{cSubDelReqToE2, 1}, |
| 4404 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4405 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4406 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4407 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4408 | |
| 4409 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4410 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4411 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4412 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4413 | |
| 4414 | // Req2 |
| 4415 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4416 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4417 | params2.SetMeid("RAN_NAME_1") |
| 4418 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4419 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4420 | |
| 4421 | //Req1 (retransmitted) |
| 4422 | e2termConn1.RecvSubsReq(t) |
| 4423 | |
| 4424 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4425 | |
| 4426 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4428 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4429 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4430 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4431 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4432 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4433 | |
| 4434 | // Del1 |
| 4435 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4436 | |
| 4437 | // Del2 |
| 4438 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4439 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4440 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4441 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4442 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4443 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4444 | |
| 4445 | mainCtrl.VerifyCounterValues(t) |
| 4446 | } |
| 4447 | |
| 4448 | //----------------------------------------------------------------------------- |
| 4449 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4450 | // |
| 4451 | // stub stub stub |
| 4452 | // +-------+ +-------+ +---------+ +---------+ |
| 4453 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4454 | // +-------+ +-------+ +---------+ +---------+ |
| 4455 | // | | | | |
| 4456 | // | | | | |
| 4457 | // | | | | |
| 4458 | // | | RESTSubReq1 | | |
| 4459 | // | |---------------->| | |
| 4460 | // | | | | |
| 4461 | // | | RESTSubResp1 | | |
| 4462 | // | |<----------------| | |
| 4463 | // | | | SubReq1 | |
| 4464 | // | | |------------->| |
| 4465 | // | RESTSubReq2 | | |
| 4466 | // |------------------------------>| | |
| 4467 | // | | | | |
| 4468 | // | RESTSubDelResp2 | | |
| 4469 | // |<------------------------------| | |
| 4470 | // | | | SubFail1 | |
| 4471 | // | | |<-------------| |
| 4472 | // | | | | |
| 4473 | // | | RESTNotif1 | | |
| 4474 | // | | unsuccess | | |
| 4475 | // | |<----------------| | |
| 4476 | // | RESTNotif2 | | |
| 4477 | // | | unsuccess | | |
| 4478 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4479 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4480 | // | | RESTSubDelReq1 | | There is no need for xApp to send delete for failed subscriptions but some xApp might do so. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4481 | // | |---------------->| | |
| 4482 | // | | | | |
| 4483 | // | | RESTSubDelResp1 | | |
| 4484 | // | |<----------------| | |
| 4485 | // | | | | |
| 4486 | // | RESTSubDelReq2 | | |
| 4487 | // |------------------------------>| | |
| 4488 | // | | | | |
| 4489 | // | RESTSubDelResp2 | | |
| 4490 | // |<------------------------------| | |
| 4491 | // |
| 4492 | //----------------------------------------------------------------------------- |
| 4493 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4494 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4495 | |
| 4496 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4497 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4498 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4499 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4500 | Counter{cSubReqToE2, 1}, |
| 4501 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4502 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4503 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4504 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4505 | }) |
| 4506 | |
| 4507 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4508 | |
| 4509 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4510 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4511 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4512 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4513 | |
| 4514 | // Req2 |
| 4515 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4516 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4517 | params2.SetMeid("RAN_NAME_1") |
| 4518 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4519 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4520 | |
| 4521 | // E2t: send SubsFail (first) |
| 4522 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4523 | fparams1.Set(crereq1) |
| 4524 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4525 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4526 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4527 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4528 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4529 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4530 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4531 | |
| 4532 | // Del1 |
| 4533 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4534 | |
| 4535 | // Del2 |
| 4536 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4537 | |
| 4538 | //Wait that subs is cleaned |
| 4539 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4540 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4541 | |
| 4542 | mainCtrl.VerifyCounterValues(t) |
| 4543 | } |
| 4544 | |
| 4545 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4546 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4547 | |
| 4548 | // Init counter check |
| 4549 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4550 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4551 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4552 | Counter{cSubReqToE2, 1}, |
| 4553 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4554 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4555 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4556 | Counter{cSubDelReqToE2, 1}, |
| 4557 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4558 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | }) |
| 4560 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4561 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4563 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4564 | |
| 4565 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4566 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4567 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4568 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4569 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4570 | |
| 4571 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4572 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4573 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4574 | |
| 4575 | // Wait that subs is cleaned |
| 4576 | waitSubsCleanup(t, e2SubsId, 10) |
| 4577 | mainCtrl.VerifyCounterValues(t) |
| 4578 | } |
| 4579 | |
| 4580 | //----------------------------------------------------------------------------- |
| 4581 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4582 | // |
| 4583 | // stub stub |
| 4584 | // +-------+ +---------+ +---------+ |
| 4585 | // | xapp | | submgr | | e2term | |
| 4586 | // +-------+ +---------+ +---------+ |
| 4587 | // | | | |
| 4588 | // | RESTSubReq | | |
| 4589 | // |---------------->| | |
| 4590 | // | | | |
| 4591 | // | RESTSubResp | | |
| 4592 | // |<----------------| | |
| 4593 | // | | SubReq | |
| 4594 | // | |------------->| |
| 4595 | // | | | |
| 4596 | // | | SubResp | |
| 4597 | // | |<-------------| |
| 4598 | // | | | |
| 4599 | // | RESTNotif | | |
| 4600 | // |<----------------| | |
| 4601 | // | | | |
| 4602 | // | RESTSubReq | | |
| 4603 | // |---------------->| | |
| 4604 | // | | | |
| 4605 | // | RESTSubResp | | |
| 4606 | // |<----------------| | |
| 4607 | // | | SubReq | |
| 4608 | // | |------------->| |
| 4609 | // | | | |
| 4610 | // | | SubResp | |
| 4611 | // | |<-------------| |
| 4612 | // | | | |
| 4613 | // | RESTNotif | | |
| 4614 | // |<----------------| | |
| 4615 | // | | | |
| 4616 | // | RESTSubDelReq | | |
| 4617 | // |---------------->| | |
| 4618 | // | | | |
| 4619 | // | | SubDelReq | |
| 4620 | // | |------------->| |
| 4621 | // | | | |
| 4622 | // | | SubDelResp | |
| 4623 | // | |<-------------| |
| 4624 | // | | | |
| 4625 | // | RESTSubDelResp | | |
| 4626 | // |<----------------| | |
| 4627 | // |
| 4628 | //----------------------------------------------------------------------------- |
| 4629 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4630 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4631 | |
| 4632 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4633 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4634 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4635 | Counter{cSubReqToE2, 2}, |
| 4636 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4637 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4638 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4639 | Counter{cSubDelReqToE2, 1}, |
| 4640 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4641 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4642 | }) |
| 4643 | |
| 4644 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4645 | const e2Timeout int64 = 1 |
| 4646 | const e2RetryCount int64 = 0 |
| 4647 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4648 | |
| 4649 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4650 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4651 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4652 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4653 | |
| 4654 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4655 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4656 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4657 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4658 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4659 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4660 | params.SetTimeToWait("w200ms") |
| 4661 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4662 | |
| 4663 | // Del |
| 4664 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4665 | |
| 4666 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4667 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4668 | |
| 4669 | // Wait that subs is cleaned |
| 4670 | waitSubsCleanup(t, e2SubsId, 10) |
| 4671 | mainCtrl.VerifyCounterValues(t) |
| 4672 | } |
| 4673 | |
| 4674 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4675 | // TestRESTSubReqPolicyChangeNOk |
| 4676 | // |
| 4677 | // stub stub |
| 4678 | // +-------+ +---------+ +---------+ |
| 4679 | // | xapp | | submgr | | e2term | |
| 4680 | // +-------+ +---------+ +---------+ |
| 4681 | // | | | |
| 4682 | // | RESTSubReq | | |
| 4683 | // |---------------->| | |
| 4684 | // | | | |
| 4685 | // | RESTSubResp | | |
| 4686 | // |<----------------| | |
| 4687 | // | | SubReq | |
| 4688 | // | |------------->| |
| 4689 | // | | | |
| 4690 | // | | SubResp | |
| 4691 | // | |<-------------| |
| 4692 | // | | | |
| 4693 | // | RESTNotif | | |
| 4694 | // |<----------------| | |
| 4695 | // | | | |
| 4696 | // | RESTSubReq | | |
| 4697 | // |---------------->| | |
| 4698 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4699 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4700 | // | | | |
| 4701 | // | RESTSubDelReq | | |
| 4702 | // |---------------->| | |
| 4703 | // | | | |
| 4704 | // | | SubDelReq | |
| 4705 | // | |------------->| |
| 4706 | // | | | |
| 4707 | // | | SubDelResp | |
| 4708 | // | |<-------------| |
| 4709 | // | | | |
| 4710 | // | RESTSubDelResp | | |
| 4711 | // |<----------------| | |
| 4712 | // |
| 4713 | //----------------------------------------------------------------------------- |
| 4714 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4715 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4716 | |
| 4717 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4718 | Counter{cRestSubReqFromXapp, 2}, |
| 4719 | Counter{cRestSubRespToXapp, 1}, |
| 4720 | Counter{cSubReqToE2, 1}, |
| 4721 | Counter{cSubRespFromE2, 1}, |
| 4722 | Counter{cRestSubNotifToXapp, 1}, |
| 4723 | Counter{cRestSubFailToXapp, 1}, |
| 4724 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4725 | Counter{cSubDelReqToE2, 1}, |
| 4726 | Counter{cSubDelRespFromE2, 1}, |
| 4727 | Counter{cRestSubDelRespToXapp, 1}, |
| 4728 | }) |
| 4729 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4730 | // Req |
| 4731 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4732 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4733 | |
| 4734 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4735 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4736 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4737 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4738 | params.SetSubscriptionID(&restSubIdUpd) |
| 4739 | params.SetTimeToWait("w200ms") |
| 4740 | |
| 4741 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4742 | assert.Equal(t, restSubId2, "") |
| 4743 | |
| 4744 | // Del |
| 4745 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4746 | |
| 4747 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4748 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4749 | |
| 4750 | // Wait that subs is cleaned |
| 4751 | waitSubsCleanup(t, e2SubsId, 10) |
| 4752 | mainCtrl.VerifyCounterValues(t) |
| 4753 | } |
| 4754 | |
| 4755 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4756 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4757 | // |
| 4758 | // stub stub stub |
| 4759 | // +-------+ +---------+ +---------+ +---------+ |
| 4760 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4761 | // +-------+ +---------+ +---------+ +---------+ |
| 4762 | // | | | | |
| 4763 | // | | | | |
| 4764 | // | | | | |
| 4765 | // | RESTSubReq1 | | | |
| 4766 | // |---------------->| | | |
| 4767 | // | | | | |
| 4768 | // | RESTSubResp1 | | | |
| 4769 | // |<----------------| | | |
| 4770 | // | | SubReq1 | | |
| 4771 | // | |------------->| | |
| 4772 | // | | | | |
| 4773 | // | RESTSubReq2 | | | |
| 4774 | // |---------------->| | | |
| 4775 | // | | | | |
| 4776 | // | RESTSubResp2 | | | |
| 4777 | // |<----------------| | | |
| 4778 | // | | SubReq2 | | |
| 4779 | // | |---------------------------->| |
| 4780 | // | | | | |
| 4781 | // | | SubResp1 | | |
| 4782 | // | |<-------------| | |
| 4783 | // | RESTNotif1 | | | |
| 4784 | // |<----------------| | | |
| 4785 | // | | SubResp2 | | |
| 4786 | // | |<----------------------------| |
| 4787 | // | RESTNotif2 | | | |
| 4788 | // |<----------------| | | |
| 4789 | // | | | | |
| 4790 | // | [SUBS 1 DELETE] | | |
| 4791 | // | | | | |
| 4792 | // | [SUBS 2 DELETE] | | |
| 4793 | // | | | | |
| 4794 | // |
| 4795 | //----------------------------------------------------------------------------- |
| 4796 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4797 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4798 | |
| 4799 | // Init counter check |
| 4800 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4801 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4802 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4803 | Counter{cSubReqToE2, 2}, |
| 4804 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4805 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4806 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4807 | Counter{cSubDelReqToE2, 2}, |
| 4808 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4809 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4810 | }) |
| 4811 | |
| 4812 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4813 | |
| 4814 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4815 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4816 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4817 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4818 | |
| 4819 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4820 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4821 | params.SetMeid("RAN_NAME_11") |
| 4822 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4823 | // would not work as notification would not be received |
| 4824 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4825 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4826 | |
| 4827 | // Resp1 |
| 4828 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4829 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4830 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4831 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4832 | |
| 4833 | // Resp2 |
| 4834 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4835 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4836 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4837 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4838 | |
| 4839 | // Delete1 |
| 4840 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4841 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4842 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4843 | |
| 4844 | // Wait that subs is cleaned |
| 4845 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4846 | |
| 4847 | // Delete2 |
| 4848 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4849 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4850 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4851 | |
| 4852 | // Wait that subs is cleaned |
| 4853 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4854 | |
| 4855 | mainCtrl.VerifyCounterValues(t) |
| 4856 | } |
| 4857 | |
| 4858 | //----------------------------------------------------------------------------- |
| 4859 | // TestRESTSubReqAsn1EncodeFail |
| 4860 | // |
| 4861 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4862 | // stub stub |
| 4863 | // +-------+ +---------+ +---------+ |
| 4864 | // | xapp | | submgr | | e2term | |
| 4865 | // +-------+ +---------+ +---------+ |
| 4866 | // | | | |
| 4867 | // | RESTSubReq | | |
| 4868 | // |---------------->| | |
| 4869 | // | | | |
| 4870 | // | RESTSubResp | | |
| 4871 | // |<----------------| | |
| 4872 | // | RESTSubDelReq | | |
| 4873 | // |---------------->| | |
| 4874 | // | RESTSubDelResp | | |
| 4875 | // | unsuccess | | |
| 4876 | // |<----------------| | |
| 4877 | // | | | |
| 4878 | // |
| 4879 | //----------------------------------------------------------------------------- |
| 4880 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4881 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4882 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4883 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4884 | |
| 4885 | } |
| 4886 | |
| 4887 | //----------------------------------------------------------------------------- |
| 4888 | // TestRESTSubReqInsertAndSubDelOk |
| 4889 | // |
| 4890 | // stub stub |
| 4891 | // +-------+ +---------+ +---------+ |
| 4892 | // | xapp | | submgr | | e2term | |
| 4893 | // +-------+ +---------+ +---------+ |
| 4894 | // | | | |
| 4895 | // | RestSubReq | | |
| 4896 | // |---------------->| | |
| 4897 | // | | | |
| 4898 | // | RESTSubResp | | |
| 4899 | // |<----------------| | |
| 4900 | // | | | |
| 4901 | // | | SubReq | |
| 4902 | // | |------------->| |
| 4903 | // | | | |
| 4904 | // | | SubResp | |
| 4905 | // | |<-------------| |
| 4906 | // | RESTNotif | | |
| 4907 | // |<----------------| | |
| 4908 | // | ... | ... | |
| 4909 | // | | | |
| 4910 | // | RESTSubDelReq | | |
| 4911 | // |---------------->| | |
| 4912 | // | | | |
| 4913 | // | | SubDelReq | |
| 4914 | // | |------------->| |
| 4915 | // | | | |
| 4916 | // | | SubDelResp | |
| 4917 | // | |<-------------| |
| 4918 | // | | | |
| 4919 | // | RESTSubDelResp| | |
| 4920 | // |<----------------| | |
| 4921 | // |
| 4922 | //----------------------------------------------------------------------------- |
| 4923 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4924 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4925 | |
| 4926 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4927 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4928 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4929 | Counter{cSubReqToE2, 1}, |
| 4930 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4931 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4932 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4933 | Counter{cSubDelReqToE2, 1}, |
| 4934 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4935 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4936 | }) |
| 4937 | |
| 4938 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4939 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4940 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4941 | params.SetSubActionTypes("insert") |
| 4942 | |
| 4943 | // Req |
| 4944 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4945 | |
| 4946 | // Del |
| 4947 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4948 | |
| 4949 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4950 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4951 | |
| 4952 | // Wait that subs is cleaned |
| 4953 | waitSubsCleanup(t, e2SubsId, 10) |
| 4954 | mainCtrl.VerifyCounterValues(t) |
| 4955 | } |
| 4956 | |
| 4957 | //----------------------------------------------------------------------------- |
| 4958 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4959 | // |
| 4960 | // stub stub |
| 4961 | // +-------+ +---------+ +---------+ |
| 4962 | // | xapp | | submgr | | e2term | |
| 4963 | // +-------+ +---------+ +---------+ |
| 4964 | // | | | |
| 4965 | // | RESTSubReq | | |
| 4966 | // |------------->| | |
| 4967 | // | | | |
| 4968 | // | | SubReq | |
| 4969 | // | |------------->| |
| 4970 | // | | | |
| 4971 | // | | SubResp | |
| 4972 | // | <----| |
| 4973 | // | | |
| 4974 | // | Submgr restart | |
| 4975 | // | | |
| 4976 | // | | | |
| 4977 | // | | SubDelReq | |
| 4978 | // | |------------->| |
| 4979 | // | | | |
| 4980 | // | | SubDelResp | |
| 4981 | // | |<-------------| |
| 4982 | // | | | |
| 4983 | // |
| 4984 | //----------------------------------------------------------------------------- |
| 4985 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4986 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4987 | |
| 4988 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4989 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4990 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4991 | Counter{cSubReqToE2, 1}, |
| 4992 | Counter{cSubDelReqFromXapp, 1}, |
| 4993 | Counter{cSubDelReqToE2, 1}, |
| 4994 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 4995 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4996 | }) |
| 4997 | |
| 4998 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4999 | |
| 5000 | // Remove possible existing subscription |
| 5001 | mainCtrl.removeExistingSubscriptions(t) |
| 5002 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5003 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5004 | |
| 5005 | //Req |
| 5006 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5007 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5008 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5009 | |
| 5010 | e2termConn1.RecvSubsReq(t) |
| 5011 | |
| 5012 | mainCtrl.SetResetTestFlag(t, false) |
| 5013 | |
| 5014 | mainCtrl.SimulateRestart(t) |
| 5015 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5016 | |
| 5017 | //Del |
| 5018 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5019 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5020 | |
| 5021 | xappConn1.TestMsgChanEmpty(t) |
| 5022 | xappConn2.TestMsgChanEmpty(t) |
| 5023 | e2termConn1.TestMsgChanEmpty(t) |
| 5024 | mainCtrl.wait_registry_empty(t, 10) |
| 5025 | |
| 5026 | mainCtrl.VerifyCounterValues(t) |
| 5027 | } |
| 5028 | |
| 5029 | //----------------------------------------------------------------------------- |
| 5030 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5031 | // |
| 5032 | // stub stub |
| 5033 | // +-------+ +---------+ +---------+ |
| 5034 | // | xapp | | submgr | | e2term | |
| 5035 | // +-------+ +---------+ +---------+ |
| 5036 | // | | | |
| 5037 | // | RESTSubReq | | |
| 5038 | // |---------------->| | |
| 5039 | // | | | |
| 5040 | // | RESTSubResp | | |
| 5041 | // |<----------------| | |
| 5042 | // | | SubReq | |
| 5043 | // | |------------->| |
| 5044 | // | | | |
| 5045 | // | | SubResp | |
| 5046 | // | |<-------------| |
| 5047 | // | | | |
| 5048 | // | RESTNotif | | |
| 5049 | // |<----------------| | |
| 5050 | // | | | |
| 5051 | // | | |
| 5052 | // | Submgr restart | |
| 5053 | // | | | |
| 5054 | // | RESTSubDelReq | | |
| 5055 | // |---------------->| | |
| 5056 | // | | | |
| 5057 | // | | SubDelReq | |
| 5058 | // | |------------->| |
| 5059 | // | | | |
| 5060 | // | | SubDelResp | |
| 5061 | // | |<-------------| |
| 5062 | // | | | |
| 5063 | // | RESTSubDelResp | | |
| 5064 | // |<----------------| | |
| 5065 | // |
| 5066 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5067 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5068 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5069 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5070 | |
| 5071 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5072 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5073 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5074 | Counter{cSubReqToE2, 1}, |
| 5075 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5076 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5077 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5078 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 5079 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5080 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5081 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5082 | // Remove possible existing subscription |
| 5083 | mainCtrl.removeExistingSubscriptions(t) |
| 5084 | |
| 5085 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5086 | |
| 5087 | // Create subscription |
| 5088 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5089 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5090 | |
| 5091 | // Check subscription |
| 5092 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5093 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5094 | mainCtrl.SimulateRestart(t) |
| 5095 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5096 | |
| 5097 | // Check subscription |
| 5098 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5099 | |
| 5100 | // Delete subscription |
| 5101 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5102 | |
| 5103 | //Wait that subs is cleaned |
| 5104 | waitSubsCleanup(t, e2SubsId, 10) |
| 5105 | |
| 5106 | mainCtrl.VerifyCounterValues(t) |
| 5107 | } |
| 5108 | |
| 5109 | //----------------------------------------------------------------------------- |
| 5110 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5111 | // |
| 5112 | // stub stub |
| 5113 | // +-------+ +-------+ +---------+ +---------+ |
| 5114 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5115 | // +-------+ +-------+ +---------+ +---------+ |
| 5116 | // | | | | |
| 5117 | // | | RESTSubReq1 | | |
| 5118 | // | |---------------->| | |
| 5119 | // | | | | |
| 5120 | // | | RESTSubResp1 | | |
| 5121 | // | |<----------------| | |
| 5122 | // | | | | |
| 5123 | // | | | SubReq1 | |
| 5124 | // | | |------------->| |
| 5125 | // | | | SubResp1 | |
| 5126 | // | | |<-------------| |
| 5127 | // | | RESTNotif1 | | |
| 5128 | // | |<----------------| | |
| 5129 | // | | | | |
| 5130 | // | RESTSubReq2 | | |
| 5131 | // |------------------------------>| | |
| 5132 | // | | | | |
| 5133 | // | RESTSubResp2 | | |
| 5134 | // |<------------------------------| | |
| 5135 | // | | | | |
| 5136 | // | | RESTNotif2 | | |
| 5137 | // |<------------------------------| | |
| 5138 | // | | | | |
| 5139 | // | | Submgr restart | |
| 5140 | // | | | | |
| 5141 | // | | RESTSubDelReq1 | | |
| 5142 | // | |---------------->| | |
| 5143 | // | | | | |
| 5144 | // | | RESTSubDelResp1 | | |
| 5145 | // | |<----------------| | |
| 5146 | // | | | | |
| 5147 | // | | Submgr restart | |
| 5148 | // | | | | |
| 5149 | // | RESTSubDelReq2 | | |
| 5150 | // |------------------------------>| | |
| 5151 | // | | | | |
| 5152 | // | RESTSubDelResp2 | | |
| 5153 | // |<------------------------------| | |
| 5154 | // | | | | |
| 5155 | // | | | SubDelReq2 | |
| 5156 | // | | |------------->| |
| 5157 | // | | | | |
| 5158 | // | | | SubDelResp2 | |
| 5159 | // | | |<-------------| |
| 5160 | // | | | | |
| 5161 | // |
| 5162 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5163 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5164 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5165 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5166 | |
| 5167 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5168 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5169 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5170 | Counter{cSubReqToE2, 1}, |
| 5171 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5172 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5173 | Counter{cMergedSubscriptions, 1}, |
| 5174 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5175 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5176 | Counter{cSubDelReqToE2, 1}, |
| 5177 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5178 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5179 | }) |
| 5180 | |
| 5181 | // Remove possible existing subscription |
| 5182 | mainCtrl.removeExistingSubscriptions(t) |
| 5183 | |
| 5184 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5185 | |
| 5186 | // Create subscription 1 |
| 5187 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5188 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5189 | |
| 5190 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5191 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5192 | params.SetMeid("RAN_NAME_1") |
| 5193 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5194 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5195 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5196 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5197 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5198 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5199 | |
| 5200 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5201 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5202 | mainCtrl.SimulateRestart(t) |
| 5203 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5204 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5205 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 5206 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5207 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5208 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5209 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5210 | mainCtrl.SimulateRestart(t) |
| 5211 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5212 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5213 | |
| 5214 | // Delete subscription 2 |
| 5215 | deleteXapp2Subscription(t, &restSubId2) |
| 5216 | |
| 5217 | //Wait that subs is cleaned |
| 5218 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5219 | |
| 5220 | mainCtrl.VerifyCounterValues(t) |
| 5221 | } |
| 5222 | |
| 5223 | //----------------------------------------------------------------------------- |
| 5224 | // TestRESTReportSubReqAndSubDelOk |
| 5225 | // |
| 5226 | // stub stub |
| 5227 | // +-------+ +---------+ +---------+ |
| 5228 | // | xapp | | submgr | | e2term | |
| 5229 | // +-------+ +---------+ +---------+ |
| 5230 | // | | | |
| 5231 | // | RestSubReq | | |
| 5232 | // |---------------->| | |
| 5233 | // | | | |
| 5234 | // | RESTSubResp | | |
| 5235 | // |<----------------| | |
| 5236 | // | | | |
| 5237 | // | | SubReq | |
| 5238 | // | |------------->| |
| 5239 | // | | | |
| 5240 | // | | SubResp | |
| 5241 | // | |<-------------| |
| 5242 | // | RESTNotif | | |
| 5243 | // |<----------------| | |
| 5244 | // | | SubReq | |
| 5245 | // | |------------->| |
| 5246 | // | | | |
| 5247 | // | | SubResp | |
| 5248 | // | |<-------------| |
| 5249 | // | RESTNotif | | |
| 5250 | // |<----------------| | |
| 5251 | // | ... | ... | |
| 5252 | // | | | |
| 5253 | // | | | |
| 5254 | // | RESTSubDelReq | | |
| 5255 | // |---------------->| | |
| 5256 | // | | | |
| 5257 | // | | SubDelReq | |
| 5258 | // | |------------->| |
| 5259 | // | | | |
| 5260 | // | | SubDelResp | |
| 5261 | // | |<-------------| |
| 5262 | // | | | |
| 5263 | // | RESTSubDelResp| | |
| 5264 | // |<----------------| | |
| 5265 | // |
| 5266 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5267 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5268 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5269 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5270 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5271 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5272 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5273 | } |
| 5274 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5275 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5276 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5277 | |
| 5278 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5279 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5280 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5281 | |
| 5282 | var e2SubsId []uint32 |
| 5283 | for i := 0; i < subReqCount; i++ { |
| 5284 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5285 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5286 | |
| 5287 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5288 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5289 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5290 | e2SubsId = append(e2SubsId, instanceId) |
| 5291 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5292 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5293 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5294 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5295 | |
| 5296 | } |
| 5297 | |
| 5298 | // Del |
| 5299 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5300 | |
| 5301 | for i := 0; i < subReqCount; i++ { |
| 5302 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5303 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5304 | } |
| 5305 | |
| 5306 | // Wait that subs is cleaned |
| 5307 | for i := 0; i < subReqCount; i++ { |
| 5308 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5309 | } |
| 5310 | |
| 5311 | xappConn1.TestMsgChanEmpty(t) |
| 5312 | e2termConn1.TestMsgChanEmpty(t) |
| 5313 | mainCtrl.wait_registry_empty(t, 10) |
| 5314 | } |
| 5315 | |
| 5316 | /* |
| 5317 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 5318 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5319 | |
| 5320 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5321 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5322 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5323 | |
| 5324 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5325 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5326 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5327 | } |
| 5328 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5329 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5330 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5331 | |
| 5332 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5333 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5334 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5335 | |
| 5336 | var e2SubsId []uint32 |
| 5337 | for i := 0; i < subReqCount; i++ { |
| 5338 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5339 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5340 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5341 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5342 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5343 | e2SubsId = append(e2SubsId, instanceId) |
| 5344 | } |
| 5345 | |
| 5346 | // Del |
| 5347 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5348 | |
| 5349 | for i := 0; i < subReqCount; i++ { |
| 5350 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5351 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5352 | } |
| 5353 | |
| 5354 | // Wait that subs is cleaned |
| 5355 | for i := 0; i < subReqCount; i++ { |
| 5356 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5357 | } |
| 5358 | xappConn1.TestMsgChanEmpty(t) |
| 5359 | e2termConn1.TestMsgChanEmpty(t) |
| 5360 | mainCtrl.wait_registry_empty(t, 10) |
| 5361 | } |
| 5362 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5363 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5364 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5365 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5366 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5367 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5368 | Counter{cSubReqToE2, 2}, |
| 5369 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5370 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5371 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5372 | Counter{cSubDelReqToE2, 2}, |
| 5373 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5374 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5375 | }) |
| 5376 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5377 | const subReqCount int = 2 |
| 5378 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5379 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5380 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5381 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5382 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5383 | |
| 5384 | assert.Equal(t, len(e2SubsIds), 2) |
| 5385 | |
| 5386 | // Del |
| 5387 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5388 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5389 | |
| 5390 | xappConn1.TestMsgChanEmpty(t) |
| 5391 | e2termConn1.TestMsgChanEmpty(t) |
| 5392 | mainCtrl.wait_registry_empty(t, 10) |
| 5393 | |
| 5394 | mainCtrl.VerifyCounterValues(t) |
| 5395 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5396 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5397 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5398 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5399 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5400 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5401 | Counter{cSubReqToE2, 19}, |
| 5402 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5403 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5404 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5405 | Counter{cSubDelReqToE2, 19}, |
| 5406 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5407 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5408 | }) |
| 5409 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5410 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5411 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5412 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5413 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5414 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5415 | |
| 5416 | assert.Equal(t, len(e2SubsIds), 19) |
| 5417 | |
| 5418 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5419 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5420 | |
| 5421 | xappConn1.TestMsgChanEmpty(t) |
| 5422 | e2termConn1.TestMsgChanEmpty(t) |
| 5423 | mainCtrl.wait_registry_empty(t, 10) |
| 5424 | |
| 5425 | mainCtrl.VerifyCounterValues(t) |
| 5426 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5427 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5428 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5429 | |
| 5430 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5431 | |
| 5432 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5433 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5434 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5435 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5436 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5437 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5438 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5439 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5440 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5441 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5442 | }) |
| 5443 | |
| 5444 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5445 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5446 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5447 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5448 | |
| 5449 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5450 | |
| 5451 | // Del |
| 5452 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5453 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5454 | |
| 5455 | xappConn1.TestMsgChanEmpty(t) |
| 5456 | e2termConn1.TestMsgChanEmpty(t) |
| 5457 | mainCtrl.wait_registry_empty(t, 10) |
| 5458 | |
| 5459 | mainCtrl.VerifyCounterValues(t) |
| 5460 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5461 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5462 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5463 | |
| 5464 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5465 | |
| 5466 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5467 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5468 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5469 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5470 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5471 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5472 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5473 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5474 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5475 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5476 | }) |
| 5477 | |
| 5478 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5479 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5480 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5481 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5482 | |
| 5483 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5484 | |
| 5485 | // Del |
| 5486 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5487 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5488 | |
| 5489 | xappConn1.TestMsgChanEmpty(t) |
| 5490 | e2termConn1.TestMsgChanEmpty(t) |
| 5491 | mainCtrl.wait_registry_empty(t, 10) |
| 5492 | |
| 5493 | mainCtrl.VerifyCounterValues(t) |
| 5494 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5495 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5496 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5497 | |
| 5498 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5499 | |
| 5500 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5501 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5502 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5503 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5504 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5505 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5506 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5507 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5508 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5509 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5510 | }) |
| 5511 | |
| 5512 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5513 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5514 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5515 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5516 | |
| 5517 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5518 | |
| 5519 | // Del |
| 5520 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5521 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5522 | |
| 5523 | xappConn1.TestMsgChanEmpty(t) |
| 5524 | e2termConn1.TestMsgChanEmpty(t) |
| 5525 | mainCtrl.wait_registry_empty(t, 10) |
| 5526 | |
| 5527 | mainCtrl.VerifyCounterValues(t) |
| 5528 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5529 | |
| 5530 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5531 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5532 | |
| 5533 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5534 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5535 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5536 | Counter{cSubReqToE2, 2}, |
| 5537 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5538 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5539 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5540 | Counter{cSubDelReqToE2, 2}, |
| 5541 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5542 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5543 | }) |
| 5544 | |
| 5545 | // Req1 |
| 5546 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5547 | |
| 5548 | //Subs Create |
| 5549 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5550 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5551 | |
| 5552 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5553 | |
| 5554 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5555 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5556 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5557 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5558 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5559 | |
| 5560 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5561 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5562 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5563 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5564 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5565 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5566 | |
| 5567 | deleteXapp1Subscription(t, &restSubId1) |
| 5568 | deleteXapp2Subscription(t, &restSubId2) |
| 5569 | |
| 5570 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5571 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5572 | |
| 5573 | mainCtrl.VerifyCounterValues(t) |
| 5574 | |
| 5575 | } |
| 5576 | |
| 5577 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5578 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5579 | |
| 5580 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5581 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5582 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5583 | Counter{cSubReqToE2, 2}, |
| 5584 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5585 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5586 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5587 | Counter{cSubDelReqToE2, 2}, |
| 5588 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5589 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5590 | }) |
| 5591 | |
| 5592 | // Req1 |
| 5593 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5594 | |
| 5595 | //Subs Create |
| 5596 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5597 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5598 | |
| 5599 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5600 | |
| 5601 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5602 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5603 | params.SetMeid("RAN_NAME_1") |
| 5604 | |
| 5605 | actionId := int64(1) |
| 5606 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5607 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5608 | subsequestActionType := "continue" |
| 5609 | timeToWait := "w10ms" |
| 5610 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5611 | |
| 5612 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5613 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5614 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5615 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5616 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5617 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5618 | |
| 5619 | deleteXapp1Subscription(t, &restSubId1) |
| 5620 | deleteXapp2Subscription(t, &restSubId2) |
| 5621 | |
| 5622 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5623 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5624 | |
| 5625 | mainCtrl.VerifyCounterValues(t) |
| 5626 | |
| 5627 | } |
| 5628 | |
| 5629 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5630 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5631 | |
| 5632 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5633 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5634 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5635 | Counter{cSubReqToE2, 2}, |
| 5636 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5637 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5638 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5639 | Counter{cSubDelReqToE2, 2}, |
| 5640 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5641 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5642 | }) |
| 5643 | |
| 5644 | // Req1 |
| 5645 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5646 | |
| 5647 | //Subs Create |
| 5648 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5649 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5650 | |
| 5651 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5652 | |
| 5653 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5654 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5655 | params.SetMeid("RAN_NAME_1") |
| 5656 | params.SetSubActionIDs(int64(2)) |
| 5657 | |
| 5658 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5659 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5660 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5661 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5662 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5663 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5664 | |
| 5665 | deleteXapp1Subscription(t, &restSubId1) |
| 5666 | deleteXapp2Subscription(t, &restSubId2) |
| 5667 | |
| 5668 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5669 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5670 | |
| 5671 | mainCtrl.VerifyCounterValues(t) |
| 5672 | |
| 5673 | } |
| 5674 | |
| 5675 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5676 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5677 | |
| 5678 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5679 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5680 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5681 | Counter{cSubReqToE2, 2}, |
| 5682 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5683 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5684 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5685 | Counter{cSubDelReqToE2, 2}, |
| 5686 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5687 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5688 | }) |
| 5689 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5690 | const e2Timeout int64 = 2 |
| 5691 | const e2RetryCount int64 = 2 |
| 5692 | const routingNeeded bool = true |
| 5693 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5694 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5695 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5696 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5697 | |
| 5698 | //Subs Create |
| 5699 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5700 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5701 | |
| 5702 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5703 | |
| 5704 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5705 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5706 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5707 | params.SetMeid("RAN_NAME_1") |
| 5708 | |
| 5709 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5710 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5711 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5712 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5713 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5714 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5715 | |
| 5716 | deleteXapp1Subscription(t, &restSubId1) |
| 5717 | deleteXapp2Subscription(t, &restSubId2) |
| 5718 | |
| 5719 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5720 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5721 | |
| 5722 | mainCtrl.VerifyCounterValues(t) |
| 5723 | |
| 5724 | } |
| 5725 | |
| 5726 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5727 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5728 | |
| 5729 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5730 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5731 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5732 | Counter{cSubReqToE2, 2}, |
| 5733 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5734 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5735 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5736 | Counter{cSubDelReqToE2, 2}, |
| 5737 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5738 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5739 | }) |
| 5740 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5741 | const e2Timeout int64 = 2 |
| 5742 | const e2RetryCount int64 = 2 |
| 5743 | const routingNeeded bool = true |
| 5744 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5745 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5746 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5747 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5748 | |
| 5749 | //Subs Create |
| 5750 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5751 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5752 | |
| 5753 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5754 | |
| 5755 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5756 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5757 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5758 | params.SetMeid("RAN_NAME_1") |
| 5759 | |
| 5760 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5761 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5762 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5763 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5764 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5765 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5766 | |
| 5767 | deleteXapp1Subscription(t, &restSubId1) |
| 5768 | deleteXapp2Subscription(t, &restSubId2) |
| 5769 | |
| 5770 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5771 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5772 | |
| 5773 | mainCtrl.VerifyCounterValues(t) |
| 5774 | |
| 5775 | } |
| 5776 | |
| 5777 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5778 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5779 | |
| 5780 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5781 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5782 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5783 | Counter{cSubReqToE2, 2}, |
| 5784 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5785 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5786 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5787 | Counter{cSubDelReqToE2, 2}, |
| 5788 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5789 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5790 | }) |
| 5791 | |
| 5792 | // Req1 |
| 5793 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5794 | |
| 5795 | //Subs Create |
| 5796 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5797 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5798 | |
| 5799 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5800 | |
| 5801 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5802 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5803 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5804 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5805 | params.SetSubActionDefinition(actionDefinition) |
| 5806 | |
| 5807 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5808 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5809 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5810 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5811 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5812 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5813 | |
| 5814 | deleteXapp1Subscription(t, &restSubId1) |
| 5815 | deleteXapp2Subscription(t, &restSubId2) |
| 5816 | |
| 5817 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5818 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5819 | |
| 5820 | mainCtrl.VerifyCounterValues(t) |
| 5821 | |
| 5822 | } |
| 5823 | |
| 5824 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5825 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5826 | |
| 5827 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5828 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5829 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5830 | Counter{cSubReqToE2, 2}, |
| 5831 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5832 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5833 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5834 | Counter{cSubDelReqToE2, 2}, |
| 5835 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5836 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5837 | }) |
| 5838 | |
| 5839 | // Req1 |
| 5840 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5841 | |
| 5842 | //Subs Create |
| 5843 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5844 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5845 | |
| 5846 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5847 | |
| 5848 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5849 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5850 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5851 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5852 | params.SetSubActionDefinition(actionDefinition) |
| 5853 | |
| 5854 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5855 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5856 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5857 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5858 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5859 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5860 | |
| 5861 | deleteXapp1Subscription(t, &restSubId1) |
| 5862 | deleteXapp2Subscription(t, &restSubId2) |
| 5863 | |
| 5864 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5865 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5866 | |
| 5867 | mainCtrl.VerifyCounterValues(t) |
| 5868 | |
| 5869 | } |
| 5870 | |
| 5871 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5872 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5873 | |
| 5874 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5875 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5876 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5877 | Counter{cSubReqToE2, 2}, |
| 5878 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5879 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5880 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5881 | Counter{cSubDelReqToE2, 2}, |
| 5882 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5883 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5884 | }) |
| 5885 | |
| 5886 | // Req1 |
| 5887 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5888 | |
| 5889 | //Subs Create |
| 5890 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5891 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5892 | |
| 5893 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5894 | |
| 5895 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5896 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5897 | params.SetMeid("RAN_NAME_1") |
| 5898 | params.SetTimeToWait("w200ms") |
| 5899 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5900 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5901 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5902 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5903 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5904 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5905 | |
| 5906 | deleteXapp1Subscription(t, &restSubId1) |
| 5907 | deleteXapp2Subscription(t, &restSubId2) |
| 5908 | |
| 5909 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5910 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5911 | |
| 5912 | mainCtrl.VerifyCounterValues(t) |
| 5913 | |
| 5914 | } |
| 5915 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5916 | //----------------------------------------------------------------------------- |
| 5917 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5918 | // |
| 5919 | // stub stub |
| 5920 | // +-------+ +---------+ +---------+ |
| 5921 | // | xapp | | submgr | | e2term | |
| 5922 | // +-------+ +---------+ +---------+ |
| 5923 | // | | | |
| 5924 | // | RestSubReq | | |
| 5925 | // |---------------->| | |
| 5926 | // | | | |
| 5927 | // | RESTSubResp | | |
| 5928 | // |<----------------| | |
| 5929 | // | | | |
| 5930 | // | | SubReq | |
| 5931 | // | |------------->| |
| 5932 | // | | | |
| 5933 | // | | SubResp | ASN.1 decode fails |
| 5934 | // | |<-------------| |
| 5935 | // | | | |
| 5936 | // | | SubReq | |
| 5937 | // | |------------->| |
| 5938 | // | | | |
| 5939 | // | | SubFail | Duplicated action |
| 5940 | // | |<-------------| |
| 5941 | // | RESTNotif (fail)| | |
| 5942 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5943 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5944 | // |
| 5945 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5946 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5947 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5948 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5949 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5950 | |
| 5951 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5952 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5953 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5954 | |
| 5955 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5956 | // Decode of this response fails which will result resending original request |
| 5957 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5958 | |
| 5959 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5960 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5961 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5962 | |
| 5963 | // Subscription already created in E2 Node. |
| 5964 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5965 | fparams.Set(crereq) |
| 5966 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5967 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5968 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5969 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5970 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5971 | |
| 5972 | // Wait that subs is cleaned |
| 5973 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5974 | |
| 5975 | xappConn1.TestMsgChanEmpty(t) |
| 5976 | e2termConn1.TestMsgChanEmpty(t) |
| 5977 | mainCtrl.wait_registry_empty(t, 10) |
| 5978 | } |
| 5979 | |
| 5980 | //----------------------------------------------------------------------------- |
| 5981 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5982 | // |
| 5983 | // stub stub |
| 5984 | // +-------+ +---------+ +---------+ |
| 5985 | // | xapp | | submgr | | e2term | |
| 5986 | // +-------+ +---------+ +---------+ |
| 5987 | // | | | |
| 5988 | // | RestSubReq | | |
| 5989 | // |---------------->| | |
| 5990 | // | | | |
| 5991 | // | RESTSubResp | | |
| 5992 | // |<----------------| | |
| 5993 | // | | | |
| 5994 | // | | SubReq | |
| 5995 | // | |------------->| |
| 5996 | // | | | |
| 5997 | // | | SubResp | Unknown instanceId |
| 5998 | // | |<-------------| |
| 5999 | // | | | |
| 6000 | // | | SubReq | |
| 6001 | // | |------------->| |
| 6002 | // | | | |
| 6003 | // | | SubFail | Duplicated action |
| 6004 | // | |<-------------| |
| 6005 | // | RESTNotif (fail)| | |
| 6006 | // |<----------------| | |
| 6007 | // | | SubDelReq | |
| 6008 | // | |------------->| |
| 6009 | // | | | |
| 6010 | // | | SubDelResp | |
| 6011 | // | |<-------------| |
| 6012 | // |
| 6013 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6014 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6015 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6016 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 6017 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6018 | |
| 6019 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6020 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6021 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6022 | |
| 6023 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6024 | |
| 6025 | // Unknown instanceId in this response which will result resending original request |
| 6026 | orgInstanceId := crereq.RequestId.InstanceId |
| 6027 | crereq.RequestId.InstanceId = 0 |
| 6028 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6029 | |
| 6030 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6031 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6032 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6033 | |
| 6034 | // Subscription already created in E2 Node. |
| 6035 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6036 | fparams.Set(crereq) |
| 6037 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6038 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6039 | |
| 6040 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6041 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6042 | |
| 6043 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6044 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6045 | |
| 6046 | // Wait that subs is cleaned |
| 6047 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6048 | |
| 6049 | xappConn1.TestMsgChanEmpty(t) |
| 6050 | e2termConn1.TestMsgChanEmpty(t) |
| 6051 | mainCtrl.wait_registry_empty(t, 10) |
| 6052 | } |
| 6053 | |
| 6054 | //----------------------------------------------------------------------------- |
| 6055 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6056 | // |
| 6057 | // stub stub |
| 6058 | // +-------+ +---------+ +---------+ |
| 6059 | // | xapp | | submgr | | e2term | |
| 6060 | // +-------+ +---------+ +---------+ |
| 6061 | // | | | |
| 6062 | // | RestSubReq | | |
| 6063 | // |---------------->| | |
| 6064 | // | | | |
| 6065 | // | RESTSubResp | | |
| 6066 | // |<----------------| | |
| 6067 | // | | | |
| 6068 | // | | SubReq | |
| 6069 | // | |------------->| |
| 6070 | // | | | |
| 6071 | // | | SubResp | No transaction for the response |
| 6072 | // | |<-------------| |
| 6073 | // | | | |
| 6074 | // | | SubReq | |
| 6075 | // | |------------->| |
| 6076 | // | | | |
| 6077 | // | | SubFail | Duplicated action |
| 6078 | // | |<-------------| |
| 6079 | // | RESTNotif (fail)| | |
| 6080 | // |<----------------| | |
| 6081 | // | | SubDelReq | |
| 6082 | // | |------------->| |
| 6083 | // | | | |
| 6084 | // | | SubDelResp | |
| 6085 | // | |<-------------| |
| 6086 | // | | | |
| 6087 | // | | SubDelReq | |
| 6088 | // | |------------->| |
| 6089 | // | | | |
| 6090 | // | | SubDelResp | |
| 6091 | // | |<-------------| |
| 6092 | // |
| 6093 | //----------------------------------------------------------------------------- |
| 6094 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6095 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6096 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6097 | |
| 6098 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6099 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6100 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6101 | |
| 6102 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6103 | |
| 6104 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6105 | // No transaction exist for this response which will result resending original request |
| 6106 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6107 | |
| 6108 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6109 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6110 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6111 | |
| 6112 | // Subscription already created in E2 Node. |
| 6113 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6114 | fparams.Set(crereq) |
| 6115 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6116 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6117 | |
| 6118 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6119 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6120 | |
| 6121 | // Resending happens because there no transaction |
| 6122 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6123 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6124 | |
| 6125 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6126 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6127 | |
| 6128 | // Wait that subs is cleaned |
| 6129 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6130 | |
| 6131 | xappConn1.TestMsgChanEmpty(t) |
| 6132 | e2termConn1.TestMsgChanEmpty(t) |
| 6133 | mainCtrl.wait_registry_empty(t, 10) |
| 6134 | |
| 6135 | } |
| 6136 | |
| 6137 | //----------------------------------------------------------------------------- |
| 6138 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6139 | // |
| 6140 | // stub stub |
| 6141 | // +-------+ +---------+ +---------+ |
| 6142 | // | xapp | | submgr | | e2term | |
| 6143 | // +-------+ +---------+ +---------+ |
| 6144 | // | | | |
| 6145 | // | RestSubReq | | |
| 6146 | // |---------------->| | |
| 6147 | // | | | |
| 6148 | // | RESTSubResp | | |
| 6149 | // |<----------------| | |
| 6150 | // | | | |
| 6151 | // | | SubReq | |
| 6152 | // | |------------->| |
| 6153 | // | | | |
| 6154 | // | | SubFail | ASN.1 decode fails |
| 6155 | // | |<-------------| |
| 6156 | // | | | |
| 6157 | // | | SubReq | |
| 6158 | // | |------------->| |
| 6159 | // | | | |
| 6160 | // | | SubFail | Duplicated action |
| 6161 | // | |<-------------| |
| 6162 | // | RESTNotif (fail)| | |
| 6163 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6164 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6165 | // |
| 6166 | //----------------------------------------------------------------------------- |
| 6167 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6168 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6169 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6170 | |
| 6171 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6172 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6173 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6174 | |
| 6175 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6176 | |
| 6177 | // Decode of this response fails which will result resending original request |
| 6178 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6179 | |
| 6180 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6181 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6182 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6183 | |
| 6184 | // Subscription already created in E2 Node. |
| 6185 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6186 | fparams.Set(crereq) |
| 6187 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6188 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6189 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6190 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6191 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6192 | |
| 6193 | // Wait that subs is cleaned |
| 6194 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6195 | |
| 6196 | xappConn1.TestMsgChanEmpty(t) |
| 6197 | e2termConn1.TestMsgChanEmpty(t) |
| 6198 | mainCtrl.wait_registry_empty(t, 10) |
| 6199 | } |
| 6200 | |
| 6201 | //----------------------------------------------------------------------------- |
| 6202 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6203 | // |
| 6204 | // stub stub |
| 6205 | // +-------+ +---------+ +---------+ |
| 6206 | // | xapp | | submgr | | e2term | |
| 6207 | // +-------+ +---------+ +---------+ |
| 6208 | // | | | |
| 6209 | // | RestSubReq | | |
| 6210 | // |---------------->| | |
| 6211 | // | | | |
| 6212 | // | RESTSubResp | | |
| 6213 | // |<----------------| | |
| 6214 | // | | | |
| 6215 | // | | SubReq | |
| 6216 | // | |------------->| |
| 6217 | // | | | |
| 6218 | // | | SubFail | Unknown instanceId |
| 6219 | // | |<-------------| |
| 6220 | // | | | |
| 6221 | // | | SubReq | |
| 6222 | // | |------------->| |
| 6223 | // | | | |
| 6224 | // | | SubFail | Duplicated action |
| 6225 | // | |<-------------| |
| 6226 | // | RESTNotif (fail)| | |
| 6227 | // |<----------------| | |
| 6228 | // | | SubDelReq | |
| 6229 | // | |------------->| |
| 6230 | // | | | |
| 6231 | // | | SubDelResp | |
| 6232 | // | |<-------------| |
| 6233 | // |
| 6234 | //----------------------------------------------------------------------------- |
| 6235 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6236 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6237 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6238 | |
| 6239 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6240 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6241 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6242 | |
| 6243 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6244 | |
| 6245 | // Unknown instanceId in this response which will result resending original request |
| 6246 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6247 | fparams.Set(crereq) |
| 6248 | fparams.Fail.RequestId.InstanceId = 0 |
| 6249 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6250 | |
| 6251 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6252 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6253 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6254 | |
| 6255 | // Subscription already created in E2 Node. |
| 6256 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6257 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6258 | |
| 6259 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6260 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6261 | |
| 6262 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6263 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6264 | |
| 6265 | // Wait that subs is cleaned |
| 6266 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6267 | |
| 6268 | xappConn1.TestMsgChanEmpty(t) |
| 6269 | e2termConn1.TestMsgChanEmpty(t) |
| 6270 | mainCtrl.wait_registry_empty(t, 10) |
| 6271 | } |
| 6272 | |
| 6273 | //----------------------------------------------------------------------------- |
| 6274 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6275 | // |
| 6276 | // stub stub |
| 6277 | // +-------+ +---------+ +---------+ |
| 6278 | // | xapp | | submgr | | e2term | |
| 6279 | // +-------+ +---------+ +---------+ |
| 6280 | // | | | |
| 6281 | // | RestSubReq | | |
| 6282 | // |---------------->| | |
| 6283 | // | | | |
| 6284 | // | RESTSubResp | | |
| 6285 | // |<----------------| | |
| 6286 | // | | | |
| 6287 | // | | SubReq | |
| 6288 | // | |------------->| |
| 6289 | // | | | |
| 6290 | // | | SubFail | No transaction for the response |
| 6291 | // | |<-------------| |
| 6292 | // | | | |
| 6293 | // | | SubReq | |
| 6294 | // | |------------->| |
| 6295 | // | | | |
| 6296 | // | | SubFail | Duplicated action |
| 6297 | // | |<-------------| |
| 6298 | // | RESTNotif (fail)| | |
| 6299 | // |<----------------| | |
| 6300 | // | | SubDelReq | |
| 6301 | // | |------------->| |
| 6302 | // | | | |
| 6303 | // | | SubDelResp | |
| 6304 | // | |<-------------| |
| 6305 | // |
| 6306 | //----------------------------------------------------------------------------- |
| 6307 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6308 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6309 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6310 | |
| 6311 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6312 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6313 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6314 | |
| 6315 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6316 | |
| 6317 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6318 | |
| 6319 | // No transaction exist for this response which will result resending original request |
| 6320 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6321 | fparams.Set(crereq) |
| 6322 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6323 | |
| 6324 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6325 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6326 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6327 | |
| 6328 | // Subscription already created in E2 Node. |
| 6329 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6330 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6331 | |
| 6332 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6333 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6334 | |
| 6335 | // Resending happens because there no transaction |
| 6336 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6337 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6338 | |
| 6339 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6340 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6341 | |
| 6342 | // Wait that subs is cleaned |
| 6343 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6344 | |
| 6345 | xappConn1.TestMsgChanEmpty(t) |
| 6346 | e2termConn1.TestMsgChanEmpty(t) |
| 6347 | mainCtrl.wait_registry_empty(t, 10) |
| 6348 | } |
| 6349 | |
| 6350 | //----------------------------------------------------------------------------- |
| 6351 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6352 | // |
| 6353 | // stub stub |
| 6354 | // +-------+ +---------+ +---------+ |
| 6355 | // | xapp | | submgr | | e2term | |
| 6356 | // +-------+ +---------+ +---------+ |
| 6357 | // | | | |
| 6358 | // | [SUBS CREATE] | |
| 6359 | // | | | |
| 6360 | // | | | |
| 6361 | // | RESTSubDelReq | | |
| 6362 | // |---------------->| | |
| 6363 | // | | | |
| 6364 | // | RESTSubDelResp | | |
| 6365 | // |<----------------| | |
| 6366 | // | | | |
| 6367 | // | | SubDelReq | |
| 6368 | // | |------------->| |
| 6369 | // | | | |
| 6370 | // | | SubDelResp | ASN.1 decode fails |
| 6371 | // | |<-------------| |
| 6372 | // | | | |
| 6373 | // | | SubDelReq | |
| 6374 | // | |------------->| |
| 6375 | // | | | |
| 6376 | // | | SubDelFail | Subscription does exist any more |
| 6377 | // | |<-------------| |
| 6378 | // | | | |
| 6379 | // |
| 6380 | //----------------------------------------------------------------------------- |
| 6381 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6382 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6383 | |
| 6384 | // Req |
| 6385 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6386 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6387 | |
| 6388 | // Del |
| 6389 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6390 | |
| 6391 | // E2t: Receive 1st SubsDelReq |
| 6392 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6393 | |
| 6394 | // Decode of this response fails which will result resending original request |
| 6395 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6396 | |
| 6397 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6398 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6399 | |
| 6400 | // Subscription does not exist in in E2 Node. |
| 6401 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6402 | |
| 6403 | // Wait that subs is cleaned |
| 6404 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6405 | |
| 6406 | xappConn1.TestMsgChanEmpty(t) |
| 6407 | e2termConn1.TestMsgChanEmpty(t) |
| 6408 | mainCtrl.wait_registry_empty(t, 10) |
| 6409 | } |
| 6410 | |
| 6411 | //----------------------------------------------------------------------------- |
| 6412 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6413 | // |
| 6414 | // stub stub |
| 6415 | // +-------+ +---------+ +---------+ |
| 6416 | // | xapp | | submgr | | e2term | |
| 6417 | // +-------+ +---------+ +---------+ |
| 6418 | // | | | |
| 6419 | // | [SUBS CREATE] | |
| 6420 | // | | | |
| 6421 | // | | | |
| 6422 | // | RESTSubDelReq | | |
| 6423 | // |---------------->| | |
| 6424 | // | | | |
| 6425 | // | RESTSubDelResp | | |
| 6426 | // |<----------------| | |
| 6427 | // | | | |
| 6428 | // | | SubDelReq | |
| 6429 | // | |------------->| |
| 6430 | // | | | |
| 6431 | // | | SubDelResp | Unknown instanceId |
| 6432 | // | |<-------------| |
| 6433 | // | | | |
| 6434 | // | | SubDelReq | |
| 6435 | // | |------------->| |
| 6436 | // | | | |
| 6437 | // | | SubDelFail | Subscription does exist any more |
| 6438 | // | |<-------------| |
| 6439 | // |
| 6440 | //----------------------------------------------------------------------------- |
| 6441 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6442 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6443 | |
| 6444 | // Req |
| 6445 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6446 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6447 | |
| 6448 | // Del |
| 6449 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6450 | |
| 6451 | // E2t: Receive 1st SubsDelReq |
| 6452 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6453 | |
| 6454 | // Unknown instanceId in this response which will result resending original request |
| 6455 | delreq.RequestId.InstanceId = 0 |
| 6456 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6457 | |
| 6458 | // E2t: Receive 2nd SubsDelReq |
| 6459 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6460 | |
| 6461 | // Subscription does not exist in in E2 Node. |
| 6462 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6463 | |
| 6464 | // Wait that subs is cleaned |
| 6465 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6466 | |
| 6467 | xappConn1.TestMsgChanEmpty(t) |
| 6468 | e2termConn1.TestMsgChanEmpty(t) |
| 6469 | mainCtrl.wait_registry_empty(t, 10) |
| 6470 | } |
| 6471 | |
| 6472 | //----------------------------------------------------------------------------- |
| 6473 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6474 | // |
| 6475 | // stub stub |
| 6476 | // +-------+ +---------+ +---------+ |
| 6477 | // | xapp | | submgr | | e2term | |
| 6478 | // +-------+ +---------+ +---------+ |
| 6479 | // | | | |
| 6480 | // | [SUBS CREATE] | |
| 6481 | // | | | |
| 6482 | // | | | |
| 6483 | // | RESTSubDelReq | | |
| 6484 | // |---------------->| | |
| 6485 | // | | | |
| 6486 | // | RESTSubDelResp | | |
| 6487 | // |<----------------| | |
| 6488 | // | | | |
| 6489 | // | | SubDelReq | |
| 6490 | // | |------------->| |
| 6491 | // | | | |
| 6492 | // | | SubDelResp | No transaction for the response |
| 6493 | // | |<-------------| |
| 6494 | // | | | |
| 6495 | // | | SubDelReq | |
| 6496 | // | |------------->| |
| 6497 | // | | | |
| 6498 | // | | SubDelFail | Subscription does exist any more |
| 6499 | // | |<-------------| |
| 6500 | // |
| 6501 | //----------------------------------------------------------------------------- |
| 6502 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6503 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6504 | |
| 6505 | // Req |
| 6506 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6507 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6508 | |
| 6509 | // Del |
| 6510 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6511 | |
| 6512 | // E2t: Receive 1st SubsDelReq |
| 6513 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6514 | |
| 6515 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6516 | |
| 6517 | // No transaction exist for this response which will result resending original request |
| 6518 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6519 | |
| 6520 | // E2t: Receive 2nd SubsDelReq |
| 6521 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6522 | |
| 6523 | // Subscription does not exist in in E2 Node. |
| 6524 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6525 | |
| 6526 | // Wait that subs is cleaned |
| 6527 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6528 | |
| 6529 | xappConn1.TestMsgChanEmpty(t) |
| 6530 | e2termConn1.TestMsgChanEmpty(t) |
| 6531 | mainCtrl.wait_registry_empty(t, 10) |
| 6532 | } |
| 6533 | |
| 6534 | //----------------------------------------------------------------------------- |
| 6535 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6536 | // |
| 6537 | // stub stub |
| 6538 | // +-------+ +---------+ +---------+ |
| 6539 | // | xapp | | submgr | | e2term | |
| 6540 | // +-------+ +---------+ +---------+ |
| 6541 | // | | | |
| 6542 | // | [SUBS CREATE] | |
| 6543 | // | | | |
| 6544 | // | | | |
| 6545 | // | RESTSubDelReq | | |
| 6546 | // |---------------->| | |
| 6547 | // | | | |
| 6548 | // | RESTSubDelResp | | |
| 6549 | // |<----------------| | |
| 6550 | // | | | |
| 6551 | // | | SubDelReq | |
| 6552 | // | |------------->| |
| 6553 | // | | | |
| 6554 | // | | SubDelFail | ASN.1 decode fails |
| 6555 | // | |<-------------| |
| 6556 | // | | | |
| 6557 | // | | SubDelReq | |
| 6558 | // | |------------->| |
| 6559 | // | | | |
| 6560 | // | | SubDelFail | Subscription does exist any more |
| 6561 | // | |<-------------| |
| 6562 | // |
| 6563 | //----------------------------------------------------------------------------- |
| 6564 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6565 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6566 | |
| 6567 | // Req |
| 6568 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6569 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6570 | |
| 6571 | // Del |
| 6572 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6573 | |
| 6574 | // E2t: Receive 1st SubsDelReq |
| 6575 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6576 | |
| 6577 | // Decode of this response fails which will result resending original request |
| 6578 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6579 | |
| 6580 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6581 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6582 | |
| 6583 | // Subscription does not exist in in E2 Node. |
| 6584 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6585 | |
| 6586 | // Wait that subs is cleaned |
| 6587 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6588 | |
| 6589 | xappConn1.TestMsgChanEmpty(t) |
| 6590 | e2termConn1.TestMsgChanEmpty(t) |
| 6591 | mainCtrl.wait_registry_empty(t, 10) |
| 6592 | } |
| 6593 | |
| 6594 | //----------------------------------------------------------------------------- |
| 6595 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6596 | // |
| 6597 | // stub stub |
| 6598 | // +-------+ +---------+ +---------+ |
| 6599 | // | xapp | | submgr | | e2term | |
| 6600 | // +-------+ +---------+ +---------+ |
| 6601 | // | | | |
| 6602 | // | [SUBS CREATE] | |
| 6603 | // | | | |
| 6604 | // | | | |
| 6605 | // | RESTSubDelReq | | |
| 6606 | // |---------------->| | |
| 6607 | // | | | |
| 6608 | // | RESTSubDelResp | | |
| 6609 | // |<----------------| | |
| 6610 | // | | | |
| 6611 | // | | SubDelReq | |
| 6612 | // | |------------->| |
| 6613 | // | | | |
| 6614 | // | | SubDelFail | Unknown instanceId |
| 6615 | // | |<-------------| |
| 6616 | // | | | |
| 6617 | // | | SubDelReq | |
| 6618 | // | |------------->| |
| 6619 | // | | | |
| 6620 | // | | SubDelFail | Subscription does exist any more |
| 6621 | // | |<-------------| |
| 6622 | // |
| 6623 | //----------------------------------------------------------------------------- |
| 6624 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6625 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6626 | |
| 6627 | // Req |
| 6628 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6629 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6630 | |
| 6631 | // Del |
| 6632 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6633 | |
| 6634 | // E2t: Receive 1st SubsDelReq |
| 6635 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6636 | |
| 6637 | // Unknown instanceId in this response which will result resending original request |
| 6638 | delreq.RequestId.InstanceId = 0 |
| 6639 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6640 | |
| 6641 | // E2t: Receive 2nd SubsDelReq |
| 6642 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6643 | |
| 6644 | // Subscription does not exist in in E2 Node. |
| 6645 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6646 | |
| 6647 | // Wait that subs is cleaned |
| 6648 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6649 | |
| 6650 | xappConn1.TestMsgChanEmpty(t) |
| 6651 | e2termConn1.TestMsgChanEmpty(t) |
| 6652 | mainCtrl.wait_registry_empty(t, 10) |
| 6653 | } |
| 6654 | |
| 6655 | //----------------------------------------------------------------------------- |
| 6656 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6657 | // |
| 6658 | // stub stub |
| 6659 | // +-------+ +---------+ +---------+ |
| 6660 | // | xapp | | submgr | | e2term | |
| 6661 | // +-------+ +---------+ +---------+ |
| 6662 | // | | | |
| 6663 | // | [SUBS CREATE] | |
| 6664 | // | | | |
| 6665 | // | | | |
| 6666 | // | RESTSubDelReq | | |
| 6667 | // |---------------->| | |
| 6668 | // | | | |
| 6669 | // | RESTSubDelResp | | |
| 6670 | // |<----------------| | |
| 6671 | // | | | |
| 6672 | // | | SubDelReq | |
| 6673 | // | |------------->| |
| 6674 | // | | | |
| 6675 | // | | SubDelFail | No transaction for the response |
| 6676 | // | |<-------------| |
| 6677 | // | | | |
| 6678 | // | | SubDelReq | |
| 6679 | // | |------------->| |
| 6680 | // | | | |
| 6681 | // | | SubDelFail | Subscription does exist any more |
| 6682 | // | |<-------------| |
| 6683 | // |
| 6684 | //----------------------------------------------------------------------------- |
| 6685 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6686 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6687 | |
| 6688 | // Req |
| 6689 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6690 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6691 | |
| 6692 | // Del |
| 6693 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6694 | |
| 6695 | // E2t: Receive 1st SubsDelReq |
| 6696 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6697 | |
| 6698 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6699 | |
| 6700 | // No transaction exist for this response which will result resending original request |
| 6701 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6702 | |
| 6703 | // E2t: Receive 2nd SubsDelReq |
| 6704 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6705 | |
| 6706 | // Subscription does not exist in in E2 Node. |
| 6707 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6708 | |
| 6709 | // Wait that subs is cleaned |
| 6710 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6711 | |
| 6712 | xappConn1.TestMsgChanEmpty(t) |
| 6713 | e2termConn1.TestMsgChanEmpty(t) |
| 6714 | mainCtrl.wait_registry_empty(t, 10) |
| 6715 | } |
| 6716 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6717 | //----------------------------------------------------------------------------- |
| 6718 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6719 | // |
| 6720 | // stub stub |
| 6721 | // +-------+ +---------+ +---------+ |
| 6722 | // | xapp | | submgr | | e2term | |
| 6723 | // +-------+ +---------+ +---------+ |
| 6724 | // | | | |
| 6725 | // | RESTSubReq | | |
| 6726 | // |---------------->| | |
| 6727 | // | | | |
| 6728 | // | RESTSubResp | | |
| 6729 | // |<----------------| | |
| 6730 | // | | | |
| 6731 | // | ASN.1 encode fails | |
| 6732 | // | | | |
| 6733 | // | | SubDelReq | |
| 6734 | // | |------------->| |
| 6735 | // | | | |
| 6736 | // | | SubDelFail | |
| 6737 | // | |<-------------| |
| 6738 | // | | | |
| 6739 | // | RESTNotif | | |
| 6740 | // | unsuccess | | |
| 6741 | // |<----------------| | |
| 6742 | // | | | |
| 6743 | // | [SUBS DELETE] | |
| 6744 | // | | | |
| 6745 | // |
| 6746 | //----------------------------------------------------------------------------- |
| 6747 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6748 | |
| 6749 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6750 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6751 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6752 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6753 | }) |
| 6754 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6755 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6756 | |
| 6757 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6758 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6759 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6760 | |
| 6761 | // Req |
| 6762 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6763 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6764 | |
| 6765 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6766 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6767 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6768 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6769 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6770 | |
| 6771 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 6772 | // Wait that subs is cleaned |
| 6773 | waitSubsCleanup(t, e2SubsId, 10) |
| 6774 | mainCtrl.VerifyCounterValues(t) |
| 6775 | } |
| 6776 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6777 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6778 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6779 | |
| 6780 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6781 | Counter{cRestSubReqFromXapp, 2}, |
| 6782 | Counter{cRestSubRespToXapp, 2}, |
| 6783 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 6784 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6785 | Counter{cSubRespFromE2, 1}, |
| 6786 | Counter{cRestSubNotifToXapp, 1}, |
| 6787 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6788 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6789 | Counter{cSubDelReqToE2, 1}, |
| 6790 | Counter{cSubDelRespFromE2, 1}, |
| 6791 | Counter{cRestSubDelRespToXapp, 1}, |
| 6792 | }) |
| 6793 | |
| 6794 | const e2Timeout int64 = 1 |
| 6795 | const e2RetryCount int64 = 0 |
| 6796 | const routingNeeded bool = false |
| 6797 | |
| 6798 | // Req1 |
| 6799 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6800 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6801 | |
| 6802 | // Subs Create |
| 6803 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6804 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6805 | |
| 6806 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6807 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6808 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6809 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6810 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6811 | |
| 6812 | // Policy change |
| 6813 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6814 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6815 | params.SetSubscriptionID(&restSubId) |
| 6816 | params.SetTimeToWait("w200ms") |
| 6817 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6818 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6819 | |
| 6820 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6821 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6822 | // SubsResp is missing, e2SubsId will be 0 |
| 6823 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6824 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6825 | |
| 6826 | // Del |
| 6827 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6828 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6829 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6830 | |
| 6831 | waitSubsCleanup(t, e2SubsId, 10) |
| 6832 | |
| 6833 | mainCtrl.VerifyCounterValues(t) |
| 6834 | } |
| 6835 | |
| 6836 | //----------------------------------------------------------------------------- |
| 6837 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6838 | // |
| 6839 | // stub stub |
| 6840 | // +-------+ +---------+ +---------+ |
| 6841 | // | xapp | | submgr | | e2term | |
| 6842 | // +-------+ +---------+ +---------+ |
| 6843 | // | | | |
| 6844 | // | RESTSubReq | | |
| 6845 | // |---------------->| | |
| 6846 | // | | | |
| 6847 | // | RESTSubResp | | |
| 6848 | // |<----------------| | |
| 6849 | // | | SubReq | |
| 6850 | // | |------------->| |
| 6851 | // | | | |
| 6852 | // | | SubResp | |
| 6853 | // | |<-------------| |
| 6854 | // | | | |
| 6855 | // | RESTNotif | | |
| 6856 | // |<----------------| | |
| 6857 | // | | | |
| 6858 | // | RESTSubReq | | |
| 6859 | // |---------------->| | |
| 6860 | // | | | |
| 6861 | // | RESTSubResp | | |
| 6862 | // |<----------------| | |
| 6863 | // | | SubReq | |
| 6864 | // | |------------->| |
| 6865 | // | | |
| 6866 | // | Submgr restart | |
| 6867 | // | | | |
| 6868 | // | RESTSubDelReq | | |
| 6869 | // |---------------->| | |
| 6870 | // | | | |
| 6871 | // | | SubDelReq | |
| 6872 | // | |------------->| |
| 6873 | // | | | |
| 6874 | // | | SubDelResp | |
| 6875 | // | |<-------------| |
| 6876 | // | | | |
| 6877 | // | RESTSubDelResp | | |
| 6878 | // |<----------------| | |
| 6879 | // |
| 6880 | //----------------------------------------------------------------------------- |
| 6881 | |
| 6882 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6883 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6884 | |
| 6885 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6886 | Counter{cRestSubReqFromXapp, 2}, |
| 6887 | Counter{cRestSubRespToXapp, 2}, |
| 6888 | Counter{cSubReqToE2, 2}, |
| 6889 | Counter{cSubRespFromE2, 1}, |
| 6890 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 6891 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6892 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6893 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame^] | 6894 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6895 | Counter{cRestSubDelRespToXapp, 1}, |
| 6896 | }) |
| 6897 | |
| 6898 | // Remove possible existing subscription |
| 6899 | mainCtrl.removeExistingSubscriptions(t) |
| 6900 | |
| 6901 | const e2Timeout int64 = 1 |
| 6902 | const e2RetryCount int64 = 0 |
| 6903 | const routingNeeded bool = false |
| 6904 | |
| 6905 | // Req1 |
| 6906 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6907 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6908 | // Create subscription |
| 6909 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6910 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6911 | |
| 6912 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6913 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6914 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6915 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6916 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6917 | |
| 6918 | // Check subscription |
| 6919 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6920 | |
| 6921 | // Policy change |
| 6922 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6923 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6924 | params.SetSubscriptionID(&restSubId) |
| 6925 | params.SetTimeToWait("w200ms") |
| 6926 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 6927 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6928 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6929 | |
| 6930 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6931 | mainCtrl.SetResetTestFlag(t, false) |
| 6932 | |
| 6933 | // SubsResp is missing due to submgr restart |
| 6934 | |
| 6935 | mainCtrl.SimulateRestart(t) |
| 6936 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 6937 | |
| 6938 | // Check subscription |
| 6939 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6940 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6941 | // Delete subscription |
| 6942 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6943 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6944 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6945 | |
| 6946 | //Wait that subs is cleaned |
| 6947 | waitSubsCleanup(t, e2SubsId, 10) |
| 6948 | |
| 6949 | mainCtrl.VerifyCounterValues(t) |
| 6950 | } |
| 6951 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6952 | //////////////////////////////////////////////////////////////////////////////////// |
| 6953 | // Services for UT cases |
| 6954 | //////////////////////////////////////////////////////////////////////////////////// |
| 6955 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6956 | const host string = "localhost" |
| 6957 | |
| 6958 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6959 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6960 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6961 | } |
| 6962 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6963 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6964 | |
| 6965 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 6966 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6967 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 6968 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6969 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6970 | |
| 6971 | return restSubId, e2SubsId |
| 6972 | } |
| 6973 | |
| 6974 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 6975 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6976 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6977 | if meid != "" { |
| 6978 | params.SetMeid(meid) |
| 6979 | } |
| 6980 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 6981 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 6982 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6983 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6984 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6985 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6986 | |
| 6987 | return restSubId, e2SubsId |
| 6988 | } |
| 6989 | |
| 6990 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6991 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6992 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6993 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6994 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6995 | |
| 6996 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6997 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6998 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6999 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7000 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7001 | |
| 7002 | return restSubId, e2SubsId |
| 7003 | } |
| 7004 | |
| 7005 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7006 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7007 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7008 | |
| 7009 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7010 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7011 | fparams1.Set(crereq1) |
| 7012 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7013 | |
| 7014 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7015 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7016 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7017 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7018 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7019 | |
| 7020 | return restSubId, e2SubsId |
| 7021 | } |
| 7022 | |
| 7023 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7024 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7025 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7026 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7027 | } |
| 7028 | |
| 7029 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7030 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7031 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7032 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7033 | } |
| 7034 | |
| 7035 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7036 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7037 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7038 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7039 | } |
| 7040 | |
| 7041 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7042 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 7043 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 7044 | assert.Equal(t, resp[0].Meid, meid) |
| 7045 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 7046 | } |
| 7047 | |
| 7048 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7049 | //Wait that subs is cleaned |
| 7050 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7051 | |
| 7052 | xappConn1.TestMsgChanEmpty(t) |
| 7053 | xappConn2.TestMsgChanEmpty(t) |
| 7054 | e2termConn1.TestMsgChanEmpty(t) |
| 7055 | mainCtrl.wait_registry_empty(t, timeout) |
| 7056 | } |
| 7057 | |
| 7058 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7059 | |
| 7060 | var e2SubsId []uint32 |
| 7061 | |
| 7062 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7063 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7064 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7065 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7066 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7067 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7068 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7069 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7070 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7071 | <-time.After(100 * time.Millisecond) |
| 7072 | } |
| 7073 | return e2SubsId |
| 7074 | } |
| 7075 | |
| 7076 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7077 | |
| 7078 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7079 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7080 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7081 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7082 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7083 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7084 | <-time.After(100 * time.Millisecond) |
| 7085 | } |
| 7086 | |
| 7087 | // Wait that subs is cleaned |
| 7088 | for i := 0; i < len(e2SubsIds); i++ { |
| 7089 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7090 | } |
| 7091 | |
| 7092 | } |