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) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 678 | mainCtrl.VerifyCounterValues(t) |
| 679 | } |
| 680 | |
| 681 | //----------------------------------------------------------------------------- |
| 682 | // TestSubMergeDelAndRouteUpdateNok |
| 683 | // stub stub |
| 684 | // +-------+ +-------+ +---------+ +---------+ |
| 685 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 686 | // +-------+ +-------+ +---------+ +---------+ |
| 687 | // | | | | |
| 688 | // | | | | |
| 689 | // | | | | |
| 690 | // | | SubReq1 | | |
| 691 | // | |------------->| | |
| 692 | // | | | | |
| 693 | // | | | SubReq1 | |
| 694 | // | | |------------->| |
| 695 | // | | | SubResp1 | |
| 696 | // | | |<-------------| |
| 697 | // | | SubResp1 | | |
| 698 | // | |<-------------| | |
| 699 | // | | | | |
| 700 | // | SubReq2 | | |
| 701 | // |--------------------------->| | |
| 702 | // | | | | |
| 703 | // | SubResp2 | | |
| 704 | // |<---------------------------| | |
| 705 | // | | | | |
| 706 | // | | SubDelReq 1 | | |
| 707 | // | |------------->| | |
| 708 | // | | | RouteUpdate | |
| 709 | // | | |-----> rtmgr | |
| 710 | // | | | | |
| 711 | // | | | RouteUpdate | |
| 712 | // | | | status:400 | |
| 713 | // | | |<----- rtmgr | |
| 714 | // | | | | |
| 715 | // | | SubDelResp 1 | | |
| 716 | // | |<-------------| | |
| 717 | // | | | | |
| 718 | // | SubDelReq 2 | | |
| 719 | // |--------------------------->| | |
| 720 | // | | | | |
| 721 | // | | | SubDelReq 2 | |
| 722 | // | | |------------->| |
| 723 | // | | | | |
| 724 | // | | | SubDelReq 2 | |
| 725 | // | | |------------->| |
| 726 | // | | | | |
| 727 | // | SubDelResp 2 | | |
| 728 | // |<---------------------------| | |
| 729 | // |
| 730 | //----------------------------------------------------------------------------- |
| 731 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 732 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 733 | |
| 734 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 735 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 736 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 737 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 738 | Counter{cSubReqToE2, 1}, |
| 739 | Counter{cSubRespFromE2, 1}, |
| 740 | Counter{cSubRespToXapp, 2}, |
| 741 | Counter{cSubDelReqFromXapp, 2}, |
| 742 | Counter{cRouteDeleteUpdateFail, 1}, |
| 743 | Counter{cSubDelReqToE2, 1}, |
| 744 | Counter{cSubDelRespFromE2, 1}, |
| 745 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 746 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 747 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 748 | |
| 749 | //Req1 |
| 750 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 751 | rparams1.Init() |
| 752 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 753 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 754 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 755 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 756 | |
| 757 | //Req2 |
| 758 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 759 | rparams2.Init() |
| 760 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 761 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 762 | |
| 763 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 764 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 765 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 766 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 767 | |
| 768 | //Del1 |
| 769 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 770 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 771 | waiter.WaitResult(t) |
| 772 | |
| 773 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 774 | |
| 775 | //Del2 |
| 776 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 777 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 778 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 779 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 780 | //Wait that subs is cleaned |
| 781 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 782 | |
| 783 | xappConn1.TestMsgChanEmpty(t) |
| 784 | xappConn2.TestMsgChanEmpty(t) |
| 785 | e2termConn1.TestMsgChanEmpty(t) |
| 786 | mainCtrl.wait_registry_empty(t, 10) |
| 787 | |
| 788 | mainCtrl.VerifyCounterValues(t) |
| 789 | } |
| 790 | |
| 791 | //----------------------------------------------------------------------------- |
| 792 | |
| 793 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 794 | // TestSubReqAndSubDelOk |
| 795 | // |
| 796 | // stub stub |
| 797 | // +-------+ +---------+ +---------+ |
| 798 | // | xapp | | submgr | | e2term | |
| 799 | // +-------+ +---------+ +---------+ |
| 800 | // | | | |
| 801 | // | SubReq | | |
| 802 | // |------------->| | |
| 803 | // | | | |
| 804 | // | | SubReq | |
| 805 | // | |------------->| |
| 806 | // | | | |
| 807 | // | | SubResp | |
| 808 | // | |<-------------| |
| 809 | // | | | |
| 810 | // | SubResp | | |
| 811 | // |<-------------| | |
| 812 | // | | | |
| 813 | // | | | |
| 814 | // | SubDelReq | | |
| 815 | // |------------->| | |
| 816 | // | | | |
| 817 | // | | SubDelReq | |
| 818 | // | |------------->| |
| 819 | // | | | |
| 820 | // | | SubDelResp | |
| 821 | // | |<-------------| |
| 822 | // | | | |
| 823 | // | SubDelResp | | |
| 824 | // |<-------------| | |
| 825 | // |
| 826 | //----------------------------------------------------------------------------- |
| 827 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 828 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 829 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 830 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 831 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 832 | Counter{cSubReqFromXapp, 1}, |
| 833 | Counter{cSubReqToE2, 1}, |
| 834 | Counter{cSubRespFromE2, 1}, |
| 835 | Counter{cSubRespToXapp, 1}, |
| 836 | Counter{cSubDelReqFromXapp, 1}, |
| 837 | Counter{cSubDelReqToE2, 1}, |
| 838 | Counter{cSubDelRespFromE2, 1}, |
| 839 | Counter{cSubDelRespToXapp, 1}, |
| 840 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 841 | |
| 842 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 843 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 844 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 845 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 846 | |
| 847 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 848 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 849 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 850 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 851 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 852 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 853 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 854 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 855 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 856 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 857 | |
| 858 | //Wait that subs is cleaned |
| 859 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 860 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 861 | xappConn1.TestMsgChanEmpty(t) |
| 862 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 863 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 864 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 865 | |
| 866 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | //----------------------------------------------------------------------------- |
| 870 | // TestSubReqRetransmission |
| 871 | // |
| 872 | // stub stub |
| 873 | // +-------+ +---------+ +---------+ |
| 874 | // | xapp | | submgr | | e2term | |
| 875 | // +-------+ +---------+ +---------+ |
| 876 | // | | | |
| 877 | // | SubReq | | |
| 878 | // |------------->| | |
| 879 | // | | | |
| 880 | // | | SubReq | |
| 881 | // | |------------->| |
| 882 | // | | | |
| 883 | // | SubReq | | |
| 884 | // | (retrans) | | |
| 885 | // |------------->| | |
| 886 | // | | | |
| 887 | // | | SubResp | |
| 888 | // | |<-------------| |
| 889 | // | | | |
| 890 | // | SubResp | | |
| 891 | // |<-------------| | |
| 892 | // | | | |
| 893 | // | [SUBS DELETE] | |
| 894 | // | | | |
| 895 | // |
| 896 | //----------------------------------------------------------------------------- |
| 897 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 898 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 899 | |
| 900 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 901 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 902 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 903 | |
| 904 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 905 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 906 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 907 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 908 | // hack as there is no real way to see has message be handled. |
| 909 | // Previuos counter check just tells that is has been received by submgr |
| 910 | // --> artificial delay |
| 911 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 912 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 913 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 914 | |
| 915 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 916 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 917 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 918 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | |
| 921 | //Wait that subs is cleaned |
| 922 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 923 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 924 | xappConn1.TestMsgChanEmpty(t) |
| 925 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 926 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 927 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 928 | } |
| 929 | |
| 930 | //----------------------------------------------------------------------------- |
| 931 | // TestSubDelReqRetransmission |
| 932 | // |
| 933 | // stub stub |
| 934 | // +-------+ +---------+ +---------+ |
| 935 | // | xapp | | submgr | | e2term | |
| 936 | // +-------+ +---------+ +---------+ |
| 937 | // | | | |
| 938 | // | [SUBS CREATE] | |
| 939 | // | | | |
| 940 | // | | | |
| 941 | // | SubDelReq | | |
| 942 | // |------------->| | |
| 943 | // | | | |
| 944 | // | | SubDelReq | |
| 945 | // | |------------->| |
| 946 | // | | | |
| 947 | // | SubDelReq | | |
| 948 | // | (same sub) | | |
| 949 | // | (same xid) | | |
| 950 | // |------------->| | |
| 951 | // | | | |
| 952 | // | | SubDelResp | |
| 953 | // | |<-------------| |
| 954 | // | | | |
| 955 | // | SubDelResp | | |
| 956 | // |<-------------| | |
| 957 | // |
| 958 | //----------------------------------------------------------------------------- |
| 959 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 960 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 961 | |
| 962 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 963 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 964 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 965 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 966 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 967 | |
| 968 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 969 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 970 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 971 | |
| 972 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 973 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 974 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 975 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 976 | // hack as there is no real way to see has message be handled. |
| 977 | // Previuos counter check just tells that is has been received by submgr |
| 978 | // --> artificial delay |
| 979 | <-time.After(1 * time.Second) |
| 980 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 981 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 982 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 983 | |
| 984 | //Wait that subs is cleaned |
| 985 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 986 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 987 | xappConn1.TestMsgChanEmpty(t) |
| 988 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 989 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 990 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 991 | } |
| 992 | |
| 993 | //----------------------------------------------------------------------------- |
| 994 | // TestSubDelReqCollision |
| 995 | // |
| 996 | // stub stub |
| 997 | // +-------+ +---------+ +---------+ |
| 998 | // | xapp | | submgr | | e2term | |
| 999 | // +-------+ +---------+ +---------+ |
| 1000 | // | | | |
| 1001 | // | [SUBS CREATE] | |
| 1002 | // | | | |
| 1003 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1004 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1005 | // |------------->| | |
| 1006 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1007 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1008 | // | |------------->| |
| 1009 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1010 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1011 | // | (same sub) | | |
| 1012 | // | (diff xid) | | |
| 1013 | // |------------->| | |
| 1014 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1015 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1016 | // | |<-------------| |
| 1017 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1018 | // | SubDelResp 1 | | |
| 1019 | // |<-------------| | |
| 1020 | // | | | |
| 1021 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1022 | // |<-------------| | |
| 1023 | // |
| 1024 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1025 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1026 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1027 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | |
| 1029 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1030 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1031 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1032 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1033 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1034 | |
| 1035 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1036 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1037 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1038 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1039 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1040 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1041 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1042 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1043 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1044 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1045 | // hack as there is no real way to see has message be handled. |
| 1046 | // Previuos counter check just tells that is has been received by submgr |
| 1047 | // --> artificial delay |
| 1048 | <-time.After(1 * time.Second) |
| 1049 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1050 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1051 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1052 | |
| 1053 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1054 | xappConn1.RecvSubsDelResp(t, nil) |
| 1055 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1056 | |
| 1057 | //Wait that subs is cleaned |
| 1058 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1059 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1060 | xappConn1.TestMsgChanEmpty(t) |
| 1061 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1062 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1063 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | //----------------------------------------------------------------------------- |
| 1067 | // TestSubReqAndSubDelOkTwoParallel |
| 1068 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1069 | // stub stub stub |
| 1070 | // +-------+ +-------+ +---------+ +---------+ |
| 1071 | // | xapp | | xapp | | submgr | | e2term | |
| 1072 | // +-------+ +-------+ +---------+ +---------+ |
| 1073 | // | | | | |
| 1074 | // | | | | |
| 1075 | // | | | | |
| 1076 | // | | SubReq1 | | |
| 1077 | // | |------------->| | |
| 1078 | // | | | | |
| 1079 | // | | | SubReq1 | |
| 1080 | // | | |------------->| |
| 1081 | // | | | | |
| 1082 | // | SubReq2 | | |
| 1083 | // |------------------------>| | |
| 1084 | // | | | | |
| 1085 | // | | | SubReq2 | |
| 1086 | // | | |------------->| |
| 1087 | // | | | | |
| 1088 | // | | | SubResp1 | |
| 1089 | // | | |<-------------| |
| 1090 | // | | SubResp1 | | |
| 1091 | // | |<-------------| | |
| 1092 | // | | | | |
| 1093 | // | | | SubResp2 | |
| 1094 | // | | |<-------------| |
| 1095 | // | SubResp2 | | |
| 1096 | // |<------------------------| | |
| 1097 | // | | | | |
| 1098 | // | | [SUBS 1 DELETE] | |
| 1099 | // | | | | |
| 1100 | // | | [SUBS 2 DELETE] | |
| 1101 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1102 | // |
| 1103 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1104 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1105 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1106 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1107 | |
| 1108 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1109 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1110 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1111 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1112 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1113 | |
| 1114 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1115 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1116 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1117 | |
| 1118 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1119 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1120 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1121 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1122 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1123 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1124 | |
| 1125 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1126 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1127 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1128 | |
| 1129 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1130 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1131 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1132 | |
| 1133 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1134 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1135 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1136 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1137 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1138 | //Wait that subs is cleaned |
| 1139 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1140 | |
| 1141 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1142 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1143 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1144 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1145 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | //Wait that subs is cleaned |
| 1147 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1148 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | xappConn1.TestMsgChanEmpty(t) |
| 1150 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1151 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1152 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1153 | } |
| 1154 | |
| 1155 | //----------------------------------------------------------------------------- |
| 1156 | // TestSameSubsDiffRan |
| 1157 | // Same subscription to different RANs |
| 1158 | // |
| 1159 | // stub stub |
| 1160 | // +-------+ +---------+ +---------+ |
| 1161 | // | xapp | | submgr | | e2term | |
| 1162 | // +-------+ +---------+ +---------+ |
| 1163 | // | | | |
| 1164 | // | | | |
| 1165 | // | | | |
| 1166 | // | SubReq(r1) | | |
| 1167 | // |------------->| | |
| 1168 | // | | | |
| 1169 | // | | SubReq(r1) | |
| 1170 | // | |------------->| |
| 1171 | // | | | |
| 1172 | // | | SubResp(r1) | |
| 1173 | // | |<-------------| |
| 1174 | // | | | |
| 1175 | // | SubResp(r1) | | |
| 1176 | // |<-------------| | |
| 1177 | // | | | |
| 1178 | // | SubReq(r2) | | |
| 1179 | // |------------->| | |
| 1180 | // | | | |
| 1181 | // | | SubReq(r2) | |
| 1182 | // | |------------->| |
| 1183 | // | | | |
| 1184 | // | | SubResp(r2) | |
| 1185 | // | |<-------------| |
| 1186 | // | | | |
| 1187 | // | SubResp(r2) | | |
| 1188 | // |<-------------| | |
| 1189 | // | | | |
| 1190 | // | [SUBS r1 DELETE] | |
| 1191 | // | | | |
| 1192 | // | [SUBS r2 DELETE] | |
| 1193 | // | | | |
| 1194 | // |
| 1195 | //----------------------------------------------------------------------------- |
| 1196 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1197 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1198 | |
| 1199 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1200 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1201 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1202 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1203 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1204 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1205 | |
| 1206 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1207 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1208 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1209 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1210 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1211 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1212 | |
| 1213 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1214 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1215 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1216 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1217 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1218 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1219 | //Wait that subs is cleaned |
| 1220 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1221 | |
| 1222 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1223 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1224 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1225 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1226 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1227 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1228 | //Wait that subs is cleaned |
| 1229 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1230 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1231 | xappConn1.TestMsgChanEmpty(t) |
| 1232 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1233 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1234 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1235 | } |
| 1236 | |
| 1237 | //----------------------------------------------------------------------------- |
| 1238 | // TestSubReqRetryInSubmgr |
| 1239 | // |
| 1240 | // stub stub |
| 1241 | // +-------+ +---------+ +---------+ |
| 1242 | // | xapp | | submgr | | e2term | |
| 1243 | // +-------+ +---------+ +---------+ |
| 1244 | // | | | |
| 1245 | // | SubReq | | |
| 1246 | // |------------->| | |
| 1247 | // | | | |
| 1248 | // | | SubReq | |
| 1249 | // | |------------->| |
| 1250 | // | | | |
| 1251 | // | | | |
| 1252 | // | | SubReq | |
| 1253 | // | |------------->| |
| 1254 | // | | | |
| 1255 | // | | SubResp | |
| 1256 | // | |<-------------| |
| 1257 | // | | | |
| 1258 | // | SubResp | | |
| 1259 | // |<-------------| | |
| 1260 | // | | | |
| 1261 | // | [SUBS DELETE] | |
| 1262 | // | | | |
| 1263 | // |
| 1264 | //----------------------------------------------------------------------------- |
| 1265 | |
| 1266 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1267 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1268 | |
| 1269 | // Init counter check |
| 1270 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1271 | Counter{cSubReqFromXapp, 1}, |
| 1272 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1273 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1274 | Counter{cSubReReqToE2, 1}, |
| 1275 | Counter{cSubRespFromE2, 1}, |
| 1276 | Counter{cSubRespToXapp, 1}, |
| 1277 | Counter{cSubDelReqFromXapp, 1}, |
| 1278 | Counter{cSubDelReqToE2, 1}, |
| 1279 | Counter{cSubDelRespFromE2, 1}, |
| 1280 | Counter{cSubDelRespToXapp, 1}, |
| 1281 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1282 | |
| 1283 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1284 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1285 | |
| 1286 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1287 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1288 | |
| 1289 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1290 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1291 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1292 | |
| 1293 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1294 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1295 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1296 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1297 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1298 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1299 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1300 | |
| 1301 | // Wait that subs is cleaned |
| 1302 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1303 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1304 | xappConn1.TestMsgChanEmpty(t) |
| 1305 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1306 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1307 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1308 | |
| 1309 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1310 | } |
| 1311 | |
| 1312 | //----------------------------------------------------------------------------- |
| 1313 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1314 | // |
| 1315 | // stub stub |
| 1316 | // +-------+ +---------+ +---------+ |
| 1317 | // | xapp | | submgr | | e2term | |
| 1318 | // +-------+ +---------+ +---------+ |
| 1319 | // | | | |
| 1320 | // | SubReq | | |
| 1321 | // |------------->| | |
| 1322 | // | | | |
| 1323 | // | | SubReq | |
| 1324 | // | |------------->| |
| 1325 | // | | | |
| 1326 | // | | | |
| 1327 | // | | SubReq | |
| 1328 | // | |------------->| |
| 1329 | // | | | |
| 1330 | // | | SubDelReq | |
| 1331 | // | |------------->| |
| 1332 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1333 | // | | SubDelResp | |
| 1334 | // | |<-------------| |
| 1335 | // | | | |
| 1336 | // |
| 1337 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1338 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1339 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1340 | |
| 1341 | // Init counter check |
| 1342 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1343 | Counter{cSubReqFromXapp, 1}, |
| 1344 | Counter{cSubReqToE2, 1}, |
| 1345 | Counter{cSubReReqToE2, 1}, |
| 1346 | Counter{cSubReqTimerExpiry, 2}, |
| 1347 | Counter{cSubDelReqToE2, 1}, |
| 1348 | Counter{cSubDelRespFromE2, 1}, |
| 1349 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1350 | |
| 1351 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1352 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1353 | |
| 1354 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1355 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1356 | |
| 1357 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1358 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1359 | |
| 1360 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1361 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1362 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1363 | |
| 1364 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1365 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1366 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1367 | xappConn1.TestMsgChanEmpty(t) |
| 1368 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1369 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1370 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1371 | |
| 1372 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | //----------------------------------------------------------------------------- |
| 1376 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1377 | // |
| 1378 | // stub stub |
| 1379 | // +-------+ +---------+ +---------+ |
| 1380 | // | xapp | | submgr | | e2term | |
| 1381 | // +-------+ +---------+ +---------+ |
| 1382 | // | | | |
| 1383 | // | SubReq | | |
| 1384 | // |------------->| | |
| 1385 | // | | | |
| 1386 | // | | SubReq | |
| 1387 | // | |------------->| |
| 1388 | // | | | |
| 1389 | // | | | |
| 1390 | // | | SubReq | |
| 1391 | // | |------------->| |
| 1392 | // | | | |
| 1393 | // | | SubDelReq | |
| 1394 | // | |------------->| |
| 1395 | // | | | |
| 1396 | // | | | |
| 1397 | // | | SubDelReq | |
| 1398 | // | |------------->| |
| 1399 | // | | | |
| 1400 | // | | | |
| 1401 | // |
| 1402 | //----------------------------------------------------------------------------- |
| 1403 | |
| 1404 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1405 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1406 | |
| 1407 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1408 | Counter{cSubReqFromXapp, 1}, |
| 1409 | Counter{cSubReqToE2, 1}, |
| 1410 | Counter{cSubReReqToE2, 1}, |
| 1411 | Counter{cSubReqTimerExpiry, 2}, |
| 1412 | Counter{cSubDelReqToE2, 1}, |
| 1413 | Counter{cSubDelReReqToE2, 1}, |
| 1414 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1415 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1416 | |
| 1417 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1418 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1419 | |
| 1420 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1421 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1422 | |
| 1423 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1424 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1425 | |
| 1426 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1427 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1428 | |
| 1429 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1430 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1431 | |
| 1432 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1433 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1434 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1435 | xappConn1.TestMsgChanEmpty(t) |
| 1436 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1437 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1438 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1439 | |
| 1440 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1441 | } |
| 1442 | |
| 1443 | //----------------------------------------------------------------------------- |
| 1444 | // TestSubReqSubFailRespInSubmgr |
| 1445 | // |
| 1446 | // stub stub |
| 1447 | // +-------+ +---------+ +---------+ |
| 1448 | // | xapp | | submgr | | e2term | |
| 1449 | // +-------+ +---------+ +---------+ |
| 1450 | // | | | |
| 1451 | // | SubReq | | |
| 1452 | // |------------->| | |
| 1453 | // | | | |
| 1454 | // | | SubReq | |
| 1455 | // | |------------->| |
| 1456 | // | | | |
| 1457 | // | | SubFail | |
| 1458 | // | |<-------------| |
| 1459 | // | | | |
| 1460 | // | SubFail | | |
| 1461 | // |<-------------| | |
| 1462 | // | | | |
| 1463 | // |
| 1464 | //----------------------------------------------------------------------------- |
| 1465 | |
| 1466 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1467 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1468 | |
| 1469 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1470 | Counter{cSubReqFromXapp, 1}, |
| 1471 | Counter{cSubReqToE2, 1}, |
| 1472 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1473 | Counter{cSubFailToXapp, 1}, |
| 1474 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1475 | |
| 1476 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1477 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1478 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1479 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1480 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1481 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1482 | fparams1.Set(crereq1) |
| 1483 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1484 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1485 | // Xapp: Receive SubsFail |
| 1486 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1487 | |
| 1488 | // Wait that subs is cleaned |
| 1489 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1490 | |
| 1491 | xappConn1.TestMsgChanEmpty(t) |
| 1492 | xappConn2.TestMsgChanEmpty(t) |
| 1493 | e2termConn1.TestMsgChanEmpty(t) |
| 1494 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1495 | |
| 1496 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1497 | } |
| 1498 | |
| 1499 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1500 | // TestSubDelReqRetryInSubmgr |
| 1501 | // |
| 1502 | // stub stub |
| 1503 | // +-------+ +---------+ +---------+ |
| 1504 | // | xapp | | submgr | | e2term | |
| 1505 | // +-------+ +---------+ +---------+ |
| 1506 | // | | | |
| 1507 | // | [SUBS CREATE] | |
| 1508 | // | | | |
| 1509 | // | | | |
| 1510 | // | SubDelReq | | |
| 1511 | // |------------->| | |
| 1512 | // | | | |
| 1513 | // | | SubDelReq | |
| 1514 | // | |------------->| |
| 1515 | // | | | |
| 1516 | // | | SubDelReq | |
| 1517 | // | |------------->| |
| 1518 | // | | | |
| 1519 | // | | SubDelResp | |
| 1520 | // | |<-------------| |
| 1521 | // | | | |
| 1522 | // | SubDelResp | | |
| 1523 | // |<-------------| | |
| 1524 | // |
| 1525 | //----------------------------------------------------------------------------- |
| 1526 | |
| 1527 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1528 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1529 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1530 | |
| 1531 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1532 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1533 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1534 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1535 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1536 | |
| 1537 | // Subs Delete |
| 1538 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1539 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1540 | |
| 1541 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1542 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1543 | |
| 1544 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1545 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1546 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1547 | |
| 1548 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1549 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1550 | |
| 1551 | // Wait that subs is cleaned |
| 1552 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1553 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1554 | xappConn1.TestMsgChanEmpty(t) |
| 1555 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1556 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1557 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1558 | } |
| 1559 | |
| 1560 | //----------------------------------------------------------------------------- |
| 1561 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1562 | // |
| 1563 | // stub stub |
| 1564 | // +-------+ +---------+ +---------+ |
| 1565 | // | xapp | | submgr | | e2term | |
| 1566 | // +-------+ +---------+ +---------+ |
| 1567 | // | | | |
| 1568 | // | [SUBS CREATE] | |
| 1569 | // | | | |
| 1570 | // | | | |
| 1571 | // | SubDelReq | | |
| 1572 | // |------------->| | |
| 1573 | // | | | |
| 1574 | // | | SubDelReq | |
| 1575 | // | |------------->| |
| 1576 | // | | | |
| 1577 | // | | SubDelReq | |
| 1578 | // | |------------->| |
| 1579 | // | | | |
| 1580 | // | | | |
| 1581 | // | SubDelResp | | |
| 1582 | // |<-------------| | |
| 1583 | // |
| 1584 | //----------------------------------------------------------------------------- |
| 1585 | |
| 1586 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1587 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1588 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1589 | |
| 1590 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1591 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1592 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1593 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1594 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1595 | |
| 1596 | // Subs Delete |
| 1597 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1598 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1599 | |
| 1600 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1601 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1602 | |
| 1603 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1604 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1605 | |
| 1606 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1607 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1608 | |
| 1609 | // Wait that subs is cleaned |
| 1610 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1611 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1612 | xappConn1.TestMsgChanEmpty(t) |
| 1613 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1614 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1615 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1616 | } |
| 1617 | |
| 1618 | //----------------------------------------------------------------------------- |
| 1619 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1620 | // |
| 1621 | // stub stub |
| 1622 | // +-------+ +---------+ +---------+ |
| 1623 | // | xapp | | submgr | | e2term | |
| 1624 | // +-------+ +---------+ +---------+ |
| 1625 | // | | | |
| 1626 | // | [SUBS CREATE] | |
| 1627 | // | | | |
| 1628 | // | | | |
| 1629 | // | SubDelReq | | |
| 1630 | // |------------->| | |
| 1631 | // | | | |
| 1632 | // | | SubDelReq | |
| 1633 | // | |------------->| |
| 1634 | // | | | |
| 1635 | // | | SubDelFail | |
| 1636 | // | |<-------------| |
| 1637 | // | | | |
| 1638 | // | SubDelResp | | |
| 1639 | // |<-------------| | |
| 1640 | // | | | |
| 1641 | // |
| 1642 | //----------------------------------------------------------------------------- |
| 1643 | |
| 1644 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1645 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1646 | |
| 1647 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1648 | Counter{cSubReqFromXapp, 1}, |
| 1649 | Counter{cSubReqToE2, 1}, |
| 1650 | Counter{cSubRespFromE2, 1}, |
| 1651 | Counter{cSubRespToXapp, 1}, |
| 1652 | Counter{cSubDelReqFromXapp, 1}, |
| 1653 | Counter{cSubDelReqToE2, 1}, |
| 1654 | Counter{cSubDelFailFromE2, 1}, |
| 1655 | Counter{cSubDelRespToXapp, 1}, |
| 1656 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1657 | |
| 1658 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1659 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1660 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1661 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1662 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1663 | |
| 1664 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1665 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1666 | |
| 1667 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1668 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1669 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1670 | |
| 1671 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1672 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1673 | |
| 1674 | // Wait that subs is cleaned |
| 1675 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1676 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1677 | xappConn1.TestMsgChanEmpty(t) |
| 1678 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1679 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1680 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1681 | |
| 1682 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1683 | } |
| 1684 | |
| 1685 | //----------------------------------------------------------------------------- |
| 1686 | // TestSubReqAndSubDelOkSameAction |
| 1687 | // |
| 1688 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1689 | // +-------+ +-------+ +---------+ +---------+ |
| 1690 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1691 | // +-------+ +-------+ +---------+ +---------+ |
| 1692 | // | | | | |
| 1693 | // | | | | |
| 1694 | // | | | | |
| 1695 | // | | SubReq1 | | |
| 1696 | // | |------------->| | |
| 1697 | // | | | | |
| 1698 | // | | | SubReq1 | |
| 1699 | // | | |------------->| |
| 1700 | // | | | SubResp1 | |
| 1701 | // | | |<-------------| |
| 1702 | // | | SubResp1 | | |
| 1703 | // | |<-------------| | |
| 1704 | // | | | | |
| 1705 | // | SubReq2 | | |
| 1706 | // |--------------------------->| | |
| 1707 | // | | | | |
| 1708 | // | SubResp2 | | |
| 1709 | // |<---------------------------| | |
| 1710 | // | | | | |
| 1711 | // | | SubDelReq 1 | | |
| 1712 | // | |------------->| | |
| 1713 | // | | | | |
| 1714 | // | | SubDelResp 1 | | |
| 1715 | // | |<-------------| | |
| 1716 | // | | | | |
| 1717 | // | SubDelReq 2 | | |
| 1718 | // |--------------------------->| | |
| 1719 | // | | | | |
| 1720 | // | | | SubDelReq 2 | |
| 1721 | // | | |------------->| |
| 1722 | // | | | | |
| 1723 | // | | | SubDelReq 2 | |
| 1724 | // | | |------------->| |
| 1725 | // | | | | |
| 1726 | // | SubDelResp 2 | | |
| 1727 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1728 | // |
| 1729 | //----------------------------------------------------------------------------- |
| 1730 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1731 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1732 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1733 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1734 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1735 | Counter{cSubReqFromXapp, 2}, |
| 1736 | Counter{cSubReqToE2, 1}, |
| 1737 | Counter{cSubRespFromE2, 1}, |
| 1738 | Counter{cSubRespToXapp, 2}, |
| 1739 | Counter{cMergedSubscriptions, 1}, |
| 1740 | Counter{cUnmergedSubscriptions, 1}, |
| 1741 | Counter{cSubDelReqFromXapp, 2}, |
| 1742 | Counter{cSubDelReqToE2, 1}, |
| 1743 | Counter{cSubDelRespFromE2, 1}, |
| 1744 | Counter{cSubDelRespToXapp, 2}, |
| 1745 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1746 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1747 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1748 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1749 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1750 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1751 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1752 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1753 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1754 | |
| 1755 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1756 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1757 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1758 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1759 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1760 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1761 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1762 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1763 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1764 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1765 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1766 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1767 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1769 | |
| 1770 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1771 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1772 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1773 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1774 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1775 | //Wait that subs is cleaned |
| 1776 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1777 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1778 | xappConn1.TestMsgChanEmpty(t) |
| 1779 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1780 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1781 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1782 | |
| 1783 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1784 | } |
| 1785 | |
| 1786 | //----------------------------------------------------------------------------- |
| 1787 | // TestSubReqAndSubDelOkSameActionParallel |
| 1788 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1789 | // stub stub stub |
| 1790 | // +-------+ +-------+ +---------+ +---------+ |
| 1791 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1792 | // +-------+ +-------+ +---------+ +---------+ |
| 1793 | // | | | | |
| 1794 | // | | | | |
| 1795 | // | | | | |
| 1796 | // | | SubReq1 | | |
| 1797 | // | |------------->| | |
| 1798 | // | | | | |
| 1799 | // | | | SubReq1 | |
| 1800 | // | | |------------->| |
| 1801 | // | SubReq2 | | |
| 1802 | // |--------------------------->| | |
| 1803 | // | | | SubResp1 | |
| 1804 | // | | |<-------------| |
| 1805 | // | | SubResp1 | | |
| 1806 | // | |<-------------| | |
| 1807 | // | | | | |
| 1808 | // | SubResp2 | | |
| 1809 | // |<---------------------------| | |
| 1810 | // | | | | |
| 1811 | // | | SubDelReq 1 | | |
| 1812 | // | |------------->| | |
| 1813 | // | | | | |
| 1814 | // | | SubDelResp 1 | | |
| 1815 | // | |<-------------| | |
| 1816 | // | | | | |
| 1817 | // | SubDelReq 2 | | |
| 1818 | // |--------------------------->| | |
| 1819 | // | | | | |
| 1820 | // | | | SubDelReq 2 | |
| 1821 | // | | |------------->| |
| 1822 | // | | | | |
| 1823 | // | | | SubDelReq 2 | |
| 1824 | // | | |------------->| |
| 1825 | // | | | | |
| 1826 | // | SubDelResp 2 | | |
| 1827 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1828 | // |
| 1829 | //----------------------------------------------------------------------------- |
| 1830 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1831 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1832 | |
| 1833 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1834 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1835 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1836 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1837 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1838 | |
| 1839 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1840 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1841 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1842 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1843 | |
| 1844 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1845 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1846 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1847 | |
| 1848 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1849 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1850 | |
| 1851 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1852 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1853 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1854 | |
| 1855 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1856 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1857 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1858 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1859 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1860 | |
| 1861 | //Wait that subs is cleaned |
| 1862 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1863 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1864 | xappConn1.TestMsgChanEmpty(t) |
| 1865 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1866 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1867 | mainCtrl.wait_registry_empty(t, 10) |
| 1868 | } |
| 1869 | |
| 1870 | //----------------------------------------------------------------------------- |
| 1871 | // TestSubReqAndSubDelNokSameActionParallel |
| 1872 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1873 | // stub stub stub |
| 1874 | // +-------+ +-------+ +---------+ +---------+ |
| 1875 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1876 | // +-------+ +-------+ +---------+ +---------+ |
| 1877 | // | | | | |
| 1878 | // | | | | |
| 1879 | // | | | | |
| 1880 | // | | SubReq1 | | |
| 1881 | // | |------------->| | |
| 1882 | // | | | | |
| 1883 | // | | | SubReq1 | |
| 1884 | // | | |------------->| |
| 1885 | // | SubReq2 | | |
| 1886 | // |--------------------------->| | |
| 1887 | // | | | SubFail1 | |
| 1888 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1889 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1890 | // | | SubFail1 | | |
| 1891 | // | |<-------------| | |
| 1892 | // | | | | |
| 1893 | // | SubFail2 | | |
| 1894 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1895 | // |
| 1896 | //----------------------------------------------------------------------------- |
| 1897 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1898 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1899 | |
| 1900 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1901 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1902 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1903 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1904 | |
| 1905 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1906 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1907 | |
| 1908 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1909 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1910 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1911 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1912 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1913 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1914 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1915 | // E2t: send SubsFail (first) |
| 1916 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1917 | fparams1.Set(crereq1) |
| 1918 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1919 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1920 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1921 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1922 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1923 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1924 | |
| 1925 | //Wait that subs is cleaned |
| 1926 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1927 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1928 | xappConn1.TestMsgChanEmpty(t) |
| 1929 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1930 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1931 | mainCtrl.wait_registry_empty(t, 10) |
| 1932 | } |
| 1933 | |
| 1934 | //----------------------------------------------------------------------------- |
| 1935 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1936 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1937 | // stub stub stub |
| 1938 | // +-------+ +-------+ +---------+ +---------+ |
| 1939 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1940 | // +-------+ +-------+ +---------+ +---------+ |
| 1941 | // | | | | |
| 1942 | // | | | | |
| 1943 | // | | | | |
| 1944 | // | | SubReq1 | | |
| 1945 | // | |------------->| | |
| 1946 | // | | | | |
| 1947 | // | | | SubReq1 | |
| 1948 | // | | |------------->| |
| 1949 | // | | SubReq2 | | |
| 1950 | // |--------------------------->| | |
| 1951 | // | | | | |
| 1952 | // | | | SubReq1 | |
| 1953 | // | | |------------->| |
| 1954 | // | | | | |
| 1955 | // | | | | |
| 1956 | // | | | SubDelReq | |
| 1957 | // | | |------------->| |
| 1958 | // | | | | |
| 1959 | // | | | SubDelResp | |
| 1960 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1961 | // |
| 1962 | //----------------------------------------------------------------------------- |
| 1963 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1964 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1965 | |
| 1966 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1967 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1968 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1969 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1970 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1971 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1972 | |
| 1973 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1974 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1975 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1976 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1977 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1978 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1979 | |
| 1980 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1981 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1982 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1983 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1984 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1985 | |
| 1986 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1987 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1988 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1989 | xappConn1.TestMsgChanEmpty(t) |
| 1990 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1991 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1992 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1993 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1994 | |
| 1995 | //----------------------------- Policy cases --------------------------------- |
| 1996 | //----------------------------------------------------------------------------- |
| 1997 | // TestSubReqPolicyAndSubDelOk |
| 1998 | // |
| 1999 | // stub stub |
| 2000 | // +-------+ +---------+ +---------+ |
| 2001 | // | xapp | | submgr | | e2term | |
| 2002 | // +-------+ +---------+ +---------+ |
| 2003 | // | | | |
| 2004 | // | SubReq | | |
| 2005 | // |------------->| | |
| 2006 | // | | | |
| 2007 | // | | SubReq | |
| 2008 | // | |------------->| |
| 2009 | // | | | |
| 2010 | // | | SubResp | |
| 2011 | // | |<-------------| |
| 2012 | // | | | |
| 2013 | // | SubResp | | |
| 2014 | // |<-------------| | |
| 2015 | // | | | |
| 2016 | // | | | |
| 2017 | // | SubDelReq | | |
| 2018 | // |------------->| | |
| 2019 | // | | | |
| 2020 | // | | SubDelReq | |
| 2021 | // | |------------->| |
| 2022 | // | | | |
| 2023 | // | | SubDelResp | |
| 2024 | // | |<-------------| |
| 2025 | // | | | |
| 2026 | // | SubDelResp | | |
| 2027 | // |<-------------| | |
| 2028 | // |
| 2029 | //----------------------------------------------------------------------------- |
| 2030 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2031 | CaseBegin("TestSubReqAndSubDelOk") |
| 2032 | |
| 2033 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2034 | rparams1.Init() |
| 2035 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2036 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2037 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2038 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2039 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2040 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2041 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2042 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2043 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2044 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2045 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2046 | |
| 2047 | //Wait that subs is cleaned |
| 2048 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2049 | |
| 2050 | xappConn1.TestMsgChanEmpty(t) |
| 2051 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2052 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2053 | mainCtrl.wait_registry_empty(t, 10) |
| 2054 | } |
| 2055 | |
| 2056 | //----------------------------------------------------------------------------- |
| 2057 | // TestSubReqPolicyChangeAndSubDelOk |
| 2058 | // |
| 2059 | // stub stub |
| 2060 | // +-------+ +---------+ +---------+ |
| 2061 | // | xapp | | submgr | | e2term | |
| 2062 | // +-------+ +---------+ +---------+ |
| 2063 | // | | | |
| 2064 | // | SubReq | | |
| 2065 | // |------------->| | |
| 2066 | // | | | |
| 2067 | // | | SubReq | |
| 2068 | // | |------------->| |
| 2069 | // | | | |
| 2070 | // | | SubResp | |
| 2071 | // | |<-------------| |
| 2072 | // | | | |
| 2073 | // | SubResp | | |
| 2074 | // |<-------------| | |
| 2075 | // | | | |
| 2076 | // | SubReq | | |
| 2077 | // |------------->| | |
| 2078 | // | | | |
| 2079 | // | | SubReq | |
| 2080 | // | |------------->| |
| 2081 | // | | | |
| 2082 | // | | SubResp | |
| 2083 | // | |<-------------| |
| 2084 | // | | | |
| 2085 | // | SubResp | | |
| 2086 | // |<-------------| | |
| 2087 | // | | | |
| 2088 | // | SubDelReq | | |
| 2089 | // |------------->| | |
| 2090 | // | | | |
| 2091 | // | | SubDelReq | |
| 2092 | // | |------------->| |
| 2093 | // | | | |
| 2094 | // | | SubDelResp | |
| 2095 | // | |<-------------| |
| 2096 | // | | | |
| 2097 | // | SubDelResp | | |
| 2098 | // |<-------------| | |
| 2099 | // |
| 2100 | //----------------------------------------------------------------------------- |
| 2101 | |
| 2102 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2103 | CaseBegin("TestSubReqAndSubDelOk") |
| 2104 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2105 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2106 | rparams1.Init() |
| 2107 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2108 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2109 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2110 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2111 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2112 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2113 | |
| 2114 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2115 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2116 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2117 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2118 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2119 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2120 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2121 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2122 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2123 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2124 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2125 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2126 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2127 | |
| 2128 | //Wait that subs is cleaned |
| 2129 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2130 | |
| 2131 | xappConn1.TestMsgChanEmpty(t) |
| 2132 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2133 | e2termConn1.TestMsgChanEmpty(t) |
| 2134 | mainCtrl.wait_registry_empty(t, 10) |
| 2135 | } |
| 2136 | |
| 2137 | //----------------------------------------------------------------------------- |
| 2138 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2139 | // |
| 2140 | // stub stub stub |
| 2141 | // +-------+ +---------+ +---------+ +---------+ |
| 2142 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2143 | // +-------+ +---------+ +---------+ +---------+ |
| 2144 | // | | | | |
| 2145 | // | | | | |
| 2146 | // | | | | |
| 2147 | // | SubReq1 | | | |
| 2148 | // |------------->| | | |
| 2149 | // | | | | |
| 2150 | // | | SubReq1 | | |
| 2151 | // | |------------->| | |
| 2152 | // | | | | |
| 2153 | // | SubReq2 | | | |
| 2154 | // |------------->| | | |
| 2155 | // | | | | |
| 2156 | // | | SubReq2 | | |
| 2157 | // | |---------------------------->| |
| 2158 | // | | | | |
| 2159 | // | | SubResp1 | | |
| 2160 | // | |<-------------| | |
| 2161 | // | SubResp1 | | | |
| 2162 | // |<-------------| | | |
| 2163 | // | | SubResp2 | | |
| 2164 | // | |<----------------------------| |
| 2165 | // | SubResp2 | | | |
| 2166 | // |<-------------| | | |
| 2167 | // | | | | |
| 2168 | // | [SUBS 1 DELETE] | | |
| 2169 | // | | | | |
| 2170 | // | [SUBS 2 DELETE] | | |
| 2171 | // | | | | |
| 2172 | // |
| 2173 | //----------------------------------------------------------------------------- |
| 2174 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2175 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2176 | |
| 2177 | //Req1 |
| 2178 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2179 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2180 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2181 | |
| 2182 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2183 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2184 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2185 | |
| 2186 | //Resp1 |
| 2187 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2188 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2189 | |
| 2190 | //Resp2 |
| 2191 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2192 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2193 | |
| 2194 | //Del1 |
| 2195 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2196 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2197 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2198 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2199 | //Wait that subs is cleaned |
| 2200 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2201 | |
| 2202 | //Del2 |
| 2203 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2204 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2205 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2206 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2207 | //Wait that subs is cleaned |
| 2208 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2209 | |
| 2210 | xappConn1.TestMsgChanEmpty(t) |
| 2211 | xappConn2.TestMsgChanEmpty(t) |
| 2212 | e2termConn1.TestMsgChanEmpty(t) |
| 2213 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2214 | mainCtrl.wait_registry_empty(t, 10) |
| 2215 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2216 | |
| 2217 | //----------------------------------------------------------------------------- |
| 2218 | // TestSubReqInsertAndSubDelOk |
| 2219 | // |
| 2220 | // stub stub |
| 2221 | // +-------+ +---------+ +---------+ |
| 2222 | // | xapp | | submgr | | e2term | |
| 2223 | // +-------+ +---------+ +---------+ |
| 2224 | // | | | |
| 2225 | // | SubReq | | |
| 2226 | // |------------->| | |
| 2227 | // | | | |
| 2228 | // | | SubReq | |
| 2229 | // | |------------->| |
| 2230 | // | | | |
| 2231 | // | | SubResp | |
| 2232 | // | |<-------------| |
| 2233 | // | | | |
| 2234 | // | SubResp | | |
| 2235 | // |<-------------| | |
| 2236 | // | | | |
| 2237 | // | | | |
| 2238 | // | SubDelReq | | |
| 2239 | // |------------->| | |
| 2240 | // | | | |
| 2241 | // | | SubDelReq | |
| 2242 | // | |------------->| |
| 2243 | // | | | |
| 2244 | // | | SubDelResp | |
| 2245 | // | |<-------------| |
| 2246 | // | | | |
| 2247 | // | SubDelResp | | |
| 2248 | // |<-------------| | |
| 2249 | // |
| 2250 | //----------------------------------------------------------------------------- |
| 2251 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2252 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2253 | |
| 2254 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2255 | rparams1.Init() |
| 2256 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2257 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2258 | |
| 2259 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2260 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2261 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2262 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2263 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2264 | |
| 2265 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2266 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2267 | |
| 2268 | //Wait that subs is cleaned |
| 2269 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2270 | |
| 2271 | xappConn1.TestMsgChanEmpty(t) |
| 2272 | xappConn2.TestMsgChanEmpty(t) |
| 2273 | e2termConn1.TestMsgChanEmpty(t) |
| 2274 | mainCtrl.wait_registry_empty(t, 10) |
| 2275 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2276 | |
| 2277 | //----------------------------------------------------------------------------- |
| 2278 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2279 | // |
| 2280 | // This case simulates case where xApp restarts and starts sending same |
| 2281 | // subscription requests which have already subscribed successfully |
| 2282 | |
| 2283 | // stub stub |
| 2284 | // +-------+ +---------+ +---------+ |
| 2285 | // | xapp | | submgr | | e2term | |
| 2286 | // +-------+ +---------+ +---------+ |
| 2287 | // | | | |
| 2288 | // | SubReq | | |
| 2289 | // |------------->| | |
| 2290 | // | | | |
| 2291 | // | | SubReq | |
| 2292 | // | |------------->| |
| 2293 | // | | | |
| 2294 | // | | SubResp | |
| 2295 | // | |<-------------| |
| 2296 | // | | | |
| 2297 | // | SubResp | | |
| 2298 | // |<-------------| | |
| 2299 | // | | | |
| 2300 | // | xApp restart | | |
| 2301 | // | | | |
| 2302 | // | SubReq | | |
| 2303 | // | (retrans with same xApp generated subid but diff xid) |
| 2304 | // |------------->| | |
| 2305 | // | | | |
| 2306 | // | SubResp | | |
| 2307 | // |<-------------| | |
| 2308 | // | | | |
| 2309 | // | [SUBS DELETE] | |
| 2310 | // | | | |
| 2311 | // |
| 2312 | //----------------------------------------------------------------------------- |
| 2313 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2314 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2315 | |
| 2316 | //Subs Create |
| 2317 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2318 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2319 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2320 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2321 | |
| 2322 | // xApp restart here |
| 2323 | // --> artificial delay |
| 2324 | <-time.After(1 * time.Second) |
| 2325 | |
| 2326 | //Subs Create |
| 2327 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2328 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2329 | |
| 2330 | //Subs Delete |
| 2331 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2332 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2333 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2334 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2335 | |
| 2336 | //Wait that subs is cleaned |
| 2337 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2338 | |
| 2339 | xappConn1.TestMsgChanEmpty(t) |
| 2340 | xappConn2.TestMsgChanEmpty(t) |
| 2341 | e2termConn1.TestMsgChanEmpty(t) |
| 2342 | mainCtrl.wait_registry_empty(t, 10) |
| 2343 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2344 | |
| 2345 | //----------------------------------------------------------------------------- |
| 2346 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2347 | // |
| 2348 | // stub stub |
| 2349 | // +-------+ +---------+ +---------+ |
| 2350 | // | xapp | | submgr | | e2term | |
| 2351 | // +-------+ +---------+ +---------+ |
| 2352 | // | | | |
| 2353 | // | SubReq | | |
| 2354 | // |------------->| | |
| 2355 | // | | | |
| 2356 | // | | SubReq | |
| 2357 | // | |------------->| |
| 2358 | // | | | |
| 2359 | // | | SubResp | |
| 2360 | // | <----| |
| 2361 | // | | |
| 2362 | // | Submgr restart | |
| 2363 | // | | |
| 2364 | // | | | |
| 2365 | // | | SubDelReq | |
| 2366 | // | |------------->| |
| 2367 | // | | | |
| 2368 | // | | SubDelResp | |
| 2369 | // | |<-------------| |
| 2370 | // | | | |
| 2371 | // |
| 2372 | //----------------------------------------------------------------------------- |
| 2373 | |
| 2374 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2375 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2376 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2377 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2378 | xappConn1.SendSubsReq(t, nil, nil) |
| 2379 | e2termConn1.RecvSubsReq(t) |
| 2380 | mainCtrl.SetResetTestFlag(t, false) |
| 2381 | |
| 2382 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2383 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2384 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2385 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2386 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2387 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2388 | mainCtrl.SimulateRestart(t) |
| 2389 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2390 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2391 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2392 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2393 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2394 | |
| 2395 | // Wait that subs is cleaned |
| 2396 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2397 | |
| 2398 | xappConn1.TestMsgChanEmpty(t) |
| 2399 | xappConn2.TestMsgChanEmpty(t) |
| 2400 | e2termConn1.TestMsgChanEmpty(t) |
| 2401 | mainCtrl.wait_registry_empty(t, 10) |
| 2402 | } |
| 2403 | |
| 2404 | //----------------------------------------------------------------------------- |
| 2405 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2406 | // |
| 2407 | // stub stub |
| 2408 | // +-------+ +---------+ +---------+ |
| 2409 | // | xapp | | submgr | | e2term | |
| 2410 | // +-------+ +---------+ +---------+ |
| 2411 | // | | | |
| 2412 | // | SubReq | | |
| 2413 | // |------------->| | |
| 2414 | // | | | |
| 2415 | // | | SubReq | |
| 2416 | // | |------------->| |
| 2417 | // | | | |
| 2418 | // | | SubResp | |
| 2419 | // | |<-------------| |
| 2420 | // | | | |
| 2421 | // | SubResp | | |
| 2422 | // |<-------------| | |
| 2423 | // | | | |
| 2424 | // | | |
| 2425 | // | Submgr restart | |
| 2426 | // | | |
| 2427 | // | SubDelReq | | |
| 2428 | // |------------->| | |
| 2429 | // | | | |
| 2430 | // | | SubDelReq | |
| 2431 | // | |------------->| |
| 2432 | // | | | |
| 2433 | // | | SubDelResp | |
| 2434 | // | |<-------------| |
| 2435 | // | | | |
| 2436 | // | SubDelResp | | |
| 2437 | // |<-------------| | |
| 2438 | // |
| 2439 | //----------------------------------------------------------------------------- |
| 2440 | |
| 2441 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2442 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2443 | |
| 2444 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2445 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2446 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2447 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2448 | |
| 2449 | // Check subscription |
| 2450 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2451 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2452 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2453 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2454 | |
| 2455 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2456 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2457 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2458 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2459 | // That needs to be completed before successful subscription query is possible |
| 2460 | <-time.After(time.Second * 1) |
| 2461 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2462 | // Check that subscription is restored correctly after restart |
| 2463 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2464 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2465 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2466 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2467 | |
| 2468 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2469 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2470 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2471 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2472 | |
| 2473 | //Wait that subs is cleaned |
| 2474 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2475 | |
| 2476 | xappConn1.TestMsgChanEmpty(t) |
| 2477 | xappConn2.TestMsgChanEmpty(t) |
| 2478 | e2termConn1.TestMsgChanEmpty(t) |
| 2479 | mainCtrl.wait_registry_empty(t, 10) |
| 2480 | } |
| 2481 | |
| 2482 | //----------------------------------------------------------------------------- |
| 2483 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2484 | // |
| 2485 | // stub stub |
| 2486 | // +-------+ +-------+ +---------+ +---------+ |
| 2487 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2488 | // +-------+ +-------+ +---------+ +---------+ |
| 2489 | // | | | | |
| 2490 | // | | | | |
| 2491 | // | | | | |
| 2492 | // | | SubReq1 | | |
| 2493 | // | |------------->| | |
| 2494 | // | | | | |
| 2495 | // | | | SubReq1 | |
| 2496 | // | | |------------->| |
| 2497 | // | | | SubResp1 | |
| 2498 | // | | |<-------------| |
| 2499 | // | | SubResp1 | | |
| 2500 | // | |<-------------| | |
| 2501 | // | | | | |
| 2502 | // | | |
| 2503 | // | submgr restart | |
| 2504 | // | | |
| 2505 | // | | | | |
| 2506 | // | | | | |
| 2507 | // | SubReq2 | | |
| 2508 | // |--------------------------->| | |
| 2509 | // | | | | |
| 2510 | // | SubResp2 | | |
| 2511 | // |<---------------------------| | |
| 2512 | // | | | | |
| 2513 | // | | SubDelReq 1 | | |
| 2514 | // | |------------->| | |
| 2515 | // | | | | |
| 2516 | // | | SubDelResp 1 | | |
| 2517 | // | |<-------------| | |
| 2518 | // | | | | |
| 2519 | // | | | | |
| 2520 | // | | |
| 2521 | // | submgr restart | |
| 2522 | // | | |
| 2523 | // | | | | |
| 2524 | // | SubDelReq 2 | | |
| 2525 | // |--------------------------->| | |
| 2526 | // | | | | |
| 2527 | // | | | SubDelReq 2 | |
| 2528 | // | | |------------->| |
| 2529 | // | | | | |
| 2530 | // | | | SubDelReq 2 | |
| 2531 | // | | |------------->| |
| 2532 | // | | | | |
| 2533 | // | SubDelResp 2 | | |
| 2534 | // |<---------------------------| | |
| 2535 | // |
| 2536 | //----------------------------------------------------------------------------- |
| 2537 | |
| 2538 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2539 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2540 | |
| 2541 | //Req1 |
| 2542 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2543 | rparams1.Init() |
| 2544 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2545 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2546 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2547 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2548 | |
| 2549 | //Req2 |
| 2550 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2551 | rparams2.Init() |
| 2552 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2553 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2554 | |
| 2555 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2556 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2557 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2558 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2559 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2560 | |
| 2561 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2562 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2563 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2564 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2565 | // That needs to be completed before successful subscription query is possible |
| 2566 | <-time.After(time.Second * 1) |
| 2567 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2568 | // Check that subscription is restored correctly after restart |
| 2569 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2570 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2571 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2572 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2573 | |
| 2574 | //Del1 |
| 2575 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2576 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2577 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2578 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2579 | |
| 2580 | mainCtrl.SimulateRestart(t) |
| 2581 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2582 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2583 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2584 | // Submgr need be ready before successful subscription deletion is possible |
| 2585 | <-time.After(time.Second * 1) |
| 2586 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2587 | //Del2 |
| 2588 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2589 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2590 | |
| 2591 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2592 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2593 | |
| 2594 | //Wait that subs is cleaned |
| 2595 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2596 | |
| 2597 | xappConn1.TestMsgChanEmpty(t) |
| 2598 | xappConn2.TestMsgChanEmpty(t) |
| 2599 | e2termConn1.TestMsgChanEmpty(t) |
| 2600 | mainCtrl.wait_registry_empty(t, 10) |
| 2601 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2602 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2603 | //***************************************************************************** |
| 2604 | // REST interface test cases |
| 2605 | //***************************************************************************** |
| 2606 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2607 | //----------------------------------------------------------------------------- |
| 2608 | // Test debug GET and POST requests |
| 2609 | // |
| 2610 | // curl |
| 2611 | // +-------+ +---------+ |
| 2612 | // | user | | submgr | |
| 2613 | // +-------+ +---------+ |
| 2614 | // | | |
| 2615 | // | GET/POST Req | |
| 2616 | // |------------->| |
| 2617 | // | Resp | |
| 2618 | // |<-------------| |
| 2619 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2620 | func TestGetSubscriptions(t *testing.T) { |
| 2621 | |
| 2622 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2623 | } |
| 2624 | |
| 2625 | func TestGetSymptomData(t *testing.T) { |
| 2626 | |
| 2627 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2628 | } |
| 2629 | |
| 2630 | func TestPostdeleteSubId(t *testing.T) { |
| 2631 | |
| 2632 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2633 | } |
| 2634 | |
| 2635 | func TestPostEmptyDb(t *testing.T) { |
| 2636 | |
| 2637 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2638 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2639 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2640 | func TestGetRestSubscriptions(t *testing.T) { |
| 2641 | |
| 2642 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2643 | } |
| 2644 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2645 | //----------------------------------------------------------------------------- |
| 2646 | // TestRESTSubReqAndRouteNok |
| 2647 | // |
| 2648 | // stub stub |
| 2649 | // +-------+ +---------+ +---------+ |
| 2650 | // | xapp | | submgr | | rtmgr | |
| 2651 | // +-------+ +---------+ +---------+ |
| 2652 | // | | | |
| 2653 | // | RESTSubReq | | |
| 2654 | // |---------------->| | |
| 2655 | // | | | |
| 2656 | // | RESTSubResp | | |
| 2657 | // |<----------------| | |
| 2658 | // | | RouteCreate | |
| 2659 | // | |------------->| |
| 2660 | // | | | |
| 2661 | // | | RouteCreate | |
| 2662 | // | | status:400 | |
| 2663 | // | |(Bad request) | |
| 2664 | // | |<-------------| |
| 2665 | // | RESTNotif | | |
| 2666 | // |<----------------| | |
| 2667 | // | | | |
| 2668 | // | [SUBS INT DELETE] | |
| 2669 | // | | | |
| 2670 | // | RESTSubDelReq | | |
| 2671 | // |---------------->| | |
| 2672 | // | RESTSubDelResp | | |
| 2673 | // |<----------------| | |
| 2674 | // |
| 2675 | //----------------------------------------------------------------------------- |
| 2676 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2677 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2678 | |
| 2679 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2680 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2681 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2682 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2683 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2684 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2685 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2686 | }) |
| 2687 | |
| 2688 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2689 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2690 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2691 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2692 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2693 | |
| 2694 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2695 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2696 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2697 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2698 | waiter.WaitResult(t) |
| 2699 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2700 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2701 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2702 | |
| 2703 | // Del |
| 2704 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2705 | |
| 2706 | // Wait that subs is cleaned |
| 2707 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2708 | waitSubsCleanup(t, e2SubsId, 10) |
| 2709 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2710 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2711 | } |
| 2712 | |
| 2713 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2714 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2715 | |
| 2716 | //Init counter check |
| 2717 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2718 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2719 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2720 | Counter{cSubReqToE2, 1}, |
| 2721 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2722 | Counter{cRestSubNotifToXapp, 1}, |
| 2723 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2724 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2725 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2726 | Counter{cSubDelReqToE2, 1}, |
| 2727 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2728 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2729 | }) |
| 2730 | |
| 2731 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2732 | |
| 2733 | //Subs Create |
| 2734 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2735 | |
| 2736 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2737 | |
| 2738 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2739 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2740 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2741 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2742 | params.SetMeid("RAN_NAME_1") |
| 2743 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2744 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2745 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2746 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2747 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2748 | |
| 2749 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2750 | |
| 2751 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2752 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2753 | |
| 2754 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2755 | //Wait that subs is cleaned |
| 2756 | waitSubsCleanup(t, e2SubsId, 10) |
| 2757 | |
| 2758 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2759 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2760 | } |
| 2761 | |
| 2762 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2763 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2764 | |
| 2765 | // Init counter check |
| 2766 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2767 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2768 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2769 | Counter{cSubReqToE2, 1}, |
| 2770 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2771 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2772 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2773 | Counter{cRouteDeleteFail, 1}, |
| 2774 | Counter{cSubDelReqToE2, 1}, |
| 2775 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2776 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2777 | }) |
| 2778 | |
| 2779 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2780 | |
| 2781 | //Subs Create |
| 2782 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2783 | |
| 2784 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2785 | |
| 2786 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2787 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2788 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2789 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2790 | waiter.WaitResult(t) |
| 2791 | |
| 2792 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2793 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2794 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2795 | } |
| 2796 | |
| 2797 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2798 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2799 | |
| 2800 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2801 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2802 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2803 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2804 | Counter{cSubReqToE2, 1}, |
| 2805 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2806 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2807 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2808 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2809 | Counter{cSubDelReqToE2, 1}, |
| 2810 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2811 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2812 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2813 | }) |
| 2814 | |
| 2815 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2816 | |
| 2817 | //Subs Create |
| 2818 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2819 | |
| 2820 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2821 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2822 | |
| 2823 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2824 | |
| 2825 | //Del1, this shall fail on rtmgr side |
| 2826 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2827 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2828 | waiter.WaitResult(t) |
| 2829 | |
| 2830 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2831 | |
| 2832 | //Del2 |
| 2833 | deleteXapp2Subscription(t, &restSubId2) |
| 2834 | |
| 2835 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2836 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2837 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2838 | } |
| 2839 | |
| 2840 | //----------------------------------------------------------------------------- |
| 2841 | // TestRESTSubReqRetransmission |
| 2842 | // |
| 2843 | // stub stub |
| 2844 | // +-------+ +---------+ +---------+ |
| 2845 | // | xapp | | submgr | | e2term | |
| 2846 | // +-------+ +---------+ +---------+ |
| 2847 | // | | | |
| 2848 | // | RESTSubReq1 | | |
| 2849 | // |---------------->| | |
| 2850 | // | | | |
| 2851 | // | RESTSubResp | | |
| 2852 | // |<----------------| | |
| 2853 | // | | SubReq1 | |
| 2854 | // | |------------->| |
| 2855 | // | | | |
| 2856 | // | RESTSubReq2 | | |
| 2857 | // | (retrans) | | |
| 2858 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2859 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2860 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2861 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2862 | // | | SubResp1 | |
| 2863 | // | |<-------------| |
| 2864 | // | RESTNotif1 | | |
| 2865 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2866 | // | | | |
| 2867 | // | [SUBS DELETE] | |
| 2868 | // | | | |
| 2869 | // |
| 2870 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2871 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2872 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2873 | CaseBegin("TestRESTSubReqRetransmission") |
| 2874 | |
| 2875 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2876 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2877 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2878 | Counter{cSubReqToE2, 1}, |
| 2879 | Counter{cSubRespFromE2, 1}, |
| 2880 | Counter{cRestSubNotifToXapp, 1}, |
| 2881 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2882 | Counter{cSubDelReqToE2, 1}, |
| 2883 | Counter{cSubDelRespFromE2, 1}, |
| 2884 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2885 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2886 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2887 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2888 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2889 | |
| 2890 | // Subs Create |
| 2891 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2892 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2893 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2894 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2895 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2896 | xappConn1.SendRESTSubsReq(t, params) |
| 2897 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2898 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2899 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2900 | |
| 2901 | // 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] | 2902 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2903 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2904 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2905 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2906 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 2907 | |
| 2908 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2909 | |
| 2910 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2911 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2912 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2913 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2914 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2915 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2916 | |
| 2917 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2918 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2919 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2920 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2921 | //----------------------------------------------------------------------------- |
| 2922 | // stub stub stub |
| 2923 | // +-------+ +---------+ +---------+ +---------+ |
| 2924 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2925 | // +-------+ +---------+ +---------+ +---------+ |
| 2926 | // | | | | |
| 2927 | // | RESTSubReq | | | |
| 2928 | // |---------------->| | | |
| 2929 | // | RESTSubResp | | | |
| 2930 | // |<----------------| | | |
| 2931 | // | | RouteCreate | | |
| 2932 | // | |--------------------------->| |
| 2933 | // | | RouteResponse| | |
| 2934 | // | |<---------------------------| // The order of these events may vary |
| 2935 | // | | SubReq | | |
| 2936 | // | |------------->| | // The order of these events may vary |
| 2937 | // | | SubResp | | |
| 2938 | // | |<-------------| | |
| 2939 | // | RESTNotif1 | | | |
| 2940 | // |<----------------| | | |
| 2941 | // | RESTSubReq | | | |
| 2942 | // | [RETRANS1] | | | |
| 2943 | // |---------------->| | | |
| 2944 | // | RESTNotif1 | | | |
| 2945 | // |<----------------| | | |
| 2946 | // | RESTSubReq | | | |
| 2947 | // | [RETRANS2] | | | |
| 2948 | // |---------------->| | | |
| 2949 | // | RESTNotif1 | | | |
| 2950 | // |<----------------| | | |
| 2951 | // | RESTSubDelReq | | | |
| 2952 | // |---------------->| | | |
| 2953 | // | | SubDelReq | | |
| 2954 | // | |------------->| | |
| 2955 | // | RESTSubDelResp| | | |
| 2956 | // |<----------------| | | |
| 2957 | // | | SubDelResp | | |
| 2958 | // | |<-------------| | |
| 2959 | // | | | | |
| 2960 | // |
| 2961 | //----------------------------------------------------------------------------- |
| 2962 | |
| 2963 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2964 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2965 | |
| 2966 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2967 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2968 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2969 | Counter{cRestSubRespToXapp, 3}, |
| 2970 | Counter{cSubReqToE2, 1}, |
| 2971 | Counter{cSubRespFromE2, 1}, |
| 2972 | Counter{cRestSubNotifToXapp, 3}, |
| 2973 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2974 | Counter{cSubDelReqToE2, 1}, |
| 2975 | Counter{cSubDelRespFromE2, 1}, |
| 2976 | Counter{cRestSubDelRespToXapp, 1}, |
| 2977 | }) |
| 2978 | |
| 2979 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2980 | |
| 2981 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2982 | |
| 2983 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2984 | |
| 2985 | //1.st resend |
| 2986 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2987 | |
| 2988 | assert.Equal(t, restSubId_resend, restSubId) |
| 2989 | |
| 2990 | <-time.After(100 * time.Millisecond) |
| 2991 | |
| 2992 | //2.nd resend |
| 2993 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2994 | |
| 2995 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2996 | |
| 2997 | <-time.After(100 * time.Millisecond) |
| 2998 | |
| 2999 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3000 | |
| 3001 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3002 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3003 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3004 | } |
| 3005 | |
| 3006 | //----------------------------------------------------------------------------- |
| 3007 | // stub stub stub |
| 3008 | // +-------+ +---------+ +---------+ +---------+ |
| 3009 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3010 | // +-------+ +---------+ +---------+ +---------+ |
| 3011 | // | | | | |
| 3012 | // | RESTSubReq | | | |
| 3013 | // |---------------->| | | |
| 3014 | // | RESTSubResp | | | |
| 3015 | // |<----------------| | | |
| 3016 | // | | RouteCreate | | |
| 3017 | // | |--------------------------->| |
| 3018 | // | | RouteResponse| | |
| 3019 | // | |<---------------------------| // The order of these events may vary |
| 3020 | // | | SubReq | | |
| 3021 | // | |------------->| | // The order of these events may vary |
| 3022 | // | | SubResp | | |
| 3023 | // | |<-------------| | |
| 3024 | // | RESTNotif1 | | | |
| 3025 | // |<----------------| | | |
| 3026 | // | RESTSubReq | | | |
| 3027 | // | [RETRANS, with RESTsubsId] | | |
| 3028 | // |---------------->| | | |
| 3029 | // | RESTNotif1 | | | |
| 3030 | // |<----------------| | | |
| 3031 | // | RESTSubReq | | | |
| 3032 | // | [RETRANS, without RESTsubsId] | | |
| 3033 | // |---------------->| | | |
| 3034 | // | RESTNotif1 | | | |
| 3035 | // |<----------------| | | |
| 3036 | // | RESTSubDelReq | | | |
| 3037 | // |---------------->| | | |
| 3038 | // | | SubDelReq | | |
| 3039 | // | |------------->| | |
| 3040 | // | RESTSubDelResp| | | |
| 3041 | // |<----------------| | | |
| 3042 | // | | SubDelResp | | |
| 3043 | // | |<-------------| | |
| 3044 | // | | | | |
| 3045 | // |
| 3046 | //----------------------------------------------------------------------------- |
| 3047 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3048 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3049 | |
| 3050 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3051 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3052 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3053 | Counter{cRestSubRespToXapp, 3}, |
| 3054 | Counter{cSubReqToE2, 1}, |
| 3055 | Counter{cSubRespFromE2, 1}, |
| 3056 | Counter{cRestSubNotifToXapp, 3}, |
| 3057 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3058 | Counter{cSubDelReqToE2, 1}, |
| 3059 | Counter{cSubDelRespFromE2, 1}, |
| 3060 | Counter{cRestSubDelRespToXapp, 1}, |
| 3061 | }) |
| 3062 | |
| 3063 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3064 | |
| 3065 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3066 | |
| 3067 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3068 | |
| 3069 | <-time.After(100 * time.Millisecond) |
| 3070 | |
| 3071 | //1.st resend with subscription ID |
| 3072 | params.SetSubscriptionID(&restSubId) |
| 3073 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3074 | |
| 3075 | assert.Equal(t, restSubId_resend, restSubId) |
| 3076 | |
| 3077 | <-time.After(100 * time.Millisecond) |
| 3078 | |
| 3079 | //2.nd resend without subscription ID (faking app restart) |
| 3080 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3081 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3082 | |
| 3083 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3084 | |
| 3085 | <-time.After(100 * time.Millisecond) |
| 3086 | |
| 3087 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3088 | |
| 3089 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3090 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3091 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3092 | } |
| 3093 | |
| 3094 | //----------------------------------------------------------------------------- |
| 3095 | // stub stub stub |
| 3096 | // +-------+ +---------+ +---------+ +---------+ |
| 3097 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3098 | // +-------+ +---------+ +---------+ +---------+ |
| 3099 | // | | | | |
| 3100 | // | RESTSubReq | | | |
| 3101 | // |---------------->| | | |
| 3102 | // | RESTSubResp | | | |
| 3103 | // |<----------------| | | |
| 3104 | // | | RouteCreate | | |
| 3105 | // | |--------------------------->| |
| 3106 | // | | RouteResponse| | |
| 3107 | // | |<---------------------------| |
| 3108 | // | | SubReq | | |
| 3109 | // | |------------->| | |
| 3110 | // | | SubResp | | |
| 3111 | // | |<-------------| | |
| 3112 | // | RESTNotif1 | | | |
| 3113 | // |<----------------| | | |
| 3114 | // | RESTSubReq | | | |
| 3115 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3116 | // |---------------->| | | |
| 3117 | // | RESTNotif1 | | | |
| 3118 | // | [for initial e2 subDetail] | | |
| 3119 | // |<----------------| | | |
| 3120 | // | | RouteCreate | | |
| 3121 | // | |--------------------------->| |
| 3122 | // | | RouteResponse| | |
| 3123 | // | |<---------------------------| |
| 3124 | // | | SubReq | | |
| 3125 | // | |------------->| | |
| 3126 | // | | SubResp | | |
| 3127 | // | |<-------------| | |
| 3128 | // | RESTNotif1 | | | |
| 3129 | // |<----------------| | | |
| 3130 | // | RESTSubReq | | | |
| 3131 | // | [with RESTsubsId initial request] | |
| 3132 | // |---------------->| | | |
| 3133 | // | RESTNotif1 | | | |
| 3134 | // |<----------------| | | |
| 3135 | // | RESTSubDelReq | | | |
| 3136 | // |---------------->| | | |
| 3137 | // | RESTSubDelResp| | | |
| 3138 | // |<----------------| | | |
| 3139 | // | | SubDelReq | | |
| 3140 | // | |------------->| | |
| 3141 | // | | SubDelResp | | |
| 3142 | // | |<-------------| | |
| 3143 | // | | SubDelReq | | |
| 3144 | // | |------------->| | |
| 3145 | // | | SubDelResp | | |
| 3146 | // | |<-------------| | |
| 3147 | // | | | | |
| 3148 | // |
| 3149 | //----------------------------------------------------------------------------- |
| 3150 | |
| 3151 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3152 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3153 | |
| 3154 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3155 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3156 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3157 | Counter{cRestSubRespToXapp, 3}, |
| 3158 | Counter{cSubReqToE2, 2}, |
| 3159 | Counter{cSubRespFromE2, 2}, |
| 3160 | Counter{cRestSubNotifToXapp, 4}, |
| 3161 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3162 | Counter{cSubDelReqToE2, 2}, |
| 3163 | Counter{cSubDelRespFromE2, 2}, |
| 3164 | Counter{cRestSubDelRespToXapp, 1}, |
| 3165 | }) |
| 3166 | |
| 3167 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3168 | |
| 3169 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3170 | |
| 3171 | <-time.After(100 * time.Millisecond) |
| 3172 | |
| 3173 | // Send modified requst, this time with e2 subscriptions. |
| 3174 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3175 | params2.SetSubscriptionID(&restSubId) |
| 3176 | |
| 3177 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3178 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3179 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3180 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3181 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3182 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3183 | |
| 3184 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3185 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3186 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3187 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3188 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3189 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3190 | assert.NotEqual(t, e2SubsId2, 0) |
| 3191 | |
| 3192 | <-time.After(100 * time.Millisecond) |
| 3193 | |
| 3194 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3195 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3196 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3197 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3198 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3199 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3200 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3201 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3202 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3203 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3204 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3205 | // Delete both e2 subscriptions |
| 3206 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3207 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3208 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3209 | |
| 3210 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3211 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3212 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3213 | } |
| 3214 | |
| 3215 | //----------------------------------------------------------------------------- |
| 3216 | // stub stub stub |
| 3217 | // +-------+ +---------+ +---------+ +---------+ |
| 3218 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3219 | // +-------+ +---------+ +---------+ +---------+ |
| 3220 | // | | | | |
| 3221 | // | RESTSubReq | | | |
| 3222 | // |---------------->| | | |
| 3223 | // | RESTSubResp | | | |
| 3224 | // |<----------------| | | |
| 3225 | // | | RouteCreate | | |
| 3226 | // | |--------------------------->| |
| 3227 | // | | RouteResponse| | |
| 3228 | // | |<---------------------------| |
| 3229 | // | | SubReq | | |
| 3230 | // | |------------->| | |
| 3231 | // | | SubResp | | |
| 3232 | // | |<-------------| | |
| 3233 | // | RESTNotif1 | | | |
| 3234 | // |<----------------| | | |
| 3235 | // | RESTSubReq | | | |
| 3236 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3237 | // |---------------->| | | |
| 3238 | // | RESTNotif1 | | | |
| 3239 | // | [for initial e2 subDetail] | | |
| 3240 | // |<----------------| | | |
| 3241 | // | | RouteCreate | | |
| 3242 | // | |--------------------------->| |
| 3243 | // | | RouteResponse| | |
| 3244 | // | |<---------------------------| |
| 3245 | // | | SubReq | | |
| 3246 | // | |------------->| | |
| 3247 | // | | SubResp | | |
| 3248 | // | |<-------------| | |
| 3249 | // | RESTNotif1 | | | |
| 3250 | // |<----------------| | | |
| 3251 | // | RESTSubReq | | | |
| 3252 | // | [without RESTsubsId initial request] | |
| 3253 | // |---------------->| | | |
| 3254 | // | RESTNotif1 | | | |
| 3255 | // |<----------------| | | |
| 3256 | // | RESTSubDelReq | | | |
| 3257 | // |---------------->| | | |
| 3258 | // | RESTSubDelResp| | | |
| 3259 | // |<----------------| | | |
| 3260 | // | | SubDelReq | | |
| 3261 | // | |------------->| | |
| 3262 | // | | SubDelResp | | |
| 3263 | // | |<-------------| | |
| 3264 | // | | SubDelReq | | |
| 3265 | // | |------------->| | |
| 3266 | // | | SubDelResp | | |
| 3267 | // | |<-------------| | |
| 3268 | // | | | | |
| 3269 | // |
| 3270 | //----------------------------------------------------------------------------- |
| 3271 | |
| 3272 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3273 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3274 | |
| 3275 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3276 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3277 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3278 | Counter{cRestSubRespToXapp, 3}, |
| 3279 | Counter{cSubReqToE2, 2}, |
| 3280 | Counter{cSubRespFromE2, 2}, |
| 3281 | Counter{cRestSubNotifToXapp, 4}, |
| 3282 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3283 | Counter{cSubDelReqToE2, 2}, |
| 3284 | Counter{cSubDelRespFromE2, 2}, |
| 3285 | Counter{cRestSubDelRespToXapp, 1}, |
| 3286 | }) |
| 3287 | |
| 3288 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3289 | |
| 3290 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3291 | |
| 3292 | <-time.After(100 * time.Millisecond) |
| 3293 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 3294 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3295 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3296 | params2.SetSubscriptionID(&restSubId) |
| 3297 | |
| 3298 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3299 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3300 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3301 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3302 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3303 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3304 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3305 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3306 | xappConn1.DecrementRequestCount() |
| 3307 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3308 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3309 | |
| 3310 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3311 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3312 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3313 | assert.NotEqual(t, e2SubsId2, 0) |
| 3314 | |
| 3315 | <-time.After(100 * time.Millisecond) |
| 3316 | |
| 3317 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3318 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3319 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3320 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3321 | // md5sum shall find the original request |
| 3322 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3323 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3324 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3325 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3326 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3327 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3328 | // Delete both e2 subscriptions |
| 3329 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3330 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3331 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3332 | |
| 3333 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3334 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3335 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3336 | } |
| 3337 | |
| 3338 | //----------------------------------------------------------------------------- |
| 3339 | // stub stub stub |
| 3340 | // +-------+ +---------+ +---------+ +---------+ |
| 3341 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3342 | // +-------+ +---------+ +---------+ +---------+ |
| 3343 | // | | | | |
| 3344 | // | RESTSubReq | | | |
| 3345 | // |---------------->| | | |
| 3346 | // | RESTSubResp | | | |
| 3347 | // |<----------------| | | |
| 3348 | // | | RouteCreate | | |
| 3349 | // | |--------------------------->| |
| 3350 | // | | RouteResponse| | |
| 3351 | // | |<---------------------------| |
| 3352 | // | | SubReq | | |
| 3353 | // | |------------->| | |
| 3354 | // | | SubResp | | |
| 3355 | // | |<-------------| | |
| 3356 | // | RESTNotif1 | | | |
| 3357 | // |<----------------| | | |
| 3358 | // | RESTSubReq | | | |
| 3359 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3360 | // |---------------->| | | |
| 3361 | // | RESTNotif1 | | | |
| 3362 | // | [for initial e2 subDetail] | | |
| 3363 | // |<----------------| | | |
| 3364 | // | | RouteCreate | | |
| 3365 | // | |--------------------------->| |
| 3366 | // | | RouteResponse| | |
| 3367 | // | |<---------------------------| |
| 3368 | // | | SubReq | | |
| 3369 | // | |------------->| | |
| 3370 | // | | SubResp | | |
| 3371 | // | |<-------------| | |
| 3372 | // | RESTNotif1 | | | |
| 3373 | // |<----------------| | | |
| 3374 | // | RESTSubDelReq | | | |
| 3375 | // |---------------->| | | |
| 3376 | // | RESTSubDelResp| | | |
| 3377 | // |<----------------| | | |
| 3378 | // | | SubDelReq | | |
| 3379 | // | |------------->| | |
| 3380 | // | | SubDelResp | | |
| 3381 | // | |<-------------| | |
| 3382 | // | | SubDelReq | | |
| 3383 | // | |------------->| | |
| 3384 | // | | SubDelResp | | |
| 3385 | // | |<-------------| | |
| 3386 | // | RESTSubReq | | | |
| 3387 | // | [with RESTsubsId initial request] | |
| 3388 | // |---------------->| | | |
| 3389 | // | RESTSubResp | | | |
| 3390 | // |<----------------| | | |
| 3391 | // | | RouteCreate | | |
| 3392 | // | |--------------------------->| |
| 3393 | // | | RouteResponse| | |
| 3394 | // | |<---------------------------| |
| 3395 | // | | SubReq | | |
| 3396 | // | |------------->| | |
| 3397 | // | | SubResp | | |
| 3398 | // | |<-------------| | |
| 3399 | // | RESTNotif1 | | | |
| 3400 | // |<----------------| | | |
| 3401 | // | | | | |
| 3402 | // |
| 3403 | //----------------------------------------------------------------------------- |
| 3404 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3405 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3406 | |
| 3407 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3408 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3409 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3410 | Counter{cRestSubRespToXapp, 3}, |
| 3411 | Counter{cSubReqToE2, 3}, |
| 3412 | Counter{cSubRespFromE2, 3}, |
| 3413 | Counter{cRestSubNotifToXapp, 4}, |
| 3414 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3415 | Counter{cSubDelReqToE2, 3}, |
| 3416 | Counter{cSubDelRespFromE2, 3}, |
| 3417 | Counter{cRestSubDelRespToXapp, 2}, |
| 3418 | }) |
| 3419 | |
| 3420 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3421 | |
| 3422 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3423 | |
| 3424 | <-time.After(100 * time.Millisecond) |
| 3425 | |
| 3426 | // Send modified requst, this time with e2 subscriptions. |
| 3427 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3428 | params2.SetSubscriptionID(&restSubId) |
| 3429 | |
| 3430 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3431 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3432 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3433 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3434 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3435 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3436 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3437 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3438 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3439 | |
| 3440 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3441 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3442 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3443 | assert.NotEqual(t, e2SubsId2, 0) |
| 3444 | |
| 3445 | <-time.After(100 * time.Millisecond) |
| 3446 | |
| 3447 | // Delete both e2 subscriptions |
| 3448 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3449 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3450 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3451 | |
| 3452 | waitSubsCleanup(t, e2SubsId, 10) |
| 3453 | |
| 3454 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3455 | // but the restsubscription has been already removed. This shall trigger a |
| 3456 | // fresh create. |
| 3457 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3458 | |
| 3459 | <-time.After(100 * time.Millisecond) |
| 3460 | |
| 3461 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3462 | |
| 3463 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3464 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3465 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3466 | } |
| 3467 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3468 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3469 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3470 | |
| 3471 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3472 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3473 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3474 | Counter{cSubReqToE2, 1}, |
| 3475 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3476 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3477 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3478 | Counter{cSubDelReqToE2, 1}, |
| 3479 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3480 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3481 | }) |
| 3482 | |
| 3483 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3484 | |
| 3485 | //Subs Create |
| 3486 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3487 | |
| 3488 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3489 | |
| 3490 | //Subs Delete |
| 3491 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3492 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3493 | |
| 3494 | seqBef := mainCtrl.get_msgcounter(t) |
| 3495 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3496 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3497 | |
| 3498 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3499 | |
| 3500 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3501 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3502 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3503 | } |
| 3504 | |
| 3505 | //----------------------------------------------------------------------------- |
| 3506 | // TestRESTSubReqDelReq |
| 3507 | // |
| 3508 | // stub stub |
| 3509 | // +-------+ +---------+ +---------+ |
| 3510 | // | xapp | | submgr | | e2term | |
| 3511 | // +-------+ +---------+ +---------+ |
| 3512 | // | | | |
| 3513 | // | RESTSubReq | | |
| 3514 | // |---------------->| | |
| 3515 | // | | | |
| 3516 | // | RESTSubResp | | |
| 3517 | // |<----------------| | |
| 3518 | // | | SubReq | |
| 3519 | // | |------------->| |
| 3520 | // | RESTSubDelReq | | |
| 3521 | // |---------------->| | |
| 3522 | // | RESTSubDelResp | | |
| 3523 | // | unsuccess | | |
| 3524 | // |<----------------| | |
| 3525 | // | | SubResp | |
| 3526 | // | |<-------------| |
| 3527 | // | RESTNotif1 | | |
| 3528 | // |<----------------| | |
| 3529 | // | | | |
| 3530 | // | [SUBS DELETE] | |
| 3531 | // | | | |
| 3532 | // |
| 3533 | //----------------------------------------------------------------------------- |
| 3534 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3535 | CaseBegin("TestRESTSubReqDelReq") |
| 3536 | |
| 3537 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3538 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3539 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3540 | Counter{cSubReqToE2, 1}, |
| 3541 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3542 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3543 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3544 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3545 | Counter{cSubDelReqToE2, 1}, |
| 3546 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3547 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3548 | }) |
| 3549 | |
| 3550 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3551 | |
| 3552 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3553 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3554 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3555 | |
| 3556 | // Del. This will fail as processing of the subscription |
| 3557 | // is still ongoing in submgr. Deletion is not allowed before |
| 3558 | // subscription creation has been completed. |
| 3559 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3560 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3561 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3562 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3563 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3564 | |
| 3565 | // Retry del |
| 3566 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3567 | |
| 3568 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3569 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3570 | |
| 3571 | // Wait that subs is cleaned |
| 3572 | waitSubsCleanup(t, e2SubsId, 10) |
| 3573 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3574 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3575 | } |
| 3576 | |
| 3577 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3578 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3579 | } |
| 3580 | |
| 3581 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3582 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3583 | |
| 3584 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3585 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3586 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3587 | Counter{cSubReqToE2, 2}, |
| 3588 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3589 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3590 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3591 | Counter{cSubDelReqToE2, 2}, |
| 3592 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3593 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3594 | }) |
| 3595 | |
| 3596 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3597 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3598 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3599 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3600 | |
| 3601 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3602 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3603 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3604 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3605 | |
| 3606 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3607 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3608 | |
| 3609 | //XappConn1 receives both of the responses |
| 3610 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3611 | |
| 3612 | //Resp1 |
| 3613 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3614 | //Resp2 |
| 3615 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3616 | |
| 3617 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3618 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3619 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3620 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3621 | |
| 3622 | //Del1 |
| 3623 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3624 | //Del2 |
| 3625 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3626 | |
| 3627 | //Wait that subs is cleaned |
| 3628 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3629 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3630 | |
| 3631 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3632 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3633 | } |
| 3634 | |
| 3635 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3636 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3637 | |
| 3638 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3639 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3640 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3641 | Counter{cSubReqToE2, 2}, |
| 3642 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3643 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3644 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3645 | Counter{cSubDelReqToE2, 2}, |
| 3646 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3647 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3648 | }) |
| 3649 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3650 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3651 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3652 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3653 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3654 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3655 | params.SetMeid("RAN_NAME_2") |
| 3656 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3657 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3658 | |
| 3659 | //Del1 |
| 3660 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3661 | //Del2 |
| 3662 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3663 | |
| 3664 | //Wait that subs is cleaned |
| 3665 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3666 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3667 | |
| 3668 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3669 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3670 | } |
| 3671 | |
| 3672 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3673 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3674 | |
| 3675 | // Init counter check |
| 3676 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3677 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3678 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3679 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3680 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3681 | Counter{cSubReReqToE2, 1}, |
| 3682 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3683 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3684 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3685 | Counter{cSubDelReqToE2, 1}, |
| 3686 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3687 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3688 | }) |
| 3689 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3690 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3691 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3692 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3693 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3694 | |
| 3695 | // Catch the first message and ignore it |
| 3696 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3697 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3698 | |
| 3699 | // The second request is being handled normally |
| 3700 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3701 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3702 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3703 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3704 | |
| 3705 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3706 | |
| 3707 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3708 | |
| 3709 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3710 | //Wait that subs is cleaned |
| 3711 | waitSubsCleanup(t, e2SubsId, 10) |
| 3712 | |
| 3713 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3714 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3715 | } |
| 3716 | |
| 3717 | //----------------------------------------------------------------------------- |
| 3718 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3719 | // |
| 3720 | // stub stub |
| 3721 | // +-------+ +---------+ +---------+ |
| 3722 | // | xapp | | submgr | | e2term | |
| 3723 | // +-------+ +---------+ +---------+ |
| 3724 | // | | | |
| 3725 | // | RESTSubReq | | |
| 3726 | // |---------------->| | |
| 3727 | // | | | |
| 3728 | // | RESTSubResp | | |
| 3729 | // |<----------------| | |
| 3730 | // | | SubReq | |
| 3731 | // | |------------->| |
| 3732 | // | | | |
| 3733 | // | | | |
| 3734 | // | | SubReq | |
| 3735 | // | |------------->| |
| 3736 | // | | | |
| 3737 | // | | SubDelReq | |
| 3738 | // | |------------->| |
| 3739 | // | | | |
| 3740 | // | | | |
| 3741 | // | | SubDelReq | |
| 3742 | // | |------------->| |
| 3743 | // | | | |
| 3744 | // | | | |
| 3745 | // | | SubDelResp | |
| 3746 | // | |<-------------| |
| 3747 | // | RESTNotif | | |
| 3748 | // | unsuccess | | |
| 3749 | // |<----------------| | |
| 3750 | // | | | |
| 3751 | // | [SUBS DELETE] | |
| 3752 | // | | | |
| 3753 | // |
| 3754 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3755 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3756 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3757 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3758 | |
| 3759 | // Init counter check |
| 3760 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3761 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3762 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3763 | Counter{cSubReqToE2, 1}, |
| 3764 | Counter{cSubReReqToE2, 1}, |
| 3765 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3766 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3767 | Counter{cSubDelReqToE2, 1}, |
| 3768 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3769 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3770 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3771 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3772 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3773 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3774 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3775 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3776 | |
| 3777 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3778 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3779 | |
| 3780 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3781 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3782 | |
| 3783 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3784 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3785 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3786 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3787 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3788 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3789 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3790 | // Wait that subs is cleaned |
| 3791 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3792 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3793 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3794 | } |
| 3795 | |
| 3796 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3797 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3798 | |
| 3799 | // Init counter check |
| 3800 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3801 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3802 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3803 | Counter{cSubReqToE2, 1}, |
| 3804 | Counter{cSubReReqToE2, 1}, |
| 3805 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3806 | Counter{cSubDelReReqToE2, 1}, |
| 3807 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3808 | Counter{cSubDelReqToE2, 1}, |
| 3809 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3810 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3811 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3812 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3813 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3814 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3815 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3816 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3817 | |
| 3818 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3819 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3820 | |
| 3821 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3822 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3823 | |
| 3824 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3825 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3826 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3827 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3828 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3829 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3830 | |
| 3831 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3832 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3833 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3834 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3835 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3836 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3837 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3838 | } |
| 3839 | |
| 3840 | //----------------------------------------------------------------------------- |
| 3841 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3842 | // |
| 3843 | // stub stub |
| 3844 | // +-------+ +---------+ +---------+ |
| 3845 | // | xapp | | submgr | | e2term | |
| 3846 | // +-------+ +---------+ +---------+ |
| 3847 | // | | | |
| 3848 | // | RESTSubReq | | |
| 3849 | // |---------------->| | |
| 3850 | // | | | |
| 3851 | // | RESTSubResp | | |
| 3852 | // |<----------------| | |
| 3853 | // | | SubReq | |
| 3854 | // | |------------->| |
| 3855 | // | | | |
| 3856 | // | | | |
| 3857 | // | | SubReq | |
| 3858 | // | |------------->| |
| 3859 | // | | | |
| 3860 | // | | SubDelReq | |
| 3861 | // | |------------->| |
| 3862 | // | | | |
| 3863 | // | | | |
| 3864 | // | | SubDelReq | |
| 3865 | // | |------------->| |
| 3866 | // | | | |
| 3867 | // | | | |
| 3868 | // | | SubDelResp | |
| 3869 | // | |<-------------| |
| 3870 | // | RESTNotif | | |
| 3871 | // | unsuccess | | |
| 3872 | // |<----------------| | |
| 3873 | // | | | |
| 3874 | // | [SUBS DELETE] | |
| 3875 | // | | | |
| 3876 | // |
| 3877 | //----------------------------------------------------------------------------- |
| 3878 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3879 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3880 | |
| 3881 | // Init counter check |
| 3882 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3883 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3884 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3885 | Counter{cSubReqToE2, 1}, |
| 3886 | Counter{cSubReReqToE2, 1}, |
| 3887 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3888 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3889 | Counter{cSubDelReqToE2, 1}, |
| 3890 | Counter{cSubDelReReqToE2, 1}, |
| 3891 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3892 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3893 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3894 | }) |
| 3895 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3896 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3897 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3898 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3899 | |
| 3900 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3901 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3902 | |
| 3903 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3904 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3905 | |
| 3906 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3907 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3908 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3909 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3910 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3911 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3912 | |
| 3913 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3914 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3915 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3916 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3917 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3918 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3919 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3920 | } |
| 3921 | |
| 3922 | //----------------------------------------------------------------------------- |
| 3923 | // TestRESTSubReqSubFailRespInSubmgr |
| 3924 | // |
| 3925 | // stub stub |
| 3926 | // +-------+ +---------+ +---------+ |
| 3927 | // | xapp | | submgr | | e2term | |
| 3928 | // +-------+ +---------+ +---------+ |
| 3929 | // | | | |
| 3930 | // | RESTSubReq | | |
| 3931 | // |---------------->| | |
| 3932 | // | | | |
| 3933 | // | RESTSubResp | | |
| 3934 | // |<----------------| | |
| 3935 | // | | SubReq | |
| 3936 | // | |------------->| |
| 3937 | // | | | |
| 3938 | // | | SubFail | |
| 3939 | // | |<-------------| |
| 3940 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3941 | // | RESTNotif | | |
| 3942 | // | unsuccess | | |
| 3943 | // |<----------------| | |
| 3944 | // | | | |
| 3945 | // | [SUBS DELETE] | |
| 3946 | // | | | |
| 3947 | // |
| 3948 | //----------------------------------------------------------------------------- |
| 3949 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3950 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3951 | |
| 3952 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3953 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3954 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3955 | Counter{cSubReqToE2, 1}, |
| 3956 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3957 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3958 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3959 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3960 | }) |
| 3961 | |
| 3962 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3963 | const e2Timeout int64 = 2 |
| 3964 | const e2RetryCount int64 = 1 |
| 3965 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3966 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3967 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3968 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3969 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3970 | |
| 3971 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3972 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3973 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 3974 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3975 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3976 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3977 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3978 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3979 | |
| 3980 | // REST subscription sill there to be deleted |
| 3981 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3982 | |
| 3983 | // Wait that subs is cleaned |
| 3984 | waitSubsCleanup(t, e2SubsId, 10) |
| 3985 | |
| 3986 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3987 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3988 | } |
| 3989 | |
| 3990 | //----------------------------------------------------------------------------- |
| 3991 | // TestRESTSubDelReqRetryInSubmgr |
| 3992 | // |
| 3993 | // stub stub |
| 3994 | // +-------+ +---------+ +---------+ |
| 3995 | // | xapp | | submgr | | e2term | |
| 3996 | // +-------+ +---------+ +---------+ |
| 3997 | // | | | |
| 3998 | // | [SUBS CREATE] | |
| 3999 | // | | | |
| 4000 | // | | | |
| 4001 | // | RESTSubDelReq | | |
| 4002 | // |---------------->| | |
| 4003 | // | | | |
| 4004 | // | RESTSubDelResp | | |
| 4005 | // |<----------------| | |
| 4006 | // | | SubDelReq | |
| 4007 | // | |------------->| |
| 4008 | // | | | |
| 4009 | // | | SubDelReq | |
| 4010 | // | |------------->| |
| 4011 | // | | | |
| 4012 | // | | SubDelResp | |
| 4013 | // | |<-------------| |
| 4014 | // | | | |
| 4015 | // |
| 4016 | //----------------------------------------------------------------------------- |
| 4017 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 4018 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 4019 | |
| 4020 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4021 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4022 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4023 | Counter{cSubReqToE2, 1}, |
| 4024 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4025 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4026 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4027 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4028 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4029 | Counter{cSubDelReReqToE2, 1}, |
| 4030 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4031 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4032 | }) |
| 4033 | // Req |
| 4034 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4035 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4036 | |
| 4037 | // Del |
| 4038 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4039 | |
| 4040 | // E2t: Receive 1st SubsDelReq |
| 4041 | e2termConn1.RecvSubsDelReq(t) |
| 4042 | |
| 4043 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4044 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4045 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4046 | |
| 4047 | //Wait that subs is cleaned |
| 4048 | waitSubsCleanup(t, e2SubsId, 10) |
| 4049 | |
| 4050 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4051 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | } |
| 4053 | |
| 4054 | //----------------------------------------------------------------------------- |
| 4055 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4056 | // |
| 4057 | // stub stub |
| 4058 | // +-------+ +---------+ +---------+ |
| 4059 | // | xapp | | submgr | | e2term | |
| 4060 | // +-------+ +---------+ +---------+ |
| 4061 | // | | | |
| 4062 | // | [SUBS CREATE] | |
| 4063 | // | | | |
| 4064 | // | | | |
| 4065 | // | RESTSubDelReq | | |
| 4066 | // |---------------->| | |
| 4067 | // | | | |
| 4068 | // | RESTSubDelResp | | |
| 4069 | // |<----------------| | |
| 4070 | // | | SubDelReq | |
| 4071 | // | |------------->| |
| 4072 | // | | | |
| 4073 | // | | SubDelReq | |
| 4074 | // | |------------->| |
| 4075 | // | | | |
| 4076 | // | | | |
| 4077 | // |
| 4078 | //----------------------------------------------------------------------------- |
| 4079 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4080 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4081 | |
| 4082 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4083 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4084 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4085 | Counter{cSubReqToE2, 1}, |
| 4086 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4087 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4088 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4089 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4090 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4091 | Counter{cSubDelReReqToE2, 1}, |
| 4092 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4093 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4094 | }) |
| 4095 | |
| 4096 | // Req |
| 4097 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4098 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4099 | |
| 4100 | // Del |
| 4101 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4102 | |
| 4103 | // E2t: Receive 1st SubsDelReq |
| 4104 | e2termConn1.RecvSubsDelReq(t) |
| 4105 | |
| 4106 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4107 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4108 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4109 | |
| 4110 | //Wait that subs is cleaned |
| 4111 | waitSubsCleanup(t, e2SubsId, 10) |
| 4112 | |
| 4113 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4114 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4115 | } |
| 4116 | |
| 4117 | //----------------------------------------------------------------------------- |
| 4118 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4119 | // |
| 4120 | // stub stub |
| 4121 | // +-------+ +---------+ +---------+ |
| 4122 | // | xapp | | submgr | | e2term | |
| 4123 | // +-------+ +---------+ +---------+ |
| 4124 | // | | | |
| 4125 | // | [SUBS CREATE] | |
| 4126 | // | | | |
| 4127 | // | | | |
| 4128 | // | RESTSubDelReq | | |
| 4129 | // |---------------->| | |
| 4130 | // | | | |
| 4131 | // | RESTSubDelResp | | |
| 4132 | // |<----------------| | |
| 4133 | // | | SubDelReq | |
| 4134 | // | |------------->| |
| 4135 | // | | | |
| 4136 | // | | SubDelFail | |
| 4137 | // | |<-------------| |
| 4138 | // | | | |
| 4139 | // |
| 4140 | //----------------------------------------------------------------------------- |
| 4141 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4142 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4143 | |
| 4144 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4145 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4146 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4147 | Counter{cSubReqToE2, 1}, |
| 4148 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4149 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4150 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4151 | Counter{cSubDelReqToE2, 1}, |
| 4152 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4153 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4154 | }) |
| 4155 | |
| 4156 | // Req |
| 4157 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4158 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4159 | |
| 4160 | // Del |
| 4161 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4162 | |
| 4163 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4164 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4165 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4166 | |
| 4167 | //Wait that subs is cleaned |
| 4168 | waitSubsCleanup(t, e2SubsId, 10) |
| 4169 | |
| 4170 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4171 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4172 | } |
| 4173 | |
| 4174 | //----------------------------------------------------------------------------- |
| 4175 | // TestRESTSubReqAndSubDelOkSameAction |
| 4176 | // |
| 4177 | // stub stub |
| 4178 | // +-------+ +-------+ +---------+ +---------+ |
| 4179 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4180 | // +-------+ +-------+ +---------+ +---------+ |
| 4181 | // | | | | |
| 4182 | // | | RESTSubReq1 | | |
| 4183 | // | |---------------->| | |
| 4184 | // | | | | |
| 4185 | // | | RESTSubResp1 | | |
| 4186 | // | |<----------------| | |
| 4187 | // | | | | |
| 4188 | // | | | SubReq1 | |
| 4189 | // | | |------------->| |
| 4190 | // | | | SubResp1 | |
| 4191 | // | | |<-------------| |
| 4192 | // | | RESTNotif1 | | |
| 4193 | // | |<----------------| | |
| 4194 | // | | | | |
| 4195 | // | RESTSubReq2 | | |
| 4196 | // |------------------------------>| | |
| 4197 | // | | | | |
| 4198 | // | RESTSubResp2 | | |
| 4199 | // |<------------------------------| | |
| 4200 | // | | | | |
| 4201 | // | | RESTNotif2 | | |
| 4202 | // |<------------------------------| | |
| 4203 | // | | | | |
| 4204 | // | | RESTSubDelReq1 | | |
| 4205 | // | |---------------->| | |
| 4206 | // | | | | |
| 4207 | // | | RESTSubDelResp1 | | |
| 4208 | // | |<----------------| | |
| 4209 | // | | | | |
| 4210 | // | RESTSubDelReq2 | | |
| 4211 | // |------------------------------>| | |
| 4212 | // | | | | |
| 4213 | // | RESTSubDelResp2 | | |
| 4214 | // |<------------------------------| | |
| 4215 | // | | | | |
| 4216 | // | | | SubDelReq2 | |
| 4217 | // | | |------------->| |
| 4218 | // | | | | |
| 4219 | // | | | SubDelResp2 | |
| 4220 | // | | |<-------------| |
| 4221 | // | | | | |
| 4222 | // |
| 4223 | //----------------------------------------------------------------------------- |
| 4224 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4225 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4226 | |
| 4227 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4228 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4229 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4230 | Counter{cSubReqToE2, 1}, |
| 4231 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4232 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4233 | Counter{cMergedSubscriptions, 1}, |
| 4234 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4235 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4236 | Counter{cSubDelReqToE2, 1}, |
| 4237 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4238 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4239 | }) |
| 4240 | |
| 4241 | // Req1 |
| 4242 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4243 | |
| 4244 | //Subs Create |
| 4245 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4246 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4247 | |
| 4248 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4249 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4250 | params.SetMeid("RAN_NAME_1") |
| 4251 | |
| 4252 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4253 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4254 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4255 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4256 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4257 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4258 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4259 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4260 | |
| 4261 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4262 | |
| 4263 | // Del1 |
| 4264 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4265 | |
| 4266 | // Del2 |
| 4267 | deleteXapp2Subscription(t, &restSubId2) |
| 4268 | |
| 4269 | //Wait that subs is cleaned |
| 4270 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4271 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4272 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4273 | } |
| 4274 | |
| 4275 | //----------------------------------------------------------------------------- |
| 4276 | // TestSubReqAndSubDelOkSameActionParallel |
| 4277 | // |
| 4278 | // stub stub stub |
| 4279 | // +-------+ +-------+ +---------+ +---------+ |
| 4280 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4281 | // +-------+ +-------+ +---------+ +---------+ |
| 4282 | // | | | | |
| 4283 | // | | | | |
| 4284 | // | | | | |
| 4285 | // | | SubReq1 | | |
| 4286 | // | |------------->| | |
| 4287 | // | | | | |
| 4288 | // | | | SubReq1 | |
| 4289 | // | | |------------->| |
| 4290 | // | SubReq2 | | |
| 4291 | // |--------------------------->| | |
| 4292 | // | | | SubResp1 | |
| 4293 | // | | |<-------------| |
| 4294 | // | | SubResp1 | | |
| 4295 | // | |<-------------| | |
| 4296 | // | | | SubReq2 | |
| 4297 | // | | |------------->| |
| 4298 | // | | | | |
| 4299 | // | | | SubResp2 | |
| 4300 | // | | |<-------------| |
| 4301 | // | SubResp2 | | |
| 4302 | // |<---------------------------| | |
| 4303 | // | | | | |
| 4304 | // | | SubDelReq 1 | | |
| 4305 | // | |------------->| | |
| 4306 | // | | | | |
| 4307 | // | | SubDelResp 1 | | |
| 4308 | // | |<-------------| | |
| 4309 | // | | | | |
| 4310 | // | SubDelReq 2 | | |
| 4311 | // |--------------------------->| | |
| 4312 | // | | | | |
| 4313 | // | | | SubDelReq 2 | |
| 4314 | // | | |------------->| |
| 4315 | // | | | | |
| 4316 | // | | | SubDelReq 2 | |
| 4317 | // | | |------------->| |
| 4318 | // | | | | |
| 4319 | // | SubDelResp 2 | | |
| 4320 | // |<---------------------------| | |
| 4321 | // |
| 4322 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4323 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4324 | |
| 4325 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4326 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4327 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4328 | Counter{cSubReqToE2, 2}, |
| 4329 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4330 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4331 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4332 | Counter{cSubDelReqToE2, 2}, |
| 4333 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4334 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4335 | }) |
| 4336 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4337 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4338 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4339 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4340 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4341 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4342 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4343 | |
| 4344 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4345 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4346 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4347 | |
| 4348 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4349 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4350 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4351 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4352 | |
| 4353 | // Del1 |
| 4354 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4355 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4356 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4357 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4358 | |
| 4359 | // Del2 |
| 4360 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4361 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4362 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4363 | |
| 4364 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4365 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4366 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4367 | } |
| 4368 | |
| 4369 | //----------------------------------------------------------------------------- |
| 4370 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4371 | // |
| 4372 | // stub stub stub |
| 4373 | // +-------+ +-------+ +---------+ +---------+ |
| 4374 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4375 | // +-------+ +-------+ +---------+ +---------+ |
| 4376 | // | | | | |
| 4377 | // | | | | |
| 4378 | // | | | | |
| 4379 | // | | RESTSubReq1 | | |
| 4380 | // | |---------------->| | |
| 4381 | // | | | | |
| 4382 | // | | RESTSubResp1 | | |
| 4383 | // | |<----------------| | |
| 4384 | // | | | SubReq1 | |
| 4385 | // | | |------------->| |
| 4386 | // | RESTSubReq2 | | |
| 4387 | // |------------------------------>| | |
| 4388 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4389 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4390 | // |<------------------------------| | |
| 4391 | // | | | SubReq1 | |
| 4392 | // | | |------------->| |
| 4393 | // | | | | |
| 4394 | // | | | | |
| 4395 | // | | | SubDelReq | |
| 4396 | // | | |------------->| |
| 4397 | // | | | | |
| 4398 | // | | | SubDelResp | |
| 4399 | // | | |<-------------| |
| 4400 | // | | RESTNotif1 | | |
| 4401 | // | | unsuccess | | |
| 4402 | // | |<----------------| | |
| 4403 | // | RESTNotif2 | | |
| 4404 | // | | unsuccess | | |
| 4405 | // |<------------------------------| | |
| 4406 | // | | | | |
| 4407 | // | | RESTSubDelReq1 | | |
| 4408 | // | |---------------->| | |
| 4409 | // | | | | |
| 4410 | // | | RESTSubDelResp1 | | |
| 4411 | // | |<----------------| | |
| 4412 | // | | | | |
| 4413 | // | RESTSubDelReq2 | | |
| 4414 | // |------------------------------>| | |
| 4415 | // | | | | |
| 4416 | // | RESTSubDelResp2 | | |
| 4417 | // |<------------------------------| | |
| 4418 | // |
| 4419 | //----------------------------------------------------------------------------- |
| 4420 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4421 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4422 | |
| 4423 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4424 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4425 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4426 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4428 | Counter{cSubReqTimerExpiry, 2}, |
| 4429 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4430 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4431 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4432 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4433 | Counter{cSubDelReqToE2, 1}, |
| 4434 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4435 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4436 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4437 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4438 | |
| 4439 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4440 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4441 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4442 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4443 | |
| 4444 | // Req2 |
| 4445 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4446 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4447 | params2.SetMeid("RAN_NAME_1") |
| 4448 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4449 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4450 | |
| 4451 | //Req1 (retransmitted) |
| 4452 | e2termConn1.RecvSubsReq(t) |
| 4453 | |
| 4454 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4455 | |
| 4456 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4457 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4458 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4459 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4460 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4461 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4462 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4463 | |
| 4464 | // Del1 |
| 4465 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4466 | |
| 4467 | // Del2 |
| 4468 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4469 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4470 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4471 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4472 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4473 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4474 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4475 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4476 | } |
| 4477 | |
| 4478 | //----------------------------------------------------------------------------- |
| 4479 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4480 | // |
| 4481 | // stub stub stub |
| 4482 | // +-------+ +-------+ +---------+ +---------+ |
| 4483 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4484 | // +-------+ +-------+ +---------+ +---------+ |
| 4485 | // | | | | |
| 4486 | // | | | | |
| 4487 | // | | | | |
| 4488 | // | | RESTSubReq1 | | |
| 4489 | // | |---------------->| | |
| 4490 | // | | | | |
| 4491 | // | | RESTSubResp1 | | |
| 4492 | // | |<----------------| | |
| 4493 | // | | | SubReq1 | |
| 4494 | // | | |------------->| |
| 4495 | // | RESTSubReq2 | | |
| 4496 | // |------------------------------>| | |
| 4497 | // | | | | |
| 4498 | // | RESTSubDelResp2 | | |
| 4499 | // |<------------------------------| | |
| 4500 | // | | | SubFail1 | |
| 4501 | // | | |<-------------| |
| 4502 | // | | | | |
| 4503 | // | | RESTNotif1 | | |
| 4504 | // | | unsuccess | | |
| 4505 | // | |<----------------| | |
| 4506 | // | RESTNotif2 | | |
| 4507 | // | | unsuccess | | |
| 4508 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4509 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4510 | // | | 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] | 4511 | // | |---------------->| | |
| 4512 | // | | | | |
| 4513 | // | | RESTSubDelResp1 | | |
| 4514 | // | |<----------------| | |
| 4515 | // | | | | |
| 4516 | // | RESTSubDelReq2 | | |
| 4517 | // |------------------------------>| | |
| 4518 | // | | | | |
| 4519 | // | RESTSubDelResp2 | | |
| 4520 | // |<------------------------------| | |
| 4521 | // |
| 4522 | //----------------------------------------------------------------------------- |
| 4523 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4524 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4525 | |
| 4526 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4527 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4528 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4529 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4530 | Counter{cSubReqToE2, 1}, |
| 4531 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4532 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4533 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4534 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4535 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | }) |
| 4537 | |
| 4538 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4539 | |
| 4540 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4541 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4542 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4543 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4544 | |
| 4545 | // Req2 |
| 4546 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4547 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4548 | params2.SetMeid("RAN_NAME_1") |
| 4549 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4550 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4551 | |
| 4552 | // E2t: send SubsFail (first) |
| 4553 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4554 | fparams1.Set(crereq1) |
| 4555 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4556 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4557 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4558 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4559 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4560 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4561 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | |
| 4563 | // Del1 |
| 4564 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4565 | |
| 4566 | // Del2 |
| 4567 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4568 | |
| 4569 | //Wait that subs is cleaned |
| 4570 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4571 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4572 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4573 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4574 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4575 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4576 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4577 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4578 | |
| 4579 | // Init counter check |
| 4580 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4581 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4582 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4583 | Counter{cSubReqToE2, 1}, |
| 4584 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4585 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4586 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4587 | Counter{cSubDelReqToE2, 1}, |
| 4588 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4589 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4590 | }) |
| 4591 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4592 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4593 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4594 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4595 | |
| 4596 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4597 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4598 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4599 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4600 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4601 | |
| 4602 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4603 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4604 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4605 | |
| 4606 | // Wait that subs is cleaned |
| 4607 | waitSubsCleanup(t, e2SubsId, 10) |
| 4608 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4609 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4610 | } |
| 4611 | |
| 4612 | //----------------------------------------------------------------------------- |
| 4613 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4614 | // |
| 4615 | // stub stub |
| 4616 | // +-------+ +---------+ +---------+ |
| 4617 | // | xapp | | submgr | | e2term | |
| 4618 | // +-------+ +---------+ +---------+ |
| 4619 | // | | | |
| 4620 | // | RESTSubReq | | |
| 4621 | // |---------------->| | |
| 4622 | // | | | |
| 4623 | // | RESTSubResp | | |
| 4624 | // |<----------------| | |
| 4625 | // | | SubReq | |
| 4626 | // | |------------->| |
| 4627 | // | | | |
| 4628 | // | | SubResp | |
| 4629 | // | |<-------------| |
| 4630 | // | | | |
| 4631 | // | RESTNotif | | |
| 4632 | // |<----------------| | |
| 4633 | // | | | |
| 4634 | // | RESTSubReq | | |
| 4635 | // |---------------->| | |
| 4636 | // | | | |
| 4637 | // | RESTSubResp | | |
| 4638 | // |<----------------| | |
| 4639 | // | | SubReq | |
| 4640 | // | |------------->| |
| 4641 | // | | | |
| 4642 | // | | SubResp | |
| 4643 | // | |<-------------| |
| 4644 | // | | | |
| 4645 | // | RESTNotif | | |
| 4646 | // |<----------------| | |
| 4647 | // | | | |
| 4648 | // | RESTSubDelReq | | |
| 4649 | // |---------------->| | |
| 4650 | // | | | |
| 4651 | // | | SubDelReq | |
| 4652 | // | |------------->| |
| 4653 | // | | | |
| 4654 | // | | SubDelResp | |
| 4655 | // | |<-------------| |
| 4656 | // | | | |
| 4657 | // | RESTSubDelResp | | |
| 4658 | // |<----------------| | |
| 4659 | // |
| 4660 | //----------------------------------------------------------------------------- |
| 4661 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4662 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4663 | |
| 4664 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4665 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4666 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4667 | Counter{cSubReqToE2, 2}, |
| 4668 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4669 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4670 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4671 | Counter{cSubDelReqToE2, 1}, |
| 4672 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4673 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4674 | }) |
| 4675 | |
| 4676 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4677 | const e2Timeout int64 = 1 |
| 4678 | const e2RetryCount int64 = 0 |
| 4679 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4680 | |
| 4681 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4682 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4683 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4684 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4685 | |
| 4686 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4687 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4688 | |
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) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4691 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4692 | params.SetTimeToWait("w200ms") |
| 4693 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4694 | |
| 4695 | // Del |
| 4696 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4697 | |
| 4698 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4699 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4700 | |
| 4701 | // Wait that subs is cleaned |
| 4702 | waitSubsCleanup(t, e2SubsId, 10) |
| 4703 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4704 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4705 | } |
| 4706 | |
| 4707 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4708 | // TestRESTSubReqPolicyChangeNOk |
| 4709 | // |
| 4710 | // stub stub |
| 4711 | // +-------+ +---------+ +---------+ |
| 4712 | // | xapp | | submgr | | e2term | |
| 4713 | // +-------+ +---------+ +---------+ |
| 4714 | // | | | |
| 4715 | // | RESTSubReq | | |
| 4716 | // |---------------->| | |
| 4717 | // | | | |
| 4718 | // | RESTSubResp | | |
| 4719 | // |<----------------| | |
| 4720 | // | | SubReq | |
| 4721 | // | |------------->| |
| 4722 | // | | | |
| 4723 | // | | SubResp | |
| 4724 | // | |<-------------| |
| 4725 | // | | | |
| 4726 | // | RESTNotif | | |
| 4727 | // |<----------------| | |
| 4728 | // | | | |
| 4729 | // | RESTSubReq | | |
| 4730 | // |---------------->| | |
| 4731 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4732 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4733 | // | | | |
| 4734 | // | RESTSubDelReq | | |
| 4735 | // |---------------->| | |
| 4736 | // | | | |
| 4737 | // | | SubDelReq | |
| 4738 | // | |------------->| |
| 4739 | // | | | |
| 4740 | // | | SubDelResp | |
| 4741 | // | |<-------------| |
| 4742 | // | | | |
| 4743 | // | RESTSubDelResp | | |
| 4744 | // |<----------------| | |
| 4745 | // |
| 4746 | //----------------------------------------------------------------------------- |
| 4747 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4748 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4749 | |
| 4750 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4751 | Counter{cRestSubReqFromXapp, 2}, |
| 4752 | Counter{cRestSubRespToXapp, 1}, |
| 4753 | Counter{cSubReqToE2, 1}, |
| 4754 | Counter{cSubRespFromE2, 1}, |
| 4755 | Counter{cRestSubNotifToXapp, 1}, |
| 4756 | Counter{cRestSubFailToXapp, 1}, |
| 4757 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4758 | Counter{cSubDelReqToE2, 1}, |
| 4759 | Counter{cSubDelRespFromE2, 1}, |
| 4760 | Counter{cRestSubDelRespToXapp, 1}, |
| 4761 | }) |
| 4762 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4763 | // Req |
| 4764 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4765 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4766 | |
| 4767 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4768 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4769 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4770 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4771 | params.SetSubscriptionID(&restSubIdUpd) |
| 4772 | params.SetTimeToWait("w200ms") |
| 4773 | |
| 4774 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4775 | assert.Equal(t, restSubId2, "") |
| 4776 | |
| 4777 | // Del |
| 4778 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4779 | |
| 4780 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4781 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4782 | |
| 4783 | // Wait that subs is cleaned |
| 4784 | waitSubsCleanup(t, e2SubsId, 10) |
| 4785 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4786 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4787 | } |
| 4788 | |
| 4789 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4790 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4791 | // |
| 4792 | // stub stub stub |
| 4793 | // +-------+ +---------+ +---------+ +---------+ |
| 4794 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4795 | // +-------+ +---------+ +---------+ +---------+ |
| 4796 | // | | | | |
| 4797 | // | | | | |
| 4798 | // | | | | |
| 4799 | // | RESTSubReq1 | | | |
| 4800 | // |---------------->| | | |
| 4801 | // | | | | |
| 4802 | // | RESTSubResp1 | | | |
| 4803 | // |<----------------| | | |
| 4804 | // | | SubReq1 | | |
| 4805 | // | |------------->| | |
| 4806 | // | | | | |
| 4807 | // | RESTSubReq2 | | | |
| 4808 | // |---------------->| | | |
| 4809 | // | | | | |
| 4810 | // | RESTSubResp2 | | | |
| 4811 | // |<----------------| | | |
| 4812 | // | | SubReq2 | | |
| 4813 | // | |---------------------------->| |
| 4814 | // | | | | |
| 4815 | // | | SubResp1 | | |
| 4816 | // | |<-------------| | |
| 4817 | // | RESTNotif1 | | | |
| 4818 | // |<----------------| | | |
| 4819 | // | | SubResp2 | | |
| 4820 | // | |<----------------------------| |
| 4821 | // | RESTNotif2 | | | |
| 4822 | // |<----------------| | | |
| 4823 | // | | | | |
| 4824 | // | [SUBS 1 DELETE] | | |
| 4825 | // | | | | |
| 4826 | // | [SUBS 2 DELETE] | | |
| 4827 | // | | | | |
| 4828 | // |
| 4829 | //----------------------------------------------------------------------------- |
| 4830 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4831 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4832 | |
| 4833 | // Init counter check |
| 4834 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4835 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4836 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4837 | Counter{cSubReqToE2, 2}, |
| 4838 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4839 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4840 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4841 | Counter{cSubDelReqToE2, 2}, |
| 4842 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4843 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4844 | }) |
| 4845 | |
| 4846 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4847 | |
| 4848 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4849 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4850 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4851 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4852 | |
| 4853 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4854 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4855 | params.SetMeid("RAN_NAME_11") |
| 4856 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4857 | // would not work as notification would not be received |
| 4858 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4859 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4860 | |
| 4861 | // Resp1 |
| 4862 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4863 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4864 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4865 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4866 | |
| 4867 | // Resp2 |
| 4868 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4869 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4870 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4871 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4872 | |
| 4873 | // Delete1 |
| 4874 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4875 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4876 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4877 | |
| 4878 | // Wait that subs is cleaned |
| 4879 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4880 | |
| 4881 | // Delete2 |
| 4882 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4883 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4884 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4885 | |
| 4886 | // Wait that subs is cleaned |
| 4887 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4888 | |
| 4889 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4890 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4891 | } |
| 4892 | |
| 4893 | //----------------------------------------------------------------------------- |
| 4894 | // TestRESTSubReqAsn1EncodeFail |
| 4895 | // |
| 4896 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4897 | // stub stub |
| 4898 | // +-------+ +---------+ +---------+ |
| 4899 | // | xapp | | submgr | | e2term | |
| 4900 | // +-------+ +---------+ +---------+ |
| 4901 | // | | | |
| 4902 | // | RESTSubReq | | |
| 4903 | // |---------------->| | |
| 4904 | // | | | |
| 4905 | // | RESTSubResp | | |
| 4906 | // |<----------------| | |
| 4907 | // | RESTSubDelReq | | |
| 4908 | // |---------------->| | |
| 4909 | // | RESTSubDelResp | | |
| 4910 | // | unsuccess | | |
| 4911 | // |<----------------| | |
| 4912 | // | | | |
| 4913 | // |
| 4914 | //----------------------------------------------------------------------------- |
| 4915 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4916 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4917 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4918 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4919 | |
| 4920 | } |
| 4921 | |
| 4922 | //----------------------------------------------------------------------------- |
| 4923 | // TestRESTSubReqInsertAndSubDelOk |
| 4924 | // |
| 4925 | // stub stub |
| 4926 | // +-------+ +---------+ +---------+ |
| 4927 | // | xapp | | submgr | | e2term | |
| 4928 | // +-------+ +---------+ +---------+ |
| 4929 | // | | | |
| 4930 | // | RestSubReq | | |
| 4931 | // |---------------->| | |
| 4932 | // | | | |
| 4933 | // | RESTSubResp | | |
| 4934 | // |<----------------| | |
| 4935 | // | | | |
| 4936 | // | | SubReq | |
| 4937 | // | |------------->| |
| 4938 | // | | | |
| 4939 | // | | SubResp | |
| 4940 | // | |<-------------| |
| 4941 | // | RESTNotif | | |
| 4942 | // |<----------------| | |
| 4943 | // | ... | ... | |
| 4944 | // | | | |
| 4945 | // | RESTSubDelReq | | |
| 4946 | // |---------------->| | |
| 4947 | // | | | |
| 4948 | // | | SubDelReq | |
| 4949 | // | |------------->| |
| 4950 | // | | | |
| 4951 | // | | SubDelResp | |
| 4952 | // | |<-------------| |
| 4953 | // | | | |
| 4954 | // | RESTSubDelResp| | |
| 4955 | // |<----------------| | |
| 4956 | // |
| 4957 | //----------------------------------------------------------------------------- |
| 4958 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4959 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4960 | |
| 4961 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4962 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4963 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4964 | Counter{cSubReqToE2, 1}, |
| 4965 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4966 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4967 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4968 | Counter{cSubDelReqToE2, 1}, |
| 4969 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4970 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4971 | }) |
| 4972 | |
| 4973 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4974 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4975 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4976 | params.SetSubActionTypes("insert") |
| 4977 | |
| 4978 | // Req |
| 4979 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4980 | |
| 4981 | // Del |
| 4982 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4983 | |
| 4984 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4985 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4986 | |
| 4987 | // Wait that subs is cleaned |
| 4988 | waitSubsCleanup(t, e2SubsId, 10) |
| 4989 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4990 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4991 | } |
| 4992 | |
| 4993 | //----------------------------------------------------------------------------- |
| 4994 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4995 | // |
| 4996 | // stub stub |
| 4997 | // +-------+ +---------+ +---------+ |
| 4998 | // | xapp | | submgr | | e2term | |
| 4999 | // +-------+ +---------+ +---------+ |
| 5000 | // | | | |
| 5001 | // | RESTSubReq | | |
| 5002 | // |------------->| | |
| 5003 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5004 | // | RESTSubResp | | |
| 5005 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5006 | // | | SubReq | |
| 5007 | // | |------------->| |
| 5008 | // | | | |
| 5009 | // | | SubResp | |
| 5010 | // | <----| |
| 5011 | // | | |
| 5012 | // | Submgr restart | |
| 5013 | // | | |
| 5014 | // | | | |
| 5015 | // | | SubDelReq | |
| 5016 | // | |------------->| |
| 5017 | // | | | |
| 5018 | // | | SubDelResp | |
| 5019 | // | |<-------------| |
| 5020 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5021 | // | RESTNotif | | |
| 5022 | // | unsuccess | | |
| 5023 | // |<-------------| | |
| 5024 | // | | | |
| 5025 | // | RESTSubDelReq| | |
| 5026 | // |------------->| | |
| 5027 | // | | | |
| 5028 | // |RESTSubDelResp| | |
| 5029 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5030 | // |
| 5031 | //----------------------------------------------------------------------------- |
| 5032 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5033 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 5034 | |
| 5035 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5036 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5037 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5038 | Counter{cSubReqToE2, 1}, |
| 5039 | Counter{cSubDelReqFromXapp, 1}, |
| 5040 | Counter{cSubDelReqToE2, 1}, |
| 5041 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5042 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5043 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5044 | }) |
| 5045 | |
| 5046 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5047 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5048 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5049 | |
| 5050 | //Req |
| 5051 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5052 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5053 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5054 | |
| 5055 | e2termConn1.RecvSubsReq(t) |
| 5056 | |
| 5057 | mainCtrl.SetResetTestFlag(t, false) |
| 5058 | |
| 5059 | mainCtrl.SimulateRestart(t) |
| 5060 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5061 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5062 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5063 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5064 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5065 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5066 | //Del |
| 5067 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5068 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5069 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5070 | e2termConn1.TestMsgChanEmpty(t) |
| 5071 | mainCtrl.wait_registry_empty(t, 10) |
| 5072 | |
| 5073 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5074 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5075 | } |
| 5076 | |
| 5077 | //----------------------------------------------------------------------------- |
| 5078 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5079 | // |
| 5080 | // stub stub |
| 5081 | // +-------+ +---------+ +---------+ |
| 5082 | // | xapp | | submgr | | e2term | |
| 5083 | // +-------+ +---------+ +---------+ |
| 5084 | // | | | |
| 5085 | // | RESTSubReq | | |
| 5086 | // |---------------->| | |
| 5087 | // | | | |
| 5088 | // | RESTSubResp | | |
| 5089 | // |<----------------| | |
| 5090 | // | | SubReq | |
| 5091 | // | |------------->| |
| 5092 | // | | | |
| 5093 | // | | SubResp | |
| 5094 | // | |<-------------| |
| 5095 | // | | | |
| 5096 | // | RESTNotif | | |
| 5097 | // |<----------------| | |
| 5098 | // | | | |
| 5099 | // | | |
| 5100 | // | Submgr restart | |
| 5101 | // | | | |
| 5102 | // | RESTSubDelReq | | |
| 5103 | // |---------------->| | |
| 5104 | // | | | |
| 5105 | // | | SubDelReq | |
| 5106 | // | |------------->| |
| 5107 | // | | | |
| 5108 | // | | SubDelResp | |
| 5109 | // | |<-------------| |
| 5110 | // | | | |
| 5111 | // | RESTSubDelResp | | |
| 5112 | // |<----------------| | |
| 5113 | // |
| 5114 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5115 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5116 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5117 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5118 | |
| 5119 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5120 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5121 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5122 | Counter{cSubReqToE2, 1}, |
| 5123 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5124 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5125 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5126 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5127 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5128 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5129 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5130 | |
| 5131 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5132 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5133 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5134 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5135 | |
| 5136 | // Check subscription |
| 5137 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5138 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5139 | mainCtrl.SimulateRestart(t) |
| 5140 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5141 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5142 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5143 | // That needs to be completed before successful subscription query is possible |
| 5144 | <-time.After(time.Second * 1) |
| 5145 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5146 | // Check subscription |
| 5147 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5148 | |
| 5149 | // Delete subscription |
| 5150 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5151 | |
| 5152 | //Wait that subs is cleaned |
| 5153 | waitSubsCleanup(t, e2SubsId, 10) |
| 5154 | |
| 5155 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5156 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5157 | } |
| 5158 | |
| 5159 | //----------------------------------------------------------------------------- |
| 5160 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5161 | // |
| 5162 | // stub stub |
| 5163 | // +-------+ +-------+ +---------+ +---------+ |
| 5164 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5165 | // +-------+ +-------+ +---------+ +---------+ |
| 5166 | // | | | | |
| 5167 | // | | RESTSubReq1 | | |
| 5168 | // | |---------------->| | |
| 5169 | // | | | | |
| 5170 | // | | RESTSubResp1 | | |
| 5171 | // | |<----------------| | |
| 5172 | // | | | | |
| 5173 | // | | | SubReq1 | |
| 5174 | // | | |------------->| |
| 5175 | // | | | SubResp1 | |
| 5176 | // | | |<-------------| |
| 5177 | // | | RESTNotif1 | | |
| 5178 | // | |<----------------| | |
| 5179 | // | | | | |
| 5180 | // | RESTSubReq2 | | |
| 5181 | // |------------------------------>| | |
| 5182 | // | | | | |
| 5183 | // | RESTSubResp2 | | |
| 5184 | // |<------------------------------| | |
| 5185 | // | | | | |
| 5186 | // | | RESTNotif2 | | |
| 5187 | // |<------------------------------| | |
| 5188 | // | | | | |
| 5189 | // | | Submgr restart | |
| 5190 | // | | | | |
| 5191 | // | | RESTSubDelReq1 | | |
| 5192 | // | |---------------->| | |
| 5193 | // | | | | |
| 5194 | // | | RESTSubDelResp1 | | |
| 5195 | // | |<----------------| | |
| 5196 | // | | | | |
| 5197 | // | | Submgr restart | |
| 5198 | // | | | | |
| 5199 | // | RESTSubDelReq2 | | |
| 5200 | // |------------------------------>| | |
| 5201 | // | | | | |
| 5202 | // | RESTSubDelResp2 | | |
| 5203 | // |<------------------------------| | |
| 5204 | // | | | | |
| 5205 | // | | | SubDelReq2 | |
| 5206 | // | | |------------->| |
| 5207 | // | | | | |
| 5208 | // | | | SubDelResp2 | |
| 5209 | // | | |<-------------| |
| 5210 | // | | | | |
| 5211 | // |
| 5212 | //----------------------------------------------------------------------------- |
| 5213 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5214 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5215 | |
| 5216 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5217 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5218 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5219 | Counter{cSubReqToE2, 1}, |
| 5220 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5221 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5222 | Counter{cMergedSubscriptions, 1}, |
| 5223 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5224 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5225 | Counter{cSubDelReqToE2, 1}, |
| 5226 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5227 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5228 | }) |
| 5229 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5230 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5231 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5232 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5233 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5234 | |
| 5235 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5236 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5237 | params.SetMeid("RAN_NAME_1") |
| 5238 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5239 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5240 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5241 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5242 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5243 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5244 | |
| 5245 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5246 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5247 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5248 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5249 | |
| 5250 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5251 | // That needs to be completed before successful subscription delete is possible |
| 5252 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5253 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5254 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 5255 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5256 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5257 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5258 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5259 | // Above wait does not work correctly anymore as this delay makes this test case work |
| 5260 | //<-time.After(time.Second * 1) |
| 5261 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5262 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5263 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5264 | |
| 5265 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5266 | // That needs to be completed before successful subscription query is possible |
| 5267 | <-time.After(time.Second * 1) |
| 5268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5269 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5270 | |
| 5271 | // Delete subscription 2 |
| 5272 | deleteXapp2Subscription(t, &restSubId2) |
| 5273 | |
| 5274 | //Wait that subs is cleaned |
| 5275 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5276 | |
| 5277 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5278 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5279 | } |
| 5280 | |
| 5281 | //----------------------------------------------------------------------------- |
| 5282 | // TestRESTReportSubReqAndSubDelOk |
| 5283 | // |
| 5284 | // stub stub |
| 5285 | // +-------+ +---------+ +---------+ |
| 5286 | // | xapp | | submgr | | e2term | |
| 5287 | // +-------+ +---------+ +---------+ |
| 5288 | // | | | |
| 5289 | // | RestSubReq | | |
| 5290 | // |---------------->| | |
| 5291 | // | | | |
| 5292 | // | RESTSubResp | | |
| 5293 | // |<----------------| | |
| 5294 | // | | | |
| 5295 | // | | SubReq | |
| 5296 | // | |------------->| |
| 5297 | // | | | |
| 5298 | // | | SubResp | |
| 5299 | // | |<-------------| |
| 5300 | // | RESTNotif | | |
| 5301 | // |<----------------| | |
| 5302 | // | | SubReq | |
| 5303 | // | |------------->| |
| 5304 | // | | | |
| 5305 | // | | SubResp | |
| 5306 | // | |<-------------| |
| 5307 | // | RESTNotif | | |
| 5308 | // |<----------------| | |
| 5309 | // | ... | ... | |
| 5310 | // | | | |
| 5311 | // | | | |
| 5312 | // | RESTSubDelReq | | |
| 5313 | // |---------------->| | |
| 5314 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5315 | // | RESTSubDelResp| | |
| 5316 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5317 | // | | SubDelReq | |
| 5318 | // | |------------->| |
| 5319 | // | | | |
| 5320 | // | | SubDelResp | |
| 5321 | // | |<-------------| |
| 5322 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5323 | // |
| 5324 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5325 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5326 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5327 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5328 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5329 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5330 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5331 | } |
| 5332 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5333 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5334 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5335 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5336 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5337 | Counter{cRestSubReqFromXapp, 1}, |
| 5338 | Counter{cRestSubRespToXapp, 1}, |
| 5339 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5340 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 5341 | Counter{cRestSubNotifToXapp, 1}, |
| 5342 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5343 | Counter{cRestSubDelRespToXapp, 1}, |
| 5344 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5345 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 5346 | }) |
| 5347 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5348 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5349 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5350 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5351 | |
| 5352 | var e2SubsId []uint32 |
| 5353 | for i := 0; i < subReqCount; i++ { |
| 5354 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5355 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5356 | |
| 5357 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5358 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5359 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5360 | e2SubsId = append(e2SubsId, instanceId) |
| 5361 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5362 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5363 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5364 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5365 | |
| 5366 | } |
| 5367 | |
| 5368 | // Del |
| 5369 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5370 | |
| 5371 | for i := 0; i < subReqCount; i++ { |
| 5372 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5373 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5374 | } |
| 5375 | |
| 5376 | // Wait that subs is cleaned |
| 5377 | for i := 0; i < subReqCount; i++ { |
| 5378 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5379 | } |
| 5380 | |
| 5381 | xappConn1.TestMsgChanEmpty(t) |
| 5382 | e2termConn1.TestMsgChanEmpty(t) |
| 5383 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5384 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5385 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5386 | } |
| 5387 | |
| 5388 | /* |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5389 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { //Was in comments already. Next case is not run! |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5390 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5391 | |
| 5392 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5393 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5394 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5395 | |
| 5396 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5398 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5399 | } |
| 5400 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5401 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5402 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5403 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5404 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5405 | Counter{cRestSubReqFromXapp, 1}, |
| 5406 | Counter{cRestSubRespToXapp, 1}, |
| 5407 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5408 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 5409 | Counter{cRestSubNotifToXapp, 1}, |
| 5410 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5411 | Counter{cRestSubDelRespToXapp, 1}, |
| 5412 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5413 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 5414 | }) |
| 5415 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5416 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5417 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5418 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5419 | |
| 5420 | var e2SubsId []uint32 |
| 5421 | for i := 0; i < subReqCount; i++ { |
| 5422 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5423 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5424 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5425 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5426 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5427 | e2SubsId = append(e2SubsId, instanceId) |
| 5428 | } |
| 5429 | |
| 5430 | // Del |
| 5431 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5432 | |
| 5433 | for i := 0; i < subReqCount; i++ { |
| 5434 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5435 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5436 | } |
| 5437 | |
| 5438 | // Wait that subs is cleaned |
| 5439 | for i := 0; i < subReqCount; i++ { |
| 5440 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5441 | } |
| 5442 | xappConn1.TestMsgChanEmpty(t) |
| 5443 | e2termConn1.TestMsgChanEmpty(t) |
| 5444 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5445 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 5446 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5447 | } |
| 5448 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5449 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5450 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5451 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5452 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5453 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5454 | Counter{cSubReqToE2, 2}, |
| 5455 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5456 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5457 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5458 | Counter{cSubDelReqToE2, 2}, |
| 5459 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5460 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5461 | }) |
| 5462 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5463 | const subReqCount int = 2 |
| 5464 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5465 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5466 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5467 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5468 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5469 | |
| 5470 | assert.Equal(t, len(e2SubsIds), 2) |
| 5471 | |
| 5472 | // Del |
| 5473 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5474 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5475 | |
| 5476 | xappConn1.TestMsgChanEmpty(t) |
| 5477 | e2termConn1.TestMsgChanEmpty(t) |
| 5478 | mainCtrl.wait_registry_empty(t, 10) |
| 5479 | |
| 5480 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5481 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5482 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5483 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5484 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5485 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5486 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5487 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5488 | Counter{cSubReqToE2, 19}, |
| 5489 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5490 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5491 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5492 | Counter{cSubDelReqToE2, 19}, |
| 5493 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5494 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5495 | }) |
| 5496 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5497 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5498 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5499 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5500 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5501 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5502 | |
| 5503 | assert.Equal(t, len(e2SubsIds), 19) |
| 5504 | |
| 5505 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5506 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5507 | |
| 5508 | xappConn1.TestMsgChanEmpty(t) |
| 5509 | e2termConn1.TestMsgChanEmpty(t) |
| 5510 | mainCtrl.wait_registry_empty(t, 10) |
| 5511 | |
| 5512 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5513 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5514 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5515 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5516 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5517 | |
| 5518 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5519 | |
| 5520 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5521 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5522 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5523 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5524 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5525 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5526 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5527 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5528 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5529 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5530 | }) |
| 5531 | |
| 5532 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5533 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5534 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5535 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5536 | |
| 5537 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5538 | |
| 5539 | // Del |
| 5540 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5541 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5542 | |
| 5543 | xappConn1.TestMsgChanEmpty(t) |
| 5544 | e2termConn1.TestMsgChanEmpty(t) |
| 5545 | mainCtrl.wait_registry_empty(t, 10) |
| 5546 | |
| 5547 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5548 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5549 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5550 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5551 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5552 | |
| 5553 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5554 | |
| 5555 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5556 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5557 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5558 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5559 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5560 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5561 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5562 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5563 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5564 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5565 | }) |
| 5566 | |
| 5567 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5568 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5569 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5570 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5571 | |
| 5572 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5573 | |
| 5574 | // Del |
| 5575 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5576 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5577 | |
| 5578 | xappConn1.TestMsgChanEmpty(t) |
| 5579 | e2termConn1.TestMsgChanEmpty(t) |
| 5580 | mainCtrl.wait_registry_empty(t, 10) |
| 5581 | |
| 5582 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5583 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5584 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5585 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5586 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5587 | |
| 5588 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5589 | |
| 5590 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5591 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5592 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5593 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5594 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5595 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5596 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5597 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5598 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5599 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5600 | }) |
| 5601 | |
| 5602 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5603 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5604 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5605 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5606 | |
| 5607 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5608 | |
| 5609 | // Del |
| 5610 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5611 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5612 | |
| 5613 | xappConn1.TestMsgChanEmpty(t) |
| 5614 | e2termConn1.TestMsgChanEmpty(t) |
| 5615 | mainCtrl.wait_registry_empty(t, 10) |
| 5616 | |
| 5617 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5618 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5619 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5620 | |
| 5621 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5622 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5623 | |
| 5624 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5625 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5626 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5627 | Counter{cSubReqToE2, 2}, |
| 5628 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5629 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5630 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5631 | Counter{cSubDelReqToE2, 2}, |
| 5632 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5633 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5634 | }) |
| 5635 | |
| 5636 | // Req1 |
| 5637 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5638 | |
| 5639 | //Subs Create |
| 5640 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5641 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5642 | |
| 5643 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5644 | |
| 5645 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5646 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5647 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5648 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5649 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5650 | |
| 5651 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5652 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5653 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5654 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5655 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5656 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5657 | |
| 5658 | deleteXapp1Subscription(t, &restSubId1) |
| 5659 | deleteXapp2Subscription(t, &restSubId2) |
| 5660 | |
| 5661 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5662 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5663 | |
| 5664 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5665 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5666 | } |
| 5667 | |
| 5668 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5669 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5670 | |
| 5671 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5672 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5673 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5674 | Counter{cSubReqToE2, 2}, |
| 5675 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5676 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5677 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5678 | Counter{cSubDelReqToE2, 2}, |
| 5679 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5680 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5681 | }) |
| 5682 | |
| 5683 | // Req1 |
| 5684 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5685 | |
| 5686 | //Subs Create |
| 5687 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5688 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5689 | |
| 5690 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5691 | |
| 5692 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5693 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5694 | params.SetMeid("RAN_NAME_1") |
| 5695 | |
| 5696 | actionId := int64(1) |
| 5697 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5698 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5699 | subsequestActionType := "continue" |
| 5700 | timeToWait := "w10ms" |
| 5701 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5702 | |
| 5703 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5704 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5705 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5706 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5707 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5708 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5709 | |
| 5710 | deleteXapp1Subscription(t, &restSubId1) |
| 5711 | deleteXapp2Subscription(t, &restSubId2) |
| 5712 | |
| 5713 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5714 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5715 | |
| 5716 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5717 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5718 | } |
| 5719 | |
| 5720 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5721 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5722 | |
| 5723 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5724 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5725 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5726 | Counter{cSubReqToE2, 2}, |
| 5727 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5728 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5729 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5730 | Counter{cSubDelReqToE2, 2}, |
| 5731 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5732 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5733 | }) |
| 5734 | |
| 5735 | // Req1 |
| 5736 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5737 | |
| 5738 | //Subs Create |
| 5739 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5740 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5741 | |
| 5742 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5743 | |
| 5744 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5745 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5746 | params.SetMeid("RAN_NAME_1") |
| 5747 | params.SetSubActionIDs(int64(2)) |
| 5748 | |
| 5749 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5750 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5751 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5752 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5753 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5754 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5755 | |
| 5756 | deleteXapp1Subscription(t, &restSubId1) |
| 5757 | deleteXapp2Subscription(t, &restSubId2) |
| 5758 | |
| 5759 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5760 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5761 | |
| 5762 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5763 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5764 | } |
| 5765 | |
| 5766 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5767 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5768 | |
| 5769 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5770 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5771 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5772 | Counter{cSubReqToE2, 2}, |
| 5773 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5774 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5775 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5776 | Counter{cSubDelReqToE2, 2}, |
| 5777 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5778 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5779 | }) |
| 5780 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5781 | const e2Timeout int64 = 2 |
| 5782 | const e2RetryCount int64 = 2 |
| 5783 | const routingNeeded bool = true |
| 5784 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5785 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5786 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5787 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5788 | |
| 5789 | //Subs Create |
| 5790 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5791 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5792 | |
| 5793 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5794 | |
| 5795 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5796 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5797 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5798 | params.SetMeid("RAN_NAME_1") |
| 5799 | |
| 5800 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5801 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5802 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5803 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5804 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5805 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5806 | |
| 5807 | deleteXapp1Subscription(t, &restSubId1) |
| 5808 | deleteXapp2Subscription(t, &restSubId2) |
| 5809 | |
| 5810 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5811 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5812 | |
| 5813 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5814 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5815 | } |
| 5816 | |
| 5817 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5818 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5819 | |
| 5820 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5821 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5822 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5823 | Counter{cSubReqToE2, 2}, |
| 5824 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5825 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5826 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5827 | Counter{cSubDelReqToE2, 2}, |
| 5828 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5829 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5830 | }) |
| 5831 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5832 | const e2Timeout int64 = 2 |
| 5833 | const e2RetryCount int64 = 2 |
| 5834 | const routingNeeded bool = true |
| 5835 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5836 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5837 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5838 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5839 | |
| 5840 | //Subs Create |
| 5841 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5842 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5843 | |
| 5844 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5845 | |
| 5846 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5847 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5848 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5849 | params.SetMeid("RAN_NAME_1") |
| 5850 | |
| 5851 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5852 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5853 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5854 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5855 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5856 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5857 | |
| 5858 | deleteXapp1Subscription(t, &restSubId1) |
| 5859 | deleteXapp2Subscription(t, &restSubId2) |
| 5860 | |
| 5861 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5862 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5863 | |
| 5864 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5865 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5866 | } |
| 5867 | |
| 5868 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5869 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5870 | |
| 5871 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5872 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5873 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5874 | Counter{cSubReqToE2, 2}, |
| 5875 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5876 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5877 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5878 | Counter{cSubDelReqToE2, 2}, |
| 5879 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5880 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5881 | }) |
| 5882 | |
| 5883 | // Req1 |
| 5884 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5885 | |
| 5886 | //Subs Create |
| 5887 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5888 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5889 | |
| 5890 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5891 | |
| 5892 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5893 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5894 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5895 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5896 | params.SetSubActionDefinition(actionDefinition) |
| 5897 | |
| 5898 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5899 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5900 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5901 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5902 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5903 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5904 | |
| 5905 | deleteXapp1Subscription(t, &restSubId1) |
| 5906 | deleteXapp2Subscription(t, &restSubId2) |
| 5907 | |
| 5908 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5909 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5910 | |
| 5911 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5912 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5913 | } |
| 5914 | |
| 5915 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5916 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5917 | |
| 5918 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5919 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5920 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5921 | Counter{cSubReqToE2, 2}, |
| 5922 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5923 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5924 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5925 | Counter{cSubDelReqToE2, 2}, |
| 5926 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5927 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5928 | }) |
| 5929 | |
| 5930 | // Req1 |
| 5931 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5932 | |
| 5933 | //Subs Create |
| 5934 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5935 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5936 | |
| 5937 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5938 | |
| 5939 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5940 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5941 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5942 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5943 | params.SetSubActionDefinition(actionDefinition) |
| 5944 | |
| 5945 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5946 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5947 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5948 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5949 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5950 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5951 | |
| 5952 | deleteXapp1Subscription(t, &restSubId1) |
| 5953 | deleteXapp2Subscription(t, &restSubId2) |
| 5954 | |
| 5955 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5956 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5957 | |
| 5958 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5959 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5960 | } |
| 5961 | |
| 5962 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5963 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5964 | |
| 5965 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5966 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5967 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5968 | Counter{cSubReqToE2, 2}, |
| 5969 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5970 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5971 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5972 | Counter{cSubDelReqToE2, 2}, |
| 5973 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5974 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5975 | }) |
| 5976 | |
| 5977 | // Req1 |
| 5978 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5979 | |
| 5980 | //Subs Create |
| 5981 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5982 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5983 | |
| 5984 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5985 | |
| 5986 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5987 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5988 | params.SetMeid("RAN_NAME_1") |
| 5989 | params.SetTimeToWait("w200ms") |
| 5990 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5991 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5992 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5993 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5994 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5995 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5996 | |
| 5997 | deleteXapp1Subscription(t, &restSubId1) |
| 5998 | deleteXapp2Subscription(t, &restSubId2) |
| 5999 | |
| 6000 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6001 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6002 | |
| 6003 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6004 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6005 | } |
| 6006 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6007 | //----------------------------------------------------------------------------- |
| 6008 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 6009 | // |
| 6010 | // stub stub |
| 6011 | // +-------+ +---------+ +---------+ |
| 6012 | // | xapp | | submgr | | e2term | |
| 6013 | // +-------+ +---------+ +---------+ |
| 6014 | // | | | |
| 6015 | // | RestSubReq | | |
| 6016 | // |---------------->| | |
| 6017 | // | | | |
| 6018 | // | RESTSubResp | | |
| 6019 | // |<----------------| | |
| 6020 | // | | | |
| 6021 | // | | SubReq | |
| 6022 | // | |------------->| |
| 6023 | // | | | |
| 6024 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6025 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6026 | // | | | |
| 6027 | // | | SubReq | |
| 6028 | // | |------------->| |
| 6029 | // | | | |
| 6030 | // | | SubFail | Duplicated action |
| 6031 | // | |<-------------| |
| 6032 | // | RESTNotif (fail)| | |
| 6033 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6034 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6035 | // | [SUBS DELETE] | |
| 6036 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6037 | // |
| 6038 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6039 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6040 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6041 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6042 | |
| 6043 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6044 | Counter{cRestSubReqFromXapp, 1}, |
| 6045 | Counter{cRestSubRespToXapp, 1}, |
| 6046 | Counter{cSubReqToE2, 1}, |
| 6047 | Counter{cSubReqTimerExpiry, 1}, |
| 6048 | Counter{cSubReReqToE2, 1}, |
| 6049 | Counter{cSubRespFromE2, 1}, |
| 6050 | Counter{cSubFailFromE2, 1}, |
| 6051 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6052 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6053 | Counter{cRestSubDelRespToXapp, 1}, |
| 6054 | }) |
| 6055 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6056 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6057 | |
| 6058 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6059 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6060 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6061 | |
| 6062 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6063 | // Decode of this response fails which will result resending original request |
| 6064 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 6065 | |
| 6066 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6067 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6068 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6069 | |
| 6070 | // Subscription already created in E2 Node. |
| 6071 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6072 | fparams.Set(crereq) |
| 6073 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6074 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6075 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6076 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6077 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6078 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6079 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6080 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6081 | // Wait that subs is cleaned |
| 6082 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6083 | |
| 6084 | xappConn1.TestMsgChanEmpty(t) |
| 6085 | e2termConn1.TestMsgChanEmpty(t) |
| 6086 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6087 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6088 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6089 | } |
| 6090 | |
| 6091 | //----------------------------------------------------------------------------- |
| 6092 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6093 | // |
| 6094 | // stub stub |
| 6095 | // +-------+ +---------+ +---------+ |
| 6096 | // | xapp | | submgr | | e2term | |
| 6097 | // +-------+ +---------+ +---------+ |
| 6098 | // | | | |
| 6099 | // | RestSubReq | | |
| 6100 | // |---------------->| | |
| 6101 | // | | | |
| 6102 | // | RESTSubResp | | |
| 6103 | // |<----------------| | |
| 6104 | // | | | |
| 6105 | // | | SubReq | |
| 6106 | // | |------------->| |
| 6107 | // | | | |
| 6108 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6109 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6110 | // | | | |
| 6111 | // | | SubReq | |
| 6112 | // | |------------->| |
| 6113 | // | | | |
| 6114 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6115 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6116 | // | RESTNotif (fail)| | |
| 6117 | // |<----------------| | |
| 6118 | // | | SubDelReq | |
| 6119 | // | |------------->| |
| 6120 | // | | | |
| 6121 | // | | SubDelResp | |
| 6122 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6123 | // | | | |
| 6124 | // | [SUBS DELETE] | |
| 6125 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6126 | // |
| 6127 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6128 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6129 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6130 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6131 | |
| 6132 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6133 | Counter{cRestSubReqFromXapp, 1}, |
| 6134 | Counter{cRestSubRespToXapp, 1}, |
| 6135 | Counter{cSubReqToE2, 1}, |
| 6136 | Counter{cSubReqTimerExpiry, 2}, |
| 6137 | Counter{cSubReReqToE2, 1}, |
| 6138 | Counter{cSubRespFromE2, 1}, |
| 6139 | Counter{cSubFailFromE2, 1}, |
| 6140 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6141 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6142 | Counter{cRestSubDelRespToXapp, 1}, |
| 6143 | Counter{cSubDelReqToE2, 1}, |
| 6144 | Counter{cSubDelRespFromE2, 1}, |
| 6145 | }) |
| 6146 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6147 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6148 | |
| 6149 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6150 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6151 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6152 | |
| 6153 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6154 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6155 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6156 | orgInstanceId := crereq.RequestId.InstanceId |
| 6157 | crereq.RequestId.InstanceId = 0 |
| 6158 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6159 | |
| 6160 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6161 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6162 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6163 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6164 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6165 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6166 | fparams.Set(crereq) |
| 6167 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6168 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6169 | |
| 6170 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6171 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6172 | |
| 6173 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6174 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6175 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6176 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6177 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6178 | // Wait that subs is cleaned |
| 6179 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6180 | |
| 6181 | xappConn1.TestMsgChanEmpty(t) |
| 6182 | e2termConn1.TestMsgChanEmpty(t) |
| 6183 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6184 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6185 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6186 | } |
| 6187 | |
| 6188 | //----------------------------------------------------------------------------- |
| 6189 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6190 | // |
| 6191 | // stub stub |
| 6192 | // +-------+ +---------+ +---------+ |
| 6193 | // | xapp | | submgr | | e2term | |
| 6194 | // +-------+ +---------+ +---------+ |
| 6195 | // | | | |
| 6196 | // | RestSubReq | | |
| 6197 | // |---------------->| | |
| 6198 | // | | | |
| 6199 | // | RESTSubResp | | |
| 6200 | // |<----------------| | |
| 6201 | // | | | |
| 6202 | // | | SubReq | |
| 6203 | // | |------------->| |
| 6204 | // | | | |
| 6205 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6206 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6207 | // | | | |
| 6208 | // | | SubReq | |
| 6209 | // | |------------->| |
| 6210 | // | | | |
| 6211 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6212 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6213 | // | RESTNotif (fail)| | |
| 6214 | // |<----------------| | |
| 6215 | // | | SubDelReq | |
| 6216 | // | |------------->| |
| 6217 | // | | | |
| 6218 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6219 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6220 | // | | | |
| 6221 | // | | SubDelReq | |
| 6222 | // | |------------->| |
| 6223 | // | | | |
| 6224 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6225 | // | |<-------------| Ongoing transaction not found. |
| 6226 | // | | | |
| 6227 | // | [SUBS DELETE] | |
| 6228 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6229 | // |
| 6230 | //----------------------------------------------------------------------------- |
| 6231 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6232 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6233 | |
| 6234 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6235 | Counter{cRestSubReqFromXapp, 1}, |
| 6236 | Counter{cRestSubRespToXapp, 1}, |
| 6237 | Counter{cSubReqToE2, 1}, |
| 6238 | Counter{cSubReqTimerExpiry, 2}, |
| 6239 | Counter{cSubReReqToE2, 1}, |
| 6240 | Counter{cSubRespFromE2, 1}, |
| 6241 | Counter{cSubFailFromE2, 1}, |
| 6242 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6243 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6244 | Counter{cRestSubDelRespToXapp, 1}, |
| 6245 | Counter{cSubDelReqToE2, 1}, |
| 6246 | Counter{cSubDelReqTimerExpiry, 2}, |
| 6247 | Counter{cSubDelReReqToE2, 1}, |
| 6248 | Counter{cSubDelRespFromE2, 2}, |
| 6249 | }) |
| 6250 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6251 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6252 | |
| 6253 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6254 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6255 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6256 | |
| 6257 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6258 | |
| 6259 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6260 | // No transaction exist for this response which will result resending original request |
| 6261 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6262 | |
| 6263 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6264 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6265 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6266 | |
| 6267 | // Subscription already created in E2 Node. |
| 6268 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6269 | fparams.Set(crereq) |
| 6270 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6271 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6272 | |
| 6273 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6274 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6275 | |
| 6276 | // Resending happens because there no transaction |
| 6277 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6278 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6279 | |
| 6280 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6281 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6282 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6283 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6284 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6285 | // Wait that subs is cleaned |
| 6286 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6287 | |
| 6288 | xappConn1.TestMsgChanEmpty(t) |
| 6289 | e2termConn1.TestMsgChanEmpty(t) |
| 6290 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6291 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6292 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6293 | } |
| 6294 | |
| 6295 | //----------------------------------------------------------------------------- |
| 6296 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6297 | // |
| 6298 | // stub stub |
| 6299 | // +-------+ +---------+ +---------+ |
| 6300 | // | xapp | | submgr | | e2term | |
| 6301 | // +-------+ +---------+ +---------+ |
| 6302 | // | | | |
| 6303 | // | RestSubReq | | |
| 6304 | // |---------------->| | |
| 6305 | // | | | |
| 6306 | // | RESTSubResp | | |
| 6307 | // |<----------------| | |
| 6308 | // | | | |
| 6309 | // | | SubReq | |
| 6310 | // | |------------->| |
| 6311 | // | | | |
| 6312 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6313 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6314 | // | | | |
| 6315 | // | | SubReq | |
| 6316 | // | |------------->| |
| 6317 | // | | | |
| 6318 | // | | SubFail | Duplicated action |
| 6319 | // | |<-------------| |
| 6320 | // | RESTNotif (fail)| | |
| 6321 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6322 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6323 | // | [SUBS DELETE] | |
| 6324 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6325 | // |
| 6326 | //----------------------------------------------------------------------------- |
| 6327 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6328 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6329 | |
| 6330 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6331 | Counter{cRestSubReqFromXapp, 1}, |
| 6332 | Counter{cRestSubRespToXapp, 1}, |
| 6333 | Counter{cSubReqToE2, 1}, |
| 6334 | Counter{cSubReqTimerExpiry, 1}, |
| 6335 | Counter{cSubReReqToE2, 1}, |
| 6336 | Counter{cSubFailFromE2, 2}, |
| 6337 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6338 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6339 | Counter{cRestSubDelRespToXapp, 1}, |
| 6340 | }) |
| 6341 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6342 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6343 | |
| 6344 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6345 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6346 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6347 | |
| 6348 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6349 | |
| 6350 | // Decode of this response fails which will result resending original request |
| 6351 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6352 | |
| 6353 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6354 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6355 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6356 | |
| 6357 | // Subscription already created in E2 Node. |
| 6358 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6359 | fparams.Set(crereq) |
| 6360 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6361 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6362 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6363 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6364 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6365 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6366 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6367 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6368 | // Wait that subs is cleaned |
| 6369 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6370 | |
| 6371 | xappConn1.TestMsgChanEmpty(t) |
| 6372 | e2termConn1.TestMsgChanEmpty(t) |
| 6373 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6374 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6375 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6376 | } |
| 6377 | |
| 6378 | //----------------------------------------------------------------------------- |
| 6379 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6380 | // |
| 6381 | // stub stub |
| 6382 | // +-------+ +---------+ +---------+ |
| 6383 | // | xapp | | submgr | | e2term | |
| 6384 | // +-------+ +---------+ +---------+ |
| 6385 | // | | | |
| 6386 | // | RestSubReq | | |
| 6387 | // |---------------->| | |
| 6388 | // | | | |
| 6389 | // | RESTSubResp | | |
| 6390 | // |<----------------| | |
| 6391 | // | | | |
| 6392 | // | | SubReq | |
| 6393 | // | |------------->| |
| 6394 | // | | | |
| 6395 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6396 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6397 | // | | | |
| 6398 | // | | SubReq | |
| 6399 | // | |------------->| |
| 6400 | // | | | |
| 6401 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6402 | // | |<-------------|No valid subscription found with subIds [0]. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6403 | // | RESTNotif (fail)| | |
| 6404 | // |<----------------| | |
| 6405 | // | | SubDelReq | |
| 6406 | // | |------------->| |
| 6407 | // | | | |
| 6408 | // | | SubDelResp | |
| 6409 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6410 | // | | | |
| 6411 | // | [SUBS DELETE] | |
| 6412 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6413 | // |
| 6414 | //----------------------------------------------------------------------------- |
| 6415 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6416 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6417 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6418 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6419 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6420 | Counter{cRestSubReqFromXapp, 1}, |
| 6421 | Counter{cRestSubRespToXapp, 1}, |
| 6422 | Counter{cSubReqToE2, 1}, |
| 6423 | Counter{cSubReqTimerExpiry, 2}, |
| 6424 | Counter{cSubReReqToE2, 1}, |
| 6425 | Counter{cSubFailFromE2, 2}, |
| 6426 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6427 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6428 | Counter{cRestSubDelRespToXapp, 1}, |
| 6429 | Counter{cSubDelReqToE2, 1}, |
| 6430 | Counter{cSubDelRespFromE2, 1}, |
| 6431 | }) |
| 6432 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6433 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6434 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6435 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6436 | |
| 6437 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6438 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6439 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6440 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6441 | fparams.Set(crereq) |
| 6442 | fparams.Fail.RequestId.InstanceId = 0 |
| 6443 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6444 | |
| 6445 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6446 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6447 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6448 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6449 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6450 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6451 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6452 | |
| 6453 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6454 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6455 | |
| 6456 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6457 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6458 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6459 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6460 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6461 | // Wait that subs is cleaned |
| 6462 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6463 | |
| 6464 | xappConn1.TestMsgChanEmpty(t) |
| 6465 | e2termConn1.TestMsgChanEmpty(t) |
| 6466 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6467 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6468 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6469 | } |
| 6470 | |
| 6471 | //----------------------------------------------------------------------------- |
| 6472 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6473 | // |
| 6474 | // stub stub |
| 6475 | // +-------+ +---------+ +---------+ |
| 6476 | // | xapp | | submgr | | e2term | |
| 6477 | // +-------+ +---------+ +---------+ |
| 6478 | // | | | |
| 6479 | // | RestSubReq | | |
| 6480 | // |---------------->| | |
| 6481 | // | | | |
| 6482 | // | RESTSubResp | | |
| 6483 | // |<----------------| | |
| 6484 | // | | | |
| 6485 | // | | SubReq | |
| 6486 | // | |------------->| |
| 6487 | // | | | |
| 6488 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6489 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6490 | // | | | |
| 6491 | // | | SubReq | |
| 6492 | // | |------------->| |
| 6493 | // | | | |
| 6494 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6495 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6496 | // | RESTNotif (fail)| | |
| 6497 | // |<----------------| | |
| 6498 | // | | SubDelReq | |
| 6499 | // | |------------->| |
| 6500 | // | | | |
| 6501 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6502 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 6503 | // | | | |
| 6504 | // | | SubDelReq | |
| 6505 | // | |------------->| |
| 6506 | // | | | |
| 6507 | // | | SubDelResp | |
| 6508 | // | |<-------------| Ongoing transaction not found. |
| 6509 | // | | | |
| 6510 | // | [SUBS DELETE] | |
| 6511 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6512 | // |
| 6513 | //----------------------------------------------------------------------------- |
| 6514 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6515 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6516 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6517 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6518 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6519 | Counter{cRestSubReqFromXapp, 1}, |
| 6520 | Counter{cRestSubRespToXapp, 1}, |
| 6521 | Counter{cSubReqToE2, 1}, |
| 6522 | Counter{cSubReqTimerExpiry, 2}, |
| 6523 | Counter{cSubReReqToE2, 1}, |
| 6524 | Counter{cSubFailFromE2, 2}, |
| 6525 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6526 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6527 | Counter{cRestSubDelRespToXapp, 1}, |
| 6528 | Counter{cSubDelReqToE2, 1}, |
| 6529 | Counter{cSubDelReqTimerExpiry, 2}, |
| 6530 | Counter{cSubDelReReqToE2, 1}, |
| 6531 | Counter{cSubDelRespFromE2, 2}, |
| 6532 | }) |
| 6533 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6534 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6535 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6536 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6537 | |
| 6538 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6539 | |
| 6540 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6541 | |
| 6542 | // No transaction exist for this response which will result resending original request |
| 6543 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6544 | fparams.Set(crereq) |
| 6545 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6546 | |
| 6547 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6548 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6549 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6550 | |
| 6551 | // Subscription already created in E2 Node. |
| 6552 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6553 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6554 | |
| 6555 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6556 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6557 | |
| 6558 | // Resending happens because there no transaction |
| 6559 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6560 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6561 | |
| 6562 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6563 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6564 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6565 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6566 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6567 | // Wait that subs is cleaned |
| 6568 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6569 | |
| 6570 | xappConn1.TestMsgChanEmpty(t) |
| 6571 | e2termConn1.TestMsgChanEmpty(t) |
| 6572 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6573 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6574 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6575 | } |
| 6576 | |
| 6577 | //----------------------------------------------------------------------------- |
| 6578 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6579 | // |
| 6580 | // stub stub |
| 6581 | // +-------+ +---------+ +---------+ |
| 6582 | // | xapp | | submgr | | e2term | |
| 6583 | // +-------+ +---------+ +---------+ |
| 6584 | // | | | |
| 6585 | // | [SUBS CREATE] | |
| 6586 | // | | | |
| 6587 | // | | | |
| 6588 | // | RESTSubDelReq | | |
| 6589 | // |---------------->| | |
| 6590 | // | | | |
| 6591 | // | RESTSubDelResp | | |
| 6592 | // |<----------------| | |
| 6593 | // | | | |
| 6594 | // | | SubDelReq | |
| 6595 | // | |------------->| |
| 6596 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6597 | // | | SubDelResp | ASN.1 decode fails. |
| 6598 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6599 | // | | | |
| 6600 | // | | SubDelReq | |
| 6601 | // | |------------->| |
| 6602 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6603 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6604 | // | |<-------------| |
| 6605 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6606 | // | [SUBS DELETE] | |
| 6607 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6608 | // |
| 6609 | //----------------------------------------------------------------------------- |
| 6610 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6611 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6612 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6613 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6614 | Counter{cRestSubReqFromXapp, 1}, |
| 6615 | Counter{cRestSubRespToXapp, 1}, |
| 6616 | Counter{cSubReqToE2, 1}, |
| 6617 | Counter{cSubRespFromE2, 1}, |
| 6618 | Counter{cRestSubNotifToXapp, 1}, |
| 6619 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6620 | Counter{cRestSubDelRespToXapp, 1}, |
| 6621 | Counter{cSubDelReqToE2, 1}, |
| 6622 | Counter{cSubDelReqTimerExpiry, 1}, |
| 6623 | Counter{cSubDelReReqToE2, 1}, |
| 6624 | Counter{cSubDelFailFromE2, 1}, |
| 6625 | Counter{cSubDelRespFromE2, 1}, |
| 6626 | }) |
| 6627 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6628 | // Req |
| 6629 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6630 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6631 | |
| 6632 | // Del |
| 6633 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6634 | |
| 6635 | // E2t: Receive 1st SubsDelReq |
| 6636 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6637 | |
| 6638 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6639 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6640 | |
| 6641 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6642 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6643 | |
| 6644 | // Subscription does not exist in in E2 Node. |
| 6645 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6646 | |
| 6647 | // Wait that subs is cleaned |
| 6648 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6649 | |
| 6650 | xappConn1.TestMsgChanEmpty(t) |
| 6651 | e2termConn1.TestMsgChanEmpty(t) |
| 6652 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6653 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6654 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6655 | } |
| 6656 | |
| 6657 | //----------------------------------------------------------------------------- |
| 6658 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6659 | // |
| 6660 | // stub stub |
| 6661 | // +-------+ +---------+ +---------+ |
| 6662 | // | xapp | | submgr | | e2term | |
| 6663 | // +-------+ +---------+ +---------+ |
| 6664 | // | | | |
| 6665 | // | [SUBS CREATE] | |
| 6666 | // | | | |
| 6667 | // | | | |
| 6668 | // | RESTSubDelReq | | |
| 6669 | // |---------------->| | |
| 6670 | // | | | |
| 6671 | // | RESTSubDelResp | | |
| 6672 | // |<----------------| | |
| 6673 | // | | | |
| 6674 | // | | SubDelReq | |
| 6675 | // | |------------->| |
| 6676 | // | | | |
| 6677 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6678 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6679 | // | | | |
| 6680 | // | | SubDelReq | |
| 6681 | // | |------------->| |
| 6682 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6683 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6684 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6685 | // | | | |
| 6686 | // | [SUBS DELETE] | |
| 6687 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6688 | //----------------------------------------------------------------------------- |
| 6689 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6690 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6691 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6692 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6693 | Counter{cRestSubReqFromXapp, 1}, |
| 6694 | Counter{cRestSubRespToXapp, 1}, |
| 6695 | Counter{cSubReqToE2, 1}, |
| 6696 | Counter{cSubRespFromE2, 1}, |
| 6697 | Counter{cRestSubNotifToXapp, 1}, |
| 6698 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6699 | Counter{cRestSubDelRespToXapp, 1}, |
| 6700 | Counter{cSubDelReqToE2, 1}, |
| 6701 | Counter{cSubDelReqTimerExpiry, 1}, |
| 6702 | Counter{cSubDelReReqToE2, 1}, |
| 6703 | Counter{cSubDelRespFromE2, 1}, |
| 6704 | Counter{cSubDelFailFromE2, 1}, |
| 6705 | }) |
| 6706 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6707 | // Req |
| 6708 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6709 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6710 | |
| 6711 | // Del |
| 6712 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6713 | |
| 6714 | // E2t: Receive 1st SubsDelReq |
| 6715 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6716 | |
| 6717 | // Unknown instanceId in this response which will result resending original request |
| 6718 | delreq.RequestId.InstanceId = 0 |
| 6719 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6720 | |
| 6721 | // E2t: Receive 2nd SubsDelReq |
| 6722 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6723 | |
| 6724 | // Subscription does not exist in in E2 Node. |
| 6725 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6726 | |
| 6727 | // Wait that subs is cleaned |
| 6728 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6729 | |
| 6730 | xappConn1.TestMsgChanEmpty(t) |
| 6731 | e2termConn1.TestMsgChanEmpty(t) |
| 6732 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6733 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6734 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6735 | } |
| 6736 | |
| 6737 | //----------------------------------------------------------------------------- |
| 6738 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6739 | // |
| 6740 | // stub stub |
| 6741 | // +-------+ +---------+ +---------+ |
| 6742 | // | xapp | | submgr | | e2term | |
| 6743 | // +-------+ +---------+ +---------+ |
| 6744 | // | | | |
| 6745 | // | [SUBS CREATE] | |
| 6746 | // | | | |
| 6747 | // | | | |
| 6748 | // | RESTSubDelReq | | |
| 6749 | // |---------------->| | |
| 6750 | // | | | |
| 6751 | // | RESTSubDelResp | | |
| 6752 | // |<----------------| | |
| 6753 | // | | | |
| 6754 | // | | SubDelReq | |
| 6755 | // | |------------->| |
| 6756 | // | | | |
| 6757 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6758 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6759 | // | | | |
| 6760 | // | | SubDelReq | |
| 6761 | // | |------------->| |
| 6762 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6763 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 6764 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 6765 | // | | | |
| 6766 | // | [SUBS DELETE] | |
| 6767 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6768 | //----------------------------------------------------------------------------- |
| 6769 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6770 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6771 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6772 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6773 | Counter{cRestSubReqFromXapp, 1}, |
| 6774 | Counter{cRestSubRespToXapp, 1}, |
| 6775 | Counter{cSubReqToE2, 1}, |
| 6776 | Counter{cSubRespFromE2, 1}, |
| 6777 | Counter{cRestSubNotifToXapp, 1}, |
| 6778 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6779 | Counter{cRestSubDelRespToXapp, 1}, |
| 6780 | Counter{cSubDelReqToE2, 1}, |
| 6781 | Counter{cSubDelReqTimerExpiry, 2}, |
| 6782 | Counter{cSubDelReReqToE2, 1}, |
| 6783 | Counter{cSubDelRespFromE2, 1}, |
| 6784 | Counter{cSubDelFailFromE2, 1}, |
| 6785 | }) |
| 6786 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6787 | // Req |
| 6788 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6789 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6790 | |
| 6791 | // Del |
| 6792 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6793 | |
| 6794 | // E2t: Receive 1st SubsDelReq |
| 6795 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6796 | |
| 6797 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6798 | |
| 6799 | // No transaction exist for this response which will result resending original request |
| 6800 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6801 | |
| 6802 | // E2t: Receive 2nd SubsDelReq |
| 6803 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6804 | |
| 6805 | // Subscription does not exist in in E2 Node. |
| 6806 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6807 | |
| 6808 | // Wait that subs is cleaned |
| 6809 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6810 | |
| 6811 | xappConn1.TestMsgChanEmpty(t) |
| 6812 | e2termConn1.TestMsgChanEmpty(t) |
| 6813 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6814 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6815 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6816 | } |
| 6817 | |
| 6818 | //----------------------------------------------------------------------------- |
| 6819 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6820 | // |
| 6821 | // stub stub |
| 6822 | // +-------+ +---------+ +---------+ |
| 6823 | // | xapp | | submgr | | e2term | |
| 6824 | // +-------+ +---------+ +---------+ |
| 6825 | // | | | |
| 6826 | // | [SUBS CREATE] | |
| 6827 | // | | | |
| 6828 | // | | | |
| 6829 | // | RESTSubDelReq | | |
| 6830 | // |---------------->| | |
| 6831 | // | | | |
| 6832 | // | RESTSubDelResp | | |
| 6833 | // |<----------------| | |
| 6834 | // | | | |
| 6835 | // | | SubDelReq | |
| 6836 | // | |------------->| |
| 6837 | // | | | |
| 6838 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6839 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6840 | // | | | |
| 6841 | // | | SubDelReq | |
| 6842 | // | |------------->| |
| 6843 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6844 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6845 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6846 | // | | | |
| 6847 | // | [SUBS DELETE] | |
| 6848 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6849 | //----------------------------------------------------------------------------- |
| 6850 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6851 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6852 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6853 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6854 | Counter{cRestSubReqFromXapp, 1}, |
| 6855 | Counter{cRestSubRespToXapp, 1}, |
| 6856 | Counter{cSubReqToE2, 1}, |
| 6857 | Counter{cSubRespFromE2, 1}, |
| 6858 | Counter{cRestSubNotifToXapp, 1}, |
| 6859 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6860 | Counter{cRestSubDelRespToXapp, 1}, |
| 6861 | Counter{cSubDelReqToE2, 1}, |
| 6862 | Counter{cSubDelReqTimerExpiry, 1}, |
| 6863 | Counter{cSubDelReReqToE2, 1}, |
| 6864 | Counter{cSubDelFailFromE2, 2}, |
| 6865 | }) |
| 6866 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6867 | // Req |
| 6868 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6869 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6870 | |
| 6871 | // Del |
| 6872 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6873 | |
| 6874 | // E2t: Receive 1st SubsDelReq |
| 6875 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6876 | |
| 6877 | // Decode of this response fails which will result resending original request |
| 6878 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6879 | |
| 6880 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6881 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6882 | |
| 6883 | // Subscription does not exist in in E2 Node. |
| 6884 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6885 | |
| 6886 | // Wait that subs is cleaned |
| 6887 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6888 | |
| 6889 | xappConn1.TestMsgChanEmpty(t) |
| 6890 | e2termConn1.TestMsgChanEmpty(t) |
| 6891 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6892 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6893 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6894 | } |
| 6895 | |
| 6896 | //----------------------------------------------------------------------------- |
| 6897 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6898 | // |
| 6899 | // stub stub |
| 6900 | // +-------+ +---------+ +---------+ |
| 6901 | // | xapp | | submgr | | e2term | |
| 6902 | // +-------+ +---------+ +---------+ |
| 6903 | // | | | |
| 6904 | // | [SUBS CREATE] | |
| 6905 | // | | | |
| 6906 | // | | | |
| 6907 | // | RESTSubDelReq | | |
| 6908 | // |---------------->| | |
| 6909 | // | | | |
| 6910 | // | RESTSubDelResp | | |
| 6911 | // |<----------------| | |
| 6912 | // | | | |
| 6913 | // | | SubDelReq | |
| 6914 | // | |------------->| |
| 6915 | // | | | |
| 6916 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6917 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6918 | // | | | |
| 6919 | // | | SubDelReq | |
| 6920 | // | |------------->| |
| 6921 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6922 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 6923 | // | |<-------------| No valid subscription found with subIds [0]. |
| 6924 | // | | | |
| 6925 | // | [SUBS DELETE] | |
| 6926 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6927 | //----------------------------------------------------------------------------- |
| 6928 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6929 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6930 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6931 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6932 | Counter{cRestSubReqFromXapp, 1}, |
| 6933 | Counter{cRestSubRespToXapp, 1}, |
| 6934 | Counter{cSubReqToE2, 1}, |
| 6935 | Counter{cSubRespFromE2, 1}, |
| 6936 | Counter{cRestSubNotifToXapp, 1}, |
| 6937 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6938 | Counter{cRestSubDelRespToXapp, 1}, |
| 6939 | Counter{cSubDelReqToE2, 1}, |
| 6940 | Counter{cSubDelReqTimerExpiry, 1}, |
| 6941 | Counter{cSubDelReReqToE2, 1}, |
| 6942 | Counter{cSubDelFailFromE2, 2}, |
| 6943 | }) |
| 6944 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6945 | // Req |
| 6946 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6947 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6948 | |
| 6949 | // Del |
| 6950 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6951 | |
| 6952 | // E2t: Receive 1st SubsDelReq |
| 6953 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6954 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6955 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6956 | delreq.RequestId.InstanceId = 0 |
| 6957 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6958 | |
| 6959 | // E2t: Receive 2nd SubsDelReq |
| 6960 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6961 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6962 | // Subscription does not exist in in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6963 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6964 | |
| 6965 | // Wait that subs is cleaned |
| 6966 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6967 | |
| 6968 | xappConn1.TestMsgChanEmpty(t) |
| 6969 | e2termConn1.TestMsgChanEmpty(t) |
| 6970 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6971 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6972 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6973 | } |
| 6974 | |
| 6975 | //----------------------------------------------------------------------------- |
| 6976 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6977 | // |
| 6978 | // stub stub |
| 6979 | // +-------+ +---------+ +---------+ |
| 6980 | // | xapp | | submgr | | e2term | |
| 6981 | // +-------+ +---------+ +---------+ |
| 6982 | // | | | |
| 6983 | // | [SUBS CREATE] | |
| 6984 | // | | | |
| 6985 | // | | | |
| 6986 | // | RESTSubDelReq | | |
| 6987 | // |---------------->| | |
| 6988 | // | | | |
| 6989 | // | RESTSubDelResp | | |
| 6990 | // |<----------------| | |
| 6991 | // | | | |
| 6992 | // | | SubDelReq | |
| 6993 | // | |------------->| |
| 6994 | // | | | |
| 6995 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 6996 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6997 | // | | | |
| 6998 | // | | SubDelReq | |
| 6999 | // | |------------->| |
| 7000 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 7001 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7002 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 7003 | // | | | |
| 7004 | // | [SUBS DELETE] | |
| 7005 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7006 | //----------------------------------------------------------------------------- |
| 7007 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7008 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7009 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 7010 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7011 | Counter{cRestSubReqFromXapp, 1}, |
| 7012 | Counter{cRestSubRespToXapp, 1}, |
| 7013 | Counter{cSubReqToE2, 1}, |
| 7014 | Counter{cSubRespFromE2, 1}, |
| 7015 | Counter{cRestSubNotifToXapp, 1}, |
| 7016 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7017 | Counter{cRestSubDelRespToXapp, 1}, |
| 7018 | Counter{cSubDelReqToE2, 1}, |
| 7019 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7020 | Counter{cSubDelReReqToE2, 1}, |
| 7021 | Counter{cSubDelFailFromE2, 2}, |
| 7022 | }) |
| 7023 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7024 | // Req |
| 7025 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7026 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7027 | |
| 7028 | // Del |
| 7029 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7030 | |
| 7031 | // E2t: Receive 1st SubsDelReq |
| 7032 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7033 | |
| 7034 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 7035 | |
| 7036 | // No transaction exist for this response which will result resending original request |
| 7037 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7038 | |
| 7039 | // E2t: Receive 2nd SubsDelReq |
| 7040 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7041 | |
| 7042 | // Subscription does not exist in in E2 Node. |
| 7043 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7044 | |
| 7045 | // Wait that subs is cleaned |
| 7046 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7047 | |
| 7048 | xappConn1.TestMsgChanEmpty(t) |
| 7049 | e2termConn1.TestMsgChanEmpty(t) |
| 7050 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7051 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 7052 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7053 | } |
| 7054 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7055 | //----------------------------------------------------------------------------- |
| 7056 | // TestRESTSubReqFailAsn1PackSubReqError |
| 7057 | // |
| 7058 | // stub stub |
| 7059 | // +-------+ +---------+ +---------+ |
| 7060 | // | xapp | | submgr | | e2term | |
| 7061 | // +-------+ +---------+ +---------+ |
| 7062 | // | | | |
| 7063 | // | RESTSubReq | | |
| 7064 | // |---------------->| | |
| 7065 | // | | | |
| 7066 | // | RESTSubResp | | |
| 7067 | // |<----------------| | |
| 7068 | // | | | |
| 7069 | // | ASN.1 encode fails | |
| 7070 | // | | | |
| 7071 | // | | SubDelReq | |
| 7072 | // | |------------->| |
| 7073 | // | | | |
| 7074 | // | | SubDelFail | |
| 7075 | // | |<-------------| |
| 7076 | // | | | |
| 7077 | // | RESTNotif | | |
| 7078 | // | unsuccess | | |
| 7079 | // |<----------------| | |
| 7080 | // | | | |
| 7081 | // | [SUBS DELETE] | |
| 7082 | // | | | |
| 7083 | // |
| 7084 | //----------------------------------------------------------------------------- |
| 7085 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 7086 | |
| 7087 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7088 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7089 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7090 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7091 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7092 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7093 | }) |
| 7094 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7095 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7096 | |
| 7097 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7098 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7099 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 7100 | |
| 7101 | // Req |
| 7102 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7103 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7104 | |
| 7105 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7106 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7107 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7108 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7109 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7110 | |
| 7111 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7112 | |
| 7113 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7114 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7115 | // Wait that subs is cleaned |
| 7116 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7117 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 7118 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 7119 | } |
| 7120 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7121 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 7122 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 7123 | |
| 7124 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7125 | Counter{cRestSubReqFromXapp, 2}, |
| 7126 | Counter{cRestSubRespToXapp, 2}, |
| 7127 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 7128 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7129 | Counter{cSubRespFromE2, 1}, |
| 7130 | Counter{cRestSubNotifToXapp, 1}, |
| 7131 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7132 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7133 | Counter{cSubDelReqToE2, 1}, |
| 7134 | Counter{cSubDelRespFromE2, 1}, |
| 7135 | Counter{cRestSubDelRespToXapp, 1}, |
| 7136 | }) |
| 7137 | |
| 7138 | const e2Timeout int64 = 1 |
| 7139 | const e2RetryCount int64 = 0 |
| 7140 | const routingNeeded bool = false |
| 7141 | |
| 7142 | // Req1 |
| 7143 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7144 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7145 | |
| 7146 | // Subs Create |
| 7147 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7148 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7149 | |
| 7150 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7151 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7152 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7153 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7154 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 7155 | |
| 7156 | // Policy change |
| 7157 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7158 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7159 | params.SetSubscriptionID(&restSubId) |
| 7160 | params.SetTimeToWait("w200ms") |
| 7161 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 7162 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7163 | |
| 7164 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 7165 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 7166 | // SubsResp is missing, e2SubsId will be 0 |
| 7167 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7168 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7169 | |
| 7170 | // Del |
| 7171 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7172 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7173 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7174 | |
| 7175 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7176 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame^] | 7177 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7178 | } |
| 7179 | |
| 7180 | //----------------------------------------------------------------------------- |
| 7181 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 7182 | // |
| 7183 | // stub stub |
| 7184 | // +-------+ +---------+ +---------+ |
| 7185 | // | xapp | | submgr | | e2term | |
| 7186 | // +-------+ +---------+ +---------+ |
| 7187 | // | | | |
| 7188 | // | RESTSubReq | | |
| 7189 | // |---------------->| | |
| 7190 | // | | | |
| 7191 | // | RESTSubResp | | |
| 7192 | // |<----------------| | |
| 7193 | // | | SubReq | |
| 7194 | // | |------------->| |
| 7195 | // | | | |
| 7196 | // | | SubResp | |
| 7197 | // | |<-------------| |
| 7198 | // | | | |
| 7199 | // | RESTNotif | | |
| 7200 | // |<----------------| | |
| 7201 | // | | | |
| 7202 | // | RESTSubReq | | |
| 7203 | // |---------------->| | |
| 7204 | // | | | |
| 7205 | // | RESTSubResp | | |
| 7206 | // |<----------------| | |
| 7207 | // | | SubReq | |
| 7208 | // | |------------->| |
| 7209 | // | | |
| 7210 | // | Submgr restart | |
| 7211 | // | | | |
| 7212 | // | RESTSubDelReq | | |
| 7213 | // |---------------->| | |
| 7214 | // | | | |
| 7215 | // | | SubDelReq | |
| 7216 | // | |------------->| |
| 7217 | // | | | |
| 7218 | // | | SubDelResp | |
| 7219 | // | |<-------------| |
| 7220 | // | | | |
| 7221 | // | RESTSubDelResp | | |
| 7222 | // |<----------------| | |
| 7223 | // |
| 7224 | //----------------------------------------------------------------------------- |
| 7225 | |
| 7226 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 7227 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 7228 | |
| 7229 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7230 | Counter{cRestSubReqFromXapp, 2}, |
| 7231 | Counter{cRestSubRespToXapp, 2}, |
| 7232 | Counter{cSubReqToE2, 2}, |
| 7233 | Counter{cSubRespFromE2, 1}, |
| 7234 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7235 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7236 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 7237 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7238 | Counter{cRestSubDelRespToXapp, 1}, |
| 7239 | }) |
| 7240 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7241 | const e2Timeout int64 = 1 |
| 7242 | const e2RetryCount int64 = 0 |
| 7243 | const routingNeeded bool = false |
| 7244 | |
| 7245 | // Req1 |
| 7246 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7247 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7248 | // Create subscription |
| 7249 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7250 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7251 | |
| 7252 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7253 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7254 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7255 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7256 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 7257 | |
| 7258 | // Check subscription |
| 7259 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7260 | |
| 7261 | // Policy change |
| 7262 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7263 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7264 | params.SetSubscriptionID(&restSubId) |
| 7265 | params.SetTimeToWait("w200ms") |
| 7266 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 7267 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 7268 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7269 | |
| 7270 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 7271 | mainCtrl.SetResetTestFlag(t, false) |
| 7272 | |
| 7273 | // SubsResp is missing due to submgr restart |
| 7274 | |
| 7275 | mainCtrl.SimulateRestart(t) |
| 7276 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 7277 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7278 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 7279 | // That needs to be completed before successful subscription query is possible |
| 7280 | <-time.After(time.Second * 1) |
| 7281 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7282 | // Check subscription |
| 7283 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7284 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7285 | // Delete subscription |
| 7286 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7287 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7288 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7289 | |
| 7290 | //Wait that subs is cleaned |
| 7291 | waitSubsCleanup(t, e2SubsId, 10) |
| 7292 | |
| 7293 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7294 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7295 | } |
| 7296 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7297 | //////////////////////////////////////////////////////////////////////////////////// |
| 7298 | // Services for UT cases |
| 7299 | //////////////////////////////////////////////////////////////////////////////////// |
| 7300 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7301 | const host string = "localhost" |
| 7302 | |
| 7303 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 7304 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7305 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7306 | } |
| 7307 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7308 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7309 | |
| 7310 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 7311 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7312 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 7313 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7314 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7315 | |
| 7316 | return restSubId, e2SubsId |
| 7317 | } |
| 7318 | |
| 7319 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 7320 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7321 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7322 | if meid != "" { |
| 7323 | params.SetMeid(meid) |
| 7324 | } |
| 7325 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 7326 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 7327 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7328 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7329 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7330 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7331 | |
| 7332 | return restSubId, e2SubsId |
| 7333 | } |
| 7334 | |
| 7335 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7336 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7337 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7338 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7339 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7340 | |
| 7341 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7342 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7343 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7344 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7345 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7346 | |
| 7347 | return restSubId, e2SubsId |
| 7348 | } |
| 7349 | |
| 7350 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7351 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7352 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7353 | |
| 7354 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7355 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7356 | fparams1.Set(crereq1) |
| 7357 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7358 | |
| 7359 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7360 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7361 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7362 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7363 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7364 | |
| 7365 | return restSubId, e2SubsId |
| 7366 | } |
| 7367 | |
| 7368 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7369 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7370 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7371 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7372 | } |
| 7373 | |
| 7374 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7375 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7376 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7377 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7378 | } |
| 7379 | |
| 7380 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7381 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7382 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7383 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7384 | } |
| 7385 | |
| 7386 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7387 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7388 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 7389 | assert.Equal(t, meid, resp[0].Meid) |
| 7390 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7391 | } |
| 7392 | |
| 7393 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7394 | //Wait that subs is cleaned |
| 7395 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7396 | |
| 7397 | xappConn1.TestMsgChanEmpty(t) |
| 7398 | xappConn2.TestMsgChanEmpty(t) |
| 7399 | e2termConn1.TestMsgChanEmpty(t) |
| 7400 | mainCtrl.wait_registry_empty(t, timeout) |
| 7401 | } |
| 7402 | |
| 7403 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7404 | |
| 7405 | var e2SubsId []uint32 |
| 7406 | |
| 7407 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7408 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7409 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7410 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7411 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7412 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7413 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7414 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7415 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7416 | <-time.After(100 * time.Millisecond) |
| 7417 | } |
| 7418 | return e2SubsId |
| 7419 | } |
| 7420 | |
| 7421 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7422 | |
| 7423 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7424 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7425 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7426 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7427 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7428 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7429 | <-time.After(100 * time.Millisecond) |
| 7430 | } |
| 7431 | |
| 7432 | // Wait that subs is cleaned |
| 7433 | for i := 0; i < len(e2SubsIds); i++ { |
| 7434 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7435 | } |
| 7436 | |
| 7437 | } |