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 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 49 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 50 | Counter{cE2StateChangedToUp, 3}, |
| 51 | }) |
| 52 | |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 53 | // Current UT test cases use these ran names |
| 54 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 55 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 56 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 57 | |
| 58 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 59 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 60 | |
| 61 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 62 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 63 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 64 | |
| 65 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | //----------------------------------------------------------------------------- |
| 69 | // TestRESTSubReqAfterE2ConnBreak |
| 70 | // |
| 71 | // stub stub |
| 72 | // +-------+ +---------+ +---------+ |
| 73 | // | xapp | | submgr | | e2term | |
| 74 | // +-------+ +---------+ +---------+ |
| 75 | // | | | |
| 76 | // | [E2 Conn. DOWN] | |
| 77 | // | | | |
| 78 | // | RESTSubReq | | |
| 79 | // |---------------->| | |
| 80 | // | RESTSubFail | | |
| 81 | // |<----------------| | |
| 82 | // | | | |
| 83 | // |
| 84 | //----------------------------------------------------------------------------- |
| 85 | |
| 86 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
| 87 | CaseBegin("TestRESTSubReqAfterE2ConnBreak") |
| 88 | |
| 89 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 90 | Counter{cRestSubReqFromXapp, 1}, |
| 91 | Counter{cRestReqRejDueE2Down, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 92 | Counter{cE2StateChangedToDown, 1}, |
| 93 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 94 | }) |
| 95 | |
| 96 | // E2 disconnect after E2term has received response |
| 97 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 98 | // Req |
| 99 | const subReqCount int = 1 |
| 100 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 101 | xappConn1.SendRESTSubsReq(t, params) |
| 102 | |
| 103 | // Restore E2 connection for following test cases |
| 104 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 105 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 106 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 107 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 108 | //os.Exit(0) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | //----------------------------------------------------------------------------- |
| 112 | // TestRESTSubReqE2ConnBreak |
| 113 | // |
| 114 | // stub stub |
| 115 | // +-------+ +---------+ +---------+ |
| 116 | // | xapp | | submgr | | e2term | |
| 117 | // +-------+ +---------+ +---------+ |
| 118 | // | | | |
| 119 | // | RESTSubReq | | |
| 120 | // |---------------->| | |
| 121 | // | RESTSubResp | | |
| 122 | // |<----------------| | |
| 123 | // | | SubReq | |
| 124 | // | |------------->| |
| 125 | // | | SubResp | |
| 126 | // | |<-------------| |
| 127 | // | | | |
| 128 | // | [E2 Conn. DOWN] | |
| 129 | // | [Int. SUBS DELETE] | |
| 130 | // | | | |
| 131 | // | RESTNotif(unsuccessful) | |
| 132 | // |<----------------| | |
| 133 | // | | | |
| 134 | // | | | |
| 135 | // |
| 136 | //----------------------------------------------------------------------------- |
| 137 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
| 138 | CaseBegin("TestRESTSubReqE2ConnBreak") |
| 139 | |
| 140 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 141 | Counter{cRestSubReqFromXapp, 1}, |
| 142 | Counter{cRestSubRespToXapp, 1}, |
| 143 | Counter{cSubReqToE2, 1}, |
| 144 | Counter{cSubRespFromE2, 1}, |
| 145 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 146 | Counter{cE2StateChangedToDown, 1}, |
| 147 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 148 | }) |
| 149 | |
| 150 | // Req |
| 151 | const subReqCount int = 1 |
| 152 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 153 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 154 | |
| 155 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 156 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 157 | |
| 158 | // E2 disconnect after E2term has received response |
| 159 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 160 | |
| 161 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 162 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 163 | |
| 164 | <-time.After(time.Second * 1) |
| 165 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 166 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 167 | |
| 168 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 169 | if err != nil { |
| 170 | xapp.Logger.Error("%v", err) |
| 171 | } else { |
| 172 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 173 | assert.Equal(t, 0, len(register)) |
| 174 | } |
| 175 | |
| 176 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 177 | if err != nil { |
| 178 | xapp.Logger.Error("%v", err) |
| 179 | } else { |
| 180 | assert.Equal(t, 0, len(restSubscriptions)) |
| 181 | } |
| 182 | |
| 183 | // Restore E2 connection for following test cases |
| 184 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 185 | |
| 186 | // Wait that subs is cleaned |
| 187 | waitSubsCleanup(t, e2SubsId, 10) |
| 188 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 189 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | //----------------------------------------------------------------------------- |
| 193 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 194 | // |
| 195 | // stub stub |
| 196 | // +-------+ +---------+ +---------+ |
| 197 | // | xapp | | submgr | | e2term | |
| 198 | // +-------+ +---------+ +---------+ |
| 199 | // | | | |
| 200 | // | [SUBS CREATE] | |
| 201 | // | | | |
| 202 | // | [E2 Conn. DOWN] | |
| 203 | // | | | |
| 204 | // | RESTSubDelReq | | |
| 205 | // |---------------->| | |
| 206 | // | | | |
| 207 | // | RESTSubDelResp | | |
| 208 | // |<----------------| | |
| 209 | // | | | |
| 210 | // | [No valid subscription found] | |
| 211 | // | | | |
| 212 | // |
| 213 | //----------------------------------------------------------------------------- |
| 214 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 215 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 216 | |
| 217 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 218 | Counter{cRestSubReqFromXapp, 1}, |
| 219 | Counter{cRestSubRespToXapp, 1}, |
| 220 | Counter{cSubReqToE2, 1}, |
| 221 | Counter{cSubRespFromE2, 1}, |
| 222 | Counter{cRestSubNotifToXapp, 1}, |
| 223 | Counter{cRestSubDelReqFromXapp, 1}, |
| 224 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 225 | Counter{cE2StateChangedToDown, 1}, |
| 226 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 227 | }) |
| 228 | |
| 229 | // Req |
| 230 | var params *teststube2ap.RESTSubsReqParams = nil |
| 231 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 232 | |
| 233 | // E2 disconnect after E2term has received response |
| 234 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 235 | |
| 236 | // Del |
| 237 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 238 | |
| 239 | <-time.After(time.Second * 1) |
| 240 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 241 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 242 | |
| 243 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 244 | if err != nil { |
| 245 | xapp.Logger.Error("%v", err) |
| 246 | } else { |
| 247 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 248 | assert.Equal(t, 0, len(register)) |
| 249 | } |
| 250 | |
| 251 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 252 | if err != nil { |
| 253 | xapp.Logger.Error("%v", err) |
| 254 | } else { |
| 255 | assert.Equal(t, 0, len(restSubscriptions)) |
| 256 | } |
| 257 | |
| 258 | // Restore E2 connection for following test cases |
| 259 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 260 | |
| 261 | // Wait that subs is cleaned |
| 262 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 263 | |
| 264 | xappConn1.TestMsgChanEmpty(t) |
| 265 | e2termConn1.TestMsgChanEmpty(t) |
| 266 | mainCtrl.wait_registry_empty(t, 10) |
| 267 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 268 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | //----------------------------------------------------------------------------- |
| 272 | // TestRESTOtherE2ConnectionChanges |
| 273 | // |
| 274 | |
| 275 | // stub stub |
| 276 | // +-------+ +---------+ +---------+ |
| 277 | // | xapp | | submgr | | e2term | |
| 278 | // +-------+ +---------+ +---------+ |
| 279 | // | | | |
| 280 | // | [SUBS CREATE] | |
| 281 | // | | | |
| 282 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 283 | // | [E2 CONNECTING] | |
| 284 | // | [E2 SHUTTING_DOWN] | |
| 285 | // | [E2 SHUT_DOWN] | |
| 286 | // | | | |
| 287 | // | [SUBS DELETE] | |
| 288 | // | | | |
| 289 | // |
| 290 | //----------------------------------------------------------------------------- |
| 291 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 292 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 293 | |
| 294 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 295 | Counter{cRestSubReqFromXapp, 1}, |
| 296 | Counter{cRestSubRespToXapp, 1}, |
| 297 | Counter{cSubReqToE2, 1}, |
| 298 | Counter{cSubRespFromE2, 1}, |
| 299 | Counter{cRestSubNotifToXapp, 1}, |
| 300 | Counter{cRestSubDelReqFromXapp, 1}, |
| 301 | Counter{cSubDelReqToE2, 1}, |
| 302 | Counter{cSubDelRespFromE2, 1}, |
| 303 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 304 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 305 | }) |
| 306 | |
| 307 | // Req |
| 308 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 309 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 310 | |
| 311 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 312 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 313 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 314 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 315 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame^] | 316 | // Submgr should not react to any other connection state changes than CONNECTED and DISCONNECTED |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 317 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 318 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 319 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 320 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 321 | |
| 322 | // Del |
| 323 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 324 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 325 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 326 | |
| 327 | // Restore E2 connection for following test cases |
| 328 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 329 | |
| 330 | // Wait that subs is cleaned |
| 331 | waitSubsCleanup(t, e2SubsId, 10) |
| 332 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 333 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 334 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 335 | |
| 336 | //----------------------------------------------------------------------------- |
| 337 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 338 | // |
| 339 | // stub stub stub |
| 340 | // +-------+ +---------+ +---------+ +---------+ |
| 341 | // | xapp | | submgr | | e2term | | rtmgr | |
| 342 | // +-------+ +---------+ +---------+ +---------+ |
| 343 | // | | | | |
| 344 | // | RESTSubReq | | | |
| 345 | // |---------------->| | | |
| 346 | // | | RouteCreate | | |
| 347 | // | |--------------------------->| // The order of these events may vary |
| 348 | // | | | | |
| 349 | // | RESTSubResp | | | // The order of these events may vary |
| 350 | // |<----------------| | | |
| 351 | // | | RouteResponse| | |
| 352 | // | |<---------------------------| // The order of these events may vary |
| 353 | // | | | | |
| 354 | // | | SubReq | | |
| 355 | // | |------------->| | // The order of these events may vary |
| 356 | // | | | | |
| 357 | // | | SubResp | | |
| 358 | // | |<-------------| | |
| 359 | // | RESTNotif1 | | | |
| 360 | // |<----------------| | | |
| 361 | // | | | | |
| 362 | // | RESTSubDelReq | | | |
| 363 | // |---------------->| | | |
| 364 | // | | SubDelReq | | |
| 365 | // | |------------->| | |
| 366 | // | | | | |
| 367 | // | RESTSubDelResp| | | |
| 368 | // |<----------------| | | |
| 369 | // | | | | |
| 370 | // | | SubDelResp | | |
| 371 | // | |<-------------| | |
| 372 | // | | | | |
| 373 | // | | | | |
| 374 | // |
| 375 | //----------------------------------------------------------------------------- |
| 376 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 377 | |
| 378 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 379 | |
| 380 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 381 | |
| 382 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 383 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 384 | } |
| 385 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 386 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 387 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 388 | // |
| 389 | // stub stub stub |
| 390 | // +-------+ +---------+ +---------+ +---------+ |
| 391 | // | xapp | | submgr | | e2term | | rtmgr | |
| 392 | // +-------+ +---------+ +---------+ +---------+ |
| 393 | // | | | | |
| 394 | // | RESTSubReq | | | |
| 395 | // |---------------->| | | |
| 396 | // | | RouteCreate | | |
| 397 | // | |--------------------------->| // The order of these events may vary |
| 398 | // | | | | |
| 399 | // | RESTSubResp | | | // The order of these events may vary |
| 400 | // |<----------------| | | |
| 401 | // | | RouteResponse| | |
| 402 | // | |<---------------------------| // The order of these events may vary |
| 403 | // | | | | |
| 404 | // | | SubReq | | |
| 405 | // | |------------->| | // The order of these events may vary |
| 406 | // | | | | |
| 407 | // | | SubResp | | |
| 408 | // | |<-------------| | |
| 409 | // | RESTNotif1 | | | |
| 410 | // |<----------------| | | |
| 411 | // | | | | |
| 412 | // | RESTSubDelReq | | | |
| 413 | // |---------------->| | | |
| 414 | // | | | | |
| 415 | // | RESTSubDelResp| | | |
| 416 | // |<----------------| | | |
| 417 | // | | | | |
| 418 | // | | | | |
| 419 | // |
| 420 | //----------------------------------------------------------------------------- |
| 421 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 422 | |
| 423 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 424 | |
| 425 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 426 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 427 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 428 | |
| 429 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 430 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | //----------------------------------------------------------------------------- |
| 434 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 435 | // |
| 436 | // stub stub stub |
| 437 | // +-------+ +---------+ +---------+ +---------+ |
| 438 | // | xapp | | submgr | | e2term | | rtmgr | |
| 439 | // +-------+ +---------+ +---------+ +---------+ |
| 440 | // | | | | |
| 441 | // | RESTSubReq | | | |
| 442 | // |---------------->| | | |
| 443 | // | | RouteCreate | | |
| 444 | // | |--------------------------->| // The order of these events may vary |
| 445 | // | | | | |
| 446 | // | RESTSubResp | | | // The order of these events may vary |
| 447 | // |<----------------| | | |
| 448 | // | | RouteResponse| | |
| 449 | // | |<---------------------------| // The order of these events may vary |
| 450 | // | | | | |
| 451 | // | | SubReq | | |
| 452 | // | |------------->| | // The order of these events may vary |
| 453 | // | | | | |
| 454 | // | | SubResp | | |
| 455 | // | |<-------------| | |
| 456 | // | RESTNotif1 | | | |
| 457 | // |<----------------| | | |
| 458 | // | | | | |
| 459 | // | RESTSubDelReq | | | |
| 460 | // |---------------->| | | |
| 461 | // | | SubDelReq | | |
| 462 | // | |------------->| | |
| 463 | // | | | | |
| 464 | // | RESTSubDelResp| | | |
| 465 | // |<----------------| | | // The order of these events may vary |
| 466 | // | | | | |
| 467 | // | | SubDelResp | | |
| 468 | // | |<-------------| | // 1.st NOK |
| 469 | // | | | | |
| 470 | // | | SubDelReq | | |
| 471 | // | |------------->| | |
| 472 | // | | | | |
| 473 | // | | SubDelResp | | |
| 474 | // | |<-------------| | // 2.nd NOK |
| 475 | // |
| 476 | //----------------------------------------------------------------------------- |
| 477 | |
| 478 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 479 | |
| 480 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 481 | |
| 482 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 483 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 484 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 485 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 486 | |
| 487 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 488 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 489 | |
| 490 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 491 | |
| 492 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 493 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 494 | } |
| 495 | |
| 496 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 497 | // TestSubReqAndRouteNok |
| 498 | // |
| 499 | // stub stub |
| 500 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 501 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 502 | // +-------+ +---------+ +---------+ |
| 503 | // | | | |
| 504 | // | SubReq | | |
| 505 | // |------------->| | |
| 506 | // | | | |
| 507 | // | | RouteCreate | |
| 508 | // | |------------->| |
| 509 | // | | | |
| 510 | // | | RouteCreate | |
| 511 | // | | status:400 | |
| 512 | // | |<-------------| |
| 513 | // | | | |
| 514 | // | [SUBS INT DELETE] | |
| 515 | // | | | |
| 516 | // |
| 517 | //----------------------------------------------------------------------------- |
| 518 | |
| 519 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 520 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 521 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 522 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 523 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 524 | Counter{cSubReqFromXapp, 1}, |
| 525 | Counter{cRouteCreateFail, 1}, |
| 526 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 527 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 528 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 529 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 530 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 531 | waiter.WaitResult(t) |
| 532 | |
| 533 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 534 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 535 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 536 | xappConn1.TestMsgChanEmpty(t) |
| 537 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 538 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 539 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 540 | |
| 541 | <-time.After(1 * time.Second) |
| 542 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 546 | // TestSubReqAndRouteUpdateNok |
| 547 | |
| 548 | // stub stub |
| 549 | // +-------+ +-------+ +---------+ +---------+ |
| 550 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 551 | // +-------+ +-------+ +---------+ +---------+ |
| 552 | // | | | | |
| 553 | // | [SUBS CREATE] | | |
| 554 | // | | | | |
| 555 | // | | | | |
| 556 | // | | | | |
| 557 | // | SubReq (mergeable) | | |
| 558 | // |--------------------------->| | | |
| 559 | // | | | | |
| 560 | // | | | RouteUpdate | |
| 561 | // | | |------------->| |
| 562 | // | | | | |
| 563 | // | | | RouteUpdate | |
| 564 | // | | | status:400 | |
| 565 | // | | |<-------------| |
| 566 | // | | | | |
| 567 | // | [SUBS INT DELETE] | | |
| 568 | // | | | | |
| 569 | // | | | | |
| 570 | // | [SUBS DELETE] | | |
| 571 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 572 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 573 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 574 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 575 | |
| 576 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 577 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 578 | Counter{cSubReqFromXapp, 2}, |
| 579 | Counter{cSubReqToE2, 1}, |
| 580 | Counter{cSubRespFromE2, 1}, |
| 581 | Counter{cSubRespToXapp, 1}, |
| 582 | Counter{cRouteCreateUpdateFail, 1}, |
| 583 | Counter{cSubDelReqFromXapp, 1}, |
| 584 | Counter{cSubDelReqToE2, 1}, |
| 585 | Counter{cSubDelRespFromE2, 1}, |
| 586 | Counter{cSubDelRespToXapp, 1}, |
| 587 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 588 | |
| 589 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 590 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 591 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 592 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 593 | |
| 594 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 595 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 596 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 597 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 598 | |
| 599 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 600 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 601 | xappConn2.SendSubsReq(t, nil, nil) |
| 602 | waiter.WaitResult(t) |
| 603 | |
| 604 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 605 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 606 | |
| 607 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 608 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 609 | |
| 610 | //Wait that subs is cleaned |
| 611 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 612 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 613 | |
| 614 | xappConn1.TestMsgChanEmpty(t) |
| 615 | xappConn2.TestMsgChanEmpty(t) |
| 616 | e2termConn1.TestMsgChanEmpty(t) |
| 617 | mainCtrl.wait_registry_empty(t, 10) |
| 618 | |
| 619 | mainCtrl.VerifyCounterValues(t) |
| 620 | } |
| 621 | |
| 622 | //----------------------------------------------------------------------------- |
| 623 | // TestSubDelReqAndRouteDeleteNok |
| 624 | // |
| 625 | // stub stub |
| 626 | // +-------+ +---------+ +---------+ +---------+ |
| 627 | // | xapp | | submgr | | e2term | | rtmgr | |
| 628 | // +-------+ +---------+ +---------+ +---------+ |
| 629 | // | | | | |
| 630 | // | [SUBS CREATE] | | |
| 631 | // | | | | |
| 632 | // | | | | |
| 633 | // | | | | |
| 634 | // | SubDelReq | | | |
| 635 | // |------------->| | | |
| 636 | // | | SubDelReq | | |
| 637 | // | |------------->| | |
| 638 | // | | SubDelRsp | | |
| 639 | // | |<-------------| | |
| 640 | // | SubDelRsp | | | |
| 641 | // |<-------------| | | |
| 642 | // | | RouteDelete | | |
| 643 | // | |---------------------------->| |
| 644 | // | | | | |
| 645 | // | | RouteDelete | | |
| 646 | // | | status:400 | | |
| 647 | // | |<----------------------------| |
| 648 | // | | | | |
| 649 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 650 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 651 | |
| 652 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 653 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 654 | Counter{cSubReqFromXapp, 1}, |
| 655 | Counter{cSubReqToE2, 1}, |
| 656 | Counter{cSubRespFromE2, 1}, |
| 657 | Counter{cSubRespToXapp, 1}, |
| 658 | Counter{cSubDelReqFromXapp, 1}, |
| 659 | Counter{cRouteDeleteFail, 1}, |
| 660 | Counter{cSubDelReqToE2, 1}, |
| 661 | Counter{cSubDelRespFromE2, 1}, |
| 662 | Counter{cSubDelRespToXapp, 1}, |
| 663 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 664 | |
| 665 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 666 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 667 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 668 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 669 | |
| 670 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 671 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 672 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 673 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 674 | |
| 675 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 676 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 677 | |
| 678 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 679 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 680 | waiter.WaitResult(t) |
| 681 | |
| 682 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 683 | |
| 684 | //Wait that subs is cleaned |
| 685 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 686 | |
| 687 | xappConn1.TestMsgChanEmpty(t) |
| 688 | xappConn2.TestMsgChanEmpty(t) |
| 689 | e2termConn1.TestMsgChanEmpty(t) |
| 690 | mainCtrl.wait_registry_empty(t, 10) |
| 691 | |
| 692 | mainCtrl.VerifyCounterValues(t) |
| 693 | } |
| 694 | |
| 695 | //----------------------------------------------------------------------------- |
| 696 | // TestSubMergeDelAndRouteUpdateNok |
| 697 | // stub stub |
| 698 | // +-------+ +-------+ +---------+ +---------+ |
| 699 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 700 | // +-------+ +-------+ +---------+ +---------+ |
| 701 | // | | | | |
| 702 | // | | | | |
| 703 | // | | | | |
| 704 | // | | SubReq1 | | |
| 705 | // | |------------->| | |
| 706 | // | | | | |
| 707 | // | | | SubReq1 | |
| 708 | // | | |------------->| |
| 709 | // | | | SubResp1 | |
| 710 | // | | |<-------------| |
| 711 | // | | SubResp1 | | |
| 712 | // | |<-------------| | |
| 713 | // | | | | |
| 714 | // | SubReq2 | | |
| 715 | // |--------------------------->| | |
| 716 | // | | | | |
| 717 | // | SubResp2 | | |
| 718 | // |<---------------------------| | |
| 719 | // | | | | |
| 720 | // | | SubDelReq 1 | | |
| 721 | // | |------------->| | |
| 722 | // | | | RouteUpdate | |
| 723 | // | | |-----> rtmgr | |
| 724 | // | | | | |
| 725 | // | | | RouteUpdate | |
| 726 | // | | | status:400 | |
| 727 | // | | |<----- rtmgr | |
| 728 | // | | | | |
| 729 | // | | SubDelResp 1 | | |
| 730 | // | |<-------------| | |
| 731 | // | | | | |
| 732 | // | SubDelReq 2 | | |
| 733 | // |--------------------------->| | |
| 734 | // | | | | |
| 735 | // | | | SubDelReq 2 | |
| 736 | // | | |------------->| |
| 737 | // | | | | |
| 738 | // | | | SubDelReq 2 | |
| 739 | // | | |------------->| |
| 740 | // | | | | |
| 741 | // | SubDelResp 2 | | |
| 742 | // |<---------------------------| | |
| 743 | // |
| 744 | //----------------------------------------------------------------------------- |
| 745 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 746 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 747 | |
| 748 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 749 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 750 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 751 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 752 | Counter{cSubReqToE2, 1}, |
| 753 | Counter{cSubRespFromE2, 1}, |
| 754 | Counter{cSubRespToXapp, 2}, |
| 755 | Counter{cSubDelReqFromXapp, 2}, |
| 756 | Counter{cRouteDeleteUpdateFail, 1}, |
| 757 | Counter{cSubDelReqToE2, 1}, |
| 758 | Counter{cSubDelRespFromE2, 1}, |
| 759 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 760 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 761 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 762 | |
| 763 | //Req1 |
| 764 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 765 | rparams1.Init() |
| 766 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 767 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 768 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 769 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 770 | |
| 771 | //Req2 |
| 772 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 773 | rparams2.Init() |
| 774 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 775 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 776 | |
| 777 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 778 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 779 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 780 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 781 | |
| 782 | //Del1 |
| 783 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 784 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 785 | waiter.WaitResult(t) |
| 786 | |
| 787 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 788 | |
| 789 | //Del2 |
| 790 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 791 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 792 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 793 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 794 | //Wait that subs is cleaned |
| 795 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 796 | |
| 797 | xappConn1.TestMsgChanEmpty(t) |
| 798 | xappConn2.TestMsgChanEmpty(t) |
| 799 | e2termConn1.TestMsgChanEmpty(t) |
| 800 | mainCtrl.wait_registry_empty(t, 10) |
| 801 | |
| 802 | mainCtrl.VerifyCounterValues(t) |
| 803 | } |
| 804 | |
| 805 | //----------------------------------------------------------------------------- |
| 806 | |
| 807 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 808 | // TestSubReqAndSubDelOk |
| 809 | // |
| 810 | // stub stub |
| 811 | // +-------+ +---------+ +---------+ |
| 812 | // | xapp | | submgr | | e2term | |
| 813 | // +-------+ +---------+ +---------+ |
| 814 | // | | | |
| 815 | // | SubReq | | |
| 816 | // |------------->| | |
| 817 | // | | | |
| 818 | // | | SubReq | |
| 819 | // | |------------->| |
| 820 | // | | | |
| 821 | // | | SubResp | |
| 822 | // | |<-------------| |
| 823 | // | | | |
| 824 | // | SubResp | | |
| 825 | // |<-------------| | |
| 826 | // | | | |
| 827 | // | | | |
| 828 | // | SubDelReq | | |
| 829 | // |------------->| | |
| 830 | // | | | |
| 831 | // | | SubDelReq | |
| 832 | // | |------------->| |
| 833 | // | | | |
| 834 | // | | SubDelResp | |
| 835 | // | |<-------------| |
| 836 | // | | | |
| 837 | // | SubDelResp | | |
| 838 | // |<-------------| | |
| 839 | // |
| 840 | //----------------------------------------------------------------------------- |
| 841 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 842 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 843 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 844 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 845 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 846 | Counter{cSubReqFromXapp, 1}, |
| 847 | Counter{cSubReqToE2, 1}, |
| 848 | Counter{cSubRespFromE2, 1}, |
| 849 | Counter{cSubRespToXapp, 1}, |
| 850 | Counter{cSubDelReqFromXapp, 1}, |
| 851 | Counter{cSubDelReqToE2, 1}, |
| 852 | Counter{cSubDelRespFromE2, 1}, |
| 853 | Counter{cSubDelRespToXapp, 1}, |
| 854 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 855 | |
| 856 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 857 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 858 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 859 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 860 | |
| 861 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 862 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 863 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 864 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 865 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 866 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 867 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 868 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 869 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 870 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 871 | |
| 872 | //Wait that subs is cleaned |
| 873 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 874 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 875 | xappConn1.TestMsgChanEmpty(t) |
| 876 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 877 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 878 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 879 | |
| 880 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | //----------------------------------------------------------------------------- |
| 884 | // TestSubReqRetransmission |
| 885 | // |
| 886 | // stub stub |
| 887 | // +-------+ +---------+ +---------+ |
| 888 | // | xapp | | submgr | | e2term | |
| 889 | // +-------+ +---------+ +---------+ |
| 890 | // | | | |
| 891 | // | SubReq | | |
| 892 | // |------------->| | |
| 893 | // | | | |
| 894 | // | | SubReq | |
| 895 | // | |------------->| |
| 896 | // | | | |
| 897 | // | SubReq | | |
| 898 | // | (retrans) | | |
| 899 | // |------------->| | |
| 900 | // | | | |
| 901 | // | | SubResp | |
| 902 | // | |<-------------| |
| 903 | // | | | |
| 904 | // | SubResp | | |
| 905 | // |<-------------| | |
| 906 | // | | | |
| 907 | // | [SUBS DELETE] | |
| 908 | // | | | |
| 909 | // |
| 910 | //----------------------------------------------------------------------------- |
| 911 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 912 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 913 | |
| 914 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 915 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 916 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 917 | |
| 918 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 921 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 922 | // hack as there is no real way to see has message be handled. |
| 923 | // Previuos counter check just tells that is has been received by submgr |
| 924 | // --> artificial delay |
| 925 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 926 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 927 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 928 | |
| 929 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 930 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 931 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 932 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 933 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 934 | |
| 935 | //Wait that subs is cleaned |
| 936 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 937 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 938 | xappConn1.TestMsgChanEmpty(t) |
| 939 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 940 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 941 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | //----------------------------------------------------------------------------- |
| 945 | // TestSubDelReqRetransmission |
| 946 | // |
| 947 | // stub stub |
| 948 | // +-------+ +---------+ +---------+ |
| 949 | // | xapp | | submgr | | e2term | |
| 950 | // +-------+ +---------+ +---------+ |
| 951 | // | | | |
| 952 | // | [SUBS CREATE] | |
| 953 | // | | | |
| 954 | // | | | |
| 955 | // | SubDelReq | | |
| 956 | // |------------->| | |
| 957 | // | | | |
| 958 | // | | SubDelReq | |
| 959 | // | |------------->| |
| 960 | // | | | |
| 961 | // | SubDelReq | | |
| 962 | // | (same sub) | | |
| 963 | // | (same xid) | | |
| 964 | // |------------->| | |
| 965 | // | | | |
| 966 | // | | SubDelResp | |
| 967 | // | |<-------------| |
| 968 | // | | | |
| 969 | // | SubDelResp | | |
| 970 | // |<-------------| | |
| 971 | // |
| 972 | //----------------------------------------------------------------------------- |
| 973 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 974 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 975 | |
| 976 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 977 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 978 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 979 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 980 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 981 | |
| 982 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 983 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 984 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 985 | |
| 986 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 987 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 988 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 989 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 990 | // hack as there is no real way to see has message be handled. |
| 991 | // Previuos counter check just tells that is has been received by submgr |
| 992 | // --> artificial delay |
| 993 | <-time.After(1 * time.Second) |
| 994 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 995 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 996 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 997 | |
| 998 | //Wait that subs is cleaned |
| 999 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1000 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1001 | xappConn1.TestMsgChanEmpty(t) |
| 1002 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1003 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1004 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | //----------------------------------------------------------------------------- |
| 1008 | // TestSubDelReqCollision |
| 1009 | // |
| 1010 | // stub stub |
| 1011 | // +-------+ +---------+ +---------+ |
| 1012 | // | xapp | | submgr | | e2term | |
| 1013 | // +-------+ +---------+ +---------+ |
| 1014 | // | | | |
| 1015 | // | [SUBS CREATE] | |
| 1016 | // | | | |
| 1017 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1018 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1019 | // |------------->| | |
| 1020 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1021 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1022 | // | |------------->| |
| 1023 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1024 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1025 | // | (same sub) | | |
| 1026 | // | (diff xid) | | |
| 1027 | // |------------->| | |
| 1028 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1029 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1030 | // | |<-------------| |
| 1031 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1032 | // | SubDelResp 1 | | |
| 1033 | // |<-------------| | |
| 1034 | // | | | |
| 1035 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1036 | // |<-------------| | |
| 1037 | // |
| 1038 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1039 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1040 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1041 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1042 | |
| 1043 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1044 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1045 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1046 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1047 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1048 | |
| 1049 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1050 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1051 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1052 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1053 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1054 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1055 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1056 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1057 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1058 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1059 | // hack as there is no real way to see has message be handled. |
| 1060 | // Previuos counter check just tells that is has been received by submgr |
| 1061 | // --> artificial delay |
| 1062 | <-time.After(1 * time.Second) |
| 1063 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1064 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1065 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1066 | |
| 1067 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1068 | xappConn1.RecvSubsDelResp(t, nil) |
| 1069 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1070 | |
| 1071 | //Wait that subs is cleaned |
| 1072 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1073 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1074 | xappConn1.TestMsgChanEmpty(t) |
| 1075 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1076 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1077 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1078 | } |
| 1079 | |
| 1080 | //----------------------------------------------------------------------------- |
| 1081 | // TestSubReqAndSubDelOkTwoParallel |
| 1082 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1083 | // stub stub stub |
| 1084 | // +-------+ +-------+ +---------+ +---------+ |
| 1085 | // | xapp | | xapp | | submgr | | e2term | |
| 1086 | // +-------+ +-------+ +---------+ +---------+ |
| 1087 | // | | | | |
| 1088 | // | | | | |
| 1089 | // | | | | |
| 1090 | // | | SubReq1 | | |
| 1091 | // | |------------->| | |
| 1092 | // | | | | |
| 1093 | // | | | SubReq1 | |
| 1094 | // | | |------------->| |
| 1095 | // | | | | |
| 1096 | // | SubReq2 | | |
| 1097 | // |------------------------>| | |
| 1098 | // | | | | |
| 1099 | // | | | SubReq2 | |
| 1100 | // | | |------------->| |
| 1101 | // | | | | |
| 1102 | // | | | SubResp1 | |
| 1103 | // | | |<-------------| |
| 1104 | // | | SubResp1 | | |
| 1105 | // | |<-------------| | |
| 1106 | // | | | | |
| 1107 | // | | | SubResp2 | |
| 1108 | // | | |<-------------| |
| 1109 | // | SubResp2 | | |
| 1110 | // |<------------------------| | |
| 1111 | // | | | | |
| 1112 | // | | [SUBS 1 DELETE] | |
| 1113 | // | | | | |
| 1114 | // | | [SUBS 2 DELETE] | |
| 1115 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1116 | // |
| 1117 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1118 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1119 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1120 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1121 | |
| 1122 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1124 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1125 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1126 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1127 | |
| 1128 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1129 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1130 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1131 | |
| 1132 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1133 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1134 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1135 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1137 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1138 | |
| 1139 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1140 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1141 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1142 | |
| 1143 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1144 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1145 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1148 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1149 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1150 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1151 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | //Wait that subs is cleaned |
| 1153 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1154 | |
| 1155 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1156 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1157 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1158 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1159 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1160 | //Wait that subs is cleaned |
| 1161 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1162 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1163 | xappConn1.TestMsgChanEmpty(t) |
| 1164 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1165 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1166 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1167 | } |
| 1168 | |
| 1169 | //----------------------------------------------------------------------------- |
| 1170 | // TestSameSubsDiffRan |
| 1171 | // Same subscription to different RANs |
| 1172 | // |
| 1173 | // stub stub |
| 1174 | // +-------+ +---------+ +---------+ |
| 1175 | // | xapp | | submgr | | e2term | |
| 1176 | // +-------+ +---------+ +---------+ |
| 1177 | // | | | |
| 1178 | // | | | |
| 1179 | // | | | |
| 1180 | // | SubReq(r1) | | |
| 1181 | // |------------->| | |
| 1182 | // | | | |
| 1183 | // | | SubReq(r1) | |
| 1184 | // | |------------->| |
| 1185 | // | | | |
| 1186 | // | | SubResp(r1) | |
| 1187 | // | |<-------------| |
| 1188 | // | | | |
| 1189 | // | SubResp(r1) | | |
| 1190 | // |<-------------| | |
| 1191 | // | | | |
| 1192 | // | SubReq(r2) | | |
| 1193 | // |------------->| | |
| 1194 | // | | | |
| 1195 | // | | SubReq(r2) | |
| 1196 | // | |------------->| |
| 1197 | // | | | |
| 1198 | // | | SubResp(r2) | |
| 1199 | // | |<-------------| |
| 1200 | // | | | |
| 1201 | // | SubResp(r2) | | |
| 1202 | // |<-------------| | |
| 1203 | // | | | |
| 1204 | // | [SUBS r1 DELETE] | |
| 1205 | // | | | |
| 1206 | // | [SUBS r2 DELETE] | |
| 1207 | // | | | |
| 1208 | // |
| 1209 | //----------------------------------------------------------------------------- |
| 1210 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1211 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1212 | |
| 1213 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1214 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1215 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1216 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1217 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1218 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1219 | |
| 1220 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1221 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1222 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1223 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1224 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1225 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1226 | |
| 1227 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1228 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1229 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1230 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1231 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1232 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1233 | //Wait that subs is cleaned |
| 1234 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1235 | |
| 1236 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1237 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1238 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1239 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1240 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1241 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1242 | //Wait that subs is cleaned |
| 1243 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1244 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1245 | xappConn1.TestMsgChanEmpty(t) |
| 1246 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1247 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1248 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1249 | } |
| 1250 | |
| 1251 | //----------------------------------------------------------------------------- |
| 1252 | // TestSubReqRetryInSubmgr |
| 1253 | // |
| 1254 | // stub stub |
| 1255 | // +-------+ +---------+ +---------+ |
| 1256 | // | xapp | | submgr | | e2term | |
| 1257 | // +-------+ +---------+ +---------+ |
| 1258 | // | | | |
| 1259 | // | SubReq | | |
| 1260 | // |------------->| | |
| 1261 | // | | | |
| 1262 | // | | SubReq | |
| 1263 | // | |------------->| |
| 1264 | // | | | |
| 1265 | // | | | |
| 1266 | // | | SubReq | |
| 1267 | // | |------------->| |
| 1268 | // | | | |
| 1269 | // | | SubResp | |
| 1270 | // | |<-------------| |
| 1271 | // | | | |
| 1272 | // | SubResp | | |
| 1273 | // |<-------------| | |
| 1274 | // | | | |
| 1275 | // | [SUBS DELETE] | |
| 1276 | // | | | |
| 1277 | // |
| 1278 | //----------------------------------------------------------------------------- |
| 1279 | |
| 1280 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1281 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1282 | |
| 1283 | // Init counter check |
| 1284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1285 | Counter{cSubReqFromXapp, 1}, |
| 1286 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1287 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1288 | Counter{cSubReReqToE2, 1}, |
| 1289 | Counter{cSubRespFromE2, 1}, |
| 1290 | Counter{cSubRespToXapp, 1}, |
| 1291 | Counter{cSubDelReqFromXapp, 1}, |
| 1292 | Counter{cSubDelReqToE2, 1}, |
| 1293 | Counter{cSubDelRespFromE2, 1}, |
| 1294 | Counter{cSubDelRespToXapp, 1}, |
| 1295 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1296 | |
| 1297 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1298 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1299 | |
| 1300 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1301 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1302 | |
| 1303 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1304 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1305 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1306 | |
| 1307 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1308 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1309 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1310 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1311 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1312 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1313 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1314 | |
| 1315 | // Wait that subs is cleaned |
| 1316 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1317 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1318 | xappConn1.TestMsgChanEmpty(t) |
| 1319 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1320 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1321 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1322 | |
| 1323 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1324 | } |
| 1325 | |
| 1326 | //----------------------------------------------------------------------------- |
| 1327 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1328 | // |
| 1329 | // stub stub |
| 1330 | // +-------+ +---------+ +---------+ |
| 1331 | // | xapp | | submgr | | e2term | |
| 1332 | // +-------+ +---------+ +---------+ |
| 1333 | // | | | |
| 1334 | // | SubReq | | |
| 1335 | // |------------->| | |
| 1336 | // | | | |
| 1337 | // | | SubReq | |
| 1338 | // | |------------->| |
| 1339 | // | | | |
| 1340 | // | | | |
| 1341 | // | | SubReq | |
| 1342 | // | |------------->| |
| 1343 | // | | | |
| 1344 | // | | SubDelReq | |
| 1345 | // | |------------->| |
| 1346 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1347 | // | | SubDelResp | |
| 1348 | // | |<-------------| |
| 1349 | // | | | |
| 1350 | // |
| 1351 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1352 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1353 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1354 | |
| 1355 | // Init counter check |
| 1356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1357 | Counter{cSubReqFromXapp, 1}, |
| 1358 | Counter{cSubReqToE2, 1}, |
| 1359 | Counter{cSubReReqToE2, 1}, |
| 1360 | Counter{cSubReqTimerExpiry, 2}, |
| 1361 | Counter{cSubDelReqToE2, 1}, |
| 1362 | Counter{cSubDelRespFromE2, 1}, |
| 1363 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1364 | |
| 1365 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1366 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1367 | |
| 1368 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1369 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1370 | |
| 1371 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1372 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1373 | |
| 1374 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1375 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1376 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1377 | |
| 1378 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1379 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1380 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1381 | xappConn1.TestMsgChanEmpty(t) |
| 1382 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1383 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1384 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1385 | |
| 1386 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | //----------------------------------------------------------------------------- |
| 1390 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1391 | // |
| 1392 | // stub stub |
| 1393 | // +-------+ +---------+ +---------+ |
| 1394 | // | xapp | | submgr | | e2term | |
| 1395 | // +-------+ +---------+ +---------+ |
| 1396 | // | | | |
| 1397 | // | SubReq | | |
| 1398 | // |------------->| | |
| 1399 | // | | | |
| 1400 | // | | SubReq | |
| 1401 | // | |------------->| |
| 1402 | // | | | |
| 1403 | // | | | |
| 1404 | // | | SubReq | |
| 1405 | // | |------------->| |
| 1406 | // | | | |
| 1407 | // | | SubDelReq | |
| 1408 | // | |------------->| |
| 1409 | // | | | |
| 1410 | // | | | |
| 1411 | // | | SubDelReq | |
| 1412 | // | |------------->| |
| 1413 | // | | | |
| 1414 | // | | | |
| 1415 | // |
| 1416 | //----------------------------------------------------------------------------- |
| 1417 | |
| 1418 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1419 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1420 | |
| 1421 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1422 | Counter{cSubReqFromXapp, 1}, |
| 1423 | Counter{cSubReqToE2, 1}, |
| 1424 | Counter{cSubReReqToE2, 1}, |
| 1425 | Counter{cSubReqTimerExpiry, 2}, |
| 1426 | Counter{cSubDelReqToE2, 1}, |
| 1427 | Counter{cSubDelReReqToE2, 1}, |
| 1428 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1429 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1430 | |
| 1431 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1432 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1433 | |
| 1434 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1435 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1436 | |
| 1437 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1438 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1439 | |
| 1440 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1441 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1442 | |
| 1443 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1444 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1445 | |
| 1446 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1447 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1448 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1449 | xappConn1.TestMsgChanEmpty(t) |
| 1450 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1451 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1452 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1453 | |
| 1454 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1455 | } |
| 1456 | |
| 1457 | //----------------------------------------------------------------------------- |
| 1458 | // TestSubReqSubFailRespInSubmgr |
| 1459 | // |
| 1460 | // stub stub |
| 1461 | // +-------+ +---------+ +---------+ |
| 1462 | // | xapp | | submgr | | e2term | |
| 1463 | // +-------+ +---------+ +---------+ |
| 1464 | // | | | |
| 1465 | // | SubReq | | |
| 1466 | // |------------->| | |
| 1467 | // | | | |
| 1468 | // | | SubReq | |
| 1469 | // | |------------->| |
| 1470 | // | | | |
| 1471 | // | | SubFail | |
| 1472 | // | |<-------------| |
| 1473 | // | | | |
| 1474 | // | SubFail | | |
| 1475 | // |<-------------| | |
| 1476 | // | | | |
| 1477 | // |
| 1478 | //----------------------------------------------------------------------------- |
| 1479 | |
| 1480 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1482 | |
| 1483 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1484 | Counter{cSubReqFromXapp, 1}, |
| 1485 | Counter{cSubReqToE2, 1}, |
| 1486 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1487 | Counter{cSubFailToXapp, 1}, |
| 1488 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1489 | |
| 1490 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1491 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1492 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1493 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1494 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1495 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1496 | fparams1.Set(crereq1) |
| 1497 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1498 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1499 | // Xapp: Receive SubsFail |
| 1500 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1501 | |
| 1502 | // Wait that subs is cleaned |
| 1503 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1504 | |
| 1505 | xappConn1.TestMsgChanEmpty(t) |
| 1506 | xappConn2.TestMsgChanEmpty(t) |
| 1507 | e2termConn1.TestMsgChanEmpty(t) |
| 1508 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1509 | |
| 1510 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1511 | } |
| 1512 | |
| 1513 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1514 | // TestSubDelReqRetryInSubmgr |
| 1515 | // |
| 1516 | // stub stub |
| 1517 | // +-------+ +---------+ +---------+ |
| 1518 | // | xapp | | submgr | | e2term | |
| 1519 | // +-------+ +---------+ +---------+ |
| 1520 | // | | | |
| 1521 | // | [SUBS CREATE] | |
| 1522 | // | | | |
| 1523 | // | | | |
| 1524 | // | SubDelReq | | |
| 1525 | // |------------->| | |
| 1526 | // | | | |
| 1527 | // | | SubDelReq | |
| 1528 | // | |------------->| |
| 1529 | // | | | |
| 1530 | // | | SubDelReq | |
| 1531 | // | |------------->| |
| 1532 | // | | | |
| 1533 | // | | SubDelResp | |
| 1534 | // | |<-------------| |
| 1535 | // | | | |
| 1536 | // | SubDelResp | | |
| 1537 | // |<-------------| | |
| 1538 | // |
| 1539 | //----------------------------------------------------------------------------- |
| 1540 | |
| 1541 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1542 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1543 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1544 | |
| 1545 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1546 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1547 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1548 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1549 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1550 | |
| 1551 | // Subs Delete |
| 1552 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1553 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1554 | |
| 1555 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1556 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1557 | |
| 1558 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1559 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1560 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1561 | |
| 1562 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1563 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1564 | |
| 1565 | // Wait that subs is cleaned |
| 1566 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1567 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1568 | xappConn1.TestMsgChanEmpty(t) |
| 1569 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1570 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1571 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1572 | } |
| 1573 | |
| 1574 | //----------------------------------------------------------------------------- |
| 1575 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1576 | // |
| 1577 | // stub stub |
| 1578 | // +-------+ +---------+ +---------+ |
| 1579 | // | xapp | | submgr | | e2term | |
| 1580 | // +-------+ +---------+ +---------+ |
| 1581 | // | | | |
| 1582 | // | [SUBS CREATE] | |
| 1583 | // | | | |
| 1584 | // | | | |
| 1585 | // | SubDelReq | | |
| 1586 | // |------------->| | |
| 1587 | // | | | |
| 1588 | // | | SubDelReq | |
| 1589 | // | |------------->| |
| 1590 | // | | | |
| 1591 | // | | SubDelReq | |
| 1592 | // | |------------->| |
| 1593 | // | | | |
| 1594 | // | | | |
| 1595 | // | SubDelResp | | |
| 1596 | // |<-------------| | |
| 1597 | // |
| 1598 | //----------------------------------------------------------------------------- |
| 1599 | |
| 1600 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1601 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1602 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1603 | |
| 1604 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1605 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1606 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1607 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1608 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1609 | |
| 1610 | // Subs Delete |
| 1611 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1612 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1613 | |
| 1614 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1615 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1616 | |
| 1617 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1618 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1619 | |
| 1620 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1621 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1622 | |
| 1623 | // Wait that subs is cleaned |
| 1624 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1625 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1626 | xappConn1.TestMsgChanEmpty(t) |
| 1627 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1628 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1629 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1630 | } |
| 1631 | |
| 1632 | //----------------------------------------------------------------------------- |
| 1633 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1634 | // |
| 1635 | // stub stub |
| 1636 | // +-------+ +---------+ +---------+ |
| 1637 | // | xapp | | submgr | | e2term | |
| 1638 | // +-------+ +---------+ +---------+ |
| 1639 | // | | | |
| 1640 | // | [SUBS CREATE] | |
| 1641 | // | | | |
| 1642 | // | | | |
| 1643 | // | SubDelReq | | |
| 1644 | // |------------->| | |
| 1645 | // | | | |
| 1646 | // | | SubDelReq | |
| 1647 | // | |------------->| |
| 1648 | // | | | |
| 1649 | // | | SubDelFail | |
| 1650 | // | |<-------------| |
| 1651 | // | | | |
| 1652 | // | SubDelResp | | |
| 1653 | // |<-------------| | |
| 1654 | // | | | |
| 1655 | // |
| 1656 | //----------------------------------------------------------------------------- |
| 1657 | |
| 1658 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1659 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1660 | |
| 1661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1662 | Counter{cSubReqFromXapp, 1}, |
| 1663 | Counter{cSubReqToE2, 1}, |
| 1664 | Counter{cSubRespFromE2, 1}, |
| 1665 | Counter{cSubRespToXapp, 1}, |
| 1666 | Counter{cSubDelReqFromXapp, 1}, |
| 1667 | Counter{cSubDelReqToE2, 1}, |
| 1668 | Counter{cSubDelFailFromE2, 1}, |
| 1669 | Counter{cSubDelRespToXapp, 1}, |
| 1670 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1671 | |
| 1672 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1673 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1674 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1675 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1676 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1677 | |
| 1678 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1679 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1680 | |
| 1681 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1682 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1683 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1684 | |
| 1685 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1686 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1687 | |
| 1688 | // Wait that subs is cleaned |
| 1689 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1690 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1691 | xappConn1.TestMsgChanEmpty(t) |
| 1692 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1693 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1694 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1695 | |
| 1696 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | //----------------------------------------------------------------------------- |
| 1700 | // TestSubReqAndSubDelOkSameAction |
| 1701 | // |
| 1702 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1703 | // +-------+ +-------+ +---------+ +---------+ |
| 1704 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1705 | // +-------+ +-------+ +---------+ +---------+ |
| 1706 | // | | | | |
| 1707 | // | | | | |
| 1708 | // | | | | |
| 1709 | // | | SubReq1 | | |
| 1710 | // | |------------->| | |
| 1711 | // | | | | |
| 1712 | // | | | SubReq1 | |
| 1713 | // | | |------------->| |
| 1714 | // | | | SubResp1 | |
| 1715 | // | | |<-------------| |
| 1716 | // | | SubResp1 | | |
| 1717 | // | |<-------------| | |
| 1718 | // | | | | |
| 1719 | // | SubReq2 | | |
| 1720 | // |--------------------------->| | |
| 1721 | // | | | | |
| 1722 | // | SubResp2 | | |
| 1723 | // |<---------------------------| | |
| 1724 | // | | | | |
| 1725 | // | | SubDelReq 1 | | |
| 1726 | // | |------------->| | |
| 1727 | // | | | | |
| 1728 | // | | SubDelResp 1 | | |
| 1729 | // | |<-------------| | |
| 1730 | // | | | | |
| 1731 | // | SubDelReq 2 | | |
| 1732 | // |--------------------------->| | |
| 1733 | // | | | | |
| 1734 | // | | | SubDelReq 2 | |
| 1735 | // | | |------------->| |
| 1736 | // | | | | |
| 1737 | // | | | SubDelReq 2 | |
| 1738 | // | | |------------->| |
| 1739 | // | | | | |
| 1740 | // | SubDelResp 2 | | |
| 1741 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1742 | // |
| 1743 | //----------------------------------------------------------------------------- |
| 1744 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1745 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1746 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1747 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1748 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1749 | Counter{cSubReqFromXapp, 2}, |
| 1750 | Counter{cSubReqToE2, 1}, |
| 1751 | Counter{cSubRespFromE2, 1}, |
| 1752 | Counter{cSubRespToXapp, 2}, |
| 1753 | Counter{cMergedSubscriptions, 1}, |
| 1754 | Counter{cUnmergedSubscriptions, 1}, |
| 1755 | Counter{cSubDelReqFromXapp, 2}, |
| 1756 | Counter{cSubDelReqToE2, 1}, |
| 1757 | Counter{cSubDelRespFromE2, 1}, |
| 1758 | Counter{cSubDelRespToXapp, 2}, |
| 1759 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1760 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1761 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1762 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1763 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1764 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1765 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1766 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1767 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1768 | |
| 1769 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1770 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1771 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1773 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1774 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1775 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1776 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1777 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1778 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1779 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1780 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1781 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1782 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1783 | |
| 1784 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1785 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1786 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1787 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1788 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1789 | //Wait that subs is cleaned |
| 1790 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1791 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1792 | xappConn1.TestMsgChanEmpty(t) |
| 1793 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1794 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1795 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1796 | |
| 1797 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1798 | } |
| 1799 | |
| 1800 | //----------------------------------------------------------------------------- |
| 1801 | // TestSubReqAndSubDelOkSameActionParallel |
| 1802 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1803 | // stub stub stub |
| 1804 | // +-------+ +-------+ +---------+ +---------+ |
| 1805 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1806 | // +-------+ +-------+ +---------+ +---------+ |
| 1807 | // | | | | |
| 1808 | // | | | | |
| 1809 | // | | | | |
| 1810 | // | | SubReq1 | | |
| 1811 | // | |------------->| | |
| 1812 | // | | | | |
| 1813 | // | | | SubReq1 | |
| 1814 | // | | |------------->| |
| 1815 | // | SubReq2 | | |
| 1816 | // |--------------------------->| | |
| 1817 | // | | | SubResp1 | |
| 1818 | // | | |<-------------| |
| 1819 | // | | SubResp1 | | |
| 1820 | // | |<-------------| | |
| 1821 | // | | | | |
| 1822 | // | SubResp2 | | |
| 1823 | // |<---------------------------| | |
| 1824 | // | | | | |
| 1825 | // | | SubDelReq 1 | | |
| 1826 | // | |------------->| | |
| 1827 | // | | | | |
| 1828 | // | | SubDelResp 1 | | |
| 1829 | // | |<-------------| | |
| 1830 | // | | | | |
| 1831 | // | SubDelReq 2 | | |
| 1832 | // |--------------------------->| | |
| 1833 | // | | | | |
| 1834 | // | | | SubDelReq 2 | |
| 1835 | // | | |------------->| |
| 1836 | // | | | | |
| 1837 | // | | | SubDelReq 2 | |
| 1838 | // | | |------------->| |
| 1839 | // | | | | |
| 1840 | // | SubDelResp 2 | | |
| 1841 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1842 | // |
| 1843 | //----------------------------------------------------------------------------- |
| 1844 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1845 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1846 | |
| 1847 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1848 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1849 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1850 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1851 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1852 | |
| 1853 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1854 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1855 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1856 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1857 | |
| 1858 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1859 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1860 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1861 | |
| 1862 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1863 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1864 | |
| 1865 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1866 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1867 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1868 | |
| 1869 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1870 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1871 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1872 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1873 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1874 | |
| 1875 | //Wait that subs is cleaned |
| 1876 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1877 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1878 | xappConn1.TestMsgChanEmpty(t) |
| 1879 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1880 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1881 | mainCtrl.wait_registry_empty(t, 10) |
| 1882 | } |
| 1883 | |
| 1884 | //----------------------------------------------------------------------------- |
| 1885 | // TestSubReqAndSubDelNokSameActionParallel |
| 1886 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1887 | // stub stub stub |
| 1888 | // +-------+ +-------+ +---------+ +---------+ |
| 1889 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1890 | // +-------+ +-------+ +---------+ +---------+ |
| 1891 | // | | | | |
| 1892 | // | | | | |
| 1893 | // | | | | |
| 1894 | // | | SubReq1 | | |
| 1895 | // | |------------->| | |
| 1896 | // | | | | |
| 1897 | // | | | SubReq1 | |
| 1898 | // | | |------------->| |
| 1899 | // | SubReq2 | | |
| 1900 | // |--------------------------->| | |
| 1901 | // | | | SubFail1 | |
| 1902 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1903 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1904 | // | | SubFail1 | | |
| 1905 | // | |<-------------| | |
| 1906 | // | | | | |
| 1907 | // | SubFail2 | | |
| 1908 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1909 | // |
| 1910 | //----------------------------------------------------------------------------- |
| 1911 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1912 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1913 | |
| 1914 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1915 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1916 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1917 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1918 | |
| 1919 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1920 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1921 | |
| 1922 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1923 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1924 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1925 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1926 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1927 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1928 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1929 | // E2t: send SubsFail (first) |
| 1930 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1931 | fparams1.Set(crereq1) |
| 1932 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1933 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1934 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1935 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1936 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1937 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1938 | |
| 1939 | //Wait that subs is cleaned |
| 1940 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1941 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1942 | xappConn1.TestMsgChanEmpty(t) |
| 1943 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1944 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1945 | mainCtrl.wait_registry_empty(t, 10) |
| 1946 | } |
| 1947 | |
| 1948 | //----------------------------------------------------------------------------- |
| 1949 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1950 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1951 | // stub stub stub |
| 1952 | // +-------+ +-------+ +---------+ +---------+ |
| 1953 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1954 | // +-------+ +-------+ +---------+ +---------+ |
| 1955 | // | | | | |
| 1956 | // | | | | |
| 1957 | // | | | | |
| 1958 | // | | SubReq1 | | |
| 1959 | // | |------------->| | |
| 1960 | // | | | | |
| 1961 | // | | | SubReq1 | |
| 1962 | // | | |------------->| |
| 1963 | // | | SubReq2 | | |
| 1964 | // |--------------------------->| | |
| 1965 | // | | | | |
| 1966 | // | | | SubReq1 | |
| 1967 | // | | |------------->| |
| 1968 | // | | | | |
| 1969 | // | | | | |
| 1970 | // | | | SubDelReq | |
| 1971 | // | | |------------->| |
| 1972 | // | | | | |
| 1973 | // | | | SubDelResp | |
| 1974 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1975 | // |
| 1976 | //----------------------------------------------------------------------------- |
| 1977 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1978 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1979 | |
| 1980 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1981 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1982 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1983 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1984 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1985 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1986 | |
| 1987 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1988 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1989 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1990 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1991 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1992 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1993 | |
| 1994 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1995 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1996 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1997 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1998 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1999 | |
| 2000 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2001 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2002 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2003 | xappConn1.TestMsgChanEmpty(t) |
| 2004 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2005 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2006 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2007 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2008 | |
| 2009 | //----------------------------- Policy cases --------------------------------- |
| 2010 | //----------------------------------------------------------------------------- |
| 2011 | // TestSubReqPolicyAndSubDelOk |
| 2012 | // |
| 2013 | // stub stub |
| 2014 | // +-------+ +---------+ +---------+ |
| 2015 | // | xapp | | submgr | | e2term | |
| 2016 | // +-------+ +---------+ +---------+ |
| 2017 | // | | | |
| 2018 | // | SubReq | | |
| 2019 | // |------------->| | |
| 2020 | // | | | |
| 2021 | // | | SubReq | |
| 2022 | // | |------------->| |
| 2023 | // | | | |
| 2024 | // | | SubResp | |
| 2025 | // | |<-------------| |
| 2026 | // | | | |
| 2027 | // | SubResp | | |
| 2028 | // |<-------------| | |
| 2029 | // | | | |
| 2030 | // | | | |
| 2031 | // | SubDelReq | | |
| 2032 | // |------------->| | |
| 2033 | // | | | |
| 2034 | // | | SubDelReq | |
| 2035 | // | |------------->| |
| 2036 | // | | | |
| 2037 | // | | SubDelResp | |
| 2038 | // | |<-------------| |
| 2039 | // | | | |
| 2040 | // | SubDelResp | | |
| 2041 | // |<-------------| | |
| 2042 | // |
| 2043 | //----------------------------------------------------------------------------- |
| 2044 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2045 | CaseBegin("TestSubReqAndSubDelOk") |
| 2046 | |
| 2047 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2048 | rparams1.Init() |
| 2049 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2050 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2051 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2052 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2053 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2054 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2055 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2056 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2057 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2059 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2060 | |
| 2061 | //Wait that subs is cleaned |
| 2062 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2063 | |
| 2064 | xappConn1.TestMsgChanEmpty(t) |
| 2065 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2066 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2067 | mainCtrl.wait_registry_empty(t, 10) |
| 2068 | } |
| 2069 | |
| 2070 | //----------------------------------------------------------------------------- |
| 2071 | // TestSubReqPolicyChangeAndSubDelOk |
| 2072 | // |
| 2073 | // stub stub |
| 2074 | // +-------+ +---------+ +---------+ |
| 2075 | // | xapp | | submgr | | e2term | |
| 2076 | // +-------+ +---------+ +---------+ |
| 2077 | // | | | |
| 2078 | // | SubReq | | |
| 2079 | // |------------->| | |
| 2080 | // | | | |
| 2081 | // | | SubReq | |
| 2082 | // | |------------->| |
| 2083 | // | | | |
| 2084 | // | | SubResp | |
| 2085 | // | |<-------------| |
| 2086 | // | | | |
| 2087 | // | SubResp | | |
| 2088 | // |<-------------| | |
| 2089 | // | | | |
| 2090 | // | SubReq | | |
| 2091 | // |------------->| | |
| 2092 | // | | | |
| 2093 | // | | SubReq | |
| 2094 | // | |------------->| |
| 2095 | // | | | |
| 2096 | // | | SubResp | |
| 2097 | // | |<-------------| |
| 2098 | // | | | |
| 2099 | // | SubResp | | |
| 2100 | // |<-------------| | |
| 2101 | // | | | |
| 2102 | // | SubDelReq | | |
| 2103 | // |------------->| | |
| 2104 | // | | | |
| 2105 | // | | SubDelReq | |
| 2106 | // | |------------->| |
| 2107 | // | | | |
| 2108 | // | | SubDelResp | |
| 2109 | // | |<-------------| |
| 2110 | // | | | |
| 2111 | // | SubDelResp | | |
| 2112 | // |<-------------| | |
| 2113 | // |
| 2114 | //----------------------------------------------------------------------------- |
| 2115 | |
| 2116 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2117 | CaseBegin("TestSubReqAndSubDelOk") |
| 2118 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2119 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2120 | rparams1.Init() |
| 2121 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2122 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2123 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2124 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2125 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2126 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2127 | |
| 2128 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2129 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2130 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2131 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2132 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2133 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2134 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2135 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2136 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2138 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2139 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2140 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2141 | |
| 2142 | //Wait that subs is cleaned |
| 2143 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2144 | |
| 2145 | xappConn1.TestMsgChanEmpty(t) |
| 2146 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2147 | e2termConn1.TestMsgChanEmpty(t) |
| 2148 | mainCtrl.wait_registry_empty(t, 10) |
| 2149 | } |
| 2150 | |
| 2151 | //----------------------------------------------------------------------------- |
| 2152 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2153 | // |
| 2154 | // stub stub stub |
| 2155 | // +-------+ +---------+ +---------+ +---------+ |
| 2156 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2157 | // +-------+ +---------+ +---------+ +---------+ |
| 2158 | // | | | | |
| 2159 | // | | | | |
| 2160 | // | | | | |
| 2161 | // | SubReq1 | | | |
| 2162 | // |------------->| | | |
| 2163 | // | | | | |
| 2164 | // | | SubReq1 | | |
| 2165 | // | |------------->| | |
| 2166 | // | | | | |
| 2167 | // | SubReq2 | | | |
| 2168 | // |------------->| | | |
| 2169 | // | | | | |
| 2170 | // | | SubReq2 | | |
| 2171 | // | |---------------------------->| |
| 2172 | // | | | | |
| 2173 | // | | SubResp1 | | |
| 2174 | // | |<-------------| | |
| 2175 | // | SubResp1 | | | |
| 2176 | // |<-------------| | | |
| 2177 | // | | SubResp2 | | |
| 2178 | // | |<----------------------------| |
| 2179 | // | SubResp2 | | | |
| 2180 | // |<-------------| | | |
| 2181 | // | | | | |
| 2182 | // | [SUBS 1 DELETE] | | |
| 2183 | // | | | | |
| 2184 | // | [SUBS 2 DELETE] | | |
| 2185 | // | | | | |
| 2186 | // |
| 2187 | //----------------------------------------------------------------------------- |
| 2188 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2189 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2190 | |
| 2191 | //Req1 |
| 2192 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2193 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2194 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2195 | |
| 2196 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2197 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2198 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2199 | |
| 2200 | //Resp1 |
| 2201 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2202 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2203 | |
| 2204 | //Resp2 |
| 2205 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2206 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2207 | |
| 2208 | //Del1 |
| 2209 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2212 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2213 | //Wait that subs is cleaned |
| 2214 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2215 | |
| 2216 | //Del2 |
| 2217 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2218 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2219 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2220 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2221 | //Wait that subs is cleaned |
| 2222 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2223 | |
| 2224 | xappConn1.TestMsgChanEmpty(t) |
| 2225 | xappConn2.TestMsgChanEmpty(t) |
| 2226 | e2termConn1.TestMsgChanEmpty(t) |
| 2227 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2228 | mainCtrl.wait_registry_empty(t, 10) |
| 2229 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2230 | |
| 2231 | //----------------------------------------------------------------------------- |
| 2232 | // TestSubReqInsertAndSubDelOk |
| 2233 | // |
| 2234 | // stub stub |
| 2235 | // +-------+ +---------+ +---------+ |
| 2236 | // | xapp | | submgr | | e2term | |
| 2237 | // +-------+ +---------+ +---------+ |
| 2238 | // | | | |
| 2239 | // | SubReq | | |
| 2240 | // |------------->| | |
| 2241 | // | | | |
| 2242 | // | | SubReq | |
| 2243 | // | |------------->| |
| 2244 | // | | | |
| 2245 | // | | SubResp | |
| 2246 | // | |<-------------| |
| 2247 | // | | | |
| 2248 | // | SubResp | | |
| 2249 | // |<-------------| | |
| 2250 | // | | | |
| 2251 | // | | | |
| 2252 | // | SubDelReq | | |
| 2253 | // |------------->| | |
| 2254 | // | | | |
| 2255 | // | | SubDelReq | |
| 2256 | // | |------------->| |
| 2257 | // | | | |
| 2258 | // | | SubDelResp | |
| 2259 | // | |<-------------| |
| 2260 | // | | | |
| 2261 | // | SubDelResp | | |
| 2262 | // |<-------------| | |
| 2263 | // |
| 2264 | //----------------------------------------------------------------------------- |
| 2265 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2266 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2267 | |
| 2268 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2269 | rparams1.Init() |
| 2270 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2271 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2272 | |
| 2273 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2274 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2275 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2276 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2277 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2278 | |
| 2279 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2280 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2281 | |
| 2282 | //Wait that subs is cleaned |
| 2283 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2284 | |
| 2285 | xappConn1.TestMsgChanEmpty(t) |
| 2286 | xappConn2.TestMsgChanEmpty(t) |
| 2287 | e2termConn1.TestMsgChanEmpty(t) |
| 2288 | mainCtrl.wait_registry_empty(t, 10) |
| 2289 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2290 | |
| 2291 | //----------------------------------------------------------------------------- |
| 2292 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2293 | // |
| 2294 | // This case simulates case where xApp restarts and starts sending same |
| 2295 | // subscription requests which have already subscribed successfully |
| 2296 | |
| 2297 | // stub stub |
| 2298 | // +-------+ +---------+ +---------+ |
| 2299 | // | xapp | | submgr | | e2term | |
| 2300 | // +-------+ +---------+ +---------+ |
| 2301 | // | | | |
| 2302 | // | SubReq | | |
| 2303 | // |------------->| | |
| 2304 | // | | | |
| 2305 | // | | SubReq | |
| 2306 | // | |------------->| |
| 2307 | // | | | |
| 2308 | // | | SubResp | |
| 2309 | // | |<-------------| |
| 2310 | // | | | |
| 2311 | // | SubResp | | |
| 2312 | // |<-------------| | |
| 2313 | // | | | |
| 2314 | // | xApp restart | | |
| 2315 | // | | | |
| 2316 | // | SubReq | | |
| 2317 | // | (retrans with same xApp generated subid but diff xid) |
| 2318 | // |------------->| | |
| 2319 | // | | | |
| 2320 | // | SubResp | | |
| 2321 | // |<-------------| | |
| 2322 | // | | | |
| 2323 | // | [SUBS DELETE] | |
| 2324 | // | | | |
| 2325 | // |
| 2326 | //----------------------------------------------------------------------------- |
| 2327 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2328 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2329 | |
| 2330 | //Subs Create |
| 2331 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2332 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2333 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2334 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2335 | |
| 2336 | // xApp restart here |
| 2337 | // --> artificial delay |
| 2338 | <-time.After(1 * time.Second) |
| 2339 | |
| 2340 | //Subs Create |
| 2341 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2342 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2343 | |
| 2344 | //Subs Delete |
| 2345 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2346 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2347 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2348 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2349 | |
| 2350 | //Wait that subs is cleaned |
| 2351 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2352 | |
| 2353 | xappConn1.TestMsgChanEmpty(t) |
| 2354 | xappConn2.TestMsgChanEmpty(t) |
| 2355 | e2termConn1.TestMsgChanEmpty(t) |
| 2356 | mainCtrl.wait_registry_empty(t, 10) |
| 2357 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2358 | |
| 2359 | //----------------------------------------------------------------------------- |
| 2360 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2361 | // |
| 2362 | // stub stub |
| 2363 | // +-------+ +---------+ +---------+ |
| 2364 | // | xapp | | submgr | | e2term | |
| 2365 | // +-------+ +---------+ +---------+ |
| 2366 | // | | | |
| 2367 | // | SubReq | | |
| 2368 | // |------------->| | |
| 2369 | // | | | |
| 2370 | // | | SubReq | |
| 2371 | // | |------------->| |
| 2372 | // | | | |
| 2373 | // | | SubResp | |
| 2374 | // | <----| |
| 2375 | // | | |
| 2376 | // | Submgr restart | |
| 2377 | // | | |
| 2378 | // | | | |
| 2379 | // | | SubDelReq | |
| 2380 | // | |------------->| |
| 2381 | // | | | |
| 2382 | // | | SubDelResp | |
| 2383 | // | |<-------------| |
| 2384 | // | | | |
| 2385 | // |
| 2386 | //----------------------------------------------------------------------------- |
| 2387 | |
| 2388 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2389 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2390 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2391 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2392 | xappConn1.SendSubsReq(t, nil, nil) |
| 2393 | e2termConn1.RecvSubsReq(t) |
| 2394 | mainCtrl.SetResetTestFlag(t, false) |
| 2395 | |
| 2396 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2397 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2398 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2399 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2400 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2401 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2402 | mainCtrl.SimulateRestart(t) |
| 2403 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2404 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2405 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2406 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2407 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2408 | |
| 2409 | // Wait that subs is cleaned |
| 2410 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2411 | |
| 2412 | xappConn1.TestMsgChanEmpty(t) |
| 2413 | xappConn2.TestMsgChanEmpty(t) |
| 2414 | e2termConn1.TestMsgChanEmpty(t) |
| 2415 | mainCtrl.wait_registry_empty(t, 10) |
| 2416 | } |
| 2417 | |
| 2418 | //----------------------------------------------------------------------------- |
| 2419 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2420 | // |
| 2421 | // stub stub |
| 2422 | // +-------+ +---------+ +---------+ |
| 2423 | // | xapp | | submgr | | e2term | |
| 2424 | // +-------+ +---------+ +---------+ |
| 2425 | // | | | |
| 2426 | // | SubReq | | |
| 2427 | // |------------->| | |
| 2428 | // | | | |
| 2429 | // | | SubReq | |
| 2430 | // | |------------->| |
| 2431 | // | | | |
| 2432 | // | | SubResp | |
| 2433 | // | |<-------------| |
| 2434 | // | | | |
| 2435 | // | SubResp | | |
| 2436 | // |<-------------| | |
| 2437 | // | | | |
| 2438 | // | | |
| 2439 | // | Submgr restart | |
| 2440 | // | | |
| 2441 | // | SubDelReq | | |
| 2442 | // |------------->| | |
| 2443 | // | | | |
| 2444 | // | | SubDelReq | |
| 2445 | // | |------------->| |
| 2446 | // | | | |
| 2447 | // | | SubDelResp | |
| 2448 | // | |<-------------| |
| 2449 | // | | | |
| 2450 | // | SubDelResp | | |
| 2451 | // |<-------------| | |
| 2452 | // |
| 2453 | //----------------------------------------------------------------------------- |
| 2454 | |
| 2455 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2456 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2457 | |
| 2458 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2459 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2460 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2461 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2462 | |
| 2463 | // Check subscription |
| 2464 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2465 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2466 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2467 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2468 | |
| 2469 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2470 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2471 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2472 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2473 | // That needs to be completed before successful subscription query is possible |
| 2474 | <-time.After(time.Second * 1) |
| 2475 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2476 | // Check that subscription is restored correctly after restart |
| 2477 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2478 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2479 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2480 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2481 | |
| 2482 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2483 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2484 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2485 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2486 | |
| 2487 | //Wait that subs is cleaned |
| 2488 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2489 | |
| 2490 | xappConn1.TestMsgChanEmpty(t) |
| 2491 | xappConn2.TestMsgChanEmpty(t) |
| 2492 | e2termConn1.TestMsgChanEmpty(t) |
| 2493 | mainCtrl.wait_registry_empty(t, 10) |
| 2494 | } |
| 2495 | |
| 2496 | //----------------------------------------------------------------------------- |
| 2497 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2498 | // |
| 2499 | // stub stub |
| 2500 | // +-------+ +-------+ +---------+ +---------+ |
| 2501 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2502 | // +-------+ +-------+ +---------+ +---------+ |
| 2503 | // | | | | |
| 2504 | // | | | | |
| 2505 | // | | | | |
| 2506 | // | | SubReq1 | | |
| 2507 | // | |------------->| | |
| 2508 | // | | | | |
| 2509 | // | | | SubReq1 | |
| 2510 | // | | |------------->| |
| 2511 | // | | | SubResp1 | |
| 2512 | // | | |<-------------| |
| 2513 | // | | SubResp1 | | |
| 2514 | // | |<-------------| | |
| 2515 | // | | | | |
| 2516 | // | | |
| 2517 | // | submgr restart | |
| 2518 | // | | |
| 2519 | // | | | | |
| 2520 | // | | | | |
| 2521 | // | SubReq2 | | |
| 2522 | // |--------------------------->| | |
| 2523 | // | | | | |
| 2524 | // | SubResp2 | | |
| 2525 | // |<---------------------------| | |
| 2526 | // | | | | |
| 2527 | // | | SubDelReq 1 | | |
| 2528 | // | |------------->| | |
| 2529 | // | | | | |
| 2530 | // | | SubDelResp 1 | | |
| 2531 | // | |<-------------| | |
| 2532 | // | | | | |
| 2533 | // | | | | |
| 2534 | // | | |
| 2535 | // | submgr restart | |
| 2536 | // | | |
| 2537 | // | | | | |
| 2538 | // | SubDelReq 2 | | |
| 2539 | // |--------------------------->| | |
| 2540 | // | | | | |
| 2541 | // | | | SubDelReq 2 | |
| 2542 | // | | |------------->| |
| 2543 | // | | | | |
| 2544 | // | | | SubDelReq 2 | |
| 2545 | // | | |------------->| |
| 2546 | // | | | | |
| 2547 | // | SubDelResp 2 | | |
| 2548 | // |<---------------------------| | |
| 2549 | // |
| 2550 | //----------------------------------------------------------------------------- |
| 2551 | |
| 2552 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2553 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2554 | |
| 2555 | //Req1 |
| 2556 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2557 | rparams1.Init() |
| 2558 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2559 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2560 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2561 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2562 | |
| 2563 | //Req2 |
| 2564 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2565 | rparams2.Init() |
| 2566 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2567 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2568 | |
| 2569 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2570 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2571 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2572 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2573 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2574 | |
| 2575 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2576 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2577 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2578 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2579 | // That needs to be completed before successful subscription query is possible |
| 2580 | <-time.After(time.Second * 1) |
| 2581 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2582 | // Check that subscription is restored correctly after restart |
| 2583 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2584 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2585 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2586 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2587 | |
| 2588 | //Del1 |
| 2589 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2590 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2591 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2592 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2593 | |
| 2594 | mainCtrl.SimulateRestart(t) |
| 2595 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2596 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2597 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2598 | // Submgr need be ready before successful subscription deletion is possible |
| 2599 | <-time.After(time.Second * 1) |
| 2600 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2601 | //Del2 |
| 2602 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2603 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2604 | |
| 2605 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2606 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2607 | |
| 2608 | //Wait that subs is cleaned |
| 2609 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2610 | |
| 2611 | xappConn1.TestMsgChanEmpty(t) |
| 2612 | xappConn2.TestMsgChanEmpty(t) |
| 2613 | e2termConn1.TestMsgChanEmpty(t) |
| 2614 | mainCtrl.wait_registry_empty(t, 10) |
| 2615 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2616 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2617 | //***************************************************************************** |
| 2618 | // REST interface test cases |
| 2619 | //***************************************************************************** |
| 2620 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2621 | //----------------------------------------------------------------------------- |
| 2622 | // Test debug GET and POST requests |
| 2623 | // |
| 2624 | // curl |
| 2625 | // +-------+ +---------+ |
| 2626 | // | user | | submgr | |
| 2627 | // +-------+ +---------+ |
| 2628 | // | | |
| 2629 | // | GET/POST Req | |
| 2630 | // |------------->| |
| 2631 | // | Resp | |
| 2632 | // |<-------------| |
| 2633 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2634 | func TestGetSubscriptions(t *testing.T) { |
| 2635 | |
| 2636 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2637 | } |
| 2638 | |
| 2639 | func TestGetSymptomData(t *testing.T) { |
| 2640 | |
| 2641 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2642 | } |
| 2643 | |
| 2644 | func TestPostdeleteSubId(t *testing.T) { |
| 2645 | |
| 2646 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2647 | } |
| 2648 | |
| 2649 | func TestPostEmptyDb(t *testing.T) { |
| 2650 | |
| 2651 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2652 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2653 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2654 | func TestGetRestSubscriptions(t *testing.T) { |
| 2655 | |
| 2656 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2657 | } |
| 2658 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2659 | //----------------------------------------------------------------------------- |
| 2660 | // TestRESTSubReqAndRouteNok |
| 2661 | // |
| 2662 | // stub stub |
| 2663 | // +-------+ +---------+ +---------+ |
| 2664 | // | xapp | | submgr | | rtmgr | |
| 2665 | // +-------+ +---------+ +---------+ |
| 2666 | // | | | |
| 2667 | // | RESTSubReq | | |
| 2668 | // |---------------->| | |
| 2669 | // | | | |
| 2670 | // | RESTSubResp | | |
| 2671 | // |<----------------| | |
| 2672 | // | | RouteCreate | |
| 2673 | // | |------------->| |
| 2674 | // | | | |
| 2675 | // | | RouteCreate | |
| 2676 | // | | status:400 | |
| 2677 | // | |(Bad request) | |
| 2678 | // | |<-------------| |
| 2679 | // | RESTNotif | | |
| 2680 | // |<----------------| | |
| 2681 | // | | | |
| 2682 | // | [SUBS INT DELETE] | |
| 2683 | // | | | |
| 2684 | // | RESTSubDelReq | | |
| 2685 | // |---------------->| | |
| 2686 | // | RESTSubDelResp | | |
| 2687 | // |<----------------| | |
| 2688 | // |
| 2689 | //----------------------------------------------------------------------------- |
| 2690 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2691 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2692 | |
| 2693 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2694 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2695 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2696 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2697 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2698 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2699 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2700 | }) |
| 2701 | |
| 2702 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2703 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2704 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2705 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2706 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2707 | |
| 2708 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2709 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2710 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2711 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2712 | waiter.WaitResult(t) |
| 2713 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2714 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2715 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2716 | |
| 2717 | // Del |
| 2718 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2719 | |
| 2720 | // Wait that subs is cleaned |
| 2721 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2722 | waitSubsCleanup(t, e2SubsId, 10) |
| 2723 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2724 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2725 | } |
| 2726 | |
| 2727 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2728 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2729 | |
| 2730 | //Init counter check |
| 2731 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2732 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2733 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2734 | Counter{cSubReqToE2, 1}, |
| 2735 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2736 | Counter{cRestSubNotifToXapp, 1}, |
| 2737 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2738 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2739 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2740 | Counter{cSubDelReqToE2, 1}, |
| 2741 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2742 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2743 | }) |
| 2744 | |
| 2745 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2746 | |
| 2747 | //Subs Create |
| 2748 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2749 | |
| 2750 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2751 | |
| 2752 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2753 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2754 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2755 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2756 | params.SetMeid("RAN_NAME_1") |
| 2757 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2758 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2759 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2760 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2761 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2762 | |
| 2763 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2764 | |
| 2765 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2766 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2767 | |
| 2768 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2769 | //Wait that subs is cleaned |
| 2770 | waitSubsCleanup(t, e2SubsId, 10) |
| 2771 | |
| 2772 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2773 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2774 | } |
| 2775 | |
| 2776 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2777 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2778 | |
| 2779 | // Init counter check |
| 2780 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2781 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2782 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2783 | Counter{cSubReqToE2, 1}, |
| 2784 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2785 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2786 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2787 | Counter{cRouteDeleteFail, 1}, |
| 2788 | Counter{cSubDelReqToE2, 1}, |
| 2789 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2790 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2791 | }) |
| 2792 | |
| 2793 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2794 | |
| 2795 | //Subs Create |
| 2796 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2797 | |
| 2798 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2799 | |
| 2800 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2801 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2802 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2803 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2804 | waiter.WaitResult(t) |
| 2805 | |
| 2806 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2807 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2808 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2809 | } |
| 2810 | |
| 2811 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2812 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2813 | |
| 2814 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2815 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2816 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2817 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2818 | Counter{cSubReqToE2, 1}, |
| 2819 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2820 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2821 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2822 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2823 | Counter{cSubDelReqToE2, 1}, |
| 2824 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2825 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2826 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2827 | }) |
| 2828 | |
| 2829 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2830 | |
| 2831 | //Subs Create |
| 2832 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2833 | |
| 2834 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2835 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2836 | |
| 2837 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2838 | |
| 2839 | //Del1, this shall fail on rtmgr side |
| 2840 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2841 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2842 | waiter.WaitResult(t) |
| 2843 | |
| 2844 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2845 | |
| 2846 | //Del2 |
| 2847 | deleteXapp2Subscription(t, &restSubId2) |
| 2848 | |
| 2849 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2850 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2851 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2852 | } |
| 2853 | |
| 2854 | //----------------------------------------------------------------------------- |
| 2855 | // TestRESTSubReqRetransmission |
| 2856 | // |
| 2857 | // stub stub |
| 2858 | // +-------+ +---------+ +---------+ |
| 2859 | // | xapp | | submgr | | e2term | |
| 2860 | // +-------+ +---------+ +---------+ |
| 2861 | // | | | |
| 2862 | // | RESTSubReq1 | | |
| 2863 | // |---------------->| | |
| 2864 | // | | | |
| 2865 | // | RESTSubResp | | |
| 2866 | // |<----------------| | |
| 2867 | // | | SubReq1 | |
| 2868 | // | |------------->| |
| 2869 | // | | | |
| 2870 | // | RESTSubReq2 | | |
| 2871 | // | (retrans) | | |
| 2872 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2873 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2874 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2875 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2876 | // | | SubResp1 | |
| 2877 | // | |<-------------| |
| 2878 | // | RESTNotif1 | | |
| 2879 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2880 | // | | | |
| 2881 | // | [SUBS DELETE] | |
| 2882 | // | | | |
| 2883 | // |
| 2884 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2885 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2886 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2887 | CaseBegin("TestRESTSubReqRetransmission") |
| 2888 | |
| 2889 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2890 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2891 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2892 | Counter{cSubReqToE2, 1}, |
| 2893 | Counter{cSubRespFromE2, 1}, |
| 2894 | Counter{cRestSubNotifToXapp, 1}, |
| 2895 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2896 | Counter{cSubDelReqToE2, 1}, |
| 2897 | Counter{cSubDelRespFromE2, 1}, |
| 2898 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2899 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2900 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2901 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2902 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2903 | |
| 2904 | // Subs Create |
| 2905 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2906 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2907 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2908 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2909 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2910 | xappConn1.SendRESTSubsReq(t, params) |
| 2911 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2912 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2913 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2914 | |
| 2915 | // 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] | 2916 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2917 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2918 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2919 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2920 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 2921 | |
| 2922 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2923 | |
| 2924 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2925 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2926 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2927 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2928 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2929 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2930 | |
| 2931 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 2932 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2933 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2934 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2935 | //----------------------------------------------------------------------------- |
| 2936 | // stub stub stub |
| 2937 | // +-------+ +---------+ +---------+ +---------+ |
| 2938 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2939 | // +-------+ +---------+ +---------+ +---------+ |
| 2940 | // | | | | |
| 2941 | // | RESTSubReq | | | |
| 2942 | // |---------------->| | | |
| 2943 | // | RESTSubResp | | | |
| 2944 | // |<----------------| | | |
| 2945 | // | | RouteCreate | | |
| 2946 | // | |--------------------------->| |
| 2947 | // | | RouteResponse| | |
| 2948 | // | |<---------------------------| // The order of these events may vary |
| 2949 | // | | SubReq | | |
| 2950 | // | |------------->| | // The order of these events may vary |
| 2951 | // | | SubResp | | |
| 2952 | // | |<-------------| | |
| 2953 | // | RESTNotif1 | | | |
| 2954 | // |<----------------| | | |
| 2955 | // | RESTSubReq | | | |
| 2956 | // | [RETRANS1] | | | |
| 2957 | // |---------------->| | | |
| 2958 | // | RESTNotif1 | | | |
| 2959 | // |<----------------| | | |
| 2960 | // | RESTSubReq | | | |
| 2961 | // | [RETRANS2] | | | |
| 2962 | // |---------------->| | | |
| 2963 | // | RESTNotif1 | | | |
| 2964 | // |<----------------| | | |
| 2965 | // | RESTSubDelReq | | | |
| 2966 | // |---------------->| | | |
| 2967 | // | | SubDelReq | | |
| 2968 | // | |------------->| | |
| 2969 | // | RESTSubDelResp| | | |
| 2970 | // |<----------------| | | |
| 2971 | // | | SubDelResp | | |
| 2972 | // | |<-------------| | |
| 2973 | // | | | | |
| 2974 | // |
| 2975 | //----------------------------------------------------------------------------- |
| 2976 | |
| 2977 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2978 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2979 | |
| 2980 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2981 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 2982 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2983 | Counter{cRestSubRespToXapp, 3}, |
| 2984 | Counter{cSubReqToE2, 1}, |
| 2985 | Counter{cSubRespFromE2, 1}, |
| 2986 | Counter{cRestSubNotifToXapp, 3}, |
| 2987 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2988 | Counter{cSubDelReqToE2, 1}, |
| 2989 | Counter{cSubDelRespFromE2, 1}, |
| 2990 | Counter{cRestSubDelRespToXapp, 1}, |
| 2991 | }) |
| 2992 | |
| 2993 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2994 | |
| 2995 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2996 | |
| 2997 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2998 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 2999 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3000 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3001 | //1.st resend |
| 3002 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3003 | |
| 3004 | assert.Equal(t, restSubId_resend, restSubId) |
| 3005 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3006 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3007 | |
| 3008 | //2.nd resend |
| 3009 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3010 | |
| 3011 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3012 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3013 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3014 | |
| 3015 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3016 | |
| 3017 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3018 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3019 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3020 | } |
| 3021 | |
| 3022 | //----------------------------------------------------------------------------- |
| 3023 | // stub stub stub |
| 3024 | // +-------+ +---------+ +---------+ +---------+ |
| 3025 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3026 | // +-------+ +---------+ +---------+ +---------+ |
| 3027 | // | | | | |
| 3028 | // | RESTSubReq | | | |
| 3029 | // |---------------->| | | |
| 3030 | // | RESTSubResp | | | |
| 3031 | // |<----------------| | | |
| 3032 | // | | RouteCreate | | |
| 3033 | // | |--------------------------->| |
| 3034 | // | | RouteResponse| | |
| 3035 | // | |<---------------------------| // The order of these events may vary |
| 3036 | // | | SubReq | | |
| 3037 | // | |------------->| | // The order of these events may vary |
| 3038 | // | | SubResp | | |
| 3039 | // | |<-------------| | |
| 3040 | // | RESTNotif1 | | | |
| 3041 | // |<----------------| | | |
| 3042 | // | RESTSubReq | | | |
| 3043 | // | [RETRANS, with RESTsubsId] | | |
| 3044 | // |---------------->| | | |
| 3045 | // | RESTNotif1 | | | |
| 3046 | // |<----------------| | | |
| 3047 | // | RESTSubReq | | | |
| 3048 | // | [RETRANS, without RESTsubsId] | | |
| 3049 | // |---------------->| | | |
| 3050 | // | RESTNotif1 | | | |
| 3051 | // |<----------------| | | |
| 3052 | // | RESTSubDelReq | | | |
| 3053 | // |---------------->| | | |
| 3054 | // | | SubDelReq | | |
| 3055 | // | |------------->| | |
| 3056 | // | RESTSubDelResp| | | |
| 3057 | // |<----------------| | | |
| 3058 | // | | SubDelResp | | |
| 3059 | // | |<-------------| | |
| 3060 | // | | | | |
| 3061 | // |
| 3062 | //----------------------------------------------------------------------------- |
| 3063 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 3064 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 3065 | |
| 3066 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3067 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3068 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3069 | Counter{cRestSubRespToXapp, 3}, |
| 3070 | Counter{cSubReqToE2, 1}, |
| 3071 | Counter{cSubRespFromE2, 1}, |
| 3072 | Counter{cRestSubNotifToXapp, 3}, |
| 3073 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3074 | Counter{cSubDelReqToE2, 1}, |
| 3075 | Counter{cSubDelRespFromE2, 1}, |
| 3076 | Counter{cRestSubDelRespToXapp, 1}, |
| 3077 | }) |
| 3078 | |
| 3079 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3080 | |
| 3081 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3082 | |
| 3083 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3084 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3085 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3086 | |
| 3087 | //1.st resend with subscription ID |
| 3088 | params.SetSubscriptionID(&restSubId) |
| 3089 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3090 | |
| 3091 | assert.Equal(t, restSubId_resend, restSubId) |
| 3092 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3093 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3094 | |
| 3095 | //2.nd resend without subscription ID (faking app restart) |
| 3096 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3097 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3098 | |
| 3099 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3100 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3101 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3102 | |
| 3103 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3104 | |
| 3105 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3106 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3107 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3108 | } |
| 3109 | |
| 3110 | //----------------------------------------------------------------------------- |
| 3111 | // stub stub stub |
| 3112 | // +-------+ +---------+ +---------+ +---------+ |
| 3113 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3114 | // +-------+ +---------+ +---------+ +---------+ |
| 3115 | // | | | | |
| 3116 | // | RESTSubReq | | | |
| 3117 | // |---------------->| | | |
| 3118 | // | RESTSubResp | | | |
| 3119 | // |<----------------| | | |
| 3120 | // | | RouteCreate | | |
| 3121 | // | |--------------------------->| |
| 3122 | // | | RouteResponse| | |
| 3123 | // | |<---------------------------| |
| 3124 | // | | SubReq | | |
| 3125 | // | |------------->| | |
| 3126 | // | | SubResp | | |
| 3127 | // | |<-------------| | |
| 3128 | // | RESTNotif1 | | | |
| 3129 | // |<----------------| | | |
| 3130 | // | RESTSubReq | | | |
| 3131 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3132 | // |---------------->| | | |
| 3133 | // | RESTNotif1 | | | |
| 3134 | // | [for initial e2 subDetail] | | |
| 3135 | // |<----------------| | | |
| 3136 | // | | RouteCreate | | |
| 3137 | // | |--------------------------->| |
| 3138 | // | | RouteResponse| | |
| 3139 | // | |<---------------------------| |
| 3140 | // | | SubReq | | |
| 3141 | // | |------------->| | |
| 3142 | // | | SubResp | | |
| 3143 | // | |<-------------| | |
| 3144 | // | RESTNotif1 | | | |
| 3145 | // |<----------------| | | |
| 3146 | // | RESTSubReq | | | |
| 3147 | // | [with RESTsubsId initial request] | |
| 3148 | // |---------------->| | | |
| 3149 | // | RESTNotif1 | | | |
| 3150 | // |<----------------| | | |
| 3151 | // | RESTSubDelReq | | | |
| 3152 | // |---------------->| | | |
| 3153 | // | RESTSubDelResp| | | |
| 3154 | // |<----------------| | | |
| 3155 | // | | SubDelReq | | |
| 3156 | // | |------------->| | |
| 3157 | // | | SubDelResp | | |
| 3158 | // | |<-------------| | |
| 3159 | // | | SubDelReq | | |
| 3160 | // | |------------->| | |
| 3161 | // | | SubDelResp | | |
| 3162 | // | |<-------------| | |
| 3163 | // | | | | |
| 3164 | // |
| 3165 | //----------------------------------------------------------------------------- |
| 3166 | |
| 3167 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 3168 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 3169 | |
| 3170 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3171 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3172 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3173 | Counter{cRestSubRespToXapp, 3}, |
| 3174 | Counter{cSubReqToE2, 2}, |
| 3175 | Counter{cSubRespFromE2, 2}, |
| 3176 | Counter{cRestSubNotifToXapp, 4}, |
| 3177 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3178 | Counter{cSubDelReqToE2, 2}, |
| 3179 | Counter{cSubDelRespFromE2, 2}, |
| 3180 | Counter{cRestSubDelRespToXapp, 1}, |
| 3181 | }) |
| 3182 | |
| 3183 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3184 | |
| 3185 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3186 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3187 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3188 | |
| 3189 | // Send modified requst, this time with e2 subscriptions. |
| 3190 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3191 | params2.SetSubscriptionID(&restSubId) |
| 3192 | |
| 3193 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3194 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3195 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3196 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3197 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3198 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3199 | |
| 3200 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3201 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3202 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3203 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3204 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3205 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3206 | assert.NotEqual(t, e2SubsId2, 0) |
| 3207 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3208 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3209 | |
| 3210 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3211 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3212 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3213 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3214 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3215 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3216 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3217 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3218 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3219 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3220 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3221 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3222 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3223 | // Delete both e2 subscriptions |
| 3224 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3225 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3226 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3227 | |
| 3228 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3229 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3230 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3231 | } |
| 3232 | |
| 3233 | //----------------------------------------------------------------------------- |
| 3234 | // stub stub stub |
| 3235 | // +-------+ +---------+ +---------+ +---------+ |
| 3236 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3237 | // +-------+ +---------+ +---------+ +---------+ |
| 3238 | // | | | | |
| 3239 | // | RESTSubReq | | | |
| 3240 | // |---------------->| | | |
| 3241 | // | RESTSubResp | | | |
| 3242 | // |<----------------| | | |
| 3243 | // | | RouteCreate | | |
| 3244 | // | |--------------------------->| |
| 3245 | // | | RouteResponse| | |
| 3246 | // | |<---------------------------| |
| 3247 | // | | SubReq | | |
| 3248 | // | |------------->| | |
| 3249 | // | | SubResp | | |
| 3250 | // | |<-------------| | |
| 3251 | // | RESTNotif1 | | | |
| 3252 | // |<----------------| | | |
| 3253 | // | RESTSubReq | | | |
| 3254 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3255 | // |---------------->| | | |
| 3256 | // | RESTNotif1 | | | |
| 3257 | // | [for initial e2 subDetail] | | |
| 3258 | // |<----------------| | | |
| 3259 | // | | RouteCreate | | |
| 3260 | // | |--------------------------->| |
| 3261 | // | | RouteResponse| | |
| 3262 | // | |<---------------------------| |
| 3263 | // | | SubReq | | |
| 3264 | // | |------------->| | |
| 3265 | // | | SubResp | | |
| 3266 | // | |<-------------| | |
| 3267 | // | RESTNotif1 | | | |
| 3268 | // |<----------------| | | |
| 3269 | // | RESTSubReq | | | |
| 3270 | // | [without RESTsubsId initial request] | |
| 3271 | // |---------------->| | | |
| 3272 | // | RESTNotif1 | | | |
| 3273 | // |<----------------| | | |
| 3274 | // | RESTSubDelReq | | | |
| 3275 | // |---------------->| | | |
| 3276 | // | RESTSubDelResp| | | |
| 3277 | // |<----------------| | | |
| 3278 | // | | SubDelReq | | |
| 3279 | // | |------------->| | |
| 3280 | // | | SubDelResp | | |
| 3281 | // | |<-------------| | |
| 3282 | // | | SubDelReq | | |
| 3283 | // | |------------->| | |
| 3284 | // | | SubDelResp | | |
| 3285 | // | |<-------------| | |
| 3286 | // | | | | |
| 3287 | // |
| 3288 | //----------------------------------------------------------------------------- |
| 3289 | |
| 3290 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3291 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3292 | |
| 3293 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3294 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3295 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3296 | Counter{cRestSubRespToXapp, 3}, |
| 3297 | Counter{cSubReqToE2, 2}, |
| 3298 | Counter{cSubRespFromE2, 2}, |
| 3299 | Counter{cRestSubNotifToXapp, 4}, |
| 3300 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3301 | Counter{cSubDelReqToE2, 2}, |
| 3302 | Counter{cSubDelRespFromE2, 2}, |
| 3303 | Counter{cRestSubDelRespToXapp, 1}, |
| 3304 | }) |
| 3305 | |
| 3306 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3307 | |
| 3308 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3309 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3310 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3311 | |
| 3312 | // Send modified requst, this time with e2 subscriptions. |
| 3313 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3314 | params2.SetSubscriptionID(&restSubId) |
| 3315 | |
| 3316 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3317 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3318 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3319 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3320 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3321 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3322 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3323 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3324 | xappConn1.DecrementRequestCount() |
| 3325 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3326 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3327 | |
| 3328 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3329 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3330 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3331 | assert.NotEqual(t, e2SubsId2, 0) |
| 3332 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3333 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3334 | |
| 3335 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3336 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3337 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3338 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3339 | // md5sum shall find the original request |
| 3340 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3341 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3342 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3343 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3344 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3345 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3346 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3347 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3348 | // Delete both e2 subscriptions |
| 3349 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3350 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3351 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3352 | |
| 3353 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3354 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3355 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3356 | } |
| 3357 | |
| 3358 | //----------------------------------------------------------------------------- |
| 3359 | // stub stub stub |
| 3360 | // +-------+ +---------+ +---------+ +---------+ |
| 3361 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3362 | // +-------+ +---------+ +---------+ +---------+ |
| 3363 | // | | | | |
| 3364 | // | RESTSubReq | | | |
| 3365 | // |---------------->| | | |
| 3366 | // | RESTSubResp | | | |
| 3367 | // |<----------------| | | |
| 3368 | // | | RouteCreate | | |
| 3369 | // | |--------------------------->| |
| 3370 | // | | RouteResponse| | |
| 3371 | // | |<---------------------------| |
| 3372 | // | | SubReq | | |
| 3373 | // | |------------->| | |
| 3374 | // | | SubResp | | |
| 3375 | // | |<-------------| | |
| 3376 | // | RESTNotif1 | | | |
| 3377 | // |<----------------| | | |
| 3378 | // | RESTSubReq | | | |
| 3379 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3380 | // |---------------->| | | |
| 3381 | // | RESTNotif1 | | | |
| 3382 | // | [for initial e2 subDetail] | | |
| 3383 | // |<----------------| | | |
| 3384 | // | | RouteCreate | | |
| 3385 | // | |--------------------------->| |
| 3386 | // | | RouteResponse| | |
| 3387 | // | |<---------------------------| |
| 3388 | // | | SubReq | | |
| 3389 | // | |------------->| | |
| 3390 | // | | SubResp | | |
| 3391 | // | |<-------------| | |
| 3392 | // | RESTNotif1 | | | |
| 3393 | // |<----------------| | | |
| 3394 | // | RESTSubDelReq | | | |
| 3395 | // |---------------->| | | |
| 3396 | // | RESTSubDelResp| | | |
| 3397 | // |<----------------| | | |
| 3398 | // | | SubDelReq | | |
| 3399 | // | |------------->| | |
| 3400 | // | | SubDelResp | | |
| 3401 | // | |<-------------| | |
| 3402 | // | | SubDelReq | | |
| 3403 | // | |------------->| | |
| 3404 | // | | SubDelResp | | |
| 3405 | // | |<-------------| | |
| 3406 | // | RESTSubReq | | | |
| 3407 | // | [with RESTsubsId initial request] | |
| 3408 | // |---------------->| | | |
| 3409 | // | RESTSubResp | | | |
| 3410 | // |<----------------| | | |
| 3411 | // | | RouteCreate | | |
| 3412 | // | |--------------------------->| |
| 3413 | // | | RouteResponse| | |
| 3414 | // | |<---------------------------| |
| 3415 | // | | SubReq | | |
| 3416 | // | |------------->| | |
| 3417 | // | | SubResp | | |
| 3418 | // | |<-------------| | |
| 3419 | // | RESTNotif1 | | | |
| 3420 | // |<----------------| | | |
| 3421 | // | | | | |
| 3422 | // |
| 3423 | //----------------------------------------------------------------------------- |
| 3424 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3425 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3426 | |
| 3427 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3428 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3429 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3430 | Counter{cRestSubRespToXapp, 3}, |
| 3431 | Counter{cSubReqToE2, 3}, |
| 3432 | Counter{cSubRespFromE2, 3}, |
| 3433 | Counter{cRestSubNotifToXapp, 4}, |
| 3434 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3435 | Counter{cSubDelReqToE2, 3}, |
| 3436 | Counter{cSubDelRespFromE2, 3}, |
| 3437 | Counter{cRestSubDelRespToXapp, 2}, |
| 3438 | }) |
| 3439 | |
| 3440 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3441 | |
| 3442 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3443 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3444 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3445 | |
| 3446 | // Send modified requst, this time with e2 subscriptions. |
| 3447 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3448 | params2.SetSubscriptionID(&restSubId) |
| 3449 | |
| 3450 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3451 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3452 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3453 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3454 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3455 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3456 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3457 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3458 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3459 | |
| 3460 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3461 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3462 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3463 | assert.NotEqual(t, e2SubsId2, 0) |
| 3464 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3465 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3466 | |
| 3467 | // Delete both e2 subscriptions |
| 3468 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3469 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3470 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3471 | |
| 3472 | waitSubsCleanup(t, e2SubsId, 10) |
| 3473 | |
| 3474 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3475 | // but the restsubscription has been already removed. This shall trigger a |
| 3476 | // fresh create. |
| 3477 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3478 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3479 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3480 | |
| 3481 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3482 | |
| 3483 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3484 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3485 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3486 | } |
| 3487 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3488 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3489 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3490 | |
| 3491 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3492 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3493 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3494 | Counter{cSubReqToE2, 1}, |
| 3495 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3496 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3497 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3498 | Counter{cSubDelReqToE2, 1}, |
| 3499 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3500 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3501 | }) |
| 3502 | |
| 3503 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3504 | |
| 3505 | //Subs Create |
| 3506 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3507 | |
| 3508 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3509 | |
| 3510 | //Subs Delete |
| 3511 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3512 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3513 | |
| 3514 | seqBef := mainCtrl.get_msgcounter(t) |
| 3515 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3516 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3517 | |
| 3518 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3519 | |
| 3520 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3521 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3522 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3523 | } |
| 3524 | |
| 3525 | //----------------------------------------------------------------------------- |
| 3526 | // TestRESTSubReqDelReq |
| 3527 | // |
| 3528 | // stub stub |
| 3529 | // +-------+ +---------+ +---------+ |
| 3530 | // | xapp | | submgr | | e2term | |
| 3531 | // +-------+ +---------+ +---------+ |
| 3532 | // | | | |
| 3533 | // | RESTSubReq | | |
| 3534 | // |---------------->| | |
| 3535 | // | | | |
| 3536 | // | RESTSubResp | | |
| 3537 | // |<----------------| | |
| 3538 | // | | SubReq | |
| 3539 | // | |------------->| |
| 3540 | // | RESTSubDelReq | | |
| 3541 | // |---------------->| | |
| 3542 | // | RESTSubDelResp | | |
| 3543 | // | unsuccess | | |
| 3544 | // |<----------------| | |
| 3545 | // | | SubResp | |
| 3546 | // | |<-------------| |
| 3547 | // | RESTNotif1 | | |
| 3548 | // |<----------------| | |
| 3549 | // | | | |
| 3550 | // | [SUBS DELETE] | |
| 3551 | // | | | |
| 3552 | // |
| 3553 | //----------------------------------------------------------------------------- |
| 3554 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3555 | CaseBegin("TestRESTSubReqDelReq") |
| 3556 | |
| 3557 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3558 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3559 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3560 | Counter{cSubReqToE2, 1}, |
| 3561 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3562 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3563 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3564 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3565 | Counter{cSubDelReqToE2, 1}, |
| 3566 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3567 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3568 | }) |
| 3569 | |
| 3570 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3571 | |
| 3572 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3573 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3574 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3575 | |
| 3576 | // Del. This will fail as processing of the subscription |
| 3577 | // is still ongoing in submgr. Deletion is not allowed before |
| 3578 | // subscription creation has been completed. |
| 3579 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3580 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3581 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3582 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3583 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3584 | |
| 3585 | // Retry del |
| 3586 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3587 | |
| 3588 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3589 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3590 | |
| 3591 | // Wait that subs is cleaned |
| 3592 | waitSubsCleanup(t, e2SubsId, 10) |
| 3593 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3594 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3595 | } |
| 3596 | |
| 3597 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3598 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3599 | } |
| 3600 | |
| 3601 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3602 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3603 | |
| 3604 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3605 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3606 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3607 | Counter{cSubReqToE2, 2}, |
| 3608 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3609 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3610 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3611 | Counter{cSubDelReqToE2, 2}, |
| 3612 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3613 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3614 | }) |
| 3615 | |
| 3616 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3617 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3618 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3619 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3620 | |
| 3621 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3622 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3623 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3624 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3625 | |
| 3626 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3627 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3628 | |
| 3629 | //XappConn1 receives both of the responses |
| 3630 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3631 | |
| 3632 | //Resp1 |
| 3633 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3634 | //Resp2 |
| 3635 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3636 | |
| 3637 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3638 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3639 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3640 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3641 | |
| 3642 | //Del1 |
| 3643 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3644 | //Del2 |
| 3645 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3646 | |
| 3647 | //Wait that subs is cleaned |
| 3648 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3649 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3650 | |
| 3651 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3652 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3653 | } |
| 3654 | |
| 3655 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3656 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3657 | |
| 3658 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3659 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3660 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3661 | Counter{cSubReqToE2, 2}, |
| 3662 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3663 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3664 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3665 | Counter{cSubDelReqToE2, 2}, |
| 3666 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3667 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3668 | }) |
| 3669 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3670 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3671 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3672 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3673 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3674 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3675 | params.SetMeid("RAN_NAME_2") |
| 3676 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3677 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3678 | |
| 3679 | //Del1 |
| 3680 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3681 | //Del2 |
| 3682 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3683 | |
| 3684 | //Wait that subs is cleaned |
| 3685 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3686 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3687 | |
| 3688 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3689 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3690 | } |
| 3691 | |
| 3692 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3693 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3694 | |
| 3695 | // Init counter check |
| 3696 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3697 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3698 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3699 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3700 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3701 | Counter{cSubReReqToE2, 1}, |
| 3702 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3703 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3704 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3705 | Counter{cSubDelReqToE2, 1}, |
| 3706 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3707 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3708 | }) |
| 3709 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3710 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3711 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3712 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3713 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3714 | |
| 3715 | // Catch the first message and ignore it |
| 3716 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3717 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3718 | |
| 3719 | // The second request is being handled normally |
| 3720 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3721 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3722 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3723 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3724 | |
| 3725 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3726 | |
| 3727 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3728 | |
| 3729 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3730 | //Wait that subs is cleaned |
| 3731 | waitSubsCleanup(t, e2SubsId, 10) |
| 3732 | |
| 3733 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3734 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3735 | } |
| 3736 | |
| 3737 | //----------------------------------------------------------------------------- |
| 3738 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3739 | // |
| 3740 | // stub stub |
| 3741 | // +-------+ +---------+ +---------+ |
| 3742 | // | xapp | | submgr | | e2term | |
| 3743 | // +-------+ +---------+ +---------+ |
| 3744 | // | | | |
| 3745 | // | RESTSubReq | | |
| 3746 | // |---------------->| | |
| 3747 | // | | | |
| 3748 | // | RESTSubResp | | |
| 3749 | // |<----------------| | |
| 3750 | // | | SubReq | |
| 3751 | // | |------------->| |
| 3752 | // | | | |
| 3753 | // | | | |
| 3754 | // | | SubReq | |
| 3755 | // | |------------->| |
| 3756 | // | | | |
| 3757 | // | | SubDelReq | |
| 3758 | // | |------------->| |
| 3759 | // | | | |
| 3760 | // | | | |
| 3761 | // | | SubDelReq | |
| 3762 | // | |------------->| |
| 3763 | // | | | |
| 3764 | // | | | |
| 3765 | // | | SubDelResp | |
| 3766 | // | |<-------------| |
| 3767 | // | RESTNotif | | |
| 3768 | // | unsuccess | | |
| 3769 | // |<----------------| | |
| 3770 | // | | | |
| 3771 | // | [SUBS DELETE] | |
| 3772 | // | | | |
| 3773 | // |
| 3774 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3775 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3776 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3777 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3778 | |
| 3779 | // Init counter check |
| 3780 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3781 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3782 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3783 | Counter{cSubReqToE2, 1}, |
| 3784 | Counter{cSubReReqToE2, 1}, |
| 3785 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3786 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3787 | Counter{cSubDelReqToE2, 1}, |
| 3788 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3789 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3790 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3791 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3792 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3793 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3794 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3795 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3796 | |
| 3797 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3798 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3799 | |
| 3800 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3801 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3802 | |
| 3803 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3804 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3805 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3806 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3807 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3808 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3809 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3810 | // Wait that subs is cleaned |
| 3811 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3812 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3813 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3814 | } |
| 3815 | |
| 3816 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3817 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3818 | |
| 3819 | // Init counter check |
| 3820 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3821 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3822 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3823 | Counter{cSubReqToE2, 1}, |
| 3824 | Counter{cSubReReqToE2, 1}, |
| 3825 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3826 | Counter{cSubDelReReqToE2, 1}, |
| 3827 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3828 | Counter{cSubDelReqToE2, 1}, |
| 3829 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3830 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3831 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3832 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3833 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3834 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3835 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3836 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3837 | |
| 3838 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3839 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3840 | |
| 3841 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3842 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3843 | |
| 3844 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3845 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3846 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3847 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3848 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3849 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3850 | |
| 3851 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3852 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3853 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3854 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3855 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3856 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3857 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3858 | } |
| 3859 | |
| 3860 | //----------------------------------------------------------------------------- |
| 3861 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3862 | // |
| 3863 | // stub stub |
| 3864 | // +-------+ +---------+ +---------+ |
| 3865 | // | xapp | | submgr | | e2term | |
| 3866 | // +-------+ +---------+ +---------+ |
| 3867 | // | | | |
| 3868 | // | RESTSubReq | | |
| 3869 | // |---------------->| | |
| 3870 | // | | | |
| 3871 | // | RESTSubResp | | |
| 3872 | // |<----------------| | |
| 3873 | // | | SubReq | |
| 3874 | // | |------------->| |
| 3875 | // | | | |
| 3876 | // | | | |
| 3877 | // | | SubReq | |
| 3878 | // | |------------->| |
| 3879 | // | | | |
| 3880 | // | | SubDelReq | |
| 3881 | // | |------------->| |
| 3882 | // | | | |
| 3883 | // | | | |
| 3884 | // | | SubDelReq | |
| 3885 | // | |------------->| |
| 3886 | // | | | |
| 3887 | // | | | |
| 3888 | // | | SubDelResp | |
| 3889 | // | |<-------------| |
| 3890 | // | RESTNotif | | |
| 3891 | // | unsuccess | | |
| 3892 | // |<----------------| | |
| 3893 | // | | | |
| 3894 | // | [SUBS DELETE] | |
| 3895 | // | | | |
| 3896 | // |
| 3897 | //----------------------------------------------------------------------------- |
| 3898 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3899 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3900 | |
| 3901 | // Init counter check |
| 3902 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3903 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3904 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3905 | Counter{cSubReqToE2, 1}, |
| 3906 | Counter{cSubReReqToE2, 1}, |
| 3907 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3908 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3909 | Counter{cSubDelReqToE2, 1}, |
| 3910 | Counter{cSubDelReReqToE2, 1}, |
| 3911 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3912 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3913 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3914 | }) |
| 3915 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3916 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3917 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3918 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3919 | |
| 3920 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3921 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3922 | |
| 3923 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3924 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3925 | |
| 3926 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3927 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3928 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3929 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3930 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3931 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3932 | |
| 3933 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3934 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3935 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3936 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3937 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3938 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3939 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3940 | } |
| 3941 | |
| 3942 | //----------------------------------------------------------------------------- |
| 3943 | // TestRESTSubReqSubFailRespInSubmgr |
| 3944 | // |
| 3945 | // stub stub |
| 3946 | // +-------+ +---------+ +---------+ |
| 3947 | // | xapp | | submgr | | e2term | |
| 3948 | // +-------+ +---------+ +---------+ |
| 3949 | // | | | |
| 3950 | // | RESTSubReq | | |
| 3951 | // |---------------->| | |
| 3952 | // | | | |
| 3953 | // | RESTSubResp | | |
| 3954 | // |<----------------| | |
| 3955 | // | | SubReq | |
| 3956 | // | |------------->| |
| 3957 | // | | | |
| 3958 | // | | SubFail | |
| 3959 | // | |<-------------| |
| 3960 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3961 | // | RESTNotif | | |
| 3962 | // | unsuccess | | |
| 3963 | // |<----------------| | |
| 3964 | // | | | |
| 3965 | // | [SUBS DELETE] | |
| 3966 | // | | | |
| 3967 | // |
| 3968 | //----------------------------------------------------------------------------- |
| 3969 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3970 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3971 | |
| 3972 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3973 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3974 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3975 | Counter{cSubReqToE2, 1}, |
| 3976 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3977 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3978 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3979 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3980 | }) |
| 3981 | |
| 3982 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3983 | const e2Timeout int64 = 2 |
| 3984 | const e2RetryCount int64 = 1 |
| 3985 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3986 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3987 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 3988 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3989 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3990 | |
| 3991 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3992 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3993 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 3994 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3995 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3996 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3997 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3998 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3999 | |
| 4000 | // REST subscription sill there to be deleted |
| 4001 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4002 | |
| 4003 | // Wait that subs is cleaned |
| 4004 | waitSubsCleanup(t, e2SubsId, 10) |
| 4005 | |
| 4006 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4007 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4008 | } |
| 4009 | |
| 4010 | //----------------------------------------------------------------------------- |
| 4011 | // TestRESTSubDelReqRetryInSubmgr |
| 4012 | // |
| 4013 | // stub stub |
| 4014 | // +-------+ +---------+ +---------+ |
| 4015 | // | xapp | | submgr | | e2term | |
| 4016 | // +-------+ +---------+ +---------+ |
| 4017 | // | | | |
| 4018 | // | [SUBS CREATE] | |
| 4019 | // | | | |
| 4020 | // | | | |
| 4021 | // | RESTSubDelReq | | |
| 4022 | // |---------------->| | |
| 4023 | // | | | |
| 4024 | // | RESTSubDelResp | | |
| 4025 | // |<----------------| | |
| 4026 | // | | SubDelReq | |
| 4027 | // | |------------->| |
| 4028 | // | | | |
| 4029 | // | | SubDelReq | |
| 4030 | // | |------------->| |
| 4031 | // | | | |
| 4032 | // | | SubDelResp | |
| 4033 | // | |<-------------| |
| 4034 | // | | | |
| 4035 | // |
| 4036 | //----------------------------------------------------------------------------- |
| 4037 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 4038 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 4039 | |
| 4040 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4041 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4042 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4043 | Counter{cSubReqToE2, 1}, |
| 4044 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4045 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4046 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4047 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4048 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4049 | Counter{cSubDelReReqToE2, 1}, |
| 4050 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4051 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | }) |
| 4053 | // Req |
| 4054 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4055 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4056 | |
| 4057 | // Del |
| 4058 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4059 | |
| 4060 | // E2t: Receive 1st SubsDelReq |
| 4061 | e2termConn1.RecvSubsDelReq(t) |
| 4062 | |
| 4063 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4064 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4065 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4066 | |
| 4067 | //Wait that subs is cleaned |
| 4068 | waitSubsCleanup(t, e2SubsId, 10) |
| 4069 | |
| 4070 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4071 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4072 | } |
| 4073 | |
| 4074 | //----------------------------------------------------------------------------- |
| 4075 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4076 | // |
| 4077 | // stub stub |
| 4078 | // +-------+ +---------+ +---------+ |
| 4079 | // | xapp | | submgr | | e2term | |
| 4080 | // +-------+ +---------+ +---------+ |
| 4081 | // | | | |
| 4082 | // | [SUBS CREATE] | |
| 4083 | // | | | |
| 4084 | // | | | |
| 4085 | // | RESTSubDelReq | | |
| 4086 | // |---------------->| | |
| 4087 | // | | | |
| 4088 | // | RESTSubDelResp | | |
| 4089 | // |<----------------| | |
| 4090 | // | | SubDelReq | |
| 4091 | // | |------------->| |
| 4092 | // | | | |
| 4093 | // | | SubDelReq | |
| 4094 | // | |------------->| |
| 4095 | // | | | |
| 4096 | // | | | |
| 4097 | // |
| 4098 | //----------------------------------------------------------------------------- |
| 4099 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 4100 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 4101 | |
| 4102 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4103 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4104 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4105 | Counter{cSubReqToE2, 1}, |
| 4106 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4107 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4108 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4109 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4110 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4111 | Counter{cSubDelReReqToE2, 1}, |
| 4112 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4113 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4114 | }) |
| 4115 | |
| 4116 | // Req |
| 4117 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4118 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4119 | |
| 4120 | // Del |
| 4121 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4122 | |
| 4123 | // E2t: Receive 1st SubsDelReq |
| 4124 | e2termConn1.RecvSubsDelReq(t) |
| 4125 | |
| 4126 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4127 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4128 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4129 | |
| 4130 | //Wait that subs is cleaned |
| 4131 | waitSubsCleanup(t, e2SubsId, 10) |
| 4132 | |
| 4133 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4134 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4135 | } |
| 4136 | |
| 4137 | //----------------------------------------------------------------------------- |
| 4138 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4139 | // |
| 4140 | // stub stub |
| 4141 | // +-------+ +---------+ +---------+ |
| 4142 | // | xapp | | submgr | | e2term | |
| 4143 | // +-------+ +---------+ +---------+ |
| 4144 | // | | | |
| 4145 | // | [SUBS CREATE] | |
| 4146 | // | | | |
| 4147 | // | | | |
| 4148 | // | RESTSubDelReq | | |
| 4149 | // |---------------->| | |
| 4150 | // | | | |
| 4151 | // | RESTSubDelResp | | |
| 4152 | // |<----------------| | |
| 4153 | // | | SubDelReq | |
| 4154 | // | |------------->| |
| 4155 | // | | | |
| 4156 | // | | SubDelFail | |
| 4157 | // | |<-------------| |
| 4158 | // | | | |
| 4159 | // |
| 4160 | //----------------------------------------------------------------------------- |
| 4161 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 4162 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 4163 | |
| 4164 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4165 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4166 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4167 | Counter{cSubReqToE2, 1}, |
| 4168 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4169 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4170 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4171 | Counter{cSubDelReqToE2, 1}, |
| 4172 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4173 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4174 | }) |
| 4175 | |
| 4176 | // Req |
| 4177 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4178 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4179 | |
| 4180 | // Del |
| 4181 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4182 | |
| 4183 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4184 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4185 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4186 | |
| 4187 | //Wait that subs is cleaned |
| 4188 | waitSubsCleanup(t, e2SubsId, 10) |
| 4189 | |
| 4190 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4191 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4192 | } |
| 4193 | |
| 4194 | //----------------------------------------------------------------------------- |
| 4195 | // TestRESTSubReqAndSubDelOkSameAction |
| 4196 | // |
| 4197 | // stub stub |
| 4198 | // +-------+ +-------+ +---------+ +---------+ |
| 4199 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4200 | // +-------+ +-------+ +---------+ +---------+ |
| 4201 | // | | | | |
| 4202 | // | | RESTSubReq1 | | |
| 4203 | // | |---------------->| | |
| 4204 | // | | | | |
| 4205 | // | | RESTSubResp1 | | |
| 4206 | // | |<----------------| | |
| 4207 | // | | | | |
| 4208 | // | | | SubReq1 | |
| 4209 | // | | |------------->| |
| 4210 | // | | | SubResp1 | |
| 4211 | // | | |<-------------| |
| 4212 | // | | RESTNotif1 | | |
| 4213 | // | |<----------------| | |
| 4214 | // | | | | |
| 4215 | // | RESTSubReq2 | | |
| 4216 | // |------------------------------>| | |
| 4217 | // | | | | |
| 4218 | // | RESTSubResp2 | | |
| 4219 | // |<------------------------------| | |
| 4220 | // | | | | |
| 4221 | // | | RESTNotif2 | | |
| 4222 | // |<------------------------------| | |
| 4223 | // | | | | |
| 4224 | // | | RESTSubDelReq1 | | |
| 4225 | // | |---------------->| | |
| 4226 | // | | | | |
| 4227 | // | | RESTSubDelResp1 | | |
| 4228 | // | |<----------------| | |
| 4229 | // | | | | |
| 4230 | // | RESTSubDelReq2 | | |
| 4231 | // |------------------------------>| | |
| 4232 | // | | | | |
| 4233 | // | RESTSubDelResp2 | | |
| 4234 | // |<------------------------------| | |
| 4235 | // | | | | |
| 4236 | // | | | SubDelReq2 | |
| 4237 | // | | |------------->| |
| 4238 | // | | | | |
| 4239 | // | | | SubDelResp2 | |
| 4240 | // | | |<-------------| |
| 4241 | // | | | | |
| 4242 | // |
| 4243 | //----------------------------------------------------------------------------- |
| 4244 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 4245 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 4246 | |
| 4247 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4248 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4249 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4250 | Counter{cSubReqToE2, 1}, |
| 4251 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4252 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4253 | Counter{cMergedSubscriptions, 1}, |
| 4254 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4255 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4256 | Counter{cSubDelReqToE2, 1}, |
| 4257 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4258 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4259 | }) |
| 4260 | |
| 4261 | // Req1 |
| 4262 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4263 | |
| 4264 | //Subs Create |
| 4265 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4266 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4267 | |
| 4268 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4269 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4270 | params.SetMeid("RAN_NAME_1") |
| 4271 | |
| 4272 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4273 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4274 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4275 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4276 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4277 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4278 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4279 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4280 | |
| 4281 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4282 | |
| 4283 | // Del1 |
| 4284 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4285 | |
| 4286 | // Del2 |
| 4287 | deleteXapp2Subscription(t, &restSubId2) |
| 4288 | |
| 4289 | //Wait that subs is cleaned |
| 4290 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4291 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4292 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4293 | } |
| 4294 | |
| 4295 | //----------------------------------------------------------------------------- |
| 4296 | // TestSubReqAndSubDelOkSameActionParallel |
| 4297 | // |
| 4298 | // stub stub stub |
| 4299 | // +-------+ +-------+ +---------+ +---------+ |
| 4300 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4301 | // +-------+ +-------+ +---------+ +---------+ |
| 4302 | // | | | | |
| 4303 | // | | | | |
| 4304 | // | | | | |
| 4305 | // | | SubReq1 | | |
| 4306 | // | |------------->| | |
| 4307 | // | | | | |
| 4308 | // | | | SubReq1 | |
| 4309 | // | | |------------->| |
| 4310 | // | SubReq2 | | |
| 4311 | // |--------------------------->| | |
| 4312 | // | | | SubResp1 | |
| 4313 | // | | |<-------------| |
| 4314 | // | | SubResp1 | | |
| 4315 | // | |<-------------| | |
| 4316 | // | | | SubReq2 | |
| 4317 | // | | |------------->| |
| 4318 | // | | | | |
| 4319 | // | | | SubResp2 | |
| 4320 | // | | |<-------------| |
| 4321 | // | SubResp2 | | |
| 4322 | // |<---------------------------| | |
| 4323 | // | | | | |
| 4324 | // | | SubDelReq 1 | | |
| 4325 | // | |------------->| | |
| 4326 | // | | | | |
| 4327 | // | | SubDelResp 1 | | |
| 4328 | // | |<-------------| | |
| 4329 | // | | | | |
| 4330 | // | SubDelReq 2 | | |
| 4331 | // |--------------------------->| | |
| 4332 | // | | | | |
| 4333 | // | | | SubDelReq 2 | |
| 4334 | // | | |------------->| |
| 4335 | // | | | | |
| 4336 | // | | | SubDelReq 2 | |
| 4337 | // | | |------------->| |
| 4338 | // | | | | |
| 4339 | // | SubDelResp 2 | | |
| 4340 | // |<---------------------------| | |
| 4341 | // |
| 4342 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4343 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4344 | |
| 4345 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4346 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4347 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4348 | Counter{cSubReqToE2, 2}, |
| 4349 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4350 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4351 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4352 | Counter{cSubDelReqToE2, 2}, |
| 4353 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4354 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4355 | }) |
| 4356 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4357 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4358 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4359 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4360 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4361 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4362 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4363 | |
| 4364 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4365 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4366 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4367 | |
| 4368 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4369 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4370 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4371 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4372 | |
| 4373 | // Del1 |
| 4374 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4375 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4376 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4377 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4378 | |
| 4379 | // Del2 |
| 4380 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4381 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4382 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4383 | |
| 4384 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4385 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4386 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4387 | } |
| 4388 | |
| 4389 | //----------------------------------------------------------------------------- |
| 4390 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4391 | // |
| 4392 | // stub stub stub |
| 4393 | // +-------+ +-------+ +---------+ +---------+ |
| 4394 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4395 | // +-------+ +-------+ +---------+ +---------+ |
| 4396 | // | | | | |
| 4397 | // | | | | |
| 4398 | // | | | | |
| 4399 | // | | RESTSubReq1 | | |
| 4400 | // | |---------------->| | |
| 4401 | // | | | | |
| 4402 | // | | RESTSubResp1 | | |
| 4403 | // | |<----------------| | |
| 4404 | // | | | SubReq1 | |
| 4405 | // | | |------------->| |
| 4406 | // | RESTSubReq2 | | |
| 4407 | // |------------------------------>| | |
| 4408 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4409 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4410 | // |<------------------------------| | |
| 4411 | // | | | SubReq1 | |
| 4412 | // | | |------------->| |
| 4413 | // | | | | |
| 4414 | // | | | | |
| 4415 | // | | | SubDelReq | |
| 4416 | // | | |------------->| |
| 4417 | // | | | | |
| 4418 | // | | | SubDelResp | |
| 4419 | // | | |<-------------| |
| 4420 | // | | RESTNotif1 | | |
| 4421 | // | | unsuccess | | |
| 4422 | // | |<----------------| | |
| 4423 | // | RESTNotif2 | | |
| 4424 | // | | unsuccess | | |
| 4425 | // |<------------------------------| | |
| 4426 | // | | | | |
| 4427 | // | | RESTSubDelReq1 | | |
| 4428 | // | |---------------->| | |
| 4429 | // | | | | |
| 4430 | // | | RESTSubDelResp1 | | |
| 4431 | // | |<----------------| | |
| 4432 | // | | | | |
| 4433 | // | RESTSubDelReq2 | | |
| 4434 | // |------------------------------>| | |
| 4435 | // | | | | |
| 4436 | // | RESTSubDelResp2 | | |
| 4437 | // |<------------------------------| | |
| 4438 | // |
| 4439 | //----------------------------------------------------------------------------- |
| 4440 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4441 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4442 | |
| 4443 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4444 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4445 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4446 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4447 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4448 | Counter{cSubReqTimerExpiry, 2}, |
| 4449 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4450 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4451 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4452 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4453 | Counter{cSubDelReqToE2, 1}, |
| 4454 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4455 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4456 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4457 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | |
| 4459 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4460 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4461 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4462 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4463 | |
| 4464 | // Req2 |
| 4465 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4466 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | params2.SetMeid("RAN_NAME_1") |
| 4468 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4469 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4470 | |
| 4471 | //Req1 (retransmitted) |
| 4472 | e2termConn1.RecvSubsReq(t) |
| 4473 | |
| 4474 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4475 | |
| 4476 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4477 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4478 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4479 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4480 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4481 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4482 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4483 | |
| 4484 | // Del1 |
| 4485 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4486 | |
| 4487 | // Del2 |
| 4488 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4489 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4490 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4491 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4492 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4493 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4494 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4495 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4496 | } |
| 4497 | |
| 4498 | //----------------------------------------------------------------------------- |
| 4499 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4500 | // |
| 4501 | // stub stub stub |
| 4502 | // +-------+ +-------+ +---------+ +---------+ |
| 4503 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4504 | // +-------+ +-------+ +---------+ +---------+ |
| 4505 | // | | | | |
| 4506 | // | | | | |
| 4507 | // | | | | |
| 4508 | // | | RESTSubReq1 | | |
| 4509 | // | |---------------->| | |
| 4510 | // | | | | |
| 4511 | // | | RESTSubResp1 | | |
| 4512 | // | |<----------------| | |
| 4513 | // | | | SubReq1 | |
| 4514 | // | | |------------->| |
| 4515 | // | RESTSubReq2 | | |
| 4516 | // |------------------------------>| | |
| 4517 | // | | | | |
| 4518 | // | RESTSubDelResp2 | | |
| 4519 | // |<------------------------------| | |
| 4520 | // | | | SubFail1 | |
| 4521 | // | | |<-------------| |
| 4522 | // | | | | |
| 4523 | // | | RESTNotif1 | | |
| 4524 | // | | unsuccess | | |
| 4525 | // | |<----------------| | |
| 4526 | // | RESTNotif2 | | |
| 4527 | // | | unsuccess | | |
| 4528 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4529 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4530 | // | | 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] | 4531 | // | |---------------->| | |
| 4532 | // | | | | |
| 4533 | // | | RESTSubDelResp1 | | |
| 4534 | // | |<----------------| | |
| 4535 | // | | | | |
| 4536 | // | RESTSubDelReq2 | | |
| 4537 | // |------------------------------>| | |
| 4538 | // | | | | |
| 4539 | // | RESTSubDelResp2 | | |
| 4540 | // |<------------------------------| | |
| 4541 | // |
| 4542 | //----------------------------------------------------------------------------- |
| 4543 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4544 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4545 | |
| 4546 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4547 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4548 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4549 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4550 | Counter{cSubReqToE2, 1}, |
| 4551 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4552 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4553 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4554 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4555 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4556 | }) |
| 4557 | |
| 4558 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | |
| 4560 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4561 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4563 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4564 | |
| 4565 | // Req2 |
| 4566 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4567 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4568 | params2.SetMeid("RAN_NAME_1") |
| 4569 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4570 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4571 | |
| 4572 | // E2t: send SubsFail (first) |
| 4573 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4574 | fparams1.Set(crereq1) |
| 4575 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4576 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4577 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4578 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4579 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4580 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4581 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4582 | |
| 4583 | // Del1 |
| 4584 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4585 | |
| 4586 | // Del2 |
| 4587 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4588 | |
| 4589 | //Wait that subs is cleaned |
| 4590 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4591 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4592 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4593 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4594 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 4595 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4596 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4597 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4598 | |
| 4599 | // Init counter check |
| 4600 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4601 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4602 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4603 | Counter{cSubReqToE2, 1}, |
| 4604 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4605 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4606 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4607 | Counter{cSubDelReqToE2, 1}, |
| 4608 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4609 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4610 | }) |
| 4611 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4612 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4613 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4614 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4615 | |
| 4616 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4617 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4618 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4619 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4620 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4621 | |
| 4622 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4623 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4624 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4625 | |
| 4626 | // Wait that subs is cleaned |
| 4627 | waitSubsCleanup(t, e2SubsId, 10) |
| 4628 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4629 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4630 | } |
| 4631 | |
| 4632 | //----------------------------------------------------------------------------- |
| 4633 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4634 | // |
| 4635 | // stub stub |
| 4636 | // +-------+ +---------+ +---------+ |
| 4637 | // | xapp | | submgr | | e2term | |
| 4638 | // +-------+ +---------+ +---------+ |
| 4639 | // | | | |
| 4640 | // | RESTSubReq | | |
| 4641 | // |---------------->| | |
| 4642 | // | | | |
| 4643 | // | RESTSubResp | | |
| 4644 | // |<----------------| | |
| 4645 | // | | SubReq | |
| 4646 | // | |------------->| |
| 4647 | // | | | |
| 4648 | // | | SubResp | |
| 4649 | // | |<-------------| |
| 4650 | // | | | |
| 4651 | // | RESTNotif | | |
| 4652 | // |<----------------| | |
| 4653 | // | | | |
| 4654 | // | RESTSubReq | | |
| 4655 | // |---------------->| | |
| 4656 | // | | | |
| 4657 | // | RESTSubResp | | |
| 4658 | // |<----------------| | |
| 4659 | // | | SubReq | |
| 4660 | // | |------------->| |
| 4661 | // | | | |
| 4662 | // | | SubResp | |
| 4663 | // | |<-------------| |
| 4664 | // | | | |
| 4665 | // | RESTNotif | | |
| 4666 | // |<----------------| | |
| 4667 | // | | | |
| 4668 | // | RESTSubDelReq | | |
| 4669 | // |---------------->| | |
| 4670 | // | | | |
| 4671 | // | | SubDelReq | |
| 4672 | // | |------------->| |
| 4673 | // | | | |
| 4674 | // | | SubDelResp | |
| 4675 | // | |<-------------| |
| 4676 | // | | | |
| 4677 | // | RESTSubDelResp | | |
| 4678 | // |<----------------| | |
| 4679 | // |
| 4680 | //----------------------------------------------------------------------------- |
| 4681 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4682 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4683 | |
| 4684 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4685 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4686 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4687 | Counter{cSubReqToE2, 2}, |
| 4688 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4689 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4690 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4691 | Counter{cSubDelReqToE2, 1}, |
| 4692 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4693 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4694 | }) |
| 4695 | |
| 4696 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4697 | const e2Timeout int64 = 1 |
| 4698 | const e2RetryCount int64 = 0 |
| 4699 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4700 | |
| 4701 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4702 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4703 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4704 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4705 | |
| 4706 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4707 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4708 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4709 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4710 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4711 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4712 | params.SetTimeToWait("w200ms") |
| 4713 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4714 | |
| 4715 | // Del |
| 4716 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4717 | |
| 4718 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4719 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4720 | |
| 4721 | // Wait that subs is cleaned |
| 4722 | waitSubsCleanup(t, e2SubsId, 10) |
| 4723 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4724 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4725 | } |
| 4726 | |
| 4727 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4728 | // TestRESTSubReqPolicyChangeNOk |
| 4729 | // |
| 4730 | // stub stub |
| 4731 | // +-------+ +---------+ +---------+ |
| 4732 | // | xapp | | submgr | | e2term | |
| 4733 | // +-------+ +---------+ +---------+ |
| 4734 | // | | | |
| 4735 | // | RESTSubReq | | |
| 4736 | // |---------------->| | |
| 4737 | // | | | |
| 4738 | // | RESTSubResp | | |
| 4739 | // |<----------------| | |
| 4740 | // | | SubReq | |
| 4741 | // | |------------->| |
| 4742 | // | | | |
| 4743 | // | | SubResp | |
| 4744 | // | |<-------------| |
| 4745 | // | | | |
| 4746 | // | RESTNotif | | |
| 4747 | // |<----------------| | |
| 4748 | // | | | |
| 4749 | // | RESTSubReq | | |
| 4750 | // |---------------->| | |
| 4751 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4752 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4753 | // | | | |
| 4754 | // | RESTSubDelReq | | |
| 4755 | // |---------------->| | |
| 4756 | // | | | |
| 4757 | // | | SubDelReq | |
| 4758 | // | |------------->| |
| 4759 | // | | | |
| 4760 | // | | SubDelResp | |
| 4761 | // | |<-------------| |
| 4762 | // | | | |
| 4763 | // | RESTSubDelResp | | |
| 4764 | // |<----------------| | |
| 4765 | // |
| 4766 | //----------------------------------------------------------------------------- |
| 4767 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4768 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4769 | |
| 4770 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4771 | Counter{cRestSubReqFromXapp, 2}, |
| 4772 | Counter{cRestSubRespToXapp, 1}, |
| 4773 | Counter{cSubReqToE2, 1}, |
| 4774 | Counter{cSubRespFromE2, 1}, |
| 4775 | Counter{cRestSubNotifToXapp, 1}, |
| 4776 | Counter{cRestSubFailToXapp, 1}, |
| 4777 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4778 | Counter{cSubDelReqToE2, 1}, |
| 4779 | Counter{cSubDelRespFromE2, 1}, |
| 4780 | Counter{cRestSubDelRespToXapp, 1}, |
| 4781 | }) |
| 4782 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4783 | // Req |
| 4784 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4785 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4786 | |
| 4787 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4788 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4789 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4790 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4791 | params.SetSubscriptionID(&restSubIdUpd) |
| 4792 | params.SetTimeToWait("w200ms") |
| 4793 | |
| 4794 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4795 | assert.Equal(t, restSubId2, "") |
| 4796 | |
| 4797 | // Del |
| 4798 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4799 | |
| 4800 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4801 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4802 | |
| 4803 | // Wait that subs is cleaned |
| 4804 | waitSubsCleanup(t, e2SubsId, 10) |
| 4805 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4806 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4807 | } |
| 4808 | |
| 4809 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4810 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4811 | // |
| 4812 | // stub stub stub |
| 4813 | // +-------+ +---------+ +---------+ +---------+ |
| 4814 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4815 | // +-------+ +---------+ +---------+ +---------+ |
| 4816 | // | | | | |
| 4817 | // | | | | |
| 4818 | // | | | | |
| 4819 | // | RESTSubReq1 | | | |
| 4820 | // |---------------->| | | |
| 4821 | // | | | | |
| 4822 | // | RESTSubResp1 | | | |
| 4823 | // |<----------------| | | |
| 4824 | // | | SubReq1 | | |
| 4825 | // | |------------->| | |
| 4826 | // | | | | |
| 4827 | // | RESTSubReq2 | | | |
| 4828 | // |---------------->| | | |
| 4829 | // | | | | |
| 4830 | // | RESTSubResp2 | | | |
| 4831 | // |<----------------| | | |
| 4832 | // | | SubReq2 | | |
| 4833 | // | |---------------------------->| |
| 4834 | // | | | | |
| 4835 | // | | SubResp1 | | |
| 4836 | // | |<-------------| | |
| 4837 | // | RESTNotif1 | | | |
| 4838 | // |<----------------| | | |
| 4839 | // | | SubResp2 | | |
| 4840 | // | |<----------------------------| |
| 4841 | // | RESTNotif2 | | | |
| 4842 | // |<----------------| | | |
| 4843 | // | | | | |
| 4844 | // | [SUBS 1 DELETE] | | |
| 4845 | // | | | | |
| 4846 | // | [SUBS 2 DELETE] | | |
| 4847 | // | | | | |
| 4848 | // |
| 4849 | //----------------------------------------------------------------------------- |
| 4850 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4851 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4852 | |
| 4853 | // Init counter check |
| 4854 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4855 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4856 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4857 | Counter{cSubReqToE2, 2}, |
| 4858 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4859 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4860 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4861 | Counter{cSubDelReqToE2, 2}, |
| 4862 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4863 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4864 | }) |
| 4865 | |
| 4866 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4867 | |
| 4868 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4869 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4870 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4871 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4872 | |
| 4873 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4874 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4875 | params.SetMeid("RAN_NAME_11") |
| 4876 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4877 | // would not work as notification would not be received |
| 4878 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4879 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4880 | |
| 4881 | // Resp1 |
| 4882 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4883 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4884 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4885 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4886 | |
| 4887 | // Resp2 |
| 4888 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4889 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4890 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4891 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4892 | |
| 4893 | // Delete1 |
| 4894 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4895 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4896 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4897 | |
| 4898 | // Wait that subs is cleaned |
| 4899 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4900 | |
| 4901 | // Delete2 |
| 4902 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4903 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4904 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4905 | |
| 4906 | // Wait that subs is cleaned |
| 4907 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4908 | |
| 4909 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4910 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4911 | } |
| 4912 | |
| 4913 | //----------------------------------------------------------------------------- |
| 4914 | // TestRESTSubReqAsn1EncodeFail |
| 4915 | // |
| 4916 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4917 | // stub stub |
| 4918 | // +-------+ +---------+ +---------+ |
| 4919 | // | xapp | | submgr | | e2term | |
| 4920 | // +-------+ +---------+ +---------+ |
| 4921 | // | | | |
| 4922 | // | RESTSubReq | | |
| 4923 | // |---------------->| | |
| 4924 | // | | | |
| 4925 | // | RESTSubResp | | |
| 4926 | // |<----------------| | |
| 4927 | // | RESTSubDelReq | | |
| 4928 | // |---------------->| | |
| 4929 | // | RESTSubDelResp | | |
| 4930 | // | unsuccess | | |
| 4931 | // |<----------------| | |
| 4932 | // | | | |
| 4933 | // |
| 4934 | //----------------------------------------------------------------------------- |
| 4935 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4936 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4937 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4938 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4939 | |
| 4940 | } |
| 4941 | |
| 4942 | //----------------------------------------------------------------------------- |
| 4943 | // TestRESTSubReqInsertAndSubDelOk |
| 4944 | // |
| 4945 | // stub stub |
| 4946 | // +-------+ +---------+ +---------+ |
| 4947 | // | xapp | | submgr | | e2term | |
| 4948 | // +-------+ +---------+ +---------+ |
| 4949 | // | | | |
| 4950 | // | RestSubReq | | |
| 4951 | // |---------------->| | |
| 4952 | // | | | |
| 4953 | // | RESTSubResp | | |
| 4954 | // |<----------------| | |
| 4955 | // | | | |
| 4956 | // | | SubReq | |
| 4957 | // | |------------->| |
| 4958 | // | | | |
| 4959 | // | | SubResp | |
| 4960 | // | |<-------------| |
| 4961 | // | RESTNotif | | |
| 4962 | // |<----------------| | |
| 4963 | // | ... | ... | |
| 4964 | // | | | |
| 4965 | // | RESTSubDelReq | | |
| 4966 | // |---------------->| | |
| 4967 | // | | | |
| 4968 | // | | SubDelReq | |
| 4969 | // | |------------->| |
| 4970 | // | | | |
| 4971 | // | | SubDelResp | |
| 4972 | // | |<-------------| |
| 4973 | // | | | |
| 4974 | // | RESTSubDelResp| | |
| 4975 | // |<----------------| | |
| 4976 | // |
| 4977 | //----------------------------------------------------------------------------- |
| 4978 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4979 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4980 | |
| 4981 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4982 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4983 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4984 | Counter{cSubReqToE2, 1}, |
| 4985 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4986 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4987 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4988 | Counter{cSubDelReqToE2, 1}, |
| 4989 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4990 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4991 | }) |
| 4992 | |
| 4993 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4994 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4995 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4996 | params.SetSubActionTypes("insert") |
| 4997 | |
| 4998 | // Req |
| 4999 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5000 | |
| 5001 | // Del |
| 5002 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5003 | |
| 5004 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5005 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5006 | |
| 5007 | // Wait that subs is cleaned |
| 5008 | waitSubsCleanup(t, e2SubsId, 10) |
| 5009 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5010 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5011 | } |
| 5012 | |
| 5013 | //----------------------------------------------------------------------------- |
| 5014 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5015 | // |
| 5016 | // stub stub |
| 5017 | // +-------+ +---------+ +---------+ |
| 5018 | // | xapp | | submgr | | e2term | |
| 5019 | // +-------+ +---------+ +---------+ |
| 5020 | // | | | |
| 5021 | // | RESTSubReq | | |
| 5022 | // |------------->| | |
| 5023 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5024 | // | RESTSubResp | | |
| 5025 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5026 | // | | SubReq | |
| 5027 | // | |------------->| |
| 5028 | // | | | |
| 5029 | // | | SubResp | |
| 5030 | // | <----| |
| 5031 | // | | |
| 5032 | // | Submgr restart | |
| 5033 | // | | |
| 5034 | // | | | |
| 5035 | // | | SubDelReq | |
| 5036 | // | |------------->| |
| 5037 | // | | | |
| 5038 | // | | SubDelResp | |
| 5039 | // | |<-------------| |
| 5040 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5041 | // | RESTNotif | | |
| 5042 | // | unsuccess | | |
| 5043 | // |<-------------| | |
| 5044 | // | | | |
| 5045 | // | RESTSubDelReq| | |
| 5046 | // |------------->| | |
| 5047 | // | | | |
| 5048 | // |RESTSubDelResp| | |
| 5049 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5050 | // |
| 5051 | //----------------------------------------------------------------------------- |
| 5052 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5053 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 5054 | |
| 5055 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5056 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5057 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5058 | Counter{cSubReqToE2, 1}, |
| 5059 | Counter{cSubDelReqFromXapp, 1}, |
| 5060 | Counter{cSubDelReqToE2, 1}, |
| 5061 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5062 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5063 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5064 | }) |
| 5065 | |
| 5066 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5067 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5068 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5069 | |
| 5070 | //Req |
| 5071 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5072 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5073 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5074 | |
| 5075 | e2termConn1.RecvSubsReq(t) |
| 5076 | |
| 5077 | mainCtrl.SetResetTestFlag(t, false) |
| 5078 | |
| 5079 | mainCtrl.SimulateRestart(t) |
| 5080 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5081 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5082 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5083 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5084 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5085 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5086 | //Del |
| 5087 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5088 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5089 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5090 | e2termConn1.TestMsgChanEmpty(t) |
| 5091 | mainCtrl.wait_registry_empty(t, 10) |
| 5092 | |
| 5093 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5094 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5095 | } |
| 5096 | |
| 5097 | //----------------------------------------------------------------------------- |
| 5098 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5099 | // |
| 5100 | // stub stub |
| 5101 | // +-------+ +---------+ +---------+ |
| 5102 | // | xapp | | submgr | | e2term | |
| 5103 | // +-------+ +---------+ +---------+ |
| 5104 | // | | | |
| 5105 | // | RESTSubReq | | |
| 5106 | // |---------------->| | |
| 5107 | // | | | |
| 5108 | // | RESTSubResp | | |
| 5109 | // |<----------------| | |
| 5110 | // | | SubReq | |
| 5111 | // | |------------->| |
| 5112 | // | | | |
| 5113 | // | | SubResp | |
| 5114 | // | |<-------------| |
| 5115 | // | | | |
| 5116 | // | RESTNotif | | |
| 5117 | // |<----------------| | |
| 5118 | // | | | |
| 5119 | // | | |
| 5120 | // | Submgr restart | |
| 5121 | // | | | |
| 5122 | // | RESTSubDelReq | | |
| 5123 | // |---------------->| | |
| 5124 | // | | | |
| 5125 | // | | SubDelReq | |
| 5126 | // | |------------->| |
| 5127 | // | | | |
| 5128 | // | | SubDelResp | |
| 5129 | // | |<-------------| |
| 5130 | // | | | |
| 5131 | // | RESTSubDelResp | | |
| 5132 | // |<----------------| | |
| 5133 | // |
| 5134 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5135 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 5137 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 5138 | |
| 5139 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5140 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5141 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5142 | Counter{cSubReqToE2, 1}, |
| 5143 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5144 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5145 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5146 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5147 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5148 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5149 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5150 | |
| 5151 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5152 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5153 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5154 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5155 | |
| 5156 | // Check subscription |
| 5157 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5158 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5159 | mainCtrl.SimulateRestart(t) |
| 5160 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5161 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5162 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5163 | // That needs to be completed before successful subscription query is possible |
| 5164 | <-time.After(time.Second * 1) |
| 5165 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5166 | // Check subscription |
| 5167 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5168 | |
| 5169 | // Delete subscription |
| 5170 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5171 | |
| 5172 | //Wait that subs is cleaned |
| 5173 | waitSubsCleanup(t, e2SubsId, 10) |
| 5174 | |
| 5175 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5176 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5177 | } |
| 5178 | |
| 5179 | //----------------------------------------------------------------------------- |
| 5180 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5181 | // |
| 5182 | // stub stub |
| 5183 | // +-------+ +-------+ +---------+ +---------+ |
| 5184 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5185 | // +-------+ +-------+ +---------+ +---------+ |
| 5186 | // | | | | |
| 5187 | // | | RESTSubReq1 | | |
| 5188 | // | |---------------->| | |
| 5189 | // | | | | |
| 5190 | // | | RESTSubResp1 | | |
| 5191 | // | |<----------------| | |
| 5192 | // | | | | |
| 5193 | // | | | SubReq1 | |
| 5194 | // | | |------------->| |
| 5195 | // | | | SubResp1 | |
| 5196 | // | | |<-------------| |
| 5197 | // | | RESTNotif1 | | |
| 5198 | // | |<----------------| | |
| 5199 | // | | | | |
| 5200 | // | RESTSubReq2 | | |
| 5201 | // |------------------------------>| | |
| 5202 | // | | | | |
| 5203 | // | RESTSubResp2 | | |
| 5204 | // |<------------------------------| | |
| 5205 | // | | | | |
| 5206 | // | | RESTNotif2 | | |
| 5207 | // |<------------------------------| | |
| 5208 | // | | | | |
| 5209 | // | | Submgr restart | |
| 5210 | // | | | | |
| 5211 | // | | RESTSubDelReq1 | | |
| 5212 | // | |---------------->| | |
| 5213 | // | | | | |
| 5214 | // | | RESTSubDelResp1 | | |
| 5215 | // | |<----------------| | |
| 5216 | // | | | | |
| 5217 | // | | Submgr restart | |
| 5218 | // | | | | |
| 5219 | // | RESTSubDelReq2 | | |
| 5220 | // |------------------------------>| | |
| 5221 | // | | | | |
| 5222 | // | RESTSubDelResp2 | | |
| 5223 | // |<------------------------------| | |
| 5224 | // | | | | |
| 5225 | // | | | SubDelReq2 | |
| 5226 | // | | |------------->| |
| 5227 | // | | | | |
| 5228 | // | | | SubDelResp2 | |
| 5229 | // | | |<-------------| |
| 5230 | // | | | | |
| 5231 | // |
| 5232 | //----------------------------------------------------------------------------- |
| 5233 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 5234 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 5235 | |
| 5236 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5237 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5238 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | Counter{cSubReqToE2, 1}, |
| 5240 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5241 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5242 | Counter{cMergedSubscriptions, 1}, |
| 5243 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5244 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5245 | Counter{cSubDelReqToE2, 1}, |
| 5246 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5247 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5248 | }) |
| 5249 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5250 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5251 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5252 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5253 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5254 | |
| 5255 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5256 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5257 | params.SetMeid("RAN_NAME_1") |
| 5258 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5259 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5260 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5261 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5262 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5263 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5264 | |
| 5265 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5266 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5267 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5268 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5269 | |
| 5270 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5271 | // That needs to be completed before successful subscription delete is possible |
| 5272 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5273 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5274 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5275 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 5276 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5277 | // Above wait does not work correctly anymore as this delay makes this test case work |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5278 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5279 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5280 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5281 | |
| 5282 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5283 | // That needs to be completed before successful subscription query is possible |
| 5284 | <-time.After(time.Second * 1) |
| 5285 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5286 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5287 | |
| 5288 | // Delete subscription 2 |
| 5289 | deleteXapp2Subscription(t, &restSubId2) |
| 5290 | |
| 5291 | //Wait that subs is cleaned |
| 5292 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5293 | |
| 5294 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5295 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5296 | } |
| 5297 | |
| 5298 | //----------------------------------------------------------------------------- |
| 5299 | // TestRESTReportSubReqAndSubDelOk |
| 5300 | // |
| 5301 | // stub stub |
| 5302 | // +-------+ +---------+ +---------+ |
| 5303 | // | xapp | | submgr | | e2term | |
| 5304 | // +-------+ +---------+ +---------+ |
| 5305 | // | | | |
| 5306 | // | RestSubReq | | |
| 5307 | // |---------------->| | |
| 5308 | // | | | |
| 5309 | // | RESTSubResp | | |
| 5310 | // |<----------------| | |
| 5311 | // | | | |
| 5312 | // | | SubReq | |
| 5313 | // | |------------->| |
| 5314 | // | | | |
| 5315 | // | | SubResp | |
| 5316 | // | |<-------------| |
| 5317 | // | RESTNotif | | |
| 5318 | // |<----------------| | |
| 5319 | // | | SubReq | |
| 5320 | // | |------------->| |
| 5321 | // | | | |
| 5322 | // | | SubResp | |
| 5323 | // | |<-------------| |
| 5324 | // | RESTNotif | | |
| 5325 | // |<----------------| | |
| 5326 | // | ... | ... | |
| 5327 | // | | | |
| 5328 | // | | | |
| 5329 | // | RESTSubDelReq | | |
| 5330 | // |---------------->| | |
| 5331 | // | | | |
| 5332 | // | | SubDelReq | |
| 5333 | // | |------------->| |
| 5334 | // | | | |
| 5335 | // | | SubDelResp | |
| 5336 | // | |<-------------| |
| 5337 | // | | | |
| 5338 | // | RESTSubDelResp| | |
| 5339 | // |<----------------| | |
| 5340 | // |
| 5341 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5342 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5343 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5344 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5345 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5346 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5347 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5348 | } |
| 5349 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5350 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5351 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5352 | |
| 5353 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5354 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5355 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5356 | |
| 5357 | var e2SubsId []uint32 |
| 5358 | for i := 0; i < subReqCount; i++ { |
| 5359 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5360 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5361 | |
| 5362 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5363 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5364 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5365 | e2SubsId = append(e2SubsId, instanceId) |
| 5366 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5367 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5368 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5369 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5370 | |
| 5371 | } |
| 5372 | |
| 5373 | // Del |
| 5374 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5375 | |
| 5376 | for i := 0; i < subReqCount; i++ { |
| 5377 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5378 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5379 | } |
| 5380 | |
| 5381 | // Wait that subs is cleaned |
| 5382 | for i := 0; i < subReqCount; i++ { |
| 5383 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5384 | } |
| 5385 | |
| 5386 | xappConn1.TestMsgChanEmpty(t) |
| 5387 | e2termConn1.TestMsgChanEmpty(t) |
| 5388 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5389 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5390 | } |
| 5391 | |
| 5392 | /* |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5393 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { was in comments already |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5394 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5395 | |
| 5396 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | testIndex := 1 |
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 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5401 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5402 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5403 | } |
| 5404 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5405 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5406 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5407 | |
| 5408 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5409 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5410 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5411 | |
| 5412 | var e2SubsId []uint32 |
| 5413 | for i := 0; i < subReqCount; i++ { |
| 5414 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5415 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5416 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5417 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5418 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5419 | e2SubsId = append(e2SubsId, instanceId) |
| 5420 | } |
| 5421 | |
| 5422 | // Del |
| 5423 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5424 | |
| 5425 | for i := 0; i < subReqCount; i++ { |
| 5426 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5427 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5428 | } |
| 5429 | |
| 5430 | // Wait that subs is cleaned |
| 5431 | for i := 0; i < subReqCount; i++ { |
| 5432 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5433 | } |
| 5434 | xappConn1.TestMsgChanEmpty(t) |
| 5435 | e2termConn1.TestMsgChanEmpty(t) |
| 5436 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5437 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5438 | } |
| 5439 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5440 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5441 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5442 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5443 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5444 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5445 | Counter{cSubReqToE2, 2}, |
| 5446 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5447 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5448 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5449 | Counter{cSubDelReqToE2, 2}, |
| 5450 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5451 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5452 | }) |
| 5453 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5454 | const subReqCount int = 2 |
| 5455 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5456 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5457 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5458 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5459 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5460 | |
| 5461 | assert.Equal(t, len(e2SubsIds), 2) |
| 5462 | |
| 5463 | // Del |
| 5464 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5465 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5466 | |
| 5467 | xappConn1.TestMsgChanEmpty(t) |
| 5468 | e2termConn1.TestMsgChanEmpty(t) |
| 5469 | mainCtrl.wait_registry_empty(t, 10) |
| 5470 | |
| 5471 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5472 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5473 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5474 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5475 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5476 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5477 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5478 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5479 | Counter{cSubReqToE2, 19}, |
| 5480 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5481 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5482 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5483 | Counter{cSubDelReqToE2, 19}, |
| 5484 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5485 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5486 | }) |
| 5487 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5488 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5489 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5490 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5491 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5492 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5493 | |
| 5494 | assert.Equal(t, len(e2SubsIds), 19) |
| 5495 | |
| 5496 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5497 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5498 | |
| 5499 | xappConn1.TestMsgChanEmpty(t) |
| 5500 | e2termConn1.TestMsgChanEmpty(t) |
| 5501 | mainCtrl.wait_registry_empty(t, 10) |
| 5502 | |
| 5503 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5504 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5505 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5506 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5507 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5508 | |
| 5509 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5510 | |
| 5511 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5512 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5513 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5514 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5515 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5516 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5517 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5518 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5519 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5520 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5521 | }) |
| 5522 | |
| 5523 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5524 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5525 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5526 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5527 | |
| 5528 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5529 | |
| 5530 | // Del |
| 5531 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5532 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5533 | |
| 5534 | xappConn1.TestMsgChanEmpty(t) |
| 5535 | e2termConn1.TestMsgChanEmpty(t) |
| 5536 | mainCtrl.wait_registry_empty(t, 10) |
| 5537 | |
| 5538 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5539 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5540 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5541 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5542 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5543 | |
| 5544 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5545 | |
| 5546 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5547 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5548 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5549 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5550 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5551 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5552 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5553 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5554 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5555 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5556 | }) |
| 5557 | |
| 5558 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5559 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5560 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5561 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5562 | |
| 5563 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5564 | |
| 5565 | // Del |
| 5566 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5567 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5568 | |
| 5569 | xappConn1.TestMsgChanEmpty(t) |
| 5570 | e2termConn1.TestMsgChanEmpty(t) |
| 5571 | mainCtrl.wait_registry_empty(t, 10) |
| 5572 | |
| 5573 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5574 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5575 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5576 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5577 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5578 | |
| 5579 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5580 | |
| 5581 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5582 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5583 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5584 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5585 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5586 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5587 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5588 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5589 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5590 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5591 | }) |
| 5592 | |
| 5593 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5594 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5595 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5596 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5597 | |
| 5598 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5599 | |
| 5600 | // Del |
| 5601 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5602 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5603 | |
| 5604 | xappConn1.TestMsgChanEmpty(t) |
| 5605 | e2termConn1.TestMsgChanEmpty(t) |
| 5606 | mainCtrl.wait_registry_empty(t, 10) |
| 5607 | |
| 5608 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5609 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5610 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5611 | |
| 5612 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5613 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5614 | |
| 5615 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5616 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5617 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5618 | Counter{cSubReqToE2, 2}, |
| 5619 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5620 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5621 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5622 | Counter{cSubDelReqToE2, 2}, |
| 5623 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5624 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5625 | }) |
| 5626 | |
| 5627 | // Req1 |
| 5628 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5629 | |
| 5630 | //Subs Create |
| 5631 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5632 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5633 | |
| 5634 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5635 | |
| 5636 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5637 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5638 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5639 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5640 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5641 | |
| 5642 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5643 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5644 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5645 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5646 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5647 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5648 | |
| 5649 | deleteXapp1Subscription(t, &restSubId1) |
| 5650 | deleteXapp2Subscription(t, &restSubId2) |
| 5651 | |
| 5652 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5653 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5654 | |
| 5655 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5656 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5657 | } |
| 5658 | |
| 5659 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5660 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5661 | |
| 5662 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5663 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5664 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5665 | Counter{cSubReqToE2, 2}, |
| 5666 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5667 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5668 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5669 | Counter{cSubDelReqToE2, 2}, |
| 5670 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5671 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5672 | }) |
| 5673 | |
| 5674 | // Req1 |
| 5675 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5676 | |
| 5677 | //Subs Create |
| 5678 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5679 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5680 | |
| 5681 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5682 | |
| 5683 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5684 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5685 | params.SetMeid("RAN_NAME_1") |
| 5686 | |
| 5687 | actionId := int64(1) |
| 5688 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5689 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5690 | subsequestActionType := "continue" |
| 5691 | timeToWait := "w10ms" |
| 5692 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5693 | |
| 5694 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5695 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5696 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5697 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5698 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5699 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5700 | |
| 5701 | deleteXapp1Subscription(t, &restSubId1) |
| 5702 | deleteXapp2Subscription(t, &restSubId2) |
| 5703 | |
| 5704 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5705 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5706 | |
| 5707 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5708 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5709 | } |
| 5710 | |
| 5711 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5712 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5713 | |
| 5714 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5715 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5716 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5717 | Counter{cSubReqToE2, 2}, |
| 5718 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5719 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5720 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5721 | Counter{cSubDelReqToE2, 2}, |
| 5722 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5723 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5724 | }) |
| 5725 | |
| 5726 | // Req1 |
| 5727 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5728 | |
| 5729 | //Subs Create |
| 5730 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5731 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5732 | |
| 5733 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5734 | |
| 5735 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5736 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5737 | params.SetMeid("RAN_NAME_1") |
| 5738 | params.SetSubActionIDs(int64(2)) |
| 5739 | |
| 5740 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5741 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5742 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5743 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5744 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5745 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5746 | |
| 5747 | deleteXapp1Subscription(t, &restSubId1) |
| 5748 | deleteXapp2Subscription(t, &restSubId2) |
| 5749 | |
| 5750 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5751 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5752 | |
| 5753 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5754 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5755 | } |
| 5756 | |
| 5757 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5758 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5759 | |
| 5760 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5761 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5762 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5763 | Counter{cSubReqToE2, 2}, |
| 5764 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5765 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5766 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5767 | Counter{cSubDelReqToE2, 2}, |
| 5768 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5769 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5770 | }) |
| 5771 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5772 | const e2Timeout int64 = 2 |
| 5773 | const e2RetryCount int64 = 2 |
| 5774 | const routingNeeded bool = true |
| 5775 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5776 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5777 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5778 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5779 | |
| 5780 | //Subs Create |
| 5781 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5782 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5783 | |
| 5784 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5785 | |
| 5786 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5787 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5788 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5789 | params.SetMeid("RAN_NAME_1") |
| 5790 | |
| 5791 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5792 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5793 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5794 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5795 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5796 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5797 | |
| 5798 | deleteXapp1Subscription(t, &restSubId1) |
| 5799 | deleteXapp2Subscription(t, &restSubId2) |
| 5800 | |
| 5801 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5802 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5803 | |
| 5804 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5805 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5806 | } |
| 5807 | |
| 5808 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5809 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5810 | |
| 5811 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5812 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5813 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5814 | Counter{cSubReqToE2, 2}, |
| 5815 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5816 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5817 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5818 | Counter{cSubDelReqToE2, 2}, |
| 5819 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5820 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5821 | }) |
| 5822 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5823 | const e2Timeout int64 = 2 |
| 5824 | const e2RetryCount int64 = 2 |
| 5825 | const routingNeeded bool = true |
| 5826 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5827 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5828 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5829 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5830 | |
| 5831 | //Subs Create |
| 5832 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5833 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5834 | |
| 5835 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5836 | |
| 5837 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5838 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5839 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5840 | params.SetMeid("RAN_NAME_1") |
| 5841 | |
| 5842 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5843 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5844 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5845 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5846 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5847 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5848 | |
| 5849 | deleteXapp1Subscription(t, &restSubId1) |
| 5850 | deleteXapp2Subscription(t, &restSubId2) |
| 5851 | |
| 5852 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5853 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5854 | |
| 5855 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5856 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5857 | } |
| 5858 | |
| 5859 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5860 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5861 | |
| 5862 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5863 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5864 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5865 | Counter{cSubReqToE2, 2}, |
| 5866 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5867 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5868 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5869 | Counter{cSubDelReqToE2, 2}, |
| 5870 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5871 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5872 | }) |
| 5873 | |
| 5874 | // Req1 |
| 5875 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5876 | |
| 5877 | //Subs Create |
| 5878 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5879 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5880 | |
| 5881 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5882 | |
| 5883 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5884 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5885 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5886 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5887 | params.SetSubActionDefinition(actionDefinition) |
| 5888 | |
| 5889 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5890 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5891 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5892 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5893 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5894 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5895 | |
| 5896 | deleteXapp1Subscription(t, &restSubId1) |
| 5897 | deleteXapp2Subscription(t, &restSubId2) |
| 5898 | |
| 5899 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5900 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5901 | |
| 5902 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5903 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5904 | } |
| 5905 | |
| 5906 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5907 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5908 | |
| 5909 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5910 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5911 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5912 | Counter{cSubReqToE2, 2}, |
| 5913 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5914 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5915 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5916 | Counter{cSubDelReqToE2, 2}, |
| 5917 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5918 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5919 | }) |
| 5920 | |
| 5921 | // Req1 |
| 5922 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5923 | |
| 5924 | //Subs Create |
| 5925 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5926 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5927 | |
| 5928 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5929 | |
| 5930 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5931 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5932 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5933 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5934 | params.SetSubActionDefinition(actionDefinition) |
| 5935 | |
| 5936 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5937 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5938 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5939 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5940 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5941 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5942 | |
| 5943 | deleteXapp1Subscription(t, &restSubId1) |
| 5944 | deleteXapp2Subscription(t, &restSubId2) |
| 5945 | |
| 5946 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5947 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5948 | |
| 5949 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5950 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5951 | } |
| 5952 | |
| 5953 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5954 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5955 | |
| 5956 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5957 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5958 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5959 | Counter{cSubReqToE2, 2}, |
| 5960 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5961 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5962 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5963 | Counter{cSubDelReqToE2, 2}, |
| 5964 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5965 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5966 | }) |
| 5967 | |
| 5968 | // Req1 |
| 5969 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5970 | |
| 5971 | //Subs Create |
| 5972 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5973 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5974 | |
| 5975 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5976 | |
| 5977 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5978 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5979 | params.SetMeid("RAN_NAME_1") |
| 5980 | params.SetTimeToWait("w200ms") |
| 5981 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5982 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5983 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5984 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5985 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5986 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5987 | |
| 5988 | deleteXapp1Subscription(t, &restSubId1) |
| 5989 | deleteXapp2Subscription(t, &restSubId2) |
| 5990 | |
| 5991 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5992 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5993 | |
| 5994 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5995 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5996 | } |
| 5997 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5998 | //----------------------------------------------------------------------------- |
| 5999 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 6000 | // |
| 6001 | // stub stub |
| 6002 | // +-------+ +---------+ +---------+ |
| 6003 | // | xapp | | submgr | | e2term | |
| 6004 | // +-------+ +---------+ +---------+ |
| 6005 | // | | | |
| 6006 | // | RestSubReq | | |
| 6007 | // |---------------->| | |
| 6008 | // | | | |
| 6009 | // | RESTSubResp | | |
| 6010 | // |<----------------| | |
| 6011 | // | | | |
| 6012 | // | | SubReq | |
| 6013 | // | |------------->| |
| 6014 | // | | | |
| 6015 | // | | SubResp | ASN.1 decode fails |
| 6016 | // | |<-------------| |
| 6017 | // | | | |
| 6018 | // | | SubReq | |
| 6019 | // | |------------->| |
| 6020 | // | | | |
| 6021 | // | | SubFail | Duplicated action |
| 6022 | // | |<-------------| |
| 6023 | // | RESTNotif (fail)| | |
| 6024 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6025 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6026 | // |
| 6027 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6028 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6029 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6030 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 6031 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6032 | |
| 6033 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6034 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6035 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6036 | |
| 6037 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6038 | // Decode of this response fails which will result resending original request |
| 6039 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 6040 | |
| 6041 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6042 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6043 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6044 | |
| 6045 | // Subscription already created in E2 Node. |
| 6046 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6047 | fparams.Set(crereq) |
| 6048 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6049 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6050 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6051 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6052 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6053 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6054 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6055 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6056 | // Wait that subs is cleaned |
| 6057 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6058 | |
| 6059 | xappConn1.TestMsgChanEmpty(t) |
| 6060 | e2termConn1.TestMsgChanEmpty(t) |
| 6061 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6062 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6063 | } |
| 6064 | |
| 6065 | //----------------------------------------------------------------------------- |
| 6066 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6067 | // |
| 6068 | // stub stub |
| 6069 | // +-------+ +---------+ +---------+ |
| 6070 | // | xapp | | submgr | | e2term | |
| 6071 | // +-------+ +---------+ +---------+ |
| 6072 | // | | | |
| 6073 | // | RestSubReq | | |
| 6074 | // |---------------->| | |
| 6075 | // | | | |
| 6076 | // | RESTSubResp | | |
| 6077 | // |<----------------| | |
| 6078 | // | | | |
| 6079 | // | | SubReq | |
| 6080 | // | |------------->| |
| 6081 | // | | | |
| 6082 | // | | SubResp | Unknown instanceId |
| 6083 | // | |<-------------| |
| 6084 | // | | | |
| 6085 | // | | SubReq | |
| 6086 | // | |------------->| |
| 6087 | // | | | |
| 6088 | // | | SubFail | Duplicated action |
| 6089 | // | |<-------------| |
| 6090 | // | RESTNotif (fail)| | |
| 6091 | // |<----------------| | |
| 6092 | // | | SubDelReq | |
| 6093 | // | |------------->| |
| 6094 | // | | | |
| 6095 | // | | SubDelResp | |
| 6096 | // | |<-------------| |
| 6097 | // |
| 6098 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6099 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6100 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6101 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 6102 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6103 | |
| 6104 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6105 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6106 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6107 | |
| 6108 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6109 | |
| 6110 | // Unknown instanceId in this response which will result resending original request |
| 6111 | orgInstanceId := crereq.RequestId.InstanceId |
| 6112 | crereq.RequestId.InstanceId = 0 |
| 6113 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6114 | |
| 6115 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6116 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6117 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6118 | |
| 6119 | // Subscription already created in E2 Node. |
| 6120 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6121 | fparams.Set(crereq) |
| 6122 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6123 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6124 | |
| 6125 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6126 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6127 | |
| 6128 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6129 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6130 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6131 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6132 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6133 | // Wait that subs is cleaned |
| 6134 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 6135 | |
| 6136 | xappConn1.TestMsgChanEmpty(t) |
| 6137 | e2termConn1.TestMsgChanEmpty(t) |
| 6138 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6139 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6140 | } |
| 6141 | |
| 6142 | //----------------------------------------------------------------------------- |
| 6143 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 6144 | // |
| 6145 | // stub stub |
| 6146 | // +-------+ +---------+ +---------+ |
| 6147 | // | xapp | | submgr | | e2term | |
| 6148 | // +-------+ +---------+ +---------+ |
| 6149 | // | | | |
| 6150 | // | RestSubReq | | |
| 6151 | // |---------------->| | |
| 6152 | // | | | |
| 6153 | // | RESTSubResp | | |
| 6154 | // |<----------------| | |
| 6155 | // | | | |
| 6156 | // | | SubReq | |
| 6157 | // | |------------->| |
| 6158 | // | | | |
| 6159 | // | | SubResp | No transaction for the response |
| 6160 | // | |<-------------| |
| 6161 | // | | | |
| 6162 | // | | SubReq | |
| 6163 | // | |------------->| |
| 6164 | // | | | |
| 6165 | // | | SubFail | Duplicated action |
| 6166 | // | |<-------------| |
| 6167 | // | RESTNotif (fail)| | |
| 6168 | // |<----------------| | |
| 6169 | // | | SubDelReq | |
| 6170 | // | |------------->| |
| 6171 | // | | | |
| 6172 | // | | SubDelResp | |
| 6173 | // | |<-------------| |
| 6174 | // | | | |
| 6175 | // | | SubDelReq | |
| 6176 | // | |------------->| |
| 6177 | // | | | |
| 6178 | // | | SubDelResp | |
| 6179 | // | |<-------------| |
| 6180 | // |
| 6181 | //----------------------------------------------------------------------------- |
| 6182 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6183 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 6184 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6185 | |
| 6186 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6187 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6188 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6189 | |
| 6190 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6191 | |
| 6192 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6193 | // No transaction exist for this response which will result resending original request |
| 6194 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6195 | |
| 6196 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6197 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6198 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6199 | |
| 6200 | // Subscription already created in E2 Node. |
| 6201 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6202 | fparams.Set(crereq) |
| 6203 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6204 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6205 | |
| 6206 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6207 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6208 | |
| 6209 | // Resending happens because there no transaction |
| 6210 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6211 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6212 | |
| 6213 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6214 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6215 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6216 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6217 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6218 | // Wait that subs is cleaned |
| 6219 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6220 | |
| 6221 | xappConn1.TestMsgChanEmpty(t) |
| 6222 | e2termConn1.TestMsgChanEmpty(t) |
| 6223 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6224 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6225 | } |
| 6226 | |
| 6227 | //----------------------------------------------------------------------------- |
| 6228 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 6229 | // |
| 6230 | // stub stub |
| 6231 | // +-------+ +---------+ +---------+ |
| 6232 | // | xapp | | submgr | | e2term | |
| 6233 | // +-------+ +---------+ +---------+ |
| 6234 | // | | | |
| 6235 | // | RestSubReq | | |
| 6236 | // |---------------->| | |
| 6237 | // | | | |
| 6238 | // | RESTSubResp | | |
| 6239 | // |<----------------| | |
| 6240 | // | | | |
| 6241 | // | | SubReq | |
| 6242 | // | |------------->| |
| 6243 | // | | | |
| 6244 | // | | SubFail | ASN.1 decode fails |
| 6245 | // | |<-------------| |
| 6246 | // | | | |
| 6247 | // | | SubReq | |
| 6248 | // | |------------->| |
| 6249 | // | | | |
| 6250 | // | | SubFail | Duplicated action |
| 6251 | // | |<-------------| |
| 6252 | // | RESTNotif (fail)| | |
| 6253 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6254 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6255 | // |
| 6256 | //----------------------------------------------------------------------------- |
| 6257 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6258 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 6259 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6260 | |
| 6261 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6262 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6263 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6264 | |
| 6265 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6266 | |
| 6267 | // Decode of this response fails which will result resending original request |
| 6268 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 6269 | |
| 6270 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6271 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6272 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6273 | |
| 6274 | // Subscription already created in E2 Node. |
| 6275 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6276 | fparams.Set(crereq) |
| 6277 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6278 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6279 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 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 | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6292 | } |
| 6293 | |
| 6294 | //----------------------------------------------------------------------------- |
| 6295 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 6296 | // |
| 6297 | // stub stub |
| 6298 | // +-------+ +---------+ +---------+ |
| 6299 | // | xapp | | submgr | | e2term | |
| 6300 | // +-------+ +---------+ +---------+ |
| 6301 | // | | | |
| 6302 | // | RestSubReq | | |
| 6303 | // |---------------->| | |
| 6304 | // | | | |
| 6305 | // | RESTSubResp | | |
| 6306 | // |<----------------| | |
| 6307 | // | | | |
| 6308 | // | | SubReq | |
| 6309 | // | |------------->| |
| 6310 | // | | | |
| 6311 | // | | SubFail | Unknown instanceId |
| 6312 | // | |<-------------| |
| 6313 | // | | | |
| 6314 | // | | SubReq | |
| 6315 | // | |------------->| |
| 6316 | // | | | |
| 6317 | // | | SubFail | Duplicated action |
| 6318 | // | |<-------------| |
| 6319 | // | RESTNotif (fail)| | |
| 6320 | // |<----------------| | |
| 6321 | // | | SubDelReq | |
| 6322 | // | |------------->| |
| 6323 | // | | | |
| 6324 | // | | SubDelResp | |
| 6325 | // | |<-------------| |
| 6326 | // |
| 6327 | //----------------------------------------------------------------------------- |
| 6328 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6329 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6330 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6331 | |
| 6332 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6333 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6334 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6335 | |
| 6336 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6337 | |
| 6338 | // Unknown instanceId in this response which will result resending original request |
| 6339 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6340 | fparams.Set(crereq) |
| 6341 | fparams.Fail.RequestId.InstanceId = 0 |
| 6342 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6343 | |
| 6344 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6345 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6346 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6347 | |
| 6348 | // Subscription already created in E2 Node. |
| 6349 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6350 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6351 | |
| 6352 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6353 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6354 | |
| 6355 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6356 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6357 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6358 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6359 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6360 | // Wait that subs is cleaned |
| 6361 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6362 | |
| 6363 | xappConn1.TestMsgChanEmpty(t) |
| 6364 | e2termConn1.TestMsgChanEmpty(t) |
| 6365 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6366 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6367 | } |
| 6368 | |
| 6369 | //----------------------------------------------------------------------------- |
| 6370 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6371 | // |
| 6372 | // stub stub |
| 6373 | // +-------+ +---------+ +---------+ |
| 6374 | // | xapp | | submgr | | e2term | |
| 6375 | // +-------+ +---------+ +---------+ |
| 6376 | // | | | |
| 6377 | // | RestSubReq | | |
| 6378 | // |---------------->| | |
| 6379 | // | | | |
| 6380 | // | RESTSubResp | | |
| 6381 | // |<----------------| | |
| 6382 | // | | | |
| 6383 | // | | SubReq | |
| 6384 | // | |------------->| |
| 6385 | // | | | |
| 6386 | // | | SubFail | No transaction for the response |
| 6387 | // | |<-------------| |
| 6388 | // | | | |
| 6389 | // | | SubReq | |
| 6390 | // | |------------->| |
| 6391 | // | | | |
| 6392 | // | | SubFail | Duplicated action |
| 6393 | // | |<-------------| |
| 6394 | // | RESTNotif (fail)| | |
| 6395 | // |<----------------| | |
| 6396 | // | | SubDelReq | |
| 6397 | // | |------------->| |
| 6398 | // | | | |
| 6399 | // | | SubDelResp | |
| 6400 | // | |<-------------| |
| 6401 | // |
| 6402 | //----------------------------------------------------------------------------- |
| 6403 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6404 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6405 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6406 | |
| 6407 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6408 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6409 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6410 | |
| 6411 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6412 | |
| 6413 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6414 | |
| 6415 | // No transaction exist for this response which will result resending original request |
| 6416 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6417 | fparams.Set(crereq) |
| 6418 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6419 | |
| 6420 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6421 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6422 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6423 | |
| 6424 | // Subscription already created in E2 Node. |
| 6425 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6426 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6427 | |
| 6428 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6429 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6430 | |
| 6431 | // Resending happens because there no transaction |
| 6432 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6433 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6434 | |
| 6435 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6436 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6437 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6438 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6439 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6440 | // Wait that subs is cleaned |
| 6441 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6442 | |
| 6443 | xappConn1.TestMsgChanEmpty(t) |
| 6444 | e2termConn1.TestMsgChanEmpty(t) |
| 6445 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6446 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6447 | } |
| 6448 | |
| 6449 | //----------------------------------------------------------------------------- |
| 6450 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6451 | // |
| 6452 | // stub stub |
| 6453 | // +-------+ +---------+ +---------+ |
| 6454 | // | xapp | | submgr | | e2term | |
| 6455 | // +-------+ +---------+ +---------+ |
| 6456 | // | | | |
| 6457 | // | [SUBS CREATE] | |
| 6458 | // | | | |
| 6459 | // | | | |
| 6460 | // | RESTSubDelReq | | |
| 6461 | // |---------------->| | |
| 6462 | // | | | |
| 6463 | // | RESTSubDelResp | | |
| 6464 | // |<----------------| | |
| 6465 | // | | | |
| 6466 | // | | SubDelReq | |
| 6467 | // | |------------->| |
| 6468 | // | | | |
| 6469 | // | | SubDelResp | ASN.1 decode fails |
| 6470 | // | |<-------------| |
| 6471 | // | | | |
| 6472 | // | | SubDelReq | |
| 6473 | // | |------------->| |
| 6474 | // | | | |
| 6475 | // | | SubDelFail | Subscription does exist any more |
| 6476 | // | |<-------------| |
| 6477 | // | | | |
| 6478 | // |
| 6479 | //----------------------------------------------------------------------------- |
| 6480 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6481 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6482 | |
| 6483 | // Req |
| 6484 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6485 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6486 | |
| 6487 | // Del |
| 6488 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6489 | |
| 6490 | // E2t: Receive 1st SubsDelReq |
| 6491 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6492 | |
| 6493 | // Decode of this response fails which will result resending original request |
| 6494 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6495 | |
| 6496 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6497 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6498 | |
| 6499 | // Subscription does not exist in in E2 Node. |
| 6500 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6501 | |
| 6502 | // Wait that subs is cleaned |
| 6503 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6504 | |
| 6505 | xappConn1.TestMsgChanEmpty(t) |
| 6506 | e2termConn1.TestMsgChanEmpty(t) |
| 6507 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6508 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6509 | } |
| 6510 | |
| 6511 | //----------------------------------------------------------------------------- |
| 6512 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6513 | // |
| 6514 | // stub stub |
| 6515 | // +-------+ +---------+ +---------+ |
| 6516 | // | xapp | | submgr | | e2term | |
| 6517 | // +-------+ +---------+ +---------+ |
| 6518 | // | | | |
| 6519 | // | [SUBS CREATE] | |
| 6520 | // | | | |
| 6521 | // | | | |
| 6522 | // | RESTSubDelReq | | |
| 6523 | // |---------------->| | |
| 6524 | // | | | |
| 6525 | // | RESTSubDelResp | | |
| 6526 | // |<----------------| | |
| 6527 | // | | | |
| 6528 | // | | SubDelReq | |
| 6529 | // | |------------->| |
| 6530 | // | | | |
| 6531 | // | | SubDelResp | Unknown instanceId |
| 6532 | // | |<-------------| |
| 6533 | // | | | |
| 6534 | // | | SubDelReq | |
| 6535 | // | |------------->| |
| 6536 | // | | | |
| 6537 | // | | SubDelFail | Subscription does exist any more |
| 6538 | // | |<-------------| |
| 6539 | // |
| 6540 | //----------------------------------------------------------------------------- |
| 6541 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6542 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6543 | |
| 6544 | // Req |
| 6545 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6546 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6547 | |
| 6548 | // Del |
| 6549 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6550 | |
| 6551 | // E2t: Receive 1st SubsDelReq |
| 6552 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6553 | |
| 6554 | // Unknown instanceId in this response which will result resending original request |
| 6555 | delreq.RequestId.InstanceId = 0 |
| 6556 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6557 | |
| 6558 | // E2t: Receive 2nd SubsDelReq |
| 6559 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6560 | |
| 6561 | // Subscription does not exist in in E2 Node. |
| 6562 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6563 | |
| 6564 | // Wait that subs is cleaned |
| 6565 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6566 | |
| 6567 | xappConn1.TestMsgChanEmpty(t) |
| 6568 | e2termConn1.TestMsgChanEmpty(t) |
| 6569 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6570 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6571 | } |
| 6572 | |
| 6573 | //----------------------------------------------------------------------------- |
| 6574 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6575 | // |
| 6576 | // stub stub |
| 6577 | // +-------+ +---------+ +---------+ |
| 6578 | // | xapp | | submgr | | e2term | |
| 6579 | // +-------+ +---------+ +---------+ |
| 6580 | // | | | |
| 6581 | // | [SUBS CREATE] | |
| 6582 | // | | | |
| 6583 | // | | | |
| 6584 | // | RESTSubDelReq | | |
| 6585 | // |---------------->| | |
| 6586 | // | | | |
| 6587 | // | RESTSubDelResp | | |
| 6588 | // |<----------------| | |
| 6589 | // | | | |
| 6590 | // | | SubDelReq | |
| 6591 | // | |------------->| |
| 6592 | // | | | |
| 6593 | // | | SubDelResp | No transaction for the response |
| 6594 | // | |<-------------| |
| 6595 | // | | | |
| 6596 | // | | SubDelReq | |
| 6597 | // | |------------->| |
| 6598 | // | | | |
| 6599 | // | | SubDelFail | Subscription does exist any more |
| 6600 | // | |<-------------| |
| 6601 | // |
| 6602 | //----------------------------------------------------------------------------- |
| 6603 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6604 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6605 | |
| 6606 | // Req |
| 6607 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6608 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6609 | |
| 6610 | // Del |
| 6611 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6612 | |
| 6613 | // E2t: Receive 1st SubsDelReq |
| 6614 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6615 | |
| 6616 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6617 | |
| 6618 | // No transaction exist for this response which will result resending original request |
| 6619 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6620 | |
| 6621 | // E2t: Receive 2nd SubsDelReq |
| 6622 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6623 | |
| 6624 | // Subscription does not exist in in E2 Node. |
| 6625 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6626 | |
| 6627 | // Wait that subs is cleaned |
| 6628 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6629 | |
| 6630 | xappConn1.TestMsgChanEmpty(t) |
| 6631 | e2termConn1.TestMsgChanEmpty(t) |
| 6632 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6633 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6634 | } |
| 6635 | |
| 6636 | //----------------------------------------------------------------------------- |
| 6637 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6638 | // |
| 6639 | // stub stub |
| 6640 | // +-------+ +---------+ +---------+ |
| 6641 | // | xapp | | submgr | | e2term | |
| 6642 | // +-------+ +---------+ +---------+ |
| 6643 | // | | | |
| 6644 | // | [SUBS CREATE] | |
| 6645 | // | | | |
| 6646 | // | | | |
| 6647 | // | RESTSubDelReq | | |
| 6648 | // |---------------->| | |
| 6649 | // | | | |
| 6650 | // | RESTSubDelResp | | |
| 6651 | // |<----------------| | |
| 6652 | // | | | |
| 6653 | // | | SubDelReq | |
| 6654 | // | |------------->| |
| 6655 | // | | | |
| 6656 | // | | SubDelFail | ASN.1 decode fails |
| 6657 | // | |<-------------| |
| 6658 | // | | | |
| 6659 | // | | SubDelReq | |
| 6660 | // | |------------->| |
| 6661 | // | | | |
| 6662 | // | | SubDelFail | Subscription does exist any more |
| 6663 | // | |<-------------| |
| 6664 | // |
| 6665 | //----------------------------------------------------------------------------- |
| 6666 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6667 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6668 | |
| 6669 | // Req |
| 6670 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6671 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6672 | |
| 6673 | // Del |
| 6674 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6675 | |
| 6676 | // E2t: Receive 1st SubsDelReq |
| 6677 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6678 | |
| 6679 | // Decode of this response fails which will result resending original request |
| 6680 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6681 | |
| 6682 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6683 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6684 | |
| 6685 | // Subscription does not exist in in E2 Node. |
| 6686 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6687 | |
| 6688 | // Wait that subs is cleaned |
| 6689 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6690 | |
| 6691 | xappConn1.TestMsgChanEmpty(t) |
| 6692 | e2termConn1.TestMsgChanEmpty(t) |
| 6693 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6694 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6695 | } |
| 6696 | |
| 6697 | //----------------------------------------------------------------------------- |
| 6698 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6699 | // |
| 6700 | // stub stub |
| 6701 | // +-------+ +---------+ +---------+ |
| 6702 | // | xapp | | submgr | | e2term | |
| 6703 | // +-------+ +---------+ +---------+ |
| 6704 | // | | | |
| 6705 | // | [SUBS CREATE] | |
| 6706 | // | | | |
| 6707 | // | | | |
| 6708 | // | RESTSubDelReq | | |
| 6709 | // |---------------->| | |
| 6710 | // | | | |
| 6711 | // | RESTSubDelResp | | |
| 6712 | // |<----------------| | |
| 6713 | // | | | |
| 6714 | // | | SubDelReq | |
| 6715 | // | |------------->| |
| 6716 | // | | | |
| 6717 | // | | SubDelFail | Unknown instanceId |
| 6718 | // | |<-------------| |
| 6719 | // | | | |
| 6720 | // | | SubDelReq | |
| 6721 | // | |------------->| |
| 6722 | // | | | |
| 6723 | // | | SubDelFail | Subscription does exist any more |
| 6724 | // | |<-------------| |
| 6725 | // |
| 6726 | //----------------------------------------------------------------------------- |
| 6727 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6728 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6729 | |
| 6730 | // Req |
| 6731 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6732 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6733 | |
| 6734 | // Del |
| 6735 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6736 | |
| 6737 | // E2t: Receive 1st SubsDelReq |
| 6738 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6739 | |
| 6740 | // Unknown instanceId in this response which will result resending original request |
| 6741 | delreq.RequestId.InstanceId = 0 |
| 6742 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6743 | |
| 6744 | // E2t: Receive 2nd SubsDelReq |
| 6745 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6746 | |
| 6747 | // Subscription does not exist in in E2 Node. |
| 6748 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6749 | |
| 6750 | // Wait that subs is cleaned |
| 6751 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6752 | |
| 6753 | xappConn1.TestMsgChanEmpty(t) |
| 6754 | e2termConn1.TestMsgChanEmpty(t) |
| 6755 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6756 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6757 | } |
| 6758 | |
| 6759 | //----------------------------------------------------------------------------- |
| 6760 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6761 | // |
| 6762 | // stub stub |
| 6763 | // +-------+ +---------+ +---------+ |
| 6764 | // | xapp | | submgr | | e2term | |
| 6765 | // +-------+ +---------+ +---------+ |
| 6766 | // | | | |
| 6767 | // | [SUBS CREATE] | |
| 6768 | // | | | |
| 6769 | // | | | |
| 6770 | // | RESTSubDelReq | | |
| 6771 | // |---------------->| | |
| 6772 | // | | | |
| 6773 | // | RESTSubDelResp | | |
| 6774 | // |<----------------| | |
| 6775 | // | | | |
| 6776 | // | | SubDelReq | |
| 6777 | // | |------------->| |
| 6778 | // | | | |
| 6779 | // | | SubDelFail | No transaction for the response |
| 6780 | // | |<-------------| |
| 6781 | // | | | |
| 6782 | // | | SubDelReq | |
| 6783 | // | |------------->| |
| 6784 | // | | | |
| 6785 | // | | SubDelFail | Subscription does exist any more |
| 6786 | // | |<-------------| |
| 6787 | // |
| 6788 | //----------------------------------------------------------------------------- |
| 6789 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6790 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6791 | |
| 6792 | // Req |
| 6793 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6794 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6795 | |
| 6796 | // Del |
| 6797 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6798 | |
| 6799 | // E2t: Receive 1st SubsDelReq |
| 6800 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6801 | |
| 6802 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6803 | |
| 6804 | // No transaction exist for this response which will result resending original request |
| 6805 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6806 | |
| 6807 | // E2t: Receive 2nd SubsDelReq |
| 6808 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6809 | |
| 6810 | // Subscription does not exist in in E2 Node. |
| 6811 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6812 | |
| 6813 | // Wait that subs is cleaned |
| 6814 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6815 | |
| 6816 | xappConn1.TestMsgChanEmpty(t) |
| 6817 | e2termConn1.TestMsgChanEmpty(t) |
| 6818 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6819 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6820 | } |
| 6821 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6822 | //----------------------------------------------------------------------------- |
| 6823 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6824 | // |
| 6825 | // stub stub |
| 6826 | // +-------+ +---------+ +---------+ |
| 6827 | // | xapp | | submgr | | e2term | |
| 6828 | // +-------+ +---------+ +---------+ |
| 6829 | // | | | |
| 6830 | // | RESTSubReq | | |
| 6831 | // |---------------->| | |
| 6832 | // | | | |
| 6833 | // | RESTSubResp | | |
| 6834 | // |<----------------| | |
| 6835 | // | | | |
| 6836 | // | ASN.1 encode fails | |
| 6837 | // | | | |
| 6838 | // | | SubDelReq | |
| 6839 | // | |------------->| |
| 6840 | // | | | |
| 6841 | // | | SubDelFail | |
| 6842 | // | |<-------------| |
| 6843 | // | | | |
| 6844 | // | RESTNotif | | |
| 6845 | // | unsuccess | | |
| 6846 | // |<----------------| | |
| 6847 | // | | | |
| 6848 | // | [SUBS DELETE] | |
| 6849 | // | | | |
| 6850 | // |
| 6851 | //----------------------------------------------------------------------------- |
| 6852 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6853 | |
| 6854 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6855 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6856 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6857 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6858 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6859 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6860 | }) |
| 6861 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6862 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6863 | |
| 6864 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6865 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6866 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6867 | |
| 6868 | // Req |
| 6869 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6870 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6871 | |
| 6872 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6873 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6874 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6875 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6876 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6877 | |
| 6878 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6879 | |
| 6880 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6881 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6882 | // Wait that subs is cleaned |
| 6883 | waitSubsCleanup(t, e2SubsId, 10) |
| 6884 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6885 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6886 | } |
| 6887 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6888 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6889 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6890 | |
| 6891 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6892 | Counter{cRestSubReqFromXapp, 2}, |
| 6893 | Counter{cRestSubRespToXapp, 2}, |
| 6894 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6895 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6896 | Counter{cSubRespFromE2, 1}, |
| 6897 | Counter{cRestSubNotifToXapp, 1}, |
| 6898 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6899 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6900 | Counter{cSubDelReqToE2, 1}, |
| 6901 | Counter{cSubDelRespFromE2, 1}, |
| 6902 | Counter{cRestSubDelRespToXapp, 1}, |
| 6903 | }) |
| 6904 | |
| 6905 | const e2Timeout int64 = 1 |
| 6906 | const e2RetryCount int64 = 0 |
| 6907 | const routingNeeded bool = false |
| 6908 | |
| 6909 | // Req1 |
| 6910 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6911 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6912 | |
| 6913 | // Subs Create |
| 6914 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6915 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6916 | |
| 6917 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6918 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6919 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6920 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6921 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6922 | |
| 6923 | // Policy change |
| 6924 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6925 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6926 | params.SetSubscriptionID(&restSubId) |
| 6927 | params.SetTimeToWait("w200ms") |
| 6928 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6929 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6930 | |
| 6931 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6932 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 6933 | // SubsResp is missing, e2SubsId will be 0 |
| 6934 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6935 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6936 | |
| 6937 | // Del |
| 6938 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6939 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6940 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6941 | |
| 6942 | waitSubsCleanup(t, e2SubsId, 10) |
| 6943 | |
| 6944 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6945 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6946 | } |
| 6947 | |
| 6948 | //----------------------------------------------------------------------------- |
| 6949 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6950 | // |
| 6951 | // stub stub |
| 6952 | // +-------+ +---------+ +---------+ |
| 6953 | // | xapp | | submgr | | e2term | |
| 6954 | // +-------+ +---------+ +---------+ |
| 6955 | // | | | |
| 6956 | // | RESTSubReq | | |
| 6957 | // |---------------->| | |
| 6958 | // | | | |
| 6959 | // | RESTSubResp | | |
| 6960 | // |<----------------| | |
| 6961 | // | | SubReq | |
| 6962 | // | |------------->| |
| 6963 | // | | | |
| 6964 | // | | SubResp | |
| 6965 | // | |<-------------| |
| 6966 | // | | | |
| 6967 | // | RESTNotif | | |
| 6968 | // |<----------------| | |
| 6969 | // | | | |
| 6970 | // | RESTSubReq | | |
| 6971 | // |---------------->| | |
| 6972 | // | | | |
| 6973 | // | RESTSubResp | | |
| 6974 | // |<----------------| | |
| 6975 | // | | SubReq | |
| 6976 | // | |------------->| |
| 6977 | // | | |
| 6978 | // | Submgr restart | |
| 6979 | // | | | |
| 6980 | // | RESTSubDelReq | | |
| 6981 | // |---------------->| | |
| 6982 | // | | | |
| 6983 | // | | SubDelReq | |
| 6984 | // | |------------->| |
| 6985 | // | | | |
| 6986 | // | | SubDelResp | |
| 6987 | // | |<-------------| |
| 6988 | // | | | |
| 6989 | // | RESTSubDelResp | | |
| 6990 | // |<----------------| | |
| 6991 | // |
| 6992 | //----------------------------------------------------------------------------- |
| 6993 | |
| 6994 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6995 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6996 | |
| 6997 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6998 | Counter{cRestSubReqFromXapp, 2}, |
| 6999 | Counter{cRestSubRespToXapp, 2}, |
| 7000 | Counter{cSubReqToE2, 2}, |
| 7001 | Counter{cSubRespFromE2, 1}, |
| 7002 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7003 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7004 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 7005 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7006 | Counter{cRestSubDelRespToXapp, 1}, |
| 7007 | }) |
| 7008 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7009 | const e2Timeout int64 = 1 |
| 7010 | const e2RetryCount int64 = 0 |
| 7011 | const routingNeeded bool = false |
| 7012 | |
| 7013 | // Req1 |
| 7014 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7015 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7016 | // Create subscription |
| 7017 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7018 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7019 | |
| 7020 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7021 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7022 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7023 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 7024 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 7025 | |
| 7026 | // Check subscription |
| 7027 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7028 | |
| 7029 | // Policy change |
| 7030 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 7031 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 7032 | params.SetSubscriptionID(&restSubId) |
| 7033 | params.SetTimeToWait("w200ms") |
| 7034 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 7035 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 7036 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 7037 | |
| 7038 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 7039 | mainCtrl.SetResetTestFlag(t, false) |
| 7040 | |
| 7041 | // SubsResp is missing due to submgr restart |
| 7042 | |
| 7043 | mainCtrl.SimulateRestart(t) |
| 7044 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 7045 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7046 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 7047 | // That needs to be completed before successful subscription query is possible |
| 7048 | <-time.After(time.Second * 1) |
| 7049 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7050 | // Check subscription |
| 7051 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7052 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7053 | // Delete subscription |
| 7054 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7055 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7056 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7057 | |
| 7058 | //Wait that subs is cleaned |
| 7059 | waitSubsCleanup(t, e2SubsId, 10) |
| 7060 | |
| 7061 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7062 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7063 | } |
| 7064 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7065 | //////////////////////////////////////////////////////////////////////////////////// |
| 7066 | // Services for UT cases |
| 7067 | //////////////////////////////////////////////////////////////////////////////////// |
| 7068 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7069 | const host string = "localhost" |
| 7070 | |
| 7071 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 7072 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7073 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7074 | } |
| 7075 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7076 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7077 | |
| 7078 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 7079 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7080 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 7081 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7082 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7083 | |
| 7084 | return restSubId, e2SubsId |
| 7085 | } |
| 7086 | |
| 7087 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 7088 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7089 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7090 | if meid != "" { |
| 7091 | params.SetMeid(meid) |
| 7092 | } |
| 7093 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 7094 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 7095 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7096 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7097 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7098 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7099 | |
| 7100 | return restSubId, e2SubsId |
| 7101 | } |
| 7102 | |
| 7103 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7104 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7105 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7106 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7107 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7108 | |
| 7109 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7110 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7111 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 7112 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7113 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7114 | |
| 7115 | return restSubId, e2SubsId |
| 7116 | } |
| 7117 | |
| 7118 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7119 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7120 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7121 | |
| 7122 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 7123 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 7124 | fparams1.Set(crereq1) |
| 7125 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 7126 | |
| 7127 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 7128 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 7129 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 7130 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7131 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7132 | |
| 7133 | return restSubId, e2SubsId |
| 7134 | } |
| 7135 | |
| 7136 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 7137 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 7138 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7139 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7140 | } |
| 7141 | |
| 7142 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 7143 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 7144 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7145 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7146 | } |
| 7147 | |
| 7148 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 7149 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 7150 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7151 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7152 | } |
| 7153 | |
| 7154 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 7155 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 7156 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 7157 | assert.Equal(t, meid, resp[0].Meid) |
| 7158 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7159 | } |
| 7160 | |
| 7161 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 7162 | //Wait that subs is cleaned |
| 7163 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 7164 | |
| 7165 | xappConn1.TestMsgChanEmpty(t) |
| 7166 | xappConn2.TestMsgChanEmpty(t) |
| 7167 | e2termConn1.TestMsgChanEmpty(t) |
| 7168 | mainCtrl.wait_registry_empty(t, timeout) |
| 7169 | } |
| 7170 | |
| 7171 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 7172 | |
| 7173 | var e2SubsId []uint32 |
| 7174 | |
| 7175 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7176 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7177 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 7178 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 7179 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 7180 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 7181 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7182 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 7183 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7184 | <-time.After(100 * time.Millisecond) |
| 7185 | } |
| 7186 | return e2SubsId |
| 7187 | } |
| 7188 | |
| 7189 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 7190 | |
| 7191 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7192 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7193 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 7194 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 7195 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7196 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 7197 | <-time.After(100 * time.Millisecond) |
| 7198 | } |
| 7199 | |
| 7200 | // Wait that subs is cleaned |
| 7201 | for i := 0; i < len(e2SubsIds); i++ { |
| 7202 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 7203 | } |
| 7204 | |
| 7205 | } |