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 | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 23 | "encoding/json" |
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 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 36 | // In below test cases there is done only one retry for E2 messages |
| 37 | // In Helm chart retry count is currently 2 By default. Retry count |
| 38 | // used in test cases is defined in submgr-config.yaml file. |
| 39 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 40 | func TestSuiteSetup(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 41 | // The effect of this call shall endure though the UT suite! |
| 42 | // If this causes any issues, the previous interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 43 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 44 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 45 | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 46 | mainCtrl.InitAllCounterMap() |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 47 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 48 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 49 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 50 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 51 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 52 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 53 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 54 | Counter{cE2StateChangedToUp, 3}, |
| 55 | }) |
| 56 | |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 57 | // Current UT test cases use these ran names |
| 58 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 59 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 60 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 61 | |
| 62 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 63 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 64 | |
| 65 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 66 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 67 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 68 | |
| 69 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | //----------------------------------------------------------------------------- |
| 73 | // TestRESTSubReqAfterE2ConnBreak |
| 74 | // |
| 75 | // stub stub |
| 76 | // +-------+ +---------+ +---------+ |
| 77 | // | xapp | | submgr | | e2term | |
| 78 | // +-------+ +---------+ +---------+ |
| 79 | // | | | |
| 80 | // | [E2 Conn. DOWN] | |
| 81 | // | | | |
| 82 | // | RESTSubReq | | |
| 83 | // |---------------->| | |
| 84 | // | RESTSubFail | | |
| 85 | // |<----------------| | |
| 86 | // | | | |
| 87 | // |
| 88 | //----------------------------------------------------------------------------- |
| 89 | |
| 90 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 91 | |
| 92 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 93 | Counter{cRestSubReqFromXapp, 1}, |
| 94 | Counter{cRestReqRejDueE2Down, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 95 | Counter{cE2StateChangedToDown, 1}, |
| 96 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 97 | }) |
| 98 | |
| 99 | // E2 disconnect after E2term has received response |
| 100 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 101 | // Req |
| 102 | const subReqCount int = 1 |
| 103 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 104 | xappConn1.SendRESTSubsReq(t, params) |
| 105 | |
| 106 | // Restore E2 connection for following test cases |
| 107 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 108 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 109 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 110 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | //----------------------------------------------------------------------------- |
| 114 | // TestRESTSubReqE2ConnBreak |
| 115 | // |
| 116 | // stub stub |
| 117 | // +-------+ +---------+ +---------+ |
| 118 | // | xapp | | submgr | | e2term | |
| 119 | // +-------+ +---------+ +---------+ |
| 120 | // | | | |
| 121 | // | RESTSubReq | | |
| 122 | // |---------------->| | |
| 123 | // | RESTSubResp | | |
| 124 | // |<----------------| | |
| 125 | // | | SubReq | |
| 126 | // | |------------->| |
| 127 | // | | SubResp | |
| 128 | // | |<-------------| |
| 129 | // | | | |
| 130 | // | [E2 Conn. DOWN] | |
| 131 | // | [Int. SUBS DELETE] | |
| 132 | // | | | |
| 133 | // | RESTNotif(unsuccessful) | |
| 134 | // |<----------------| | |
| 135 | // | | | |
| 136 | // | | | |
| 137 | // |
| 138 | //----------------------------------------------------------------------------- |
| 139 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 140 | |
| 141 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 142 | Counter{cRestSubReqFromXapp, 1}, |
| 143 | Counter{cRestSubRespToXapp, 1}, |
| 144 | Counter{cSubReqToE2, 1}, |
| 145 | Counter{cSubRespFromE2, 1}, |
| 146 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 147 | Counter{cE2StateChangedToDown, 1}, |
| 148 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 149 | }) |
| 150 | |
| 151 | // Req |
| 152 | const subReqCount int = 1 |
| 153 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 154 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 155 | |
| 156 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 157 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 158 | |
| 159 | // E2 disconnect after E2term has received response |
| 160 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 161 | |
| 162 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 163 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 164 | |
| 165 | <-time.After(time.Second * 1) |
| 166 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 167 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 168 | |
| 169 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 170 | if err != nil { |
| 171 | xapp.Logger.Error("%v", err) |
| 172 | } else { |
| 173 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 174 | assert.Equal(t, 0, len(register)) |
| 175 | } |
| 176 | |
| 177 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 178 | if err != nil { |
| 179 | xapp.Logger.Error("%v", err) |
| 180 | } else { |
| 181 | assert.Equal(t, 0, len(restSubscriptions)) |
| 182 | } |
| 183 | |
| 184 | // Restore E2 connection for following test cases |
| 185 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 186 | |
| 187 | // Wait that subs is cleaned |
| 188 | waitSubsCleanup(t, e2SubsId, 10) |
| 189 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 190 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | //----------------------------------------------------------------------------- |
| 194 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 195 | // |
| 196 | // stub stub |
| 197 | // +-------+ +---------+ +---------+ |
| 198 | // | xapp | | submgr | | e2term | |
| 199 | // +-------+ +---------+ +---------+ |
| 200 | // | | | |
| 201 | // | [SUBS CREATE] | |
| 202 | // | | | |
| 203 | // | [E2 Conn. DOWN] | |
| 204 | // | | | |
| 205 | // | RESTSubDelReq | | |
| 206 | // |---------------->| | |
| 207 | // | | | |
| 208 | // | RESTSubDelResp | | |
| 209 | // |<----------------| | |
| 210 | // | | | |
| 211 | // | [No valid subscription found] | |
| 212 | // | | | |
| 213 | // |
| 214 | //----------------------------------------------------------------------------- |
| 215 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 216 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 217 | |
| 218 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 219 | Counter{cRestSubReqFromXapp, 1}, |
| 220 | Counter{cRestSubRespToXapp, 1}, |
| 221 | Counter{cSubReqToE2, 1}, |
| 222 | Counter{cSubRespFromE2, 1}, |
| 223 | Counter{cRestSubNotifToXapp, 1}, |
| 224 | Counter{cRestSubDelReqFromXapp, 1}, |
| 225 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 226 | Counter{cE2StateChangedToDown, 1}, |
| 227 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 228 | }) |
| 229 | |
| 230 | // Req |
| 231 | var params *teststube2ap.RESTSubsReqParams = nil |
| 232 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 233 | |
| 234 | // E2 disconnect after E2term has received response |
| 235 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 236 | |
| 237 | // Del |
| 238 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 239 | |
| 240 | <-time.After(time.Second * 1) |
| 241 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 242 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 243 | |
| 244 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 245 | if err != nil { |
| 246 | xapp.Logger.Error("%v", err) |
| 247 | } else { |
| 248 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 249 | assert.Equal(t, 0, len(register)) |
| 250 | } |
| 251 | |
| 252 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 253 | if err != nil { |
| 254 | xapp.Logger.Error("%v", err) |
| 255 | } else { |
| 256 | assert.Equal(t, 0, len(restSubscriptions)) |
| 257 | } |
| 258 | |
| 259 | // Restore E2 connection for following test cases |
| 260 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 261 | |
| 262 | // Wait that subs is cleaned |
| 263 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 264 | |
| 265 | xappConn1.TestMsgChanEmpty(t) |
| 266 | e2termConn1.TestMsgChanEmpty(t) |
| 267 | mainCtrl.wait_registry_empty(t, 10) |
| 268 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 269 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | //----------------------------------------------------------------------------- |
| 273 | // TestRESTOtherE2ConnectionChanges |
| 274 | // |
| 275 | |
| 276 | // stub stub |
| 277 | // +-------+ +---------+ +---------+ |
| 278 | // | xapp | | submgr | | e2term | |
| 279 | // +-------+ +---------+ +---------+ |
| 280 | // | | | |
| 281 | // | [SUBS CREATE] | |
| 282 | // | | | |
| 283 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 284 | // | [E2 CONNECTING] | |
| 285 | // | [E2 SHUTTING_DOWN] | |
| 286 | // | [E2 SHUT_DOWN] | |
| 287 | // | | | |
| 288 | // | [SUBS DELETE] | |
| 289 | // | | | |
| 290 | // |
| 291 | //----------------------------------------------------------------------------- |
| 292 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 293 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 294 | |
| 295 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 296 | Counter{cRestSubReqFromXapp, 1}, |
| 297 | Counter{cRestSubRespToXapp, 1}, |
| 298 | Counter{cSubReqToE2, 1}, |
| 299 | Counter{cSubRespFromE2, 1}, |
| 300 | Counter{cRestSubNotifToXapp, 1}, |
| 301 | Counter{cRestSubDelReqFromXapp, 1}, |
| 302 | Counter{cSubDelReqToE2, 1}, |
| 303 | Counter{cSubDelRespFromE2, 1}, |
| 304 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 305 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 306 | }) |
| 307 | |
| 308 | // Req |
| 309 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 310 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 311 | |
| 312 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 313 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 314 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 315 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 316 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 317 | // 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] | 318 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 319 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 320 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 321 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 322 | |
| 323 | // Del |
| 324 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 325 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 326 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 327 | |
| 328 | // Restore E2 connection for following test cases |
| 329 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 330 | |
| 331 | // Wait that subs is cleaned |
| 332 | waitSubsCleanup(t, e2SubsId, 10) |
| 333 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 334 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 335 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 336 | |
| 337 | //----------------------------------------------------------------------------- |
| 338 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 339 | // |
| 340 | // stub stub stub |
| 341 | // +-------+ +---------+ +---------+ +---------+ |
| 342 | // | xapp | | submgr | | e2term | | rtmgr | |
| 343 | // +-------+ +---------+ +---------+ +---------+ |
| 344 | // | | | | |
| 345 | // | RESTSubReq | | | |
| 346 | // |---------------->| | | |
| 347 | // | | RouteCreate | | |
| 348 | // | |--------------------------->| // The order of these events may vary |
| 349 | // | | | | |
| 350 | // | RESTSubResp | | | // The order of these events may vary |
| 351 | // |<----------------| | | |
| 352 | // | | RouteResponse| | |
| 353 | // | |<---------------------------| // The order of these events may vary |
| 354 | // | | | | |
| 355 | // | | SubReq | | |
| 356 | // | |------------->| | // The order of these events may vary |
| 357 | // | | | | |
| 358 | // | | SubResp | | |
| 359 | // | |<-------------| | |
| 360 | // | RESTNotif1 | | | |
| 361 | // |<----------------| | | |
| 362 | // | | | | |
| 363 | // | RESTSubDelReq | | | |
| 364 | // |---------------->| | | |
| 365 | // | | SubDelReq | | |
| 366 | // | |------------->| | |
| 367 | // | | | | |
| 368 | // | RESTSubDelResp| | | |
| 369 | // |<----------------| | | |
| 370 | // | | | | |
| 371 | // | | SubDelResp | | |
| 372 | // | |<-------------| | |
| 373 | // | | | | |
| 374 | // | | | | |
| 375 | // |
| 376 | //----------------------------------------------------------------------------- |
| 377 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 378 | |
| 379 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 380 | |
| 381 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 382 | |
| 383 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 384 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 385 | } |
| 386 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 387 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 388 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 389 | // |
| 390 | // stub stub stub |
| 391 | // +-------+ +---------+ +---------+ +---------+ |
| 392 | // | xapp | | submgr | | e2term | | rtmgr | |
| 393 | // +-------+ +---------+ +---------+ +---------+ |
| 394 | // | | | | |
| 395 | // | RESTSubReq | | | |
| 396 | // |---------------->| | | |
| 397 | // | | RouteCreate | | |
| 398 | // | |--------------------------->| // The order of these events may vary |
| 399 | // | | | | |
| 400 | // | RESTSubResp | | | // The order of these events may vary |
| 401 | // |<----------------| | | |
| 402 | // | | RouteResponse| | |
| 403 | // | |<---------------------------| // The order of these events may vary |
| 404 | // | | | | |
| 405 | // | | SubReq | | |
| 406 | // | |------------->| | // The order of these events may vary |
| 407 | // | | | | |
| 408 | // | | SubResp | | |
| 409 | // | |<-------------| | |
| 410 | // | RESTNotif1 | | | |
| 411 | // |<----------------| | | |
| 412 | // | | | | |
| 413 | // | RESTSubDelReq | | | |
| 414 | // |---------------->| | | |
| 415 | // | | | | |
| 416 | // | RESTSubDelResp| | | |
| 417 | // |<----------------| | | |
| 418 | // | | | | |
| 419 | // | | | | |
| 420 | // |
| 421 | //----------------------------------------------------------------------------- |
| 422 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 423 | |
| 424 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 425 | |
| 426 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 427 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 428 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 429 | |
| 430 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 431 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | //----------------------------------------------------------------------------- |
| 435 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 436 | // |
| 437 | // stub stub stub |
| 438 | // +-------+ +---------+ +---------+ +---------+ |
| 439 | // | xapp | | submgr | | e2term | | rtmgr | |
| 440 | // +-------+ +---------+ +---------+ +---------+ |
| 441 | // | | | | |
| 442 | // | RESTSubReq | | | |
| 443 | // |---------------->| | | |
| 444 | // | | RouteCreate | | |
| 445 | // | |--------------------------->| // The order of these events may vary |
| 446 | // | | | | |
| 447 | // | RESTSubResp | | | // The order of these events may vary |
| 448 | // |<----------------| | | |
| 449 | // | | RouteResponse| | |
| 450 | // | |<---------------------------| // The order of these events may vary |
| 451 | // | | | | |
| 452 | // | | SubReq | | |
| 453 | // | |------------->| | // The order of these events may vary |
| 454 | // | | | | |
| 455 | // | | SubResp | | |
| 456 | // | |<-------------| | |
| 457 | // | RESTNotif1 | | | |
| 458 | // |<----------------| | | |
| 459 | // | | | | |
| 460 | // | RESTSubDelReq | | | |
| 461 | // |---------------->| | | |
| 462 | // | | SubDelReq | | |
| 463 | // | |------------->| | |
| 464 | // | | | | |
| 465 | // | RESTSubDelResp| | | |
| 466 | // |<----------------| | | // The order of these events may vary |
| 467 | // | | | | |
| 468 | // | | SubDelResp | | |
| 469 | // | |<-------------| | // 1.st NOK |
| 470 | // | | | | |
| 471 | // | | SubDelReq | | |
| 472 | // | |------------->| | |
| 473 | // | | | | |
| 474 | // | | SubDelResp | | |
| 475 | // | |<-------------| | // 2.nd NOK |
| 476 | // |
| 477 | //----------------------------------------------------------------------------- |
| 478 | |
| 479 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 480 | |
| 481 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 482 | |
| 483 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 484 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 485 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 486 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 487 | |
| 488 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 489 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 490 | |
| 491 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 492 | |
| 493 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 494 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 498 | // TestSubReqAndRouteNok |
| 499 | // |
| 500 | // stub stub |
| 501 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 502 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 503 | // +-------+ +---------+ +---------+ |
| 504 | // | | | |
| 505 | // | SubReq | | |
| 506 | // |------------->| | |
| 507 | // | | | |
| 508 | // | | RouteCreate | |
| 509 | // | |------------->| |
| 510 | // | | | |
| 511 | // | | RouteCreate | |
| 512 | // | | status:400 | |
| 513 | // | |<-------------| |
| 514 | // | | | |
| 515 | // | [SUBS INT DELETE] | |
| 516 | // | | | |
| 517 | // |
| 518 | //----------------------------------------------------------------------------- |
| 519 | |
| 520 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 521 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 522 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 523 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 524 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 525 | Counter{cSubReqFromXapp, 1}, |
| 526 | Counter{cRouteCreateFail, 1}, |
| 527 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 528 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 529 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 530 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 531 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 532 | waiter.WaitResult(t) |
| 533 | |
| 534 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 535 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 536 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 537 | xappConn1.TestMsgChanEmpty(t) |
| 538 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 539 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 540 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 541 | |
| 542 | <-time.After(1 * time.Second) |
| 543 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 547 | // TestSubReqAndRouteUpdateNok |
| 548 | |
| 549 | // stub stub |
| 550 | // +-------+ +-------+ +---------+ +---------+ |
| 551 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 552 | // +-------+ +-------+ +---------+ +---------+ |
| 553 | // | | | | |
| 554 | // | [SUBS CREATE] | | |
| 555 | // | | | | |
| 556 | // | | | | |
| 557 | // | | | | |
| 558 | // | SubReq (mergeable) | | |
| 559 | // |--------------------------->| | | |
| 560 | // | | | | |
| 561 | // | | | RouteUpdate | |
| 562 | // | | |------------->| |
| 563 | // | | | | |
| 564 | // | | | RouteUpdate | |
| 565 | // | | | status:400 | |
| 566 | // | | |<-------------| |
| 567 | // | | | | |
| 568 | // | [SUBS INT DELETE] | | |
| 569 | // | | | | |
| 570 | // | | | | |
| 571 | // | [SUBS DELETE] | | |
| 572 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 573 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 574 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 575 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 576 | |
| 577 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 578 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 579 | Counter{cSubReqFromXapp, 2}, |
| 580 | Counter{cSubReqToE2, 1}, |
| 581 | Counter{cSubRespFromE2, 1}, |
| 582 | Counter{cSubRespToXapp, 1}, |
| 583 | Counter{cRouteCreateUpdateFail, 1}, |
| 584 | Counter{cSubDelReqFromXapp, 1}, |
| 585 | Counter{cSubDelReqToE2, 1}, |
| 586 | Counter{cSubDelRespFromE2, 1}, |
| 587 | Counter{cSubDelRespToXapp, 1}, |
| 588 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 589 | |
| 590 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 591 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 592 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 593 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 594 | |
| 595 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 596 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 597 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 598 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 599 | |
| 600 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 601 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 602 | xappConn2.SendSubsReq(t, nil, nil) |
| 603 | waiter.WaitResult(t) |
| 604 | |
| 605 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 606 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 607 | |
| 608 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 609 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 610 | |
| 611 | //Wait that subs is cleaned |
| 612 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 613 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 614 | |
| 615 | xappConn1.TestMsgChanEmpty(t) |
| 616 | xappConn2.TestMsgChanEmpty(t) |
| 617 | e2termConn1.TestMsgChanEmpty(t) |
| 618 | mainCtrl.wait_registry_empty(t, 10) |
| 619 | |
| 620 | mainCtrl.VerifyCounterValues(t) |
| 621 | } |
| 622 | |
| 623 | //----------------------------------------------------------------------------- |
| 624 | // TestSubDelReqAndRouteDeleteNok |
| 625 | // |
| 626 | // stub stub |
| 627 | // +-------+ +---------+ +---------+ +---------+ |
| 628 | // | xapp | | submgr | | e2term | | rtmgr | |
| 629 | // +-------+ +---------+ +---------+ +---------+ |
| 630 | // | | | | |
| 631 | // | [SUBS CREATE] | | |
| 632 | // | | | | |
| 633 | // | | | | |
| 634 | // | | | | |
| 635 | // | SubDelReq | | | |
| 636 | // |------------->| | | |
| 637 | // | | SubDelReq | | |
| 638 | // | |------------->| | |
| 639 | // | | SubDelRsp | | |
| 640 | // | |<-------------| | |
| 641 | // | SubDelRsp | | | |
| 642 | // |<-------------| | | |
| 643 | // | | RouteDelete | | |
| 644 | // | |---------------------------->| |
| 645 | // | | | | |
| 646 | // | | RouteDelete | | |
| 647 | // | | status:400 | | |
| 648 | // | |<----------------------------| |
| 649 | // | | | | |
| 650 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 651 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 652 | |
| 653 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 654 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 655 | Counter{cSubReqFromXapp, 1}, |
| 656 | Counter{cSubReqToE2, 1}, |
| 657 | Counter{cSubRespFromE2, 1}, |
| 658 | Counter{cSubRespToXapp, 1}, |
| 659 | Counter{cSubDelReqFromXapp, 1}, |
| 660 | Counter{cRouteDeleteFail, 1}, |
| 661 | Counter{cSubDelReqToE2, 1}, |
| 662 | Counter{cSubDelRespFromE2, 1}, |
| 663 | Counter{cSubDelRespToXapp, 1}, |
| 664 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 665 | |
| 666 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 667 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 668 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 669 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 670 | |
| 671 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 672 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 673 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 674 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 675 | |
| 676 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 677 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 678 | |
| 679 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 680 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 681 | waiter.WaitResult(t) |
| 682 | |
| 683 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 684 | |
| 685 | //Wait that subs is cleaned |
| 686 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 687 | |
| 688 | xappConn1.TestMsgChanEmpty(t) |
| 689 | xappConn2.TestMsgChanEmpty(t) |
| 690 | e2termConn1.TestMsgChanEmpty(t) |
| 691 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 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 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2636 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2637 | } |
| 2638 | |
| 2639 | func TestGetSymptomData(t *testing.T) { |
| 2640 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2641 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2642 | } |
| 2643 | |
| 2644 | func TestPostdeleteSubId(t *testing.T) { |
| 2645 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2646 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2647 | } |
| 2648 | |
| 2649 | func TestPostEmptyDb(t *testing.T) { |
| 2650 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2651 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 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 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2656 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2657 | } |
| 2658 | |
| 2659 | //----------------------------------------------------------------------------- |
| 2660 | // TestDelAllE2nodeSubsViaDebugIf |
| 2661 | // |
| 2662 | // stub stub stub |
| 2663 | // +-------+ +---------+ +---------+ +---------+ |
| 2664 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2665 | // +-------+ +---------+ +---------+ +---------+ |
| 2666 | // | | | | |
| 2667 | // | RESTSubReq | | | |
| 2668 | // |---------------->| | | |
| 2669 | // | RESTSubResp | | | |
| 2670 | // |<----------------| | | |
| 2671 | // | | RouteCreate | | |
| 2672 | // | |--------------------------->| |
| 2673 | // | | RouteResponse| | |
| 2674 | // | |<---------------------------| |
| 2675 | // | | SubReq | | |
| 2676 | // | |------------->| | |
| 2677 | // | | SubResp | | |
| 2678 | // | |<-------------| | |
| 2679 | // | RESTNotif1 | | | |
| 2680 | // |<----------------| | | |
| 2681 | // | | | | |
| 2682 | // | REST get_all_e2nodes | | |
| 2683 | // |---------------->| | | |
| 2684 | // | OK 200 | | | |
| 2685 | // |<----------------| | | |
| 2686 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2687 | // |---------------->| | | |
| 2688 | // | OK 200 | | | |
| 2689 | // |<----------------| | | |
| 2690 | // | | SubDelReq | | |
| 2691 | // | |------------->| | |
| 2692 | // | | SubDelResp | | |
| 2693 | // | |<-------------| | |
| 2694 | // | | | | |
| 2695 | // | | RouteDelete | | |
| 2696 | // | |--------------------------->| |
| 2697 | // | | RouteResponse| | |
| 2698 | // | |<---------------------------| |
| 2699 | // |
| 2700 | //----------------------------------------------------------------------------- |
| 2701 | |
| 2702 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2703 | |
| 2704 | // Init counter check |
| 2705 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2706 | Counter{cRestSubReqFromXapp, 1}, |
| 2707 | Counter{cRestSubRespToXapp, 1}, |
| 2708 | Counter{cSubReqToE2, 1}, |
| 2709 | Counter{cSubRespFromE2, 1}, |
| 2710 | Counter{cRestSubNotifToXapp, 1}, |
| 2711 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2712 | Counter{cSubDelReqToE2, 1}, |
| 2713 | Counter{cSubDelRespFromE2, 1}, |
| 2714 | Counter{cRestSubDelRespToXapp, 1}, |
| 2715 | }) |
| 2716 | |
| 2717 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2718 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2719 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2720 | |
| 2721 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2722 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2723 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2724 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2725 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2726 | |
| 2727 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2728 | |
| 2729 | var e2nodesList []string |
| 2730 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2731 | if err != nil { |
| 2732 | t.Errorf("Unmarshal error: %s", err) |
| 2733 | } |
| 2734 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2735 | |
| 2736 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2737 | var e2RestSubsMap map[string]RESTSubscription |
| 2738 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2739 | if err != nil { |
| 2740 | t.Errorf("Unmarshal error: %s", err) |
| 2741 | } |
| 2742 | |
| 2743 | if len(e2RestSubsMap) != 1 { |
| 2744 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2745 | } |
| 2746 | |
| 2747 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2748 | mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2749 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2750 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2751 | |
| 2752 | // Wait that subs is cleaned |
| 2753 | waitSubsCleanup(t, e2SubsId, 10) |
| 2754 | mainCtrl.VerifyCounterValues(t) |
| 2755 | mainCtrl.VerifyAllClean(t) |
| 2756 | } |
| 2757 | |
| 2758 | //----------------------------------------------------------------------------- |
| 2759 | // TestDelAllxAppSubsViaDebugIf |
| 2760 | // |
| 2761 | // stub stub stub |
| 2762 | // +-------+ +---------+ +---------+ +---------+ |
| 2763 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2764 | // +-------+ +---------+ +---------+ +---------+ |
| 2765 | // | | | | |
| 2766 | // | RESTSubReq | | | |
| 2767 | // |---------------->| | | |
| 2768 | // | RESTSubResp | | | |
| 2769 | // |<----------------| | | |
| 2770 | // | | RouteCreate | | |
| 2771 | // | |--------------------------->| |
| 2772 | // | | RouteResponse| | |
| 2773 | // | |<---------------------------| |
| 2774 | // | | SubReq | | |
| 2775 | // | |------------->| | |
| 2776 | // | | SubResp | | |
| 2777 | // | |<-------------| | |
| 2778 | // | RESTNotif1 | | | |
| 2779 | // |<----------------| | | |
| 2780 | // | | | | |
| 2781 | // | REST get_all_xapps | | |
| 2782 | // |---------------->| | | |
| 2783 | // | OK 200 | | | |
| 2784 | // |<----------------| | | |
| 2785 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 2786 | // |---------------->| | | |
| 2787 | // | OK 200 | | | |
| 2788 | // |<----------------| | | |
| 2789 | // | | SubDelReq | | |
| 2790 | // | |------------->| | |
| 2791 | // | | SubDelResp | | |
| 2792 | // | |<-------------| | |
| 2793 | // | | | | |
| 2794 | // | | RouteDelete | | |
| 2795 | // | |--------------------------->| |
| 2796 | // | | RouteResponse| | |
| 2797 | // | |<---------------------------| |
| 2798 | // |
| 2799 | //----------------------------------------------------------------------------- |
| 2800 | |
| 2801 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 2802 | |
| 2803 | // Init counter check |
| 2804 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2805 | Counter{cRestSubReqFromXapp, 1}, |
| 2806 | Counter{cRestSubRespToXapp, 1}, |
| 2807 | Counter{cSubReqToE2, 1}, |
| 2808 | Counter{cSubRespFromE2, 1}, |
| 2809 | Counter{cRestSubNotifToXapp, 1}, |
| 2810 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2811 | Counter{cSubDelReqToE2, 1}, |
| 2812 | Counter{cSubDelRespFromE2, 1}, |
| 2813 | Counter{cRestSubDelRespToXapp, 1}, |
| 2814 | }) |
| 2815 | |
| 2816 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2817 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2818 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2819 | |
| 2820 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2821 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2822 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2823 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2824 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2825 | |
| 2826 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 2827 | |
| 2828 | var xappList []string |
| 2829 | err := json.Unmarshal(xappsJson, &xappList) |
| 2830 | if err != nil { |
| 2831 | t.Errorf("Unmarshal error: %s", err) |
| 2832 | } |
| 2833 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 2834 | |
| 2835 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2836 | mainCtrl.SendDeleteRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2837 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2838 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2839 | |
| 2840 | // Wait that subs is cleaned |
| 2841 | waitSubsCleanup(t, e2SubsId, 10) |
| 2842 | mainCtrl.VerifyCounterValues(t) |
| 2843 | mainCtrl.VerifyAllClean(t) |
| 2844 | } |
| 2845 | |
| 2846 | //----------------------------------------------------------------------------- |
| 2847 | // TestDelViaxAppSubsIf |
| 2848 | // |
| 2849 | // stub stub stub |
| 2850 | // +-------+ +---------+ +---------+ +---------+ |
| 2851 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2852 | // +-------+ +---------+ +---------+ +---------+ |
| 2853 | // | | | | |
| 2854 | // | RESTSubReq | | | |
| 2855 | // |---------------->| | | |
| 2856 | // | RESTSubResp | | | |
| 2857 | // |<----------------| | | |
| 2858 | // | | RouteCreate | | |
| 2859 | // | |--------------------------->| |
| 2860 | // | | RouteResponse| | |
| 2861 | // | |<---------------------------| |
| 2862 | // | | SubReq | | |
| 2863 | // | |------------->| | |
| 2864 | // | | SubResp | | |
| 2865 | // | |<-------------| | |
| 2866 | // | RESTNotif1 | | | |
| 2867 | // |<----------------| | | |
| 2868 | // | | | | |
| 2869 | // | REST get_xapp_rest_restsubscriptions | |
| 2870 | // |---------------->| | | |
| 2871 | // | OK 200 | | | |
| 2872 | // |<----------------| | | |
| 2873 | // | RESTSudDel | | | |
| 2874 | // |---------------->| | | Via user curl command (port 8088) |
| 2875 | // | RESTSudDel | | | |
| 2876 | // |<----------------| | | |
| 2877 | // | | SubDelReq | | |
| 2878 | // | |------------->| | |
| 2879 | // | | SubDelResp | | |
| 2880 | // | |<-------------| | |
| 2881 | // | | | | |
| 2882 | // | | RouteDelete | | |
| 2883 | // | |--------------------------->| |
| 2884 | // | | RouteResponse| | |
| 2885 | // | |<---------------------------| |
| 2886 | // |
| 2887 | //----------------------------------------------------------------------------- |
| 2888 | |
| 2889 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 2890 | |
| 2891 | // Init counter check |
| 2892 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2893 | Counter{cRestSubReqFromXapp, 1}, |
| 2894 | Counter{cRestSubRespToXapp, 1}, |
| 2895 | Counter{cSubReqToE2, 1}, |
| 2896 | Counter{cSubRespFromE2, 1}, |
| 2897 | Counter{cRestSubNotifToXapp, 1}, |
| 2898 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2899 | Counter{cSubDelReqToE2, 1}, |
| 2900 | Counter{cSubDelRespFromE2, 1}, |
| 2901 | Counter{cRestSubDelRespToXapp, 1}, |
| 2902 | }) |
| 2903 | |
| 2904 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2905 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2906 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2907 | |
| 2908 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2909 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2910 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2911 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2912 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2913 | |
| 2914 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 2915 | |
| 2916 | var restSubsMap map[string]RESTSubscription |
| 2917 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 2918 | if err != nil { |
| 2919 | t.Errorf("Unmarshal error: %s", err) |
| 2920 | } |
| 2921 | _, ok := restSubsMap[restSubId] |
| 2922 | if !ok { |
| 2923 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 2924 | } |
| 2925 | |
| 2926 | var e2Subscriptions []Subscription |
| 2927 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 2928 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 2929 | if err != nil { |
| 2930 | t.Errorf("Unmarshal error: %s", err) |
| 2931 | } |
| 2932 | if len(e2Subscriptions) != 1 { |
| 2933 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 2934 | } |
| 2935 | |
| 2936 | // Simulate deletion through xapp REST test interface |
| 2937 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 2938 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2939 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2940 | |
| 2941 | // Wait that subs is cleaned |
| 2942 | waitSubsCleanup(t, e2SubsId, 10) |
| 2943 | mainCtrl.VerifyCounterValues(t) |
| 2944 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2945 | } |
| 2946 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2947 | //----------------------------------------------------------------------------- |
| 2948 | // TestRESTSubReqAndRouteNok |
| 2949 | // |
| 2950 | // stub stub |
| 2951 | // +-------+ +---------+ +---------+ |
| 2952 | // | xapp | | submgr | | rtmgr | |
| 2953 | // +-------+ +---------+ +---------+ |
| 2954 | // | | | |
| 2955 | // | RESTSubReq | | |
| 2956 | // |---------------->| | |
| 2957 | // | | | |
| 2958 | // | RESTSubResp | | |
| 2959 | // |<----------------| | |
| 2960 | // | | RouteCreate | |
| 2961 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2962 | // | | RouteCreate | |
| 2963 | // | | status:400 | |
| 2964 | // | |(Bad request) | |
| 2965 | // | |<-------------| |
| 2966 | // | RESTNotif | | |
| 2967 | // |<----------------| | |
| 2968 | // | | | |
| 2969 | // | [SUBS INT DELETE] | |
| 2970 | // | | | |
| 2971 | // | RESTSubDelReq | | |
| 2972 | // |---------------->| | |
| 2973 | // | RESTSubDelResp | | |
| 2974 | // |<----------------| | |
| 2975 | // |
| 2976 | //----------------------------------------------------------------------------- |
| 2977 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2978 | |
| 2979 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2980 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2981 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2982 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2983 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2984 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2985 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2986 | }) |
| 2987 | |
| 2988 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2989 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2990 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2991 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2992 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2993 | |
| 2994 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2995 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2996 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2997 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2998 | waiter.WaitResult(t) |
| 2999 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3000 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3001 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3002 | |
| 3003 | // Del |
| 3004 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3005 | |
| 3006 | // Wait that subs is cleaned |
| 3007 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3008 | waitSubsCleanup(t, e2SubsId, 10) |
| 3009 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3010 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3011 | } |
| 3012 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3013 | //----------------------------------------------------------------------------- |
| 3014 | // TestRESTSubReqAndRouteUpdateNok |
| 3015 | // |
| 3016 | // stub stub stub stub |
| 3017 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3018 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3019 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3020 | // | | | | | |
| 3021 | // | RESTSubReq1 | | | |
| 3022 | // |------------------------>| | | |
| 3023 | // | RESTSubResp2 | | | |
| 3024 | // |<------------------------| | | |
| 3025 | // | | | | | |
| 3026 | // | | | RouteCreate | | |
| 3027 | // | | |------------->| | |
| 3028 | // | | | CreateResp | | |
| 3029 | // | | |<-------------| | |
| 3030 | // | | | SubReq | | |
| 3031 | // | | |---------------------------->| |
| 3032 | // | | | SubResp | | |
| 3033 | // | | |<----------------------------| |
| 3034 | // | RESTNotif1 | | | |
| 3035 | // |<------------------------| | | |
| 3036 | // | | | | | |
| 3037 | // | | RESTSubReq2 | | | |
| 3038 | // | |------------>| | | |
| 3039 | // | | RESTSubResp2| | | |
| 3040 | // | |<------------| | | |
| 3041 | // | | | RouteUpdate | | |
| 3042 | // | | |------------->| | |
| 3043 | // | | | RouteUpdate | | |
| 3044 | // | | | status:400 | | |
| 3045 | // | | |(Bad request) | | |
| 3046 | // | | |<-------------| | |
| 3047 | // | | RESTNotif2(unsuccessful) | | |
| 3048 | // | |<------------| | | |
| 3049 | // | | | | | |
| 3050 | // | [SUBS INT DELETE] | | |
| 3051 | // | | | | | |
| 3052 | // | RESTSubDelReq1 | | | |
| 3053 | // |------------------------>| | | |
| 3054 | // | RESTSubDelResp1 | | | |
| 3055 | // |<------------------------| | | |
| 3056 | // | | | | | |
| 3057 | // | | | [SUBS DELETE] | |
| 3058 | // |
| 3059 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3060 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3061 | |
| 3062 | //Init counter check |
| 3063 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3064 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3065 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3066 | Counter{cSubReqToE2, 1}, |
| 3067 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3068 | Counter{cRestSubNotifToXapp, 1}, |
| 3069 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3070 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3071 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3072 | Counter{cSubDelReqToE2, 1}, |
| 3073 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3074 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3075 | }) |
| 3076 | |
| 3077 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3078 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3079 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3080 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3081 | |
| 3082 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3083 | |
| 3084 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3085 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3086 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3087 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3088 | params.SetMeid("RAN_NAME_1") |
| 3089 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3090 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3091 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3092 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3093 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3094 | |
| 3095 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3096 | |
| 3097 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3098 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3099 | |
| 3100 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3101 | //Wait that subs is cleaned |
| 3102 | waitSubsCleanup(t, e2SubsId, 10) |
| 3103 | |
| 3104 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3105 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3106 | } |
| 3107 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3108 | //----------------------------------------------------------------------------- |
| 3109 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3110 | // |
| 3111 | // stub stub stub |
| 3112 | // +-------+ +---------+ +---------+ +---------+ |
| 3113 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3114 | // +-------+ +---------+ +---------+ +---------+ |
| 3115 | // | | | | |
| 3116 | // | RESTSubReq | | | |
| 3117 | // |---------------->| | | |
| 3118 | // | | | | |
| 3119 | // | RESTSubResp | | | |
| 3120 | // |<----------------| | | |
| 3121 | // | | SubReq | | |
| 3122 | // | |---------------------------->| |
| 3123 | // | | SubResp | | |
| 3124 | // | |<----------------------------| |
| 3125 | // | RESTNotif | | | |
| 3126 | // |<----------------| | | |
| 3127 | // | | | | |
| 3128 | // | | | | |
| 3129 | // | RESTSubDelReq | | | |
| 3130 | // |---------------->| | | |
| 3131 | // | RESTSubDelResp | | | |
| 3132 | // |<----------------| | | |
| 3133 | // | | SubSelReq | | |
| 3134 | // | |---------------------------->| |
| 3135 | // | | SubSelResp | | |
| 3136 | // | |<----------------------------| |
| 3137 | // | | RouteDelete | | |
| 3138 | // | |------------->| | |
| 3139 | // | | Routedelete | | |
| 3140 | // | | status:400 | | |
| 3141 | // | |(Bad request) | | |
| 3142 | // | |<-------------| | |
| 3143 | // |
| 3144 | //----------------------------------------------------------------------------- |
| 3145 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3146 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3147 | |
| 3148 | // Init counter check |
| 3149 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3150 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3151 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3152 | Counter{cSubReqToE2, 1}, |
| 3153 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3154 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3155 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3156 | Counter{cRouteDeleteFail, 1}, |
| 3157 | Counter{cSubDelReqToE2, 1}, |
| 3158 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3159 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3160 | }) |
| 3161 | |
| 3162 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3163 | |
| 3164 | //Subs Create |
| 3165 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3166 | |
| 3167 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3168 | |
| 3169 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3170 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3171 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3172 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3173 | waiter.WaitResult(t) |
| 3174 | |
| 3175 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3176 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3177 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3178 | } |
| 3179 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3180 | //----------------------------------------------------------------------------- |
| 3181 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3182 | // |
| 3183 | // stub stub stub stub |
| 3184 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3185 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3186 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3187 | // | | | | | |
| 3188 | // | RESTSubReq1 | | | |
| 3189 | // |------------------------>| | | |
| 3190 | // | RESTSubResp2 | | | |
| 3191 | // |<------------------------| | | |
| 3192 | // | | | | | |
| 3193 | // | | | RouteCreate | | |
| 3194 | // | | |------------->| | |
| 3195 | // | | | CreateResp | | |
| 3196 | // | | |<-------------| | |
| 3197 | // | | | SubReq | | |
| 3198 | // | | |---------------------------->| |
| 3199 | // | | | SubResp | | |
| 3200 | // | | |<----------------------------| |
| 3201 | // | RESTNotif1 | | | |
| 3202 | // |<------------------------| | | |
| 3203 | // | | | | | |
| 3204 | // | | RESTSubReq2 | | | |
| 3205 | // | |------------>| | | |
| 3206 | // | | RESTSubResp2| | | |
| 3207 | // | |<------------| | | |
| 3208 | // | | | RouteCreate | | |
| 3209 | // | | |------------->| | |
| 3210 | // | | | CreateResp | | |
| 3211 | // | | |<-------------| | |
| 3212 | // | | | SubReq | | |
| 3213 | // | | |---------------------------->| |
| 3214 | // | | | SubResp | | |
| 3215 | // | | |<----------------------------| |
| 3216 | // | | RESTNotif2 | | | |
| 3217 | // | |<------------| | | |
| 3218 | // | | | | | |
| 3219 | // | [SUBS INT DELETE] | | |
| 3220 | // | | | | | |
| 3221 | // | RESTSubDelReq1 | | | |
| 3222 | // |------------------------>| | | |
| 3223 | // | RESTSubDelResp1 | | | |
| 3224 | // |<------------------------| | | |
| 3225 | // | | | SubDelReq | | |
| 3226 | // | | |---------------------------->| |
| 3227 | // | | | SubDelResp | | |
| 3228 | // | | |<----------------------------| |
| 3229 | // | | | RouteUpdate | | |
| 3230 | // | | |------------->| | |
| 3231 | // | | | RouteUpdate | | |
| 3232 | // | | | status:400 | | |
| 3233 | // | | |(Bad request) | | |
| 3234 | // | | |<-------------| | |
| 3235 | // | | | | | |
| 3236 | // | | RESTSubDelReq2 | | |
| 3237 | // | |------------>| | | |
| 3238 | // | | RESTSubDelResp2 | | |
| 3239 | // | |<------------| | | |
| 3240 | // | | | SubDelReq | | |
| 3241 | // | | |---------------------------->| |
| 3242 | // | | | SubdelResp | | |
| 3243 | // | | |<----------------------------| |
| 3244 | // | | | RouteDelete | | |
| 3245 | // | | |------------->| | |
| 3246 | // | | | Deleteresp | | |
| 3247 | // | | |<-------------| | |
| 3248 | |
| 3249 | //----------------------------------------------------------------------------- |
| 3250 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3251 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3252 | |
| 3253 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3254 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3255 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3256 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3257 | Counter{cSubReqToE2, 1}, |
| 3258 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3259 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3260 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3261 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3262 | Counter{cSubDelReqToE2, 1}, |
| 3263 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3264 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3265 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3266 | }) |
| 3267 | |
| 3268 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3269 | |
| 3270 | //Subs Create |
| 3271 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3272 | |
| 3273 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3274 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3275 | |
| 3276 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3277 | |
| 3278 | //Del1, this shall fail on rtmgr side |
| 3279 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3280 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3281 | waiter.WaitResult(t) |
| 3282 | |
| 3283 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3284 | |
| 3285 | //Del2 |
| 3286 | deleteXapp2Subscription(t, &restSubId2) |
| 3287 | |
| 3288 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3289 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3290 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3291 | } |
| 3292 | |
| 3293 | //----------------------------------------------------------------------------- |
| 3294 | // TestRESTSubReqRetransmission |
| 3295 | // |
| 3296 | // stub stub |
| 3297 | // +-------+ +---------+ +---------+ |
| 3298 | // | xapp | | submgr | | e2term | |
| 3299 | // +-------+ +---------+ +---------+ |
| 3300 | // | | | |
| 3301 | // | RESTSubReq1 | | |
| 3302 | // |---------------->| | |
| 3303 | // | | | |
| 3304 | // | RESTSubResp | | |
| 3305 | // |<----------------| | |
| 3306 | // | | SubReq1 | |
| 3307 | // | |------------->| |
| 3308 | // | | | |
| 3309 | // | RESTSubReq2 | | |
| 3310 | // | (retrans) | | |
| 3311 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3312 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3313 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3314 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3315 | // | | SubResp1 | |
| 3316 | // | |<-------------| |
| 3317 | // | RESTNotif1 | | |
| 3318 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3319 | // | | | |
| 3320 | // | [SUBS DELETE] | |
| 3321 | // | | | |
| 3322 | // |
| 3323 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3324 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3325 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | |
| 3327 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3328 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3329 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3330 | Counter{cSubReqToE2, 1}, |
| 3331 | Counter{cSubRespFromE2, 1}, |
| 3332 | Counter{cRestSubNotifToXapp, 1}, |
| 3333 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3334 | Counter{cSubDelReqToE2, 1}, |
| 3335 | Counter{cSubDelRespFromE2, 1}, |
| 3336 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3337 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3338 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3339 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3340 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3341 | |
| 3342 | // Subs Create |
| 3343 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3344 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3345 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3346 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3347 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3348 | xappConn1.SendRESTSubsReq(t, params) |
| 3349 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3350 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3351 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3352 | |
| 3353 | // 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] | 3354 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3355 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3356 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3357 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3358 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3359 | |
| 3360 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3361 | |
| 3362 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3363 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3364 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3365 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3366 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3367 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3368 | |
| 3369 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3370 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3371 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3372 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3373 | //----------------------------------------------------------------------------- |
| 3374 | // stub stub stub |
| 3375 | // +-------+ +---------+ +---------+ +---------+ |
| 3376 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3377 | // +-------+ +---------+ +---------+ +---------+ |
| 3378 | // | | | | |
| 3379 | // | RESTSubReq | | | |
| 3380 | // |---------------->| | | |
| 3381 | // | RESTSubResp | | | |
| 3382 | // |<----------------| | | |
| 3383 | // | | RouteCreate | | |
| 3384 | // | |--------------------------->| |
| 3385 | // | | RouteResponse| | |
| 3386 | // | |<---------------------------| // The order of these events may vary |
| 3387 | // | | SubReq | | |
| 3388 | // | |------------->| | // The order of these events may vary |
| 3389 | // | | SubResp | | |
| 3390 | // | |<-------------| | |
| 3391 | // | RESTNotif1 | | | |
| 3392 | // |<----------------| | | |
| 3393 | // | RESTSubReq | | | |
| 3394 | // | [RETRANS1] | | | |
| 3395 | // |---------------->| | | |
| 3396 | // | RESTNotif1 | | | |
| 3397 | // |<----------------| | | |
| 3398 | // | RESTSubReq | | | |
| 3399 | // | [RETRANS2] | | | |
| 3400 | // |---------------->| | | |
| 3401 | // | RESTNotif1 | | | |
| 3402 | // |<----------------| | | |
| 3403 | // | RESTSubDelReq | | | |
| 3404 | // |---------------->| | | |
| 3405 | // | | SubDelReq | | |
| 3406 | // | |------------->| | |
| 3407 | // | RESTSubDelResp| | | |
| 3408 | // |<----------------| | | |
| 3409 | // | | SubDelResp | | |
| 3410 | // | |<-------------| | |
| 3411 | // | | | | |
| 3412 | // |
| 3413 | //----------------------------------------------------------------------------- |
| 3414 | |
| 3415 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3416 | |
| 3417 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3418 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3419 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3420 | Counter{cRestSubRespToXapp, 3}, |
| 3421 | Counter{cSubReqToE2, 1}, |
| 3422 | Counter{cSubRespFromE2, 1}, |
| 3423 | Counter{cRestSubNotifToXapp, 3}, |
| 3424 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3425 | Counter{cSubDelReqToE2, 1}, |
| 3426 | Counter{cSubDelRespFromE2, 1}, |
| 3427 | Counter{cRestSubDelRespToXapp, 1}, |
| 3428 | }) |
| 3429 | |
| 3430 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3431 | |
| 3432 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3433 | |
| 3434 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3435 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3436 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3437 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3438 | //1.st resend |
| 3439 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3440 | |
| 3441 | assert.Equal(t, restSubId_resend, restSubId) |
| 3442 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3443 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3444 | |
| 3445 | //2.nd resend |
| 3446 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3447 | |
| 3448 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3449 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3450 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3451 | |
| 3452 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3453 | |
| 3454 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3455 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3456 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | //----------------------------------------------------------------------------- |
| 3460 | // stub stub stub |
| 3461 | // +-------+ +---------+ +---------+ +---------+ |
| 3462 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3463 | // +-------+ +---------+ +---------+ +---------+ |
| 3464 | // | | | | |
| 3465 | // | RESTSubReq | | | |
| 3466 | // |---------------->| | | |
| 3467 | // | RESTSubResp | | | |
| 3468 | // |<----------------| | | |
| 3469 | // | | RouteCreate | | |
| 3470 | // | |--------------------------->| |
| 3471 | // | | RouteResponse| | |
| 3472 | // | |<---------------------------| // The order of these events may vary |
| 3473 | // | | SubReq | | |
| 3474 | // | |------------->| | // The order of these events may vary |
| 3475 | // | | SubResp | | |
| 3476 | // | |<-------------| | |
| 3477 | // | RESTNotif1 | | | |
| 3478 | // |<----------------| | | |
| 3479 | // | RESTSubReq | | | |
| 3480 | // | [RETRANS, with RESTsubsId] | | |
| 3481 | // |---------------->| | | |
| 3482 | // | RESTNotif1 | | | |
| 3483 | // |<----------------| | | |
| 3484 | // | RESTSubReq | | | |
| 3485 | // | [RETRANS, without RESTsubsId] | | |
| 3486 | // |---------------->| | | |
| 3487 | // | RESTNotif1 | | | |
| 3488 | // |<----------------| | | |
| 3489 | // | RESTSubDelReq | | | |
| 3490 | // |---------------->| | | |
| 3491 | // | | SubDelReq | | |
| 3492 | // | |------------->| | |
| 3493 | // | RESTSubDelResp| | | |
| 3494 | // |<----------------| | | |
| 3495 | // | | SubDelResp | | |
| 3496 | // | |<-------------| | |
| 3497 | // | | | | |
| 3498 | // |
| 3499 | //----------------------------------------------------------------------------- |
| 3500 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3501 | |
| 3502 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3503 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3504 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3505 | Counter{cRestSubRespToXapp, 3}, |
| 3506 | Counter{cSubReqToE2, 1}, |
| 3507 | Counter{cSubRespFromE2, 1}, |
| 3508 | Counter{cRestSubNotifToXapp, 3}, |
| 3509 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3510 | Counter{cSubDelReqToE2, 1}, |
| 3511 | Counter{cSubDelRespFromE2, 1}, |
| 3512 | Counter{cRestSubDelRespToXapp, 1}, |
| 3513 | }) |
| 3514 | |
| 3515 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3516 | |
| 3517 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3518 | |
| 3519 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3520 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3521 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3522 | |
| 3523 | //1.st resend with subscription ID |
| 3524 | params.SetSubscriptionID(&restSubId) |
| 3525 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3526 | |
| 3527 | assert.Equal(t, restSubId_resend, restSubId) |
| 3528 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3529 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3530 | |
| 3531 | //2.nd resend without subscription ID (faking app restart) |
| 3532 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3533 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3534 | |
| 3535 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3536 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3537 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3538 | |
| 3539 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3540 | |
| 3541 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3542 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3543 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3544 | } |
| 3545 | |
| 3546 | //----------------------------------------------------------------------------- |
| 3547 | // stub stub stub |
| 3548 | // +-------+ +---------+ +---------+ +---------+ |
| 3549 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3550 | // +-------+ +---------+ +---------+ +---------+ |
| 3551 | // | | | | |
| 3552 | // | RESTSubReq | | | |
| 3553 | // |---------------->| | | |
| 3554 | // | RESTSubResp | | | |
| 3555 | // |<----------------| | | |
| 3556 | // | | RouteCreate | | |
| 3557 | // | |--------------------------->| |
| 3558 | // | | RouteResponse| | |
| 3559 | // | |<---------------------------| |
| 3560 | // | | SubReq | | |
| 3561 | // | |------------->| | |
| 3562 | // | | SubResp | | |
| 3563 | // | |<-------------| | |
| 3564 | // | RESTNotif1 | | | |
| 3565 | // |<----------------| | | |
| 3566 | // | RESTSubReq | | | |
| 3567 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3568 | // |---------------->| | | |
| 3569 | // | RESTNotif1 | | | |
| 3570 | // | [for initial e2 subDetail] | | |
| 3571 | // |<----------------| | | |
| 3572 | // | | RouteCreate | | |
| 3573 | // | |--------------------------->| |
| 3574 | // | | RouteResponse| | |
| 3575 | // | |<---------------------------| |
| 3576 | // | | SubReq | | |
| 3577 | // | |------------->| | |
| 3578 | // | | SubResp | | |
| 3579 | // | |<-------------| | |
| 3580 | // | RESTNotif1 | | | |
| 3581 | // |<----------------| | | |
| 3582 | // | RESTSubReq | | | |
| 3583 | // | [with RESTsubsId initial request] | |
| 3584 | // |---------------->| | | |
| 3585 | // | RESTNotif1 | | | |
| 3586 | // |<----------------| | | |
| 3587 | // | RESTSubDelReq | | | |
| 3588 | // |---------------->| | | |
| 3589 | // | RESTSubDelResp| | | |
| 3590 | // |<----------------| | | |
| 3591 | // | | SubDelReq | | |
| 3592 | // | |------------->| | |
| 3593 | // | | SubDelResp | | |
| 3594 | // | |<-------------| | |
| 3595 | // | | SubDelReq | | |
| 3596 | // | |------------->| | |
| 3597 | // | | SubDelResp | | |
| 3598 | // | |<-------------| | |
| 3599 | // | | | | |
| 3600 | // |
| 3601 | //----------------------------------------------------------------------------- |
| 3602 | |
| 3603 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3604 | |
| 3605 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3606 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3607 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3608 | Counter{cRestSubRespToXapp, 3}, |
| 3609 | Counter{cSubReqToE2, 2}, |
| 3610 | Counter{cSubRespFromE2, 2}, |
| 3611 | Counter{cRestSubNotifToXapp, 4}, |
| 3612 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3613 | Counter{cSubDelReqToE2, 2}, |
| 3614 | Counter{cSubDelRespFromE2, 2}, |
| 3615 | Counter{cRestSubDelRespToXapp, 1}, |
| 3616 | }) |
| 3617 | |
| 3618 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3619 | |
| 3620 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3621 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3622 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3623 | |
| 3624 | // Send modified requst, this time with e2 subscriptions. |
| 3625 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3626 | params2.SetSubscriptionID(&restSubId) |
| 3627 | |
| 3628 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3629 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3630 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3631 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3632 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3633 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3634 | |
| 3635 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3636 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3637 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3638 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3639 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3640 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3641 | assert.NotEqual(t, e2SubsId2, 0) |
| 3642 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3643 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3644 | |
| 3645 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3646 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3647 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3648 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3649 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3650 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3651 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3652 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3653 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3654 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3655 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3656 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3657 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3658 | // Delete both e2 subscriptions |
| 3659 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3660 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3661 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3662 | |
| 3663 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3664 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3665 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3666 | } |
| 3667 | |
| 3668 | //----------------------------------------------------------------------------- |
| 3669 | // stub stub stub |
| 3670 | // +-------+ +---------+ +---------+ +---------+ |
| 3671 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3672 | // +-------+ +---------+ +---------+ +---------+ |
| 3673 | // | | | | |
| 3674 | // | RESTSubReq | | | |
| 3675 | // |---------------->| | | |
| 3676 | // | RESTSubResp | | | |
| 3677 | // |<----------------| | | |
| 3678 | // | | RouteCreate | | |
| 3679 | // | |--------------------------->| |
| 3680 | // | | RouteResponse| | |
| 3681 | // | |<---------------------------| |
| 3682 | // | | SubReq | | |
| 3683 | // | |------------->| | |
| 3684 | // | | SubResp | | |
| 3685 | // | |<-------------| | |
| 3686 | // | RESTNotif1 | | | |
| 3687 | // |<----------------| | | |
| 3688 | // | RESTSubReq | | | |
| 3689 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3690 | // |---------------->| | | |
| 3691 | // | RESTNotif1 | | | |
| 3692 | // | [for initial e2 subDetail] | | |
| 3693 | // |<----------------| | | |
| 3694 | // | | RouteCreate | | |
| 3695 | // | |--------------------------->| |
| 3696 | // | | RouteResponse| | |
| 3697 | // | |<---------------------------| |
| 3698 | // | | SubReq | | |
| 3699 | // | |------------->| | |
| 3700 | // | | SubResp | | |
| 3701 | // | |<-------------| | |
| 3702 | // | RESTNotif1 | | | |
| 3703 | // |<----------------| | | |
| 3704 | // | RESTSubReq | | | |
| 3705 | // | [without RESTsubsId initial request] | |
| 3706 | // |---------------->| | | |
| 3707 | // | RESTNotif1 | | | |
| 3708 | // |<----------------| | | |
| 3709 | // | RESTSubDelReq | | | |
| 3710 | // |---------------->| | | |
| 3711 | // | RESTSubDelResp| | | |
| 3712 | // |<----------------| | | |
| 3713 | // | | SubDelReq | | |
| 3714 | // | |------------->| | |
| 3715 | // | | SubDelResp | | |
| 3716 | // | |<-------------| | |
| 3717 | // | | SubDelReq | | |
| 3718 | // | |------------->| | |
| 3719 | // | | SubDelResp | | |
| 3720 | // | |<-------------| | |
| 3721 | // | | | | |
| 3722 | // |
| 3723 | //----------------------------------------------------------------------------- |
| 3724 | |
| 3725 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3726 | |
| 3727 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3728 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3729 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3730 | Counter{cRestSubRespToXapp, 3}, |
| 3731 | Counter{cSubReqToE2, 2}, |
| 3732 | Counter{cSubRespFromE2, 2}, |
| 3733 | Counter{cRestSubNotifToXapp, 4}, |
| 3734 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3735 | Counter{cSubDelReqToE2, 2}, |
| 3736 | Counter{cSubDelRespFromE2, 2}, |
| 3737 | Counter{cRestSubDelRespToXapp, 1}, |
| 3738 | }) |
| 3739 | |
| 3740 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3741 | |
| 3742 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3743 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3744 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3745 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3746 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3747 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3748 | params2.SetSubscriptionID(&restSubId) |
| 3749 | |
| 3750 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3751 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3752 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3753 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3754 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3755 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3756 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3757 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3758 | xappConn1.DecrementRequestCount() |
| 3759 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3760 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3761 | |
| 3762 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3763 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3764 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3765 | assert.NotEqual(t, e2SubsId2, 0) |
| 3766 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3767 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3768 | |
| 3769 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3770 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3771 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3772 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3773 | // md5sum shall find the original request |
| 3774 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3775 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3776 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3777 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3778 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3779 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3780 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3781 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3782 | // Delete both e2 subscriptions |
| 3783 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3784 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3785 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3786 | |
| 3787 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3788 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3789 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3790 | } |
| 3791 | |
| 3792 | //----------------------------------------------------------------------------- |
| 3793 | // stub stub stub |
| 3794 | // +-------+ +---------+ +---------+ +---------+ |
| 3795 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3796 | // +-------+ +---------+ +---------+ +---------+ |
| 3797 | // | | | | |
| 3798 | // | RESTSubReq | | | |
| 3799 | // |---------------->| | | |
| 3800 | // | RESTSubResp | | | |
| 3801 | // |<----------------| | | |
| 3802 | // | | RouteCreate | | |
| 3803 | // | |--------------------------->| |
| 3804 | // | | RouteResponse| | |
| 3805 | // | |<---------------------------| |
| 3806 | // | | SubReq | | |
| 3807 | // | |------------->| | |
| 3808 | // | | SubResp | | |
| 3809 | // | |<-------------| | |
| 3810 | // | RESTNotif1 | | | |
| 3811 | // |<----------------| | | |
| 3812 | // | RESTSubReq | | | |
| 3813 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3814 | // |---------------->| | | |
| 3815 | // | RESTNotif1 | | | |
| 3816 | // | [for initial e2 subDetail] | | |
| 3817 | // |<----------------| | | |
| 3818 | // | | RouteCreate | | |
| 3819 | // | |--------------------------->| |
| 3820 | // | | RouteResponse| | |
| 3821 | // | |<---------------------------| |
| 3822 | // | | SubReq | | |
| 3823 | // | |------------->| | |
| 3824 | // | | SubResp | | |
| 3825 | // | |<-------------| | |
| 3826 | // | RESTNotif1 | | | |
| 3827 | // |<----------------| | | |
| 3828 | // | RESTSubDelReq | | | |
| 3829 | // |---------------->| | | |
| 3830 | // | RESTSubDelResp| | | |
| 3831 | // |<----------------| | | |
| 3832 | // | | SubDelReq | | |
| 3833 | // | |------------->| | |
| 3834 | // | | SubDelResp | | |
| 3835 | // | |<-------------| | |
| 3836 | // | | SubDelReq | | |
| 3837 | // | |------------->| | |
| 3838 | // | | SubDelResp | | |
| 3839 | // | |<-------------| | |
| 3840 | // | RESTSubReq | | | |
| 3841 | // | [with RESTsubsId initial request] | |
| 3842 | // |---------------->| | | |
| 3843 | // | RESTSubResp | | | |
| 3844 | // |<----------------| | | |
| 3845 | // | | RouteCreate | | |
| 3846 | // | |--------------------------->| |
| 3847 | // | | RouteResponse| | |
| 3848 | // | |<---------------------------| |
| 3849 | // | | SubReq | | |
| 3850 | // | |------------->| | |
| 3851 | // | | SubResp | | |
| 3852 | // | |<-------------| | |
| 3853 | // | RESTNotif1 | | | |
| 3854 | // |<----------------| | | |
| 3855 | // | | | | |
| 3856 | // |
| 3857 | //----------------------------------------------------------------------------- |
| 3858 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3859 | |
| 3860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3861 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3862 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3863 | Counter{cRestSubRespToXapp, 3}, |
| 3864 | Counter{cSubReqToE2, 3}, |
| 3865 | Counter{cSubRespFromE2, 3}, |
| 3866 | Counter{cRestSubNotifToXapp, 4}, |
| 3867 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3868 | Counter{cSubDelReqToE2, 3}, |
| 3869 | Counter{cSubDelRespFromE2, 3}, |
| 3870 | Counter{cRestSubDelRespToXapp, 2}, |
| 3871 | }) |
| 3872 | |
| 3873 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3874 | |
| 3875 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3876 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3877 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3878 | |
| 3879 | // Send modified requst, this time with e2 subscriptions. |
| 3880 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3881 | params2.SetSubscriptionID(&restSubId) |
| 3882 | |
| 3883 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3884 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3885 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3886 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3887 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3888 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3889 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3890 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3891 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3892 | |
| 3893 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3894 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3895 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3896 | assert.NotEqual(t, e2SubsId2, 0) |
| 3897 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3898 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3899 | |
| 3900 | // Delete both e2 subscriptions |
| 3901 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3902 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3903 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3904 | |
| 3905 | waitSubsCleanup(t, e2SubsId, 10) |
| 3906 | |
| 3907 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3908 | // but the restsubscription has been already removed. This shall trigger a |
| 3909 | // fresh create. |
| 3910 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3911 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3912 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3913 | |
| 3914 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3915 | |
| 3916 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3917 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3918 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3919 | } |
| 3920 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3921 | //----------------------------------------------------------------------------- |
| 3922 | // TestRESTSubDelReqRetransmission |
| 3923 | // |
| 3924 | // stub stub |
| 3925 | // +-------+ +---------+ +---------+ |
| 3926 | // | xapp | | submgr | | e2term | |
| 3927 | // +-------+ +---------+ +---------+ |
| 3928 | // | | | |
| 3929 | // | RESTSubReq | | |
| 3930 | // |---------------->| | |
| 3931 | // | | | |
| 3932 | // | RESTSubResp | | |
| 3933 | // |<----------------| | |
| 3934 | // | | SubReq | |
| 3935 | // | |------------->| |
| 3936 | // | | SubResp | |
| 3937 | // | |<-------------| |
| 3938 | // | RESTNotif1 | | |
| 3939 | // |<----------------| | |
| 3940 | // | | | |
| 3941 | // | RESTSubDelReq | | |
| 3942 | // |---------------->| | |
| 3943 | // | RESTSubDelResp | | |
| 3944 | // |<----------------| | |
| 3945 | // | | SubDelReq | |
| 3946 | // | |------------->| |
| 3947 | // | RESTSubDelReq | | |
| 3948 | // |---------------->| | |
| 3949 | // | RESTSubDelResp | | |
| 3950 | // |<----------------| | |
| 3951 | // | | SubDelResp | |
| 3952 | // | |<-------------| |
| 3953 | // | | | |
| 3954 | // |
| 3955 | //----------------------------------------------------------------------------- |
| 3956 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3957 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3958 | |
| 3959 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3960 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3961 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3962 | Counter{cSubReqToE2, 1}, |
| 3963 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3964 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3965 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3966 | Counter{cSubDelReqToE2, 1}, |
| 3967 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3968 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3969 | }) |
| 3970 | |
| 3971 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3972 | |
| 3973 | //Subs Create |
| 3974 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3975 | |
| 3976 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3977 | |
| 3978 | //Subs Delete |
| 3979 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3980 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3981 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3982 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3983 | seqBef := mainCtrl.get_msgcounter(t) |
| 3984 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3985 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3986 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3987 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3988 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3989 | |
| 3990 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3991 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3992 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3993 | } |
| 3994 | |
| 3995 | //----------------------------------------------------------------------------- |
| 3996 | // TestRESTSubReqDelReq |
| 3997 | // |
| 3998 | // stub stub |
| 3999 | // +-------+ +---------+ +---------+ |
| 4000 | // | xapp | | submgr | | e2term | |
| 4001 | // +-------+ +---------+ +---------+ |
| 4002 | // | | | |
| 4003 | // | RESTSubReq | | |
| 4004 | // |---------------->| | |
| 4005 | // | | | |
| 4006 | // | RESTSubResp | | |
| 4007 | // |<----------------| | |
| 4008 | // | | SubReq | |
| 4009 | // | |------------->| |
| 4010 | // | RESTSubDelReq | | |
| 4011 | // |---------------->| | |
| 4012 | // | RESTSubDelResp | | |
| 4013 | // | unsuccess | | |
| 4014 | // |<----------------| | |
| 4015 | // | | SubResp | |
| 4016 | // | |<-------------| |
| 4017 | // | RESTNotif1 | | |
| 4018 | // |<----------------| | |
| 4019 | // | | | |
| 4020 | // | [SUBS DELETE] | |
| 4021 | // | | | |
| 4022 | // |
| 4023 | //----------------------------------------------------------------------------- |
| 4024 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4025 | |
| 4026 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4027 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4028 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4029 | Counter{cSubReqToE2, 1}, |
| 4030 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4031 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4032 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4033 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4034 | Counter{cSubDelReqToE2, 1}, |
| 4035 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4036 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4037 | }) |
| 4038 | |
| 4039 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4040 | |
| 4041 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4042 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4043 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4044 | |
| 4045 | // Del. This will fail as processing of the subscription |
| 4046 | // is still ongoing in submgr. Deletion is not allowed before |
| 4047 | // subscription creation has been completed. |
| 4048 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4049 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4050 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4051 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4052 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4053 | |
| 4054 | // Retry del |
| 4055 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4056 | |
| 4057 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4059 | |
| 4060 | // Wait that subs is cleaned |
| 4061 | waitSubsCleanup(t, e2SubsId, 10) |
| 4062 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4063 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | } |
| 4065 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4066 | //----------------------------------------------------------------------------- |
| 4067 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4068 | // |
| 4069 | // stub stub stub |
| 4070 | // +-------+ +-------+ +---------+ +---------+ |
| 4071 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4072 | // +-------+ +-------+ +---------+ +---------+ |
| 4073 | // | | | | |
| 4074 | // | | RESTSubReq1 | | |
| 4075 | // | |------------->| | |
| 4076 | // | | RESTSubResp1 | | |
| 4077 | // | |<-------------| | |
| 4078 | // | | | | |
| 4079 | // | | | SubReq1 | |
| 4080 | // | | |------------->| |
| 4081 | // | | | | |
| 4082 | // | RESTSubReq2 | | |
| 4083 | // |------------------------>| | |
| 4084 | // | RESTSubResp2 | | |
| 4085 | // |<------------------------| | |
| 4086 | // | | | | |
| 4087 | // | | | SubReq2 | |
| 4088 | // | | |------------->| |
| 4089 | // | | | | |
| 4090 | // | | | SubResp1 | |
| 4091 | // | | |<-------------| |
| 4092 | // | | RESTNotif1 | | |
| 4093 | // | |<-------------| | |
| 4094 | // | | | | |
| 4095 | // | | | SubResp2 | |
| 4096 | // | | |<-------------| |
| 4097 | // | RESTNotif2 | | |
| 4098 | // |<------------------------| | |
| 4099 | // | | | | |
| 4100 | // | | [SUBS 1 DELETE] | |
| 4101 | // | | | | |
| 4102 | // | | [SUBS 2 DELETE] | |
| 4103 | // | | | | |
| 4104 | // |
| 4105 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4106 | |
| 4107 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4108 | |
| 4109 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4110 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4111 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4112 | Counter{cSubReqToE2, 2}, |
| 4113 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4114 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4115 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4116 | Counter{cSubDelReqToE2, 2}, |
| 4117 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4118 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4119 | }) |
| 4120 | |
| 4121 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4122 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4123 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4124 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4125 | |
| 4126 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4127 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4128 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4129 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4130 | |
| 4131 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4132 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4133 | |
| 4134 | //XappConn1 receives both of the responses |
| 4135 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4136 | |
| 4137 | //Resp1 |
| 4138 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4139 | //Resp2 |
| 4140 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4141 | |
| 4142 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4143 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4144 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4145 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4146 | |
| 4147 | //Del1 |
| 4148 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4149 | //Del2 |
| 4150 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4151 | |
| 4152 | //Wait that subs is cleaned |
| 4153 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4154 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4155 | |
| 4156 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4157 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4158 | } |
| 4159 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4160 | //----------------------------------------------------------------------------- |
| 4161 | // TestRESTSameSubsDiffRan |
| 4162 | // Same subscription to different RANs |
| 4163 | // |
| 4164 | // stub stub |
| 4165 | // +-------+ +---------+ +---------+ |
| 4166 | // | xapp | | submgr | | e2term | |
| 4167 | // +-------+ +---------+ +---------+ |
| 4168 | // | | | |
| 4169 | // | RESTSubReq(r1) | | |
| 4170 | // |---------------->| | |
| 4171 | // | RESTSubResp(r1) | | |
| 4172 | // |<----------------| | |
| 4173 | // | | | |
| 4174 | // | | SubReq(r1) | |
| 4175 | // | |------------->| |
| 4176 | // | | | |
| 4177 | // | | SubResp(r1) | |
| 4178 | // | |<-------------| |
| 4179 | // | | | |
| 4180 | // | RESTNotif(r1) | | |
| 4181 | // |<----------------| | |
| 4182 | // | | | |
| 4183 | // | RESTSubReq(r2) | | |
| 4184 | // |---------------->| | |
| 4185 | // | | | |
| 4186 | // | RESTSubResp(r2) | | |
| 4187 | // |<----------------| | |
| 4188 | // | | SubReq(r2) | |
| 4189 | // | |------------->| |
| 4190 | // | | | |
| 4191 | // | | SubResp(r2) | |
| 4192 | // | |<-------------| |
| 4193 | // | | | |
| 4194 | // | RESTNotif(r2) | | |
| 4195 | // |<----------------| | |
| 4196 | // | | | |
| 4197 | // | [SUBS r1 DELETE] | |
| 4198 | // | | | |
| 4199 | // | [SUBS r2 DELETE] | |
| 4200 | // | | | |
| 4201 | // |
| 4202 | //----------------------------------------------------------------------------- |
| 4203 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4204 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4205 | |
| 4206 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4207 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4208 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4209 | Counter{cSubReqToE2, 2}, |
| 4210 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4211 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4212 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4213 | Counter{cSubDelReqToE2, 2}, |
| 4214 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4215 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4216 | }) |
| 4217 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4218 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4219 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4220 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4221 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4222 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4223 | params.SetMeid("RAN_NAME_2") |
| 4224 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4225 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4226 | |
| 4227 | //Del1 |
| 4228 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4229 | //Del2 |
| 4230 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4231 | |
| 4232 | //Wait that subs is cleaned |
| 4233 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4234 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4235 | |
| 4236 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4237 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4238 | } |
| 4239 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4240 | //----------------------------------------------------------------------------- |
| 4241 | // TestRESTSubReqRetryInSubmgr |
| 4242 | // |
| 4243 | // stub stub |
| 4244 | // +-------+ +---------+ +---------+ |
| 4245 | // | xapp | | submgr | | e2term | |
| 4246 | // +-------+ +---------+ +---------+ |
| 4247 | // | | | |
| 4248 | // | RESTSubReq | | |
| 4249 | // |---------------->| | |
| 4250 | // | RESTSubResp | | |
| 4251 | // |<----------------| | |
| 4252 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 4253 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4254 | // | | | |
| 4255 | // | | | |
| 4256 | // | | SubReq | |
| 4257 | // | |------------->| |
| 4258 | // | | SubResp | |
| 4259 | // | |<-------------| |
| 4260 | // | | | |
| 4261 | // | RESTNotif | | |
| 4262 | // |<----------------| | |
| 4263 | // | | | |
| 4264 | // | [SUBS DELETE] | |
| 4265 | // | | | |
| 4266 | // |
| 4267 | //----------------------------------------------------------------------------- |
| 4268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4269 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4270 | |
| 4271 | // Init counter check |
| 4272 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4273 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4274 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4275 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4276 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4277 | Counter{cSubReReqToE2, 1}, |
| 4278 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4279 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4280 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4281 | Counter{cSubDelReqToE2, 1}, |
| 4282 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4283 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4284 | }) |
| 4285 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4286 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4287 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4288 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4289 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4290 | |
| 4291 | // Catch the first message and ignore it |
| 4292 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4293 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4294 | |
| 4295 | // The second request is being handled normally |
| 4296 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4297 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4298 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4299 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4300 | |
| 4301 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4302 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4303 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4304 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4305 | |
| 4306 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4307 | //Wait that subs is cleaned |
| 4308 | waitSubsCleanup(t, e2SubsId, 10) |
| 4309 | |
| 4310 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4311 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4312 | } |
| 4313 | |
| 4314 | //----------------------------------------------------------------------------- |
| 4315 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4316 | // |
| 4317 | // stub stub |
| 4318 | // +-------+ +---------+ +---------+ |
| 4319 | // | xapp | | submgr | | e2term | |
| 4320 | // +-------+ +---------+ +---------+ |
| 4321 | // | | | |
| 4322 | // | RESTSubReq | | |
| 4323 | // |---------------->| | |
| 4324 | // | | | |
| 4325 | // | RESTSubResp | | |
| 4326 | // |<----------------| | |
| 4327 | // | | SubReq | |
| 4328 | // | |------------->| |
| 4329 | // | | | |
| 4330 | // | | | |
| 4331 | // | | SubReq | |
| 4332 | // | |------------->| |
| 4333 | // | | | |
| 4334 | // | | SubDelReq | |
| 4335 | // | |------------->| |
| 4336 | // | | | |
| 4337 | // | | | |
| 4338 | // | | SubDelReq | |
| 4339 | // | |------------->| |
| 4340 | // | | | |
| 4341 | // | | | |
| 4342 | // | | SubDelResp | |
| 4343 | // | |<-------------| |
| 4344 | // | RESTNotif | | |
| 4345 | // | unsuccess | | |
| 4346 | // |<----------------| | |
| 4347 | // | | | |
| 4348 | // | [SUBS DELETE] | |
| 4349 | // | | | |
| 4350 | // |
| 4351 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4352 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4353 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4354 | |
| 4355 | // Init counter check |
| 4356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4357 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4358 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4359 | Counter{cSubReqToE2, 1}, |
| 4360 | Counter{cSubReReqToE2, 1}, |
| 4361 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4362 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4363 | Counter{cSubDelReqToE2, 1}, |
| 4364 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4365 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4366 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4367 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4368 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4369 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4370 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4371 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4372 | |
| 4373 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4374 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4375 | |
| 4376 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4377 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4378 | |
| 4379 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4380 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4381 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4383 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4384 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4385 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4386 | // Wait that subs is cleaned |
| 4387 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4388 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4389 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4390 | } |
| 4391 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4392 | //----------------------------------------------------------------------------- |
| 4393 | // TestREST2eTermNotRespondingToSubReq |
| 4394 | // |
| 4395 | // stub stub |
| 4396 | // +-------+ +---------+ +---------+ |
| 4397 | // | xapp | | submgr | | e2term | |
| 4398 | // +-------+ +---------+ +---------+ |
| 4399 | // | | | |
| 4400 | // | RESTSubReq | | |
| 4401 | // |---------------->| | |
| 4402 | // | RESTSubResp | | |
| 4403 | // |<----------------| | |
| 4404 | // | | SubReq | |
| 4405 | // | |------------->| |
| 4406 | // | | | |
| 4407 | // | | SubReq | |
| 4408 | // | |------------->| |
| 4409 | // | | | |
| 4410 | // | | SubDelReq | |
| 4411 | // | |------------->| |
| 4412 | // | | | |
| 4413 | // | | SubDelReq | |
| 4414 | // | |------------->| |
| 4415 | // | RESTNotif(Unsuccessful) | |
| 4416 | // |<----------------| | |
| 4417 | // | | | |
| 4418 | // | RESTSubDelReq | | |
| 4419 | // |---------------->| | |
| 4420 | // | RESTSubDelResp | | |
| 4421 | // |<----------------| | |
| 4422 | // | | | |
| 4423 | // |
| 4424 | //----------------------------------------------------------------------------- |
| 4425 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4426 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | |
| 4428 | // Init counter check |
| 4429 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4430 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4431 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4432 | Counter{cSubReqToE2, 1}, |
| 4433 | Counter{cSubReReqToE2, 1}, |
| 4434 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4435 | Counter{cSubDelReReqToE2, 1}, |
| 4436 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4437 | Counter{cSubDelReqToE2, 1}, |
| 4438 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4439 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4440 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4441 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4442 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4443 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4444 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4445 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4446 | |
| 4447 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4448 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4449 | |
| 4450 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4451 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4452 | |
| 4453 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4454 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4455 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4456 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4457 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4458 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4459 | |
| 4460 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4461 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4462 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4463 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4464 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4465 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4466 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | } |
| 4468 | |
| 4469 | //----------------------------------------------------------------------------- |
| 4470 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4471 | // |
| 4472 | // stub stub |
| 4473 | // +-------+ +---------+ +---------+ |
| 4474 | // | xapp | | submgr | | e2term | |
| 4475 | // +-------+ +---------+ +---------+ |
| 4476 | // | | | |
| 4477 | // | RESTSubReq | | |
| 4478 | // |---------------->| | |
| 4479 | // | | | |
| 4480 | // | RESTSubResp | | |
| 4481 | // |<----------------| | |
| 4482 | // | | SubReq | |
| 4483 | // | |------------->| |
| 4484 | // | | | |
| 4485 | // | | | |
| 4486 | // | | SubReq | |
| 4487 | // | |------------->| |
| 4488 | // | | | |
| 4489 | // | | SubDelReq | |
| 4490 | // | |------------->| |
| 4491 | // | | | |
| 4492 | // | | | |
| 4493 | // | | SubDelReq | |
| 4494 | // | |------------->| |
| 4495 | // | | | |
| 4496 | // | | | |
| 4497 | // | | SubDelResp | |
| 4498 | // | |<-------------| |
| 4499 | // | RESTNotif | | |
| 4500 | // | unsuccess | | |
| 4501 | // |<----------------| | |
| 4502 | // | | | |
| 4503 | // | [SUBS DELETE] | |
| 4504 | // | | | |
| 4505 | // |
| 4506 | //----------------------------------------------------------------------------- |
| 4507 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4508 | |
| 4509 | // Init counter check |
| 4510 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4511 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4512 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4513 | Counter{cSubReqToE2, 1}, |
| 4514 | Counter{cSubReReqToE2, 1}, |
| 4515 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4516 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4517 | Counter{cSubDelReqToE2, 1}, |
| 4518 | Counter{cSubDelReReqToE2, 1}, |
| 4519 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4520 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4521 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4522 | }) |
| 4523 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4524 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4525 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4526 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4527 | |
| 4528 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4529 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4530 | |
| 4531 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4532 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4533 | |
| 4534 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4535 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4537 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4538 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4539 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | |
| 4541 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4542 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4543 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4544 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4545 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4546 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4547 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4548 | } |
| 4549 | |
| 4550 | //----------------------------------------------------------------------------- |
| 4551 | // TestRESTSubReqSubFailRespInSubmgr |
| 4552 | // |
| 4553 | // stub stub |
| 4554 | // +-------+ +---------+ +---------+ |
| 4555 | // | xapp | | submgr | | e2term | |
| 4556 | // +-------+ +---------+ +---------+ |
| 4557 | // | | | |
| 4558 | // | RESTSubReq | | |
| 4559 | // |---------------->| | |
| 4560 | // | | | |
| 4561 | // | RESTSubResp | | |
| 4562 | // |<----------------| | |
| 4563 | // | | SubReq | |
| 4564 | // | |------------->| |
| 4565 | // | | | |
| 4566 | // | | SubFail | |
| 4567 | // | |<-------------| |
| 4568 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4569 | // | RESTNotif | | |
| 4570 | // | unsuccess | | |
| 4571 | // |<----------------| | |
| 4572 | // | | | |
| 4573 | // | [SUBS DELETE] | |
| 4574 | // | | | |
| 4575 | // |
| 4576 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4577 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4578 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | |
| 4580 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4581 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4582 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4583 | Counter{cSubReqToE2, 1}, |
| 4584 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4585 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4586 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4587 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4588 | }) |
| 4589 | |
| 4590 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4591 | const e2Timeout int64 = 2 |
| 4592 | const e2RetryCount int64 = 1 |
| 4593 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4594 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4595 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4596 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4597 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4598 | |
| 4599 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4600 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4601 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4602 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4603 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4604 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4605 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4606 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4607 | |
| 4608 | // REST subscription sill there to be deleted |
| 4609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4610 | |
| 4611 | // Wait that subs is cleaned |
| 4612 | waitSubsCleanup(t, e2SubsId, 10) |
| 4613 | |
| 4614 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4615 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4616 | } |
| 4617 | |
| 4618 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 4619 | // TestRESTSubReqPartialResp |
| 4620 | // |
| 4621 | // stub stub |
| 4622 | // +-------+ +---------+ +---------+ |
| 4623 | // | xapp | | submgr | | e2term | |
| 4624 | // +-------+ +---------+ +---------+ |
| 4625 | // | | | |
| 4626 | // | RESTSubReq | | |
| 4627 | // |---------------->| | |
| 4628 | // | RESTSubResp | | |
| 4629 | // |<----------------| | |
| 4630 | // | | SubReq | |
| 4631 | // | |------------->| |
| 4632 | // | | SubResp | Partially accepted |
| 4633 | // | |<-------------| |
| 4634 | // | | | |
| 4635 | // | RESTNotif | | |
| 4636 | // |<----------------| | |
| 4637 | // | | | |
| 4638 | // | [SUBS DELETE] | |
| 4639 | // | | | |
| 4640 | // |
| 4641 | //----------------------------------------------------------------------------- |
| 4642 | |
| 4643 | func TestRESTSubReqPartialResp(t *testing.T) { |
| 4644 | |
| 4645 | // Init counter check |
| 4646 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4647 | Counter{cRestSubReqFromXapp, 1}, |
| 4648 | Counter{cRestSubRespToXapp, 1}, |
| 4649 | Counter{cSubReqToE2, 1}, |
| 4650 | Counter{cSubRespFromE2, 1}, |
| 4651 | Counter{cPartialSubRespFromE2, 1}, |
| 4652 | Counter{cRestSubNotifToXapp, 1}, |
| 4653 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4654 | Counter{cSubDelReqToE2, 1}, |
| 4655 | Counter{cSubDelRespFromE2, 1}, |
| 4656 | Counter{cRestSubDelRespToXapp, 1}, |
| 4657 | }) |
| 4658 | |
| 4659 | // Req |
| 4660 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4661 | |
| 4662 | actionId := int64(2) |
| 4663 | actionType := "report" |
| 4664 | actionDefinition := []int64{5678, 1} |
| 4665 | subsequestActionType := "continue" |
| 4666 | timeToWait := "w10ms" |
| 4667 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4668 | |
| 4669 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4670 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4671 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4672 | |
| 4673 | actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} |
| 4674 | actionNotAdmittedItem.ActionId = 1 |
| 4675 | actionNotAdmittedItem.Cause.Content = 1 |
| 4676 | actionNotAdmittedItem.Cause.Value = 8 |
| 4677 | actionNotAdmittedList := e2ap.ActionNotAdmittedList{} |
| 4678 | actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) |
| 4679 | e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) |
| 4680 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4681 | |
| 4682 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4683 | |
| 4684 | // Del |
| 4685 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4686 | |
| 4687 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4688 | //Wait that subs is cleaned |
| 4689 | waitSubsCleanup(t, e2SubsId, 10) |
| 4690 | |
| 4691 | mainCtrl.VerifyCounterValues(t) |
| 4692 | mainCtrl.VerifyAllClean(t) |
| 4693 | } |
| 4694 | |
| 4695 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4696 | // TestRESTSubDelReqRetryInSubmgr |
| 4697 | // |
| 4698 | // stub stub |
| 4699 | // +-------+ +---------+ +---------+ |
| 4700 | // | xapp | | submgr | | e2term | |
| 4701 | // +-------+ +---------+ +---------+ |
| 4702 | // | | | |
| 4703 | // | [SUBS CREATE] | |
| 4704 | // | | | |
| 4705 | // | | | |
| 4706 | // | RESTSubDelReq | | |
| 4707 | // |---------------->| | |
| 4708 | // | | | |
| 4709 | // | RESTSubDelResp | | |
| 4710 | // |<----------------| | |
| 4711 | // | | SubDelReq | |
| 4712 | // | |------------->| |
| 4713 | // | | | |
| 4714 | // | | SubDelReq | |
| 4715 | // | |------------->| |
| 4716 | // | | | |
| 4717 | // | | SubDelResp | |
| 4718 | // | |<-------------| |
| 4719 | // | | | |
| 4720 | // |
| 4721 | //----------------------------------------------------------------------------- |
| 4722 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4723 | |
| 4724 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4725 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4726 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4727 | Counter{cSubReqToE2, 1}, |
| 4728 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4729 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4730 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4731 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4732 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4733 | Counter{cSubDelReReqToE2, 1}, |
| 4734 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4735 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4736 | }) |
| 4737 | // Req |
| 4738 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4739 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4740 | |
| 4741 | // Del |
| 4742 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4743 | |
| 4744 | // E2t: Receive 1st SubsDelReq |
| 4745 | e2termConn1.RecvSubsDelReq(t) |
| 4746 | |
| 4747 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4748 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4749 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4750 | |
| 4751 | //Wait that subs is cleaned |
| 4752 | waitSubsCleanup(t, e2SubsId, 10) |
| 4753 | |
| 4754 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4755 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4756 | } |
| 4757 | |
| 4758 | //----------------------------------------------------------------------------- |
| 4759 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4760 | // |
| 4761 | // stub stub |
| 4762 | // +-------+ +---------+ +---------+ |
| 4763 | // | xapp | | submgr | | e2term | |
| 4764 | // +-------+ +---------+ +---------+ |
| 4765 | // | | | |
| 4766 | // | [SUBS CREATE] | |
| 4767 | // | | | |
| 4768 | // | | | |
| 4769 | // | RESTSubDelReq | | |
| 4770 | // |---------------->| | |
| 4771 | // | | | |
| 4772 | // | RESTSubDelResp | | |
| 4773 | // |<----------------| | |
| 4774 | // | | SubDelReq | |
| 4775 | // | |------------->| |
| 4776 | // | | | |
| 4777 | // | | SubDelReq | |
| 4778 | // | |------------->| |
| 4779 | // | | | |
| 4780 | // | | | |
| 4781 | // |
| 4782 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4783 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4784 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4785 | |
| 4786 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4787 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4788 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4789 | Counter{cSubReqToE2, 1}, |
| 4790 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4791 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4792 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4793 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4794 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4795 | Counter{cSubDelReReqToE2, 1}, |
| 4796 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4797 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4798 | }) |
| 4799 | |
| 4800 | // Req |
| 4801 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4802 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4803 | |
| 4804 | // Del |
| 4805 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4806 | |
| 4807 | // E2t: Receive 1st SubsDelReq |
| 4808 | e2termConn1.RecvSubsDelReq(t) |
| 4809 | |
| 4810 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4811 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4812 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4813 | |
| 4814 | //Wait that subs is cleaned |
| 4815 | waitSubsCleanup(t, e2SubsId, 10) |
| 4816 | |
| 4817 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4818 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4819 | } |
| 4820 | |
| 4821 | //----------------------------------------------------------------------------- |
| 4822 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4823 | // |
| 4824 | // stub stub |
| 4825 | // +-------+ +---------+ +---------+ |
| 4826 | // | xapp | | submgr | | e2term | |
| 4827 | // +-------+ +---------+ +---------+ |
| 4828 | // | | | |
| 4829 | // | [SUBS CREATE] | |
| 4830 | // | | | |
| 4831 | // | | | |
| 4832 | // | RESTSubDelReq | | |
| 4833 | // |---------------->| | |
| 4834 | // | | | |
| 4835 | // | RESTSubDelResp | | |
| 4836 | // |<----------------| | |
| 4837 | // | | SubDelReq | |
| 4838 | // | |------------->| |
| 4839 | // | | | |
| 4840 | // | | SubDelFail | |
| 4841 | // | |<-------------| |
| 4842 | // | | | |
| 4843 | // |
| 4844 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4845 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4846 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4847 | |
| 4848 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4849 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4850 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4851 | Counter{cSubReqToE2, 1}, |
| 4852 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4853 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4854 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4855 | Counter{cSubDelReqToE2, 1}, |
| 4856 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4857 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4858 | }) |
| 4859 | |
| 4860 | // Req |
| 4861 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4862 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4863 | |
| 4864 | // Del |
| 4865 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4866 | |
| 4867 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4868 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4869 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4870 | |
| 4871 | //Wait that subs is cleaned |
| 4872 | waitSubsCleanup(t, e2SubsId, 10) |
| 4873 | |
| 4874 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4875 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4876 | } |
| 4877 | |
| 4878 | //----------------------------------------------------------------------------- |
| 4879 | // TestRESTSubReqAndSubDelOkSameAction |
| 4880 | // |
| 4881 | // stub stub |
| 4882 | // +-------+ +-------+ +---------+ +---------+ |
| 4883 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4884 | // +-------+ +-------+ +---------+ +---------+ |
| 4885 | // | | | | |
| 4886 | // | | RESTSubReq1 | | |
| 4887 | // | |---------------->| | |
| 4888 | // | | | | |
| 4889 | // | | RESTSubResp1 | | |
| 4890 | // | |<----------------| | |
| 4891 | // | | | | |
| 4892 | // | | | SubReq1 | |
| 4893 | // | | |------------->| |
| 4894 | // | | | SubResp1 | |
| 4895 | // | | |<-------------| |
| 4896 | // | | RESTNotif1 | | |
| 4897 | // | |<----------------| | |
| 4898 | // | | | | |
| 4899 | // | RESTSubReq2 | | |
| 4900 | // |------------------------------>| | |
| 4901 | // | | | | |
| 4902 | // | RESTSubResp2 | | |
| 4903 | // |<------------------------------| | |
| 4904 | // | | | | |
| 4905 | // | | RESTNotif2 | | |
| 4906 | // |<------------------------------| | |
| 4907 | // | | | | |
| 4908 | // | | RESTSubDelReq1 | | |
| 4909 | // | |---------------->| | |
| 4910 | // | | | | |
| 4911 | // | | RESTSubDelResp1 | | |
| 4912 | // | |<----------------| | |
| 4913 | // | | | | |
| 4914 | // | RESTSubDelReq2 | | |
| 4915 | // |------------------------------>| | |
| 4916 | // | | | | |
| 4917 | // | RESTSubDelResp2 | | |
| 4918 | // |<------------------------------| | |
| 4919 | // | | | | |
| 4920 | // | | | SubDelReq2 | |
| 4921 | // | | |------------->| |
| 4922 | // | | | | |
| 4923 | // | | | SubDelResp2 | |
| 4924 | // | | |<-------------| |
| 4925 | // | | | | |
| 4926 | // |
| 4927 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4928 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4929 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4930 | |
| 4931 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4932 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4933 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4934 | Counter{cSubReqToE2, 1}, |
| 4935 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4936 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4937 | Counter{cMergedSubscriptions, 1}, |
| 4938 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4939 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4940 | Counter{cSubDelReqToE2, 1}, |
| 4941 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4942 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4943 | }) |
| 4944 | |
| 4945 | // Req1 |
| 4946 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4947 | |
| 4948 | //Subs Create |
| 4949 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4950 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4951 | |
| 4952 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4953 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4954 | params.SetMeid("RAN_NAME_1") |
| 4955 | |
| 4956 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4957 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4958 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4959 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4960 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4961 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4962 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4963 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4964 | |
| 4965 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4966 | |
| 4967 | // Del1 |
| 4968 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4969 | |
| 4970 | // Del2 |
| 4971 | deleteXapp2Subscription(t, &restSubId2) |
| 4972 | |
| 4973 | //Wait that subs is cleaned |
| 4974 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4975 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4976 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4977 | } |
| 4978 | |
| 4979 | //----------------------------------------------------------------------------- |
| 4980 | // TestSubReqAndSubDelOkSameActionParallel |
| 4981 | // |
| 4982 | // stub stub stub |
| 4983 | // +-------+ +-------+ +---------+ +---------+ |
| 4984 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4985 | // +-------+ +-------+ +---------+ +---------+ |
| 4986 | // | | | | |
| 4987 | // | | | | |
| 4988 | // | | | | |
| 4989 | // | | SubReq1 | | |
| 4990 | // | |------------->| | |
| 4991 | // | | | | |
| 4992 | // | | | SubReq1 | |
| 4993 | // | | |------------->| |
| 4994 | // | SubReq2 | | |
| 4995 | // |--------------------------->| | |
| 4996 | // | | | SubResp1 | |
| 4997 | // | | |<-------------| |
| 4998 | // | | SubResp1 | | |
| 4999 | // | |<-------------| | |
| 5000 | // | | | SubReq2 | |
| 5001 | // | | |------------->| |
| 5002 | // | | | | |
| 5003 | // | | | SubResp2 | |
| 5004 | // | | |<-------------| |
| 5005 | // | SubResp2 | | |
| 5006 | // |<---------------------------| | |
| 5007 | // | | | | |
| 5008 | // | | SubDelReq 1 | | |
| 5009 | // | |------------->| | |
| 5010 | // | | | | |
| 5011 | // | | SubDelResp 1 | | |
| 5012 | // | |<-------------| | |
| 5013 | // | | | | |
| 5014 | // | SubDelReq 2 | | |
| 5015 | // |--------------------------->| | |
| 5016 | // | | | | |
| 5017 | // | | | SubDelReq 2 | |
| 5018 | // | | |------------->| |
| 5019 | // | | | | |
| 5020 | // | | | SubDelReq 2 | |
| 5021 | // | | |------------->| |
| 5022 | // | | | | |
| 5023 | // | SubDelResp 2 | | |
| 5024 | // |<---------------------------| | |
| 5025 | // |
| 5026 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5027 | |
| 5028 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5029 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5030 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5031 | Counter{cSubReqToE2, 2}, |
| 5032 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5033 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5034 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5035 | Counter{cSubDelReqToE2, 2}, |
| 5036 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5037 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5038 | }) |
| 5039 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5040 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5041 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5042 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5043 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5044 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5045 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5046 | |
| 5047 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5048 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5049 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 5050 | |
| 5051 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5052 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 5053 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 5054 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5055 | |
| 5056 | // Del1 |
| 5057 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5058 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5059 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5060 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5061 | |
| 5062 | // Del2 |
| 5063 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5064 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 5065 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 5066 | |
| 5067 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5068 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5069 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5070 | } |
| 5071 | |
| 5072 | //----------------------------------------------------------------------------- |
| 5073 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 5074 | // |
| 5075 | // stub stub stub |
| 5076 | // +-------+ +-------+ +---------+ +---------+ |
| 5077 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5078 | // +-------+ +-------+ +---------+ +---------+ |
| 5079 | // | | | | |
| 5080 | // | | | | |
| 5081 | // | | | | |
| 5082 | // | | RESTSubReq1 | | |
| 5083 | // | |---------------->| | |
| 5084 | // | | | | |
| 5085 | // | | RESTSubResp1 | | |
| 5086 | // | |<----------------| | |
| 5087 | // | | | SubReq1 | |
| 5088 | // | | |------------->| |
| 5089 | // | RESTSubReq2 | | |
| 5090 | // |------------------------------>| | |
| 5091 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5092 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5093 | // |<------------------------------| | |
| 5094 | // | | | SubReq1 | |
| 5095 | // | | |------------->| |
| 5096 | // | | | | |
| 5097 | // | | | | |
| 5098 | // | | | SubDelReq | |
| 5099 | // | | |------------->| |
| 5100 | // | | | | |
| 5101 | // | | | SubDelResp | |
| 5102 | // | | |<-------------| |
| 5103 | // | | RESTNotif1 | | |
| 5104 | // | | unsuccess | | |
| 5105 | // | |<----------------| | |
| 5106 | // | RESTNotif2 | | |
| 5107 | // | | unsuccess | | |
| 5108 | // |<------------------------------| | |
| 5109 | // | | | | |
| 5110 | // | | RESTSubDelReq1 | | |
| 5111 | // | |---------------->| | |
| 5112 | // | | | | |
| 5113 | // | | RESTSubDelResp1 | | |
| 5114 | // | |<----------------| | |
| 5115 | // | | | | |
| 5116 | // | RESTSubDelReq2 | | |
| 5117 | // |------------------------------>| | |
| 5118 | // | | | | |
| 5119 | // | RESTSubDelResp2 | | |
| 5120 | // |<------------------------------| | |
| 5121 | // |
| 5122 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5123 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5124 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5125 | |
| 5126 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5127 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5128 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5129 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5130 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5131 | Counter{cSubReqTimerExpiry, 2}, |
| 5132 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5133 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5134 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5135 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | Counter{cSubDelReqToE2, 1}, |
| 5137 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5138 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5139 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5140 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5141 | |
| 5142 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5143 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5144 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5145 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5146 | |
| 5147 | // Req2 |
| 5148 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5149 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5150 | params2.SetMeid("RAN_NAME_1") |
| 5151 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5152 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5153 | |
| 5154 | //Req1 (retransmitted) |
| 5155 | e2termConn1.RecvSubsReq(t) |
| 5156 | |
| 5157 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5158 | |
| 5159 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5160 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5161 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5162 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5163 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5164 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5165 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5166 | |
| 5167 | // Del1 |
| 5168 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5169 | |
| 5170 | // Del2 |
| 5171 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5172 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5173 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5174 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5175 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5176 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5177 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5178 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5179 | } |
| 5180 | |
| 5181 | //----------------------------------------------------------------------------- |
| 5182 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5183 | // |
| 5184 | // stub stub stub |
| 5185 | // +-------+ +-------+ +---------+ +---------+ |
| 5186 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5187 | // +-------+ +-------+ +---------+ +---------+ |
| 5188 | // | | | | |
| 5189 | // | | | | |
| 5190 | // | | | | |
| 5191 | // | | RESTSubReq1 | | |
| 5192 | // | |---------------->| | |
| 5193 | // | | | | |
| 5194 | // | | RESTSubResp1 | | |
| 5195 | // | |<----------------| | |
| 5196 | // | | | SubReq1 | |
| 5197 | // | | |------------->| |
| 5198 | // | RESTSubReq2 | | |
| 5199 | // |------------------------------>| | |
| 5200 | // | | | | |
| 5201 | // | RESTSubDelResp2 | | |
| 5202 | // |<------------------------------| | |
| 5203 | // | | | SubFail1 | |
| 5204 | // | | |<-------------| |
| 5205 | // | | | | |
| 5206 | // | | RESTNotif1 | | |
| 5207 | // | | unsuccess | | |
| 5208 | // | |<----------------| | |
| 5209 | // | RESTNotif2 | | |
| 5210 | // | | unsuccess | | |
| 5211 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5212 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5213 | // | | 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] | 5214 | // | |---------------->| | |
| 5215 | // | | | | |
| 5216 | // | | RESTSubDelResp1 | | |
| 5217 | // | |<----------------| | |
| 5218 | // | | | | |
| 5219 | // | RESTSubDelReq2 | | |
| 5220 | // |------------------------------>| | |
| 5221 | // | | | | |
| 5222 | // | RESTSubDelResp2 | | |
| 5223 | // |<------------------------------| | |
| 5224 | // |
| 5225 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5226 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5227 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5228 | |
| 5229 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5230 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5231 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5232 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5233 | Counter{cSubReqToE2, 1}, |
| 5234 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5235 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5236 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5237 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5238 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | }) |
| 5240 | |
| 5241 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5242 | |
| 5243 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5244 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5245 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5246 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5247 | |
| 5248 | // Req2 |
| 5249 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5250 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5251 | params2.SetMeid("RAN_NAME_1") |
| 5252 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5253 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5254 | |
| 5255 | // E2t: send SubsFail (first) |
| 5256 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5257 | fparams1.Set(crereq1) |
| 5258 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5259 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5260 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5261 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5262 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5263 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5264 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5265 | |
| 5266 | // Del1 |
| 5267 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5268 | |
| 5269 | // Del2 |
| 5270 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5271 | |
| 5272 | //Wait that subs is cleaned |
| 5273 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5274 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5275 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5276 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5277 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5278 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5279 | //----------------------------------------------------------------------------- |
| 5280 | // TestRESTSubReqPolicyAndSubDelOk |
| 5281 | // |
| 5282 | // stub stub |
| 5283 | // +-------+ +---------+ +---------+ |
| 5284 | // | xapp | | submgr | | e2term | |
| 5285 | // +-------+ +---------+ +---------+ |
| 5286 | // | | | |
| 5287 | // | RESTSubReq | | |
| 5288 | // |--------------->| | |
| 5289 | // | RESTSubResp | | |
| 5290 | // |<---------------| | |
| 5291 | // | | | |
| 5292 | // | | SubReq | |
| 5293 | // | |------------->| |
| 5294 | // | | | |
| 5295 | // | | SubResp | |
| 5296 | // | |<-------------| |
| 5297 | // | | | |
| 5298 | // | RESTNotif | | |
| 5299 | // |<---------------| | |
| 5300 | // | | | |
| 5301 | // | | | |
| 5302 | // | RESTSubDelReq | | |
| 5303 | // |--------------->| | |
| 5304 | // | RESTSubDelResp | | |
| 5305 | // |<---------------| | |
| 5306 | // | | | |
| 5307 | // | | SubDelReq | |
| 5308 | // | |------------->| |
| 5309 | // | | | |
| 5310 | // | | SubDelResp | |
| 5311 | // | |<-------------| |
| 5312 | // | | | |
| 5313 | // |
| 5314 | //----------------------------------------------------------------------------- |
| 5315 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5316 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5317 | |
| 5318 | // Init counter check |
| 5319 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5320 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5321 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5322 | Counter{cSubReqToE2, 1}, |
| 5323 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5324 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5325 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5326 | Counter{cSubDelReqToE2, 1}, |
| 5327 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5328 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5329 | }) |
| 5330 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5331 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5332 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5333 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5334 | |
| 5335 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5336 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5337 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5338 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5339 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5340 | |
| 5341 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5342 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5343 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5344 | |
| 5345 | // Wait that subs is cleaned |
| 5346 | waitSubsCleanup(t, e2SubsId, 10) |
| 5347 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5348 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5349 | } |
| 5350 | |
| 5351 | //----------------------------------------------------------------------------- |
| 5352 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5353 | // |
| 5354 | // stub stub |
| 5355 | // +-------+ +---------+ +---------+ |
| 5356 | // | xapp | | submgr | | e2term | |
| 5357 | // +-------+ +---------+ +---------+ |
| 5358 | // | | | |
| 5359 | // | RESTSubReq | | |
| 5360 | // |---------------->| | |
| 5361 | // | | | |
| 5362 | // | RESTSubResp | | |
| 5363 | // |<----------------| | |
| 5364 | // | | SubReq | |
| 5365 | // | |------------->| |
| 5366 | // | | | |
| 5367 | // | | SubResp | |
| 5368 | // | |<-------------| |
| 5369 | // | | | |
| 5370 | // | RESTNotif | | |
| 5371 | // |<----------------| | |
| 5372 | // | | | |
| 5373 | // | RESTSubReq | | |
| 5374 | // |---------------->| | |
| 5375 | // | | | |
| 5376 | // | RESTSubResp | | |
| 5377 | // |<----------------| | |
| 5378 | // | | SubReq | |
| 5379 | // | |------------->| |
| 5380 | // | | | |
| 5381 | // | | SubResp | |
| 5382 | // | |<-------------| |
| 5383 | // | | | |
| 5384 | // | RESTNotif | | |
| 5385 | // |<----------------| | |
| 5386 | // | | | |
| 5387 | // | RESTSubDelReq | | |
| 5388 | // |---------------->| | |
| 5389 | // | | | |
| 5390 | // | | SubDelReq | |
| 5391 | // | |------------->| |
| 5392 | // | | | |
| 5393 | // | | SubDelResp | |
| 5394 | // | |<-------------| |
| 5395 | // | | | |
| 5396 | // | RESTSubDelResp | | |
| 5397 | // |<----------------| | |
| 5398 | // |
| 5399 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5400 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5401 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5402 | |
| 5403 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5404 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5405 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5406 | Counter{cSubReqToE2, 2}, |
| 5407 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5408 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5409 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5410 | Counter{cSubDelReqToE2, 1}, |
| 5411 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5412 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5413 | }) |
| 5414 | |
| 5415 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5416 | const e2Timeout int64 = 1 |
| 5417 | const e2RetryCount int64 = 0 |
| 5418 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5419 | |
| 5420 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5421 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5422 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5423 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5424 | |
| 5425 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5426 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5427 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5428 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5429 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5430 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5431 | params.SetTimeToWait("w200ms") |
| 5432 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5433 | |
| 5434 | // Del |
| 5435 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5436 | |
| 5437 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5438 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5439 | |
| 5440 | // Wait that subs is cleaned |
| 5441 | waitSubsCleanup(t, e2SubsId, 10) |
| 5442 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5443 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5444 | } |
| 5445 | |
| 5446 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5447 | // TestRESTSubReqPolicyChangeNOk |
| 5448 | // |
| 5449 | // stub stub |
| 5450 | // +-------+ +---------+ +---------+ |
| 5451 | // | xapp | | submgr | | e2term | |
| 5452 | // +-------+ +---------+ +---------+ |
| 5453 | // | | | |
| 5454 | // | RESTSubReq | | |
| 5455 | // |---------------->| | |
| 5456 | // | | | |
| 5457 | // | RESTSubResp | | |
| 5458 | // |<----------------| | |
| 5459 | // | | SubReq | |
| 5460 | // | |------------->| |
| 5461 | // | | | |
| 5462 | // | | SubResp | |
| 5463 | // | |<-------------| |
| 5464 | // | | | |
| 5465 | // | RESTNotif | | |
| 5466 | // |<----------------| | |
| 5467 | // | | | |
| 5468 | // | RESTSubReq | | |
| 5469 | // |---------------->| | |
| 5470 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5471 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5472 | // | | | |
| 5473 | // | RESTSubDelReq | | |
| 5474 | // |---------------->| | |
| 5475 | // | | | |
| 5476 | // | | SubDelReq | |
| 5477 | // | |------------->| |
| 5478 | // | | | |
| 5479 | // | | SubDelResp | |
| 5480 | // | |<-------------| |
| 5481 | // | | | |
| 5482 | // | RESTSubDelResp | | |
| 5483 | // |<----------------| | |
| 5484 | // |
| 5485 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5486 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5487 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5488 | |
| 5489 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5490 | Counter{cRestSubReqFromXapp, 2}, |
| 5491 | Counter{cRestSubRespToXapp, 1}, |
| 5492 | Counter{cSubReqToE2, 1}, |
| 5493 | Counter{cSubRespFromE2, 1}, |
| 5494 | Counter{cRestSubNotifToXapp, 1}, |
| 5495 | Counter{cRestSubFailToXapp, 1}, |
| 5496 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5497 | Counter{cSubDelReqToE2, 1}, |
| 5498 | Counter{cSubDelRespFromE2, 1}, |
| 5499 | Counter{cRestSubDelRespToXapp, 1}, |
| 5500 | }) |
| 5501 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5502 | // Req |
| 5503 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5504 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5505 | |
| 5506 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5507 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5508 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5509 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5510 | params.SetSubscriptionID(&restSubIdUpd) |
| 5511 | params.SetTimeToWait("w200ms") |
| 5512 | |
| 5513 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5514 | assert.Equal(t, restSubId2, "") |
| 5515 | |
| 5516 | // Del |
| 5517 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5518 | |
| 5519 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5520 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5521 | |
| 5522 | // Wait that subs is cleaned |
| 5523 | waitSubsCleanup(t, e2SubsId, 10) |
| 5524 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5525 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5526 | } |
| 5527 | |
| 5528 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5529 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5530 | // |
| 5531 | // stub stub stub |
| 5532 | // +-------+ +---------+ +---------+ +---------+ |
| 5533 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5534 | // +-------+ +---------+ +---------+ +---------+ |
| 5535 | // | | | | |
| 5536 | // | | | | |
| 5537 | // | | | | |
| 5538 | // | RESTSubReq1 | | | |
| 5539 | // |---------------->| | | |
| 5540 | // | | | | |
| 5541 | // | RESTSubResp1 | | | |
| 5542 | // |<----------------| | | |
| 5543 | // | | SubReq1 | | |
| 5544 | // | |------------->| | |
| 5545 | // | | | | |
| 5546 | // | RESTSubReq2 | | | |
| 5547 | // |---------------->| | | |
| 5548 | // | | | | |
| 5549 | // | RESTSubResp2 | | | |
| 5550 | // |<----------------| | | |
| 5551 | // | | SubReq2 | | |
| 5552 | // | |---------------------------->| |
| 5553 | // | | | | |
| 5554 | // | | SubResp1 | | |
| 5555 | // | |<-------------| | |
| 5556 | // | RESTNotif1 | | | |
| 5557 | // |<----------------| | | |
| 5558 | // | | SubResp2 | | |
| 5559 | // | |<----------------------------| |
| 5560 | // | RESTNotif2 | | | |
| 5561 | // |<----------------| | | |
| 5562 | // | | | | |
| 5563 | // | [SUBS 1 DELETE] | | |
| 5564 | // | | | | |
| 5565 | // | [SUBS 2 DELETE] | | |
| 5566 | // | | | | |
| 5567 | // |
| 5568 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5569 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5570 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5571 | |
| 5572 | // Init counter check |
| 5573 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5574 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5575 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5576 | Counter{cSubReqToE2, 2}, |
| 5577 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5578 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5579 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5580 | Counter{cSubDelReqToE2, 2}, |
| 5581 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5582 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5583 | }) |
| 5584 | |
| 5585 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5586 | |
| 5587 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5588 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5589 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5590 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5591 | |
| 5592 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5593 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5594 | params.SetMeid("RAN_NAME_11") |
| 5595 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5596 | // would not work as notification would not be received |
| 5597 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5598 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5599 | |
| 5600 | // Resp1 |
| 5601 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5602 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5603 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5604 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5605 | |
| 5606 | // Resp2 |
| 5607 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5608 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5609 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5610 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5611 | |
| 5612 | // Delete1 |
| 5613 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5614 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5615 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5616 | |
| 5617 | // Wait that subs is cleaned |
| 5618 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5619 | |
| 5620 | // Delete2 |
| 5621 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5622 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5623 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5624 | |
| 5625 | // Wait that subs is cleaned |
| 5626 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5627 | |
| 5628 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5629 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5630 | } |
| 5631 | |
| 5632 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5633 | // TestRESTSubReqInsertAndSubDelOk |
| 5634 | // |
| 5635 | // stub stub |
| 5636 | // +-------+ +---------+ +---------+ |
| 5637 | // | xapp | | submgr | | e2term | |
| 5638 | // +-------+ +---------+ +---------+ |
| 5639 | // | | | |
| 5640 | // | RestSubReq | | |
| 5641 | // |---------------->| | |
| 5642 | // | | | |
| 5643 | // | RESTSubResp | | |
| 5644 | // |<----------------| | |
| 5645 | // | | | |
| 5646 | // | | SubReq | |
| 5647 | // | |------------->| |
| 5648 | // | | | |
| 5649 | // | | SubResp | |
| 5650 | // | |<-------------| |
| 5651 | // | RESTNotif | | |
| 5652 | // |<----------------| | |
| 5653 | // | ... | ... | |
| 5654 | // | | | |
| 5655 | // | RESTSubDelReq | | |
| 5656 | // |---------------->| | |
| 5657 | // | | | |
| 5658 | // | | SubDelReq | |
| 5659 | // | |------------->| |
| 5660 | // | | | |
| 5661 | // | | SubDelResp | |
| 5662 | // | |<-------------| |
| 5663 | // | | | |
| 5664 | // | RESTSubDelResp| | |
| 5665 | // |<----------------| | |
| 5666 | // |
| 5667 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5668 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5669 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5670 | |
| 5671 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5672 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5673 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5674 | Counter{cSubReqToE2, 1}, |
| 5675 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5676 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5677 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5678 | Counter{cSubDelReqToE2, 1}, |
| 5679 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5680 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5681 | }) |
| 5682 | |
| 5683 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5684 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5685 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5686 | params.SetSubActionTypes("insert") |
| 5687 | |
| 5688 | // Req |
| 5689 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5690 | |
| 5691 | // Del |
| 5692 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5693 | |
| 5694 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5695 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5696 | |
| 5697 | // Wait that subs is cleaned |
| 5698 | waitSubsCleanup(t, e2SubsId, 10) |
| 5699 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5700 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5701 | } |
| 5702 | |
| 5703 | //----------------------------------------------------------------------------- |
| 5704 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5705 | // |
| 5706 | // stub stub |
| 5707 | // +-------+ +---------+ +---------+ |
| 5708 | // | xapp | | submgr | | e2term | |
| 5709 | // +-------+ +---------+ +---------+ |
| 5710 | // | | | |
| 5711 | // | RESTSubReq | | |
| 5712 | // |------------->| | |
| 5713 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5714 | // | RESTSubResp | | |
| 5715 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5716 | // | | SubReq | |
| 5717 | // | |------------->| |
| 5718 | // | | | |
| 5719 | // | | SubResp | |
| 5720 | // | <----| |
| 5721 | // | | |
| 5722 | // | Submgr restart | |
| 5723 | // | | |
| 5724 | // | | | |
| 5725 | // | | SubDelReq | |
| 5726 | // | |------------->| |
| 5727 | // | | | |
| 5728 | // | | SubDelResp | |
| 5729 | // | |<-------------| |
| 5730 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5731 | // | RESTNotif | | |
| 5732 | // | unsuccess | | |
| 5733 | // |<-------------| | |
| 5734 | // | | | |
| 5735 | // | RESTSubDelReq| | |
| 5736 | // |------------->| | |
| 5737 | // | | | |
| 5738 | // |RESTSubDelResp| | |
| 5739 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5740 | // |
| 5741 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5742 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5743 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5744 | |
| 5745 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5746 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5747 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5748 | Counter{cSubReqToE2, 1}, |
| 5749 | Counter{cSubDelReqFromXapp, 1}, |
| 5750 | Counter{cSubDelReqToE2, 1}, |
| 5751 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5752 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5753 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5754 | }) |
| 5755 | |
| 5756 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5757 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5758 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5759 | |
| 5760 | //Req |
| 5761 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5762 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5763 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5764 | |
| 5765 | e2termConn1.RecvSubsReq(t) |
| 5766 | |
| 5767 | mainCtrl.SetResetTestFlag(t, false) |
| 5768 | |
| 5769 | mainCtrl.SimulateRestart(t) |
| 5770 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5771 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5772 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5773 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5774 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5775 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5776 | //Del |
| 5777 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5778 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5779 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5780 | e2termConn1.TestMsgChanEmpty(t) |
| 5781 | mainCtrl.wait_registry_empty(t, 10) |
| 5782 | |
| 5783 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5784 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5785 | } |
| 5786 | |
| 5787 | //----------------------------------------------------------------------------- |
| 5788 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5789 | // |
| 5790 | // stub stub |
| 5791 | // +-------+ +---------+ +---------+ |
| 5792 | // | xapp | | submgr | | e2term | |
| 5793 | // +-------+ +---------+ +---------+ |
| 5794 | // | | | |
| 5795 | // | RESTSubReq | | |
| 5796 | // |---------------->| | |
| 5797 | // | | | |
| 5798 | // | RESTSubResp | | |
| 5799 | // |<----------------| | |
| 5800 | // | | SubReq | |
| 5801 | // | |------------->| |
| 5802 | // | | | |
| 5803 | // | | SubResp | |
| 5804 | // | |<-------------| |
| 5805 | // | | | |
| 5806 | // | RESTNotif | | |
| 5807 | // |<----------------| | |
| 5808 | // | | | |
| 5809 | // | | |
| 5810 | // | Submgr restart | |
| 5811 | // | | | |
| 5812 | // | RESTSubDelReq | | |
| 5813 | // |---------------->| | |
| 5814 | // | | | |
| 5815 | // | | SubDelReq | |
| 5816 | // | |------------->| |
| 5817 | // | | | |
| 5818 | // | | SubDelResp | |
| 5819 | // | |<-------------| |
| 5820 | // | | | |
| 5821 | // | RESTSubDelResp | | |
| 5822 | // |<----------------| | |
| 5823 | // |
| 5824 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5825 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5826 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5827 | |
| 5828 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5829 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5830 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5831 | Counter{cSubReqToE2, 1}, |
| 5832 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5833 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5834 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5835 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5836 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5837 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5838 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5839 | |
| 5840 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5841 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5842 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5843 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5844 | |
| 5845 | // Check subscription |
| 5846 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5847 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5848 | mainCtrl.SimulateRestart(t) |
| 5849 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5850 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5851 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5852 | // That needs to be completed before successful subscription query is possible |
| 5853 | <-time.After(time.Second * 1) |
| 5854 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5855 | // Check subscription |
| 5856 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5857 | |
| 5858 | // Delete subscription |
| 5859 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5860 | |
| 5861 | //Wait that subs is cleaned |
| 5862 | waitSubsCleanup(t, e2SubsId, 10) |
| 5863 | |
| 5864 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5865 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5866 | } |
| 5867 | |
| 5868 | //----------------------------------------------------------------------------- |
| 5869 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5870 | // |
| 5871 | // stub stub |
| 5872 | // +-------+ +-------+ +---------+ +---------+ |
| 5873 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5874 | // +-------+ +-------+ +---------+ +---------+ |
| 5875 | // | | | | |
| 5876 | // | | RESTSubReq1 | | |
| 5877 | // | |---------------->| | |
| 5878 | // | | | | |
| 5879 | // | | RESTSubResp1 | | |
| 5880 | // | |<----------------| | |
| 5881 | // | | | | |
| 5882 | // | | | SubReq1 | |
| 5883 | // | | |------------->| |
| 5884 | // | | | SubResp1 | |
| 5885 | // | | |<-------------| |
| 5886 | // | | RESTNotif1 | | |
| 5887 | // | |<----------------| | |
| 5888 | // | | | | |
| 5889 | // | RESTSubReq2 | | |
| 5890 | // |------------------------------>| | |
| 5891 | // | | | | |
| 5892 | // | RESTSubResp2 | | |
| 5893 | // |<------------------------------| | |
| 5894 | // | | | | |
| 5895 | // | | RESTNotif2 | | |
| 5896 | // |<------------------------------| | |
| 5897 | // | | | | |
| 5898 | // | | Submgr restart | |
| 5899 | // | | | | |
| 5900 | // | | RESTSubDelReq1 | | |
| 5901 | // | |---------------->| | |
| 5902 | // | | | | |
| 5903 | // | | RESTSubDelResp1 | | |
| 5904 | // | |<----------------| | |
| 5905 | // | | | | |
| 5906 | // | | Submgr restart | |
| 5907 | // | | | | |
| 5908 | // | RESTSubDelReq2 | | |
| 5909 | // |------------------------------>| | |
| 5910 | // | | | | |
| 5911 | // | RESTSubDelResp2 | | |
| 5912 | // |<------------------------------| | |
| 5913 | // | | | | |
| 5914 | // | | | SubDelReq2 | |
| 5915 | // | | |------------->| |
| 5916 | // | | | | |
| 5917 | // | | | SubDelResp2 | |
| 5918 | // | | |<-------------| |
| 5919 | // | | | | |
| 5920 | // |
| 5921 | //----------------------------------------------------------------------------- |
| 5922 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5923 | |
| 5924 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5925 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5926 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5927 | Counter{cSubReqToE2, 1}, |
| 5928 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5929 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5930 | Counter{cMergedSubscriptions, 1}, |
| 5931 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5932 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5933 | Counter{cSubDelReqToE2, 1}, |
| 5934 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5935 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5936 | }) |
| 5937 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5938 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5939 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5940 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5941 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5942 | |
| 5943 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5944 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5945 | params.SetMeid("RAN_NAME_1") |
| 5946 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5947 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5948 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5949 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5950 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5951 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5952 | |
| 5953 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5954 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5955 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5956 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5957 | |
| 5958 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5959 | // That needs to be completed before successful subscription delete is possible |
| 5960 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5961 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5962 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5963 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 5964 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5965 | // 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] | 5966 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5967 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5968 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5969 | |
| 5970 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5971 | // That needs to be completed before successful subscription query is possible |
| 5972 | <-time.After(time.Second * 1) |
| 5973 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5974 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5975 | |
| 5976 | // Delete subscription 2 |
| 5977 | deleteXapp2Subscription(t, &restSubId2) |
| 5978 | |
| 5979 | //Wait that subs is cleaned |
| 5980 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5981 | |
| 5982 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5983 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5984 | } |
| 5985 | |
| 5986 | //----------------------------------------------------------------------------- |
| 5987 | // TestRESTReportSubReqAndSubDelOk |
| 5988 | // |
| 5989 | // stub stub |
| 5990 | // +-------+ +---------+ +---------+ |
| 5991 | // | xapp | | submgr | | e2term | |
| 5992 | // +-------+ +---------+ +---------+ |
| 5993 | // | | | |
| 5994 | // | RestSubReq | | |
| 5995 | // |---------------->| | |
| 5996 | // | | | |
| 5997 | // | RESTSubResp | | |
| 5998 | // |<----------------| | |
| 5999 | // | | | |
| 6000 | // | | SubReq | |
| 6001 | // | |------------->| |
| 6002 | // | | | |
| 6003 | // | | SubResp | |
| 6004 | // | |<-------------| |
| 6005 | // | RESTNotif | | |
| 6006 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6007 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6008 | // | |------------->| |
| 6009 | // | | | |
| 6010 | // | | SubResp | |
| 6011 | // | |<-------------| |
| 6012 | // | RESTNotif | | |
| 6013 | // |<----------------| | |
| 6014 | // | ... | ... | |
| 6015 | // | | | |
| 6016 | // | | | |
| 6017 | // | RESTSubDelReq | | |
| 6018 | // |---------------->| | |
| 6019 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6020 | // | RESTSubDelResp| | |
| 6021 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6022 | // | | SubDelReq | |
| 6023 | // | |------------->| |
| 6024 | // | | | |
| 6025 | // | | SubDelResp | |
| 6026 | // | |<-------------| |
| 6027 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6028 | // |
| 6029 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6030 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6031 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6032 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6033 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6034 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6035 | } |
| 6036 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6037 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6038 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6039 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6040 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6041 | Counter{cRestSubReqFromXapp, 1}, |
| 6042 | Counter{cRestSubRespToXapp, 1}, |
| 6043 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6044 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 6045 | Counter{cRestSubNotifToXapp, 1}, |
| 6046 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6047 | Counter{cRestSubDelRespToXapp, 1}, |
| 6048 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6049 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 6050 | }) |
| 6051 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6052 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6053 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6054 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6055 | |
| 6056 | var e2SubsId []uint32 |
| 6057 | for i := 0; i < subReqCount; i++ { |
| 6058 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6059 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6060 | |
| 6061 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6062 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6063 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6064 | e2SubsId = append(e2SubsId, instanceId) |
| 6065 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6066 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 6067 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 6068 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 6069 | |
| 6070 | } |
| 6071 | |
| 6072 | // Del |
| 6073 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6074 | |
| 6075 | for i := 0; i < subReqCount; i++ { |
| 6076 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6077 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6078 | } |
| 6079 | |
| 6080 | // Wait that subs is cleaned |
| 6081 | for i := 0; i < subReqCount; i++ { |
| 6082 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6083 | } |
| 6084 | |
| 6085 | xappConn1.TestMsgChanEmpty(t) |
| 6086 | e2termConn1.TestMsgChanEmpty(t) |
| 6087 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6088 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6089 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6090 | } |
| 6091 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6092 | //----------------------------------------------------------------------------- |
| 6093 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6094 | // |
| 6095 | // stub stub |
| 6096 | // +-------+ +---------+ +---------+ |
| 6097 | // | xapp | | submgr | | e2term | |
| 6098 | // +-------+ +---------+ +---------+ |
| 6099 | // | | | |
| 6100 | // | RestSubReq | | |
| 6101 | // |---------------->| | |
| 6102 | // | | | |
| 6103 | // | RESTSubResp | | |
| 6104 | // |<----------------| | |
| 6105 | // | | | |
| 6106 | // | | SubReq | |
| 6107 | // | |------------->| |
| 6108 | // | | | |
| 6109 | // | | SubResp | |
| 6110 | // | |<-------------| |
| 6111 | // | RESTNotif | | |
| 6112 | // |<----------------| | |
| 6113 | // | | SubReq | |
| 6114 | // | |------------->| |
| 6115 | // | | | |
| 6116 | // | | SubResp | |
| 6117 | // | |<-------------| |
| 6118 | // | RESTNotif | | |
| 6119 | // |<----------------| | |
| 6120 | // | | | |
| 6121 | // | RESTSubDelReq | | |
| 6122 | // |---------------->| | |
| 6123 | // | | | |
| 6124 | // | RESTSubDelResp| | |
| 6125 | // |<----------------| | |
| 6126 | // | | SubDelReq | |
| 6127 | // | |------------->| |
| 6128 | // | | | |
| 6129 | // | | SubDelResp | |
| 6130 | // | |<-------------| |
| 6131 | // | | | |
| 6132 | // | | SubDelReq | |
| 6133 | // | |------------->| |
| 6134 | // | | | |
| 6135 | // | | SubDelResp | |
| 6136 | // | |<-------------| |
| 6137 | // | | | |
| 6138 | // |
| 6139 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6140 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6141 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6142 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6143 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6144 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6145 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6146 | Counter{cSubReqToE2, 2}, |
| 6147 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6148 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6149 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6150 | Counter{cSubDelReqToE2, 2}, |
| 6151 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6152 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6153 | }) |
| 6154 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6155 | const subReqCount int = 2 |
| 6156 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6157 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6158 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6159 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6160 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6161 | |
| 6162 | assert.Equal(t, len(e2SubsIds), 2) |
| 6163 | |
| 6164 | // Del |
| 6165 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6166 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6167 | |
| 6168 | xappConn1.TestMsgChanEmpty(t) |
| 6169 | e2termConn1.TestMsgChanEmpty(t) |
| 6170 | mainCtrl.wait_registry_empty(t, 10) |
| 6171 | |
| 6172 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6173 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6174 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6175 | |
| 6176 | //----------------------------------------------------------------------------- |
| 6177 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6178 | // |
| 6179 | // stub stub |
| 6180 | // +-------+ +---------+ +---------+ |
| 6181 | // | xapp | | submgr | | e2term | |
| 6182 | // +-------+ +---------+ +---------+ |
| 6183 | // | | | |
| 6184 | // | RestSubReq | | |
| 6185 | // |---------------->| | |
| 6186 | // | | | |
| 6187 | // | RESTSubResp | | |
| 6188 | // |<----------------| | |
| 6189 | // | | | ------ |
| 6190 | // | | SubReq | |
| 6191 | // | |------------->| |
| 6192 | // | | | E2 subscription x 19 |
| 6193 | // | | SubResp | |
| 6194 | // | |<-------------| |
| 6195 | // | RESTNotif | | |
| 6196 | // |<----------------| | |
| 6197 | // | | | ------ |
| 6198 | // | RESTSubDelReq | | |
| 6199 | // |---------------->| | |
| 6200 | // | | | |
| 6201 | // | RESTSubDelResp| | |
| 6202 | // |<----------------| | |
| 6203 | // | | SubDelReq | ------ |
| 6204 | // | |------------->| |
| 6205 | // | | | E2 subscription delete x 19 |
| 6206 | // | | SubDelResp | |
| 6207 | // | |<-------------| |
| 6208 | // | | | ------ |
| 6209 | // | | | |
| 6210 | // |
| 6211 | //----------------------------------------------------------------------------- |
| 6212 | |
| 6213 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6214 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6215 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6216 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6217 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6218 | Counter{cSubReqToE2, 19}, |
| 6219 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6220 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6221 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6222 | Counter{cSubDelReqToE2, 19}, |
| 6223 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6224 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6225 | }) |
| 6226 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6227 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6228 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6229 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6230 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6231 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6232 | |
| 6233 | assert.Equal(t, len(e2SubsIds), 19) |
| 6234 | |
| 6235 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6236 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6237 | |
| 6238 | xappConn1.TestMsgChanEmpty(t) |
| 6239 | e2termConn1.TestMsgChanEmpty(t) |
| 6240 | mainCtrl.wait_registry_empty(t, 10) |
| 6241 | |
| 6242 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6243 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6244 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6245 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6246 | //----------------------------------------------------------------------------- |
| 6247 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6248 | // |
| 6249 | // stub stub |
| 6250 | // +-------+ +---------+ +---------+ |
| 6251 | // | xapp | | submgr | | e2term | |
| 6252 | // +-------+ +---------+ +---------+ |
| 6253 | // | | | |
| 6254 | // | RestSubReq | | |
| 6255 | // |---------------->| | |
| 6256 | // | | | |
| 6257 | // | RESTSubResp | | |
| 6258 | // |<----------------| | |
| 6259 | // | | | |
| 6260 | // | | SubReq | |
| 6261 | // | |------------->| |
| 6262 | // | | | |
| 6263 | // | | SubResp | |
| 6264 | // | |<-------------| |
| 6265 | // | RESTNotif | | |
| 6266 | // |<----------------| | |
| 6267 | // | | SubReq | |
| 6268 | // | |------------->| |
| 6269 | // | | | |
| 6270 | // | | SubResp | |
| 6271 | // | |<-------------| |
| 6272 | // | RESTNotif | | |
| 6273 | // |<----------------| | |
| 6274 | // | | | |
| 6275 | // | RESTSubDelReq | | |
| 6276 | // |---------------->| | |
| 6277 | // | | | |
| 6278 | // | RESTSubDelResp| | |
| 6279 | // |<----------------| | |
| 6280 | // | | SubDelReq | |
| 6281 | // | |------------->| |
| 6282 | // | | | |
| 6283 | // | | SubDelResp | |
| 6284 | // | |<-------------| |
| 6285 | // | | | |
| 6286 | // | | SubDelReq | |
| 6287 | // | |------------->| |
| 6288 | // | | | |
| 6289 | // | | SubDelResp | |
| 6290 | // | |<-------------| |
| 6291 | // | | | |
| 6292 | // |
| 6293 | //----------------------------------------------------------------------------- |
| 6294 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6295 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6296 | |
| 6297 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6298 | |
| 6299 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6300 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6301 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6302 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6303 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6304 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6305 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6306 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6307 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6308 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6309 | }) |
| 6310 | |
| 6311 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6312 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6313 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6314 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6315 | |
| 6316 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6317 | |
| 6318 | // Del |
| 6319 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6320 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6321 | |
| 6322 | xappConn1.TestMsgChanEmpty(t) |
| 6323 | e2termConn1.TestMsgChanEmpty(t) |
| 6324 | mainCtrl.wait_registry_empty(t, 10) |
| 6325 | |
| 6326 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6327 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6328 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6329 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6330 | //----------------------------------------------------------------------------- |
| 6331 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6332 | // |
| 6333 | // stub stub |
| 6334 | // +-------+ +---------+ +---------+ |
| 6335 | // | xapp | | submgr | | e2term | |
| 6336 | // +-------+ +---------+ +---------+ |
| 6337 | // | | | |
| 6338 | // | RestSubReq | | |
| 6339 | // |---------------->| | |
| 6340 | // | | | |
| 6341 | // | RESTSubResp | | |
| 6342 | // |<----------------| | |
| 6343 | // | | | |
| 6344 | // | | SubReq | |
| 6345 | // | |------------->| |
| 6346 | // | | | |
| 6347 | // | | SubResp | |
| 6348 | // | |<-------------| |
| 6349 | // | RESTNotif | | |
| 6350 | // |<----------------| | |
| 6351 | // | | SubReq | |
| 6352 | // | |------------->| |
| 6353 | // | | | |
| 6354 | // | | SubResp | |
| 6355 | // | |<-------------| |
| 6356 | // | RESTNotif | | |
| 6357 | // |<----------------| | |
| 6358 | // | | | |
| 6359 | // | RESTSubDelReq | | |
| 6360 | // |---------------->| | |
| 6361 | // | | | |
| 6362 | // | RESTSubDelResp| | |
| 6363 | // |<----------------| | |
| 6364 | // | | SubDelReq | |
| 6365 | // | |------------->| |
| 6366 | // | | | |
| 6367 | // | | SubDelResp | |
| 6368 | // | |<-------------| |
| 6369 | // | | | |
| 6370 | // | | SubDelReq | |
| 6371 | // | |------------->| |
| 6372 | // | | | |
| 6373 | // | | SubDelResp | |
| 6374 | // | |<-------------| |
| 6375 | // | | | |
| 6376 | // |
| 6377 | //----------------------------------------------------------------------------- |
| 6378 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6379 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6380 | |
| 6381 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6382 | |
| 6383 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6384 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6385 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6386 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6387 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6388 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6389 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6390 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6391 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6392 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6393 | }) |
| 6394 | |
| 6395 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6396 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6397 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6398 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6399 | |
| 6400 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6401 | |
| 6402 | // Del |
| 6403 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6404 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6405 | |
| 6406 | xappConn1.TestMsgChanEmpty(t) |
| 6407 | e2termConn1.TestMsgChanEmpty(t) |
| 6408 | mainCtrl.wait_registry_empty(t, 10) |
| 6409 | |
| 6410 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6411 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6412 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6413 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6414 | //----------------------------------------------------------------------------- |
| 6415 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6416 | // |
| 6417 | // stub stub |
| 6418 | // +-------+ +---------+ +---------+ |
| 6419 | // | xapp | | submgr | | e2term | |
| 6420 | // +-------+ +---------+ +---------+ |
| 6421 | // | | | |
| 6422 | // | RestSubReq | | |
| 6423 | // |---------------->| | |
| 6424 | // | | | |
| 6425 | // | RESTSubResp | | |
| 6426 | // |<----------------| | |
| 6427 | // | | | ------ |
| 6428 | // | | SubReq | |
| 6429 | // | |------------->| |
| 6430 | // | | | E2 subscription x 19 |
| 6431 | // | | SubResp | |
| 6432 | // | |<-------------| |
| 6433 | // | RESTNotif | | |
| 6434 | // |<----------------| | |
| 6435 | // | | | ------ |
| 6436 | // | RESTSubDelReq | | |
| 6437 | // |---------------->| | |
| 6438 | // | | | |
| 6439 | // | RESTSubDelResp| | |
| 6440 | // |<----------------| | |
| 6441 | // | | SubDelReq | ------ |
| 6442 | // | |------------->| |
| 6443 | // | | | E2 subscription delete x 19 |
| 6444 | // | | SubDelResp | |
| 6445 | // | |<-------------| |
| 6446 | // | | | ------ |
| 6447 | // | | | |
| 6448 | // |
| 6449 | //----------------------------------------------------------------------------- |
| 6450 | |
| 6451 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6452 | |
| 6453 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6454 | |
| 6455 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6456 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6457 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6458 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6459 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6460 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6461 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6462 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6463 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6464 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6465 | }) |
| 6466 | |
| 6467 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6468 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6469 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6470 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6471 | |
| 6472 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6473 | |
| 6474 | // Del |
| 6475 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6476 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6477 | |
| 6478 | xappConn1.TestMsgChanEmpty(t) |
| 6479 | e2termConn1.TestMsgChanEmpty(t) |
| 6480 | mainCtrl.wait_registry_empty(t, 10) |
| 6481 | |
| 6482 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6483 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6484 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6485 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6486 | //----------------------------------------------------------------------------- |
| 6487 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6488 | // |
| 6489 | // stub stub stub |
| 6490 | // +-------+ +-------+ +---------+ +---------+ |
| 6491 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6492 | // +-------+ +-------+ +---------+ +---------+ |
| 6493 | // | | | | |
| 6494 | // | | RESTSubReq1 | | |
| 6495 | // | |------------->| | |
| 6496 | // | | RESTSubResp1 | | |
| 6497 | // | |<-------------| | |
| 6498 | // | | | | |
| 6499 | // | | | SubReq1 | |
| 6500 | // | | |------------->| |
| 6501 | // | | | | |
| 6502 | // | RESTSubReq2 | | |
| 6503 | // |------------------------>| | |
| 6504 | // | RESTSubResp2 | | |
| 6505 | // |<------------------------| | |
| 6506 | // | | | | |
| 6507 | // | | | SubReq2 | |
| 6508 | // | | |------------->| |
| 6509 | // | | | | |
| 6510 | // | | | SubResp1 | |
| 6511 | // | | |<-------------| |
| 6512 | // | | RESTNotif1 | | |
| 6513 | // | |<-------------| | |
| 6514 | // | | | | |
| 6515 | // | | | SubResp2 | |
| 6516 | // | | |<-------------| |
| 6517 | // | RESTNotif2 | | |
| 6518 | // |<------------------------| | |
| 6519 | // | | | | |
| 6520 | // | | [SUBS 1 DELETE] | |
| 6521 | // | | | | |
| 6522 | // | | [SUBS 2 DELETE] | |
| 6523 | // | | | | |
| 6524 | // |
| 6525 | //----------------------------------------------------------------------------- |
| 6526 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6527 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6528 | |
| 6529 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6530 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6531 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6532 | Counter{cSubReqToE2, 2}, |
| 6533 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6534 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6535 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6536 | Counter{cSubDelReqToE2, 2}, |
| 6537 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6538 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6539 | }) |
| 6540 | |
| 6541 | // Req1 |
| 6542 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6543 | |
| 6544 | //Subs Create |
| 6545 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6546 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6547 | |
| 6548 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6549 | |
| 6550 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6551 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6552 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6553 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6554 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6555 | |
| 6556 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6557 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6558 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6559 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6560 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6561 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6562 | |
| 6563 | deleteXapp1Subscription(t, &restSubId1) |
| 6564 | deleteXapp2Subscription(t, &restSubId2) |
| 6565 | |
| 6566 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6567 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6568 | |
| 6569 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6570 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6571 | } |
| 6572 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6573 | //----------------------------------------------------------------------------- |
| 6574 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6575 | // |
| 6576 | // stub stub stub |
| 6577 | // +-------+ +-------+ +---------+ +---------+ |
| 6578 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6579 | // +-------+ +-------+ +---------+ +---------+ |
| 6580 | // | | | | |
| 6581 | // | | RESTSubReq1 | | |
| 6582 | // | |------------->| | |
| 6583 | // | | RESTSubResp1 | | |
| 6584 | // | |<-------------| | |
| 6585 | // | | | | |
| 6586 | // | | | SubReq1 | |
| 6587 | // | | |------------->| |
| 6588 | // | | | | |
| 6589 | // | RESTSubReq2 | | |
| 6590 | // |------------------------>| | |
| 6591 | // | RESTSubResp2 | | |
| 6592 | // |<------------------------| | |
| 6593 | // | | | | |
| 6594 | // | | | SubReq2 | |
| 6595 | // | | |------------->| |
| 6596 | // | | | | |
| 6597 | // | | | SubResp1 | |
| 6598 | // | | |<-------------| |
| 6599 | // | | RESTNotif1 | | |
| 6600 | // | |<-------------| | |
| 6601 | // | | | | |
| 6602 | // | | | SubResp2 | |
| 6603 | // | | |<-------------| |
| 6604 | // | RESTNotif2 | | |
| 6605 | // |<------------------------| | |
| 6606 | // | | | | |
| 6607 | // | | [SUBS 1 DELETE] | |
| 6608 | // | | | | |
| 6609 | // | | [SUBS 2 DELETE] | |
| 6610 | // | | | | |
| 6611 | // |
| 6612 | //----------------------------------------------------------------------------- |
| 6613 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6614 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6615 | |
| 6616 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6617 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6618 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6619 | Counter{cSubReqToE2, 2}, |
| 6620 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6621 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6622 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6623 | Counter{cSubDelReqToE2, 2}, |
| 6624 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6625 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6626 | }) |
| 6627 | |
| 6628 | // Req1 |
| 6629 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6630 | |
| 6631 | //Subs Create |
| 6632 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6633 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6634 | |
| 6635 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6636 | |
| 6637 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6638 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6639 | params.SetMeid("RAN_NAME_1") |
| 6640 | |
| 6641 | actionId := int64(1) |
| 6642 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6643 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6644 | subsequestActionType := "continue" |
| 6645 | timeToWait := "w10ms" |
| 6646 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6647 | |
| 6648 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6649 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6650 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6651 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6652 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6653 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6654 | |
| 6655 | deleteXapp1Subscription(t, &restSubId1) |
| 6656 | deleteXapp2Subscription(t, &restSubId2) |
| 6657 | |
| 6658 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6659 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6660 | |
| 6661 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6662 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6663 | } |
| 6664 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6665 | //----------------------------------------------------------------------------- |
| 6666 | // TestRESTSubReqReportSameActionDiffActionID |
| 6667 | // |
| 6668 | // stub stub stub |
| 6669 | // +-------+ +-------+ +---------+ +---------+ |
| 6670 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6671 | // +-------+ +-------+ +---------+ +---------+ |
| 6672 | // | | | | |
| 6673 | // | | RESTSubReq1 | | |
| 6674 | // | |------------->| | |
| 6675 | // | | RESTSubResp1 | | |
| 6676 | // | |<-------------| | |
| 6677 | // | | | | |
| 6678 | // | | | SubReq1 | |
| 6679 | // | | |------------->| |
| 6680 | // | | | | |
| 6681 | // | RESTSubReq2 | | |
| 6682 | // |------------------------>| | |
| 6683 | // | RESTSubResp2 | | |
| 6684 | // |<------------------------| | |
| 6685 | // | | | | |
| 6686 | // | | | SubReq2 | |
| 6687 | // | | |------------->| |
| 6688 | // | | | | |
| 6689 | // | | | SubResp1 | |
| 6690 | // | | |<-------------| |
| 6691 | // | | RESTNotif1 | | |
| 6692 | // | |<-------------| | |
| 6693 | // | | | | |
| 6694 | // | | | SubResp2 | |
| 6695 | // | | |<-------------| |
| 6696 | // | RESTNotif2 | | |
| 6697 | // |<------------------------| | |
| 6698 | // | | | | |
| 6699 | // | | [SUBS 1 DELETE] | |
| 6700 | // | | | | |
| 6701 | // | | [SUBS 2 DELETE] | |
| 6702 | // | | | | |
| 6703 | // |
| 6704 | //----------------------------------------------------------------------------- |
| 6705 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6706 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6707 | |
| 6708 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6709 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6710 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6711 | Counter{cSubReqToE2, 2}, |
| 6712 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6713 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6714 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6715 | Counter{cSubDelReqToE2, 2}, |
| 6716 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6717 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6718 | }) |
| 6719 | |
| 6720 | // Req1 |
| 6721 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6722 | |
| 6723 | //Subs Create |
| 6724 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6725 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6726 | |
| 6727 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6728 | |
| 6729 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6730 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6731 | params.SetMeid("RAN_NAME_1") |
| 6732 | params.SetSubActionIDs(int64(2)) |
| 6733 | |
| 6734 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6735 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6736 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6737 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6738 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6739 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6740 | |
| 6741 | deleteXapp1Subscription(t, &restSubId1) |
| 6742 | deleteXapp2Subscription(t, &restSubId2) |
| 6743 | |
| 6744 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6745 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6746 | |
| 6747 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6748 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6749 | } |
| 6750 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6751 | //----------------------------------------------------------------------------- |
| 6752 | // TestRESTSubReqDiffActionType |
| 6753 | // |
| 6754 | // stub stub stub |
| 6755 | // +-------+ +-------+ +---------+ +---------+ |
| 6756 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6757 | // +-------+ +-------+ +---------+ +---------+ |
| 6758 | // | | | | |
| 6759 | // | | RESTSubReq1 | | |
| 6760 | // | |------------->| | |
| 6761 | // | | RESTSubResp1 | | |
| 6762 | // | |<-------------| | |
| 6763 | // | | | | |
| 6764 | // | | | SubReq1 | |
| 6765 | // | | |------------->| |
| 6766 | // | | | | |
| 6767 | // | RESTSubReq2 | | |
| 6768 | // |------------------------>| | |
| 6769 | // | RESTSubResp2 | | |
| 6770 | // |<------------------------| | |
| 6771 | // | | | | |
| 6772 | // | | | SubReq2 | |
| 6773 | // | | |------------->| |
| 6774 | // | | | | |
| 6775 | // | | | SubResp1 | |
| 6776 | // | | |<-------------| |
| 6777 | // | | RESTNotif1 | | |
| 6778 | // | |<-------------| | |
| 6779 | // | | | | |
| 6780 | // | | | SubResp2 | |
| 6781 | // | | |<-------------| |
| 6782 | // | RESTNotif2 | | |
| 6783 | // |<------------------------| | |
| 6784 | // | | | | |
| 6785 | // | | [SUBS 1 DELETE] | |
| 6786 | // | | | | |
| 6787 | // | | [SUBS 2 DELETE] | |
| 6788 | // | | | | |
| 6789 | // |
| 6790 | //----------------------------------------------------------------------------- |
| 6791 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6792 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6793 | |
| 6794 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6795 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6796 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6797 | Counter{cSubReqToE2, 2}, |
| 6798 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6799 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6800 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6801 | Counter{cSubDelReqToE2, 2}, |
| 6802 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6803 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6804 | }) |
| 6805 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6806 | const e2Timeout int64 = 2 |
| 6807 | const e2RetryCount int64 = 2 |
| 6808 | const routingNeeded bool = true |
| 6809 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6810 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6811 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6812 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6813 | |
| 6814 | //Subs Create |
| 6815 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6816 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6817 | |
| 6818 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6819 | |
| 6820 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6821 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6822 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6823 | params.SetMeid("RAN_NAME_1") |
| 6824 | |
| 6825 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6826 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6827 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6828 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6829 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6830 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6831 | |
| 6832 | deleteXapp1Subscription(t, &restSubId1) |
| 6833 | deleteXapp2Subscription(t, &restSubId2) |
| 6834 | |
| 6835 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6836 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6837 | |
| 6838 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6839 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6840 | } |
| 6841 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6842 | //----------------------------------------------------------------------------- |
| 6843 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 6844 | // |
| 6845 | // stub stub stub |
| 6846 | // +-------+ +-------+ +---------+ +---------+ |
| 6847 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6848 | // +-------+ +-------+ +---------+ +---------+ |
| 6849 | // | | | | |
| 6850 | // | | RESTSubReq1 | | |
| 6851 | // | |------------->| | |
| 6852 | // | | RESTSubResp1 | | |
| 6853 | // | |<-------------| | |
| 6854 | // | | | | |
| 6855 | // | | | SubReq1 | |
| 6856 | // | | |------------->| |
| 6857 | // | | | | |
| 6858 | // | RESTSubReq2 | | |
| 6859 | // |------------------------>| | |
| 6860 | // | RESTSubResp2 | | |
| 6861 | // |<------------------------| | |
| 6862 | // | | | | |
| 6863 | // | | | SubReq2 | |
| 6864 | // | | |------------->| |
| 6865 | // | | | | |
| 6866 | // | | | SubResp1 | |
| 6867 | // | | |<-------------| |
| 6868 | // | | RESTNotif1 | | |
| 6869 | // | |<-------------| | |
| 6870 | // | | | | |
| 6871 | // | | | SubResp2 | |
| 6872 | // | | |<-------------| |
| 6873 | // | RESTNotif2 | | |
| 6874 | // |<------------------------| | |
| 6875 | // | | | | |
| 6876 | // | | [SUBS 1 DELETE] | |
| 6877 | // | | | | |
| 6878 | // | | [SUBS 2 DELETE] | |
| 6879 | // | | | | |
| 6880 | // |
| 6881 | //----------------------------------------------------------------------------- |
| 6882 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6883 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6884 | |
| 6885 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6886 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6887 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6888 | Counter{cSubReqToE2, 2}, |
| 6889 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6890 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6891 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6892 | Counter{cSubDelReqToE2, 2}, |
| 6893 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6894 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6895 | }) |
| 6896 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6897 | const e2Timeout int64 = 2 |
| 6898 | const e2RetryCount int64 = 2 |
| 6899 | const routingNeeded bool = true |
| 6900 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6901 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6902 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6903 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6904 | |
| 6905 | //Subs Create |
| 6906 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6907 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6908 | |
| 6909 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6910 | |
| 6911 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6912 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6913 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6914 | params.SetMeid("RAN_NAME_1") |
| 6915 | |
| 6916 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6917 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6918 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6919 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6920 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6921 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6922 | |
| 6923 | deleteXapp1Subscription(t, &restSubId1) |
| 6924 | deleteXapp2Subscription(t, &restSubId2) |
| 6925 | |
| 6926 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6927 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6928 | |
| 6929 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6930 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6931 | } |
| 6932 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6933 | //----------------------------------------------------------------------------- |
| 6934 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 6935 | // |
| 6936 | // stub stub stub |
| 6937 | // +-------+ +-------+ +---------+ +---------+ |
| 6938 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6939 | // +-------+ +-------+ +---------+ +---------+ |
| 6940 | // | | | | |
| 6941 | // | | RESTSubReq1 | | |
| 6942 | // | |------------->| | |
| 6943 | // | | RESTSubResp1 | | |
| 6944 | // | |<-------------| | |
| 6945 | // | | | | |
| 6946 | // | | | SubReq1 | |
| 6947 | // | | |------------->| |
| 6948 | // | | | | |
| 6949 | // | RESTSubReq2 | | |
| 6950 | // |------------------------>| | |
| 6951 | // | RESTSubResp2 | | |
| 6952 | // |<------------------------| | |
| 6953 | // | | | | |
| 6954 | // | | | SubReq2 | |
| 6955 | // | | |------------->| |
| 6956 | // | | | | |
| 6957 | // | | | SubResp1 | |
| 6958 | // | | |<-------------| |
| 6959 | // | | RESTNotif1 | | |
| 6960 | // | |<-------------| | |
| 6961 | // | | | | |
| 6962 | // | | | SubResp2 | |
| 6963 | // | | |<-------------| |
| 6964 | // | RESTNotif2 | | |
| 6965 | // |<------------------------| | |
| 6966 | // | | | | |
| 6967 | // | | [SUBS 1 DELETE] | |
| 6968 | // | | | | |
| 6969 | // | | [SUBS 2 DELETE] | |
| 6970 | // | | | | |
| 6971 | // |
| 6972 | //----------------------------------------------------------------------------- |
| 6973 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6974 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6975 | |
| 6976 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6977 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6978 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6979 | Counter{cSubReqToE2, 2}, |
| 6980 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6981 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6982 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6983 | Counter{cSubDelReqToE2, 2}, |
| 6984 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6985 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6986 | }) |
| 6987 | |
| 6988 | // Req1 |
| 6989 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6990 | |
| 6991 | //Subs Create |
| 6992 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6993 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6994 | |
| 6995 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6996 | |
| 6997 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6998 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6999 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7000 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7001 | params.SetSubActionDefinition(actionDefinition) |
| 7002 | |
| 7003 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7004 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7005 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7006 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7007 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7008 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7009 | |
| 7010 | deleteXapp1Subscription(t, &restSubId1) |
| 7011 | deleteXapp2Subscription(t, &restSubId2) |
| 7012 | |
| 7013 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7014 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7015 | |
| 7016 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7017 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7018 | } |
| 7019 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7020 | //----------------------------------------------------------------------------- |
| 7021 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 7022 | // |
| 7023 | // stub stub stub |
| 7024 | // +-------+ +-------+ +---------+ +---------+ |
| 7025 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7026 | // +-------+ +-------+ +---------+ +---------+ |
| 7027 | // | | | | |
| 7028 | // | | RESTSubReq1 | | |
| 7029 | // | |------------->| | |
| 7030 | // | | RESTSubResp1 | | |
| 7031 | // | |<-------------| | |
| 7032 | // | | | | |
| 7033 | // | | | SubReq1 | |
| 7034 | // | | |------------->| |
| 7035 | // | | | | |
| 7036 | // | RESTSubReq2 | | |
| 7037 | // |------------------------>| | |
| 7038 | // | RESTSubResp2 | | |
| 7039 | // |<------------------------| | |
| 7040 | // | | | | |
| 7041 | // | | | SubReq2 | |
| 7042 | // | | |------------->| |
| 7043 | // | | | | |
| 7044 | // | | | SubResp1 | |
| 7045 | // | | |<-------------| |
| 7046 | // | | RESTNotif1 | | |
| 7047 | // | |<-------------| | |
| 7048 | // | | | | |
| 7049 | // | | | SubResp2 | |
| 7050 | // | | |<-------------| |
| 7051 | // | RESTNotif2 | | |
| 7052 | // |<------------------------| | |
| 7053 | // | | | | |
| 7054 | // | | [SUBS 1 DELETE] | |
| 7055 | // | | | | |
| 7056 | // | | [SUBS 2 DELETE] | |
| 7057 | // | | | | |
| 7058 | // |
| 7059 | //----------------------------------------------------------------------------- |
| 7060 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7061 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7062 | |
| 7063 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7064 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7065 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7066 | Counter{cSubReqToE2, 2}, |
| 7067 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7068 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7069 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7070 | Counter{cSubDelReqToE2, 2}, |
| 7071 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7072 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7073 | }) |
| 7074 | |
| 7075 | // Req1 |
| 7076 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7077 | |
| 7078 | //Subs Create |
| 7079 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7080 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7081 | |
| 7082 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7083 | |
| 7084 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7085 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7086 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7087 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7088 | params.SetSubActionDefinition(actionDefinition) |
| 7089 | |
| 7090 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7091 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7092 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7093 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7094 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7095 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7096 | |
| 7097 | deleteXapp1Subscription(t, &restSubId1) |
| 7098 | deleteXapp2Subscription(t, &restSubId2) |
| 7099 | |
| 7100 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7101 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7102 | |
| 7103 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7104 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7105 | } |
| 7106 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7107 | //----------------------------------------------------------------------------- |
| 7108 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7109 | // |
| 7110 | // stub stub stub |
| 7111 | // +-------+ +-------+ +---------+ +---------+ |
| 7112 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7113 | // +-------+ +-------+ +---------+ +---------+ |
| 7114 | // | | | | |
| 7115 | // | | RESTSubReq1 | | |
| 7116 | // | |------------->| | |
| 7117 | // | | RESTSubResp1 | | |
| 7118 | // | |<-------------| | |
| 7119 | // | | | | |
| 7120 | // | | | SubReq1 | |
| 7121 | // | | |------------->| |
| 7122 | // | | | | |
| 7123 | // | RESTSubReq2 | | |
| 7124 | // |------------------------>| | |
| 7125 | // | RESTSubResp2 | | |
| 7126 | // |<------------------------| | |
| 7127 | // | | | | |
| 7128 | // | | | SubReq2 | |
| 7129 | // | | |------------->| |
| 7130 | // | | | | |
| 7131 | // | | | SubResp1 | |
| 7132 | // | | |<-------------| |
| 7133 | // | | RESTNotif1 | | |
| 7134 | // | |<-------------| | |
| 7135 | // | | | | |
| 7136 | // | | | SubResp2 | |
| 7137 | // | | |<-------------| |
| 7138 | // | RESTNotif2 | | |
| 7139 | // |<------------------------| | |
| 7140 | // | | | | |
| 7141 | // | | [SUBS 1 DELETE] | |
| 7142 | // | | | | |
| 7143 | // | | [SUBS 2 DELETE] | |
| 7144 | // | | | | |
| 7145 | // |
| 7146 | //----------------------------------------------------------------------------- |
| 7147 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7148 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7149 | |
| 7150 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7151 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7152 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7153 | Counter{cSubReqToE2, 2}, |
| 7154 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7155 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7156 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7157 | Counter{cSubDelReqToE2, 2}, |
| 7158 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7159 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7160 | }) |
| 7161 | |
| 7162 | // Req1 |
| 7163 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7164 | |
| 7165 | //Subs Create |
| 7166 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7167 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7168 | |
| 7169 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7170 | |
| 7171 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7172 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7173 | params.SetMeid("RAN_NAME_1") |
| 7174 | params.SetTimeToWait("w200ms") |
| 7175 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7176 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7177 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7178 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7179 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7180 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7181 | |
| 7182 | deleteXapp1Subscription(t, &restSubId1) |
| 7183 | deleteXapp2Subscription(t, &restSubId2) |
| 7184 | |
| 7185 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7186 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7187 | |
| 7188 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7189 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7190 | } |
| 7191 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7192 | //----------------------------------------------------------------------------- |
| 7193 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7194 | // |
| 7195 | // stub stub |
| 7196 | // +-------+ +---------+ +---------+ |
| 7197 | // | xapp | | submgr | | e2term | |
| 7198 | // +-------+ +---------+ +---------+ |
| 7199 | // | | | |
| 7200 | // | RestSubReq | | |
| 7201 | // |---------------->| | |
| 7202 | // | | | |
| 7203 | // | RESTSubResp | | |
| 7204 | // |<----------------| | |
| 7205 | // | | | |
| 7206 | // | | SubReq | |
| 7207 | // | |------------->| |
| 7208 | // | | | |
| 7209 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7210 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7211 | // | | | |
| 7212 | // | | SubReq | |
| 7213 | // | |------------->| |
| 7214 | // | | | |
| 7215 | // | | SubFail | Duplicated action |
| 7216 | // | |<-------------| |
| 7217 | // | RESTNotif (fail)| | |
| 7218 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7219 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7220 | // | [SUBS DELETE] | |
| 7221 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7222 | // |
| 7223 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7224 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7225 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7226 | |
| 7227 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7228 | Counter{cRestSubReqFromXapp, 1}, |
| 7229 | Counter{cRestSubRespToXapp, 1}, |
| 7230 | Counter{cSubReqToE2, 1}, |
| 7231 | Counter{cSubReqTimerExpiry, 1}, |
| 7232 | Counter{cSubReReqToE2, 1}, |
| 7233 | Counter{cSubRespFromE2, 1}, |
| 7234 | Counter{cSubFailFromE2, 1}, |
| 7235 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7236 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7237 | Counter{cRestSubDelRespToXapp, 1}, |
| 7238 | }) |
| 7239 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7240 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7241 | |
| 7242 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7243 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7244 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7245 | |
| 7246 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7247 | // Decode of this response fails which will result resending original request |
| 7248 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7249 | |
| 7250 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7251 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7252 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7253 | |
| 7254 | // Subscription already created in E2 Node. |
| 7255 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7256 | fparams.Set(crereq) |
| 7257 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7258 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7259 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7260 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7261 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7262 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7263 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7264 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7265 | // Wait that subs is cleaned |
| 7266 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7267 | |
| 7268 | xappConn1.TestMsgChanEmpty(t) |
| 7269 | e2termConn1.TestMsgChanEmpty(t) |
| 7270 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7271 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7272 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7273 | } |
| 7274 | |
| 7275 | //----------------------------------------------------------------------------- |
| 7276 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7277 | // |
| 7278 | // stub stub |
| 7279 | // +-------+ +---------+ +---------+ |
| 7280 | // | xapp | | submgr | | e2term | |
| 7281 | // +-------+ +---------+ +---------+ |
| 7282 | // | | | |
| 7283 | // | RestSubReq | | |
| 7284 | // |---------------->| | |
| 7285 | // | | | |
| 7286 | // | RESTSubResp | | |
| 7287 | // |<----------------| | |
| 7288 | // | | | |
| 7289 | // | | SubReq | |
| 7290 | // | |------------->| |
| 7291 | // | | | |
| 7292 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7293 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7294 | // | | | |
| 7295 | // | | SubReq | |
| 7296 | // | |------------->| |
| 7297 | // | | | |
| 7298 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7299 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7300 | // | RESTNotif (fail)| | |
| 7301 | // |<----------------| | |
| 7302 | // | | SubDelReq | |
| 7303 | // | |------------->| |
| 7304 | // | | | |
| 7305 | // | | SubDelResp | |
| 7306 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7307 | // | | | |
| 7308 | // | [SUBS DELETE] | |
| 7309 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7310 | // |
| 7311 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7312 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7313 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7314 | |
| 7315 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7316 | Counter{cRestSubReqFromXapp, 1}, |
| 7317 | Counter{cRestSubRespToXapp, 1}, |
| 7318 | Counter{cSubReqToE2, 1}, |
| 7319 | Counter{cSubReqTimerExpiry, 2}, |
| 7320 | Counter{cSubReReqToE2, 1}, |
| 7321 | Counter{cSubRespFromE2, 1}, |
| 7322 | Counter{cSubFailFromE2, 1}, |
| 7323 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7324 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7325 | Counter{cRestSubDelRespToXapp, 1}, |
| 7326 | Counter{cSubDelReqToE2, 1}, |
| 7327 | Counter{cSubDelRespFromE2, 1}, |
| 7328 | }) |
| 7329 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7330 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7331 | |
| 7332 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7333 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7334 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7335 | |
| 7336 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7337 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7338 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7339 | orgInstanceId := crereq.RequestId.InstanceId |
| 7340 | crereq.RequestId.InstanceId = 0 |
| 7341 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7342 | |
| 7343 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7344 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7345 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7346 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7347 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7348 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7349 | fparams.Set(crereq) |
| 7350 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7351 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7352 | |
| 7353 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7354 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7355 | |
| 7356 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7357 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7358 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7359 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7360 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7361 | // Wait that subs is cleaned |
| 7362 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7363 | |
| 7364 | xappConn1.TestMsgChanEmpty(t) |
| 7365 | e2termConn1.TestMsgChanEmpty(t) |
| 7366 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7367 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7368 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7369 | } |
| 7370 | |
| 7371 | //----------------------------------------------------------------------------- |
| 7372 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7373 | // |
| 7374 | // stub stub |
| 7375 | // +-------+ +---------+ +---------+ |
| 7376 | // | xapp | | submgr | | e2term | |
| 7377 | // +-------+ +---------+ +---------+ |
| 7378 | // | | | |
| 7379 | // | RestSubReq | | |
| 7380 | // |---------------->| | |
| 7381 | // | | | |
| 7382 | // | RESTSubResp | | |
| 7383 | // |<----------------| | |
| 7384 | // | | | |
| 7385 | // | | SubReq | |
| 7386 | // | |------------->| |
| 7387 | // | | | |
| 7388 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7389 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7390 | // | | | |
| 7391 | // | | SubReq | |
| 7392 | // | |------------->| |
| 7393 | // | | | |
| 7394 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7395 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7396 | // | RESTNotif (fail)| | |
| 7397 | // |<----------------| | |
| 7398 | // | | SubDelReq | |
| 7399 | // | |------------->| |
| 7400 | // | | | |
| 7401 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7402 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7403 | // | | | |
| 7404 | // | | SubDelReq | |
| 7405 | // | |------------->| |
| 7406 | // | | | |
| 7407 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7408 | // | |<-------------| Ongoing transaction not found. |
| 7409 | // | | | |
| 7410 | // | [SUBS DELETE] | |
| 7411 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7412 | // |
| 7413 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7414 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7415 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7416 | |
| 7417 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7418 | Counter{cRestSubReqFromXapp, 1}, |
| 7419 | Counter{cRestSubRespToXapp, 1}, |
| 7420 | Counter{cSubReqToE2, 1}, |
| 7421 | Counter{cSubReqTimerExpiry, 2}, |
| 7422 | Counter{cSubReReqToE2, 1}, |
| 7423 | Counter{cSubRespFromE2, 1}, |
| 7424 | Counter{cSubFailFromE2, 1}, |
| 7425 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7426 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7427 | Counter{cRestSubDelRespToXapp, 1}, |
| 7428 | Counter{cSubDelReqToE2, 1}, |
| 7429 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7430 | Counter{cSubDelReReqToE2, 1}, |
| 7431 | Counter{cSubDelRespFromE2, 2}, |
| 7432 | }) |
| 7433 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7434 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7435 | |
| 7436 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7437 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7438 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7439 | |
| 7440 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7441 | |
| 7442 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7443 | // No transaction exist for this response which will result resending original request |
| 7444 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7445 | |
| 7446 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7447 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7448 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7449 | |
| 7450 | // Subscription already created in E2 Node. |
| 7451 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7452 | fparams.Set(crereq) |
| 7453 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7454 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7455 | |
| 7456 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7457 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7458 | |
| 7459 | // Resending happens because there no transaction |
| 7460 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7461 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7462 | |
| 7463 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7464 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7465 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7466 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7467 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7468 | // Wait that subs is cleaned |
| 7469 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7470 | |
| 7471 | xappConn1.TestMsgChanEmpty(t) |
| 7472 | e2termConn1.TestMsgChanEmpty(t) |
| 7473 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7474 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7475 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7476 | } |
| 7477 | |
| 7478 | //----------------------------------------------------------------------------- |
| 7479 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7480 | // |
| 7481 | // stub stub |
| 7482 | // +-------+ +---------+ +---------+ |
| 7483 | // | xapp | | submgr | | e2term | |
| 7484 | // +-------+ +---------+ +---------+ |
| 7485 | // | | | |
| 7486 | // | RestSubReq | | |
| 7487 | // |---------------->| | |
| 7488 | // | | | |
| 7489 | // | RESTSubResp | | |
| 7490 | // |<----------------| | |
| 7491 | // | | | |
| 7492 | // | | SubReq | |
| 7493 | // | |------------->| |
| 7494 | // | | | |
| 7495 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7496 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7497 | // | | | |
| 7498 | // | | SubReq | |
| 7499 | // | |------------->| |
| 7500 | // | | | |
| 7501 | // | | SubFail | Duplicated action |
| 7502 | // | |<-------------| |
| 7503 | // | RESTNotif (fail)| | |
| 7504 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7505 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7506 | // | [SUBS DELETE] | |
| 7507 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7508 | // |
| 7509 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7510 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7511 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7512 | |
| 7513 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7514 | Counter{cRestSubReqFromXapp, 1}, |
| 7515 | Counter{cRestSubRespToXapp, 1}, |
| 7516 | Counter{cSubReqToE2, 1}, |
| 7517 | Counter{cSubReqTimerExpiry, 1}, |
| 7518 | Counter{cSubReReqToE2, 1}, |
| 7519 | Counter{cSubFailFromE2, 2}, |
| 7520 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7521 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7522 | Counter{cRestSubDelRespToXapp, 1}, |
| 7523 | }) |
| 7524 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7525 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7526 | |
| 7527 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7528 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7529 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7530 | |
| 7531 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7532 | |
| 7533 | // Decode of this response fails which will result resending original request |
| 7534 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7535 | |
| 7536 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7537 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7538 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7539 | |
| 7540 | // Subscription already created in E2 Node. |
| 7541 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7542 | fparams.Set(crereq) |
| 7543 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7544 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7545 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7546 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7547 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7548 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7549 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7550 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7551 | // Wait that subs is cleaned |
| 7552 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7553 | |
| 7554 | xappConn1.TestMsgChanEmpty(t) |
| 7555 | e2termConn1.TestMsgChanEmpty(t) |
| 7556 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7557 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7558 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7559 | } |
| 7560 | |
| 7561 | //----------------------------------------------------------------------------- |
| 7562 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7563 | // |
| 7564 | // stub stub |
| 7565 | // +-------+ +---------+ +---------+ |
| 7566 | // | xapp | | submgr | | e2term | |
| 7567 | // +-------+ +---------+ +---------+ |
| 7568 | // | | | |
| 7569 | // | RestSubReq | | |
| 7570 | // |---------------->| | |
| 7571 | // | | | |
| 7572 | // | RESTSubResp | | |
| 7573 | // |<----------------| | |
| 7574 | // | | | |
| 7575 | // | | SubReq | |
| 7576 | // | |------------->| |
| 7577 | // | | | |
| 7578 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7579 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7580 | // | | | |
| 7581 | // | | SubReq | |
| 7582 | // | |------------->| |
| 7583 | // | | | |
| 7584 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7585 | // | |<-------------|No valid subscription found with subIds [0]. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7586 | // | RESTNotif (fail)| | |
| 7587 | // |<----------------| | |
| 7588 | // | | SubDelReq | |
| 7589 | // | |------------->| |
| 7590 | // | | | |
| 7591 | // | | SubDelResp | |
| 7592 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7593 | // | | | |
| 7594 | // | [SUBS DELETE] | |
| 7595 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7596 | // |
| 7597 | //----------------------------------------------------------------------------- |
| 7598 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7599 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7600 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7601 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7602 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7603 | Counter{cRestSubReqFromXapp, 1}, |
| 7604 | Counter{cRestSubRespToXapp, 1}, |
| 7605 | Counter{cSubReqToE2, 1}, |
| 7606 | Counter{cSubReqTimerExpiry, 2}, |
| 7607 | Counter{cSubReReqToE2, 1}, |
| 7608 | Counter{cSubFailFromE2, 2}, |
| 7609 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7610 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7611 | Counter{cRestSubDelRespToXapp, 1}, |
| 7612 | Counter{cSubDelReqToE2, 1}, |
| 7613 | Counter{cSubDelRespFromE2, 1}, |
| 7614 | }) |
| 7615 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7616 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7617 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7618 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7619 | |
| 7620 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7621 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7622 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7623 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7624 | fparams.Set(crereq) |
| 7625 | fparams.Fail.RequestId.InstanceId = 0 |
| 7626 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7627 | |
| 7628 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7629 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7630 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7631 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7632 | // Subscription already created in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7633 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7634 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7635 | |
| 7636 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7637 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7638 | |
| 7639 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7640 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7641 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7642 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7643 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7644 | // Wait that subs is cleaned |
| 7645 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7646 | |
| 7647 | xappConn1.TestMsgChanEmpty(t) |
| 7648 | e2termConn1.TestMsgChanEmpty(t) |
| 7649 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7650 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7651 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7652 | } |
| 7653 | |
| 7654 | //----------------------------------------------------------------------------- |
| 7655 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7656 | // |
| 7657 | // stub stub |
| 7658 | // +-------+ +---------+ +---------+ |
| 7659 | // | xapp | | submgr | | e2term | |
| 7660 | // +-------+ +---------+ +---------+ |
| 7661 | // | | | |
| 7662 | // | RestSubReq | | |
| 7663 | // |---------------->| | |
| 7664 | // | | | |
| 7665 | // | RESTSubResp | | |
| 7666 | // |<----------------| | |
| 7667 | // | | | |
| 7668 | // | | SubReq | |
| 7669 | // | |------------->| |
| 7670 | // | | | |
| 7671 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7672 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7673 | // | | | |
| 7674 | // | | SubReq | |
| 7675 | // | |------------->| |
| 7676 | // | | | |
| 7677 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7678 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7679 | // | RESTNotif (fail)| | |
| 7680 | // |<----------------| | |
| 7681 | // | | SubDelReq | |
| 7682 | // | |------------->| |
| 7683 | // | | | |
| 7684 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7685 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7686 | // | | | |
| 7687 | // | | SubDelReq | |
| 7688 | // | |------------->| |
| 7689 | // | | | |
| 7690 | // | | SubDelResp | |
| 7691 | // | |<-------------| Ongoing transaction not found. |
| 7692 | // | | | |
| 7693 | // | [SUBS DELETE] | |
| 7694 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7695 | // |
| 7696 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7697 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7698 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7699 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7700 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7701 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7702 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7703 | Counter{cRestSubReqFromXapp, 1}, |
| 7704 | Counter{cRestSubRespToXapp, 1}, |
| 7705 | Counter{cSubReqToE2, 1}, |
| 7706 | Counter{cSubReqTimerExpiry, 2}, |
| 7707 | Counter{cSubReReqToE2, 1}, |
| 7708 | Counter{cSubFailFromE2, 2}, |
| 7709 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7710 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7711 | Counter{cRestSubDelRespToXapp, 1}, |
| 7712 | Counter{cSubDelReqToE2, 1}, |
| 7713 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7714 | Counter{cSubDelReReqToE2, 1}, |
| 7715 | Counter{cSubDelRespFromE2, 2}, |
| 7716 | }) |
| 7717 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7718 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7719 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7720 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7721 | |
| 7722 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7723 | |
| 7724 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7725 | |
| 7726 | // No transaction exist for this response which will result resending original request |
| 7727 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7728 | fparams.Set(crereq) |
| 7729 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7730 | |
| 7731 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7732 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7733 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7734 | |
| 7735 | // Subscription already created in E2 Node. |
| 7736 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7737 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7738 | |
| 7739 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7740 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7741 | |
| 7742 | // Resending happens because there no transaction |
| 7743 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7744 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7745 | |
| 7746 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7747 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7748 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7749 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7750 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7751 | // Wait that subs is cleaned |
| 7752 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7753 | |
| 7754 | xappConn1.TestMsgChanEmpty(t) |
| 7755 | e2termConn1.TestMsgChanEmpty(t) |
| 7756 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7757 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7758 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7759 | } |
| 7760 | |
| 7761 | //----------------------------------------------------------------------------- |
| 7762 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7763 | // |
| 7764 | // stub stub |
| 7765 | // +-------+ +---------+ +---------+ |
| 7766 | // | xapp | | submgr | | e2term | |
| 7767 | // +-------+ +---------+ +---------+ |
| 7768 | // | | | |
| 7769 | // | [SUBS CREATE] | |
| 7770 | // | | | |
| 7771 | // | | | |
| 7772 | // | RESTSubDelReq | | |
| 7773 | // |---------------->| | |
| 7774 | // | | | |
| 7775 | // | RESTSubDelResp | | |
| 7776 | // |<----------------| | |
| 7777 | // | | | |
| 7778 | // | | SubDelReq | |
| 7779 | // | |------------->| |
| 7780 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7781 | // | | SubDelResp | ASN.1 decode fails. |
| 7782 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7783 | // | | | |
| 7784 | // | | SubDelReq | |
| 7785 | // | |------------->| |
| 7786 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7787 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7788 | // | |<-------------| |
| 7789 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7790 | // | [SUBS DELETE] | |
| 7791 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7792 | // |
| 7793 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7794 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7795 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7796 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7797 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7798 | Counter{cRestSubReqFromXapp, 1}, |
| 7799 | Counter{cRestSubRespToXapp, 1}, |
| 7800 | Counter{cSubReqToE2, 1}, |
| 7801 | Counter{cSubRespFromE2, 1}, |
| 7802 | Counter{cRestSubNotifToXapp, 1}, |
| 7803 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7804 | Counter{cRestSubDelRespToXapp, 1}, |
| 7805 | Counter{cSubDelReqToE2, 1}, |
| 7806 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7807 | Counter{cSubDelReReqToE2, 1}, |
| 7808 | Counter{cSubDelFailFromE2, 1}, |
| 7809 | Counter{cSubDelRespFromE2, 1}, |
| 7810 | }) |
| 7811 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7812 | // Req |
| 7813 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7814 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7815 | |
| 7816 | // Del |
| 7817 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7818 | |
| 7819 | // E2t: Receive 1st SubsDelReq |
| 7820 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7821 | |
| 7822 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7823 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7824 | |
| 7825 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7826 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7827 | |
| 7828 | // Subscription does not exist in in E2 Node. |
| 7829 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7830 | |
| 7831 | // Wait that subs is cleaned |
| 7832 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7833 | |
| 7834 | xappConn1.TestMsgChanEmpty(t) |
| 7835 | e2termConn1.TestMsgChanEmpty(t) |
| 7836 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7837 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7838 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7839 | } |
| 7840 | |
| 7841 | //----------------------------------------------------------------------------- |
| 7842 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 7843 | // |
| 7844 | // stub stub |
| 7845 | // +-------+ +---------+ +---------+ |
| 7846 | // | xapp | | submgr | | e2term | |
| 7847 | // +-------+ +---------+ +---------+ |
| 7848 | // | | | |
| 7849 | // | [SUBS CREATE] | |
| 7850 | // | | | |
| 7851 | // | | | |
| 7852 | // | RESTSubDelReq | | |
| 7853 | // |---------------->| | |
| 7854 | // | | | |
| 7855 | // | RESTSubDelResp | | |
| 7856 | // |<----------------| | |
| 7857 | // | | | |
| 7858 | // | | SubDelReq | |
| 7859 | // | |------------->| |
| 7860 | // | | | |
| 7861 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7862 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7863 | // | | | |
| 7864 | // | | SubDelReq | |
| 7865 | // | |------------->| |
| 7866 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7867 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7868 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7869 | // | | | |
| 7870 | // | [SUBS DELETE] | |
| 7871 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7872 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7873 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7874 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7875 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7876 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7877 | Counter{cRestSubReqFromXapp, 1}, |
| 7878 | Counter{cRestSubRespToXapp, 1}, |
| 7879 | Counter{cSubReqToE2, 1}, |
| 7880 | Counter{cSubRespFromE2, 1}, |
| 7881 | Counter{cRestSubNotifToXapp, 1}, |
| 7882 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7883 | Counter{cRestSubDelRespToXapp, 1}, |
| 7884 | Counter{cSubDelReqToE2, 1}, |
| 7885 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7886 | Counter{cSubDelReReqToE2, 1}, |
| 7887 | Counter{cSubDelRespFromE2, 1}, |
| 7888 | Counter{cSubDelFailFromE2, 1}, |
| 7889 | }) |
| 7890 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7891 | // Req |
| 7892 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7893 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7894 | |
| 7895 | // Del |
| 7896 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7897 | |
| 7898 | // E2t: Receive 1st SubsDelReq |
| 7899 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7900 | |
| 7901 | // Unknown instanceId in this response which will result resending original request |
| 7902 | delreq.RequestId.InstanceId = 0 |
| 7903 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7904 | |
| 7905 | // E2t: Receive 2nd SubsDelReq |
| 7906 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7907 | |
| 7908 | // Subscription does not exist in in E2 Node. |
| 7909 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7910 | |
| 7911 | // Wait that subs is cleaned |
| 7912 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7913 | |
| 7914 | xappConn1.TestMsgChanEmpty(t) |
| 7915 | e2termConn1.TestMsgChanEmpty(t) |
| 7916 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7917 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7918 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7919 | } |
| 7920 | |
| 7921 | //----------------------------------------------------------------------------- |
| 7922 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 7923 | // |
| 7924 | // stub stub |
| 7925 | // +-------+ +---------+ +---------+ |
| 7926 | // | xapp | | submgr | | e2term | |
| 7927 | // +-------+ +---------+ +---------+ |
| 7928 | // | | | |
| 7929 | // | [SUBS CREATE] | |
| 7930 | // | | | |
| 7931 | // | | | |
| 7932 | // | RESTSubDelReq | | |
| 7933 | // |---------------->| | |
| 7934 | // | | | |
| 7935 | // | RESTSubDelResp | | |
| 7936 | // |<----------------| | |
| 7937 | // | | | |
| 7938 | // | | SubDelReq | |
| 7939 | // | |------------->| |
| 7940 | // | | | |
| 7941 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7942 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7943 | // | | | |
| 7944 | // | | SubDelReq | |
| 7945 | // | |------------->| |
| 7946 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7947 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7948 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 7949 | // | | | |
| 7950 | // | [SUBS DELETE] | |
| 7951 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7952 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7953 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7954 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7955 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7956 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7957 | Counter{cRestSubReqFromXapp, 1}, |
| 7958 | Counter{cRestSubRespToXapp, 1}, |
| 7959 | Counter{cSubReqToE2, 1}, |
| 7960 | Counter{cSubRespFromE2, 1}, |
| 7961 | Counter{cRestSubNotifToXapp, 1}, |
| 7962 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7963 | Counter{cRestSubDelRespToXapp, 1}, |
| 7964 | Counter{cSubDelReqToE2, 1}, |
| 7965 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7966 | Counter{cSubDelReReqToE2, 1}, |
| 7967 | Counter{cSubDelRespFromE2, 1}, |
| 7968 | Counter{cSubDelFailFromE2, 1}, |
| 7969 | }) |
| 7970 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7971 | // Req |
| 7972 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7973 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7974 | |
| 7975 | // Del |
| 7976 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7977 | |
| 7978 | // E2t: Receive 1st SubsDelReq |
| 7979 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7980 | |
| 7981 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 7982 | |
| 7983 | // No transaction exist for this response which will result resending original request |
| 7984 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7985 | |
| 7986 | // E2t: Receive 2nd SubsDelReq |
| 7987 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7988 | |
| 7989 | // Subscription does not exist in in E2 Node. |
| 7990 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7991 | |
| 7992 | // Wait that subs is cleaned |
| 7993 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7994 | |
| 7995 | xappConn1.TestMsgChanEmpty(t) |
| 7996 | e2termConn1.TestMsgChanEmpty(t) |
| 7997 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7998 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7999 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8000 | } |
| 8001 | |
| 8002 | //----------------------------------------------------------------------------- |
| 8003 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 8004 | // |
| 8005 | // stub stub |
| 8006 | // +-------+ +---------+ +---------+ |
| 8007 | // | xapp | | submgr | | e2term | |
| 8008 | // +-------+ +---------+ +---------+ |
| 8009 | // | | | |
| 8010 | // | [SUBS CREATE] | |
| 8011 | // | | | |
| 8012 | // | | | |
| 8013 | // | RESTSubDelReq | | |
| 8014 | // |---------------->| | |
| 8015 | // | | | |
| 8016 | // | RESTSubDelResp | | |
| 8017 | // |<----------------| | |
| 8018 | // | | | |
| 8019 | // | | SubDelReq | |
| 8020 | // | |------------->| |
| 8021 | // | | | |
| 8022 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8023 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8024 | // | | | |
| 8025 | // | | SubDelReq | |
| 8026 | // | |------------->| |
| 8027 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8028 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8029 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8030 | // | | | |
| 8031 | // | [SUBS DELETE] | |
| 8032 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8033 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8034 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8035 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8036 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8037 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8038 | Counter{cRestSubReqFromXapp, 1}, |
| 8039 | Counter{cRestSubRespToXapp, 1}, |
| 8040 | Counter{cSubReqToE2, 1}, |
| 8041 | Counter{cSubRespFromE2, 1}, |
| 8042 | Counter{cRestSubNotifToXapp, 1}, |
| 8043 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8044 | Counter{cRestSubDelRespToXapp, 1}, |
| 8045 | Counter{cSubDelReqToE2, 1}, |
| 8046 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8047 | Counter{cSubDelReReqToE2, 1}, |
| 8048 | Counter{cSubDelFailFromE2, 2}, |
| 8049 | }) |
| 8050 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8051 | // Req |
| 8052 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8053 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8054 | |
| 8055 | // Del |
| 8056 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8057 | |
| 8058 | // E2t: Receive 1st SubsDelReq |
| 8059 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8060 | |
| 8061 | // Decode of this response fails which will result resending original request |
| 8062 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 8063 | |
| 8064 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8065 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8066 | |
| 8067 | // Subscription does not exist in in E2 Node. |
| 8068 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8069 | |
| 8070 | // Wait that subs is cleaned |
| 8071 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8072 | |
| 8073 | xappConn1.TestMsgChanEmpty(t) |
| 8074 | e2termConn1.TestMsgChanEmpty(t) |
| 8075 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8076 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8077 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8078 | } |
| 8079 | |
| 8080 | //----------------------------------------------------------------------------- |
| 8081 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8082 | // |
| 8083 | // stub stub |
| 8084 | // +-------+ +---------+ +---------+ |
| 8085 | // | xapp | | submgr | | e2term | |
| 8086 | // +-------+ +---------+ +---------+ |
| 8087 | // | | | |
| 8088 | // | [SUBS CREATE] | |
| 8089 | // | | | |
| 8090 | // | | | |
| 8091 | // | RESTSubDelReq | | |
| 8092 | // |---------------->| | |
| 8093 | // | | | |
| 8094 | // | RESTSubDelResp | | |
| 8095 | // |<----------------| | |
| 8096 | // | | | |
| 8097 | // | | SubDelReq | |
| 8098 | // | |------------->| |
| 8099 | // | | | |
| 8100 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8101 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8102 | // | | | |
| 8103 | // | | SubDelReq | |
| 8104 | // | |------------->| |
| 8105 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8106 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8107 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8108 | // | | | |
| 8109 | // | [SUBS DELETE] | |
| 8110 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8111 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8112 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8113 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8114 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8115 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8116 | Counter{cRestSubReqFromXapp, 1}, |
| 8117 | Counter{cRestSubRespToXapp, 1}, |
| 8118 | Counter{cSubReqToE2, 1}, |
| 8119 | Counter{cSubRespFromE2, 1}, |
| 8120 | Counter{cRestSubNotifToXapp, 1}, |
| 8121 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8122 | Counter{cRestSubDelRespToXapp, 1}, |
| 8123 | Counter{cSubDelReqToE2, 1}, |
| 8124 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8125 | Counter{cSubDelReReqToE2, 1}, |
| 8126 | Counter{cSubDelFailFromE2, 2}, |
| 8127 | }) |
| 8128 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8129 | // Req |
| 8130 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8131 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8132 | |
| 8133 | // Del |
| 8134 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8135 | |
| 8136 | // E2t: Receive 1st SubsDelReq |
| 8137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8138 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8139 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8140 | delreq.RequestId.InstanceId = 0 |
| 8141 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8142 | |
| 8143 | // E2t: Receive 2nd SubsDelReq |
| 8144 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8145 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8146 | // Subscription does not exist in in E2 Node. E2 Node responds with failure but there is also same unknown instanceId 0 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8147 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8148 | |
| 8149 | // Wait that subs is cleaned |
| 8150 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8151 | |
| 8152 | xappConn1.TestMsgChanEmpty(t) |
| 8153 | e2termConn1.TestMsgChanEmpty(t) |
| 8154 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8155 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8156 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8157 | } |
| 8158 | |
| 8159 | //----------------------------------------------------------------------------- |
| 8160 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8161 | // |
| 8162 | // stub stub |
| 8163 | // +-------+ +---------+ +---------+ |
| 8164 | // | xapp | | submgr | | e2term | |
| 8165 | // +-------+ +---------+ +---------+ |
| 8166 | // | | | |
| 8167 | // | [SUBS CREATE] | |
| 8168 | // | | | |
| 8169 | // | | | |
| 8170 | // | RESTSubDelReq | | |
| 8171 | // |---------------->| | |
| 8172 | // | | | |
| 8173 | // | RESTSubDelResp | | |
| 8174 | // |<----------------| | |
| 8175 | // | | | |
| 8176 | // | | SubDelReq | |
| 8177 | // | |------------->| |
| 8178 | // | | | |
| 8179 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8180 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8181 | // | | | |
| 8182 | // | | SubDelReq | |
| 8183 | // | |------------->| |
| 8184 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8185 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8186 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8187 | // | | | |
| 8188 | // | [SUBS DELETE] | |
| 8189 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8190 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8191 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8192 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8193 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8194 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8195 | Counter{cRestSubReqFromXapp, 1}, |
| 8196 | Counter{cRestSubRespToXapp, 1}, |
| 8197 | Counter{cSubReqToE2, 1}, |
| 8198 | Counter{cSubRespFromE2, 1}, |
| 8199 | Counter{cRestSubNotifToXapp, 1}, |
| 8200 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8201 | Counter{cRestSubDelRespToXapp, 1}, |
| 8202 | Counter{cSubDelReqToE2, 1}, |
| 8203 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8204 | Counter{cSubDelReReqToE2, 1}, |
| 8205 | Counter{cSubDelFailFromE2, 2}, |
| 8206 | }) |
| 8207 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8208 | // Req |
| 8209 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8210 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8211 | |
| 8212 | // Del |
| 8213 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8214 | |
| 8215 | // E2t: Receive 1st SubsDelReq |
| 8216 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8217 | |
| 8218 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8219 | |
| 8220 | // No transaction exist for this response which will result resending original request |
| 8221 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8222 | |
| 8223 | // E2t: Receive 2nd SubsDelReq |
| 8224 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8225 | |
| 8226 | // Subscription does not exist in in E2 Node. |
| 8227 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8228 | |
| 8229 | // Wait that subs is cleaned |
| 8230 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8231 | |
| 8232 | xappConn1.TestMsgChanEmpty(t) |
| 8233 | e2termConn1.TestMsgChanEmpty(t) |
| 8234 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8235 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8236 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8237 | } |
| 8238 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8239 | //----------------------------------------------------------------------------- |
| 8240 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8241 | // |
| 8242 | // stub stub |
| 8243 | // +-------+ +---------+ +---------+ |
| 8244 | // | xapp | | submgr | | e2term | |
| 8245 | // +-------+ +---------+ +---------+ |
| 8246 | // | | | |
| 8247 | // | RESTSubReq | | |
| 8248 | // |---------------->| | |
| 8249 | // | | | |
| 8250 | // | RESTSubResp | | |
| 8251 | // |<----------------| | |
| 8252 | // | | | |
| 8253 | // | ASN.1 encode fails | |
| 8254 | // | | | |
| 8255 | // | | SubDelReq | |
| 8256 | // | |------------->| |
| 8257 | // | | | |
| 8258 | // | | SubDelFail | |
| 8259 | // | |<-------------| |
| 8260 | // | | | |
| 8261 | // | RESTNotif | | |
| 8262 | // | unsuccess | | |
| 8263 | // |<----------------| | |
| 8264 | // | | | |
| 8265 | // | [SUBS DELETE] | |
| 8266 | // | | | |
| 8267 | // |
| 8268 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8269 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8270 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8271 | |
| 8272 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8273 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8274 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8275 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8276 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8277 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8278 | }) |
| 8279 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8280 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8281 | |
| 8282 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8283 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8284 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8285 | |
| 8286 | // Req |
| 8287 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8288 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8289 | |
| 8290 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8291 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8292 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8293 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8294 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8295 | |
| 8296 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8297 | |
| 8298 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8299 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8300 | // Wait that subs is cleaned |
| 8301 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8302 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8303 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8304 | } |
| 8305 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8306 | //----------------------------------------------------------------------------- |
| 8307 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8308 | // |
| 8309 | // stub stub |
| 8310 | // +-------+ +---------+ +---------+ |
| 8311 | // | xapp | | submgr | | e2term | |
| 8312 | // +-------+ +---------+ +---------+ |
| 8313 | // | | | |
| 8314 | // | RESTSubReq | | |
| 8315 | // |---------------->| | |
| 8316 | // | | | |
| 8317 | // | RESTSubResp | | |
| 8318 | // |<----------------| | |
| 8319 | // | | SubReq | |
| 8320 | // | |------------->| |
| 8321 | // | | | |
| 8322 | // | | SubResp | |
| 8323 | // | |<-------------| |
| 8324 | // | | | |
| 8325 | // | RESTNotif | | |
| 8326 | // |<----------------| | |
| 8327 | // | | | |
| 8328 | // | RESTSubReq | | Policy modification |
| 8329 | // |---------------->| | |
| 8330 | // | | | |
| 8331 | // | RESTSubResp | | |
| 8332 | // |<----------------| | |
| 8333 | // | | SubReq | |
| 8334 | // | |------------->| |
| 8335 | // | | | |
| 8336 | // | | | |
| 8337 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8338 | // |<----------------| | |
| 8339 | // | | | |
| 8340 | // | RESTSubDelReq | | |
| 8341 | // |---------------->| | |
| 8342 | // | | | |
| 8343 | // | | SubDelReq | |
| 8344 | // | |------------->| |
| 8345 | // | | | |
| 8346 | // | | SubDelResp | |
| 8347 | // | |<-------------| |
| 8348 | // | | | |
| 8349 | // | RESTSubDelResp | | |
| 8350 | // |<----------------| | |
| 8351 | // |
| 8352 | //----------------------------------------------------------------------------- |
| 8353 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8354 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8355 | |
| 8356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8357 | Counter{cRestSubReqFromXapp, 2}, |
| 8358 | Counter{cRestSubRespToXapp, 2}, |
| 8359 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8360 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8361 | Counter{cSubRespFromE2, 1}, |
| 8362 | Counter{cRestSubNotifToXapp, 1}, |
| 8363 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8364 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8365 | Counter{cSubDelReqToE2, 1}, |
| 8366 | Counter{cSubDelRespFromE2, 1}, |
| 8367 | Counter{cRestSubDelRespToXapp, 1}, |
| 8368 | }) |
| 8369 | |
| 8370 | const e2Timeout int64 = 1 |
| 8371 | const e2RetryCount int64 = 0 |
| 8372 | const routingNeeded bool = false |
| 8373 | |
| 8374 | // Req1 |
| 8375 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8376 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8377 | |
| 8378 | // Subs Create |
| 8379 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8380 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8381 | |
| 8382 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8383 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8384 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8385 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8386 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8387 | |
| 8388 | // Policy change |
| 8389 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8390 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8391 | params.SetSubscriptionID(&restSubId) |
| 8392 | params.SetTimeToWait("w200ms") |
| 8393 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8394 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8395 | |
| 8396 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8397 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8398 | // SubsResp is missing, e2SubsId will be 0 |
| 8399 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8400 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8401 | |
| 8402 | // Del |
| 8403 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8404 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8405 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8406 | |
| 8407 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8408 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8409 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8410 | } |
| 8411 | |
| 8412 | //----------------------------------------------------------------------------- |
| 8413 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8414 | // |
| 8415 | // stub stub |
| 8416 | // +-------+ +---------+ +---------+ |
| 8417 | // | xapp | | submgr | | e2term | |
| 8418 | // +-------+ +---------+ +---------+ |
| 8419 | // | | | |
| 8420 | // | RESTSubReq | | |
| 8421 | // |---------------->| | |
| 8422 | // | | | |
| 8423 | // | RESTSubResp | | |
| 8424 | // |<----------------| | |
| 8425 | // | | SubReq | |
| 8426 | // | |------------->| |
| 8427 | // | | | |
| 8428 | // | | SubResp | |
| 8429 | // | |<-------------| |
| 8430 | // | | | |
| 8431 | // | RESTNotif | | |
| 8432 | // |<----------------| | |
| 8433 | // | | | |
| 8434 | // | RESTSubReq | | |
| 8435 | // |---------------->| | |
| 8436 | // | | | |
| 8437 | // | RESTSubResp | | |
| 8438 | // |<----------------| | |
| 8439 | // | | SubReq | |
| 8440 | // | |------------->| |
| 8441 | // | | |
| 8442 | // | Submgr restart | |
| 8443 | // | | | |
| 8444 | // | RESTSubDelReq | | |
| 8445 | // |---------------->| | |
| 8446 | // | | | |
| 8447 | // | | SubDelReq | |
| 8448 | // | |------------->| |
| 8449 | // | | | |
| 8450 | // | | SubDelResp | |
| 8451 | // | |<-------------| |
| 8452 | // | | | |
| 8453 | // | RESTSubDelResp | | |
| 8454 | // |<----------------| | |
| 8455 | // |
| 8456 | //----------------------------------------------------------------------------- |
| 8457 | |
| 8458 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8459 | |
| 8460 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8461 | Counter{cRestSubReqFromXapp, 2}, |
| 8462 | Counter{cRestSubRespToXapp, 2}, |
| 8463 | Counter{cSubReqToE2, 2}, |
| 8464 | Counter{cSubRespFromE2, 1}, |
| 8465 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8466 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8467 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8468 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8469 | Counter{cRestSubDelRespToXapp, 1}, |
| 8470 | }) |
| 8471 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8472 | const e2Timeout int64 = 1 |
| 8473 | const e2RetryCount int64 = 0 |
| 8474 | const routingNeeded bool = false |
| 8475 | |
| 8476 | // Req1 |
| 8477 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8478 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8479 | // Create subscription |
| 8480 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8481 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8482 | |
| 8483 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8484 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8485 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8486 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8487 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8488 | |
| 8489 | // Check subscription |
| 8490 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8491 | |
| 8492 | // Policy change |
| 8493 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8494 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8495 | params.SetSubscriptionID(&restSubId) |
| 8496 | params.SetTimeToWait("w200ms") |
| 8497 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8498 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8499 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8500 | |
| 8501 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8502 | mainCtrl.SetResetTestFlag(t, false) |
| 8503 | |
| 8504 | // SubsResp is missing due to submgr restart |
| 8505 | |
| 8506 | mainCtrl.SimulateRestart(t) |
| 8507 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8508 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8509 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8510 | // That needs to be completed before successful subscription query is possible |
| 8511 | <-time.After(time.Second * 1) |
| 8512 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8513 | // Check subscription |
| 8514 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8515 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8516 | // Delete subscription |
| 8517 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8518 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8519 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8520 | |
| 8521 | //Wait that subs is cleaned |
| 8522 | waitSubsCleanup(t, e2SubsId, 10) |
| 8523 | |
| 8524 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8525 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8526 | } |
| 8527 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8528 | //////////////////////////////////////////////////////////////////////////////////// |
| 8529 | // Services for UT cases |
| 8530 | //////////////////////////////////////////////////////////////////////////////////// |
| 8531 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8532 | const host string = "localhost" |
| 8533 | |
| 8534 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8535 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8536 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8537 | } |
| 8538 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8539 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8540 | |
| 8541 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8542 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8543 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8544 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8545 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8546 | |
| 8547 | return restSubId, e2SubsId |
| 8548 | } |
| 8549 | |
| 8550 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8551 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8552 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8553 | if meid != "" { |
| 8554 | params.SetMeid(meid) |
| 8555 | } |
| 8556 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8557 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8558 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8559 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8560 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8561 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8562 | |
| 8563 | return restSubId, e2SubsId |
| 8564 | } |
| 8565 | |
| 8566 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8567 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8568 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8569 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8570 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8571 | |
| 8572 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8573 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8574 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8575 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8576 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8577 | |
| 8578 | return restSubId, e2SubsId |
| 8579 | } |
| 8580 | |
| 8581 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8582 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8583 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8584 | |
| 8585 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8586 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8587 | fparams1.Set(crereq1) |
| 8588 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8589 | |
| 8590 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8591 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8592 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8593 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8594 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8595 | |
| 8596 | return restSubId, e2SubsId |
| 8597 | } |
| 8598 | |
| 8599 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8600 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8601 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8602 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8603 | } |
| 8604 | |
| 8605 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8606 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8607 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8608 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8609 | } |
| 8610 | |
| 8611 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8612 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8613 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8614 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8615 | } |
| 8616 | |
| 8617 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8618 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8619 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8620 | assert.Equal(t, meid, resp[0].Meid) |
| 8621 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8622 | } |
| 8623 | |
| 8624 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8625 | //Wait that subs is cleaned |
| 8626 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8627 | |
| 8628 | xappConn1.TestMsgChanEmpty(t) |
| 8629 | xappConn2.TestMsgChanEmpty(t) |
| 8630 | e2termConn1.TestMsgChanEmpty(t) |
| 8631 | mainCtrl.wait_registry_empty(t, timeout) |
| 8632 | } |
| 8633 | |
| 8634 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8635 | |
| 8636 | var e2SubsId []uint32 |
| 8637 | |
| 8638 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8639 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8640 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8641 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8642 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8643 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8644 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8645 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8646 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8647 | <-time.After(100 * time.Millisecond) |
| 8648 | } |
| 8649 | return e2SubsId |
| 8650 | } |
| 8651 | |
| 8652 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8653 | |
| 8654 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8655 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8656 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8657 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8658 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8659 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8660 | <-time.After(100 * time.Millisecond) |
| 8661 | } |
| 8662 | |
| 8663 | // Wait that subs is cleaned |
| 8664 | for i := 0; i < len(e2SubsIds); i++ { |
| 8665 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8666 | } |
| 8667 | |
| 8668 | } |