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 | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 99 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 100 | //os.Exit(0) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | //----------------------------------------------------------------------------- |
| 104 | // TestRESTSubReqE2ConnBreak |
| 105 | // |
| 106 | // stub stub |
| 107 | // +-------+ +---------+ +---------+ |
| 108 | // | xapp | | submgr | | e2term | |
| 109 | // +-------+ +---------+ +---------+ |
| 110 | // | | | |
| 111 | // | RESTSubReq | | |
| 112 | // |---------------->| | |
| 113 | // | RESTSubResp | | |
| 114 | // |<----------------| | |
| 115 | // | | SubReq | |
| 116 | // | |------------->| |
| 117 | // | | SubResp | |
| 118 | // | |<-------------| |
| 119 | // | | | |
| 120 | // | [E2 Conn. DOWN] | |
| 121 | // | [Int. SUBS DELETE] | |
| 122 | // | | | |
| 123 | // | RESTNotif(unsuccessful) | |
| 124 | // |<----------------| | |
| 125 | // | | | |
| 126 | // | | | |
| 127 | // |
| 128 | //----------------------------------------------------------------------------- |
| 129 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
| 130 | CaseBegin("TestRESTSubReqE2ConnBreak") |
| 131 | |
| 132 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 133 | Counter{cRestSubReqFromXapp, 1}, |
| 134 | Counter{cRestSubRespToXapp, 1}, |
| 135 | Counter{cSubReqToE2, 1}, |
| 136 | Counter{cSubRespFromE2, 1}, |
| 137 | Counter{cRestSubFailNotifToXapp, 1}, |
| 138 | }) |
| 139 | |
| 140 | // Req |
| 141 | const subReqCount int = 1 |
| 142 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 143 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 144 | |
| 145 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 146 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 147 | |
| 148 | // E2 disconnect after E2term has received response |
| 149 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 150 | |
| 151 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 152 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 153 | |
| 154 | <-time.After(time.Second * 1) |
| 155 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 156 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 157 | |
| 158 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 159 | if err != nil { |
| 160 | xapp.Logger.Error("%v", err) |
| 161 | } else { |
| 162 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 163 | assert.Equal(t, 0, len(register)) |
| 164 | } |
| 165 | |
| 166 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 167 | if err != nil { |
| 168 | xapp.Logger.Error("%v", err) |
| 169 | } else { |
| 170 | assert.Equal(t, 0, len(restSubscriptions)) |
| 171 | } |
| 172 | |
| 173 | // Restore E2 connection for following test cases |
| 174 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 175 | |
| 176 | // Wait that subs is cleaned |
| 177 | waitSubsCleanup(t, e2SubsId, 10) |
| 178 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 179 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | //----------------------------------------------------------------------------- |
| 183 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 184 | // |
| 185 | // stub stub |
| 186 | // +-------+ +---------+ +---------+ |
| 187 | // | xapp | | submgr | | e2term | |
| 188 | // +-------+ +---------+ +---------+ |
| 189 | // | | | |
| 190 | // | [SUBS CREATE] | |
| 191 | // | | | |
| 192 | // | [E2 Conn. DOWN] | |
| 193 | // | | | |
| 194 | // | RESTSubDelReq | | |
| 195 | // |---------------->| | |
| 196 | // | | | |
| 197 | // | RESTSubDelResp | | |
| 198 | // |<----------------| | |
| 199 | // | | | |
| 200 | // | [No valid subscription found] | |
| 201 | // | | | |
| 202 | // |
| 203 | //----------------------------------------------------------------------------- |
| 204 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 205 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 206 | |
| 207 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 208 | Counter{cRestSubReqFromXapp, 1}, |
| 209 | Counter{cRestSubRespToXapp, 1}, |
| 210 | Counter{cSubReqToE2, 1}, |
| 211 | Counter{cSubRespFromE2, 1}, |
| 212 | Counter{cRestSubNotifToXapp, 1}, |
| 213 | Counter{cRestSubDelReqFromXapp, 1}, |
| 214 | Counter{cRestSubDelRespToXapp, 1}, |
| 215 | }) |
| 216 | |
| 217 | // Req |
| 218 | var params *teststube2ap.RESTSubsReqParams = nil |
| 219 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 220 | |
| 221 | // E2 disconnect after E2term has received response |
| 222 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 223 | |
| 224 | // Del |
| 225 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 226 | |
| 227 | <-time.After(time.Second * 1) |
| 228 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 229 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 230 | |
| 231 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 232 | if err != nil { |
| 233 | xapp.Logger.Error("%v", err) |
| 234 | } else { |
| 235 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 236 | assert.Equal(t, 0, len(register)) |
| 237 | } |
| 238 | |
| 239 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 240 | if err != nil { |
| 241 | xapp.Logger.Error("%v", err) |
| 242 | } else { |
| 243 | assert.Equal(t, 0, len(restSubscriptions)) |
| 244 | } |
| 245 | |
| 246 | // Restore E2 connection for following test cases |
| 247 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 248 | |
| 249 | // Wait that subs is cleaned |
| 250 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 251 | |
| 252 | xappConn1.TestMsgChanEmpty(t) |
| 253 | e2termConn1.TestMsgChanEmpty(t) |
| 254 | mainCtrl.wait_registry_empty(t, 10) |
| 255 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 256 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | //----------------------------------------------------------------------------- |
| 260 | // TestRESTOtherE2ConnectionChanges |
| 261 | // |
| 262 | |
| 263 | // stub stub |
| 264 | // +-------+ +---------+ +---------+ |
| 265 | // | xapp | | submgr | | e2term | |
| 266 | // +-------+ +---------+ +---------+ |
| 267 | // | | | |
| 268 | // | [SUBS CREATE] | |
| 269 | // | | | |
| 270 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 271 | // | [E2 CONNECTING] | |
| 272 | // | [E2 SHUTTING_DOWN] | |
| 273 | // | [E2 SHUT_DOWN] | |
| 274 | // | | | |
| 275 | // | [SUBS DELETE] | |
| 276 | // | | | |
| 277 | // |
| 278 | //----------------------------------------------------------------------------- |
| 279 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 280 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 281 | |
| 282 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 283 | Counter{cRestSubReqFromXapp, 1}, |
| 284 | Counter{cRestSubRespToXapp, 1}, |
| 285 | Counter{cSubReqToE2, 1}, |
| 286 | Counter{cSubRespFromE2, 1}, |
| 287 | Counter{cRestSubNotifToXapp, 1}, |
| 288 | Counter{cRestSubDelReqFromXapp, 1}, |
| 289 | Counter{cSubDelReqToE2, 1}, |
| 290 | Counter{cSubDelRespFromE2, 1}, |
| 291 | Counter{cRestSubDelRespToXapp, 1}, |
| 292 | }) |
| 293 | |
| 294 | // Req |
| 295 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 296 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 297 | |
| 298 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 299 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 300 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 301 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 302 | |
| 303 | // Submgr should not react any other connection state changes than CONNECTED and DISCONNECTED |
| 304 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 305 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 306 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 307 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 308 | |
| 309 | // Del |
| 310 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 311 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 312 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 313 | |
| 314 | // Restore E2 connection for following test cases |
| 315 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 316 | |
| 317 | // Wait that subs is cleaned |
| 318 | waitSubsCleanup(t, e2SubsId, 10) |
| 319 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 320 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 321 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 322 | |
| 323 | //----------------------------------------------------------------------------- |
| 324 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 325 | // |
| 326 | // stub stub stub |
| 327 | // +-------+ +---------+ +---------+ +---------+ |
| 328 | // | xapp | | submgr | | e2term | | rtmgr | |
| 329 | // +-------+ +---------+ +---------+ +---------+ |
| 330 | // | | | | |
| 331 | // | RESTSubReq | | | |
| 332 | // |---------------->| | | |
| 333 | // | | RouteCreate | | |
| 334 | // | |--------------------------->| // The order of these events may vary |
| 335 | // | | | | |
| 336 | // | RESTSubResp | | | // The order of these events may vary |
| 337 | // |<----------------| | | |
| 338 | // | | RouteResponse| | |
| 339 | // | |<---------------------------| // The order of these events may vary |
| 340 | // | | | | |
| 341 | // | | SubReq | | |
| 342 | // | |------------->| | // The order of these events may vary |
| 343 | // | | | | |
| 344 | // | | SubResp | | |
| 345 | // | |<-------------| | |
| 346 | // | RESTNotif1 | | | |
| 347 | // |<----------------| | | |
| 348 | // | | | | |
| 349 | // | RESTSubDelReq | | | |
| 350 | // |---------------->| | | |
| 351 | // | | SubDelReq | | |
| 352 | // | |------------->| | |
| 353 | // | | | | |
| 354 | // | RESTSubDelResp| | | |
| 355 | // |<----------------| | | |
| 356 | // | | | | |
| 357 | // | | SubDelResp | | |
| 358 | // | |<-------------| | |
| 359 | // | | | | |
| 360 | // | | | | |
| 361 | // |
| 362 | //----------------------------------------------------------------------------- |
| 363 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 364 | |
| 365 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 366 | |
| 367 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 368 | |
| 369 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 370 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 371 | } |
| 372 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 373 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 374 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 375 | // |
| 376 | // stub stub stub |
| 377 | // +-------+ +---------+ +---------+ +---------+ |
| 378 | // | xapp | | submgr | | e2term | | rtmgr | |
| 379 | // +-------+ +---------+ +---------+ +---------+ |
| 380 | // | | | | |
| 381 | // | RESTSubReq | | | |
| 382 | // |---------------->| | | |
| 383 | // | | RouteCreate | | |
| 384 | // | |--------------------------->| // The order of these events may vary |
| 385 | // | | | | |
| 386 | // | RESTSubResp | | | // The order of these events may vary |
| 387 | // |<----------------| | | |
| 388 | // | | RouteResponse| | |
| 389 | // | |<---------------------------| // The order of these events may vary |
| 390 | // | | | | |
| 391 | // | | SubReq | | |
| 392 | // | |------------->| | // The order of these events may vary |
| 393 | // | | | | |
| 394 | // | | SubResp | | |
| 395 | // | |<-------------| | |
| 396 | // | RESTNotif1 | | | |
| 397 | // |<----------------| | | |
| 398 | // | | | | |
| 399 | // | RESTSubDelReq | | | |
| 400 | // |---------------->| | | |
| 401 | // | | | | |
| 402 | // | RESTSubDelResp| | | |
| 403 | // |<----------------| | | |
| 404 | // | | | | |
| 405 | // | | | | |
| 406 | // |
| 407 | //----------------------------------------------------------------------------- |
| 408 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 409 | |
| 410 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 411 | |
| 412 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 413 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 414 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 415 | |
| 416 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 417 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 418 | } |
| 419 | |
| 420 | //----------------------------------------------------------------------------- |
| 421 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 422 | // |
| 423 | // stub stub stub |
| 424 | // +-------+ +---------+ +---------+ +---------+ |
| 425 | // | xapp | | submgr | | e2term | | rtmgr | |
| 426 | // +-------+ +---------+ +---------+ +---------+ |
| 427 | // | | | | |
| 428 | // | RESTSubReq | | | |
| 429 | // |---------------->| | | |
| 430 | // | | RouteCreate | | |
| 431 | // | |--------------------------->| // The order of these events may vary |
| 432 | // | | | | |
| 433 | // | RESTSubResp | | | // The order of these events may vary |
| 434 | // |<----------------| | | |
| 435 | // | | RouteResponse| | |
| 436 | // | |<---------------------------| // The order of these events may vary |
| 437 | // | | | | |
| 438 | // | | SubReq | | |
| 439 | // | |------------->| | // The order of these events may vary |
| 440 | // | | | | |
| 441 | // | | SubResp | | |
| 442 | // | |<-------------| | |
| 443 | // | RESTNotif1 | | | |
| 444 | // |<----------------| | | |
| 445 | // | | | | |
| 446 | // | RESTSubDelReq | | | |
| 447 | // |---------------->| | | |
| 448 | // | | SubDelReq | | |
| 449 | // | |------------->| | |
| 450 | // | | | | |
| 451 | // | RESTSubDelResp| | | |
| 452 | // |<----------------| | | // The order of these events may vary |
| 453 | // | | | | |
| 454 | // | | SubDelResp | | |
| 455 | // | |<-------------| | // 1.st NOK |
| 456 | // | | | | |
| 457 | // | | SubDelReq | | |
| 458 | // | |------------->| | |
| 459 | // | | | | |
| 460 | // | | SubDelResp | | |
| 461 | // | |<-------------| | // 2.nd NOK |
| 462 | // |
| 463 | //----------------------------------------------------------------------------- |
| 464 | |
| 465 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 466 | |
| 467 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 468 | |
| 469 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 470 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 471 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 472 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 473 | |
| 474 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 475 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 476 | |
| 477 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 478 | |
| 479 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 480 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 484 | // TestSubReqAndRouteNok |
| 485 | // |
| 486 | // stub stub |
| 487 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 488 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 489 | // +-------+ +---------+ +---------+ |
| 490 | // | | | |
| 491 | // | SubReq | | |
| 492 | // |------------->| | |
| 493 | // | | | |
| 494 | // | | RouteCreate | |
| 495 | // | |------------->| |
| 496 | // | | | |
| 497 | // | | RouteCreate | |
| 498 | // | | status:400 | |
| 499 | // | |<-------------| |
| 500 | // | | | |
| 501 | // | [SUBS INT DELETE] | |
| 502 | // | | | |
| 503 | // |
| 504 | //----------------------------------------------------------------------------- |
| 505 | |
| 506 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 507 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 508 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 509 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 510 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 511 | Counter{cSubReqFromXapp, 1}, |
| 512 | Counter{cRouteCreateFail, 1}, |
| 513 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 514 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 515 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 516 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 517 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 518 | waiter.WaitResult(t) |
| 519 | |
| 520 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 521 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 522 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 523 | xappConn1.TestMsgChanEmpty(t) |
| 524 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 525 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 526 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 527 | |
| 528 | <-time.After(1 * time.Second) |
| 529 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 533 | // TestSubReqAndRouteUpdateNok |
| 534 | |
| 535 | // stub stub |
| 536 | // +-------+ +-------+ +---------+ +---------+ |
| 537 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 538 | // +-------+ +-------+ +---------+ +---------+ |
| 539 | // | | | | |
| 540 | // | [SUBS CREATE] | | |
| 541 | // | | | | |
| 542 | // | | | | |
| 543 | // | | | | |
| 544 | // | SubReq (mergeable) | | |
| 545 | // |--------------------------->| | | |
| 546 | // | | | | |
| 547 | // | | | RouteUpdate | |
| 548 | // | | |------------->| |
| 549 | // | | | | |
| 550 | // | | | RouteUpdate | |
| 551 | // | | | status:400 | |
| 552 | // | | |<-------------| |
| 553 | // | | | | |
| 554 | // | [SUBS INT DELETE] | | |
| 555 | // | | | | |
| 556 | // | | | | |
| 557 | // | [SUBS DELETE] | | |
| 558 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 559 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 560 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 561 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 562 | |
| 563 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 564 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 565 | Counter{cSubReqFromXapp, 2}, |
| 566 | Counter{cSubReqToE2, 1}, |
| 567 | Counter{cSubRespFromE2, 1}, |
| 568 | Counter{cSubRespToXapp, 1}, |
| 569 | Counter{cRouteCreateUpdateFail, 1}, |
| 570 | Counter{cSubDelReqFromXapp, 1}, |
| 571 | Counter{cSubDelReqToE2, 1}, |
| 572 | Counter{cSubDelRespFromE2, 1}, |
| 573 | Counter{cSubDelRespToXapp, 1}, |
| 574 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 575 | |
| 576 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 577 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 578 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 579 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 580 | |
| 581 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 582 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 583 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 584 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 585 | |
| 586 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 587 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 588 | xappConn2.SendSubsReq(t, nil, nil) |
| 589 | waiter.WaitResult(t) |
| 590 | |
| 591 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 592 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 593 | |
| 594 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 595 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 596 | |
| 597 | //Wait that subs is cleaned |
| 598 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 599 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 600 | |
| 601 | xappConn1.TestMsgChanEmpty(t) |
| 602 | xappConn2.TestMsgChanEmpty(t) |
| 603 | e2termConn1.TestMsgChanEmpty(t) |
| 604 | mainCtrl.wait_registry_empty(t, 10) |
| 605 | |
| 606 | mainCtrl.VerifyCounterValues(t) |
| 607 | } |
| 608 | |
| 609 | //----------------------------------------------------------------------------- |
| 610 | // TestSubDelReqAndRouteDeleteNok |
| 611 | // |
| 612 | // stub stub |
| 613 | // +-------+ +---------+ +---------+ +---------+ |
| 614 | // | xapp | | submgr | | e2term | | rtmgr | |
| 615 | // +-------+ +---------+ +---------+ +---------+ |
| 616 | // | | | | |
| 617 | // | [SUBS CREATE] | | |
| 618 | // | | | | |
| 619 | // | | | | |
| 620 | // | | | | |
| 621 | // | SubDelReq | | | |
| 622 | // |------------->| | | |
| 623 | // | | SubDelReq | | |
| 624 | // | |------------->| | |
| 625 | // | | SubDelRsp | | |
| 626 | // | |<-------------| | |
| 627 | // | SubDelRsp | | | |
| 628 | // |<-------------| | | |
| 629 | // | | RouteDelete | | |
| 630 | // | |---------------------------->| |
| 631 | // | | | | |
| 632 | // | | RouteDelete | | |
| 633 | // | | status:400 | | |
| 634 | // | |<----------------------------| |
| 635 | // | | | | |
| 636 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 637 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 638 | |
| 639 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 640 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 641 | Counter{cSubReqFromXapp, 1}, |
| 642 | Counter{cSubReqToE2, 1}, |
| 643 | Counter{cSubRespFromE2, 1}, |
| 644 | Counter{cSubRespToXapp, 1}, |
| 645 | Counter{cSubDelReqFromXapp, 1}, |
| 646 | Counter{cRouteDeleteFail, 1}, |
| 647 | Counter{cSubDelReqToE2, 1}, |
| 648 | Counter{cSubDelRespFromE2, 1}, |
| 649 | Counter{cSubDelRespToXapp, 1}, |
| 650 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 651 | |
| 652 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 653 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 654 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 655 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 656 | |
| 657 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 658 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 659 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 660 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 661 | |
| 662 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 663 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 664 | |
| 665 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 666 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 667 | waiter.WaitResult(t) |
| 668 | |
| 669 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 670 | |
| 671 | //Wait that subs is cleaned |
| 672 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 673 | |
| 674 | xappConn1.TestMsgChanEmpty(t) |
| 675 | xappConn2.TestMsgChanEmpty(t) |
| 676 | e2termConn1.TestMsgChanEmpty(t) |
| 677 | mainCtrl.wait_registry_empty(t, 10) |
| 678 | |
| 679 | mainCtrl.VerifyCounterValues(t) |
| 680 | } |
| 681 | |
| 682 | //----------------------------------------------------------------------------- |
| 683 | // TestSubMergeDelAndRouteUpdateNok |
| 684 | // stub stub |
| 685 | // +-------+ +-------+ +---------+ +---------+ |
| 686 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 687 | // +-------+ +-------+ +---------+ +---------+ |
| 688 | // | | | | |
| 689 | // | | | | |
| 690 | // | | | | |
| 691 | // | | SubReq1 | | |
| 692 | // | |------------->| | |
| 693 | // | | | | |
| 694 | // | | | SubReq1 | |
| 695 | // | | |------------->| |
| 696 | // | | | SubResp1 | |
| 697 | // | | |<-------------| |
| 698 | // | | SubResp1 | | |
| 699 | // | |<-------------| | |
| 700 | // | | | | |
| 701 | // | SubReq2 | | |
| 702 | // |--------------------------->| | |
| 703 | // | | | | |
| 704 | // | SubResp2 | | |
| 705 | // |<---------------------------| | |
| 706 | // | | | | |
| 707 | // | | SubDelReq 1 | | |
| 708 | // | |------------->| | |
| 709 | // | | | RouteUpdate | |
| 710 | // | | |-----> rtmgr | |
| 711 | // | | | | |
| 712 | // | | | RouteUpdate | |
| 713 | // | | | status:400 | |
| 714 | // | | |<----- rtmgr | |
| 715 | // | | | | |
| 716 | // | | SubDelResp 1 | | |
| 717 | // | |<-------------| | |
| 718 | // | | | | |
| 719 | // | SubDelReq 2 | | |
| 720 | // |--------------------------->| | |
| 721 | // | | | | |
| 722 | // | | | SubDelReq 2 | |
| 723 | // | | |------------->| |
| 724 | // | | | | |
| 725 | // | | | SubDelReq 2 | |
| 726 | // | | |------------->| |
| 727 | // | | | | |
| 728 | // | SubDelResp 2 | | |
| 729 | // |<---------------------------| | |
| 730 | // |
| 731 | //----------------------------------------------------------------------------- |
| 732 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 733 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 734 | |
| 735 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 736 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 737 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 738 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 739 | Counter{cSubReqToE2, 1}, |
| 740 | Counter{cSubRespFromE2, 1}, |
| 741 | Counter{cSubRespToXapp, 2}, |
| 742 | Counter{cSubDelReqFromXapp, 2}, |
| 743 | Counter{cRouteDeleteUpdateFail, 1}, |
| 744 | Counter{cSubDelReqToE2, 1}, |
| 745 | Counter{cSubDelRespFromE2, 1}, |
| 746 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 747 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 748 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 749 | |
| 750 | //Req1 |
| 751 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 752 | rparams1.Init() |
| 753 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 754 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 755 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 756 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 757 | |
| 758 | //Req2 |
| 759 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 760 | rparams2.Init() |
| 761 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 762 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 763 | |
| 764 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 765 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 766 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 767 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 768 | |
| 769 | //Del1 |
| 770 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 771 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 772 | waiter.WaitResult(t) |
| 773 | |
| 774 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 775 | |
| 776 | //Del2 |
| 777 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 778 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 779 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 780 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 781 | //Wait that subs is cleaned |
| 782 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 783 | |
| 784 | xappConn1.TestMsgChanEmpty(t) |
| 785 | xappConn2.TestMsgChanEmpty(t) |
| 786 | e2termConn1.TestMsgChanEmpty(t) |
| 787 | mainCtrl.wait_registry_empty(t, 10) |
| 788 | |
| 789 | mainCtrl.VerifyCounterValues(t) |
| 790 | } |
| 791 | |
| 792 | //----------------------------------------------------------------------------- |
| 793 | |
| 794 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 795 | // TestSubReqAndSubDelOk |
| 796 | // |
| 797 | // stub stub |
| 798 | // +-------+ +---------+ +---------+ |
| 799 | // | xapp | | submgr | | e2term | |
| 800 | // +-------+ +---------+ +---------+ |
| 801 | // | | | |
| 802 | // | SubReq | | |
| 803 | // |------------->| | |
| 804 | // | | | |
| 805 | // | | SubReq | |
| 806 | // | |------------->| |
| 807 | // | | | |
| 808 | // | | SubResp | |
| 809 | // | |<-------------| |
| 810 | // | | | |
| 811 | // | SubResp | | |
| 812 | // |<-------------| | |
| 813 | // | | | |
| 814 | // | | | |
| 815 | // | SubDelReq | | |
| 816 | // |------------->| | |
| 817 | // | | | |
| 818 | // | | SubDelReq | |
| 819 | // | |------------->| |
| 820 | // | | | |
| 821 | // | | SubDelResp | |
| 822 | // | |<-------------| |
| 823 | // | | | |
| 824 | // | SubDelResp | | |
| 825 | // |<-------------| | |
| 826 | // |
| 827 | //----------------------------------------------------------------------------- |
| 828 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 829 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 830 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 831 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 832 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 833 | Counter{cSubReqFromXapp, 1}, |
| 834 | Counter{cSubReqToE2, 1}, |
| 835 | Counter{cSubRespFromE2, 1}, |
| 836 | Counter{cSubRespToXapp, 1}, |
| 837 | Counter{cSubDelReqFromXapp, 1}, |
| 838 | Counter{cSubDelReqToE2, 1}, |
| 839 | Counter{cSubDelRespFromE2, 1}, |
| 840 | Counter{cSubDelRespToXapp, 1}, |
| 841 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 842 | |
| 843 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 844 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 845 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 847 | |
| 848 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 849 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 850 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 851 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 852 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 853 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 854 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 855 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 856 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 857 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 858 | |
| 859 | //Wait that subs is cleaned |
| 860 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 861 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 862 | xappConn1.TestMsgChanEmpty(t) |
| 863 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 864 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 865 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 866 | |
| 867 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | //----------------------------------------------------------------------------- |
| 871 | // TestSubReqRetransmission |
| 872 | // |
| 873 | // stub stub |
| 874 | // +-------+ +---------+ +---------+ |
| 875 | // | xapp | | submgr | | e2term | |
| 876 | // +-------+ +---------+ +---------+ |
| 877 | // | | | |
| 878 | // | SubReq | | |
| 879 | // |------------->| | |
| 880 | // | | | |
| 881 | // | | SubReq | |
| 882 | // | |------------->| |
| 883 | // | | | |
| 884 | // | SubReq | | |
| 885 | // | (retrans) | | |
| 886 | // |------------->| | |
| 887 | // | | | |
| 888 | // | | SubResp | |
| 889 | // | |<-------------| |
| 890 | // | | | |
| 891 | // | SubResp | | |
| 892 | // |<-------------| | |
| 893 | // | | | |
| 894 | // | [SUBS DELETE] | |
| 895 | // | | | |
| 896 | // |
| 897 | //----------------------------------------------------------------------------- |
| 898 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 899 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 900 | |
| 901 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 902 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 903 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 904 | |
| 905 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 906 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 907 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 908 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 909 | // hack as there is no real way to see has message be handled. |
| 910 | // Previuos counter check just tells that is has been received by submgr |
| 911 | // --> artificial delay |
| 912 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 913 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 914 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 915 | |
| 916 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 917 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 918 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 919 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 920 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 921 | |
| 922 | //Wait that subs is cleaned |
| 923 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 924 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 925 | xappConn1.TestMsgChanEmpty(t) |
| 926 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 927 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 928 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | //----------------------------------------------------------------------------- |
| 932 | // TestSubDelReqRetransmission |
| 933 | // |
| 934 | // stub stub |
| 935 | // +-------+ +---------+ +---------+ |
| 936 | // | xapp | | submgr | | e2term | |
| 937 | // +-------+ +---------+ +---------+ |
| 938 | // | | | |
| 939 | // | [SUBS CREATE] | |
| 940 | // | | | |
| 941 | // | | | |
| 942 | // | SubDelReq | | |
| 943 | // |------------->| | |
| 944 | // | | | |
| 945 | // | | SubDelReq | |
| 946 | // | |------------->| |
| 947 | // | | | |
| 948 | // | SubDelReq | | |
| 949 | // | (same sub) | | |
| 950 | // | (same xid) | | |
| 951 | // |------------->| | |
| 952 | // | | | |
| 953 | // | | SubDelResp | |
| 954 | // | |<-------------| |
| 955 | // | | | |
| 956 | // | SubDelResp | | |
| 957 | // |<-------------| | |
| 958 | // |
| 959 | //----------------------------------------------------------------------------- |
| 960 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 961 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 962 | |
| 963 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 964 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 965 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 966 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 967 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 968 | |
| 969 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 970 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 971 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 972 | |
| 973 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 974 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 975 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 976 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 977 | // hack as there is no real way to see has message be handled. |
| 978 | // Previuos counter check just tells that is has been received by submgr |
| 979 | // --> artificial delay |
| 980 | <-time.After(1 * time.Second) |
| 981 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 982 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 983 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 984 | |
| 985 | //Wait that subs is cleaned |
| 986 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 987 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 988 | xappConn1.TestMsgChanEmpty(t) |
| 989 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 990 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 991 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | //----------------------------------------------------------------------------- |
| 995 | // TestSubDelReqCollision |
| 996 | // |
| 997 | // stub stub |
| 998 | // +-------+ +---------+ +---------+ |
| 999 | // | xapp | | submgr | | e2term | |
| 1000 | // +-------+ +---------+ +---------+ |
| 1001 | // | | | |
| 1002 | // | [SUBS CREATE] | |
| 1003 | // | | | |
| 1004 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1005 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | // |------------->| | |
| 1007 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1008 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1009 | // | |------------->| |
| 1010 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1011 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1012 | // | (same sub) | | |
| 1013 | // | (diff xid) | | |
| 1014 | // |------------->| | |
| 1015 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1016 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1017 | // | |<-------------| |
| 1018 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1019 | // | SubDelResp 1 | | |
| 1020 | // |<-------------| | |
| 1021 | // | | | |
| 1022 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1023 | // |<-------------| | |
| 1024 | // |
| 1025 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1026 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1027 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1028 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1029 | |
| 1030 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1031 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1032 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1033 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1034 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1035 | |
| 1036 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1037 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1038 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1039 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1040 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1041 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1042 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1043 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1044 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1045 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1046 | // hack as there is no real way to see has message be handled. |
| 1047 | // Previuos counter check just tells that is has been received by submgr |
| 1048 | // --> artificial delay |
| 1049 | <-time.After(1 * time.Second) |
| 1050 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1051 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1052 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1053 | |
| 1054 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1055 | xappConn1.RecvSubsDelResp(t, nil) |
| 1056 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1057 | |
| 1058 | //Wait that subs is cleaned |
| 1059 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1060 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1061 | xappConn1.TestMsgChanEmpty(t) |
| 1062 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1063 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1064 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1065 | } |
| 1066 | |
| 1067 | //----------------------------------------------------------------------------- |
| 1068 | // TestSubReqAndSubDelOkTwoParallel |
| 1069 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1070 | // stub stub stub |
| 1071 | // +-------+ +-------+ +---------+ +---------+ |
| 1072 | // | xapp | | xapp | | submgr | | e2term | |
| 1073 | // +-------+ +-------+ +---------+ +---------+ |
| 1074 | // | | | | |
| 1075 | // | | | | |
| 1076 | // | | | | |
| 1077 | // | | SubReq1 | | |
| 1078 | // | |------------->| | |
| 1079 | // | | | | |
| 1080 | // | | | SubReq1 | |
| 1081 | // | | |------------->| |
| 1082 | // | | | | |
| 1083 | // | SubReq2 | | |
| 1084 | // |------------------------>| | |
| 1085 | // | | | | |
| 1086 | // | | | SubReq2 | |
| 1087 | // | | |------------->| |
| 1088 | // | | | | |
| 1089 | // | | | SubResp1 | |
| 1090 | // | | |<-------------| |
| 1091 | // | | SubResp1 | | |
| 1092 | // | |<-------------| | |
| 1093 | // | | | | |
| 1094 | // | | | SubResp2 | |
| 1095 | // | | |<-------------| |
| 1096 | // | SubResp2 | | |
| 1097 | // |<------------------------| | |
| 1098 | // | | | | |
| 1099 | // | | [SUBS 1 DELETE] | |
| 1100 | // | | | | |
| 1101 | // | | [SUBS 2 DELETE] | |
| 1102 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1103 | // |
| 1104 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1105 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1106 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1107 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1108 | |
| 1109 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1110 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1111 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1112 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1113 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1114 | |
| 1115 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1116 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1117 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1118 | |
| 1119 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1120 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1121 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1122 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1124 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1125 | |
| 1126 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1127 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1128 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1129 | |
| 1130 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1131 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1132 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1133 | |
| 1134 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1135 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1136 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1137 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1138 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1139 | //Wait that subs is cleaned |
| 1140 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1141 | |
| 1142 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1143 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1144 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1145 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1146 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | //Wait that subs is cleaned |
| 1148 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1149 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1150 | xappConn1.TestMsgChanEmpty(t) |
| 1151 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1152 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1153 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1154 | } |
| 1155 | |
| 1156 | //----------------------------------------------------------------------------- |
| 1157 | // TestSameSubsDiffRan |
| 1158 | // Same subscription to different RANs |
| 1159 | // |
| 1160 | // stub stub |
| 1161 | // +-------+ +---------+ +---------+ |
| 1162 | // | xapp | | submgr | | e2term | |
| 1163 | // +-------+ +---------+ +---------+ |
| 1164 | // | | | |
| 1165 | // | | | |
| 1166 | // | | | |
| 1167 | // | SubReq(r1) | | |
| 1168 | // |------------->| | |
| 1169 | // | | | |
| 1170 | // | | SubReq(r1) | |
| 1171 | // | |------------->| |
| 1172 | // | | | |
| 1173 | // | | SubResp(r1) | |
| 1174 | // | |<-------------| |
| 1175 | // | | | |
| 1176 | // | SubResp(r1) | | |
| 1177 | // |<-------------| | |
| 1178 | // | | | |
| 1179 | // | SubReq(r2) | | |
| 1180 | // |------------->| | |
| 1181 | // | | | |
| 1182 | // | | SubReq(r2) | |
| 1183 | // | |------------->| |
| 1184 | // | | | |
| 1185 | // | | SubResp(r2) | |
| 1186 | // | |<-------------| |
| 1187 | // | | | |
| 1188 | // | SubResp(r2) | | |
| 1189 | // |<-------------| | |
| 1190 | // | | | |
| 1191 | // | [SUBS r1 DELETE] | |
| 1192 | // | | | |
| 1193 | // | [SUBS r2 DELETE] | |
| 1194 | // | | | |
| 1195 | // |
| 1196 | //----------------------------------------------------------------------------- |
| 1197 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1198 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1199 | |
| 1200 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1201 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1202 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1203 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1204 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1205 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1206 | |
| 1207 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1208 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1209 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1210 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1211 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1212 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1213 | |
| 1214 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1215 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1216 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1217 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1218 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1219 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1220 | //Wait that subs is cleaned |
| 1221 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1222 | |
| 1223 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1224 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1225 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1226 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1227 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1228 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1229 | //Wait that subs is cleaned |
| 1230 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1231 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1232 | xappConn1.TestMsgChanEmpty(t) |
| 1233 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1234 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1235 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | //----------------------------------------------------------------------------- |
| 1239 | // TestSubReqRetryInSubmgr |
| 1240 | // |
| 1241 | // stub stub |
| 1242 | // +-------+ +---------+ +---------+ |
| 1243 | // | xapp | | submgr | | e2term | |
| 1244 | // +-------+ +---------+ +---------+ |
| 1245 | // | | | |
| 1246 | // | SubReq | | |
| 1247 | // |------------->| | |
| 1248 | // | | | |
| 1249 | // | | SubReq | |
| 1250 | // | |------------->| |
| 1251 | // | | | |
| 1252 | // | | | |
| 1253 | // | | SubReq | |
| 1254 | // | |------------->| |
| 1255 | // | | | |
| 1256 | // | | SubResp | |
| 1257 | // | |<-------------| |
| 1258 | // | | | |
| 1259 | // | SubResp | | |
| 1260 | // |<-------------| | |
| 1261 | // | | | |
| 1262 | // | [SUBS DELETE] | |
| 1263 | // | | | |
| 1264 | // |
| 1265 | //----------------------------------------------------------------------------- |
| 1266 | |
| 1267 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1268 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1269 | |
| 1270 | // Init counter check |
| 1271 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1272 | Counter{cSubReqFromXapp, 1}, |
| 1273 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1274 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1275 | Counter{cSubReReqToE2, 1}, |
| 1276 | Counter{cSubRespFromE2, 1}, |
| 1277 | Counter{cSubRespToXapp, 1}, |
| 1278 | Counter{cSubDelReqFromXapp, 1}, |
| 1279 | Counter{cSubDelReqToE2, 1}, |
| 1280 | Counter{cSubDelRespFromE2, 1}, |
| 1281 | Counter{cSubDelRespToXapp, 1}, |
| 1282 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1283 | |
| 1284 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1285 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1286 | |
| 1287 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1288 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1289 | |
| 1290 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1291 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1292 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1293 | |
| 1294 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1295 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1296 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1297 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1298 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1299 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1300 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1301 | |
| 1302 | // Wait that subs is cleaned |
| 1303 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1304 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1305 | xappConn1.TestMsgChanEmpty(t) |
| 1306 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1307 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1308 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1309 | |
| 1310 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1311 | } |
| 1312 | |
| 1313 | //----------------------------------------------------------------------------- |
| 1314 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1315 | // |
| 1316 | // stub stub |
| 1317 | // +-------+ +---------+ +---------+ |
| 1318 | // | xapp | | submgr | | e2term | |
| 1319 | // +-------+ +---------+ +---------+ |
| 1320 | // | | | |
| 1321 | // | SubReq | | |
| 1322 | // |------------->| | |
| 1323 | // | | | |
| 1324 | // | | SubReq | |
| 1325 | // | |------------->| |
| 1326 | // | | | |
| 1327 | // | | | |
| 1328 | // | | SubReq | |
| 1329 | // | |------------->| |
| 1330 | // | | | |
| 1331 | // | | SubDelReq | |
| 1332 | // | |------------->| |
| 1333 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1334 | // | | SubDelResp | |
| 1335 | // | |<-------------| |
| 1336 | // | | | |
| 1337 | // |
| 1338 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1339 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1340 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1341 | |
| 1342 | // Init counter check |
| 1343 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1344 | Counter{cSubReqFromXapp, 1}, |
| 1345 | Counter{cSubReqToE2, 1}, |
| 1346 | Counter{cSubReReqToE2, 1}, |
| 1347 | Counter{cSubReqTimerExpiry, 2}, |
| 1348 | Counter{cSubDelReqToE2, 1}, |
| 1349 | Counter{cSubDelRespFromE2, 1}, |
| 1350 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1351 | |
| 1352 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1353 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1354 | |
| 1355 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1356 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1357 | |
| 1358 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1359 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1360 | |
| 1361 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1362 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1363 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1364 | |
| 1365 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1366 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1367 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1368 | xappConn1.TestMsgChanEmpty(t) |
| 1369 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1370 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1371 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1372 | |
| 1373 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1374 | } |
| 1375 | |
| 1376 | //----------------------------------------------------------------------------- |
| 1377 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1378 | // |
| 1379 | // stub stub |
| 1380 | // +-------+ +---------+ +---------+ |
| 1381 | // | xapp | | submgr | | e2term | |
| 1382 | // +-------+ +---------+ +---------+ |
| 1383 | // | | | |
| 1384 | // | SubReq | | |
| 1385 | // |------------->| | |
| 1386 | // | | | |
| 1387 | // | | SubReq | |
| 1388 | // | |------------->| |
| 1389 | // | | | |
| 1390 | // | | | |
| 1391 | // | | SubReq | |
| 1392 | // | |------------->| |
| 1393 | // | | | |
| 1394 | // | | SubDelReq | |
| 1395 | // | |------------->| |
| 1396 | // | | | |
| 1397 | // | | | |
| 1398 | // | | SubDelReq | |
| 1399 | // | |------------->| |
| 1400 | // | | | |
| 1401 | // | | | |
| 1402 | // |
| 1403 | //----------------------------------------------------------------------------- |
| 1404 | |
| 1405 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1406 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1407 | |
| 1408 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1409 | Counter{cSubReqFromXapp, 1}, |
| 1410 | Counter{cSubReqToE2, 1}, |
| 1411 | Counter{cSubReReqToE2, 1}, |
| 1412 | Counter{cSubReqTimerExpiry, 2}, |
| 1413 | Counter{cSubDelReqToE2, 1}, |
| 1414 | Counter{cSubDelReReqToE2, 1}, |
| 1415 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1416 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1417 | |
| 1418 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1419 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1420 | |
| 1421 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1422 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1423 | |
| 1424 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1425 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1426 | |
| 1427 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1428 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1429 | |
| 1430 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1431 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1432 | |
| 1433 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1434 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1435 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1436 | xappConn1.TestMsgChanEmpty(t) |
| 1437 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1438 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1439 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1440 | |
| 1441 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1442 | } |
| 1443 | |
| 1444 | //----------------------------------------------------------------------------- |
| 1445 | // TestSubReqSubFailRespInSubmgr |
| 1446 | // |
| 1447 | // stub stub |
| 1448 | // +-------+ +---------+ +---------+ |
| 1449 | // | xapp | | submgr | | e2term | |
| 1450 | // +-------+ +---------+ +---------+ |
| 1451 | // | | | |
| 1452 | // | SubReq | | |
| 1453 | // |------------->| | |
| 1454 | // | | | |
| 1455 | // | | SubReq | |
| 1456 | // | |------------->| |
| 1457 | // | | | |
| 1458 | // | | SubFail | |
| 1459 | // | |<-------------| |
| 1460 | // | | | |
| 1461 | // | SubFail | | |
| 1462 | // |<-------------| | |
| 1463 | // | | | |
| 1464 | // |
| 1465 | //----------------------------------------------------------------------------- |
| 1466 | |
| 1467 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1468 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1469 | |
| 1470 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1471 | Counter{cSubReqFromXapp, 1}, |
| 1472 | Counter{cSubReqToE2, 1}, |
| 1473 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1474 | Counter{cSubFailToXapp, 1}, |
| 1475 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1476 | |
| 1477 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1478 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1479 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1480 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1481 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1482 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1483 | fparams1.Set(crereq1) |
| 1484 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1485 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1486 | // Xapp: Receive SubsFail |
| 1487 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1488 | |
| 1489 | // Wait that subs is cleaned |
| 1490 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1491 | |
| 1492 | xappConn1.TestMsgChanEmpty(t) |
| 1493 | xappConn2.TestMsgChanEmpty(t) |
| 1494 | e2termConn1.TestMsgChanEmpty(t) |
| 1495 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1496 | |
| 1497 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1498 | } |
| 1499 | |
| 1500 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1501 | // TestSubDelReqRetryInSubmgr |
| 1502 | // |
| 1503 | // stub stub |
| 1504 | // +-------+ +---------+ +---------+ |
| 1505 | // | xapp | | submgr | | e2term | |
| 1506 | // +-------+ +---------+ +---------+ |
| 1507 | // | | | |
| 1508 | // | [SUBS CREATE] | |
| 1509 | // | | | |
| 1510 | // | | | |
| 1511 | // | SubDelReq | | |
| 1512 | // |------------->| | |
| 1513 | // | | | |
| 1514 | // | | SubDelReq | |
| 1515 | // | |------------->| |
| 1516 | // | | | |
| 1517 | // | | SubDelReq | |
| 1518 | // | |------------->| |
| 1519 | // | | | |
| 1520 | // | | SubDelResp | |
| 1521 | // | |<-------------| |
| 1522 | // | | | |
| 1523 | // | SubDelResp | | |
| 1524 | // |<-------------| | |
| 1525 | // |
| 1526 | //----------------------------------------------------------------------------- |
| 1527 | |
| 1528 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1529 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1530 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1531 | |
| 1532 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1533 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1534 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1535 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1536 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1537 | |
| 1538 | // Subs Delete |
| 1539 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1540 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1541 | |
| 1542 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1543 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1544 | |
| 1545 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1546 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1547 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1548 | |
| 1549 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1550 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1551 | |
| 1552 | // Wait that subs is cleaned |
| 1553 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1554 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1555 | xappConn1.TestMsgChanEmpty(t) |
| 1556 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1557 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1558 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1559 | } |
| 1560 | |
| 1561 | //----------------------------------------------------------------------------- |
| 1562 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1563 | // |
| 1564 | // stub stub |
| 1565 | // +-------+ +---------+ +---------+ |
| 1566 | // | xapp | | submgr | | e2term | |
| 1567 | // +-------+ +---------+ +---------+ |
| 1568 | // | | | |
| 1569 | // | [SUBS CREATE] | |
| 1570 | // | | | |
| 1571 | // | | | |
| 1572 | // | SubDelReq | | |
| 1573 | // |------------->| | |
| 1574 | // | | | |
| 1575 | // | | SubDelReq | |
| 1576 | // | |------------->| |
| 1577 | // | | | |
| 1578 | // | | SubDelReq | |
| 1579 | // | |------------->| |
| 1580 | // | | | |
| 1581 | // | | | |
| 1582 | // | SubDelResp | | |
| 1583 | // |<-------------| | |
| 1584 | // |
| 1585 | //----------------------------------------------------------------------------- |
| 1586 | |
| 1587 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1588 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1589 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1590 | |
| 1591 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1592 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1593 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1594 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1595 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1596 | |
| 1597 | // Subs Delete |
| 1598 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1599 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1600 | |
| 1601 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1602 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1603 | |
| 1604 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1605 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1606 | |
| 1607 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1608 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1609 | |
| 1610 | // Wait that subs is cleaned |
| 1611 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1612 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1613 | xappConn1.TestMsgChanEmpty(t) |
| 1614 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1615 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1616 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1617 | } |
| 1618 | |
| 1619 | //----------------------------------------------------------------------------- |
| 1620 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1621 | // |
| 1622 | // stub stub |
| 1623 | // +-------+ +---------+ +---------+ |
| 1624 | // | xapp | | submgr | | e2term | |
| 1625 | // +-------+ +---------+ +---------+ |
| 1626 | // | | | |
| 1627 | // | [SUBS CREATE] | |
| 1628 | // | | | |
| 1629 | // | | | |
| 1630 | // | SubDelReq | | |
| 1631 | // |------------->| | |
| 1632 | // | | | |
| 1633 | // | | SubDelReq | |
| 1634 | // | |------------->| |
| 1635 | // | | | |
| 1636 | // | | SubDelFail | |
| 1637 | // | |<-------------| |
| 1638 | // | | | |
| 1639 | // | SubDelResp | | |
| 1640 | // |<-------------| | |
| 1641 | // | | | |
| 1642 | // |
| 1643 | //----------------------------------------------------------------------------- |
| 1644 | |
| 1645 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1646 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1647 | |
| 1648 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1649 | Counter{cSubReqFromXapp, 1}, |
| 1650 | Counter{cSubReqToE2, 1}, |
| 1651 | Counter{cSubRespFromE2, 1}, |
| 1652 | Counter{cSubRespToXapp, 1}, |
| 1653 | Counter{cSubDelReqFromXapp, 1}, |
| 1654 | Counter{cSubDelReqToE2, 1}, |
| 1655 | Counter{cSubDelFailFromE2, 1}, |
| 1656 | Counter{cSubDelRespToXapp, 1}, |
| 1657 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1658 | |
| 1659 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1660 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1661 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1662 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1663 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1664 | |
| 1665 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1666 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1667 | |
| 1668 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1669 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1670 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1671 | |
| 1672 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1673 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1674 | |
| 1675 | // Wait that subs is cleaned |
| 1676 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1677 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1678 | xappConn1.TestMsgChanEmpty(t) |
| 1679 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1680 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1681 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1682 | |
| 1683 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1684 | } |
| 1685 | |
| 1686 | //----------------------------------------------------------------------------- |
| 1687 | // TestSubReqAndSubDelOkSameAction |
| 1688 | // |
| 1689 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1690 | // +-------+ +-------+ +---------+ +---------+ |
| 1691 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1692 | // +-------+ +-------+ +---------+ +---------+ |
| 1693 | // | | | | |
| 1694 | // | | | | |
| 1695 | // | | | | |
| 1696 | // | | SubReq1 | | |
| 1697 | // | |------------->| | |
| 1698 | // | | | | |
| 1699 | // | | | SubReq1 | |
| 1700 | // | | |------------->| |
| 1701 | // | | | SubResp1 | |
| 1702 | // | | |<-------------| |
| 1703 | // | | SubResp1 | | |
| 1704 | // | |<-------------| | |
| 1705 | // | | | | |
| 1706 | // | SubReq2 | | |
| 1707 | // |--------------------------->| | |
| 1708 | // | | | | |
| 1709 | // | SubResp2 | | |
| 1710 | // |<---------------------------| | |
| 1711 | // | | | | |
| 1712 | // | | SubDelReq 1 | | |
| 1713 | // | |------------->| | |
| 1714 | // | | | | |
| 1715 | // | | SubDelResp 1 | | |
| 1716 | // | |<-------------| | |
| 1717 | // | | | | |
| 1718 | // | SubDelReq 2 | | |
| 1719 | // |--------------------------->| | |
| 1720 | // | | | | |
| 1721 | // | | | SubDelReq 2 | |
| 1722 | // | | |------------->| |
| 1723 | // | | | | |
| 1724 | // | | | SubDelReq 2 | |
| 1725 | // | | |------------->| |
| 1726 | // | | | | |
| 1727 | // | SubDelResp 2 | | |
| 1728 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1729 | // |
| 1730 | //----------------------------------------------------------------------------- |
| 1731 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1732 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1733 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1734 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1735 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1736 | Counter{cSubReqFromXapp, 2}, |
| 1737 | Counter{cSubReqToE2, 1}, |
| 1738 | Counter{cSubRespFromE2, 1}, |
| 1739 | Counter{cSubRespToXapp, 2}, |
| 1740 | Counter{cMergedSubscriptions, 1}, |
| 1741 | Counter{cUnmergedSubscriptions, 1}, |
| 1742 | Counter{cSubDelReqFromXapp, 2}, |
| 1743 | Counter{cSubDelReqToE2, 1}, |
| 1744 | Counter{cSubDelRespFromE2, 1}, |
| 1745 | Counter{cSubDelRespToXapp, 2}, |
| 1746 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1747 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1748 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1749 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1750 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1751 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1752 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1753 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1754 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1755 | |
| 1756 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1757 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1758 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1759 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1760 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1761 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1762 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1763 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1764 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1765 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1766 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1767 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1769 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1770 | |
| 1771 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1773 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1774 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1775 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1776 | //Wait that subs is cleaned |
| 1777 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1778 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1779 | xappConn1.TestMsgChanEmpty(t) |
| 1780 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1781 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1782 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1783 | |
| 1784 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1785 | } |
| 1786 | |
| 1787 | //----------------------------------------------------------------------------- |
| 1788 | // TestSubReqAndSubDelOkSameActionParallel |
| 1789 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1790 | // stub stub stub |
| 1791 | // +-------+ +-------+ +---------+ +---------+ |
| 1792 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1793 | // +-------+ +-------+ +---------+ +---------+ |
| 1794 | // | | | | |
| 1795 | // | | | | |
| 1796 | // | | | | |
| 1797 | // | | SubReq1 | | |
| 1798 | // | |------------->| | |
| 1799 | // | | | | |
| 1800 | // | | | SubReq1 | |
| 1801 | // | | |------------->| |
| 1802 | // | SubReq2 | | |
| 1803 | // |--------------------------->| | |
| 1804 | // | | | SubResp1 | |
| 1805 | // | | |<-------------| |
| 1806 | // | | SubResp1 | | |
| 1807 | // | |<-------------| | |
| 1808 | // | | | | |
| 1809 | // | SubResp2 | | |
| 1810 | // |<---------------------------| | |
| 1811 | // | | | | |
| 1812 | // | | SubDelReq 1 | | |
| 1813 | // | |------------->| | |
| 1814 | // | | | | |
| 1815 | // | | SubDelResp 1 | | |
| 1816 | // | |<-------------| | |
| 1817 | // | | | | |
| 1818 | // | SubDelReq 2 | | |
| 1819 | // |--------------------------->| | |
| 1820 | // | | | | |
| 1821 | // | | | SubDelReq 2 | |
| 1822 | // | | |------------->| |
| 1823 | // | | | | |
| 1824 | // | | | SubDelReq 2 | |
| 1825 | // | | |------------->| |
| 1826 | // | | | | |
| 1827 | // | SubDelResp 2 | | |
| 1828 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1829 | // |
| 1830 | //----------------------------------------------------------------------------- |
| 1831 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1832 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1833 | |
| 1834 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1835 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1836 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1837 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1838 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1839 | |
| 1840 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1841 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1842 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1843 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1844 | |
| 1845 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1846 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1847 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1848 | |
| 1849 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1850 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1851 | |
| 1852 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1853 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1854 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1855 | |
| 1856 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1857 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1858 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1859 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1860 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1861 | |
| 1862 | //Wait that subs is cleaned |
| 1863 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1864 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1865 | xappConn1.TestMsgChanEmpty(t) |
| 1866 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1867 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1868 | mainCtrl.wait_registry_empty(t, 10) |
| 1869 | } |
| 1870 | |
| 1871 | //----------------------------------------------------------------------------- |
| 1872 | // TestSubReqAndSubDelNokSameActionParallel |
| 1873 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1874 | // stub stub stub |
| 1875 | // +-------+ +-------+ +---------+ +---------+ |
| 1876 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1877 | // +-------+ +-------+ +---------+ +---------+ |
| 1878 | // | | | | |
| 1879 | // | | | | |
| 1880 | // | | | | |
| 1881 | // | | SubReq1 | | |
| 1882 | // | |------------->| | |
| 1883 | // | | | | |
| 1884 | // | | | SubReq1 | |
| 1885 | // | | |------------->| |
| 1886 | // | SubReq2 | | |
| 1887 | // |--------------------------->| | |
| 1888 | // | | | SubFail1 | |
| 1889 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1890 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1891 | // | | SubFail1 | | |
| 1892 | // | |<-------------| | |
| 1893 | // | | | | |
| 1894 | // | SubFail2 | | |
| 1895 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1896 | // |
| 1897 | //----------------------------------------------------------------------------- |
| 1898 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1899 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1900 | |
| 1901 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1902 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1903 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1904 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1905 | |
| 1906 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1907 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1908 | |
| 1909 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1910 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1911 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1912 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1913 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1914 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1915 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1916 | // E2t: send SubsFail (first) |
| 1917 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1918 | fparams1.Set(crereq1) |
| 1919 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1920 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1921 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1922 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1923 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1924 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1925 | |
| 1926 | //Wait that subs is cleaned |
| 1927 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1928 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1929 | xappConn1.TestMsgChanEmpty(t) |
| 1930 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1931 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1932 | mainCtrl.wait_registry_empty(t, 10) |
| 1933 | } |
| 1934 | |
| 1935 | //----------------------------------------------------------------------------- |
| 1936 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1937 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1938 | // stub stub stub |
| 1939 | // +-------+ +-------+ +---------+ +---------+ |
| 1940 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1941 | // +-------+ +-------+ +---------+ +---------+ |
| 1942 | // | | | | |
| 1943 | // | | | | |
| 1944 | // | | | | |
| 1945 | // | | SubReq1 | | |
| 1946 | // | |------------->| | |
| 1947 | // | | | | |
| 1948 | // | | | SubReq1 | |
| 1949 | // | | |------------->| |
| 1950 | // | | SubReq2 | | |
| 1951 | // |--------------------------->| | |
| 1952 | // | | | | |
| 1953 | // | | | SubReq1 | |
| 1954 | // | | |------------->| |
| 1955 | // | | | | |
| 1956 | // | | | | |
| 1957 | // | | | SubDelReq | |
| 1958 | // | | |------------->| |
| 1959 | // | | | | |
| 1960 | // | | | SubDelResp | |
| 1961 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1962 | // |
| 1963 | //----------------------------------------------------------------------------- |
| 1964 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1965 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1966 | |
| 1967 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1968 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1969 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1970 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1971 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1972 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1973 | |
| 1974 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1975 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1976 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1977 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1978 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1979 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1980 | |
| 1981 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1982 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1983 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1984 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1985 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1986 | |
| 1987 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1988 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1989 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1990 | xappConn1.TestMsgChanEmpty(t) |
| 1991 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1992 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1993 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1994 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1995 | |
| 1996 | //----------------------------- Policy cases --------------------------------- |
| 1997 | //----------------------------------------------------------------------------- |
| 1998 | // TestSubReqPolicyAndSubDelOk |
| 1999 | // |
| 2000 | // stub stub |
| 2001 | // +-------+ +---------+ +---------+ |
| 2002 | // | xapp | | submgr | | e2term | |
| 2003 | // +-------+ +---------+ +---------+ |
| 2004 | // | | | |
| 2005 | // | SubReq | | |
| 2006 | // |------------->| | |
| 2007 | // | | | |
| 2008 | // | | SubReq | |
| 2009 | // | |------------->| |
| 2010 | // | | | |
| 2011 | // | | SubResp | |
| 2012 | // | |<-------------| |
| 2013 | // | | | |
| 2014 | // | SubResp | | |
| 2015 | // |<-------------| | |
| 2016 | // | | | |
| 2017 | // | | | |
| 2018 | // | SubDelReq | | |
| 2019 | // |------------->| | |
| 2020 | // | | | |
| 2021 | // | | SubDelReq | |
| 2022 | // | |------------->| |
| 2023 | // | | | |
| 2024 | // | | SubDelResp | |
| 2025 | // | |<-------------| |
| 2026 | // | | | |
| 2027 | // | SubDelResp | | |
| 2028 | // |<-------------| | |
| 2029 | // |
| 2030 | //----------------------------------------------------------------------------- |
| 2031 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2032 | CaseBegin("TestSubReqAndSubDelOk") |
| 2033 | |
| 2034 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2035 | rparams1.Init() |
| 2036 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2037 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2038 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2039 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2040 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2041 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2042 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2043 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2044 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2045 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2046 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2047 | |
| 2048 | //Wait that subs is cleaned |
| 2049 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2050 | |
| 2051 | xappConn1.TestMsgChanEmpty(t) |
| 2052 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2053 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2054 | mainCtrl.wait_registry_empty(t, 10) |
| 2055 | } |
| 2056 | |
| 2057 | //----------------------------------------------------------------------------- |
| 2058 | // TestSubReqPolicyChangeAndSubDelOk |
| 2059 | // |
| 2060 | // stub stub |
| 2061 | // +-------+ +---------+ +---------+ |
| 2062 | // | xapp | | submgr | | e2term | |
| 2063 | // +-------+ +---------+ +---------+ |
| 2064 | // | | | |
| 2065 | // | SubReq | | |
| 2066 | // |------------->| | |
| 2067 | // | | | |
| 2068 | // | | SubReq | |
| 2069 | // | |------------->| |
| 2070 | // | | | |
| 2071 | // | | SubResp | |
| 2072 | // | |<-------------| |
| 2073 | // | | | |
| 2074 | // | SubResp | | |
| 2075 | // |<-------------| | |
| 2076 | // | | | |
| 2077 | // | SubReq | | |
| 2078 | // |------------->| | |
| 2079 | // | | | |
| 2080 | // | | SubReq | |
| 2081 | // | |------------->| |
| 2082 | // | | | |
| 2083 | // | | SubResp | |
| 2084 | // | |<-------------| |
| 2085 | // | | | |
| 2086 | // | SubResp | | |
| 2087 | // |<-------------| | |
| 2088 | // | | | |
| 2089 | // | SubDelReq | | |
| 2090 | // |------------->| | |
| 2091 | // | | | |
| 2092 | // | | SubDelReq | |
| 2093 | // | |------------->| |
| 2094 | // | | | |
| 2095 | // | | SubDelResp | |
| 2096 | // | |<-------------| |
| 2097 | // | | | |
| 2098 | // | SubDelResp | | |
| 2099 | // |<-------------| | |
| 2100 | // |
| 2101 | //----------------------------------------------------------------------------- |
| 2102 | |
| 2103 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2104 | CaseBegin("TestSubReqAndSubDelOk") |
| 2105 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2106 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2107 | rparams1.Init() |
| 2108 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2109 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2110 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2111 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2112 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2113 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2114 | |
| 2115 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2116 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2117 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2118 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2119 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2120 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2121 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2122 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2123 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2124 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2125 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2126 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2127 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2128 | |
| 2129 | //Wait that subs is cleaned |
| 2130 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2131 | |
| 2132 | xappConn1.TestMsgChanEmpty(t) |
| 2133 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2134 | e2termConn1.TestMsgChanEmpty(t) |
| 2135 | mainCtrl.wait_registry_empty(t, 10) |
| 2136 | } |
| 2137 | |
| 2138 | //----------------------------------------------------------------------------- |
| 2139 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2140 | // |
| 2141 | // stub stub stub |
| 2142 | // +-------+ +---------+ +---------+ +---------+ |
| 2143 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2144 | // +-------+ +---------+ +---------+ +---------+ |
| 2145 | // | | | | |
| 2146 | // | | | | |
| 2147 | // | | | | |
| 2148 | // | SubReq1 | | | |
| 2149 | // |------------->| | | |
| 2150 | // | | | | |
| 2151 | // | | SubReq1 | | |
| 2152 | // | |------------->| | |
| 2153 | // | | | | |
| 2154 | // | SubReq2 | | | |
| 2155 | // |------------->| | | |
| 2156 | // | | | | |
| 2157 | // | | SubReq2 | | |
| 2158 | // | |---------------------------->| |
| 2159 | // | | | | |
| 2160 | // | | SubResp1 | | |
| 2161 | // | |<-------------| | |
| 2162 | // | SubResp1 | | | |
| 2163 | // |<-------------| | | |
| 2164 | // | | SubResp2 | | |
| 2165 | // | |<----------------------------| |
| 2166 | // | SubResp2 | | | |
| 2167 | // |<-------------| | | |
| 2168 | // | | | | |
| 2169 | // | [SUBS 1 DELETE] | | |
| 2170 | // | | | | |
| 2171 | // | [SUBS 2 DELETE] | | |
| 2172 | // | | | | |
| 2173 | // |
| 2174 | //----------------------------------------------------------------------------- |
| 2175 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2176 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2177 | |
| 2178 | //Req1 |
| 2179 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2180 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2181 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2182 | |
| 2183 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2184 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2185 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2186 | |
| 2187 | //Resp1 |
| 2188 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2189 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2190 | |
| 2191 | //Resp2 |
| 2192 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2193 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2194 | |
| 2195 | //Del1 |
| 2196 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2197 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2198 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2199 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2200 | //Wait that subs is cleaned |
| 2201 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2202 | |
| 2203 | //Del2 |
| 2204 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2205 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2206 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2207 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2208 | //Wait that subs is cleaned |
| 2209 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2210 | |
| 2211 | xappConn1.TestMsgChanEmpty(t) |
| 2212 | xappConn2.TestMsgChanEmpty(t) |
| 2213 | e2termConn1.TestMsgChanEmpty(t) |
| 2214 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2215 | mainCtrl.wait_registry_empty(t, 10) |
| 2216 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2217 | |
| 2218 | //----------------------------------------------------------------------------- |
| 2219 | // TestSubReqInsertAndSubDelOk |
| 2220 | // |
| 2221 | // stub stub |
| 2222 | // +-------+ +---------+ +---------+ |
| 2223 | // | xapp | | submgr | | e2term | |
| 2224 | // +-------+ +---------+ +---------+ |
| 2225 | // | | | |
| 2226 | // | SubReq | | |
| 2227 | // |------------->| | |
| 2228 | // | | | |
| 2229 | // | | SubReq | |
| 2230 | // | |------------->| |
| 2231 | // | | | |
| 2232 | // | | SubResp | |
| 2233 | // | |<-------------| |
| 2234 | // | | | |
| 2235 | // | SubResp | | |
| 2236 | // |<-------------| | |
| 2237 | // | | | |
| 2238 | // | | | |
| 2239 | // | SubDelReq | | |
| 2240 | // |------------->| | |
| 2241 | // | | | |
| 2242 | // | | SubDelReq | |
| 2243 | // | |------------->| |
| 2244 | // | | | |
| 2245 | // | | SubDelResp | |
| 2246 | // | |<-------------| |
| 2247 | // | | | |
| 2248 | // | SubDelResp | | |
| 2249 | // |<-------------| | |
| 2250 | // |
| 2251 | //----------------------------------------------------------------------------- |
| 2252 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2253 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2254 | |
| 2255 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2256 | rparams1.Init() |
| 2257 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2258 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2259 | |
| 2260 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2261 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2262 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2263 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2264 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2265 | |
| 2266 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2267 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2268 | |
| 2269 | //Wait that subs is cleaned |
| 2270 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2271 | |
| 2272 | xappConn1.TestMsgChanEmpty(t) |
| 2273 | xappConn2.TestMsgChanEmpty(t) |
| 2274 | e2termConn1.TestMsgChanEmpty(t) |
| 2275 | mainCtrl.wait_registry_empty(t, 10) |
| 2276 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2277 | |
| 2278 | //----------------------------------------------------------------------------- |
| 2279 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2280 | // |
| 2281 | // This case simulates case where xApp restarts and starts sending same |
| 2282 | // subscription requests which have already subscribed successfully |
| 2283 | |
| 2284 | // stub stub |
| 2285 | // +-------+ +---------+ +---------+ |
| 2286 | // | xapp | | submgr | | e2term | |
| 2287 | // +-------+ +---------+ +---------+ |
| 2288 | // | | | |
| 2289 | // | SubReq | | |
| 2290 | // |------------->| | |
| 2291 | // | | | |
| 2292 | // | | SubReq | |
| 2293 | // | |------------->| |
| 2294 | // | | | |
| 2295 | // | | SubResp | |
| 2296 | // | |<-------------| |
| 2297 | // | | | |
| 2298 | // | SubResp | | |
| 2299 | // |<-------------| | |
| 2300 | // | | | |
| 2301 | // | xApp restart | | |
| 2302 | // | | | |
| 2303 | // | SubReq | | |
| 2304 | // | (retrans with same xApp generated subid but diff xid) |
| 2305 | // |------------->| | |
| 2306 | // | | | |
| 2307 | // | SubResp | | |
| 2308 | // |<-------------| | |
| 2309 | // | | | |
| 2310 | // | [SUBS DELETE] | |
| 2311 | // | | | |
| 2312 | // |
| 2313 | //----------------------------------------------------------------------------- |
| 2314 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2315 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2316 | |
| 2317 | //Subs Create |
| 2318 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2319 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2320 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2321 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2322 | |
| 2323 | // xApp restart here |
| 2324 | // --> artificial delay |
| 2325 | <-time.After(1 * time.Second) |
| 2326 | |
| 2327 | //Subs Create |
| 2328 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2329 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2330 | |
| 2331 | //Subs Delete |
| 2332 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2333 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2334 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2335 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2336 | |
| 2337 | //Wait that subs is cleaned |
| 2338 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2339 | |
| 2340 | xappConn1.TestMsgChanEmpty(t) |
| 2341 | xappConn2.TestMsgChanEmpty(t) |
| 2342 | e2termConn1.TestMsgChanEmpty(t) |
| 2343 | mainCtrl.wait_registry_empty(t, 10) |
| 2344 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2345 | |
| 2346 | //----------------------------------------------------------------------------- |
| 2347 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2348 | // |
| 2349 | // stub stub |
| 2350 | // +-------+ +---------+ +---------+ |
| 2351 | // | xapp | | submgr | | e2term | |
| 2352 | // +-------+ +---------+ +---------+ |
| 2353 | // | | | |
| 2354 | // | SubReq | | |
| 2355 | // |------------->| | |
| 2356 | // | | | |
| 2357 | // | | SubReq | |
| 2358 | // | |------------->| |
| 2359 | // | | | |
| 2360 | // | | SubResp | |
| 2361 | // | <----| |
| 2362 | // | | |
| 2363 | // | Submgr restart | |
| 2364 | // | | |
| 2365 | // | | | |
| 2366 | // | | SubDelReq | |
| 2367 | // | |------------->| |
| 2368 | // | | | |
| 2369 | // | | SubDelResp | |
| 2370 | // | |<-------------| |
| 2371 | // | | | |
| 2372 | // |
| 2373 | //----------------------------------------------------------------------------- |
| 2374 | |
| 2375 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2376 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2377 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2378 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2379 | xappConn1.SendSubsReq(t, nil, nil) |
| 2380 | e2termConn1.RecvSubsReq(t) |
| 2381 | mainCtrl.SetResetTestFlag(t, false) |
| 2382 | |
| 2383 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2384 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2385 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2386 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2387 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2388 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2389 | mainCtrl.SimulateRestart(t) |
| 2390 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2391 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2392 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2393 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2394 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2395 | |
| 2396 | // Wait that subs is cleaned |
| 2397 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2398 | |
| 2399 | xappConn1.TestMsgChanEmpty(t) |
| 2400 | xappConn2.TestMsgChanEmpty(t) |
| 2401 | e2termConn1.TestMsgChanEmpty(t) |
| 2402 | mainCtrl.wait_registry_empty(t, 10) |
| 2403 | } |
| 2404 | |
| 2405 | //----------------------------------------------------------------------------- |
| 2406 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2407 | // |
| 2408 | // stub stub |
| 2409 | // +-------+ +---------+ +---------+ |
| 2410 | // | xapp | | submgr | | e2term | |
| 2411 | // +-------+ +---------+ +---------+ |
| 2412 | // | | | |
| 2413 | // | SubReq | | |
| 2414 | // |------------->| | |
| 2415 | // | | | |
| 2416 | // | | SubReq | |
| 2417 | // | |------------->| |
| 2418 | // | | | |
| 2419 | // | | SubResp | |
| 2420 | // | |<-------------| |
| 2421 | // | | | |
| 2422 | // | SubResp | | |
| 2423 | // |<-------------| | |
| 2424 | // | | | |
| 2425 | // | | |
| 2426 | // | Submgr restart | |
| 2427 | // | | |
| 2428 | // | SubDelReq | | |
| 2429 | // |------------->| | |
| 2430 | // | | | |
| 2431 | // | | SubDelReq | |
| 2432 | // | |------------->| |
| 2433 | // | | | |
| 2434 | // | | SubDelResp | |
| 2435 | // | |<-------------| |
| 2436 | // | | | |
| 2437 | // | SubDelResp | | |
| 2438 | // |<-------------| | |
| 2439 | // |
| 2440 | //----------------------------------------------------------------------------- |
| 2441 | |
| 2442 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2443 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2444 | |
| 2445 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2446 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2447 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2448 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2449 | |
| 2450 | // Check subscription |
| 2451 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2452 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2453 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2454 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2455 | |
| 2456 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2457 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2458 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 2459 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2460 | // That needs to be completed before successful subscription query is possible |
| 2461 | <-time.After(time.Second * 1) |
| 2462 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2463 | // Check that subscription is restored correctly after restart |
| 2464 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2465 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2466 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2467 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2468 | |
| 2469 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2470 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2471 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2472 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2473 | |
| 2474 | //Wait that subs is cleaned |
| 2475 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2476 | |
| 2477 | xappConn1.TestMsgChanEmpty(t) |
| 2478 | xappConn2.TestMsgChanEmpty(t) |
| 2479 | e2termConn1.TestMsgChanEmpty(t) |
| 2480 | mainCtrl.wait_registry_empty(t, 10) |
| 2481 | } |
| 2482 | |
| 2483 | //----------------------------------------------------------------------------- |
| 2484 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2485 | // |
| 2486 | // stub stub |
| 2487 | // +-------+ +-------+ +---------+ +---------+ |
| 2488 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2489 | // +-------+ +-------+ +---------+ +---------+ |
| 2490 | // | | | | |
| 2491 | // | | | | |
| 2492 | // | | | | |
| 2493 | // | | SubReq1 | | |
| 2494 | // | |------------->| | |
| 2495 | // | | | | |
| 2496 | // | | | SubReq1 | |
| 2497 | // | | |------------->| |
| 2498 | // | | | SubResp1 | |
| 2499 | // | | |<-------------| |
| 2500 | // | | SubResp1 | | |
| 2501 | // | |<-------------| | |
| 2502 | // | | | | |
| 2503 | // | | |
| 2504 | // | submgr restart | |
| 2505 | // | | |
| 2506 | // | | | | |
| 2507 | // | | | | |
| 2508 | // | SubReq2 | | |
| 2509 | // |--------------------------->| | |
| 2510 | // | | | | |
| 2511 | // | SubResp2 | | |
| 2512 | // |<---------------------------| | |
| 2513 | // | | | | |
| 2514 | // | | SubDelReq 1 | | |
| 2515 | // | |------------->| | |
| 2516 | // | | | | |
| 2517 | // | | SubDelResp 1 | | |
| 2518 | // | |<-------------| | |
| 2519 | // | | | | |
| 2520 | // | | | | |
| 2521 | // | | |
| 2522 | // | submgr restart | |
| 2523 | // | | |
| 2524 | // | | | | |
| 2525 | // | SubDelReq 2 | | |
| 2526 | // |--------------------------->| | |
| 2527 | // | | | | |
| 2528 | // | | | SubDelReq 2 | |
| 2529 | // | | |------------->| |
| 2530 | // | | | | |
| 2531 | // | | | SubDelReq 2 | |
| 2532 | // | | |------------->| |
| 2533 | // | | | | |
| 2534 | // | SubDelResp 2 | | |
| 2535 | // |<---------------------------| | |
| 2536 | // |
| 2537 | //----------------------------------------------------------------------------- |
| 2538 | |
| 2539 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2540 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2541 | |
| 2542 | //Req1 |
| 2543 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2544 | rparams1.Init() |
| 2545 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2546 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2547 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2548 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2549 | |
| 2550 | //Req2 |
| 2551 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2552 | rparams2.Init() |
| 2553 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2554 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2555 | |
| 2556 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 2557 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2558 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2559 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2560 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2561 | |
| 2562 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2563 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2564 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 2565 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2566 | // That needs to be completed before successful subscription query is possible |
| 2567 | <-time.After(time.Second * 1) |
| 2568 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2569 | // Check that subscription is restored correctly after restart |
| 2570 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2571 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2572 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2573 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2574 | |
| 2575 | //Del1 |
| 2576 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2577 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2578 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2579 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2580 | |
| 2581 | mainCtrl.SimulateRestart(t) |
| 2582 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2583 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 2584 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2585 | // Submgr need be ready before successful subscription deletion is possible |
| 2586 | <-time.After(time.Second * 1) |
| 2587 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2588 | //Del2 |
| 2589 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2590 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2591 | |
| 2592 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2593 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2594 | |
| 2595 | //Wait that subs is cleaned |
| 2596 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2597 | |
| 2598 | xappConn1.TestMsgChanEmpty(t) |
| 2599 | xappConn2.TestMsgChanEmpty(t) |
| 2600 | e2termConn1.TestMsgChanEmpty(t) |
| 2601 | mainCtrl.wait_registry_empty(t, 10) |
| 2602 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2603 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2604 | //***************************************************************************** |
| 2605 | // REST interface test cases |
| 2606 | //***************************************************************************** |
| 2607 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2608 | //----------------------------------------------------------------------------- |
| 2609 | // Test debug GET and POST requests |
| 2610 | // |
| 2611 | // curl |
| 2612 | // +-------+ +---------+ |
| 2613 | // | user | | submgr | |
| 2614 | // +-------+ +---------+ |
| 2615 | // | | |
| 2616 | // | GET/POST Req | |
| 2617 | // |------------->| |
| 2618 | // | Resp | |
| 2619 | // |<-------------| |
| 2620 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2621 | func TestGetSubscriptions(t *testing.T) { |
| 2622 | |
| 2623 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2624 | } |
| 2625 | |
| 2626 | func TestGetSymptomData(t *testing.T) { |
| 2627 | |
| 2628 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2629 | } |
| 2630 | |
| 2631 | func TestPostdeleteSubId(t *testing.T) { |
| 2632 | |
| 2633 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2634 | } |
| 2635 | |
| 2636 | func TestPostEmptyDb(t *testing.T) { |
| 2637 | |
| 2638 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2639 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2640 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2641 | func TestGetRestSubscriptions(t *testing.T) { |
| 2642 | |
| 2643 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2644 | } |
| 2645 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2646 | //----------------------------------------------------------------------------- |
| 2647 | // TestRESTSubReqAndRouteNok |
| 2648 | // |
| 2649 | // stub stub |
| 2650 | // +-------+ +---------+ +---------+ |
| 2651 | // | xapp | | submgr | | rtmgr | |
| 2652 | // +-------+ +---------+ +---------+ |
| 2653 | // | | | |
| 2654 | // | RESTSubReq | | |
| 2655 | // |---------------->| | |
| 2656 | // | | | |
| 2657 | // | RESTSubResp | | |
| 2658 | // |<----------------| | |
| 2659 | // | | RouteCreate | |
| 2660 | // | |------------->| |
| 2661 | // | | | |
| 2662 | // | | RouteCreate | |
| 2663 | // | | status:400 | |
| 2664 | // | |(Bad request) | |
| 2665 | // | |<-------------| |
| 2666 | // | RESTNotif | | |
| 2667 | // |<----------------| | |
| 2668 | // | | | |
| 2669 | // | [SUBS INT DELETE] | |
| 2670 | // | | | |
| 2671 | // | RESTSubDelReq | | |
| 2672 | // |---------------->| | |
| 2673 | // | RESTSubDelResp | | |
| 2674 | // |<----------------| | |
| 2675 | // |
| 2676 | //----------------------------------------------------------------------------- |
| 2677 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2678 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2679 | |
| 2680 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2681 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2682 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2683 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2684 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2685 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2686 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2687 | }) |
| 2688 | |
| 2689 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2690 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2691 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2692 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2693 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2694 | |
| 2695 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2696 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2697 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2698 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2699 | waiter.WaitResult(t) |
| 2700 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2701 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2702 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2703 | |
| 2704 | // Del |
| 2705 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2706 | |
| 2707 | // Wait that subs is cleaned |
| 2708 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2709 | waitSubsCleanup(t, e2SubsId, 10) |
| 2710 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2711 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2712 | } |
| 2713 | |
| 2714 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2715 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2716 | |
| 2717 | //Init counter check |
| 2718 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2719 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2720 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2721 | Counter{cSubReqToE2, 1}, |
| 2722 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2723 | Counter{cRestSubNotifToXapp, 1}, |
| 2724 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2725 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2726 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2727 | Counter{cSubDelReqToE2, 1}, |
| 2728 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2729 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2730 | }) |
| 2731 | |
| 2732 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2733 | |
| 2734 | //Subs Create |
| 2735 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2736 | |
| 2737 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2738 | |
| 2739 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2740 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2741 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2742 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2743 | params.SetMeid("RAN_NAME_1") |
| 2744 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2745 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2746 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2747 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2748 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2749 | |
| 2750 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2751 | |
| 2752 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2753 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2754 | |
| 2755 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2756 | //Wait that subs is cleaned |
| 2757 | waitSubsCleanup(t, e2SubsId, 10) |
| 2758 | |
| 2759 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2760 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2761 | } |
| 2762 | |
| 2763 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2764 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2765 | |
| 2766 | // Init counter check |
| 2767 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2768 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2769 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2770 | Counter{cSubReqToE2, 1}, |
| 2771 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2772 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2773 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2774 | Counter{cRouteDeleteFail, 1}, |
| 2775 | Counter{cSubDelReqToE2, 1}, |
| 2776 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2777 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2778 | }) |
| 2779 | |
| 2780 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2781 | |
| 2782 | //Subs Create |
| 2783 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2784 | |
| 2785 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2786 | |
| 2787 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2788 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2789 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2790 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2791 | waiter.WaitResult(t) |
| 2792 | |
| 2793 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2794 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2795 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2796 | } |
| 2797 | |
| 2798 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2799 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2800 | |
| 2801 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2802 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2803 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2804 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2805 | Counter{cSubReqToE2, 1}, |
| 2806 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2807 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2808 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2809 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2810 | Counter{cSubDelReqToE2, 1}, |
| 2811 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2812 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2813 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2814 | }) |
| 2815 | |
| 2816 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2817 | |
| 2818 | //Subs Create |
| 2819 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2820 | |
| 2821 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2822 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2823 | |
| 2824 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2825 | |
| 2826 | //Del1, this shall fail on rtmgr side |
| 2827 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2828 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2829 | waiter.WaitResult(t) |
| 2830 | |
| 2831 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2832 | |
| 2833 | //Del2 |
| 2834 | deleteXapp2Subscription(t, &restSubId2) |
| 2835 | |
| 2836 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2837 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2838 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2839 | } |
| 2840 | |
| 2841 | //----------------------------------------------------------------------------- |
| 2842 | // TestRESTSubReqRetransmission |
| 2843 | // |
| 2844 | // stub stub |
| 2845 | // +-------+ +---------+ +---------+ |
| 2846 | // | xapp | | submgr | | e2term | |
| 2847 | // +-------+ +---------+ +---------+ |
| 2848 | // | | | |
| 2849 | // | RESTSubReq1 | | |
| 2850 | // |---------------->| | |
| 2851 | // | | | |
| 2852 | // | RESTSubResp | | |
| 2853 | // |<----------------| | |
| 2854 | // | | SubReq1 | |
| 2855 | // | |------------->| |
| 2856 | // | | | |
| 2857 | // | RESTSubReq2 | | |
| 2858 | // | (retrans) | | |
| 2859 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2860 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2861 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2862 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2863 | // | | SubResp1 | |
| 2864 | // | |<-------------| |
| 2865 | // | RESTNotif1 | | |
| 2866 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2867 | // | | | |
| 2868 | // | [SUBS DELETE] | |
| 2869 | // | | | |
| 2870 | // |
| 2871 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2872 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2873 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2874 | CaseBegin("TestRESTSubReqRetransmission") |
| 2875 | |
| 2876 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2877 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2878 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2879 | Counter{cSubReqToE2, 1}, |
| 2880 | Counter{cSubRespFromE2, 1}, |
| 2881 | Counter{cRestSubNotifToXapp, 1}, |
| 2882 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2883 | Counter{cSubDelReqToE2, 1}, |
| 2884 | Counter{cSubDelRespFromE2, 1}, |
| 2885 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2886 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2887 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2888 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2889 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2890 | |
| 2891 | // Subs Create |
| 2892 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2893 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2894 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2895 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2896 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2897 | xappConn1.SendRESTSubsReq(t, params) |
| 2898 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2899 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2900 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2901 | |
| 2902 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2903 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2904 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2905 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2906 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2907 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 2908 | |
| 2909 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2910 | |
| 2911 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2912 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2913 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2914 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2915 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2916 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2917 | |
| 2918 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2919 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2920 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2921 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2922 | //----------------------------------------------------------------------------- |
| 2923 | // stub stub stub |
| 2924 | // +-------+ +---------+ +---------+ +---------+ |
| 2925 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2926 | // +-------+ +---------+ +---------+ +---------+ |
| 2927 | // | | | | |
| 2928 | // | RESTSubReq | | | |
| 2929 | // |---------------->| | | |
| 2930 | // | RESTSubResp | | | |
| 2931 | // |<----------------| | | |
| 2932 | // | | RouteCreate | | |
| 2933 | // | |--------------------------->| |
| 2934 | // | | RouteResponse| | |
| 2935 | // | |<---------------------------| // The order of these events may vary |
| 2936 | // | | SubReq | | |
| 2937 | // | |------------->| | // The order of these events may vary |
| 2938 | // | | SubResp | | |
| 2939 | // | |<-------------| | |
| 2940 | // | RESTNotif1 | | | |
| 2941 | // |<----------------| | | |
| 2942 | // | RESTSubReq | | | |
| 2943 | // | [RETRANS1] | | | |
| 2944 | // |---------------->| | | |
| 2945 | // | RESTNotif1 | | | |
| 2946 | // |<----------------| | | |
| 2947 | // | RESTSubReq | | | |
| 2948 | // | [RETRANS2] | | | |
| 2949 | // |---------------->| | | |
| 2950 | // | RESTNotif1 | | | |
| 2951 | // |<----------------| | | |
| 2952 | // | RESTSubDelReq | | | |
| 2953 | // |---------------->| | | |
| 2954 | // | | SubDelReq | | |
| 2955 | // | |------------->| | |
| 2956 | // | RESTSubDelResp| | | |
| 2957 | // |<----------------| | | |
| 2958 | // | | SubDelResp | | |
| 2959 | // | |<-------------| | |
| 2960 | // | | | | |
| 2961 | // |
| 2962 | //----------------------------------------------------------------------------- |
| 2963 | |
| 2964 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2965 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2966 | |
| 2967 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2968 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2969 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2970 | Counter{cRestSubRespToXapp, 3}, |
| 2971 | Counter{cSubReqToE2, 1}, |
| 2972 | Counter{cSubRespFromE2, 1}, |
| 2973 | Counter{cRestSubNotifToXapp, 3}, |
| 2974 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2975 | Counter{cSubDelReqToE2, 1}, |
| 2976 | Counter{cSubDelRespFromE2, 1}, |
| 2977 | Counter{cRestSubDelRespToXapp, 1}, |
| 2978 | }) |
| 2979 | |
| 2980 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2981 | |
| 2982 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2983 | |
| 2984 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2985 | |
| 2986 | //1.st resend |
| 2987 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2988 | |
| 2989 | assert.Equal(t, restSubId_resend, restSubId) |
| 2990 | |
| 2991 | <-time.After(100 * time.Millisecond) |
| 2992 | |
| 2993 | //2.nd resend |
| 2994 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2995 | |
| 2996 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2997 | |
| 2998 | <-time.After(100 * time.Millisecond) |
| 2999 | |
| 3000 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3001 | |
| 3002 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3003 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3004 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3005 | } |
| 3006 | |
| 3007 | //----------------------------------------------------------------------------- |
| 3008 | // stub stub stub |
| 3009 | // +-------+ +---------+ +---------+ +---------+ |
| 3010 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3011 | // +-------+ +---------+ +---------+ +---------+ |
| 3012 | // | | | | |
| 3013 | // | RESTSubReq | | | |
| 3014 | // |---------------->| | | |
| 3015 | // | RESTSubResp | | | |
| 3016 | // |<----------------| | | |
| 3017 | // | | RouteCreate | | |
| 3018 | // | |--------------------------->| |
| 3019 | // | | RouteResponse| | |
| 3020 | // | |<---------------------------| // The order of these events may vary |
| 3021 | // | | SubReq | | |
| 3022 | // | |------------->| | // The order of these events may vary |
| 3023 | // | | SubResp | | |
| 3024 | // | |<-------------| | |
| 3025 | // | RESTNotif1 | | | |
| 3026 | // |<----------------| | | |
| 3027 | // | RESTSubReq | | | |
| 3028 | // | [RETRANS, with RESTsubsId] | | |
| 3029 | // |---------------->| | | |
| 3030 | // | RESTNotif1 | | | |
| 3031 | // |<----------------| | | |
| 3032 | // | RESTSubReq | | | |
| 3033 | // | [RETRANS, without RESTsubsId] | | |
| 3034 | // |---------------->| | | |
| 3035 | // | RESTNotif1 | | | |
| 3036 | // |<----------------| | | |
| 3037 | // | RESTSubDelReq | | | |
| 3038 | // |---------------->| | | |
| 3039 | // | | SubDelReq | | |
| 3040 | // | |------------->| | |
| 3041 | // | RESTSubDelResp| | | |
| 3042 | // |<----------------| | | |
| 3043 | // | | SubDelResp | | |
| 3044 | // | |<-------------| | |
| 3045 | // | | | | |
| 3046 | // |
| 3047 | //----------------------------------------------------------------------------- |
| 3048 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3049 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3050 | |
| 3051 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3052 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3053 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3054 | Counter{cRestSubRespToXapp, 3}, |
| 3055 | Counter{cSubReqToE2, 1}, |
| 3056 | Counter{cSubRespFromE2, 1}, |
| 3057 | Counter{cRestSubNotifToXapp, 3}, |
| 3058 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3059 | Counter{cSubDelReqToE2, 1}, |
| 3060 | Counter{cSubDelRespFromE2, 1}, |
| 3061 | Counter{cRestSubDelRespToXapp, 1}, |
| 3062 | }) |
| 3063 | |
| 3064 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3065 | |
| 3066 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3067 | |
| 3068 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3069 | |
| 3070 | <-time.After(100 * time.Millisecond) |
| 3071 | |
| 3072 | //1.st resend with subscription ID |
| 3073 | params.SetSubscriptionID(&restSubId) |
| 3074 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3075 | |
| 3076 | assert.Equal(t, restSubId_resend, restSubId) |
| 3077 | |
| 3078 | <-time.After(100 * time.Millisecond) |
| 3079 | |
| 3080 | //2.nd resend without subscription ID (faking app restart) |
| 3081 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3082 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3083 | |
| 3084 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3085 | |
| 3086 | <-time.After(100 * time.Millisecond) |
| 3087 | |
| 3088 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3089 | |
| 3090 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3091 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3092 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3093 | } |
| 3094 | |
| 3095 | //----------------------------------------------------------------------------- |
| 3096 | // stub stub stub |
| 3097 | // +-------+ +---------+ +---------+ +---------+ |
| 3098 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3099 | // +-------+ +---------+ +---------+ +---------+ |
| 3100 | // | | | | |
| 3101 | // | RESTSubReq | | | |
| 3102 | // |---------------->| | | |
| 3103 | // | RESTSubResp | | | |
| 3104 | // |<----------------| | | |
| 3105 | // | | RouteCreate | | |
| 3106 | // | |--------------------------->| |
| 3107 | // | | RouteResponse| | |
| 3108 | // | |<---------------------------| |
| 3109 | // | | SubReq | | |
| 3110 | // | |------------->| | |
| 3111 | // | | SubResp | | |
| 3112 | // | |<-------------| | |
| 3113 | // | RESTNotif1 | | | |
| 3114 | // |<----------------| | | |
| 3115 | // | RESTSubReq | | | |
| 3116 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3117 | // |---------------->| | | |
| 3118 | // | RESTNotif1 | | | |
| 3119 | // | [for initial e2 subDetail] | | |
| 3120 | // |<----------------| | | |
| 3121 | // | | RouteCreate | | |
| 3122 | // | |--------------------------->| |
| 3123 | // | | RouteResponse| | |
| 3124 | // | |<---------------------------| |
| 3125 | // | | SubReq | | |
| 3126 | // | |------------->| | |
| 3127 | // | | SubResp | | |
| 3128 | // | |<-------------| | |
| 3129 | // | RESTNotif1 | | | |
| 3130 | // |<----------------| | | |
| 3131 | // | RESTSubReq | | | |
| 3132 | // | [with RESTsubsId initial request] | |
| 3133 | // |---------------->| | | |
| 3134 | // | RESTNotif1 | | | |
| 3135 | // |<----------------| | | |
| 3136 | // | RESTSubDelReq | | | |
| 3137 | // |---------------->| | | |
| 3138 | // | RESTSubDelResp| | | |
| 3139 | // |<----------------| | | |
| 3140 | // | | SubDelReq | | |
| 3141 | // | |------------->| | |
| 3142 | // | | SubDelResp | | |
| 3143 | // | |<-------------| | |
| 3144 | // | | SubDelReq | | |
| 3145 | // | |------------->| | |
| 3146 | // | | SubDelResp | | |
| 3147 | // | |<-------------| | |
| 3148 | // | | | | |
| 3149 | // |
| 3150 | //----------------------------------------------------------------------------- |
| 3151 | |
| 3152 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3153 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3154 | |
| 3155 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3156 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3157 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3158 | Counter{cRestSubRespToXapp, 3}, |
| 3159 | Counter{cSubReqToE2, 2}, |
| 3160 | Counter{cSubRespFromE2, 2}, |
| 3161 | Counter{cRestSubNotifToXapp, 4}, |
| 3162 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3163 | Counter{cSubDelReqToE2, 2}, |
| 3164 | Counter{cSubDelRespFromE2, 2}, |
| 3165 | Counter{cRestSubDelRespToXapp, 1}, |
| 3166 | }) |
| 3167 | |
| 3168 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3169 | |
| 3170 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3171 | |
| 3172 | <-time.After(100 * time.Millisecond) |
| 3173 | |
| 3174 | // Send modified requst, this time with e2 subscriptions. |
| 3175 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3176 | params2.SetSubscriptionID(&restSubId) |
| 3177 | |
| 3178 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3179 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3180 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3181 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3182 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3183 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3184 | |
| 3185 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3186 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3187 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3188 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3189 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3190 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3191 | assert.NotEqual(t, e2SubsId2, 0) |
| 3192 | |
| 3193 | <-time.After(100 * time.Millisecond) |
| 3194 | |
| 3195 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3196 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3197 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3198 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3199 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3200 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3201 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3202 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3203 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3204 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3205 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3206 | // Delete both e2 subscriptions |
| 3207 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3208 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3209 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3210 | |
| 3211 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3212 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3213 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3214 | } |
| 3215 | |
| 3216 | //----------------------------------------------------------------------------- |
| 3217 | // stub stub stub |
| 3218 | // +-------+ +---------+ +---------+ +---------+ |
| 3219 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3220 | // +-------+ +---------+ +---------+ +---------+ |
| 3221 | // | | | | |
| 3222 | // | RESTSubReq | | | |
| 3223 | // |---------------->| | | |
| 3224 | // | RESTSubResp | | | |
| 3225 | // |<----------------| | | |
| 3226 | // | | RouteCreate | | |
| 3227 | // | |--------------------------->| |
| 3228 | // | | RouteResponse| | |
| 3229 | // | |<---------------------------| |
| 3230 | // | | SubReq | | |
| 3231 | // | |------------->| | |
| 3232 | // | | SubResp | | |
| 3233 | // | |<-------------| | |
| 3234 | // | RESTNotif1 | | | |
| 3235 | // |<----------------| | | |
| 3236 | // | RESTSubReq | | | |
| 3237 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3238 | // |---------------->| | | |
| 3239 | // | RESTNotif1 | | | |
| 3240 | // | [for initial e2 subDetail] | | |
| 3241 | // |<----------------| | | |
| 3242 | // | | RouteCreate | | |
| 3243 | // | |--------------------------->| |
| 3244 | // | | RouteResponse| | |
| 3245 | // | |<---------------------------| |
| 3246 | // | | SubReq | | |
| 3247 | // | |------------->| | |
| 3248 | // | | SubResp | | |
| 3249 | // | |<-------------| | |
| 3250 | // | RESTNotif1 | | | |
| 3251 | // |<----------------| | | |
| 3252 | // | RESTSubReq | | | |
| 3253 | // | [without RESTsubsId initial request] | |
| 3254 | // |---------------->| | | |
| 3255 | // | RESTNotif1 | | | |
| 3256 | // |<----------------| | | |
| 3257 | // | RESTSubDelReq | | | |
| 3258 | // |---------------->| | | |
| 3259 | // | RESTSubDelResp| | | |
| 3260 | // |<----------------| | | |
| 3261 | // | | SubDelReq | | |
| 3262 | // | |------------->| | |
| 3263 | // | | SubDelResp | | |
| 3264 | // | |<-------------| | |
| 3265 | // | | SubDelReq | | |
| 3266 | // | |------------->| | |
| 3267 | // | | SubDelResp | | |
| 3268 | // | |<-------------| | |
| 3269 | // | | | | |
| 3270 | // |
| 3271 | //----------------------------------------------------------------------------- |
| 3272 | |
| 3273 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3274 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3275 | |
| 3276 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3277 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3278 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3279 | Counter{cRestSubRespToXapp, 3}, |
| 3280 | Counter{cSubReqToE2, 2}, |
| 3281 | Counter{cSubRespFromE2, 2}, |
| 3282 | Counter{cRestSubNotifToXapp, 4}, |
| 3283 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3284 | Counter{cSubDelReqToE2, 2}, |
| 3285 | Counter{cSubDelRespFromE2, 2}, |
| 3286 | Counter{cRestSubDelRespToXapp, 1}, |
| 3287 | }) |
| 3288 | |
| 3289 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3290 | |
| 3291 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3292 | |
| 3293 | <-time.After(100 * time.Millisecond) |
| 3294 | |
| 3295 | // Send modified requst, this time with e2 subscriptions. |
| 3296 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3297 | params2.SetSubscriptionID(&restSubId) |
| 3298 | |
| 3299 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3300 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3301 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3302 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3303 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3304 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3305 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3306 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3307 | xappConn1.DecrementRequestCount() |
| 3308 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3309 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3310 | |
| 3311 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3312 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3313 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3314 | assert.NotEqual(t, e2SubsId2, 0) |
| 3315 | |
| 3316 | <-time.After(100 * time.Millisecond) |
| 3317 | |
| 3318 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3319 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3320 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3321 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3322 | // md5sum shall find the original request |
| 3323 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3324 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3325 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3326 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3327 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3328 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3329 | // Delete both e2 subscriptions |
| 3330 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3331 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3332 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3333 | |
| 3334 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3335 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3336 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3337 | } |
| 3338 | |
| 3339 | //----------------------------------------------------------------------------- |
| 3340 | // stub stub stub |
| 3341 | // +-------+ +---------+ +---------+ +---------+ |
| 3342 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3343 | // +-------+ +---------+ +---------+ +---------+ |
| 3344 | // | | | | |
| 3345 | // | RESTSubReq | | | |
| 3346 | // |---------------->| | | |
| 3347 | // | RESTSubResp | | | |
| 3348 | // |<----------------| | | |
| 3349 | // | | RouteCreate | | |
| 3350 | // | |--------------------------->| |
| 3351 | // | | RouteResponse| | |
| 3352 | // | |<---------------------------| |
| 3353 | // | | SubReq | | |
| 3354 | // | |------------->| | |
| 3355 | // | | SubResp | | |
| 3356 | // | |<-------------| | |
| 3357 | // | RESTNotif1 | | | |
| 3358 | // |<----------------| | | |
| 3359 | // | RESTSubReq | | | |
| 3360 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3361 | // |---------------->| | | |
| 3362 | // | RESTNotif1 | | | |
| 3363 | // | [for initial e2 subDetail] | | |
| 3364 | // |<----------------| | | |
| 3365 | // | | RouteCreate | | |
| 3366 | // | |--------------------------->| |
| 3367 | // | | RouteResponse| | |
| 3368 | // | |<---------------------------| |
| 3369 | // | | SubReq | | |
| 3370 | // | |------------->| | |
| 3371 | // | | SubResp | | |
| 3372 | // | |<-------------| | |
| 3373 | // | RESTNotif1 | | | |
| 3374 | // |<----------------| | | |
| 3375 | // | RESTSubDelReq | | | |
| 3376 | // |---------------->| | | |
| 3377 | // | RESTSubDelResp| | | |
| 3378 | // |<----------------| | | |
| 3379 | // | | SubDelReq | | |
| 3380 | // | |------------->| | |
| 3381 | // | | SubDelResp | | |
| 3382 | // | |<-------------| | |
| 3383 | // | | SubDelReq | | |
| 3384 | // | |------------->| | |
| 3385 | // | | SubDelResp | | |
| 3386 | // | |<-------------| | |
| 3387 | // | RESTSubReq | | | |
| 3388 | // | [with RESTsubsId initial request] | |
| 3389 | // |---------------->| | | |
| 3390 | // | RESTSubResp | | | |
| 3391 | // |<----------------| | | |
| 3392 | // | | RouteCreate | | |
| 3393 | // | |--------------------------->| |
| 3394 | // | | RouteResponse| | |
| 3395 | // | |<---------------------------| |
| 3396 | // | | SubReq | | |
| 3397 | // | |------------->| | |
| 3398 | // | | SubResp | | |
| 3399 | // | |<-------------| | |
| 3400 | // | RESTNotif1 | | | |
| 3401 | // |<----------------| | | |
| 3402 | // | | | | |
| 3403 | // |
| 3404 | //----------------------------------------------------------------------------- |
| 3405 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3406 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3407 | |
| 3408 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3409 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3410 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3411 | Counter{cRestSubRespToXapp, 3}, |
| 3412 | Counter{cSubReqToE2, 3}, |
| 3413 | Counter{cSubRespFromE2, 3}, |
| 3414 | Counter{cRestSubNotifToXapp, 4}, |
| 3415 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3416 | Counter{cSubDelReqToE2, 3}, |
| 3417 | Counter{cSubDelRespFromE2, 3}, |
| 3418 | Counter{cRestSubDelRespToXapp, 2}, |
| 3419 | }) |
| 3420 | |
| 3421 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3422 | |
| 3423 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3424 | |
| 3425 | <-time.After(100 * time.Millisecond) |
| 3426 | |
| 3427 | // Send modified requst, this time with e2 subscriptions. |
| 3428 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3429 | params2.SetSubscriptionID(&restSubId) |
| 3430 | |
| 3431 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3432 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3433 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3434 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3435 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3436 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3437 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3438 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3439 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3440 | |
| 3441 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3442 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3443 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3444 | assert.NotEqual(t, e2SubsId2, 0) |
| 3445 | |
| 3446 | <-time.After(100 * time.Millisecond) |
| 3447 | |
| 3448 | // Delete both e2 subscriptions |
| 3449 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3450 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3451 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3452 | |
| 3453 | waitSubsCleanup(t, e2SubsId, 10) |
| 3454 | |
| 3455 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3456 | // but the restsubscription has been already removed. This shall trigger a |
| 3457 | // fresh create. |
| 3458 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3459 | |
| 3460 | <-time.After(100 * time.Millisecond) |
| 3461 | |
| 3462 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3463 | |
| 3464 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3465 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3466 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3467 | } |
| 3468 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3469 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3470 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3471 | |
| 3472 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3473 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3474 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3475 | Counter{cSubReqToE2, 1}, |
| 3476 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3477 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3478 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3479 | Counter{cSubDelReqToE2, 1}, |
| 3480 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3481 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3482 | }) |
| 3483 | |
| 3484 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3485 | |
| 3486 | //Subs Create |
| 3487 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3488 | |
| 3489 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3490 | |
| 3491 | //Subs Delete |
| 3492 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3493 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3494 | |
| 3495 | seqBef := mainCtrl.get_msgcounter(t) |
| 3496 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3497 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3498 | |
| 3499 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3500 | |
| 3501 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3502 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3503 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3504 | } |
| 3505 | |
| 3506 | //----------------------------------------------------------------------------- |
| 3507 | // TestRESTSubReqDelReq |
| 3508 | // |
| 3509 | // stub stub |
| 3510 | // +-------+ +---------+ +---------+ |
| 3511 | // | xapp | | submgr | | e2term | |
| 3512 | // +-------+ +---------+ +---------+ |
| 3513 | // | | | |
| 3514 | // | RESTSubReq | | |
| 3515 | // |---------------->| | |
| 3516 | // | | | |
| 3517 | // | RESTSubResp | | |
| 3518 | // |<----------------| | |
| 3519 | // | | SubReq | |
| 3520 | // | |------------->| |
| 3521 | // | RESTSubDelReq | | |
| 3522 | // |---------------->| | |
| 3523 | // | RESTSubDelResp | | |
| 3524 | // | unsuccess | | |
| 3525 | // |<----------------| | |
| 3526 | // | | SubResp | |
| 3527 | // | |<-------------| |
| 3528 | // | RESTNotif1 | | |
| 3529 | // |<----------------| | |
| 3530 | // | | | |
| 3531 | // | [SUBS DELETE] | |
| 3532 | // | | | |
| 3533 | // |
| 3534 | //----------------------------------------------------------------------------- |
| 3535 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3536 | CaseBegin("TestRESTSubReqDelReq") |
| 3537 | |
| 3538 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3539 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3540 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3541 | Counter{cSubReqToE2, 1}, |
| 3542 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3543 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3544 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3545 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3546 | Counter{cSubDelReqToE2, 1}, |
| 3547 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3548 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3549 | }) |
| 3550 | |
| 3551 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3552 | |
| 3553 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3554 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3555 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3556 | |
| 3557 | // Del. This will fail as processing of the subscription |
| 3558 | // is still ongoing in submgr. Deletion is not allowed before |
| 3559 | // subscription creation has been completed. |
| 3560 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3561 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3562 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3563 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3564 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3565 | |
| 3566 | // Retry del |
| 3567 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3568 | |
| 3569 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3570 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3571 | |
| 3572 | // Wait that subs is cleaned |
| 3573 | waitSubsCleanup(t, e2SubsId, 10) |
| 3574 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3575 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3576 | } |
| 3577 | |
| 3578 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3579 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3580 | } |
| 3581 | |
| 3582 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3583 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3584 | |
| 3585 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3586 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3587 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3588 | Counter{cSubReqToE2, 2}, |
| 3589 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3590 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3591 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3592 | Counter{cSubDelReqToE2, 2}, |
| 3593 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3594 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3595 | }) |
| 3596 | |
| 3597 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3598 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3599 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3600 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3601 | |
| 3602 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3603 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3604 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3605 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3606 | |
| 3607 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3608 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3609 | |
| 3610 | //XappConn1 receives both of the responses |
| 3611 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3612 | |
| 3613 | //Resp1 |
| 3614 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3615 | //Resp2 |
| 3616 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3617 | |
| 3618 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3619 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3620 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3621 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3622 | |
| 3623 | //Del1 |
| 3624 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3625 | //Del2 |
| 3626 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3627 | |
| 3628 | //Wait that subs is cleaned |
| 3629 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3630 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3631 | |
| 3632 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3633 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3634 | } |
| 3635 | |
| 3636 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3637 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3638 | |
| 3639 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3640 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3641 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3642 | Counter{cSubReqToE2, 2}, |
| 3643 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3644 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3645 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3646 | Counter{cSubDelReqToE2, 2}, |
| 3647 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3648 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3649 | }) |
| 3650 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3651 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3652 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3653 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3654 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3655 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3656 | params.SetMeid("RAN_NAME_2") |
| 3657 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3658 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3659 | |
| 3660 | //Del1 |
| 3661 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3662 | //Del2 |
| 3663 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3664 | |
| 3665 | //Wait that subs is cleaned |
| 3666 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3667 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3668 | |
| 3669 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3670 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3671 | } |
| 3672 | |
| 3673 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3674 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3675 | |
| 3676 | // Init counter check |
| 3677 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3678 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3679 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3680 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3681 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3682 | Counter{cSubReReqToE2, 1}, |
| 3683 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3684 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3685 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3686 | Counter{cSubDelReqToE2, 1}, |
| 3687 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3688 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3689 | }) |
| 3690 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3691 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3692 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3693 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3694 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3695 | |
| 3696 | // Catch the first message and ignore it |
| 3697 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3698 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3699 | |
| 3700 | // The second request is being handled normally |
| 3701 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3702 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3703 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3704 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3705 | |
| 3706 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3707 | |
| 3708 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3709 | |
| 3710 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3711 | //Wait that subs is cleaned |
| 3712 | waitSubsCleanup(t, e2SubsId, 10) |
| 3713 | |
| 3714 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3715 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3716 | } |
| 3717 | |
| 3718 | //----------------------------------------------------------------------------- |
| 3719 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3720 | // |
| 3721 | // stub stub |
| 3722 | // +-------+ +---------+ +---------+ |
| 3723 | // | xapp | | submgr | | e2term | |
| 3724 | // +-------+ +---------+ +---------+ |
| 3725 | // | | | |
| 3726 | // | RESTSubReq | | |
| 3727 | // |---------------->| | |
| 3728 | // | | | |
| 3729 | // | RESTSubResp | | |
| 3730 | // |<----------------| | |
| 3731 | // | | SubReq | |
| 3732 | // | |------------->| |
| 3733 | // | | | |
| 3734 | // | | | |
| 3735 | // | | SubReq | |
| 3736 | // | |------------->| |
| 3737 | // | | | |
| 3738 | // | | SubDelReq | |
| 3739 | // | |------------->| |
| 3740 | // | | | |
| 3741 | // | | | |
| 3742 | // | | SubDelReq | |
| 3743 | // | |------------->| |
| 3744 | // | | | |
| 3745 | // | | | |
| 3746 | // | | SubDelResp | |
| 3747 | // | |<-------------| |
| 3748 | // | RESTNotif | | |
| 3749 | // | unsuccess | | |
| 3750 | // |<----------------| | |
| 3751 | // | | | |
| 3752 | // | [SUBS DELETE] | |
| 3753 | // | | | |
| 3754 | // |
| 3755 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3756 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3757 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3758 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3759 | |
| 3760 | // Init counter check |
| 3761 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3762 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3763 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3764 | Counter{cSubReqToE2, 1}, |
| 3765 | Counter{cSubReReqToE2, 1}, |
| 3766 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3767 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3768 | Counter{cSubDelReqToE2, 1}, |
| 3769 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3770 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3771 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3772 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3773 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3774 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3775 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3776 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3777 | |
| 3778 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3779 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3780 | |
| 3781 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3782 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3783 | |
| 3784 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3785 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3786 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3787 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3788 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3789 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3790 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3791 | // Wait that subs is cleaned |
| 3792 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3793 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3794 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3795 | } |
| 3796 | |
| 3797 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3798 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3799 | |
| 3800 | // Init counter check |
| 3801 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3802 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3803 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3804 | Counter{cSubReqToE2, 1}, |
| 3805 | Counter{cSubReReqToE2, 1}, |
| 3806 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3807 | Counter{cSubDelReReqToE2, 1}, |
| 3808 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3809 | Counter{cSubDelReqToE2, 1}, |
| 3810 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3811 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3812 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3813 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3814 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3815 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3816 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3817 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3818 | |
| 3819 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3820 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3821 | |
| 3822 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3823 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3824 | |
| 3825 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3826 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3827 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3828 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3829 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3830 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3831 | |
| 3832 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3833 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3834 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3835 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3836 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3837 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3838 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3839 | } |
| 3840 | |
| 3841 | //----------------------------------------------------------------------------- |
| 3842 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3843 | // |
| 3844 | // stub stub |
| 3845 | // +-------+ +---------+ +---------+ |
| 3846 | // | xapp | | submgr | | e2term | |
| 3847 | // +-------+ +---------+ +---------+ |
| 3848 | // | | | |
| 3849 | // | RESTSubReq | | |
| 3850 | // |---------------->| | |
| 3851 | // | | | |
| 3852 | // | RESTSubResp | | |
| 3853 | // |<----------------| | |
| 3854 | // | | SubReq | |
| 3855 | // | |------------->| |
| 3856 | // | | | |
| 3857 | // | | | |
| 3858 | // | | SubReq | |
| 3859 | // | |------------->| |
| 3860 | // | | | |
| 3861 | // | | SubDelReq | |
| 3862 | // | |------------->| |
| 3863 | // | | | |
| 3864 | // | | | |
| 3865 | // | | SubDelReq | |
| 3866 | // | |------------->| |
| 3867 | // | | | |
| 3868 | // | | | |
| 3869 | // | | SubDelResp | |
| 3870 | // | |<-------------| |
| 3871 | // | RESTNotif | | |
| 3872 | // | unsuccess | | |
| 3873 | // |<----------------| | |
| 3874 | // | | | |
| 3875 | // | [SUBS DELETE] | |
| 3876 | // | | | |
| 3877 | // |
| 3878 | //----------------------------------------------------------------------------- |
| 3879 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3880 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3881 | |
| 3882 | // Init counter check |
| 3883 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3884 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3885 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3886 | Counter{cSubReqToE2, 1}, |
| 3887 | Counter{cSubReReqToE2, 1}, |
| 3888 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3889 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3890 | Counter{cSubDelReqToE2, 1}, |
| 3891 | Counter{cSubDelReReqToE2, 1}, |
| 3892 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3893 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3894 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3895 | }) |
| 3896 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3897 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3898 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3899 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3900 | |
| 3901 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3902 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3903 | |
| 3904 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3905 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3906 | |
| 3907 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3908 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3909 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3910 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3911 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3912 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3913 | |
| 3914 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3915 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3916 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3917 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3918 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3919 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3920 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3921 | } |
| 3922 | |
| 3923 | //----------------------------------------------------------------------------- |
| 3924 | // TestRESTSubReqSubFailRespInSubmgr |
| 3925 | // |
| 3926 | // stub stub |
| 3927 | // +-------+ +---------+ +---------+ |
| 3928 | // | xapp | | submgr | | e2term | |
| 3929 | // +-------+ +---------+ +---------+ |
| 3930 | // | | | |
| 3931 | // | RESTSubReq | | |
| 3932 | // |---------------->| | |
| 3933 | // | | | |
| 3934 | // | RESTSubResp | | |
| 3935 | // |<----------------| | |
| 3936 | // | | SubReq | |
| 3937 | // | |------------->| |
| 3938 | // | | | |
| 3939 | // | | SubFail | |
| 3940 | // | |<-------------| |
| 3941 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3942 | // | RESTNotif | | |
| 3943 | // | unsuccess | | |
| 3944 | // |<----------------| | |
| 3945 | // | | | |
| 3946 | // | [SUBS DELETE] | |
| 3947 | // | | | |
| 3948 | // |
| 3949 | //----------------------------------------------------------------------------- |
| 3950 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3951 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3952 | |
| 3953 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3954 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3955 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3956 | Counter{cSubReqToE2, 1}, |
| 3957 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3958 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3959 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3960 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3961 | }) |
| 3962 | |
| 3963 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3964 | const e2Timeout int64 = 2 |
| 3965 | const e2RetryCount int64 = 1 |
| 3966 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3967 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3968 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3969 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3970 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3971 | |
| 3972 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3973 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3974 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 3975 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3976 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3977 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3978 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3979 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3980 | |
| 3981 | // REST subscription sill there to be deleted |
| 3982 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3983 | |
| 3984 | // Wait that subs is cleaned |
| 3985 | waitSubsCleanup(t, e2SubsId, 10) |
| 3986 | |
| 3987 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3988 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3989 | } |
| 3990 | |
| 3991 | //----------------------------------------------------------------------------- |
| 3992 | // TestRESTSubDelReqRetryInSubmgr |
| 3993 | // |
| 3994 | // stub stub |
| 3995 | // +-------+ +---------+ +---------+ |
| 3996 | // | xapp | | submgr | | e2term | |
| 3997 | // +-------+ +---------+ +---------+ |
| 3998 | // | | | |
| 3999 | // | [SUBS CREATE] | |
| 4000 | // | | | |
| 4001 | // | | | |
| 4002 | // | RESTSubDelReq | | |
| 4003 | // |---------------->| | |
| 4004 | // | | | |
| 4005 | // | RESTSubDelResp | | |
| 4006 | // |<----------------| | |
| 4007 | // | | SubDelReq | |
| 4008 | // | |------------->| |
| 4009 | // | | | |
| 4010 | // | | SubDelReq | |
| 4011 | // | |------------->| |
| 4012 | // | | | |
| 4013 | // | | SubDelResp | |
| 4014 | // | |<-------------| |
| 4015 | // | | | |
| 4016 | // |
| 4017 | //----------------------------------------------------------------------------- |
| 4018 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 4019 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 4020 | |
| 4021 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4022 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4023 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4024 | Counter{cSubReqToE2, 1}, |
| 4025 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4026 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4027 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4028 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4029 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4030 | Counter{cSubDelReReqToE2, 1}, |
| 4031 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4032 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4033 | }) |
| 4034 | // Req |
| 4035 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4036 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4037 | |
| 4038 | // Del |
| 4039 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4040 | |
| 4041 | // E2t: Receive 1st SubsDelReq |
| 4042 | e2termConn1.RecvSubsDelReq(t) |
| 4043 | |
| 4044 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4045 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4046 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4047 | |
| 4048 | //Wait that subs is cleaned |
| 4049 | waitSubsCleanup(t, e2SubsId, 10) |
| 4050 | |
| 4051 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4052 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4053 | } |
| 4054 | |
| 4055 | //----------------------------------------------------------------------------- |
| 4056 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4057 | // |
| 4058 | // stub stub |
| 4059 | // +-------+ +---------+ +---------+ |
| 4060 | // | xapp | | submgr | | e2term | |
| 4061 | // +-------+ +---------+ +---------+ |
| 4062 | // | | | |
| 4063 | // | [SUBS CREATE] | |
| 4064 | // | | | |
| 4065 | // | | | |
| 4066 | // | RESTSubDelReq | | |
| 4067 | // |---------------->| | |
| 4068 | // | | | |
| 4069 | // | RESTSubDelResp | | |
| 4070 | // |<----------------| | |
| 4071 | // | | SubDelReq | |
| 4072 | // | |------------->| |
| 4073 | // | | | |
| 4074 | // | | SubDelReq | |
| 4075 | // | |------------->| |
| 4076 | // | | | |
| 4077 | // | | | |
| 4078 | // |
| 4079 | //----------------------------------------------------------------------------- |
| 4080 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4081 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4082 | |
| 4083 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4084 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4085 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4086 | Counter{cSubReqToE2, 1}, |
| 4087 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4088 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4089 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4090 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4091 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4092 | Counter{cSubDelReReqToE2, 1}, |
| 4093 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4094 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4095 | }) |
| 4096 | |
| 4097 | // Req |
| 4098 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4099 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4100 | |
| 4101 | // Del |
| 4102 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4103 | |
| 4104 | // E2t: Receive 1st SubsDelReq |
| 4105 | e2termConn1.RecvSubsDelReq(t) |
| 4106 | |
| 4107 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4108 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4109 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4110 | |
| 4111 | //Wait that subs is cleaned |
| 4112 | waitSubsCleanup(t, e2SubsId, 10) |
| 4113 | |
| 4114 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4115 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4116 | } |
| 4117 | |
| 4118 | //----------------------------------------------------------------------------- |
| 4119 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4120 | // |
| 4121 | // stub stub |
| 4122 | // +-------+ +---------+ +---------+ |
| 4123 | // | xapp | | submgr | | e2term | |
| 4124 | // +-------+ +---------+ +---------+ |
| 4125 | // | | | |
| 4126 | // | [SUBS CREATE] | |
| 4127 | // | | | |
| 4128 | // | | | |
| 4129 | // | RESTSubDelReq | | |
| 4130 | // |---------------->| | |
| 4131 | // | | | |
| 4132 | // | RESTSubDelResp | | |
| 4133 | // |<----------------| | |
| 4134 | // | | SubDelReq | |
| 4135 | // | |------------->| |
| 4136 | // | | | |
| 4137 | // | | SubDelFail | |
| 4138 | // | |<-------------| |
| 4139 | // | | | |
| 4140 | // |
| 4141 | //----------------------------------------------------------------------------- |
| 4142 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4143 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4144 | |
| 4145 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4146 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4147 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4148 | Counter{cSubReqToE2, 1}, |
| 4149 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4150 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4151 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4152 | Counter{cSubDelReqToE2, 1}, |
| 4153 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4154 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4155 | }) |
| 4156 | |
| 4157 | // Req |
| 4158 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4159 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4160 | |
| 4161 | // Del |
| 4162 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4163 | |
| 4164 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4165 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4166 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4167 | |
| 4168 | //Wait that subs is cleaned |
| 4169 | waitSubsCleanup(t, e2SubsId, 10) |
| 4170 | |
| 4171 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4172 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4173 | } |
| 4174 | |
| 4175 | //----------------------------------------------------------------------------- |
| 4176 | // TestRESTSubReqAndSubDelOkSameAction |
| 4177 | // |
| 4178 | // stub stub |
| 4179 | // +-------+ +-------+ +---------+ +---------+ |
| 4180 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4181 | // +-------+ +-------+ +---------+ +---------+ |
| 4182 | // | | | | |
| 4183 | // | | RESTSubReq1 | | |
| 4184 | // | |---------------->| | |
| 4185 | // | | | | |
| 4186 | // | | RESTSubResp1 | | |
| 4187 | // | |<----------------| | |
| 4188 | // | | | | |
| 4189 | // | | | SubReq1 | |
| 4190 | // | | |------------->| |
| 4191 | // | | | SubResp1 | |
| 4192 | // | | |<-------------| |
| 4193 | // | | RESTNotif1 | | |
| 4194 | // | |<----------------| | |
| 4195 | // | | | | |
| 4196 | // | RESTSubReq2 | | |
| 4197 | // |------------------------------>| | |
| 4198 | // | | | | |
| 4199 | // | RESTSubResp2 | | |
| 4200 | // |<------------------------------| | |
| 4201 | // | | | | |
| 4202 | // | | RESTNotif2 | | |
| 4203 | // |<------------------------------| | |
| 4204 | // | | | | |
| 4205 | // | | RESTSubDelReq1 | | |
| 4206 | // | |---------------->| | |
| 4207 | // | | | | |
| 4208 | // | | RESTSubDelResp1 | | |
| 4209 | // | |<----------------| | |
| 4210 | // | | | | |
| 4211 | // | RESTSubDelReq2 | | |
| 4212 | // |------------------------------>| | |
| 4213 | // | | | | |
| 4214 | // | RESTSubDelResp2 | | |
| 4215 | // |<------------------------------| | |
| 4216 | // | | | | |
| 4217 | // | | | SubDelReq2 | |
| 4218 | // | | |------------->| |
| 4219 | // | | | | |
| 4220 | // | | | SubDelResp2 | |
| 4221 | // | | |<-------------| |
| 4222 | // | | | | |
| 4223 | // |
| 4224 | //----------------------------------------------------------------------------- |
| 4225 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4226 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4227 | |
| 4228 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4229 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4230 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4231 | Counter{cSubReqToE2, 1}, |
| 4232 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4233 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4234 | Counter{cMergedSubscriptions, 1}, |
| 4235 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4236 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4237 | Counter{cSubDelReqToE2, 1}, |
| 4238 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4239 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4240 | }) |
| 4241 | |
| 4242 | // Req1 |
| 4243 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4244 | |
| 4245 | //Subs Create |
| 4246 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4247 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4248 | |
| 4249 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4250 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4251 | params.SetMeid("RAN_NAME_1") |
| 4252 | |
| 4253 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4254 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4255 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4256 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4257 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4258 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4259 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4260 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4261 | |
| 4262 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4263 | |
| 4264 | // Del1 |
| 4265 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4266 | |
| 4267 | // Del2 |
| 4268 | deleteXapp2Subscription(t, &restSubId2) |
| 4269 | |
| 4270 | //Wait that subs is cleaned |
| 4271 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4272 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4273 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4274 | } |
| 4275 | |
| 4276 | //----------------------------------------------------------------------------- |
| 4277 | // TestSubReqAndSubDelOkSameActionParallel |
| 4278 | // |
| 4279 | // stub stub stub |
| 4280 | // +-------+ +-------+ +---------+ +---------+ |
| 4281 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4282 | // +-------+ +-------+ +---------+ +---------+ |
| 4283 | // | | | | |
| 4284 | // | | | | |
| 4285 | // | | | | |
| 4286 | // | | SubReq1 | | |
| 4287 | // | |------------->| | |
| 4288 | // | | | | |
| 4289 | // | | | SubReq1 | |
| 4290 | // | | |------------->| |
| 4291 | // | SubReq2 | | |
| 4292 | // |--------------------------->| | |
| 4293 | // | | | SubResp1 | |
| 4294 | // | | |<-------------| |
| 4295 | // | | SubResp1 | | |
| 4296 | // | |<-------------| | |
| 4297 | // | | | SubReq2 | |
| 4298 | // | | |------------->| |
| 4299 | // | | | | |
| 4300 | // | | | SubResp2 | |
| 4301 | // | | |<-------------| |
| 4302 | // | SubResp2 | | |
| 4303 | // |<---------------------------| | |
| 4304 | // | | | | |
| 4305 | // | | SubDelReq 1 | | |
| 4306 | // | |------------->| | |
| 4307 | // | | | | |
| 4308 | // | | SubDelResp 1 | | |
| 4309 | // | |<-------------| | |
| 4310 | // | | | | |
| 4311 | // | SubDelReq 2 | | |
| 4312 | // |--------------------------->| | |
| 4313 | // | | | | |
| 4314 | // | | | SubDelReq 2 | |
| 4315 | // | | |------------->| |
| 4316 | // | | | | |
| 4317 | // | | | SubDelReq 2 | |
| 4318 | // | | |------------->| |
| 4319 | // | | | | |
| 4320 | // | SubDelResp 2 | | |
| 4321 | // |<---------------------------| | |
| 4322 | // |
| 4323 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4324 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4325 | |
| 4326 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4327 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4328 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4329 | Counter{cSubReqToE2, 2}, |
| 4330 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4331 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4332 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4333 | Counter{cSubDelReqToE2, 2}, |
| 4334 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4335 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4336 | }) |
| 4337 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4338 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4339 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4340 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4341 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4342 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4343 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4344 | |
| 4345 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4346 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4347 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4348 | |
| 4349 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4350 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4351 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4352 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4353 | |
| 4354 | // Del1 |
| 4355 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4356 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4357 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4358 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4359 | |
| 4360 | // Del2 |
| 4361 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4362 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4363 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4364 | |
| 4365 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4366 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4367 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4368 | } |
| 4369 | |
| 4370 | //----------------------------------------------------------------------------- |
| 4371 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4372 | // |
| 4373 | // stub stub stub |
| 4374 | // +-------+ +-------+ +---------+ +---------+ |
| 4375 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4376 | // +-------+ +-------+ +---------+ +---------+ |
| 4377 | // | | | | |
| 4378 | // | | | | |
| 4379 | // | | | | |
| 4380 | // | | RESTSubReq1 | | |
| 4381 | // | |---------------->| | |
| 4382 | // | | | | |
| 4383 | // | | RESTSubResp1 | | |
| 4384 | // | |<----------------| | |
| 4385 | // | | | SubReq1 | |
| 4386 | // | | |------------->| |
| 4387 | // | RESTSubReq2 | | |
| 4388 | // |------------------------------>| | |
| 4389 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4390 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4391 | // |<------------------------------| | |
| 4392 | // | | | SubReq1 | |
| 4393 | // | | |------------->| |
| 4394 | // | | | | |
| 4395 | // | | | | |
| 4396 | // | | | SubDelReq | |
| 4397 | // | | |------------->| |
| 4398 | // | | | | |
| 4399 | // | | | SubDelResp | |
| 4400 | // | | |<-------------| |
| 4401 | // | | RESTNotif1 | | |
| 4402 | // | | unsuccess | | |
| 4403 | // | |<----------------| | |
| 4404 | // | RESTNotif2 | | |
| 4405 | // | | unsuccess | | |
| 4406 | // |<------------------------------| | |
| 4407 | // | | | | |
| 4408 | // | | RESTSubDelReq1 | | |
| 4409 | // | |---------------->| | |
| 4410 | // | | | | |
| 4411 | // | | RESTSubDelResp1 | | |
| 4412 | // | |<----------------| | |
| 4413 | // | | | | |
| 4414 | // | RESTSubDelReq2 | | |
| 4415 | // |------------------------------>| | |
| 4416 | // | | | | |
| 4417 | // | RESTSubDelResp2 | | |
| 4418 | // |<------------------------------| | |
| 4419 | // |
| 4420 | //----------------------------------------------------------------------------- |
| 4421 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4422 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4423 | |
| 4424 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4425 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4426 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4427 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4428 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4429 | Counter{cSubReqTimerExpiry, 2}, |
| 4430 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4431 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 4432 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4433 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4434 | Counter{cSubDelReqToE2, 1}, |
| 4435 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4436 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4437 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4438 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4439 | |
| 4440 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4441 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4442 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4443 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4444 | |
| 4445 | // Req2 |
| 4446 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4447 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4448 | params2.SetMeid("RAN_NAME_1") |
| 4449 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4450 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4451 | |
| 4452 | //Req1 (retransmitted) |
| 4453 | e2termConn1.RecvSubsReq(t) |
| 4454 | |
| 4455 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4456 | |
| 4457 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4459 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4460 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4461 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4462 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4463 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4464 | |
| 4465 | // Del1 |
| 4466 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4467 | |
| 4468 | // Del2 |
| 4469 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4470 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4471 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4472 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4473 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4474 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4475 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4476 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4477 | } |
| 4478 | |
| 4479 | //----------------------------------------------------------------------------- |
| 4480 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4481 | // |
| 4482 | // stub stub stub |
| 4483 | // +-------+ +-------+ +---------+ +---------+ |
| 4484 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4485 | // +-------+ +-------+ +---------+ +---------+ |
| 4486 | // | | | | |
| 4487 | // | | | | |
| 4488 | // | | | | |
| 4489 | // | | RESTSubReq1 | | |
| 4490 | // | |---------------->| | |
| 4491 | // | | | | |
| 4492 | // | | RESTSubResp1 | | |
| 4493 | // | |<----------------| | |
| 4494 | // | | | SubReq1 | |
| 4495 | // | | |------------->| |
| 4496 | // | RESTSubReq2 | | |
| 4497 | // |------------------------------>| | |
| 4498 | // | | | | |
| 4499 | // | RESTSubDelResp2 | | |
| 4500 | // |<------------------------------| | |
| 4501 | // | | | SubFail1 | |
| 4502 | // | | |<-------------| |
| 4503 | // | | | | |
| 4504 | // | | RESTNotif1 | | |
| 4505 | // | | unsuccess | | |
| 4506 | // | |<----------------| | |
| 4507 | // | RESTNotif2 | | |
| 4508 | // | | unsuccess | | |
| 4509 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4510 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4511 | // | | 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] | 4512 | // | |---------------->| | |
| 4513 | // | | | | |
| 4514 | // | | RESTSubDelResp1 | | |
| 4515 | // | |<----------------| | |
| 4516 | // | | | | |
| 4517 | // | RESTSubDelReq2 | | |
| 4518 | // |------------------------------>| | |
| 4519 | // | | | | |
| 4520 | // | RESTSubDelResp2 | | |
| 4521 | // |<------------------------------| | |
| 4522 | // |
| 4523 | //----------------------------------------------------------------------------- |
| 4524 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4525 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4526 | |
| 4527 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4528 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4529 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4530 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4531 | Counter{cSubReqToE2, 1}, |
| 4532 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4533 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 4534 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4535 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4536 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4537 | }) |
| 4538 | |
| 4539 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | |
| 4541 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4542 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4544 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4545 | |
| 4546 | // Req2 |
| 4547 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4548 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | params2.SetMeid("RAN_NAME_1") |
| 4550 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4551 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4552 | |
| 4553 | // E2t: send SubsFail (first) |
| 4554 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4555 | fparams1.Set(crereq1) |
| 4556 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4557 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4558 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4560 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4561 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4562 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4563 | |
| 4564 | // Del1 |
| 4565 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4566 | |
| 4567 | // Del2 |
| 4568 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4569 | |
| 4570 | //Wait that subs is cleaned |
| 4571 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4572 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4573 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4574 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4575 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 4576 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4577 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4578 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4579 | |
| 4580 | // Init counter check |
| 4581 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4582 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4583 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4584 | Counter{cSubReqToE2, 1}, |
| 4585 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4586 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4587 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4588 | Counter{cSubDelReqToE2, 1}, |
| 4589 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4590 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4591 | }) |
| 4592 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4593 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4594 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4595 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4596 | |
| 4597 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4598 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4599 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4600 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4601 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | |
| 4603 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4604 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4605 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4606 | |
| 4607 | // Wait that subs is cleaned |
| 4608 | waitSubsCleanup(t, e2SubsId, 10) |
| 4609 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4610 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4611 | } |
| 4612 | |
| 4613 | //----------------------------------------------------------------------------- |
| 4614 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4615 | // |
| 4616 | // stub stub |
| 4617 | // +-------+ +---------+ +---------+ |
| 4618 | // | xapp | | submgr | | e2term | |
| 4619 | // +-------+ +---------+ +---------+ |
| 4620 | // | | | |
| 4621 | // | RESTSubReq | | |
| 4622 | // |---------------->| | |
| 4623 | // | | | |
| 4624 | // | RESTSubResp | | |
| 4625 | // |<----------------| | |
| 4626 | // | | SubReq | |
| 4627 | // | |------------->| |
| 4628 | // | | | |
| 4629 | // | | SubResp | |
| 4630 | // | |<-------------| |
| 4631 | // | | | |
| 4632 | // | RESTNotif | | |
| 4633 | // |<----------------| | |
| 4634 | // | | | |
| 4635 | // | RESTSubReq | | |
| 4636 | // |---------------->| | |
| 4637 | // | | | |
| 4638 | // | RESTSubResp | | |
| 4639 | // |<----------------| | |
| 4640 | // | | SubReq | |
| 4641 | // | |------------->| |
| 4642 | // | | | |
| 4643 | // | | SubResp | |
| 4644 | // | |<-------------| |
| 4645 | // | | | |
| 4646 | // | RESTNotif | | |
| 4647 | // |<----------------| | |
| 4648 | // | | | |
| 4649 | // | RESTSubDelReq | | |
| 4650 | // |---------------->| | |
| 4651 | // | | | |
| 4652 | // | | SubDelReq | |
| 4653 | // | |------------->| |
| 4654 | // | | | |
| 4655 | // | | SubDelResp | |
| 4656 | // | |<-------------| |
| 4657 | // | | | |
| 4658 | // | RESTSubDelResp | | |
| 4659 | // |<----------------| | |
| 4660 | // |
| 4661 | //----------------------------------------------------------------------------- |
| 4662 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4663 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4664 | |
| 4665 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4666 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4667 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4668 | Counter{cSubReqToE2, 2}, |
| 4669 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4670 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4671 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4672 | Counter{cSubDelReqToE2, 1}, |
| 4673 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4674 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4675 | }) |
| 4676 | |
| 4677 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4678 | const e2Timeout int64 = 1 |
| 4679 | const e2RetryCount int64 = 0 |
| 4680 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4681 | |
| 4682 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4683 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4684 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4685 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4686 | |
| 4687 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4688 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4689 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4690 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4691 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4692 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4693 | params.SetTimeToWait("w200ms") |
| 4694 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4695 | |
| 4696 | // Del |
| 4697 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4698 | |
| 4699 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4700 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4701 | |
| 4702 | // Wait that subs is cleaned |
| 4703 | waitSubsCleanup(t, e2SubsId, 10) |
| 4704 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4705 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4706 | } |
| 4707 | |
| 4708 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4709 | // TestRESTSubReqPolicyChangeNOk |
| 4710 | // |
| 4711 | // stub stub |
| 4712 | // +-------+ +---------+ +---------+ |
| 4713 | // | xapp | | submgr | | e2term | |
| 4714 | // +-------+ +---------+ +---------+ |
| 4715 | // | | | |
| 4716 | // | RESTSubReq | | |
| 4717 | // |---------------->| | |
| 4718 | // | | | |
| 4719 | // | RESTSubResp | | |
| 4720 | // |<----------------| | |
| 4721 | // | | SubReq | |
| 4722 | // | |------------->| |
| 4723 | // | | | |
| 4724 | // | | SubResp | |
| 4725 | // | |<-------------| |
| 4726 | // | | | |
| 4727 | // | RESTNotif | | |
| 4728 | // |<----------------| | |
| 4729 | // | | | |
| 4730 | // | RESTSubReq | | |
| 4731 | // |---------------->| | |
| 4732 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4733 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4734 | // | | | |
| 4735 | // | RESTSubDelReq | | |
| 4736 | // |---------------->| | |
| 4737 | // | | | |
| 4738 | // | | SubDelReq | |
| 4739 | // | |------------->| |
| 4740 | // | | | |
| 4741 | // | | SubDelResp | |
| 4742 | // | |<-------------| |
| 4743 | // | | | |
| 4744 | // | RESTSubDelResp | | |
| 4745 | // |<----------------| | |
| 4746 | // |
| 4747 | //----------------------------------------------------------------------------- |
| 4748 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4749 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4750 | |
| 4751 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4752 | Counter{cRestSubReqFromXapp, 2}, |
| 4753 | Counter{cRestSubRespToXapp, 1}, |
| 4754 | Counter{cSubReqToE2, 1}, |
| 4755 | Counter{cSubRespFromE2, 1}, |
| 4756 | Counter{cRestSubNotifToXapp, 1}, |
| 4757 | Counter{cRestSubFailToXapp, 1}, |
| 4758 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4759 | Counter{cSubDelReqToE2, 1}, |
| 4760 | Counter{cSubDelRespFromE2, 1}, |
| 4761 | Counter{cRestSubDelRespToXapp, 1}, |
| 4762 | }) |
| 4763 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4764 | // Req |
| 4765 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4766 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4767 | |
| 4768 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4769 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4770 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4771 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4772 | params.SetSubscriptionID(&restSubIdUpd) |
| 4773 | params.SetTimeToWait("w200ms") |
| 4774 | |
| 4775 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4776 | assert.Equal(t, restSubId2, "") |
| 4777 | |
| 4778 | // Del |
| 4779 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4780 | |
| 4781 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4782 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4783 | |
| 4784 | // Wait that subs is cleaned |
| 4785 | waitSubsCleanup(t, e2SubsId, 10) |
| 4786 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4787 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4788 | } |
| 4789 | |
| 4790 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4791 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4792 | // |
| 4793 | // stub stub stub |
| 4794 | // +-------+ +---------+ +---------+ +---------+ |
| 4795 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4796 | // +-------+ +---------+ +---------+ +---------+ |
| 4797 | // | | | | |
| 4798 | // | | | | |
| 4799 | // | | | | |
| 4800 | // | RESTSubReq1 | | | |
| 4801 | // |---------------->| | | |
| 4802 | // | | | | |
| 4803 | // | RESTSubResp1 | | | |
| 4804 | // |<----------------| | | |
| 4805 | // | | SubReq1 | | |
| 4806 | // | |------------->| | |
| 4807 | // | | | | |
| 4808 | // | RESTSubReq2 | | | |
| 4809 | // |---------------->| | | |
| 4810 | // | | | | |
| 4811 | // | RESTSubResp2 | | | |
| 4812 | // |<----------------| | | |
| 4813 | // | | SubReq2 | | |
| 4814 | // | |---------------------------->| |
| 4815 | // | | | | |
| 4816 | // | | SubResp1 | | |
| 4817 | // | |<-------------| | |
| 4818 | // | RESTNotif1 | | | |
| 4819 | // |<----------------| | | |
| 4820 | // | | SubResp2 | | |
| 4821 | // | |<----------------------------| |
| 4822 | // | RESTNotif2 | | | |
| 4823 | // |<----------------| | | |
| 4824 | // | | | | |
| 4825 | // | [SUBS 1 DELETE] | | |
| 4826 | // | | | | |
| 4827 | // | [SUBS 2 DELETE] | | |
| 4828 | // | | | | |
| 4829 | // |
| 4830 | //----------------------------------------------------------------------------- |
| 4831 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4832 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4833 | |
| 4834 | // Init counter check |
| 4835 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4836 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4837 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4838 | Counter{cSubReqToE2, 2}, |
| 4839 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4840 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4841 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4842 | Counter{cSubDelReqToE2, 2}, |
| 4843 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4844 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4845 | }) |
| 4846 | |
| 4847 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4848 | |
| 4849 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4850 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4851 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4852 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4853 | |
| 4854 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4855 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4856 | params.SetMeid("RAN_NAME_11") |
| 4857 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4858 | // would not work as notification would not be received |
| 4859 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4860 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4861 | |
| 4862 | // Resp1 |
| 4863 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4864 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4865 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4866 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4867 | |
| 4868 | // Resp2 |
| 4869 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4870 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4871 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4872 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4873 | |
| 4874 | // Delete1 |
| 4875 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4876 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4877 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4878 | |
| 4879 | // Wait that subs is cleaned |
| 4880 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4881 | |
| 4882 | // Delete2 |
| 4883 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4884 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4885 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4886 | |
| 4887 | // Wait that subs is cleaned |
| 4888 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4889 | |
| 4890 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4891 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4892 | } |
| 4893 | |
| 4894 | //----------------------------------------------------------------------------- |
| 4895 | // TestRESTSubReqAsn1EncodeFail |
| 4896 | // |
| 4897 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4898 | // stub stub |
| 4899 | // +-------+ +---------+ +---------+ |
| 4900 | // | xapp | | submgr | | e2term | |
| 4901 | // +-------+ +---------+ +---------+ |
| 4902 | // | | | |
| 4903 | // | RESTSubReq | | |
| 4904 | // |---------------->| | |
| 4905 | // | | | |
| 4906 | // | RESTSubResp | | |
| 4907 | // |<----------------| | |
| 4908 | // | RESTSubDelReq | | |
| 4909 | // |---------------->| | |
| 4910 | // | RESTSubDelResp | | |
| 4911 | // | unsuccess | | |
| 4912 | // |<----------------| | |
| 4913 | // | | | |
| 4914 | // |
| 4915 | //----------------------------------------------------------------------------- |
| 4916 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4917 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4918 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4919 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4920 | |
| 4921 | } |
| 4922 | |
| 4923 | //----------------------------------------------------------------------------- |
| 4924 | // TestRESTSubReqInsertAndSubDelOk |
| 4925 | // |
| 4926 | // stub stub |
| 4927 | // +-------+ +---------+ +---------+ |
| 4928 | // | xapp | | submgr | | e2term | |
| 4929 | // +-------+ +---------+ +---------+ |
| 4930 | // | | | |
| 4931 | // | RestSubReq | | |
| 4932 | // |---------------->| | |
| 4933 | // | | | |
| 4934 | // | RESTSubResp | | |
| 4935 | // |<----------------| | |
| 4936 | // | | | |
| 4937 | // | | SubReq | |
| 4938 | // | |------------->| |
| 4939 | // | | | |
| 4940 | // | | SubResp | |
| 4941 | // | |<-------------| |
| 4942 | // | RESTNotif | | |
| 4943 | // |<----------------| | |
| 4944 | // | ... | ... | |
| 4945 | // | | | |
| 4946 | // | RESTSubDelReq | | |
| 4947 | // |---------------->| | |
| 4948 | // | | | |
| 4949 | // | | SubDelReq | |
| 4950 | // | |------------->| |
| 4951 | // | | | |
| 4952 | // | | SubDelResp | |
| 4953 | // | |<-------------| |
| 4954 | // | | | |
| 4955 | // | RESTSubDelResp| | |
| 4956 | // |<----------------| | |
| 4957 | // |
| 4958 | //----------------------------------------------------------------------------- |
| 4959 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4960 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4961 | |
| 4962 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4963 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4964 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4965 | Counter{cSubReqToE2, 1}, |
| 4966 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4967 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4968 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4969 | Counter{cSubDelReqToE2, 1}, |
| 4970 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4971 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4972 | }) |
| 4973 | |
| 4974 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4975 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4976 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4977 | params.SetSubActionTypes("insert") |
| 4978 | |
| 4979 | // Req |
| 4980 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4981 | |
| 4982 | // Del |
| 4983 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4984 | |
| 4985 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4986 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4987 | |
| 4988 | // Wait that subs is cleaned |
| 4989 | waitSubsCleanup(t, e2SubsId, 10) |
| 4990 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4991 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4992 | } |
| 4993 | |
| 4994 | //----------------------------------------------------------------------------- |
| 4995 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4996 | // |
| 4997 | // stub stub |
| 4998 | // +-------+ +---------+ +---------+ |
| 4999 | // | xapp | | submgr | | e2term | |
| 5000 | // +-------+ +---------+ +---------+ |
| 5001 | // | | | |
| 5002 | // | RESTSubReq | | |
| 5003 | // |------------->| | |
| 5004 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5005 | // | RESTSubResp | | |
| 5006 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5007 | // | | SubReq | |
| 5008 | // | |------------->| |
| 5009 | // | | | |
| 5010 | // | | SubResp | |
| 5011 | // | <----| |
| 5012 | // | | |
| 5013 | // | Submgr restart | |
| 5014 | // | | |
| 5015 | // | | | |
| 5016 | // | | SubDelReq | |
| 5017 | // | |------------->| |
| 5018 | // | | | |
| 5019 | // | | SubDelResp | |
| 5020 | // | |<-------------| |
| 5021 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5022 | // | RESTNotif | | |
| 5023 | // | unsuccess | | |
| 5024 | // |<-------------| | |
| 5025 | // | | | |
| 5026 | // | RESTSubDelReq| | |
| 5027 | // |------------->| | |
| 5028 | // | | | |
| 5029 | // |RESTSubDelResp| | |
| 5030 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5031 | // |
| 5032 | //----------------------------------------------------------------------------- |
| 5033 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5034 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 5035 | |
| 5036 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5037 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5038 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5039 | Counter{cSubReqToE2, 1}, |
| 5040 | Counter{cSubDelReqFromXapp, 1}, |
| 5041 | Counter{cSubDelReqToE2, 1}, |
| 5042 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5043 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5044 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5045 | }) |
| 5046 | |
| 5047 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5048 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5049 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5050 | |
| 5051 | //Req |
| 5052 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5053 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5054 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5055 | |
| 5056 | e2termConn1.RecvSubsReq(t) |
| 5057 | |
| 5058 | mainCtrl.SetResetTestFlag(t, false) |
| 5059 | |
| 5060 | mainCtrl.SimulateRestart(t) |
| 5061 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5062 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5063 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5064 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5065 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5066 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5067 | //Del |
| 5068 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5069 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5070 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5071 | e2termConn1.TestMsgChanEmpty(t) |
| 5072 | mainCtrl.wait_registry_empty(t, 10) |
| 5073 | |
| 5074 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5075 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5076 | } |
| 5077 | |
| 5078 | //----------------------------------------------------------------------------- |
| 5079 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5080 | // |
| 5081 | // stub stub |
| 5082 | // +-------+ +---------+ +---------+ |
| 5083 | // | xapp | | submgr | | e2term | |
| 5084 | // +-------+ +---------+ +---------+ |
| 5085 | // | | | |
| 5086 | // | RESTSubReq | | |
| 5087 | // |---------------->| | |
| 5088 | // | | | |
| 5089 | // | RESTSubResp | | |
| 5090 | // |<----------------| | |
| 5091 | // | | SubReq | |
| 5092 | // | |------------->| |
| 5093 | // | | | |
| 5094 | // | | SubResp | |
| 5095 | // | |<-------------| |
| 5096 | // | | | |
| 5097 | // | RESTNotif | | |
| 5098 | // |<----------------| | |
| 5099 | // | | | |
| 5100 | // | | |
| 5101 | // | Submgr restart | |
| 5102 | // | | | |
| 5103 | // | RESTSubDelReq | | |
| 5104 | // |---------------->| | |
| 5105 | // | | | |
| 5106 | // | | SubDelReq | |
| 5107 | // | |------------->| |
| 5108 | // | | | |
| 5109 | // | | SubDelResp | |
| 5110 | // | |<-------------| |
| 5111 | // | | | |
| 5112 | // | RESTSubDelResp | | |
| 5113 | // |<----------------| | |
| 5114 | // |
| 5115 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5116 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5117 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5118 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5119 | |
| 5120 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5121 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5122 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5123 | Counter{cSubReqToE2, 1}, |
| 5124 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5125 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5126 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5127 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5128 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5129 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5130 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5131 | |
| 5132 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5133 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5134 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5135 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | |
| 5137 | // Check subscription |
| 5138 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5139 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5140 | mainCtrl.SimulateRestart(t) |
| 5141 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5142 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5143 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5144 | // That needs to be completed before successful subscription query is possible |
| 5145 | <-time.After(time.Second * 1) |
| 5146 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5147 | // Check subscription |
| 5148 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5149 | |
| 5150 | // Delete subscription |
| 5151 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5152 | |
| 5153 | //Wait that subs is cleaned |
| 5154 | waitSubsCleanup(t, e2SubsId, 10) |
| 5155 | |
| 5156 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5157 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5158 | } |
| 5159 | |
| 5160 | //----------------------------------------------------------------------------- |
| 5161 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5162 | // |
| 5163 | // stub stub |
| 5164 | // +-------+ +-------+ +---------+ +---------+ |
| 5165 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5166 | // +-------+ +-------+ +---------+ +---------+ |
| 5167 | // | | | | |
| 5168 | // | | RESTSubReq1 | | |
| 5169 | // | |---------------->| | |
| 5170 | // | | | | |
| 5171 | // | | RESTSubResp1 | | |
| 5172 | // | |<----------------| | |
| 5173 | // | | | | |
| 5174 | // | | | SubReq1 | |
| 5175 | // | | |------------->| |
| 5176 | // | | | SubResp1 | |
| 5177 | // | | |<-------------| |
| 5178 | // | | RESTNotif1 | | |
| 5179 | // | |<----------------| | |
| 5180 | // | | | | |
| 5181 | // | RESTSubReq2 | | |
| 5182 | // |------------------------------>| | |
| 5183 | // | | | | |
| 5184 | // | RESTSubResp2 | | |
| 5185 | // |<------------------------------| | |
| 5186 | // | | | | |
| 5187 | // | | RESTNotif2 | | |
| 5188 | // |<------------------------------| | |
| 5189 | // | | | | |
| 5190 | // | | Submgr restart | |
| 5191 | // | | | | |
| 5192 | // | | RESTSubDelReq1 | | |
| 5193 | // | |---------------->| | |
| 5194 | // | | | | |
| 5195 | // | | RESTSubDelResp1 | | |
| 5196 | // | |<----------------| | |
| 5197 | // | | | | |
| 5198 | // | | Submgr restart | |
| 5199 | // | | | | |
| 5200 | // | RESTSubDelReq2 | | |
| 5201 | // |------------------------------>| | |
| 5202 | // | | | | |
| 5203 | // | RESTSubDelResp2 | | |
| 5204 | // |<------------------------------| | |
| 5205 | // | | | | |
| 5206 | // | | | SubDelReq2 | |
| 5207 | // | | |------------->| |
| 5208 | // | | | | |
| 5209 | // | | | SubDelResp2 | |
| 5210 | // | | |<-------------| |
| 5211 | // | | | | |
| 5212 | // |
| 5213 | //----------------------------------------------------------------------------- |
| 5214 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5215 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5216 | |
| 5217 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5218 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5219 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5220 | Counter{cSubReqToE2, 1}, |
| 5221 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5222 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5223 | Counter{cMergedSubscriptions, 1}, |
| 5224 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5225 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5226 | Counter{cSubDelReqToE2, 1}, |
| 5227 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5228 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5229 | }) |
| 5230 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5231 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5232 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5233 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5234 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5235 | |
| 5236 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5237 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5238 | params.SetMeid("RAN_NAME_1") |
| 5239 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5240 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5241 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5242 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5243 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5244 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5245 | |
| 5246 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5247 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5248 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5249 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5250 | |
| 5251 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5252 | // That needs to be completed before successful subscription delete is possible |
| 5253 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5254 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5255 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 5256 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5257 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5258 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5259 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5260 | // Above wait does not work correctly anymore as this delay makes this test case work |
| 5261 | //<-time.After(time.Second * 1) |
| 5262 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5263 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5264 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5265 | |
| 5266 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5267 | // That needs to be completed before successful subscription query is possible |
| 5268 | <-time.After(time.Second * 1) |
| 5269 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5270 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5271 | |
| 5272 | // Delete subscription 2 |
| 5273 | deleteXapp2Subscription(t, &restSubId2) |
| 5274 | |
| 5275 | //Wait that subs is cleaned |
| 5276 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5277 | |
| 5278 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5279 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5280 | } |
| 5281 | |
| 5282 | //----------------------------------------------------------------------------- |
| 5283 | // TestRESTReportSubReqAndSubDelOk |
| 5284 | // |
| 5285 | // stub stub |
| 5286 | // +-------+ +---------+ +---------+ |
| 5287 | // | xapp | | submgr | | e2term | |
| 5288 | // +-------+ +---------+ +---------+ |
| 5289 | // | | | |
| 5290 | // | RestSubReq | | |
| 5291 | // |---------------->| | |
| 5292 | // | | | |
| 5293 | // | RESTSubResp | | |
| 5294 | // |<----------------| | |
| 5295 | // | | | |
| 5296 | // | | SubReq | |
| 5297 | // | |------------->| |
| 5298 | // | | | |
| 5299 | // | | SubResp | |
| 5300 | // | |<-------------| |
| 5301 | // | RESTNotif | | |
| 5302 | // |<----------------| | |
| 5303 | // | | SubReq | |
| 5304 | // | |------------->| |
| 5305 | // | | | |
| 5306 | // | | SubResp | |
| 5307 | // | |<-------------| |
| 5308 | // | RESTNotif | | |
| 5309 | // |<----------------| | |
| 5310 | // | ... | ... | |
| 5311 | // | | | |
| 5312 | // | | | |
| 5313 | // | RESTSubDelReq | | |
| 5314 | // |---------------->| | |
| 5315 | // | | | |
| 5316 | // | | SubDelReq | |
| 5317 | // | |------------->| |
| 5318 | // | | | |
| 5319 | // | | SubDelResp | |
| 5320 | // | |<-------------| |
| 5321 | // | | | |
| 5322 | // | RESTSubDelResp| | |
| 5323 | // |<----------------| | |
| 5324 | // |
| 5325 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5326 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5327 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5328 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5329 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5330 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5331 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5332 | } |
| 5333 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5334 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5335 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5336 | |
| 5337 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5338 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5339 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5340 | |
| 5341 | var e2SubsId []uint32 |
| 5342 | for i := 0; i < subReqCount; i++ { |
| 5343 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5344 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5345 | |
| 5346 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5347 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5348 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5349 | e2SubsId = append(e2SubsId, instanceId) |
| 5350 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5351 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5352 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5353 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5354 | |
| 5355 | } |
| 5356 | |
| 5357 | // Del |
| 5358 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5359 | |
| 5360 | for i := 0; i < subReqCount; i++ { |
| 5361 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5362 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5363 | } |
| 5364 | |
| 5365 | // Wait that subs is cleaned |
| 5366 | for i := 0; i < subReqCount; i++ { |
| 5367 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5368 | } |
| 5369 | |
| 5370 | xappConn1.TestMsgChanEmpty(t) |
| 5371 | e2termConn1.TestMsgChanEmpty(t) |
| 5372 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5373 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5374 | } |
| 5375 | |
| 5376 | /* |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 5377 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { was in comments already |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5378 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5379 | |
| 5380 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5381 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5382 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5383 | |
| 5384 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5385 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5386 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5387 | } |
| 5388 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5389 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5390 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5391 | |
| 5392 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5393 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5394 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5395 | |
| 5396 | var e2SubsId []uint32 |
| 5397 | for i := 0; i < subReqCount; i++ { |
| 5398 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5399 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5400 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5401 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5402 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5403 | e2SubsId = append(e2SubsId, instanceId) |
| 5404 | } |
| 5405 | |
| 5406 | // Del |
| 5407 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5408 | |
| 5409 | for i := 0; i < subReqCount; i++ { |
| 5410 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5411 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5412 | } |
| 5413 | |
| 5414 | // Wait that subs is cleaned |
| 5415 | for i := 0; i < subReqCount; i++ { |
| 5416 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5417 | } |
| 5418 | xappConn1.TestMsgChanEmpty(t) |
| 5419 | e2termConn1.TestMsgChanEmpty(t) |
| 5420 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5421 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5422 | } |
| 5423 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5424 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5425 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5426 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5427 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5428 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5429 | Counter{cSubReqToE2, 2}, |
| 5430 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5431 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5432 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5433 | Counter{cSubDelReqToE2, 2}, |
| 5434 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5435 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5436 | }) |
| 5437 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5438 | const subReqCount int = 2 |
| 5439 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5440 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5441 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5442 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5443 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5444 | |
| 5445 | assert.Equal(t, len(e2SubsIds), 2) |
| 5446 | |
| 5447 | // Del |
| 5448 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5449 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5450 | |
| 5451 | xappConn1.TestMsgChanEmpty(t) |
| 5452 | e2termConn1.TestMsgChanEmpty(t) |
| 5453 | mainCtrl.wait_registry_empty(t, 10) |
| 5454 | |
| 5455 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5456 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5457 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5458 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5459 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5460 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5461 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5462 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5463 | Counter{cSubReqToE2, 19}, |
| 5464 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5465 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5466 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5467 | Counter{cSubDelReqToE2, 19}, |
| 5468 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5469 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5470 | }) |
| 5471 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5472 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5473 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5474 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5475 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5476 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5477 | |
| 5478 | assert.Equal(t, len(e2SubsIds), 19) |
| 5479 | |
| 5480 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5481 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5482 | |
| 5483 | xappConn1.TestMsgChanEmpty(t) |
| 5484 | e2termConn1.TestMsgChanEmpty(t) |
| 5485 | mainCtrl.wait_registry_empty(t, 10) |
| 5486 | |
| 5487 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5488 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5489 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5490 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5491 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5492 | |
| 5493 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5494 | |
| 5495 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5496 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5497 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5498 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5499 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5500 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5501 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5502 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5503 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5504 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5505 | }) |
| 5506 | |
| 5507 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5508 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5509 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5510 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5511 | |
| 5512 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5513 | |
| 5514 | // Del |
| 5515 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5516 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5517 | |
| 5518 | xappConn1.TestMsgChanEmpty(t) |
| 5519 | e2termConn1.TestMsgChanEmpty(t) |
| 5520 | mainCtrl.wait_registry_empty(t, 10) |
| 5521 | |
| 5522 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5523 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5524 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5525 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5526 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5527 | |
| 5528 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5529 | |
| 5530 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5531 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5532 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5533 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5534 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5535 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5536 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5537 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5538 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5539 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5540 | }) |
| 5541 | |
| 5542 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5543 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5544 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5545 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5546 | |
| 5547 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5548 | |
| 5549 | // Del |
| 5550 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5551 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5552 | |
| 5553 | xappConn1.TestMsgChanEmpty(t) |
| 5554 | e2termConn1.TestMsgChanEmpty(t) |
| 5555 | mainCtrl.wait_registry_empty(t, 10) |
| 5556 | |
| 5557 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5558 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5559 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5560 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5561 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5562 | |
| 5563 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5564 | |
| 5565 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5566 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5567 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5568 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5569 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5570 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5571 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5572 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5573 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5574 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5575 | }) |
| 5576 | |
| 5577 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5578 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5579 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5580 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5581 | |
| 5582 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5583 | |
| 5584 | // Del |
| 5585 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5586 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5587 | |
| 5588 | xappConn1.TestMsgChanEmpty(t) |
| 5589 | e2termConn1.TestMsgChanEmpty(t) |
| 5590 | mainCtrl.wait_registry_empty(t, 10) |
| 5591 | |
| 5592 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5593 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5594 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5595 | |
| 5596 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5597 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5598 | |
| 5599 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5600 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5601 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5602 | Counter{cSubReqToE2, 2}, |
| 5603 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5604 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5605 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5606 | Counter{cSubDelReqToE2, 2}, |
| 5607 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5608 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5609 | }) |
| 5610 | |
| 5611 | // Req1 |
| 5612 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5613 | |
| 5614 | //Subs Create |
| 5615 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5616 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5617 | |
| 5618 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5619 | |
| 5620 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5621 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5622 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5623 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5624 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5625 | |
| 5626 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5627 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5628 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5629 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5630 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5631 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5632 | |
| 5633 | deleteXapp1Subscription(t, &restSubId1) |
| 5634 | deleteXapp2Subscription(t, &restSubId2) |
| 5635 | |
| 5636 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5637 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5638 | |
| 5639 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5640 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5641 | } |
| 5642 | |
| 5643 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5644 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5645 | |
| 5646 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5647 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5648 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5649 | Counter{cSubReqToE2, 2}, |
| 5650 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5651 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5652 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5653 | Counter{cSubDelReqToE2, 2}, |
| 5654 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5655 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5656 | }) |
| 5657 | |
| 5658 | // Req1 |
| 5659 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5660 | |
| 5661 | //Subs Create |
| 5662 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5663 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5664 | |
| 5665 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5666 | |
| 5667 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5668 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5669 | params.SetMeid("RAN_NAME_1") |
| 5670 | |
| 5671 | actionId := int64(1) |
| 5672 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5673 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5674 | subsequestActionType := "continue" |
| 5675 | timeToWait := "w10ms" |
| 5676 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5677 | |
| 5678 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5679 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5680 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5681 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5682 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5683 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5684 | |
| 5685 | deleteXapp1Subscription(t, &restSubId1) |
| 5686 | deleteXapp2Subscription(t, &restSubId2) |
| 5687 | |
| 5688 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5689 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5690 | |
| 5691 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5692 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5693 | } |
| 5694 | |
| 5695 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5696 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5697 | |
| 5698 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5699 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5700 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5701 | Counter{cSubReqToE2, 2}, |
| 5702 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5703 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5704 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5705 | Counter{cSubDelReqToE2, 2}, |
| 5706 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5707 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5708 | }) |
| 5709 | |
| 5710 | // Req1 |
| 5711 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5712 | |
| 5713 | //Subs Create |
| 5714 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5715 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5716 | |
| 5717 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5718 | |
| 5719 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5720 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5721 | params.SetMeid("RAN_NAME_1") |
| 5722 | params.SetSubActionIDs(int64(2)) |
| 5723 | |
| 5724 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5725 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5726 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5727 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5728 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5729 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5730 | |
| 5731 | deleteXapp1Subscription(t, &restSubId1) |
| 5732 | deleteXapp2Subscription(t, &restSubId2) |
| 5733 | |
| 5734 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5735 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5736 | |
| 5737 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5738 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5739 | } |
| 5740 | |
| 5741 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5742 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5743 | |
| 5744 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5745 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5746 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5747 | Counter{cSubReqToE2, 2}, |
| 5748 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5749 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5750 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5751 | Counter{cSubDelReqToE2, 2}, |
| 5752 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5753 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5754 | }) |
| 5755 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5756 | const e2Timeout int64 = 2 |
| 5757 | const e2RetryCount int64 = 2 |
| 5758 | const routingNeeded bool = true |
| 5759 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5760 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5761 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5762 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5763 | |
| 5764 | //Subs Create |
| 5765 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5766 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5767 | |
| 5768 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5769 | |
| 5770 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5771 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5772 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5773 | params.SetMeid("RAN_NAME_1") |
| 5774 | |
| 5775 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5776 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5777 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5778 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5779 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5780 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5781 | |
| 5782 | deleteXapp1Subscription(t, &restSubId1) |
| 5783 | deleteXapp2Subscription(t, &restSubId2) |
| 5784 | |
| 5785 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5786 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5787 | |
| 5788 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5789 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5790 | } |
| 5791 | |
| 5792 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5793 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5794 | |
| 5795 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5796 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5797 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5798 | Counter{cSubReqToE2, 2}, |
| 5799 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5800 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5801 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5802 | Counter{cSubDelReqToE2, 2}, |
| 5803 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5804 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5805 | }) |
| 5806 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5807 | const e2Timeout int64 = 2 |
| 5808 | const e2RetryCount int64 = 2 |
| 5809 | const routingNeeded bool = true |
| 5810 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5811 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5812 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5813 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5814 | |
| 5815 | //Subs Create |
| 5816 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5817 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5818 | |
| 5819 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5820 | |
| 5821 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5822 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5823 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5824 | params.SetMeid("RAN_NAME_1") |
| 5825 | |
| 5826 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5827 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5828 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5829 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5830 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5831 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5832 | |
| 5833 | deleteXapp1Subscription(t, &restSubId1) |
| 5834 | deleteXapp2Subscription(t, &restSubId2) |
| 5835 | |
| 5836 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5837 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5838 | |
| 5839 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5840 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5841 | } |
| 5842 | |
| 5843 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5844 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5845 | |
| 5846 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5847 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5848 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5849 | Counter{cSubReqToE2, 2}, |
| 5850 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5851 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5852 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5853 | Counter{cSubDelReqToE2, 2}, |
| 5854 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5855 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5856 | }) |
| 5857 | |
| 5858 | // Req1 |
| 5859 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5860 | |
| 5861 | //Subs Create |
| 5862 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5863 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5864 | |
| 5865 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5866 | |
| 5867 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5868 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5869 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5870 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5871 | params.SetSubActionDefinition(actionDefinition) |
| 5872 | |
| 5873 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5874 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5875 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5876 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5877 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5878 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5879 | |
| 5880 | deleteXapp1Subscription(t, &restSubId1) |
| 5881 | deleteXapp2Subscription(t, &restSubId2) |
| 5882 | |
| 5883 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5884 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5885 | |
| 5886 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5887 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5888 | } |
| 5889 | |
| 5890 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5891 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5892 | |
| 5893 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5894 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5895 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5896 | Counter{cSubReqToE2, 2}, |
| 5897 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5898 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5899 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5900 | Counter{cSubDelReqToE2, 2}, |
| 5901 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5902 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5903 | }) |
| 5904 | |
| 5905 | // Req1 |
| 5906 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5907 | |
| 5908 | //Subs Create |
| 5909 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5910 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5911 | |
| 5912 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5913 | |
| 5914 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5915 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5916 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5917 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5918 | params.SetSubActionDefinition(actionDefinition) |
| 5919 | |
| 5920 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5921 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5922 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5923 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5924 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5925 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5926 | |
| 5927 | deleteXapp1Subscription(t, &restSubId1) |
| 5928 | deleteXapp2Subscription(t, &restSubId2) |
| 5929 | |
| 5930 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5931 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5932 | |
| 5933 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5934 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5935 | } |
| 5936 | |
| 5937 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5938 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5939 | |
| 5940 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5941 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5942 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5943 | Counter{cSubReqToE2, 2}, |
| 5944 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5945 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5946 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5947 | Counter{cSubDelReqToE2, 2}, |
| 5948 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5949 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5950 | }) |
| 5951 | |
| 5952 | // Req1 |
| 5953 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5954 | |
| 5955 | //Subs Create |
| 5956 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5957 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5958 | |
| 5959 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5960 | |
| 5961 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5962 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5963 | params.SetMeid("RAN_NAME_1") |
| 5964 | params.SetTimeToWait("w200ms") |
| 5965 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5966 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5967 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5968 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5969 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5970 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5971 | |
| 5972 | deleteXapp1Subscription(t, &restSubId1) |
| 5973 | deleteXapp2Subscription(t, &restSubId2) |
| 5974 | |
| 5975 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5976 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5977 | |
| 5978 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5979 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5980 | } |
| 5981 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5982 | //----------------------------------------------------------------------------- |
| 5983 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5984 | // |
| 5985 | // stub stub |
| 5986 | // +-------+ +---------+ +---------+ |
| 5987 | // | xapp | | submgr | | e2term | |
| 5988 | // +-------+ +---------+ +---------+ |
| 5989 | // | | | |
| 5990 | // | RestSubReq | | |
| 5991 | // |---------------->| | |
| 5992 | // | | | |
| 5993 | // | RESTSubResp | | |
| 5994 | // |<----------------| | |
| 5995 | // | | | |
| 5996 | // | | SubReq | |
| 5997 | // | |------------->| |
| 5998 | // | | | |
| 5999 | // | | SubResp | ASN.1 decode fails |
| 6000 | // | |<-------------| |
| 6001 | // | | | |
| 6002 | // | | SubReq | |
| 6003 | // | |------------->| |
| 6004 | // | | | |
| 6005 | // | | SubFail | Duplicated action |
| 6006 | // | |<-------------| |
| 6007 | // | RESTNotif (fail)| | |
| 6008 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6009 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6010 | // |
| 6011 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6012 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6013 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6014 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 6015 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6016 | |
| 6017 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6018 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6019 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6020 | |
| 6021 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6022 | // Decode of this response fails which will result resending original request |
| 6023 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 6024 | |
| 6025 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6026 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6027 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6028 | |
| 6029 | // Subscription already created in E2 Node. |
| 6030 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6031 | fparams.Set(crereq) |
| 6032 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6033 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6034 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6035 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6036 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6037 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6038 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6039 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6040 | // Wait that subs is cleaned |
| 6041 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6042 | |
| 6043 | xappConn1.TestMsgChanEmpty(t) |
| 6044 | e2termConn1.TestMsgChanEmpty(t) |
| 6045 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6046 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6047 | } |
| 6048 | |
| 6049 | //----------------------------------------------------------------------------- |
| 6050 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6051 | // |
| 6052 | // stub stub |
| 6053 | // +-------+ +---------+ +---------+ |
| 6054 | // | xapp | | submgr | | e2term | |
| 6055 | // +-------+ +---------+ +---------+ |
| 6056 | // | | | |
| 6057 | // | RestSubReq | | |
| 6058 | // |---------------->| | |
| 6059 | // | | | |
| 6060 | // | RESTSubResp | | |
| 6061 | // |<----------------| | |
| 6062 | // | | | |
| 6063 | // | | SubReq | |
| 6064 | // | |------------->| |
| 6065 | // | | | |
| 6066 | // | | SubResp | Unknown instanceId |
| 6067 | // | |<-------------| |
| 6068 | // | | | |
| 6069 | // | | SubReq | |
| 6070 | // | |------------->| |
| 6071 | // | | | |
| 6072 | // | | SubFail | Duplicated action |
| 6073 | // | |<-------------| |
| 6074 | // | RESTNotif (fail)| | |
| 6075 | // |<----------------| | |
| 6076 | // | | SubDelReq | |
| 6077 | // | |------------->| |
| 6078 | // | | | |
| 6079 | // | | SubDelResp | |
| 6080 | // | |<-------------| |
| 6081 | // |
| 6082 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6083 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6084 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6085 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 6086 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6087 | |
| 6088 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6089 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6090 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6091 | |
| 6092 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6093 | |
| 6094 | // Unknown instanceId in this response which will result resending original request |
| 6095 | orgInstanceId := crereq.RequestId.InstanceId |
| 6096 | crereq.RequestId.InstanceId = 0 |
| 6097 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6098 | |
| 6099 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6100 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6101 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6102 | |
| 6103 | // Subscription already created in E2 Node. |
| 6104 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6105 | fparams.Set(crereq) |
| 6106 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6107 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6108 | |
| 6109 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6110 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6111 | |
| 6112 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6113 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6114 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6115 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6116 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6117 | // Wait that subs is cleaned |
| 6118 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6119 | |
| 6120 | xappConn1.TestMsgChanEmpty(t) |
| 6121 | e2termConn1.TestMsgChanEmpty(t) |
| 6122 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6123 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6124 | } |
| 6125 | |
| 6126 | //----------------------------------------------------------------------------- |
| 6127 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6128 | // |
| 6129 | // stub stub |
| 6130 | // +-------+ +---------+ +---------+ |
| 6131 | // | xapp | | submgr | | e2term | |
| 6132 | // +-------+ +---------+ +---------+ |
| 6133 | // | | | |
| 6134 | // | RestSubReq | | |
| 6135 | // |---------------->| | |
| 6136 | // | | | |
| 6137 | // | RESTSubResp | | |
| 6138 | // |<----------------| | |
| 6139 | // | | | |
| 6140 | // | | SubReq | |
| 6141 | // | |------------->| |
| 6142 | // | | | |
| 6143 | // | | SubResp | No transaction for the response |
| 6144 | // | |<-------------| |
| 6145 | // | | | |
| 6146 | // | | SubReq | |
| 6147 | // | |------------->| |
| 6148 | // | | | |
| 6149 | // | | SubFail | Duplicated action |
| 6150 | // | |<-------------| |
| 6151 | // | RESTNotif (fail)| | |
| 6152 | // |<----------------| | |
| 6153 | // | | SubDelReq | |
| 6154 | // | |------------->| |
| 6155 | // | | | |
| 6156 | // | | SubDelResp | |
| 6157 | // | |<-------------| |
| 6158 | // | | | |
| 6159 | // | | SubDelReq | |
| 6160 | // | |------------->| |
| 6161 | // | | | |
| 6162 | // | | SubDelResp | |
| 6163 | // | |<-------------| |
| 6164 | // |
| 6165 | //----------------------------------------------------------------------------- |
| 6166 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6167 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6168 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6169 | |
| 6170 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6171 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6172 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6173 | |
| 6174 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6175 | |
| 6176 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6177 | // No transaction exist for this response which will result resending original request |
| 6178 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 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 | |
| 6190 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6191 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6192 | |
| 6193 | // Resending happens because there no transaction |
| 6194 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6195 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6196 | |
| 6197 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6198 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6199 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6200 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6201 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6202 | // Wait that subs is cleaned |
| 6203 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6204 | |
| 6205 | xappConn1.TestMsgChanEmpty(t) |
| 6206 | e2termConn1.TestMsgChanEmpty(t) |
| 6207 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6208 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6209 | } |
| 6210 | |
| 6211 | //----------------------------------------------------------------------------- |
| 6212 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6213 | // |
| 6214 | // stub stub |
| 6215 | // +-------+ +---------+ +---------+ |
| 6216 | // | xapp | | submgr | | e2term | |
| 6217 | // +-------+ +---------+ +---------+ |
| 6218 | // | | | |
| 6219 | // | RestSubReq | | |
| 6220 | // |---------------->| | |
| 6221 | // | | | |
| 6222 | // | RESTSubResp | | |
| 6223 | // |<----------------| | |
| 6224 | // | | | |
| 6225 | // | | SubReq | |
| 6226 | // | |------------->| |
| 6227 | // | | | |
| 6228 | // | | SubFail | ASN.1 decode fails |
| 6229 | // | |<-------------| |
| 6230 | // | | | |
| 6231 | // | | SubReq | |
| 6232 | // | |------------->| |
| 6233 | // | | | |
| 6234 | // | | SubFail | Duplicated action |
| 6235 | // | |<-------------| |
| 6236 | // | RESTNotif (fail)| | |
| 6237 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6238 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6239 | // |
| 6240 | //----------------------------------------------------------------------------- |
| 6241 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6242 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6243 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6244 | |
| 6245 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6246 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6247 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6248 | |
| 6249 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6250 | |
| 6251 | // Decode of this response fails which will result resending original request |
| 6252 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6253 | |
| 6254 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6255 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6256 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6257 | |
| 6258 | // Subscription already created in E2 Node. |
| 6259 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6260 | fparams.Set(crereq) |
| 6261 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6262 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6263 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6264 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6265 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6266 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6267 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6268 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6269 | // Wait that subs is cleaned |
| 6270 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6271 | |
| 6272 | xappConn1.TestMsgChanEmpty(t) |
| 6273 | e2termConn1.TestMsgChanEmpty(t) |
| 6274 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6275 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6276 | } |
| 6277 | |
| 6278 | //----------------------------------------------------------------------------- |
| 6279 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6280 | // |
| 6281 | // stub stub |
| 6282 | // +-------+ +---------+ +---------+ |
| 6283 | // | xapp | | submgr | | e2term | |
| 6284 | // +-------+ +---------+ +---------+ |
| 6285 | // | | | |
| 6286 | // | RestSubReq | | |
| 6287 | // |---------------->| | |
| 6288 | // | | | |
| 6289 | // | RESTSubResp | | |
| 6290 | // |<----------------| | |
| 6291 | // | | | |
| 6292 | // | | SubReq | |
| 6293 | // | |------------->| |
| 6294 | // | | | |
| 6295 | // | | SubFail | Unknown instanceId |
| 6296 | // | |<-------------| |
| 6297 | // | | | |
| 6298 | // | | SubReq | |
| 6299 | // | |------------->| |
| 6300 | // | | | |
| 6301 | // | | SubFail | Duplicated action |
| 6302 | // | |<-------------| |
| 6303 | // | RESTNotif (fail)| | |
| 6304 | // |<----------------| | |
| 6305 | // | | SubDelReq | |
| 6306 | // | |------------->| |
| 6307 | // | | | |
| 6308 | // | | SubDelResp | |
| 6309 | // | |<-------------| |
| 6310 | // |
| 6311 | //----------------------------------------------------------------------------- |
| 6312 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6313 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6314 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6315 | |
| 6316 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6317 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6318 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6319 | |
| 6320 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6321 | |
| 6322 | // Unknown instanceId in this response which will result resending original request |
| 6323 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6324 | fparams.Set(crereq) |
| 6325 | fparams.Fail.RequestId.InstanceId = 0 |
| 6326 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6327 | |
| 6328 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6329 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6330 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6331 | |
| 6332 | // Subscription already created in E2 Node. |
| 6333 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6334 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6335 | |
| 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 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6342 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6343 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6344 | // Wait that subs is cleaned |
| 6345 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6346 | |
| 6347 | xappConn1.TestMsgChanEmpty(t) |
| 6348 | e2termConn1.TestMsgChanEmpty(t) |
| 6349 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6350 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6351 | } |
| 6352 | |
| 6353 | //----------------------------------------------------------------------------- |
| 6354 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6355 | // |
| 6356 | // stub stub |
| 6357 | // +-------+ +---------+ +---------+ |
| 6358 | // | xapp | | submgr | | e2term | |
| 6359 | // +-------+ +---------+ +---------+ |
| 6360 | // | | | |
| 6361 | // | RestSubReq | | |
| 6362 | // |---------------->| | |
| 6363 | // | | | |
| 6364 | // | RESTSubResp | | |
| 6365 | // |<----------------| | |
| 6366 | // | | | |
| 6367 | // | | SubReq | |
| 6368 | // | |------------->| |
| 6369 | // | | | |
| 6370 | // | | SubFail | No transaction for the response |
| 6371 | // | |<-------------| |
| 6372 | // | | | |
| 6373 | // | | SubReq | |
| 6374 | // | |------------->| |
| 6375 | // | | | |
| 6376 | // | | SubFail | Duplicated action |
| 6377 | // | |<-------------| |
| 6378 | // | RESTNotif (fail)| | |
| 6379 | // |<----------------| | |
| 6380 | // | | SubDelReq | |
| 6381 | // | |------------->| |
| 6382 | // | | | |
| 6383 | // | | SubDelResp | |
| 6384 | // | |<-------------| |
| 6385 | // |
| 6386 | //----------------------------------------------------------------------------- |
| 6387 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6388 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6389 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6390 | |
| 6391 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6392 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6393 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6394 | |
| 6395 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6396 | |
| 6397 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6398 | |
| 6399 | // No transaction exist for this response which will result resending original request |
| 6400 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6401 | fparams.Set(crereq) |
| 6402 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6403 | |
| 6404 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6405 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6406 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6407 | |
| 6408 | // Subscription already created in E2 Node. |
| 6409 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6410 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6411 | |
| 6412 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6413 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6414 | |
| 6415 | // Resending happens because there no transaction |
| 6416 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6417 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6418 | |
| 6419 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6420 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6421 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6422 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6423 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6424 | // Wait that subs is cleaned |
| 6425 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6426 | |
| 6427 | xappConn1.TestMsgChanEmpty(t) |
| 6428 | e2termConn1.TestMsgChanEmpty(t) |
| 6429 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6430 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6431 | } |
| 6432 | |
| 6433 | //----------------------------------------------------------------------------- |
| 6434 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6435 | // |
| 6436 | // stub stub |
| 6437 | // +-------+ +---------+ +---------+ |
| 6438 | // | xapp | | submgr | | e2term | |
| 6439 | // +-------+ +---------+ +---------+ |
| 6440 | // | | | |
| 6441 | // | [SUBS CREATE] | |
| 6442 | // | | | |
| 6443 | // | | | |
| 6444 | // | RESTSubDelReq | | |
| 6445 | // |---------------->| | |
| 6446 | // | | | |
| 6447 | // | RESTSubDelResp | | |
| 6448 | // |<----------------| | |
| 6449 | // | | | |
| 6450 | // | | SubDelReq | |
| 6451 | // | |------------->| |
| 6452 | // | | | |
| 6453 | // | | SubDelResp | ASN.1 decode fails |
| 6454 | // | |<-------------| |
| 6455 | // | | | |
| 6456 | // | | SubDelReq | |
| 6457 | // | |------------->| |
| 6458 | // | | | |
| 6459 | // | | SubDelFail | Subscription does exist any more |
| 6460 | // | |<-------------| |
| 6461 | // | | | |
| 6462 | // |
| 6463 | //----------------------------------------------------------------------------- |
| 6464 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6465 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6466 | |
| 6467 | // Req |
| 6468 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6469 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6470 | |
| 6471 | // Del |
| 6472 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6473 | |
| 6474 | // E2t: Receive 1st SubsDelReq |
| 6475 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6476 | |
| 6477 | // Decode of this response fails which will result resending original request |
| 6478 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6479 | |
| 6480 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6481 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6482 | |
| 6483 | // Subscription does not exist in in E2 Node. |
| 6484 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6485 | |
| 6486 | // Wait that subs is cleaned |
| 6487 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6488 | |
| 6489 | xappConn1.TestMsgChanEmpty(t) |
| 6490 | e2termConn1.TestMsgChanEmpty(t) |
| 6491 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6492 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6493 | } |
| 6494 | |
| 6495 | //----------------------------------------------------------------------------- |
| 6496 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6497 | // |
| 6498 | // stub stub |
| 6499 | // +-------+ +---------+ +---------+ |
| 6500 | // | xapp | | submgr | | e2term | |
| 6501 | // +-------+ +---------+ +---------+ |
| 6502 | // | | | |
| 6503 | // | [SUBS CREATE] | |
| 6504 | // | | | |
| 6505 | // | | | |
| 6506 | // | RESTSubDelReq | | |
| 6507 | // |---------------->| | |
| 6508 | // | | | |
| 6509 | // | RESTSubDelResp | | |
| 6510 | // |<----------------| | |
| 6511 | // | | | |
| 6512 | // | | SubDelReq | |
| 6513 | // | |------------->| |
| 6514 | // | | | |
| 6515 | // | | SubDelResp | Unknown instanceId |
| 6516 | // | |<-------------| |
| 6517 | // | | | |
| 6518 | // | | SubDelReq | |
| 6519 | // | |------------->| |
| 6520 | // | | | |
| 6521 | // | | SubDelFail | Subscription does exist any more |
| 6522 | // | |<-------------| |
| 6523 | // |
| 6524 | //----------------------------------------------------------------------------- |
| 6525 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6526 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6527 | |
| 6528 | // Req |
| 6529 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6530 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6531 | |
| 6532 | // Del |
| 6533 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6534 | |
| 6535 | // E2t: Receive 1st SubsDelReq |
| 6536 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6537 | |
| 6538 | // Unknown instanceId in this response which will result resending original request |
| 6539 | delreq.RequestId.InstanceId = 0 |
| 6540 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6541 | |
| 6542 | // E2t: Receive 2nd SubsDelReq |
| 6543 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6544 | |
| 6545 | // Subscription does not exist in in E2 Node. |
| 6546 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6547 | |
| 6548 | // Wait that subs is cleaned |
| 6549 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6550 | |
| 6551 | xappConn1.TestMsgChanEmpty(t) |
| 6552 | e2termConn1.TestMsgChanEmpty(t) |
| 6553 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6554 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6555 | } |
| 6556 | |
| 6557 | //----------------------------------------------------------------------------- |
| 6558 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6559 | // |
| 6560 | // stub stub |
| 6561 | // +-------+ +---------+ +---------+ |
| 6562 | // | xapp | | submgr | | e2term | |
| 6563 | // +-------+ +---------+ +---------+ |
| 6564 | // | | | |
| 6565 | // | [SUBS CREATE] | |
| 6566 | // | | | |
| 6567 | // | | | |
| 6568 | // | RESTSubDelReq | | |
| 6569 | // |---------------->| | |
| 6570 | // | | | |
| 6571 | // | RESTSubDelResp | | |
| 6572 | // |<----------------| | |
| 6573 | // | | | |
| 6574 | // | | SubDelReq | |
| 6575 | // | |------------->| |
| 6576 | // | | | |
| 6577 | // | | SubDelResp | No transaction for the response |
| 6578 | // | |<-------------| |
| 6579 | // | | | |
| 6580 | // | | SubDelReq | |
| 6581 | // | |------------->| |
| 6582 | // | | | |
| 6583 | // | | SubDelFail | Subscription does exist any more |
| 6584 | // | |<-------------| |
| 6585 | // |
| 6586 | //----------------------------------------------------------------------------- |
| 6587 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6588 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6589 | |
| 6590 | // Req |
| 6591 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6592 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6593 | |
| 6594 | // Del |
| 6595 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6596 | |
| 6597 | // E2t: Receive 1st SubsDelReq |
| 6598 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6599 | |
| 6600 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6601 | |
| 6602 | // No transaction exist for this response which will result resending original request |
| 6603 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6604 | |
| 6605 | // E2t: Receive 2nd SubsDelReq |
| 6606 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6607 | |
| 6608 | // Subscription does not exist in in E2 Node. |
| 6609 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6610 | |
| 6611 | // Wait that subs is cleaned |
| 6612 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6613 | |
| 6614 | xappConn1.TestMsgChanEmpty(t) |
| 6615 | e2termConn1.TestMsgChanEmpty(t) |
| 6616 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6617 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6618 | } |
| 6619 | |
| 6620 | //----------------------------------------------------------------------------- |
| 6621 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6622 | // |
| 6623 | // stub stub |
| 6624 | // +-------+ +---------+ +---------+ |
| 6625 | // | xapp | | submgr | | e2term | |
| 6626 | // +-------+ +---------+ +---------+ |
| 6627 | // | | | |
| 6628 | // | [SUBS CREATE] | |
| 6629 | // | | | |
| 6630 | // | | | |
| 6631 | // | RESTSubDelReq | | |
| 6632 | // |---------------->| | |
| 6633 | // | | | |
| 6634 | // | RESTSubDelResp | | |
| 6635 | // |<----------------| | |
| 6636 | // | | | |
| 6637 | // | | SubDelReq | |
| 6638 | // | |------------->| |
| 6639 | // | | | |
| 6640 | // | | SubDelFail | ASN.1 decode fails |
| 6641 | // | |<-------------| |
| 6642 | // | | | |
| 6643 | // | | SubDelReq | |
| 6644 | // | |------------->| |
| 6645 | // | | | |
| 6646 | // | | SubDelFail | Subscription does exist any more |
| 6647 | // | |<-------------| |
| 6648 | // |
| 6649 | //----------------------------------------------------------------------------- |
| 6650 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6651 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6652 | |
| 6653 | // Req |
| 6654 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6655 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6656 | |
| 6657 | // Del |
| 6658 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6659 | |
| 6660 | // E2t: Receive 1st SubsDelReq |
| 6661 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6662 | |
| 6663 | // Decode of this response fails which will result resending original request |
| 6664 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6665 | |
| 6666 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6667 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6668 | |
| 6669 | // Subscription does not exist in in E2 Node. |
| 6670 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6671 | |
| 6672 | // Wait that subs is cleaned |
| 6673 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6674 | |
| 6675 | xappConn1.TestMsgChanEmpty(t) |
| 6676 | e2termConn1.TestMsgChanEmpty(t) |
| 6677 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6678 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6679 | } |
| 6680 | |
| 6681 | //----------------------------------------------------------------------------- |
| 6682 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6683 | // |
| 6684 | // stub stub |
| 6685 | // +-------+ +---------+ +---------+ |
| 6686 | // | xapp | | submgr | | e2term | |
| 6687 | // +-------+ +---------+ +---------+ |
| 6688 | // | | | |
| 6689 | // | [SUBS CREATE] | |
| 6690 | // | | | |
| 6691 | // | | | |
| 6692 | // | RESTSubDelReq | | |
| 6693 | // |---------------->| | |
| 6694 | // | | | |
| 6695 | // | RESTSubDelResp | | |
| 6696 | // |<----------------| | |
| 6697 | // | | | |
| 6698 | // | | SubDelReq | |
| 6699 | // | |------------->| |
| 6700 | // | | | |
| 6701 | // | | SubDelFail | Unknown instanceId |
| 6702 | // | |<-------------| |
| 6703 | // | | | |
| 6704 | // | | SubDelReq | |
| 6705 | // | |------------->| |
| 6706 | // | | | |
| 6707 | // | | SubDelFail | Subscription does exist any more |
| 6708 | // | |<-------------| |
| 6709 | // |
| 6710 | //----------------------------------------------------------------------------- |
| 6711 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6712 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6713 | |
| 6714 | // Req |
| 6715 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6716 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6717 | |
| 6718 | // Del |
| 6719 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6720 | |
| 6721 | // E2t: Receive 1st SubsDelReq |
| 6722 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6723 | |
| 6724 | // Unknown instanceId in this response which will result resending original request |
| 6725 | delreq.RequestId.InstanceId = 0 |
| 6726 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6727 | |
| 6728 | // E2t: Receive 2nd SubsDelReq |
| 6729 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6730 | |
| 6731 | // Subscription does not exist in in E2 Node. |
| 6732 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6733 | |
| 6734 | // Wait that subs is cleaned |
| 6735 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6736 | |
| 6737 | xappConn1.TestMsgChanEmpty(t) |
| 6738 | e2termConn1.TestMsgChanEmpty(t) |
| 6739 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6740 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6741 | } |
| 6742 | |
| 6743 | //----------------------------------------------------------------------------- |
| 6744 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6745 | // |
| 6746 | // stub stub |
| 6747 | // +-------+ +---------+ +---------+ |
| 6748 | // | xapp | | submgr | | e2term | |
| 6749 | // +-------+ +---------+ +---------+ |
| 6750 | // | | | |
| 6751 | // | [SUBS CREATE] | |
| 6752 | // | | | |
| 6753 | // | | | |
| 6754 | // | RESTSubDelReq | | |
| 6755 | // |---------------->| | |
| 6756 | // | | | |
| 6757 | // | RESTSubDelResp | | |
| 6758 | // |<----------------| | |
| 6759 | // | | | |
| 6760 | // | | SubDelReq | |
| 6761 | // | |------------->| |
| 6762 | // | | | |
| 6763 | // | | SubDelFail | No transaction for the response |
| 6764 | // | |<-------------| |
| 6765 | // | | | |
| 6766 | // | | SubDelReq | |
| 6767 | // | |------------->| |
| 6768 | // | | | |
| 6769 | // | | SubDelFail | Subscription does exist any more |
| 6770 | // | |<-------------| |
| 6771 | // |
| 6772 | //----------------------------------------------------------------------------- |
| 6773 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6774 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6775 | |
| 6776 | // Req |
| 6777 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6778 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6779 | |
| 6780 | // Del |
| 6781 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6782 | |
| 6783 | // E2t: Receive 1st SubsDelReq |
| 6784 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6785 | |
| 6786 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6787 | |
| 6788 | // No transaction exist for this response which will result resending original request |
| 6789 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6790 | |
| 6791 | // E2t: Receive 2nd SubsDelReq |
| 6792 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6793 | |
| 6794 | // Subscription does not exist in in E2 Node. |
| 6795 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6796 | |
| 6797 | // Wait that subs is cleaned |
| 6798 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6799 | |
| 6800 | xappConn1.TestMsgChanEmpty(t) |
| 6801 | e2termConn1.TestMsgChanEmpty(t) |
| 6802 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6803 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6804 | } |
| 6805 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6806 | //----------------------------------------------------------------------------- |
| 6807 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6808 | // |
| 6809 | // stub stub |
| 6810 | // +-------+ +---------+ +---------+ |
| 6811 | // | xapp | | submgr | | e2term | |
| 6812 | // +-------+ +---------+ +---------+ |
| 6813 | // | | | |
| 6814 | // | RESTSubReq | | |
| 6815 | // |---------------->| | |
| 6816 | // | | | |
| 6817 | // | RESTSubResp | | |
| 6818 | // |<----------------| | |
| 6819 | // | | | |
| 6820 | // | ASN.1 encode fails | |
| 6821 | // | | | |
| 6822 | // | | SubDelReq | |
| 6823 | // | |------------->| |
| 6824 | // | | | |
| 6825 | // | | SubDelFail | |
| 6826 | // | |<-------------| |
| 6827 | // | | | |
| 6828 | // | RESTNotif | | |
| 6829 | // | unsuccess | | |
| 6830 | // |<----------------| | |
| 6831 | // | | | |
| 6832 | // | [SUBS DELETE] | |
| 6833 | // | | | |
| 6834 | // |
| 6835 | //----------------------------------------------------------------------------- |
| 6836 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6837 | |
| 6838 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6839 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6840 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6841 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6842 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6843 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6844 | }) |
| 6845 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6846 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6847 | |
| 6848 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6849 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6850 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6851 | |
| 6852 | // Req |
| 6853 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6854 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6855 | |
| 6856 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6857 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6858 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6859 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6860 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6861 | |
| 6862 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6863 | |
| 6864 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6865 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6866 | // Wait that subs is cleaned |
| 6867 | waitSubsCleanup(t, e2SubsId, 10) |
| 6868 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6869 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6870 | } |
| 6871 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6872 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6873 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6874 | |
| 6875 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6876 | Counter{cRestSubReqFromXapp, 2}, |
| 6877 | Counter{cRestSubRespToXapp, 2}, |
| 6878 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6879 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6880 | Counter{cSubRespFromE2, 1}, |
| 6881 | Counter{cRestSubNotifToXapp, 1}, |
| 6882 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6883 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6884 | Counter{cSubDelReqToE2, 1}, |
| 6885 | Counter{cSubDelRespFromE2, 1}, |
| 6886 | Counter{cRestSubDelRespToXapp, 1}, |
| 6887 | }) |
| 6888 | |
| 6889 | const e2Timeout int64 = 1 |
| 6890 | const e2RetryCount int64 = 0 |
| 6891 | const routingNeeded bool = false |
| 6892 | |
| 6893 | // Req1 |
| 6894 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6895 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6896 | |
| 6897 | // Subs Create |
| 6898 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6899 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6900 | |
| 6901 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6902 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6903 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6904 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6905 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6906 | |
| 6907 | // Policy change |
| 6908 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6909 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6910 | params.SetSubscriptionID(&restSubId) |
| 6911 | params.SetTimeToWait("w200ms") |
| 6912 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6913 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6914 | |
| 6915 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6916 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6917 | // SubsResp is missing, e2SubsId will be 0 |
| 6918 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6919 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6920 | |
| 6921 | // Del |
| 6922 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6923 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6924 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6925 | |
| 6926 | waitSubsCleanup(t, e2SubsId, 10) |
| 6927 | |
| 6928 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6929 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6930 | } |
| 6931 | |
| 6932 | //----------------------------------------------------------------------------- |
| 6933 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6934 | // |
| 6935 | // stub stub |
| 6936 | // +-------+ +---------+ +---------+ |
| 6937 | // | xapp | | submgr | | e2term | |
| 6938 | // +-------+ +---------+ +---------+ |
| 6939 | // | | | |
| 6940 | // | RESTSubReq | | |
| 6941 | // |---------------->| | |
| 6942 | // | | | |
| 6943 | // | RESTSubResp | | |
| 6944 | // |<----------------| | |
| 6945 | // | | SubReq | |
| 6946 | // | |------------->| |
| 6947 | // | | | |
| 6948 | // | | SubResp | |
| 6949 | // | |<-------------| |
| 6950 | // | | | |
| 6951 | // | RESTNotif | | |
| 6952 | // |<----------------| | |
| 6953 | // | | | |
| 6954 | // | RESTSubReq | | |
| 6955 | // |---------------->| | |
| 6956 | // | | | |
| 6957 | // | RESTSubResp | | |
| 6958 | // |<----------------| | |
| 6959 | // | | SubReq | |
| 6960 | // | |------------->| |
| 6961 | // | | |
| 6962 | // | Submgr restart | |
| 6963 | // | | | |
| 6964 | // | RESTSubDelReq | | |
| 6965 | // |---------------->| | |
| 6966 | // | | | |
| 6967 | // | | SubDelReq | |
| 6968 | // | |------------->| |
| 6969 | // | | | |
| 6970 | // | | SubDelResp | |
| 6971 | // | |<-------------| |
| 6972 | // | | | |
| 6973 | // | RESTSubDelResp | | |
| 6974 | // |<----------------| | |
| 6975 | // |
| 6976 | //----------------------------------------------------------------------------- |
| 6977 | |
| 6978 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6979 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6980 | |
| 6981 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6982 | Counter{cRestSubReqFromXapp, 2}, |
| 6983 | Counter{cRestSubRespToXapp, 2}, |
| 6984 | Counter{cSubReqToE2, 2}, |
| 6985 | Counter{cSubRespFromE2, 1}, |
| 6986 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6987 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6988 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6989 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6990 | Counter{cRestSubDelRespToXapp, 1}, |
| 6991 | }) |
| 6992 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6993 | const e2Timeout int64 = 1 |
| 6994 | const e2RetryCount int64 = 0 |
| 6995 | const routingNeeded bool = false |
| 6996 | |
| 6997 | // Req1 |
| 6998 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6999 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7000 | // Create subscription |
| 7001 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7002 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7003 | |
| 7004 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7005 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7006 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7007 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7008 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 7009 | |
| 7010 | // Check subscription |
| 7011 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7012 | |
| 7013 | // Policy change |
| 7014 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7015 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7016 | params.SetSubscriptionID(&restSubId) |
| 7017 | params.SetTimeToWait("w200ms") |
| 7018 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 7019 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 7020 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7021 | |
| 7022 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 7023 | mainCtrl.SetResetTestFlag(t, false) |
| 7024 | |
| 7025 | // SubsResp is missing due to submgr restart |
| 7026 | |
| 7027 | mainCtrl.SimulateRestart(t) |
| 7028 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 7029 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 7030 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 7031 | // That needs to be completed before successful subscription query is possible |
| 7032 | <-time.After(time.Second * 1) |
| 7033 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7034 | // Check subscription |
| 7035 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7036 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7037 | // Delete subscription |
| 7038 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7039 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7040 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7041 | |
| 7042 | //Wait that subs is cleaned |
| 7043 | waitSubsCleanup(t, e2SubsId, 10) |
| 7044 | |
| 7045 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7046 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7047 | } |
| 7048 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7049 | //////////////////////////////////////////////////////////////////////////////////// |
| 7050 | // Services for UT cases |
| 7051 | //////////////////////////////////////////////////////////////////////////////////// |
| 7052 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7053 | const host string = "localhost" |
| 7054 | |
| 7055 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 7056 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7057 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7058 | } |
| 7059 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7060 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7061 | |
| 7062 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 7063 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7064 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 7065 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7066 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7067 | |
| 7068 | return restSubId, e2SubsId |
| 7069 | } |
| 7070 | |
| 7071 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 7072 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7073 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7074 | if meid != "" { |
| 7075 | params.SetMeid(meid) |
| 7076 | } |
| 7077 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 7078 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 7079 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7080 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7081 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7082 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7083 | |
| 7084 | return restSubId, e2SubsId |
| 7085 | } |
| 7086 | |
| 7087 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7088 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7089 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7090 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7091 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7092 | |
| 7093 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7094 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7095 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7096 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7097 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7098 | |
| 7099 | return restSubId, e2SubsId |
| 7100 | } |
| 7101 | |
| 7102 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7103 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7104 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7105 | |
| 7106 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7107 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7108 | fparams1.Set(crereq1) |
| 7109 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7110 | |
| 7111 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7112 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7113 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7114 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7115 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7116 | |
| 7117 | return restSubId, e2SubsId |
| 7118 | } |
| 7119 | |
| 7120 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7121 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7122 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7123 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7124 | } |
| 7125 | |
| 7126 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7127 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7128 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7129 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7130 | } |
| 7131 | |
| 7132 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7133 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7134 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7135 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7136 | } |
| 7137 | |
| 7138 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7139 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame^] | 7140 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 7141 | assert.Equal(t, meid, resp[0].Meid) |
| 7142 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7143 | } |
| 7144 | |
| 7145 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7146 | //Wait that subs is cleaned |
| 7147 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7148 | |
| 7149 | xappConn1.TestMsgChanEmpty(t) |
| 7150 | xappConn2.TestMsgChanEmpty(t) |
| 7151 | e2termConn1.TestMsgChanEmpty(t) |
| 7152 | mainCtrl.wait_registry_empty(t, timeout) |
| 7153 | } |
| 7154 | |
| 7155 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7156 | |
| 7157 | var e2SubsId []uint32 |
| 7158 | |
| 7159 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7160 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7161 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7162 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7163 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7164 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7165 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7166 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7167 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7168 | <-time.After(100 * time.Millisecond) |
| 7169 | } |
| 7170 | return e2SubsId |
| 7171 | } |
| 7172 | |
| 7173 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7174 | |
| 7175 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7176 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7177 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7178 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7179 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7180 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7181 | <-time.After(100 * time.Millisecond) |
| 7182 | } |
| 7183 | |
| 7184 | // Wait that subs is cleaned |
| 7185 | for i := 0; i < len(e2SubsIds); i++ { |
| 7186 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7187 | } |
| 7188 | |
| 7189 | } |