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 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 2986 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 2987 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2988 | //1.st resend |
| 2989 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2990 | |
| 2991 | assert.Equal(t, restSubId_resend, restSubId) |
| 2992 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 2993 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2994 | |
| 2995 | //2.nd resend |
| 2996 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2997 | |
| 2998 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2999 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3000 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3001 | |
| 3002 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3003 | |
| 3004 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3005 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3006 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3007 | } |
| 3008 | |
| 3009 | //----------------------------------------------------------------------------- |
| 3010 | // stub stub stub |
| 3011 | // +-------+ +---------+ +---------+ +---------+ |
| 3012 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3013 | // +-------+ +---------+ +---------+ +---------+ |
| 3014 | // | | | | |
| 3015 | // | RESTSubReq | | | |
| 3016 | // |---------------->| | | |
| 3017 | // | RESTSubResp | | | |
| 3018 | // |<----------------| | | |
| 3019 | // | | RouteCreate | | |
| 3020 | // | |--------------------------->| |
| 3021 | // | | RouteResponse| | |
| 3022 | // | |<---------------------------| // The order of these events may vary |
| 3023 | // | | SubReq | | |
| 3024 | // | |------------->| | // The order of these events may vary |
| 3025 | // | | SubResp | | |
| 3026 | // | |<-------------| | |
| 3027 | // | RESTNotif1 | | | |
| 3028 | // |<----------------| | | |
| 3029 | // | RESTSubReq | | | |
| 3030 | // | [RETRANS, with RESTsubsId] | | |
| 3031 | // |---------------->| | | |
| 3032 | // | RESTNotif1 | | | |
| 3033 | // |<----------------| | | |
| 3034 | // | RESTSubReq | | | |
| 3035 | // | [RETRANS, without RESTsubsId] | | |
| 3036 | // |---------------->| | | |
| 3037 | // | RESTNotif1 | | | |
| 3038 | // |<----------------| | | |
| 3039 | // | RESTSubDelReq | | | |
| 3040 | // |---------------->| | | |
| 3041 | // | | SubDelReq | | |
| 3042 | // | |------------->| | |
| 3043 | // | RESTSubDelResp| | | |
| 3044 | // |<----------------| | | |
| 3045 | // | | SubDelResp | | |
| 3046 | // | |<-------------| | |
| 3047 | // | | | | |
| 3048 | // |
| 3049 | //----------------------------------------------------------------------------- |
| 3050 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3051 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3052 | |
| 3053 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3054 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3055 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3056 | Counter{cRestSubRespToXapp, 3}, |
| 3057 | Counter{cSubReqToE2, 1}, |
| 3058 | Counter{cSubRespFromE2, 1}, |
| 3059 | Counter{cRestSubNotifToXapp, 3}, |
| 3060 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3061 | Counter{cSubDelReqToE2, 1}, |
| 3062 | Counter{cSubDelRespFromE2, 1}, |
| 3063 | Counter{cRestSubDelRespToXapp, 1}, |
| 3064 | }) |
| 3065 | |
| 3066 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3067 | |
| 3068 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3069 | |
| 3070 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3071 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3072 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3073 | |
| 3074 | //1.st resend with subscription ID |
| 3075 | params.SetSubscriptionID(&restSubId) |
| 3076 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3077 | |
| 3078 | assert.Equal(t, restSubId_resend, restSubId) |
| 3079 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3080 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3081 | |
| 3082 | //2.nd resend without subscription ID (faking app restart) |
| 3083 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3084 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3085 | |
| 3086 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3087 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3088 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3089 | |
| 3090 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3091 | |
| 3092 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3093 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3094 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3095 | } |
| 3096 | |
| 3097 | //----------------------------------------------------------------------------- |
| 3098 | // stub stub stub |
| 3099 | // +-------+ +---------+ +---------+ +---------+ |
| 3100 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3101 | // +-------+ +---------+ +---------+ +---------+ |
| 3102 | // | | | | |
| 3103 | // | RESTSubReq | | | |
| 3104 | // |---------------->| | | |
| 3105 | // | RESTSubResp | | | |
| 3106 | // |<----------------| | | |
| 3107 | // | | RouteCreate | | |
| 3108 | // | |--------------------------->| |
| 3109 | // | | RouteResponse| | |
| 3110 | // | |<---------------------------| |
| 3111 | // | | SubReq | | |
| 3112 | // | |------------->| | |
| 3113 | // | | SubResp | | |
| 3114 | // | |<-------------| | |
| 3115 | // | RESTNotif1 | | | |
| 3116 | // |<----------------| | | |
| 3117 | // | RESTSubReq | | | |
| 3118 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3119 | // |---------------->| | | |
| 3120 | // | RESTNotif1 | | | |
| 3121 | // | [for initial e2 subDetail] | | |
| 3122 | // |<----------------| | | |
| 3123 | // | | RouteCreate | | |
| 3124 | // | |--------------------------->| |
| 3125 | // | | RouteResponse| | |
| 3126 | // | |<---------------------------| |
| 3127 | // | | SubReq | | |
| 3128 | // | |------------->| | |
| 3129 | // | | SubResp | | |
| 3130 | // | |<-------------| | |
| 3131 | // | RESTNotif1 | | | |
| 3132 | // |<----------------| | | |
| 3133 | // | RESTSubReq | | | |
| 3134 | // | [with RESTsubsId initial request] | |
| 3135 | // |---------------->| | | |
| 3136 | // | RESTNotif1 | | | |
| 3137 | // |<----------------| | | |
| 3138 | // | RESTSubDelReq | | | |
| 3139 | // |---------------->| | | |
| 3140 | // | RESTSubDelResp| | | |
| 3141 | // |<----------------| | | |
| 3142 | // | | SubDelReq | | |
| 3143 | // | |------------->| | |
| 3144 | // | | SubDelResp | | |
| 3145 | // | |<-------------| | |
| 3146 | // | | SubDelReq | | |
| 3147 | // | |------------->| | |
| 3148 | // | | SubDelResp | | |
| 3149 | // | |<-------------| | |
| 3150 | // | | | | |
| 3151 | // |
| 3152 | //----------------------------------------------------------------------------- |
| 3153 | |
| 3154 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3155 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3156 | |
| 3157 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3158 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3159 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3160 | Counter{cRestSubRespToXapp, 3}, |
| 3161 | Counter{cSubReqToE2, 2}, |
| 3162 | Counter{cSubRespFromE2, 2}, |
| 3163 | Counter{cRestSubNotifToXapp, 4}, |
| 3164 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3165 | Counter{cSubDelReqToE2, 2}, |
| 3166 | Counter{cSubDelRespFromE2, 2}, |
| 3167 | Counter{cRestSubDelRespToXapp, 1}, |
| 3168 | }) |
| 3169 | |
| 3170 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3171 | |
| 3172 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3173 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3174 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3175 | |
| 3176 | // Send modified requst, this time with e2 subscriptions. |
| 3177 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3178 | params2.SetSubscriptionID(&restSubId) |
| 3179 | |
| 3180 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3181 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3182 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3183 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3184 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3185 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3186 | |
| 3187 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3188 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3189 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3190 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3191 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3192 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3193 | assert.NotEqual(t, e2SubsId2, 0) |
| 3194 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3195 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3196 | |
| 3197 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3198 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3199 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3200 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3201 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3202 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3203 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3204 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3205 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3206 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3207 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3208 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3209 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3210 | // Delete both e2 subscriptions |
| 3211 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3212 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3213 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3214 | |
| 3215 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3216 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3217 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3218 | } |
| 3219 | |
| 3220 | //----------------------------------------------------------------------------- |
| 3221 | // stub stub stub |
| 3222 | // +-------+ +---------+ +---------+ +---------+ |
| 3223 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3224 | // +-------+ +---------+ +---------+ +---------+ |
| 3225 | // | | | | |
| 3226 | // | RESTSubReq | | | |
| 3227 | // |---------------->| | | |
| 3228 | // | RESTSubResp | | | |
| 3229 | // |<----------------| | | |
| 3230 | // | | RouteCreate | | |
| 3231 | // | |--------------------------->| |
| 3232 | // | | RouteResponse| | |
| 3233 | // | |<---------------------------| |
| 3234 | // | | SubReq | | |
| 3235 | // | |------------->| | |
| 3236 | // | | SubResp | | |
| 3237 | // | |<-------------| | |
| 3238 | // | RESTNotif1 | | | |
| 3239 | // |<----------------| | | |
| 3240 | // | RESTSubReq | | | |
| 3241 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3242 | // |---------------->| | | |
| 3243 | // | RESTNotif1 | | | |
| 3244 | // | [for initial e2 subDetail] | | |
| 3245 | // |<----------------| | | |
| 3246 | // | | RouteCreate | | |
| 3247 | // | |--------------------------->| |
| 3248 | // | | RouteResponse| | |
| 3249 | // | |<---------------------------| |
| 3250 | // | | SubReq | | |
| 3251 | // | |------------->| | |
| 3252 | // | | SubResp | | |
| 3253 | // | |<-------------| | |
| 3254 | // | RESTNotif1 | | | |
| 3255 | // |<----------------| | | |
| 3256 | // | RESTSubReq | | | |
| 3257 | // | [without RESTsubsId initial request] | |
| 3258 | // |---------------->| | | |
| 3259 | // | RESTNotif1 | | | |
| 3260 | // |<----------------| | | |
| 3261 | // | RESTSubDelReq | | | |
| 3262 | // |---------------->| | | |
| 3263 | // | RESTSubDelResp| | | |
| 3264 | // |<----------------| | | |
| 3265 | // | | SubDelReq | | |
| 3266 | // | |------------->| | |
| 3267 | // | | SubDelResp | | |
| 3268 | // | |<-------------| | |
| 3269 | // | | SubDelReq | | |
| 3270 | // | |------------->| | |
| 3271 | // | | SubDelResp | | |
| 3272 | // | |<-------------| | |
| 3273 | // | | | | |
| 3274 | // |
| 3275 | //----------------------------------------------------------------------------- |
| 3276 | |
| 3277 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3278 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3279 | |
| 3280 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3281 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3282 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3283 | Counter{cRestSubRespToXapp, 3}, |
| 3284 | Counter{cSubReqToE2, 2}, |
| 3285 | Counter{cSubRespFromE2, 2}, |
| 3286 | Counter{cRestSubNotifToXapp, 4}, |
| 3287 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3288 | Counter{cSubDelReqToE2, 2}, |
| 3289 | Counter{cSubDelRespFromE2, 2}, |
| 3290 | Counter{cRestSubDelRespToXapp, 1}, |
| 3291 | }) |
| 3292 | |
| 3293 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3294 | |
| 3295 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3296 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3297 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3298 | |
| 3299 | // Send modified requst, this time with e2 subscriptions. |
| 3300 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3301 | params2.SetSubscriptionID(&restSubId) |
| 3302 | |
| 3303 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3304 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3305 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3306 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3307 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3308 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3309 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3310 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3311 | xappConn1.DecrementRequestCount() |
| 3312 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3313 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3314 | |
| 3315 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3316 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3317 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3318 | assert.NotEqual(t, e2SubsId2, 0) |
| 3319 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3320 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3321 | |
| 3322 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3323 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3324 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3325 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3326 | // md5sum shall find the original request |
| 3327 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3328 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3329 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3330 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3331 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3332 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3333 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3334 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3335 | // Delete both e2 subscriptions |
| 3336 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3337 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3338 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3339 | |
| 3340 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3341 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3342 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3343 | } |
| 3344 | |
| 3345 | //----------------------------------------------------------------------------- |
| 3346 | // stub stub stub |
| 3347 | // +-------+ +---------+ +---------+ +---------+ |
| 3348 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3349 | // +-------+ +---------+ +---------+ +---------+ |
| 3350 | // | | | | |
| 3351 | // | RESTSubReq | | | |
| 3352 | // |---------------->| | | |
| 3353 | // | RESTSubResp | | | |
| 3354 | // |<----------------| | | |
| 3355 | // | | RouteCreate | | |
| 3356 | // | |--------------------------->| |
| 3357 | // | | RouteResponse| | |
| 3358 | // | |<---------------------------| |
| 3359 | // | | SubReq | | |
| 3360 | // | |------------->| | |
| 3361 | // | | SubResp | | |
| 3362 | // | |<-------------| | |
| 3363 | // | RESTNotif1 | | | |
| 3364 | // |<----------------| | | |
| 3365 | // | RESTSubReq | | | |
| 3366 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3367 | // |---------------->| | | |
| 3368 | // | RESTNotif1 | | | |
| 3369 | // | [for initial e2 subDetail] | | |
| 3370 | // |<----------------| | | |
| 3371 | // | | RouteCreate | | |
| 3372 | // | |--------------------------->| |
| 3373 | // | | RouteResponse| | |
| 3374 | // | |<---------------------------| |
| 3375 | // | | SubReq | | |
| 3376 | // | |------------->| | |
| 3377 | // | | SubResp | | |
| 3378 | // | |<-------------| | |
| 3379 | // | RESTNotif1 | | | |
| 3380 | // |<----------------| | | |
| 3381 | // | RESTSubDelReq | | | |
| 3382 | // |---------------->| | | |
| 3383 | // | RESTSubDelResp| | | |
| 3384 | // |<----------------| | | |
| 3385 | // | | SubDelReq | | |
| 3386 | // | |------------->| | |
| 3387 | // | | SubDelResp | | |
| 3388 | // | |<-------------| | |
| 3389 | // | | SubDelReq | | |
| 3390 | // | |------------->| | |
| 3391 | // | | SubDelResp | | |
| 3392 | // | |<-------------| | |
| 3393 | // | RESTSubReq | | | |
| 3394 | // | [with RESTsubsId initial request] | |
| 3395 | // |---------------->| | | |
| 3396 | // | RESTSubResp | | | |
| 3397 | // |<----------------| | | |
| 3398 | // | | RouteCreate | | |
| 3399 | // | |--------------------------->| |
| 3400 | // | | RouteResponse| | |
| 3401 | // | |<---------------------------| |
| 3402 | // | | SubReq | | |
| 3403 | // | |------------->| | |
| 3404 | // | | SubResp | | |
| 3405 | // | |<-------------| | |
| 3406 | // | RESTNotif1 | | | |
| 3407 | // |<----------------| | | |
| 3408 | // | | | | |
| 3409 | // |
| 3410 | //----------------------------------------------------------------------------- |
| 3411 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3412 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3413 | |
| 3414 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3415 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3416 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3417 | Counter{cRestSubRespToXapp, 3}, |
| 3418 | Counter{cSubReqToE2, 3}, |
| 3419 | Counter{cSubRespFromE2, 3}, |
| 3420 | Counter{cRestSubNotifToXapp, 4}, |
| 3421 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3422 | Counter{cSubDelReqToE2, 3}, |
| 3423 | Counter{cSubDelRespFromE2, 3}, |
| 3424 | Counter{cRestSubDelRespToXapp, 2}, |
| 3425 | }) |
| 3426 | |
| 3427 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3428 | |
| 3429 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3430 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3431 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3432 | |
| 3433 | // Send modified requst, this time with e2 subscriptions. |
| 3434 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3435 | params2.SetSubscriptionID(&restSubId) |
| 3436 | |
| 3437 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3438 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3439 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3440 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3441 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3442 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3443 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3444 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3445 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3446 | |
| 3447 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3448 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3449 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3450 | assert.NotEqual(t, e2SubsId2, 0) |
| 3451 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3452 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3453 | |
| 3454 | // Delete both e2 subscriptions |
| 3455 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3456 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3457 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3458 | |
| 3459 | waitSubsCleanup(t, e2SubsId, 10) |
| 3460 | |
| 3461 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3462 | // but the restsubscription has been already removed. This shall trigger a |
| 3463 | // fresh create. |
| 3464 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3465 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3466 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3467 | |
| 3468 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3469 | |
| 3470 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3471 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3472 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3473 | } |
| 3474 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3475 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3476 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3477 | |
| 3478 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3479 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3480 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3481 | Counter{cSubReqToE2, 1}, |
| 3482 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3483 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3484 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3485 | Counter{cSubDelReqToE2, 1}, |
| 3486 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3487 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3488 | }) |
| 3489 | |
| 3490 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3491 | |
| 3492 | //Subs Create |
| 3493 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3494 | |
| 3495 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3496 | |
| 3497 | //Subs Delete |
| 3498 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3499 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3500 | |
| 3501 | seqBef := mainCtrl.get_msgcounter(t) |
| 3502 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3503 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3504 | |
| 3505 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3506 | |
| 3507 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3508 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3509 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3510 | } |
| 3511 | |
| 3512 | //----------------------------------------------------------------------------- |
| 3513 | // TestRESTSubReqDelReq |
| 3514 | // |
| 3515 | // stub stub |
| 3516 | // +-------+ +---------+ +---------+ |
| 3517 | // | xapp | | submgr | | e2term | |
| 3518 | // +-------+ +---------+ +---------+ |
| 3519 | // | | | |
| 3520 | // | RESTSubReq | | |
| 3521 | // |---------------->| | |
| 3522 | // | | | |
| 3523 | // | RESTSubResp | | |
| 3524 | // |<----------------| | |
| 3525 | // | | SubReq | |
| 3526 | // | |------------->| |
| 3527 | // | RESTSubDelReq | | |
| 3528 | // |---------------->| | |
| 3529 | // | RESTSubDelResp | | |
| 3530 | // | unsuccess | | |
| 3531 | // |<----------------| | |
| 3532 | // | | SubResp | |
| 3533 | // | |<-------------| |
| 3534 | // | RESTNotif1 | | |
| 3535 | // |<----------------| | |
| 3536 | // | | | |
| 3537 | // | [SUBS DELETE] | |
| 3538 | // | | | |
| 3539 | // |
| 3540 | //----------------------------------------------------------------------------- |
| 3541 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3542 | CaseBegin("TestRESTSubReqDelReq") |
| 3543 | |
| 3544 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3545 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3546 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3547 | Counter{cSubReqToE2, 1}, |
| 3548 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3549 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3550 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3551 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3552 | Counter{cSubDelReqToE2, 1}, |
| 3553 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3554 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3555 | }) |
| 3556 | |
| 3557 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3558 | |
| 3559 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3560 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3561 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3562 | |
| 3563 | // Del. This will fail as processing of the subscription |
| 3564 | // is still ongoing in submgr. Deletion is not allowed before |
| 3565 | // subscription creation has been completed. |
| 3566 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3567 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3568 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3569 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3570 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3571 | |
| 3572 | // Retry del |
| 3573 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3574 | |
| 3575 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3576 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3577 | |
| 3578 | // Wait that subs is cleaned |
| 3579 | waitSubsCleanup(t, e2SubsId, 10) |
| 3580 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3581 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3582 | } |
| 3583 | |
| 3584 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3585 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3586 | } |
| 3587 | |
| 3588 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3589 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3590 | |
| 3591 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3592 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3593 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3594 | Counter{cSubReqToE2, 2}, |
| 3595 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3596 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3597 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3598 | Counter{cSubDelReqToE2, 2}, |
| 3599 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3600 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3601 | }) |
| 3602 | |
| 3603 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3604 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3605 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3606 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3607 | |
| 3608 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3609 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3610 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3611 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3612 | |
| 3613 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3614 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3615 | |
| 3616 | //XappConn1 receives both of the responses |
| 3617 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3618 | |
| 3619 | //Resp1 |
| 3620 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3621 | //Resp2 |
| 3622 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3623 | |
| 3624 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3625 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3626 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3627 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3628 | |
| 3629 | //Del1 |
| 3630 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3631 | //Del2 |
| 3632 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3633 | |
| 3634 | //Wait that subs is cleaned |
| 3635 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3636 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3637 | |
| 3638 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3639 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3640 | } |
| 3641 | |
| 3642 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3643 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3644 | |
| 3645 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3646 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3647 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3648 | Counter{cSubReqToE2, 2}, |
| 3649 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3650 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3651 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3652 | Counter{cSubDelReqToE2, 2}, |
| 3653 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3654 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3655 | }) |
| 3656 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3657 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3658 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3659 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3660 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3661 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3662 | params.SetMeid("RAN_NAME_2") |
| 3663 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3664 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3665 | |
| 3666 | //Del1 |
| 3667 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3668 | //Del2 |
| 3669 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3670 | |
| 3671 | //Wait that subs is cleaned |
| 3672 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3673 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3674 | |
| 3675 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3676 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3677 | } |
| 3678 | |
| 3679 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3680 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3681 | |
| 3682 | // Init counter check |
| 3683 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3684 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3685 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3686 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3687 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3688 | Counter{cSubReReqToE2, 1}, |
| 3689 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3690 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3691 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3692 | Counter{cSubDelReqToE2, 1}, |
| 3693 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3694 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3695 | }) |
| 3696 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3697 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3698 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3699 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3700 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3701 | |
| 3702 | // Catch the first message and ignore it |
| 3703 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3704 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3705 | |
| 3706 | // The second request is being handled normally |
| 3707 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3708 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3709 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3710 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3711 | |
| 3712 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3713 | |
| 3714 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3715 | |
| 3716 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3717 | //Wait that subs is cleaned |
| 3718 | waitSubsCleanup(t, e2SubsId, 10) |
| 3719 | |
| 3720 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3721 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3722 | } |
| 3723 | |
| 3724 | //----------------------------------------------------------------------------- |
| 3725 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3726 | // |
| 3727 | // stub stub |
| 3728 | // +-------+ +---------+ +---------+ |
| 3729 | // | xapp | | submgr | | e2term | |
| 3730 | // +-------+ +---------+ +---------+ |
| 3731 | // | | | |
| 3732 | // | RESTSubReq | | |
| 3733 | // |---------------->| | |
| 3734 | // | | | |
| 3735 | // | RESTSubResp | | |
| 3736 | // |<----------------| | |
| 3737 | // | | SubReq | |
| 3738 | // | |------------->| |
| 3739 | // | | | |
| 3740 | // | | | |
| 3741 | // | | SubReq | |
| 3742 | // | |------------->| |
| 3743 | // | | | |
| 3744 | // | | SubDelReq | |
| 3745 | // | |------------->| |
| 3746 | // | | | |
| 3747 | // | | | |
| 3748 | // | | SubDelReq | |
| 3749 | // | |------------->| |
| 3750 | // | | | |
| 3751 | // | | | |
| 3752 | // | | SubDelResp | |
| 3753 | // | |<-------------| |
| 3754 | // | RESTNotif | | |
| 3755 | // | unsuccess | | |
| 3756 | // |<----------------| | |
| 3757 | // | | | |
| 3758 | // | [SUBS DELETE] | |
| 3759 | // | | | |
| 3760 | // |
| 3761 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3762 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3763 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3764 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3765 | |
| 3766 | // Init counter check |
| 3767 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3768 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3769 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3770 | Counter{cSubReqToE2, 1}, |
| 3771 | Counter{cSubReReqToE2, 1}, |
| 3772 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3773 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3774 | Counter{cSubDelReqToE2, 1}, |
| 3775 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3776 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3777 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3778 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3779 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3780 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3781 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3782 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3783 | |
| 3784 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3785 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3786 | |
| 3787 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3788 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3789 | |
| 3790 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3791 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3792 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3793 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3794 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3795 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3796 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3797 | // Wait that subs is cleaned |
| 3798 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3799 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3800 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3801 | } |
| 3802 | |
| 3803 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3804 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3805 | |
| 3806 | // Init counter check |
| 3807 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3808 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3809 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3810 | Counter{cSubReqToE2, 1}, |
| 3811 | Counter{cSubReReqToE2, 1}, |
| 3812 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3813 | Counter{cSubDelReReqToE2, 1}, |
| 3814 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3815 | Counter{cSubDelReqToE2, 1}, |
| 3816 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3817 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3818 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3819 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3820 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3821 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3822 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3823 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3824 | |
| 3825 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3826 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3827 | |
| 3828 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3829 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3830 | |
| 3831 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3832 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3833 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3834 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3835 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3836 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3837 | |
| 3838 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3839 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3840 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3841 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3842 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3843 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3844 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3845 | } |
| 3846 | |
| 3847 | //----------------------------------------------------------------------------- |
| 3848 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3849 | // |
| 3850 | // stub stub |
| 3851 | // +-------+ +---------+ +---------+ |
| 3852 | // | xapp | | submgr | | e2term | |
| 3853 | // +-------+ +---------+ +---------+ |
| 3854 | // | | | |
| 3855 | // | RESTSubReq | | |
| 3856 | // |---------------->| | |
| 3857 | // | | | |
| 3858 | // | RESTSubResp | | |
| 3859 | // |<----------------| | |
| 3860 | // | | SubReq | |
| 3861 | // | |------------->| |
| 3862 | // | | | |
| 3863 | // | | | |
| 3864 | // | | SubReq | |
| 3865 | // | |------------->| |
| 3866 | // | | | |
| 3867 | // | | SubDelReq | |
| 3868 | // | |------------->| |
| 3869 | // | | | |
| 3870 | // | | | |
| 3871 | // | | SubDelReq | |
| 3872 | // | |------------->| |
| 3873 | // | | | |
| 3874 | // | | | |
| 3875 | // | | SubDelResp | |
| 3876 | // | |<-------------| |
| 3877 | // | RESTNotif | | |
| 3878 | // | unsuccess | | |
| 3879 | // |<----------------| | |
| 3880 | // | | | |
| 3881 | // | [SUBS DELETE] | |
| 3882 | // | | | |
| 3883 | // |
| 3884 | //----------------------------------------------------------------------------- |
| 3885 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3886 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3887 | |
| 3888 | // Init counter check |
| 3889 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3890 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3891 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3892 | Counter{cSubReqToE2, 1}, |
| 3893 | Counter{cSubReReqToE2, 1}, |
| 3894 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3895 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3896 | Counter{cSubDelReqToE2, 1}, |
| 3897 | Counter{cSubDelReReqToE2, 1}, |
| 3898 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3899 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3900 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3901 | }) |
| 3902 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3903 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3904 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3905 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3906 | |
| 3907 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3908 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3909 | |
| 3910 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3911 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3912 | |
| 3913 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3914 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3915 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3916 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3917 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3918 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3919 | |
| 3920 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3921 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3922 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3923 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3924 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3925 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3926 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3927 | } |
| 3928 | |
| 3929 | //----------------------------------------------------------------------------- |
| 3930 | // TestRESTSubReqSubFailRespInSubmgr |
| 3931 | // |
| 3932 | // stub stub |
| 3933 | // +-------+ +---------+ +---------+ |
| 3934 | // | xapp | | submgr | | e2term | |
| 3935 | // +-------+ +---------+ +---------+ |
| 3936 | // | | | |
| 3937 | // | RESTSubReq | | |
| 3938 | // |---------------->| | |
| 3939 | // | | | |
| 3940 | // | RESTSubResp | | |
| 3941 | // |<----------------| | |
| 3942 | // | | SubReq | |
| 3943 | // | |------------->| |
| 3944 | // | | | |
| 3945 | // | | SubFail | |
| 3946 | // | |<-------------| |
| 3947 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3948 | // | RESTNotif | | |
| 3949 | // | unsuccess | | |
| 3950 | // |<----------------| | |
| 3951 | // | | | |
| 3952 | // | [SUBS DELETE] | |
| 3953 | // | | | |
| 3954 | // |
| 3955 | //----------------------------------------------------------------------------- |
| 3956 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3957 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3958 | |
| 3959 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3960 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3961 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3962 | Counter{cSubReqToE2, 1}, |
| 3963 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3964 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3965 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3966 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3967 | }) |
| 3968 | |
| 3969 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3970 | const e2Timeout int64 = 2 |
| 3971 | const e2RetryCount int64 = 1 |
| 3972 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3973 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3974 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3975 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3976 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3977 | |
| 3978 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3979 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3980 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 3981 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3982 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3983 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3984 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3985 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3986 | |
| 3987 | // REST subscription sill there to be deleted |
| 3988 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3989 | |
| 3990 | // Wait that subs is cleaned |
| 3991 | waitSubsCleanup(t, e2SubsId, 10) |
| 3992 | |
| 3993 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3994 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3995 | } |
| 3996 | |
| 3997 | //----------------------------------------------------------------------------- |
| 3998 | // TestRESTSubDelReqRetryInSubmgr |
| 3999 | // |
| 4000 | // stub stub |
| 4001 | // +-------+ +---------+ +---------+ |
| 4002 | // | xapp | | submgr | | e2term | |
| 4003 | // +-------+ +---------+ +---------+ |
| 4004 | // | | | |
| 4005 | // | [SUBS CREATE] | |
| 4006 | // | | | |
| 4007 | // | | | |
| 4008 | // | RESTSubDelReq | | |
| 4009 | // |---------------->| | |
| 4010 | // | | | |
| 4011 | // | RESTSubDelResp | | |
| 4012 | // |<----------------| | |
| 4013 | // | | SubDelReq | |
| 4014 | // | |------------->| |
| 4015 | // | | | |
| 4016 | // | | SubDelReq | |
| 4017 | // | |------------->| |
| 4018 | // | | | |
| 4019 | // | | SubDelResp | |
| 4020 | // | |<-------------| |
| 4021 | // | | | |
| 4022 | // |
| 4023 | //----------------------------------------------------------------------------- |
| 4024 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 4025 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 4026 | |
| 4027 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4028 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4029 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4030 | Counter{cSubReqToE2, 1}, |
| 4031 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4032 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4033 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4034 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4035 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4036 | Counter{cSubDelReReqToE2, 1}, |
| 4037 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4038 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4039 | }) |
| 4040 | // Req |
| 4041 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4042 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4043 | |
| 4044 | // Del |
| 4045 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4046 | |
| 4047 | // E2t: Receive 1st SubsDelReq |
| 4048 | e2termConn1.RecvSubsDelReq(t) |
| 4049 | |
| 4050 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4051 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4052 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4053 | |
| 4054 | //Wait that subs is cleaned |
| 4055 | waitSubsCleanup(t, e2SubsId, 10) |
| 4056 | |
| 4057 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4058 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4059 | } |
| 4060 | |
| 4061 | //----------------------------------------------------------------------------- |
| 4062 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4063 | // |
| 4064 | // stub stub |
| 4065 | // +-------+ +---------+ +---------+ |
| 4066 | // | xapp | | submgr | | e2term | |
| 4067 | // +-------+ +---------+ +---------+ |
| 4068 | // | | | |
| 4069 | // | [SUBS CREATE] | |
| 4070 | // | | | |
| 4071 | // | | | |
| 4072 | // | RESTSubDelReq | | |
| 4073 | // |---------------->| | |
| 4074 | // | | | |
| 4075 | // | RESTSubDelResp | | |
| 4076 | // |<----------------| | |
| 4077 | // | | SubDelReq | |
| 4078 | // | |------------->| |
| 4079 | // | | | |
| 4080 | // | | SubDelReq | |
| 4081 | // | |------------->| |
| 4082 | // | | | |
| 4083 | // | | | |
| 4084 | // |
| 4085 | //----------------------------------------------------------------------------- |
| 4086 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4087 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4088 | |
| 4089 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4090 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4091 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4092 | Counter{cSubReqToE2, 1}, |
| 4093 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4094 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4095 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4096 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4097 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4098 | Counter{cSubDelReReqToE2, 1}, |
| 4099 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4100 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4101 | }) |
| 4102 | |
| 4103 | // Req |
| 4104 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4105 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4106 | |
| 4107 | // Del |
| 4108 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4109 | |
| 4110 | // E2t: Receive 1st SubsDelReq |
| 4111 | e2termConn1.RecvSubsDelReq(t) |
| 4112 | |
| 4113 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4114 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4115 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4116 | |
| 4117 | //Wait that subs is cleaned |
| 4118 | waitSubsCleanup(t, e2SubsId, 10) |
| 4119 | |
| 4120 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4121 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4122 | } |
| 4123 | |
| 4124 | //----------------------------------------------------------------------------- |
| 4125 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4126 | // |
| 4127 | // stub stub |
| 4128 | // +-------+ +---------+ +---------+ |
| 4129 | // | xapp | | submgr | | e2term | |
| 4130 | // +-------+ +---------+ +---------+ |
| 4131 | // | | | |
| 4132 | // | [SUBS CREATE] | |
| 4133 | // | | | |
| 4134 | // | | | |
| 4135 | // | RESTSubDelReq | | |
| 4136 | // |---------------->| | |
| 4137 | // | | | |
| 4138 | // | RESTSubDelResp | | |
| 4139 | // |<----------------| | |
| 4140 | // | | SubDelReq | |
| 4141 | // | |------------->| |
| 4142 | // | | | |
| 4143 | // | | SubDelFail | |
| 4144 | // | |<-------------| |
| 4145 | // | | | |
| 4146 | // |
| 4147 | //----------------------------------------------------------------------------- |
| 4148 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4149 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4150 | |
| 4151 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4152 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4153 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4154 | Counter{cSubReqToE2, 1}, |
| 4155 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4156 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4157 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4158 | Counter{cSubDelReqToE2, 1}, |
| 4159 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4160 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4161 | }) |
| 4162 | |
| 4163 | // Req |
| 4164 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4165 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4166 | |
| 4167 | // Del |
| 4168 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4169 | |
| 4170 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4171 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4172 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4173 | |
| 4174 | //Wait that subs is cleaned |
| 4175 | waitSubsCleanup(t, e2SubsId, 10) |
| 4176 | |
| 4177 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4178 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4179 | } |
| 4180 | |
| 4181 | //----------------------------------------------------------------------------- |
| 4182 | // TestRESTSubReqAndSubDelOkSameAction |
| 4183 | // |
| 4184 | // stub stub |
| 4185 | // +-------+ +-------+ +---------+ +---------+ |
| 4186 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4187 | // +-------+ +-------+ +---------+ +---------+ |
| 4188 | // | | | | |
| 4189 | // | | RESTSubReq1 | | |
| 4190 | // | |---------------->| | |
| 4191 | // | | | | |
| 4192 | // | | RESTSubResp1 | | |
| 4193 | // | |<----------------| | |
| 4194 | // | | | | |
| 4195 | // | | | SubReq1 | |
| 4196 | // | | |------------->| |
| 4197 | // | | | SubResp1 | |
| 4198 | // | | |<-------------| |
| 4199 | // | | RESTNotif1 | | |
| 4200 | // | |<----------------| | |
| 4201 | // | | | | |
| 4202 | // | RESTSubReq2 | | |
| 4203 | // |------------------------------>| | |
| 4204 | // | | | | |
| 4205 | // | RESTSubResp2 | | |
| 4206 | // |<------------------------------| | |
| 4207 | // | | | | |
| 4208 | // | | RESTNotif2 | | |
| 4209 | // |<------------------------------| | |
| 4210 | // | | | | |
| 4211 | // | | RESTSubDelReq1 | | |
| 4212 | // | |---------------->| | |
| 4213 | // | | | | |
| 4214 | // | | RESTSubDelResp1 | | |
| 4215 | // | |<----------------| | |
| 4216 | // | | | | |
| 4217 | // | RESTSubDelReq2 | | |
| 4218 | // |------------------------------>| | |
| 4219 | // | | | | |
| 4220 | // | RESTSubDelResp2 | | |
| 4221 | // |<------------------------------| | |
| 4222 | // | | | | |
| 4223 | // | | | SubDelReq2 | |
| 4224 | // | | |------------->| |
| 4225 | // | | | | |
| 4226 | // | | | SubDelResp2 | |
| 4227 | // | | |<-------------| |
| 4228 | // | | | | |
| 4229 | // |
| 4230 | //----------------------------------------------------------------------------- |
| 4231 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4232 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4233 | |
| 4234 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4235 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4236 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4237 | Counter{cSubReqToE2, 1}, |
| 4238 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4239 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4240 | Counter{cMergedSubscriptions, 1}, |
| 4241 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4242 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4243 | Counter{cSubDelReqToE2, 1}, |
| 4244 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4245 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4246 | }) |
| 4247 | |
| 4248 | // Req1 |
| 4249 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4250 | |
| 4251 | //Subs Create |
| 4252 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4253 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4254 | |
| 4255 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4256 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4257 | params.SetMeid("RAN_NAME_1") |
| 4258 | |
| 4259 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4260 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4261 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4262 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4263 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4264 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4265 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4266 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4267 | |
| 4268 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4269 | |
| 4270 | // Del1 |
| 4271 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4272 | |
| 4273 | // Del2 |
| 4274 | deleteXapp2Subscription(t, &restSubId2) |
| 4275 | |
| 4276 | //Wait that subs is cleaned |
| 4277 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4278 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4279 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4280 | } |
| 4281 | |
| 4282 | //----------------------------------------------------------------------------- |
| 4283 | // TestSubReqAndSubDelOkSameActionParallel |
| 4284 | // |
| 4285 | // stub stub stub |
| 4286 | // +-------+ +-------+ +---------+ +---------+ |
| 4287 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4288 | // +-------+ +-------+ +---------+ +---------+ |
| 4289 | // | | | | |
| 4290 | // | | | | |
| 4291 | // | | | | |
| 4292 | // | | SubReq1 | | |
| 4293 | // | |------------->| | |
| 4294 | // | | | | |
| 4295 | // | | | SubReq1 | |
| 4296 | // | | |------------->| |
| 4297 | // | SubReq2 | | |
| 4298 | // |--------------------------->| | |
| 4299 | // | | | SubResp1 | |
| 4300 | // | | |<-------------| |
| 4301 | // | | SubResp1 | | |
| 4302 | // | |<-------------| | |
| 4303 | // | | | SubReq2 | |
| 4304 | // | | |------------->| |
| 4305 | // | | | | |
| 4306 | // | | | SubResp2 | |
| 4307 | // | | |<-------------| |
| 4308 | // | SubResp2 | | |
| 4309 | // |<---------------------------| | |
| 4310 | // | | | | |
| 4311 | // | | SubDelReq 1 | | |
| 4312 | // | |------------->| | |
| 4313 | // | | | | |
| 4314 | // | | SubDelResp 1 | | |
| 4315 | // | |<-------------| | |
| 4316 | // | | | | |
| 4317 | // | SubDelReq 2 | | |
| 4318 | // |--------------------------->| | |
| 4319 | // | | | | |
| 4320 | // | | | SubDelReq 2 | |
| 4321 | // | | |------------->| |
| 4322 | // | | | | |
| 4323 | // | | | SubDelReq 2 | |
| 4324 | // | | |------------->| |
| 4325 | // | | | | |
| 4326 | // | SubDelResp 2 | | |
| 4327 | // |<---------------------------| | |
| 4328 | // |
| 4329 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4330 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4331 | |
| 4332 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4333 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4334 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4335 | Counter{cSubReqToE2, 2}, |
| 4336 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4337 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4338 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4339 | Counter{cSubDelReqToE2, 2}, |
| 4340 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4341 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4342 | }) |
| 4343 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4344 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4345 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4346 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4347 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4348 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4349 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4350 | |
| 4351 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4352 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4353 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4354 | |
| 4355 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4356 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4357 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4358 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4359 | |
| 4360 | // Del1 |
| 4361 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4362 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4363 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4364 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4365 | |
| 4366 | // Del2 |
| 4367 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4368 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4369 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4370 | |
| 4371 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4372 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4373 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4374 | } |
| 4375 | |
| 4376 | //----------------------------------------------------------------------------- |
| 4377 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4378 | // |
| 4379 | // stub stub stub |
| 4380 | // +-------+ +-------+ +---------+ +---------+ |
| 4381 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4382 | // +-------+ +-------+ +---------+ +---------+ |
| 4383 | // | | | | |
| 4384 | // | | | | |
| 4385 | // | | | | |
| 4386 | // | | RESTSubReq1 | | |
| 4387 | // | |---------------->| | |
| 4388 | // | | | | |
| 4389 | // | | RESTSubResp1 | | |
| 4390 | // | |<----------------| | |
| 4391 | // | | | SubReq1 | |
| 4392 | // | | |------------->| |
| 4393 | // | RESTSubReq2 | | |
| 4394 | // |------------------------------>| | |
| 4395 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4396 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4397 | // |<------------------------------| | |
| 4398 | // | | | SubReq1 | |
| 4399 | // | | |------------->| |
| 4400 | // | | | | |
| 4401 | // | | | | |
| 4402 | // | | | SubDelReq | |
| 4403 | // | | |------------->| |
| 4404 | // | | | | |
| 4405 | // | | | SubDelResp | |
| 4406 | // | | |<-------------| |
| 4407 | // | | RESTNotif1 | | |
| 4408 | // | | unsuccess | | |
| 4409 | // | |<----------------| | |
| 4410 | // | RESTNotif2 | | |
| 4411 | // | | unsuccess | | |
| 4412 | // |<------------------------------| | |
| 4413 | // | | | | |
| 4414 | // | | RESTSubDelReq1 | | |
| 4415 | // | |---------------->| | |
| 4416 | // | | | | |
| 4417 | // | | RESTSubDelResp1 | | |
| 4418 | // | |<----------------| | |
| 4419 | // | | | | |
| 4420 | // | RESTSubDelReq2 | | |
| 4421 | // |------------------------------>| | |
| 4422 | // | | | | |
| 4423 | // | RESTSubDelResp2 | | |
| 4424 | // |<------------------------------| | |
| 4425 | // |
| 4426 | //----------------------------------------------------------------------------- |
| 4427 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4428 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4429 | |
| 4430 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4431 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4432 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4433 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4434 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4435 | Counter{cSubReqTimerExpiry, 2}, |
| 4436 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4437 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4438 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4439 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4440 | Counter{cSubDelReqToE2, 1}, |
| 4441 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4442 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4443 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4444 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4445 | |
| 4446 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4447 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4448 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4449 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4450 | |
| 4451 | // Req2 |
| 4452 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4453 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4454 | params2.SetMeid("RAN_NAME_1") |
| 4455 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4456 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4457 | |
| 4458 | //Req1 (retransmitted) |
| 4459 | e2termConn1.RecvSubsReq(t) |
| 4460 | |
| 4461 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4462 | |
| 4463 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4464 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4465 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4466 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4467 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4468 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4469 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4470 | |
| 4471 | // Del1 |
| 4472 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4473 | |
| 4474 | // Del2 |
| 4475 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4476 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4477 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4478 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4479 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4480 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4481 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4482 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4483 | } |
| 4484 | |
| 4485 | //----------------------------------------------------------------------------- |
| 4486 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4487 | // |
| 4488 | // stub stub stub |
| 4489 | // +-------+ +-------+ +---------+ +---------+ |
| 4490 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4491 | // +-------+ +-------+ +---------+ +---------+ |
| 4492 | // | | | | |
| 4493 | // | | | | |
| 4494 | // | | | | |
| 4495 | // | | RESTSubReq1 | | |
| 4496 | // | |---------------->| | |
| 4497 | // | | | | |
| 4498 | // | | RESTSubResp1 | | |
| 4499 | // | |<----------------| | |
| 4500 | // | | | SubReq1 | |
| 4501 | // | | |------------->| |
| 4502 | // | RESTSubReq2 | | |
| 4503 | // |------------------------------>| | |
| 4504 | // | | | | |
| 4505 | // | RESTSubDelResp2 | | |
| 4506 | // |<------------------------------| | |
| 4507 | // | | | SubFail1 | |
| 4508 | // | | |<-------------| |
| 4509 | // | | | | |
| 4510 | // | | RESTNotif1 | | |
| 4511 | // | | unsuccess | | |
| 4512 | // | |<----------------| | |
| 4513 | // | RESTNotif2 | | |
| 4514 | // | | unsuccess | | |
| 4515 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4516 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4517 | // | | 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] | 4518 | // | |---------------->| | |
| 4519 | // | | | | |
| 4520 | // | | RESTSubDelResp1 | | |
| 4521 | // | |<----------------| | |
| 4522 | // | | | | |
| 4523 | // | RESTSubDelReq2 | | |
| 4524 | // |------------------------------>| | |
| 4525 | // | | | | |
| 4526 | // | RESTSubDelResp2 | | |
| 4527 | // |<------------------------------| | |
| 4528 | // |
| 4529 | //----------------------------------------------------------------------------- |
| 4530 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4531 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4532 | |
| 4533 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4534 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4535 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4536 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4537 | Counter{cSubReqToE2, 1}, |
| 4538 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4539 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4540 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4541 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4542 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | }) |
| 4544 | |
| 4545 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4546 | |
| 4547 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4548 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4550 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4551 | |
| 4552 | // Req2 |
| 4553 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4554 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4555 | params2.SetMeid("RAN_NAME_1") |
| 4556 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4557 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4558 | |
| 4559 | // E2t: send SubsFail (first) |
| 4560 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4561 | fparams1.Set(crereq1) |
| 4562 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4563 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4564 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4565 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4566 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4567 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4568 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4569 | |
| 4570 | // Del1 |
| 4571 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4572 | |
| 4573 | // Del2 |
| 4574 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4575 | |
| 4576 | //Wait that subs is cleaned |
| 4577 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4578 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4580 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4581 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4582 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4583 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4584 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4585 | |
| 4586 | // Init counter check |
| 4587 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4588 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4589 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4590 | Counter{cSubReqToE2, 1}, |
| 4591 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4592 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4593 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4594 | Counter{cSubDelReqToE2, 1}, |
| 4595 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4596 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4597 | }) |
| 4598 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4599 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4600 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4601 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | |
| 4603 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4604 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4605 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4606 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4607 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4608 | |
| 4609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4610 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4611 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4612 | |
| 4613 | // Wait that subs is cleaned |
| 4614 | waitSubsCleanup(t, e2SubsId, 10) |
| 4615 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4616 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4617 | } |
| 4618 | |
| 4619 | //----------------------------------------------------------------------------- |
| 4620 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4621 | // |
| 4622 | // stub stub |
| 4623 | // +-------+ +---------+ +---------+ |
| 4624 | // | xapp | | submgr | | e2term | |
| 4625 | // +-------+ +---------+ +---------+ |
| 4626 | // | | | |
| 4627 | // | RESTSubReq | | |
| 4628 | // |---------------->| | |
| 4629 | // | | | |
| 4630 | // | RESTSubResp | | |
| 4631 | // |<----------------| | |
| 4632 | // | | SubReq | |
| 4633 | // | |------------->| |
| 4634 | // | | | |
| 4635 | // | | SubResp | |
| 4636 | // | |<-------------| |
| 4637 | // | | | |
| 4638 | // | RESTNotif | | |
| 4639 | // |<----------------| | |
| 4640 | // | | | |
| 4641 | // | RESTSubReq | | |
| 4642 | // |---------------->| | |
| 4643 | // | | | |
| 4644 | // | RESTSubResp | | |
| 4645 | // |<----------------| | |
| 4646 | // | | SubReq | |
| 4647 | // | |------------->| |
| 4648 | // | | | |
| 4649 | // | | SubResp | |
| 4650 | // | |<-------------| |
| 4651 | // | | | |
| 4652 | // | RESTNotif | | |
| 4653 | // |<----------------| | |
| 4654 | // | | | |
| 4655 | // | RESTSubDelReq | | |
| 4656 | // |---------------->| | |
| 4657 | // | | | |
| 4658 | // | | SubDelReq | |
| 4659 | // | |------------->| |
| 4660 | // | | | |
| 4661 | // | | SubDelResp | |
| 4662 | // | |<-------------| |
| 4663 | // | | | |
| 4664 | // | RESTSubDelResp | | |
| 4665 | // |<----------------| | |
| 4666 | // |
| 4667 | //----------------------------------------------------------------------------- |
| 4668 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4669 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4670 | |
| 4671 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4672 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4673 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4674 | Counter{cSubReqToE2, 2}, |
| 4675 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4676 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4677 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4678 | Counter{cSubDelReqToE2, 1}, |
| 4679 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4680 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4681 | }) |
| 4682 | |
| 4683 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4684 | const e2Timeout int64 = 1 |
| 4685 | const e2RetryCount int64 = 0 |
| 4686 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4687 | |
| 4688 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4689 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4690 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4691 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4692 | |
| 4693 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4694 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4695 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4696 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4697 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4698 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4699 | params.SetTimeToWait("w200ms") |
| 4700 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4701 | |
| 4702 | // Del |
| 4703 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4704 | |
| 4705 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4706 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4707 | |
| 4708 | // Wait that subs is cleaned |
| 4709 | waitSubsCleanup(t, e2SubsId, 10) |
| 4710 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4711 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4712 | } |
| 4713 | |
| 4714 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4715 | // TestRESTSubReqPolicyChangeNOk |
| 4716 | // |
| 4717 | // stub stub |
| 4718 | // +-------+ +---------+ +---------+ |
| 4719 | // | xapp | | submgr | | e2term | |
| 4720 | // +-------+ +---------+ +---------+ |
| 4721 | // | | | |
| 4722 | // | RESTSubReq | | |
| 4723 | // |---------------->| | |
| 4724 | // | | | |
| 4725 | // | RESTSubResp | | |
| 4726 | // |<----------------| | |
| 4727 | // | | SubReq | |
| 4728 | // | |------------->| |
| 4729 | // | | | |
| 4730 | // | | SubResp | |
| 4731 | // | |<-------------| |
| 4732 | // | | | |
| 4733 | // | RESTNotif | | |
| 4734 | // |<----------------| | |
| 4735 | // | | | |
| 4736 | // | RESTSubReq | | |
| 4737 | // |---------------->| | |
| 4738 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4739 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4740 | // | | | |
| 4741 | // | RESTSubDelReq | | |
| 4742 | // |---------------->| | |
| 4743 | // | | | |
| 4744 | // | | SubDelReq | |
| 4745 | // | |------------->| |
| 4746 | // | | | |
| 4747 | // | | SubDelResp | |
| 4748 | // | |<-------------| |
| 4749 | // | | | |
| 4750 | // | RESTSubDelResp | | |
| 4751 | // |<----------------| | |
| 4752 | // |
| 4753 | //----------------------------------------------------------------------------- |
| 4754 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4755 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4756 | |
| 4757 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4758 | Counter{cRestSubReqFromXapp, 2}, |
| 4759 | Counter{cRestSubRespToXapp, 1}, |
| 4760 | Counter{cSubReqToE2, 1}, |
| 4761 | Counter{cSubRespFromE2, 1}, |
| 4762 | Counter{cRestSubNotifToXapp, 1}, |
| 4763 | Counter{cRestSubFailToXapp, 1}, |
| 4764 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4765 | Counter{cSubDelReqToE2, 1}, |
| 4766 | Counter{cSubDelRespFromE2, 1}, |
| 4767 | Counter{cRestSubDelRespToXapp, 1}, |
| 4768 | }) |
| 4769 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4770 | // Req |
| 4771 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4772 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4773 | |
| 4774 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4775 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4776 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4777 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4778 | params.SetSubscriptionID(&restSubIdUpd) |
| 4779 | params.SetTimeToWait("w200ms") |
| 4780 | |
| 4781 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4782 | assert.Equal(t, restSubId2, "") |
| 4783 | |
| 4784 | // Del |
| 4785 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4786 | |
| 4787 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4788 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4789 | |
| 4790 | // Wait that subs is cleaned |
| 4791 | waitSubsCleanup(t, e2SubsId, 10) |
| 4792 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4793 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4794 | } |
| 4795 | |
| 4796 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4797 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4798 | // |
| 4799 | // stub stub stub |
| 4800 | // +-------+ +---------+ +---------+ +---------+ |
| 4801 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4802 | // +-------+ +---------+ +---------+ +---------+ |
| 4803 | // | | | | |
| 4804 | // | | | | |
| 4805 | // | | | | |
| 4806 | // | RESTSubReq1 | | | |
| 4807 | // |---------------->| | | |
| 4808 | // | | | | |
| 4809 | // | RESTSubResp1 | | | |
| 4810 | // |<----------------| | | |
| 4811 | // | | SubReq1 | | |
| 4812 | // | |------------->| | |
| 4813 | // | | | | |
| 4814 | // | RESTSubReq2 | | | |
| 4815 | // |---------------->| | | |
| 4816 | // | | | | |
| 4817 | // | RESTSubResp2 | | | |
| 4818 | // |<----------------| | | |
| 4819 | // | | SubReq2 | | |
| 4820 | // | |---------------------------->| |
| 4821 | // | | | | |
| 4822 | // | | SubResp1 | | |
| 4823 | // | |<-------------| | |
| 4824 | // | RESTNotif1 | | | |
| 4825 | // |<----------------| | | |
| 4826 | // | | SubResp2 | | |
| 4827 | // | |<----------------------------| |
| 4828 | // | RESTNotif2 | | | |
| 4829 | // |<----------------| | | |
| 4830 | // | | | | |
| 4831 | // | [SUBS 1 DELETE] | | |
| 4832 | // | | | | |
| 4833 | // | [SUBS 2 DELETE] | | |
| 4834 | // | | | | |
| 4835 | // |
| 4836 | //----------------------------------------------------------------------------- |
| 4837 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4838 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4839 | |
| 4840 | // Init counter check |
| 4841 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4842 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4843 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4844 | Counter{cSubReqToE2, 2}, |
| 4845 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4846 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4847 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4848 | Counter{cSubDelReqToE2, 2}, |
| 4849 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4850 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4851 | }) |
| 4852 | |
| 4853 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4854 | |
| 4855 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4856 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4857 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4858 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4859 | |
| 4860 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4861 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4862 | params.SetMeid("RAN_NAME_11") |
| 4863 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4864 | // would not work as notification would not be received |
| 4865 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4866 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4867 | |
| 4868 | // Resp1 |
| 4869 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4870 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4871 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4872 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4873 | |
| 4874 | // Resp2 |
| 4875 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4876 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4877 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4878 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4879 | |
| 4880 | // Delete1 |
| 4881 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4882 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4883 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4884 | |
| 4885 | // Wait that subs is cleaned |
| 4886 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4887 | |
| 4888 | // Delete2 |
| 4889 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4890 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4891 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4892 | |
| 4893 | // Wait that subs is cleaned |
| 4894 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4895 | |
| 4896 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4897 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4898 | } |
| 4899 | |
| 4900 | //----------------------------------------------------------------------------- |
| 4901 | // TestRESTSubReqAsn1EncodeFail |
| 4902 | // |
| 4903 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4904 | // stub stub |
| 4905 | // +-------+ +---------+ +---------+ |
| 4906 | // | xapp | | submgr | | e2term | |
| 4907 | // +-------+ +---------+ +---------+ |
| 4908 | // | | | |
| 4909 | // | RESTSubReq | | |
| 4910 | // |---------------->| | |
| 4911 | // | | | |
| 4912 | // | RESTSubResp | | |
| 4913 | // |<----------------| | |
| 4914 | // | RESTSubDelReq | | |
| 4915 | // |---------------->| | |
| 4916 | // | RESTSubDelResp | | |
| 4917 | // | unsuccess | | |
| 4918 | // |<----------------| | |
| 4919 | // | | | |
| 4920 | // |
| 4921 | //----------------------------------------------------------------------------- |
| 4922 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4923 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4924 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4925 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4926 | |
| 4927 | } |
| 4928 | |
| 4929 | //----------------------------------------------------------------------------- |
| 4930 | // TestRESTSubReqInsertAndSubDelOk |
| 4931 | // |
| 4932 | // stub stub |
| 4933 | // +-------+ +---------+ +---------+ |
| 4934 | // | xapp | | submgr | | e2term | |
| 4935 | // +-------+ +---------+ +---------+ |
| 4936 | // | | | |
| 4937 | // | RestSubReq | | |
| 4938 | // |---------------->| | |
| 4939 | // | | | |
| 4940 | // | RESTSubResp | | |
| 4941 | // |<----------------| | |
| 4942 | // | | | |
| 4943 | // | | SubReq | |
| 4944 | // | |------------->| |
| 4945 | // | | | |
| 4946 | // | | SubResp | |
| 4947 | // | |<-------------| |
| 4948 | // | RESTNotif | | |
| 4949 | // |<----------------| | |
| 4950 | // | ... | ... | |
| 4951 | // | | | |
| 4952 | // | RESTSubDelReq | | |
| 4953 | // |---------------->| | |
| 4954 | // | | | |
| 4955 | // | | SubDelReq | |
| 4956 | // | |------------->| |
| 4957 | // | | | |
| 4958 | // | | SubDelResp | |
| 4959 | // | |<-------------| |
| 4960 | // | | | |
| 4961 | // | RESTSubDelResp| | |
| 4962 | // |<----------------| | |
| 4963 | // |
| 4964 | //----------------------------------------------------------------------------- |
| 4965 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4966 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4967 | |
| 4968 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4969 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4970 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4971 | Counter{cSubReqToE2, 1}, |
| 4972 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4973 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4974 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4975 | Counter{cSubDelReqToE2, 1}, |
| 4976 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4977 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4978 | }) |
| 4979 | |
| 4980 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4981 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4982 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4983 | params.SetSubActionTypes("insert") |
| 4984 | |
| 4985 | // Req |
| 4986 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4987 | |
| 4988 | // Del |
| 4989 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4990 | |
| 4991 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4992 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4993 | |
| 4994 | // Wait that subs is cleaned |
| 4995 | waitSubsCleanup(t, e2SubsId, 10) |
| 4996 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4997 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4998 | } |
| 4999 | |
| 5000 | //----------------------------------------------------------------------------- |
| 5001 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5002 | // |
| 5003 | // stub stub |
| 5004 | // +-------+ +---------+ +---------+ |
| 5005 | // | xapp | | submgr | | e2term | |
| 5006 | // +-------+ +---------+ +---------+ |
| 5007 | // | | | |
| 5008 | // | RESTSubReq | | |
| 5009 | // |------------->| | |
| 5010 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5011 | // | RESTSubResp | | |
| 5012 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5013 | // | | SubReq | |
| 5014 | // | |------------->| |
| 5015 | // | | | |
| 5016 | // | | SubResp | |
| 5017 | // | <----| |
| 5018 | // | | |
| 5019 | // | Submgr restart | |
| 5020 | // | | |
| 5021 | // | | | |
| 5022 | // | | SubDelReq | |
| 5023 | // | |------------->| |
| 5024 | // | | | |
| 5025 | // | | SubDelResp | |
| 5026 | // | |<-------------| |
| 5027 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5028 | // | RESTNotif | | |
| 5029 | // | unsuccess | | |
| 5030 | // |<-------------| | |
| 5031 | // | | | |
| 5032 | // | RESTSubDelReq| | |
| 5033 | // |------------->| | |
| 5034 | // | | | |
| 5035 | // |RESTSubDelResp| | |
| 5036 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5037 | // |
| 5038 | //----------------------------------------------------------------------------- |
| 5039 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5040 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 5041 | |
| 5042 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5043 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5044 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5045 | Counter{cSubReqToE2, 1}, |
| 5046 | Counter{cSubDelReqFromXapp, 1}, |
| 5047 | Counter{cSubDelReqToE2, 1}, |
| 5048 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5049 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5050 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5051 | }) |
| 5052 | |
| 5053 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5054 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5055 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5056 | |
| 5057 | //Req |
| 5058 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5059 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5060 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5061 | |
| 5062 | e2termConn1.RecvSubsReq(t) |
| 5063 | |
| 5064 | mainCtrl.SetResetTestFlag(t, false) |
| 5065 | |
| 5066 | mainCtrl.SimulateRestart(t) |
| 5067 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5068 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5069 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5070 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5071 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5072 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5073 | //Del |
| 5074 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5075 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5076 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5077 | e2termConn1.TestMsgChanEmpty(t) |
| 5078 | mainCtrl.wait_registry_empty(t, 10) |
| 5079 | |
| 5080 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5081 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5082 | } |
| 5083 | |
| 5084 | //----------------------------------------------------------------------------- |
| 5085 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5086 | // |
| 5087 | // stub stub |
| 5088 | // +-------+ +---------+ +---------+ |
| 5089 | // | xapp | | submgr | | e2term | |
| 5090 | // +-------+ +---------+ +---------+ |
| 5091 | // | | | |
| 5092 | // | RESTSubReq | | |
| 5093 | // |---------------->| | |
| 5094 | // | | | |
| 5095 | // | RESTSubResp | | |
| 5096 | // |<----------------| | |
| 5097 | // | | SubReq | |
| 5098 | // | |------------->| |
| 5099 | // | | | |
| 5100 | // | | SubResp | |
| 5101 | // | |<-------------| |
| 5102 | // | | | |
| 5103 | // | RESTNotif | | |
| 5104 | // |<----------------| | |
| 5105 | // | | | |
| 5106 | // | | |
| 5107 | // | Submgr restart | |
| 5108 | // | | | |
| 5109 | // | RESTSubDelReq | | |
| 5110 | // |---------------->| | |
| 5111 | // | | | |
| 5112 | // | | SubDelReq | |
| 5113 | // | |------------->| |
| 5114 | // | | | |
| 5115 | // | | SubDelResp | |
| 5116 | // | |<-------------| |
| 5117 | // | | | |
| 5118 | // | RESTSubDelResp | | |
| 5119 | // |<----------------| | |
| 5120 | // |
| 5121 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5122 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5123 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5124 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5125 | |
| 5126 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5127 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5128 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5129 | Counter{cSubReqToE2, 1}, |
| 5130 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5131 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5132 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5133 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5134 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5135 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5137 | |
| 5138 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5139 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5140 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5141 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5142 | |
| 5143 | // Check subscription |
| 5144 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5145 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5146 | mainCtrl.SimulateRestart(t) |
| 5147 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5148 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5149 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5150 | // That needs to be completed before successful subscription query is possible |
| 5151 | <-time.After(time.Second * 1) |
| 5152 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5153 | // Check subscription |
| 5154 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5155 | |
| 5156 | // Delete subscription |
| 5157 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5158 | |
| 5159 | //Wait that subs is cleaned |
| 5160 | waitSubsCleanup(t, e2SubsId, 10) |
| 5161 | |
| 5162 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5163 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5164 | } |
| 5165 | |
| 5166 | //----------------------------------------------------------------------------- |
| 5167 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5168 | // |
| 5169 | // stub stub |
| 5170 | // +-------+ +-------+ +---------+ +---------+ |
| 5171 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5172 | // +-------+ +-------+ +---------+ +---------+ |
| 5173 | // | | | | |
| 5174 | // | | RESTSubReq1 | | |
| 5175 | // | |---------------->| | |
| 5176 | // | | | | |
| 5177 | // | | RESTSubResp1 | | |
| 5178 | // | |<----------------| | |
| 5179 | // | | | | |
| 5180 | // | | | SubReq1 | |
| 5181 | // | | |------------->| |
| 5182 | // | | | SubResp1 | |
| 5183 | // | | |<-------------| |
| 5184 | // | | RESTNotif1 | | |
| 5185 | // | |<----------------| | |
| 5186 | // | | | | |
| 5187 | // | RESTSubReq2 | | |
| 5188 | // |------------------------------>| | |
| 5189 | // | | | | |
| 5190 | // | RESTSubResp2 | | |
| 5191 | // |<------------------------------| | |
| 5192 | // | | | | |
| 5193 | // | | RESTNotif2 | | |
| 5194 | // |<------------------------------| | |
| 5195 | // | | | | |
| 5196 | // | | Submgr restart | |
| 5197 | // | | | | |
| 5198 | // | | RESTSubDelReq1 | | |
| 5199 | // | |---------------->| | |
| 5200 | // | | | | |
| 5201 | // | | RESTSubDelResp1 | | |
| 5202 | // | |<----------------| | |
| 5203 | // | | | | |
| 5204 | // | | Submgr restart | |
| 5205 | // | | | | |
| 5206 | // | RESTSubDelReq2 | | |
| 5207 | // |------------------------------>| | |
| 5208 | // | | | | |
| 5209 | // | RESTSubDelResp2 | | |
| 5210 | // |<------------------------------| | |
| 5211 | // | | | | |
| 5212 | // | | | SubDelReq2 | |
| 5213 | // | | |------------->| |
| 5214 | // | | | | |
| 5215 | // | | | SubDelResp2 | |
| 5216 | // | | |<-------------| |
| 5217 | // | | | | |
| 5218 | // |
| 5219 | //----------------------------------------------------------------------------- |
| 5220 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5221 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5222 | |
| 5223 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5224 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5225 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5226 | Counter{cSubReqToE2, 1}, |
| 5227 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5228 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5229 | Counter{cMergedSubscriptions, 1}, |
| 5230 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5231 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5232 | Counter{cSubDelReqToE2, 1}, |
| 5233 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5234 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5235 | }) |
| 5236 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5237 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5238 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5240 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5241 | |
| 5242 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5243 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5244 | params.SetMeid("RAN_NAME_1") |
| 5245 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5246 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5247 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5248 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5249 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5250 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5251 | |
| 5252 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5253 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5254 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5255 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5256 | |
| 5257 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5258 | // That needs to be completed before successful subscription delete is possible |
| 5259 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5260 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5261 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5262 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame^] | 5263 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5264 | // Above wait does not work correctly anymore as this delay makes this test case work |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5265 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5266 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5267 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5268 | |
| 5269 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5270 | // That needs to be completed before successful subscription query is possible |
| 5271 | <-time.After(time.Second * 1) |
| 5272 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5273 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5274 | |
| 5275 | // Delete subscription 2 |
| 5276 | deleteXapp2Subscription(t, &restSubId2) |
| 5277 | |
| 5278 | //Wait that subs is cleaned |
| 5279 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5280 | |
| 5281 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5282 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5283 | } |
| 5284 | |
| 5285 | //----------------------------------------------------------------------------- |
| 5286 | // TestRESTReportSubReqAndSubDelOk |
| 5287 | // |
| 5288 | // stub stub |
| 5289 | // +-------+ +---------+ +---------+ |
| 5290 | // | xapp | | submgr | | e2term | |
| 5291 | // +-------+ +---------+ +---------+ |
| 5292 | // | | | |
| 5293 | // | RestSubReq | | |
| 5294 | // |---------------->| | |
| 5295 | // | | | |
| 5296 | // | RESTSubResp | | |
| 5297 | // |<----------------| | |
| 5298 | // | | | |
| 5299 | // | | SubReq | |
| 5300 | // | |------------->| |
| 5301 | // | | | |
| 5302 | // | | SubResp | |
| 5303 | // | |<-------------| |
| 5304 | // | RESTNotif | | |
| 5305 | // |<----------------| | |
| 5306 | // | | SubReq | |
| 5307 | // | |------------->| |
| 5308 | // | | | |
| 5309 | // | | SubResp | |
| 5310 | // | |<-------------| |
| 5311 | // | RESTNotif | | |
| 5312 | // |<----------------| | |
| 5313 | // | ... | ... | |
| 5314 | // | | | |
| 5315 | // | | | |
| 5316 | // | RESTSubDelReq | | |
| 5317 | // |---------------->| | |
| 5318 | // | | | |
| 5319 | // | | SubDelReq | |
| 5320 | // | |------------->| |
| 5321 | // | | | |
| 5322 | // | | SubDelResp | |
| 5323 | // | |<-------------| |
| 5324 | // | | | |
| 5325 | // | RESTSubDelResp| | |
| 5326 | // |<----------------| | |
| 5327 | // |
| 5328 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5329 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5330 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5331 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5332 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5333 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5334 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5335 | } |
| 5336 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5337 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5338 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5339 | |
| 5340 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5341 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5342 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5343 | |
| 5344 | var e2SubsId []uint32 |
| 5345 | for i := 0; i < subReqCount; i++ { |
| 5346 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5347 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5348 | |
| 5349 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5350 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5351 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5352 | e2SubsId = append(e2SubsId, instanceId) |
| 5353 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5354 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5355 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5356 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5357 | |
| 5358 | } |
| 5359 | |
| 5360 | // Del |
| 5361 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5362 | |
| 5363 | for i := 0; i < subReqCount; i++ { |
| 5364 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5365 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5366 | } |
| 5367 | |
| 5368 | // Wait that subs is cleaned |
| 5369 | for i := 0; i < subReqCount; i++ { |
| 5370 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5371 | } |
| 5372 | |
| 5373 | xappConn1.TestMsgChanEmpty(t) |
| 5374 | e2termConn1.TestMsgChanEmpty(t) |
| 5375 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5376 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5377 | } |
| 5378 | |
| 5379 | /* |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5380 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { was in comments already |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5381 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5382 | |
| 5383 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5384 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5385 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5386 | |
| 5387 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5388 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5389 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5390 | } |
| 5391 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5392 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5393 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5394 | |
| 5395 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5396 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5398 | |
| 5399 | var e2SubsId []uint32 |
| 5400 | for i := 0; i < subReqCount; i++ { |
| 5401 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5402 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5403 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5404 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5405 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5406 | e2SubsId = append(e2SubsId, instanceId) |
| 5407 | } |
| 5408 | |
| 5409 | // Del |
| 5410 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5411 | |
| 5412 | for i := 0; i < subReqCount; i++ { |
| 5413 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5414 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5415 | } |
| 5416 | |
| 5417 | // Wait that subs is cleaned |
| 5418 | for i := 0; i < subReqCount; i++ { |
| 5419 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5420 | } |
| 5421 | xappConn1.TestMsgChanEmpty(t) |
| 5422 | e2termConn1.TestMsgChanEmpty(t) |
| 5423 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5424 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5425 | } |
| 5426 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5427 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5428 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5429 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5430 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5431 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5432 | Counter{cSubReqToE2, 2}, |
| 5433 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5434 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5435 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5436 | Counter{cSubDelReqToE2, 2}, |
| 5437 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5438 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5439 | }) |
| 5440 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5441 | const subReqCount int = 2 |
| 5442 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5443 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5444 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5445 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5446 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5447 | |
| 5448 | assert.Equal(t, len(e2SubsIds), 2) |
| 5449 | |
| 5450 | // Del |
| 5451 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5452 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5453 | |
| 5454 | xappConn1.TestMsgChanEmpty(t) |
| 5455 | e2termConn1.TestMsgChanEmpty(t) |
| 5456 | mainCtrl.wait_registry_empty(t, 10) |
| 5457 | |
| 5458 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5459 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5460 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5461 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5462 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5463 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5464 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5465 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5466 | Counter{cSubReqToE2, 19}, |
| 5467 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5468 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5469 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5470 | Counter{cSubDelReqToE2, 19}, |
| 5471 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5472 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5473 | }) |
| 5474 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5475 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5476 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5477 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5478 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5479 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5480 | |
| 5481 | assert.Equal(t, len(e2SubsIds), 19) |
| 5482 | |
| 5483 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5484 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5485 | |
| 5486 | xappConn1.TestMsgChanEmpty(t) |
| 5487 | e2termConn1.TestMsgChanEmpty(t) |
| 5488 | mainCtrl.wait_registry_empty(t, 10) |
| 5489 | |
| 5490 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5491 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5492 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5493 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5494 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5495 | |
| 5496 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5497 | |
| 5498 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5499 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5500 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5501 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5502 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5503 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5504 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5505 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5506 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5507 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5508 | }) |
| 5509 | |
| 5510 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5511 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5512 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5513 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5514 | |
| 5515 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5516 | |
| 5517 | // Del |
| 5518 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5519 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5520 | |
| 5521 | xappConn1.TestMsgChanEmpty(t) |
| 5522 | e2termConn1.TestMsgChanEmpty(t) |
| 5523 | mainCtrl.wait_registry_empty(t, 10) |
| 5524 | |
| 5525 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5526 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5527 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5528 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5529 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5530 | |
| 5531 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5532 | |
| 5533 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5534 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5535 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5536 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5537 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5538 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5539 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5540 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5541 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5542 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5543 | }) |
| 5544 | |
| 5545 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5546 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5547 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5548 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5549 | |
| 5550 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5551 | |
| 5552 | // Del |
| 5553 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5554 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5555 | |
| 5556 | xappConn1.TestMsgChanEmpty(t) |
| 5557 | e2termConn1.TestMsgChanEmpty(t) |
| 5558 | mainCtrl.wait_registry_empty(t, 10) |
| 5559 | |
| 5560 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5561 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5562 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5563 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5564 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5565 | |
| 5566 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5567 | |
| 5568 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5569 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5570 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5571 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5572 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5573 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5574 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5575 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5576 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5577 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5578 | }) |
| 5579 | |
| 5580 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5581 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5582 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5583 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5584 | |
| 5585 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5586 | |
| 5587 | // Del |
| 5588 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5589 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5590 | |
| 5591 | xappConn1.TestMsgChanEmpty(t) |
| 5592 | e2termConn1.TestMsgChanEmpty(t) |
| 5593 | mainCtrl.wait_registry_empty(t, 10) |
| 5594 | |
| 5595 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5596 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5597 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5598 | |
| 5599 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5600 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5601 | |
| 5602 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5603 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5604 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5605 | Counter{cSubReqToE2, 2}, |
| 5606 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5607 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5608 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5609 | Counter{cSubDelReqToE2, 2}, |
| 5610 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5611 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5612 | }) |
| 5613 | |
| 5614 | // Req1 |
| 5615 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5616 | |
| 5617 | //Subs Create |
| 5618 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5619 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5620 | |
| 5621 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5622 | |
| 5623 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5624 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5625 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5626 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5627 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5628 | |
| 5629 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5630 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5631 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5632 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5633 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5634 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5635 | |
| 5636 | deleteXapp1Subscription(t, &restSubId1) |
| 5637 | deleteXapp2Subscription(t, &restSubId2) |
| 5638 | |
| 5639 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5640 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5641 | |
| 5642 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5643 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5644 | } |
| 5645 | |
| 5646 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5647 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5648 | |
| 5649 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5650 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5651 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5652 | Counter{cSubReqToE2, 2}, |
| 5653 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5654 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5655 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5656 | Counter{cSubDelReqToE2, 2}, |
| 5657 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5658 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5659 | }) |
| 5660 | |
| 5661 | // Req1 |
| 5662 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5663 | |
| 5664 | //Subs Create |
| 5665 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5666 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5667 | |
| 5668 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5669 | |
| 5670 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5671 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5672 | params.SetMeid("RAN_NAME_1") |
| 5673 | |
| 5674 | actionId := int64(1) |
| 5675 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5676 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5677 | subsequestActionType := "continue" |
| 5678 | timeToWait := "w10ms" |
| 5679 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5680 | |
| 5681 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5682 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5683 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5684 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5685 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5686 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5687 | |
| 5688 | deleteXapp1Subscription(t, &restSubId1) |
| 5689 | deleteXapp2Subscription(t, &restSubId2) |
| 5690 | |
| 5691 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5692 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5693 | |
| 5694 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5695 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5696 | } |
| 5697 | |
| 5698 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5699 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5700 | |
| 5701 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5702 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5703 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5704 | Counter{cSubReqToE2, 2}, |
| 5705 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5706 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5707 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5708 | Counter{cSubDelReqToE2, 2}, |
| 5709 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5710 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5711 | }) |
| 5712 | |
| 5713 | // Req1 |
| 5714 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5715 | |
| 5716 | //Subs Create |
| 5717 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5718 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5719 | |
| 5720 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5721 | |
| 5722 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5723 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5724 | params.SetMeid("RAN_NAME_1") |
| 5725 | params.SetSubActionIDs(int64(2)) |
| 5726 | |
| 5727 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5728 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5729 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5730 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5731 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5732 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5733 | |
| 5734 | deleteXapp1Subscription(t, &restSubId1) |
| 5735 | deleteXapp2Subscription(t, &restSubId2) |
| 5736 | |
| 5737 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5738 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5739 | |
| 5740 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5741 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5742 | } |
| 5743 | |
| 5744 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5745 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5746 | |
| 5747 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5748 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5749 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5750 | Counter{cSubReqToE2, 2}, |
| 5751 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5752 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5753 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5754 | Counter{cSubDelReqToE2, 2}, |
| 5755 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5756 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5757 | }) |
| 5758 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5759 | const e2Timeout int64 = 2 |
| 5760 | const e2RetryCount int64 = 2 |
| 5761 | const routingNeeded bool = true |
| 5762 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5763 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5764 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5765 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5766 | |
| 5767 | //Subs Create |
| 5768 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5769 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5770 | |
| 5771 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5772 | |
| 5773 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5774 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5775 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5776 | params.SetMeid("RAN_NAME_1") |
| 5777 | |
| 5778 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5779 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5780 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5781 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5782 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5783 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5784 | |
| 5785 | deleteXapp1Subscription(t, &restSubId1) |
| 5786 | deleteXapp2Subscription(t, &restSubId2) |
| 5787 | |
| 5788 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5789 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5790 | |
| 5791 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5792 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5793 | } |
| 5794 | |
| 5795 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5796 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5797 | |
| 5798 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5799 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5800 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5801 | Counter{cSubReqToE2, 2}, |
| 5802 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5803 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5804 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5805 | Counter{cSubDelReqToE2, 2}, |
| 5806 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5807 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5808 | }) |
| 5809 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5810 | const e2Timeout int64 = 2 |
| 5811 | const e2RetryCount int64 = 2 |
| 5812 | const routingNeeded bool = true |
| 5813 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5814 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5815 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5816 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5817 | |
| 5818 | //Subs Create |
| 5819 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5820 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5821 | |
| 5822 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5823 | |
| 5824 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5825 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5826 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5827 | params.SetMeid("RAN_NAME_1") |
| 5828 | |
| 5829 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5830 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5831 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5832 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5833 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5834 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5835 | |
| 5836 | deleteXapp1Subscription(t, &restSubId1) |
| 5837 | deleteXapp2Subscription(t, &restSubId2) |
| 5838 | |
| 5839 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5840 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5841 | |
| 5842 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5843 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5844 | } |
| 5845 | |
| 5846 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5847 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5848 | |
| 5849 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5850 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5851 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5852 | Counter{cSubReqToE2, 2}, |
| 5853 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5854 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5855 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5856 | Counter{cSubDelReqToE2, 2}, |
| 5857 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5858 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5859 | }) |
| 5860 | |
| 5861 | // Req1 |
| 5862 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5863 | |
| 5864 | //Subs Create |
| 5865 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5866 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5867 | |
| 5868 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5869 | |
| 5870 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5871 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5872 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5873 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5874 | params.SetSubActionDefinition(actionDefinition) |
| 5875 | |
| 5876 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5877 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5878 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5879 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5880 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5881 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5882 | |
| 5883 | deleteXapp1Subscription(t, &restSubId1) |
| 5884 | deleteXapp2Subscription(t, &restSubId2) |
| 5885 | |
| 5886 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5887 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5888 | |
| 5889 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5890 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5891 | } |
| 5892 | |
| 5893 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5894 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5895 | |
| 5896 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5897 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5898 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5899 | Counter{cSubReqToE2, 2}, |
| 5900 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5901 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5902 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5903 | Counter{cSubDelReqToE2, 2}, |
| 5904 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5905 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5906 | }) |
| 5907 | |
| 5908 | // Req1 |
| 5909 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5910 | |
| 5911 | //Subs Create |
| 5912 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5913 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5914 | |
| 5915 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5916 | |
| 5917 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5918 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5919 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5920 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5921 | params.SetSubActionDefinition(actionDefinition) |
| 5922 | |
| 5923 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5924 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5925 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5926 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5927 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5928 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5929 | |
| 5930 | deleteXapp1Subscription(t, &restSubId1) |
| 5931 | deleteXapp2Subscription(t, &restSubId2) |
| 5932 | |
| 5933 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5934 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5935 | |
| 5936 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5937 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5938 | } |
| 5939 | |
| 5940 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5941 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5942 | |
| 5943 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5944 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5945 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5946 | Counter{cSubReqToE2, 2}, |
| 5947 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5948 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5949 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5950 | Counter{cSubDelReqToE2, 2}, |
| 5951 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5952 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5953 | }) |
| 5954 | |
| 5955 | // Req1 |
| 5956 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5957 | |
| 5958 | //Subs Create |
| 5959 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5960 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5961 | |
| 5962 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5963 | |
| 5964 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5965 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5966 | params.SetMeid("RAN_NAME_1") |
| 5967 | params.SetTimeToWait("w200ms") |
| 5968 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5969 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5970 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5971 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5972 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5973 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5974 | |
| 5975 | deleteXapp1Subscription(t, &restSubId1) |
| 5976 | deleteXapp2Subscription(t, &restSubId2) |
| 5977 | |
| 5978 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5979 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5980 | |
| 5981 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5982 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5983 | } |
| 5984 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5985 | //----------------------------------------------------------------------------- |
| 5986 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5987 | // |
| 5988 | // stub stub |
| 5989 | // +-------+ +---------+ +---------+ |
| 5990 | // | xapp | | submgr | | e2term | |
| 5991 | // +-------+ +---------+ +---------+ |
| 5992 | // | | | |
| 5993 | // | RestSubReq | | |
| 5994 | // |---------------->| | |
| 5995 | // | | | |
| 5996 | // | RESTSubResp | | |
| 5997 | // |<----------------| | |
| 5998 | // | | | |
| 5999 | // | | SubReq | |
| 6000 | // | |------------->| |
| 6001 | // | | | |
| 6002 | // | | SubResp | ASN.1 decode fails |
| 6003 | // | |<-------------| |
| 6004 | // | | | |
| 6005 | // | | SubReq | |
| 6006 | // | |------------->| |
| 6007 | // | | | |
| 6008 | // | | SubFail | Duplicated action |
| 6009 | // | |<-------------| |
| 6010 | // | RESTNotif (fail)| | |
| 6011 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6012 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6013 | // |
| 6014 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6015 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6016 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6017 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 6018 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6019 | |
| 6020 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6021 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6022 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6023 | |
| 6024 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6025 | // Decode of this response fails which will result resending original request |
| 6026 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 6027 | |
| 6028 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6029 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6030 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6031 | |
| 6032 | // Subscription already created in E2 Node. |
| 6033 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6034 | fparams.Set(crereq) |
| 6035 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6036 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6037 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6038 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6039 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6040 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6041 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6042 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6043 | // Wait that subs is cleaned |
| 6044 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6045 | |
| 6046 | xappConn1.TestMsgChanEmpty(t) |
| 6047 | e2termConn1.TestMsgChanEmpty(t) |
| 6048 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6049 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6050 | } |
| 6051 | |
| 6052 | //----------------------------------------------------------------------------- |
| 6053 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6054 | // |
| 6055 | // stub stub |
| 6056 | // +-------+ +---------+ +---------+ |
| 6057 | // | xapp | | submgr | | e2term | |
| 6058 | // +-------+ +---------+ +---------+ |
| 6059 | // | | | |
| 6060 | // | RestSubReq | | |
| 6061 | // |---------------->| | |
| 6062 | // | | | |
| 6063 | // | RESTSubResp | | |
| 6064 | // |<----------------| | |
| 6065 | // | | | |
| 6066 | // | | SubReq | |
| 6067 | // | |------------->| |
| 6068 | // | | | |
| 6069 | // | | SubResp | Unknown instanceId |
| 6070 | // | |<-------------| |
| 6071 | // | | | |
| 6072 | // | | SubReq | |
| 6073 | // | |------------->| |
| 6074 | // | | | |
| 6075 | // | | SubFail | Duplicated action |
| 6076 | // | |<-------------| |
| 6077 | // | RESTNotif (fail)| | |
| 6078 | // |<----------------| | |
| 6079 | // | | SubDelReq | |
| 6080 | // | |------------->| |
| 6081 | // | | | |
| 6082 | // | | SubDelResp | |
| 6083 | // | |<-------------| |
| 6084 | // |
| 6085 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6086 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6087 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6088 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 6089 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6090 | |
| 6091 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6092 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6093 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6094 | |
| 6095 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6096 | |
| 6097 | // Unknown instanceId in this response which will result resending original request |
| 6098 | orgInstanceId := crereq.RequestId.InstanceId |
| 6099 | crereq.RequestId.InstanceId = 0 |
| 6100 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6101 | |
| 6102 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6103 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6104 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6105 | |
| 6106 | // Subscription already created in E2 Node. |
| 6107 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6108 | fparams.Set(crereq) |
| 6109 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6110 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6111 | |
| 6112 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6113 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6114 | |
| 6115 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6116 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6117 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6118 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6119 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6120 | // Wait that subs is cleaned |
| 6121 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6122 | |
| 6123 | xappConn1.TestMsgChanEmpty(t) |
| 6124 | e2termConn1.TestMsgChanEmpty(t) |
| 6125 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6126 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6127 | } |
| 6128 | |
| 6129 | //----------------------------------------------------------------------------- |
| 6130 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6131 | // |
| 6132 | // stub stub |
| 6133 | // +-------+ +---------+ +---------+ |
| 6134 | // | xapp | | submgr | | e2term | |
| 6135 | // +-------+ +---------+ +---------+ |
| 6136 | // | | | |
| 6137 | // | RestSubReq | | |
| 6138 | // |---------------->| | |
| 6139 | // | | | |
| 6140 | // | RESTSubResp | | |
| 6141 | // |<----------------| | |
| 6142 | // | | | |
| 6143 | // | | SubReq | |
| 6144 | // | |------------->| |
| 6145 | // | | | |
| 6146 | // | | SubResp | No transaction for the response |
| 6147 | // | |<-------------| |
| 6148 | // | | | |
| 6149 | // | | SubReq | |
| 6150 | // | |------------->| |
| 6151 | // | | | |
| 6152 | // | | SubFail | Duplicated action |
| 6153 | // | |<-------------| |
| 6154 | // | RESTNotif (fail)| | |
| 6155 | // |<----------------| | |
| 6156 | // | | SubDelReq | |
| 6157 | // | |------------->| |
| 6158 | // | | | |
| 6159 | // | | SubDelResp | |
| 6160 | // | |<-------------| |
| 6161 | // | | | |
| 6162 | // | | SubDelReq | |
| 6163 | // | |------------->| |
| 6164 | // | | | |
| 6165 | // | | SubDelResp | |
| 6166 | // | |<-------------| |
| 6167 | // |
| 6168 | //----------------------------------------------------------------------------- |
| 6169 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6170 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6171 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6172 | |
| 6173 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6174 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6175 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6176 | |
| 6177 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6178 | |
| 6179 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6180 | // No transaction exist for this response which will result resending original request |
| 6181 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6182 | |
| 6183 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6184 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6185 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6186 | |
| 6187 | // Subscription already created in E2 Node. |
| 6188 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6189 | fparams.Set(crereq) |
| 6190 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6191 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6192 | |
| 6193 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6194 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6195 | |
| 6196 | // Resending happens because there no transaction |
| 6197 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6198 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6199 | |
| 6200 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6201 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6202 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6203 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6204 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6205 | // Wait that subs is cleaned |
| 6206 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6207 | |
| 6208 | xappConn1.TestMsgChanEmpty(t) |
| 6209 | e2termConn1.TestMsgChanEmpty(t) |
| 6210 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6211 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6212 | } |
| 6213 | |
| 6214 | //----------------------------------------------------------------------------- |
| 6215 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6216 | // |
| 6217 | // stub stub |
| 6218 | // +-------+ +---------+ +---------+ |
| 6219 | // | xapp | | submgr | | e2term | |
| 6220 | // +-------+ +---------+ +---------+ |
| 6221 | // | | | |
| 6222 | // | RestSubReq | | |
| 6223 | // |---------------->| | |
| 6224 | // | | | |
| 6225 | // | RESTSubResp | | |
| 6226 | // |<----------------| | |
| 6227 | // | | | |
| 6228 | // | | SubReq | |
| 6229 | // | |------------->| |
| 6230 | // | | | |
| 6231 | // | | SubFail | ASN.1 decode fails |
| 6232 | // | |<-------------| |
| 6233 | // | | | |
| 6234 | // | | SubReq | |
| 6235 | // | |------------->| |
| 6236 | // | | | |
| 6237 | // | | SubFail | Duplicated action |
| 6238 | // | |<-------------| |
| 6239 | // | RESTNotif (fail)| | |
| 6240 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6241 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6242 | // |
| 6243 | //----------------------------------------------------------------------------- |
| 6244 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6245 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6246 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6247 | |
| 6248 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6249 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6250 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6251 | |
| 6252 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6253 | |
| 6254 | // Decode of this response fails which will result resending original request |
| 6255 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6256 | |
| 6257 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6258 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6259 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6260 | |
| 6261 | // Subscription already created in E2 Node. |
| 6262 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6263 | fparams.Set(crereq) |
| 6264 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6265 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6266 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6267 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6268 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6269 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6270 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6271 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6272 | // Wait that subs is cleaned |
| 6273 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6274 | |
| 6275 | xappConn1.TestMsgChanEmpty(t) |
| 6276 | e2termConn1.TestMsgChanEmpty(t) |
| 6277 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6278 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6279 | } |
| 6280 | |
| 6281 | //----------------------------------------------------------------------------- |
| 6282 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6283 | // |
| 6284 | // stub stub |
| 6285 | // +-------+ +---------+ +---------+ |
| 6286 | // | xapp | | submgr | | e2term | |
| 6287 | // +-------+ +---------+ +---------+ |
| 6288 | // | | | |
| 6289 | // | RestSubReq | | |
| 6290 | // |---------------->| | |
| 6291 | // | | | |
| 6292 | // | RESTSubResp | | |
| 6293 | // |<----------------| | |
| 6294 | // | | | |
| 6295 | // | | SubReq | |
| 6296 | // | |------------->| |
| 6297 | // | | | |
| 6298 | // | | SubFail | Unknown instanceId |
| 6299 | // | |<-------------| |
| 6300 | // | | | |
| 6301 | // | | SubReq | |
| 6302 | // | |------------->| |
| 6303 | // | | | |
| 6304 | // | | SubFail | Duplicated action |
| 6305 | // | |<-------------| |
| 6306 | // | RESTNotif (fail)| | |
| 6307 | // |<----------------| | |
| 6308 | // | | SubDelReq | |
| 6309 | // | |------------->| |
| 6310 | // | | | |
| 6311 | // | | SubDelResp | |
| 6312 | // | |<-------------| |
| 6313 | // |
| 6314 | //----------------------------------------------------------------------------- |
| 6315 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6316 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6317 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6318 | |
| 6319 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6320 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6321 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6322 | |
| 6323 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6324 | |
| 6325 | // Unknown instanceId in this response which will result resending original request |
| 6326 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6327 | fparams.Set(crereq) |
| 6328 | fparams.Fail.RequestId.InstanceId = 0 |
| 6329 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6330 | |
| 6331 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6332 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6333 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6334 | |
| 6335 | // Subscription already created in E2 Node. |
| 6336 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6337 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6338 | |
| 6339 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6340 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6341 | |
| 6342 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6343 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6344 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6345 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6346 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6347 | // Wait that subs is cleaned |
| 6348 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6349 | |
| 6350 | xappConn1.TestMsgChanEmpty(t) |
| 6351 | e2termConn1.TestMsgChanEmpty(t) |
| 6352 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6353 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6354 | } |
| 6355 | |
| 6356 | //----------------------------------------------------------------------------- |
| 6357 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6358 | // |
| 6359 | // stub stub |
| 6360 | // +-------+ +---------+ +---------+ |
| 6361 | // | xapp | | submgr | | e2term | |
| 6362 | // +-------+ +---------+ +---------+ |
| 6363 | // | | | |
| 6364 | // | RestSubReq | | |
| 6365 | // |---------------->| | |
| 6366 | // | | | |
| 6367 | // | RESTSubResp | | |
| 6368 | // |<----------------| | |
| 6369 | // | | | |
| 6370 | // | | SubReq | |
| 6371 | // | |------------->| |
| 6372 | // | | | |
| 6373 | // | | SubFail | No transaction for the response |
| 6374 | // | |<-------------| |
| 6375 | // | | | |
| 6376 | // | | SubReq | |
| 6377 | // | |------------->| |
| 6378 | // | | | |
| 6379 | // | | SubFail | Duplicated action |
| 6380 | // | |<-------------| |
| 6381 | // | RESTNotif (fail)| | |
| 6382 | // |<----------------| | |
| 6383 | // | | SubDelReq | |
| 6384 | // | |------------->| |
| 6385 | // | | | |
| 6386 | // | | SubDelResp | |
| 6387 | // | |<-------------| |
| 6388 | // |
| 6389 | //----------------------------------------------------------------------------- |
| 6390 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6391 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6392 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6393 | |
| 6394 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6395 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6396 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6397 | |
| 6398 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6399 | |
| 6400 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6401 | |
| 6402 | // No transaction exist for this response which will result resending original request |
| 6403 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6404 | fparams.Set(crereq) |
| 6405 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6406 | |
| 6407 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6408 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6409 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6410 | |
| 6411 | // Subscription already created in E2 Node. |
| 6412 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6413 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6414 | |
| 6415 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6416 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6417 | |
| 6418 | // Resending happens because there no transaction |
| 6419 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6420 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6421 | |
| 6422 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6423 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6424 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6425 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6426 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6427 | // Wait that subs is cleaned |
| 6428 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6429 | |
| 6430 | xappConn1.TestMsgChanEmpty(t) |
| 6431 | e2termConn1.TestMsgChanEmpty(t) |
| 6432 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6433 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6434 | } |
| 6435 | |
| 6436 | //----------------------------------------------------------------------------- |
| 6437 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6438 | // |
| 6439 | // stub stub |
| 6440 | // +-------+ +---------+ +---------+ |
| 6441 | // | xapp | | submgr | | e2term | |
| 6442 | // +-------+ +---------+ +---------+ |
| 6443 | // | | | |
| 6444 | // | [SUBS CREATE] | |
| 6445 | // | | | |
| 6446 | // | | | |
| 6447 | // | RESTSubDelReq | | |
| 6448 | // |---------------->| | |
| 6449 | // | | | |
| 6450 | // | RESTSubDelResp | | |
| 6451 | // |<----------------| | |
| 6452 | // | | | |
| 6453 | // | | SubDelReq | |
| 6454 | // | |------------->| |
| 6455 | // | | | |
| 6456 | // | | SubDelResp | ASN.1 decode fails |
| 6457 | // | |<-------------| |
| 6458 | // | | | |
| 6459 | // | | SubDelReq | |
| 6460 | // | |------------->| |
| 6461 | // | | | |
| 6462 | // | | SubDelFail | Subscription does exist any more |
| 6463 | // | |<-------------| |
| 6464 | // | | | |
| 6465 | // |
| 6466 | //----------------------------------------------------------------------------- |
| 6467 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6468 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6469 | |
| 6470 | // Req |
| 6471 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6472 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6473 | |
| 6474 | // Del |
| 6475 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6476 | |
| 6477 | // E2t: Receive 1st SubsDelReq |
| 6478 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6479 | |
| 6480 | // Decode of this response fails which will result resending original request |
| 6481 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6482 | |
| 6483 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6484 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6485 | |
| 6486 | // Subscription does not exist in in E2 Node. |
| 6487 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6488 | |
| 6489 | // Wait that subs is cleaned |
| 6490 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6491 | |
| 6492 | xappConn1.TestMsgChanEmpty(t) |
| 6493 | e2termConn1.TestMsgChanEmpty(t) |
| 6494 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6495 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6496 | } |
| 6497 | |
| 6498 | //----------------------------------------------------------------------------- |
| 6499 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6500 | // |
| 6501 | // stub stub |
| 6502 | // +-------+ +---------+ +---------+ |
| 6503 | // | xapp | | submgr | | e2term | |
| 6504 | // +-------+ +---------+ +---------+ |
| 6505 | // | | | |
| 6506 | // | [SUBS CREATE] | |
| 6507 | // | | | |
| 6508 | // | | | |
| 6509 | // | RESTSubDelReq | | |
| 6510 | // |---------------->| | |
| 6511 | // | | | |
| 6512 | // | RESTSubDelResp | | |
| 6513 | // |<----------------| | |
| 6514 | // | | | |
| 6515 | // | | SubDelReq | |
| 6516 | // | |------------->| |
| 6517 | // | | | |
| 6518 | // | | SubDelResp | Unknown instanceId |
| 6519 | // | |<-------------| |
| 6520 | // | | | |
| 6521 | // | | SubDelReq | |
| 6522 | // | |------------->| |
| 6523 | // | | | |
| 6524 | // | | SubDelFail | Subscription does exist any more |
| 6525 | // | |<-------------| |
| 6526 | // |
| 6527 | //----------------------------------------------------------------------------- |
| 6528 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6529 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6530 | |
| 6531 | // Req |
| 6532 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6533 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6534 | |
| 6535 | // Del |
| 6536 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6537 | |
| 6538 | // E2t: Receive 1st SubsDelReq |
| 6539 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6540 | |
| 6541 | // Unknown instanceId in this response which will result resending original request |
| 6542 | delreq.RequestId.InstanceId = 0 |
| 6543 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6544 | |
| 6545 | // E2t: Receive 2nd SubsDelReq |
| 6546 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6547 | |
| 6548 | // Subscription does not exist in in E2 Node. |
| 6549 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6550 | |
| 6551 | // Wait that subs is cleaned |
| 6552 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6553 | |
| 6554 | xappConn1.TestMsgChanEmpty(t) |
| 6555 | e2termConn1.TestMsgChanEmpty(t) |
| 6556 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6557 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6558 | } |
| 6559 | |
| 6560 | //----------------------------------------------------------------------------- |
| 6561 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6562 | // |
| 6563 | // stub stub |
| 6564 | // +-------+ +---------+ +---------+ |
| 6565 | // | xapp | | submgr | | e2term | |
| 6566 | // +-------+ +---------+ +---------+ |
| 6567 | // | | | |
| 6568 | // | [SUBS CREATE] | |
| 6569 | // | | | |
| 6570 | // | | | |
| 6571 | // | RESTSubDelReq | | |
| 6572 | // |---------------->| | |
| 6573 | // | | | |
| 6574 | // | RESTSubDelResp | | |
| 6575 | // |<----------------| | |
| 6576 | // | | | |
| 6577 | // | | SubDelReq | |
| 6578 | // | |------------->| |
| 6579 | // | | | |
| 6580 | // | | SubDelResp | No transaction for the response |
| 6581 | // | |<-------------| |
| 6582 | // | | | |
| 6583 | // | | SubDelReq | |
| 6584 | // | |------------->| |
| 6585 | // | | | |
| 6586 | // | | SubDelFail | Subscription does exist any more |
| 6587 | // | |<-------------| |
| 6588 | // |
| 6589 | //----------------------------------------------------------------------------- |
| 6590 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6591 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6592 | |
| 6593 | // Req |
| 6594 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6595 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6596 | |
| 6597 | // Del |
| 6598 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6599 | |
| 6600 | // E2t: Receive 1st SubsDelReq |
| 6601 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6602 | |
| 6603 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6604 | |
| 6605 | // No transaction exist for this response which will result resending original request |
| 6606 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6607 | |
| 6608 | // E2t: Receive 2nd SubsDelReq |
| 6609 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6610 | |
| 6611 | // Subscription does not exist in in E2 Node. |
| 6612 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6613 | |
| 6614 | // Wait that subs is cleaned |
| 6615 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6616 | |
| 6617 | xappConn1.TestMsgChanEmpty(t) |
| 6618 | e2termConn1.TestMsgChanEmpty(t) |
| 6619 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6620 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6621 | } |
| 6622 | |
| 6623 | //----------------------------------------------------------------------------- |
| 6624 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6625 | // |
| 6626 | // stub stub |
| 6627 | // +-------+ +---------+ +---------+ |
| 6628 | // | xapp | | submgr | | e2term | |
| 6629 | // +-------+ +---------+ +---------+ |
| 6630 | // | | | |
| 6631 | // | [SUBS CREATE] | |
| 6632 | // | | | |
| 6633 | // | | | |
| 6634 | // | RESTSubDelReq | | |
| 6635 | // |---------------->| | |
| 6636 | // | | | |
| 6637 | // | RESTSubDelResp | | |
| 6638 | // |<----------------| | |
| 6639 | // | | | |
| 6640 | // | | SubDelReq | |
| 6641 | // | |------------->| |
| 6642 | // | | | |
| 6643 | // | | SubDelFail | ASN.1 decode fails |
| 6644 | // | |<-------------| |
| 6645 | // | | | |
| 6646 | // | | SubDelReq | |
| 6647 | // | |------------->| |
| 6648 | // | | | |
| 6649 | // | | SubDelFail | Subscription does exist any more |
| 6650 | // | |<-------------| |
| 6651 | // |
| 6652 | //----------------------------------------------------------------------------- |
| 6653 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6654 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6655 | |
| 6656 | // Req |
| 6657 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6658 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6659 | |
| 6660 | // Del |
| 6661 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6662 | |
| 6663 | // E2t: Receive 1st SubsDelReq |
| 6664 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6665 | |
| 6666 | // Decode of this response fails which will result resending original request |
| 6667 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6668 | |
| 6669 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6670 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6671 | |
| 6672 | // Subscription does not exist in in E2 Node. |
| 6673 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6674 | |
| 6675 | // Wait that subs is cleaned |
| 6676 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6677 | |
| 6678 | xappConn1.TestMsgChanEmpty(t) |
| 6679 | e2termConn1.TestMsgChanEmpty(t) |
| 6680 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6681 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6682 | } |
| 6683 | |
| 6684 | //----------------------------------------------------------------------------- |
| 6685 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6686 | // |
| 6687 | // stub stub |
| 6688 | // +-------+ +---------+ +---------+ |
| 6689 | // | xapp | | submgr | | e2term | |
| 6690 | // +-------+ +---------+ +---------+ |
| 6691 | // | | | |
| 6692 | // | [SUBS CREATE] | |
| 6693 | // | | | |
| 6694 | // | | | |
| 6695 | // | RESTSubDelReq | | |
| 6696 | // |---------------->| | |
| 6697 | // | | | |
| 6698 | // | RESTSubDelResp | | |
| 6699 | // |<----------------| | |
| 6700 | // | | | |
| 6701 | // | | SubDelReq | |
| 6702 | // | |------------->| |
| 6703 | // | | | |
| 6704 | // | | SubDelFail | Unknown instanceId |
| 6705 | // | |<-------------| |
| 6706 | // | | | |
| 6707 | // | | SubDelReq | |
| 6708 | // | |------------->| |
| 6709 | // | | | |
| 6710 | // | | SubDelFail | Subscription does exist any more |
| 6711 | // | |<-------------| |
| 6712 | // |
| 6713 | //----------------------------------------------------------------------------- |
| 6714 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6715 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6716 | |
| 6717 | // Req |
| 6718 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6719 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6720 | |
| 6721 | // Del |
| 6722 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6723 | |
| 6724 | // E2t: Receive 1st SubsDelReq |
| 6725 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6726 | |
| 6727 | // Unknown instanceId in this response which will result resending original request |
| 6728 | delreq.RequestId.InstanceId = 0 |
| 6729 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6730 | |
| 6731 | // E2t: Receive 2nd SubsDelReq |
| 6732 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6733 | |
| 6734 | // Subscription does not exist in in E2 Node. |
| 6735 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6736 | |
| 6737 | // Wait that subs is cleaned |
| 6738 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6739 | |
| 6740 | xappConn1.TestMsgChanEmpty(t) |
| 6741 | e2termConn1.TestMsgChanEmpty(t) |
| 6742 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6743 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6744 | } |
| 6745 | |
| 6746 | //----------------------------------------------------------------------------- |
| 6747 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6748 | // |
| 6749 | // stub stub |
| 6750 | // +-------+ +---------+ +---------+ |
| 6751 | // | xapp | | submgr | | e2term | |
| 6752 | // +-------+ +---------+ +---------+ |
| 6753 | // | | | |
| 6754 | // | [SUBS CREATE] | |
| 6755 | // | | | |
| 6756 | // | | | |
| 6757 | // | RESTSubDelReq | | |
| 6758 | // |---------------->| | |
| 6759 | // | | | |
| 6760 | // | RESTSubDelResp | | |
| 6761 | // |<----------------| | |
| 6762 | // | | | |
| 6763 | // | | SubDelReq | |
| 6764 | // | |------------->| |
| 6765 | // | | | |
| 6766 | // | | SubDelFail | No transaction for the response |
| 6767 | // | |<-------------| |
| 6768 | // | | | |
| 6769 | // | | SubDelReq | |
| 6770 | // | |------------->| |
| 6771 | // | | | |
| 6772 | // | | SubDelFail | Subscription does exist any more |
| 6773 | // | |<-------------| |
| 6774 | // |
| 6775 | //----------------------------------------------------------------------------- |
| 6776 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6777 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6778 | |
| 6779 | // Req |
| 6780 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6781 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6782 | |
| 6783 | // Del |
| 6784 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6785 | |
| 6786 | // E2t: Receive 1st SubsDelReq |
| 6787 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6788 | |
| 6789 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6790 | |
| 6791 | // No transaction exist for this response which will result resending original request |
| 6792 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6793 | |
| 6794 | // E2t: Receive 2nd SubsDelReq |
| 6795 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6796 | |
| 6797 | // Subscription does not exist in in E2 Node. |
| 6798 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6799 | |
| 6800 | // Wait that subs is cleaned |
| 6801 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6802 | |
| 6803 | xappConn1.TestMsgChanEmpty(t) |
| 6804 | e2termConn1.TestMsgChanEmpty(t) |
| 6805 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6806 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6807 | } |
| 6808 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6809 | //----------------------------------------------------------------------------- |
| 6810 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6811 | // |
| 6812 | // stub stub |
| 6813 | // +-------+ +---------+ +---------+ |
| 6814 | // | xapp | | submgr | | e2term | |
| 6815 | // +-------+ +---------+ +---------+ |
| 6816 | // | | | |
| 6817 | // | RESTSubReq | | |
| 6818 | // |---------------->| | |
| 6819 | // | | | |
| 6820 | // | RESTSubResp | | |
| 6821 | // |<----------------| | |
| 6822 | // | | | |
| 6823 | // | ASN.1 encode fails | |
| 6824 | // | | | |
| 6825 | // | | SubDelReq | |
| 6826 | // | |------------->| |
| 6827 | // | | | |
| 6828 | // | | SubDelFail | |
| 6829 | // | |<-------------| |
| 6830 | // | | | |
| 6831 | // | RESTNotif | | |
| 6832 | // | unsuccess | | |
| 6833 | // |<----------------| | |
| 6834 | // | | | |
| 6835 | // | [SUBS DELETE] | |
| 6836 | // | | | |
| 6837 | // |
| 6838 | //----------------------------------------------------------------------------- |
| 6839 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6840 | |
| 6841 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6842 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6843 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6844 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6845 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6846 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6847 | }) |
| 6848 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6849 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6850 | |
| 6851 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6852 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6853 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6854 | |
| 6855 | // Req |
| 6856 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6857 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6858 | |
| 6859 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6860 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6861 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6862 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6863 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6864 | |
| 6865 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6866 | |
| 6867 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6868 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6869 | // Wait that subs is cleaned |
| 6870 | waitSubsCleanup(t, e2SubsId, 10) |
| 6871 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6872 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6873 | } |
| 6874 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6875 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6876 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6877 | |
| 6878 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6879 | Counter{cRestSubReqFromXapp, 2}, |
| 6880 | Counter{cRestSubRespToXapp, 2}, |
| 6881 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6882 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6883 | Counter{cSubRespFromE2, 1}, |
| 6884 | Counter{cRestSubNotifToXapp, 1}, |
| 6885 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6886 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6887 | Counter{cSubDelReqToE2, 1}, |
| 6888 | Counter{cSubDelRespFromE2, 1}, |
| 6889 | Counter{cRestSubDelRespToXapp, 1}, |
| 6890 | }) |
| 6891 | |
| 6892 | const e2Timeout int64 = 1 |
| 6893 | const e2RetryCount int64 = 0 |
| 6894 | const routingNeeded bool = false |
| 6895 | |
| 6896 | // Req1 |
| 6897 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6898 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6899 | |
| 6900 | // Subs Create |
| 6901 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6902 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6903 | |
| 6904 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6905 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6906 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6907 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6908 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6909 | |
| 6910 | // Policy change |
| 6911 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6912 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6913 | params.SetSubscriptionID(&restSubId) |
| 6914 | params.SetTimeToWait("w200ms") |
| 6915 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6916 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6917 | |
| 6918 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6919 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6920 | // SubsResp is missing, e2SubsId will be 0 |
| 6921 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6922 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6923 | |
| 6924 | // Del |
| 6925 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6926 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6927 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6928 | |
| 6929 | waitSubsCleanup(t, e2SubsId, 10) |
| 6930 | |
| 6931 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6932 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6933 | } |
| 6934 | |
| 6935 | //----------------------------------------------------------------------------- |
| 6936 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6937 | // |
| 6938 | // stub stub |
| 6939 | // +-------+ +---------+ +---------+ |
| 6940 | // | xapp | | submgr | | e2term | |
| 6941 | // +-------+ +---------+ +---------+ |
| 6942 | // | | | |
| 6943 | // | RESTSubReq | | |
| 6944 | // |---------------->| | |
| 6945 | // | | | |
| 6946 | // | RESTSubResp | | |
| 6947 | // |<----------------| | |
| 6948 | // | | SubReq | |
| 6949 | // | |------------->| |
| 6950 | // | | | |
| 6951 | // | | SubResp | |
| 6952 | // | |<-------------| |
| 6953 | // | | | |
| 6954 | // | RESTNotif | | |
| 6955 | // |<----------------| | |
| 6956 | // | | | |
| 6957 | // | RESTSubReq | | |
| 6958 | // |---------------->| | |
| 6959 | // | | | |
| 6960 | // | RESTSubResp | | |
| 6961 | // |<----------------| | |
| 6962 | // | | SubReq | |
| 6963 | // | |------------->| |
| 6964 | // | | |
| 6965 | // | Submgr restart | |
| 6966 | // | | | |
| 6967 | // | RESTSubDelReq | | |
| 6968 | // |---------------->| | |
| 6969 | // | | | |
| 6970 | // | | SubDelReq | |
| 6971 | // | |------------->| |
| 6972 | // | | | |
| 6973 | // | | SubDelResp | |
| 6974 | // | |<-------------| |
| 6975 | // | | | |
| 6976 | // | RESTSubDelResp | | |
| 6977 | // |<----------------| | |
| 6978 | // |
| 6979 | //----------------------------------------------------------------------------- |
| 6980 | |
| 6981 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6982 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6983 | |
| 6984 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6985 | Counter{cRestSubReqFromXapp, 2}, |
| 6986 | Counter{cRestSubRespToXapp, 2}, |
| 6987 | Counter{cSubReqToE2, 2}, |
| 6988 | Counter{cSubRespFromE2, 1}, |
| 6989 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6990 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6991 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6992 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6993 | Counter{cRestSubDelRespToXapp, 1}, |
| 6994 | }) |
| 6995 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6996 | const e2Timeout int64 = 1 |
| 6997 | const e2RetryCount int64 = 0 |
| 6998 | const routingNeeded bool = false |
| 6999 | |
| 7000 | // Req1 |
| 7001 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7002 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7003 | // Create subscription |
| 7004 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7005 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7006 | |
| 7007 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7008 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7009 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7010 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7011 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 7012 | |
| 7013 | // Check subscription |
| 7014 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7015 | |
| 7016 | // Policy change |
| 7017 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7018 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7019 | params.SetSubscriptionID(&restSubId) |
| 7020 | params.SetTimeToWait("w200ms") |
| 7021 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 7022 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 7023 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7024 | |
| 7025 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 7026 | mainCtrl.SetResetTestFlag(t, false) |
| 7027 | |
| 7028 | // SubsResp is missing due to submgr restart |
| 7029 | |
| 7030 | mainCtrl.SimulateRestart(t) |
| 7031 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 7032 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7033 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 7034 | // That needs to be completed before successful subscription query is possible |
| 7035 | <-time.After(time.Second * 1) |
| 7036 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7037 | // Check subscription |
| 7038 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7039 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7040 | // Delete subscription |
| 7041 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7042 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7043 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7044 | |
| 7045 | //Wait that subs is cleaned |
| 7046 | waitSubsCleanup(t, e2SubsId, 10) |
| 7047 | |
| 7048 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7049 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7050 | } |
| 7051 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7052 | //////////////////////////////////////////////////////////////////////////////////// |
| 7053 | // Services for UT cases |
| 7054 | //////////////////////////////////////////////////////////////////////////////////// |
| 7055 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7056 | const host string = "localhost" |
| 7057 | |
| 7058 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 7059 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7060 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7061 | } |
| 7062 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7063 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7064 | |
| 7065 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 7066 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7067 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 7068 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7069 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7070 | |
| 7071 | return restSubId, e2SubsId |
| 7072 | } |
| 7073 | |
| 7074 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 7075 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7076 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7077 | if meid != "" { |
| 7078 | params.SetMeid(meid) |
| 7079 | } |
| 7080 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 7081 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 7082 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7083 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7084 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7085 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7086 | |
| 7087 | return restSubId, e2SubsId |
| 7088 | } |
| 7089 | |
| 7090 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7091 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7092 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7093 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7094 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7095 | |
| 7096 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7097 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7098 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7099 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7100 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7101 | |
| 7102 | return restSubId, e2SubsId |
| 7103 | } |
| 7104 | |
| 7105 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7106 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7107 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7108 | |
| 7109 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7110 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7111 | fparams1.Set(crereq1) |
| 7112 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7113 | |
| 7114 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7115 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7116 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7117 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7118 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7119 | |
| 7120 | return restSubId, e2SubsId |
| 7121 | } |
| 7122 | |
| 7123 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7124 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7125 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7126 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7127 | } |
| 7128 | |
| 7129 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7130 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7131 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7132 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7133 | } |
| 7134 | |
| 7135 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7136 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7138 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7139 | } |
| 7140 | |
| 7141 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7142 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7143 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 7144 | assert.Equal(t, meid, resp[0].Meid) |
| 7145 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7146 | } |
| 7147 | |
| 7148 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7149 | //Wait that subs is cleaned |
| 7150 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7151 | |
| 7152 | xappConn1.TestMsgChanEmpty(t) |
| 7153 | xappConn2.TestMsgChanEmpty(t) |
| 7154 | e2termConn1.TestMsgChanEmpty(t) |
| 7155 | mainCtrl.wait_registry_empty(t, timeout) |
| 7156 | } |
| 7157 | |
| 7158 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7159 | |
| 7160 | var e2SubsId []uint32 |
| 7161 | |
| 7162 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7163 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7164 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7165 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7166 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7167 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7168 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7169 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7170 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7171 | <-time.After(100 * time.Millisecond) |
| 7172 | } |
| 7173 | return e2SubsId |
| 7174 | } |
| 7175 | |
| 7176 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7177 | |
| 7178 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7179 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7180 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7181 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7182 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7183 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7184 | <-time.After(100 * time.Millisecond) |
| 7185 | } |
| 7186 | |
| 7187 | // Wait that subs is cleaned |
| 7188 | for i := 0; i < len(e2SubsIds); i++ { |
| 7189 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7190 | } |
| 7191 | |
| 7192 | } |