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 | //----------------------------------------------------------------------------- |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame] | 435 | // TestRESTSubReqAndE2APDeleteRespUnpackingError |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 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 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame] | 479 | func TestRESTSubReqAndE2APDeleteRespUnpackingError(t *testing.T) { |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 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 | //----------------------------------------------------------------------------- |
Himanshu Puorhit | 84662c4 | 2023-08-29 15:46:18 +0530 | [diff] [blame^] | 884 | |
| 885 | //----------------------------------------------------------------------------- |
| 886 | // TestSubReqAndSubDelOkOutofOrderIEs |
| 887 | // |
| 888 | // stub stub |
| 889 | // +-------+ +---------+ +---------+ |
| 890 | // | xapp | | submgr | | e2term | |
| 891 | // +-------+ +---------+ +---------+ |
| 892 | // | | | |
| 893 | // | SubReq | | |
| 894 | // |------------->| | |
| 895 | // | | | |
| 896 | // | | SubReq | |
| 897 | // | |------------->| |
| 898 | // | | | |
| 899 | // | | SubResp | (Out of Order IEs) |
| 900 | // | |<-------------| |
| 901 | // | | | |
| 902 | // | SubResp | | |
| 903 | // |<-------------| | |
| 904 | // | | | |
| 905 | // | | | |
| 906 | // | SubDelReq | | |
| 907 | // |------------->| | |
| 908 | // | | | |
| 909 | // | | SubDelReq | |
| 910 | // | |------------->| |
| 911 | // | | | |
| 912 | // | | SubDelResp | |
| 913 | // | |<-------------| |
| 914 | // | | | |
| 915 | // | SubDelResp | | |
| 916 | // |<-------------| | |
| 917 | // |
| 918 | //----------------------------------------------------------------------------- |
| 919 | |
| 920 | func TestSubReqAndSubDelOkOutofOrderIEs(t *testing.T) { |
| 921 | CaseBegin("TestSubReqAndSubDelOkOutofOrderIEs") |
| 922 | |
| 923 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 924 | // Init counter check |
| 925 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 926 | Counter{cSubReqFromXapp, 1}, |
| 927 | Counter{cSubReqToE2, 1}, |
| 928 | Counter{cSubRespFromE2, 1}, |
| 929 | Counter{cSubRespToXapp, 1}, |
| 930 | Counter{cSubDelReqFromXapp, 1}, |
| 931 | Counter{cSubDelReqToE2, 1}, |
| 932 | Counter{cSubDelRespFromE2, 1}, |
| 933 | Counter{cSubDelRespToXapp, 1}, |
| 934 | }) |
| 935 | |
| 936 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 937 | if cretrans == nil { |
| 938 | t.Logf("Could not send SubsReq") |
| 939 | t.FailNow() |
| 940 | } |
| 941 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 942 | if crereq == nil || cremsg == nil { |
| 943 | t.Logf("Could not recieve SubsReq") |
| 944 | t.FailNow() |
| 945 | } |
| 946 | |
| 947 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 948 | |
| 949 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 950 | |
| 951 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 952 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 953 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 954 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 955 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
| 956 | |
| 957 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 958 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 959 | |
| 960 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 961 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 962 | |
| 963 | //Wait that subs is cleaned |
| 964 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 965 | |
| 966 | xappConn1.TestMsgChanEmpty(t) |
| 967 | xappConn2.TestMsgChanEmpty(t) |
| 968 | e2termConn1.TestMsgChanEmpty(t) |
| 969 | mainCtrl.wait_registry_empty(t, 10) |
| 970 | |
| 971 | mainCtrl.VerifyCounterValues(t) |
| 972 | mainCtrl.c.e2ap.SetE2IEOrderCheck(1) |
| 973 | } |
| 974 | |
| 975 | //----------------------------------------------------------------------------- |
| 976 | |
| 977 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 978 | // TestSubReqRetransmission |
| 979 | // |
| 980 | // stub stub |
| 981 | // +-------+ +---------+ +---------+ |
| 982 | // | xapp | | submgr | | e2term | |
| 983 | // +-------+ +---------+ +---------+ |
| 984 | // | | | |
| 985 | // | SubReq | | |
| 986 | // |------------->| | |
| 987 | // | | | |
| 988 | // | | SubReq | |
| 989 | // | |------------->| |
| 990 | // | | | |
| 991 | // | SubReq | | |
| 992 | // | (retrans) | | |
| 993 | // |------------->| | |
| 994 | // | | | |
| 995 | // | | SubResp | |
| 996 | // | |<-------------| |
| 997 | // | | | |
| 998 | // | SubResp | | |
| 999 | // |<-------------| | |
| 1000 | // | | | |
| 1001 | // | [SUBS DELETE] | |
| 1002 | // | | | |
| 1003 | // |
| 1004 | //----------------------------------------------------------------------------- |
| 1005 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1006 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1007 | |
| 1008 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1009 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1010 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1011 | |
| 1012 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1013 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1014 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1015 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1016 | // hack as there is no real way to see has message be handled. |
| 1017 | // Previuos counter check just tells that is has been received by submgr |
| 1018 | // --> artificial delay |
| 1019 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1020 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1021 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1022 | |
| 1023 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1024 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1025 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1026 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1027 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | |
| 1029 | //Wait that subs is cleaned |
| 1030 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1031 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1032 | xappConn1.TestMsgChanEmpty(t) |
| 1033 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1034 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1035 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1036 | } |
| 1037 | |
| 1038 | //----------------------------------------------------------------------------- |
| 1039 | // TestSubDelReqRetransmission |
| 1040 | // |
| 1041 | // stub stub |
| 1042 | // +-------+ +---------+ +---------+ |
| 1043 | // | xapp | | submgr | | e2term | |
| 1044 | // +-------+ +---------+ +---------+ |
| 1045 | // | | | |
| 1046 | // | [SUBS CREATE] | |
| 1047 | // | | | |
| 1048 | // | | | |
| 1049 | // | SubDelReq | | |
| 1050 | // |------------->| | |
| 1051 | // | | | |
| 1052 | // | | SubDelReq | |
| 1053 | // | |------------->| |
| 1054 | // | | | |
| 1055 | // | SubDelReq | | |
| 1056 | // | (same sub) | | |
| 1057 | // | (same xid) | | |
| 1058 | // |------------->| | |
| 1059 | // | | | |
| 1060 | // | | SubDelResp | |
| 1061 | // | |<-------------| |
| 1062 | // | | | |
| 1063 | // | SubDelResp | | |
| 1064 | // |<-------------| | |
| 1065 | // |
| 1066 | //----------------------------------------------------------------------------- |
| 1067 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1068 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1069 | |
| 1070 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1071 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1072 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1073 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1074 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1075 | |
| 1076 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1077 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1078 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1079 | |
| 1080 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1081 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1082 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1083 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1084 | // hack as there is no real way to see has message be handled. |
| 1085 | // Previuos counter check just tells that is has been received by submgr |
| 1086 | // --> artificial delay |
| 1087 | <-time.After(1 * time.Second) |
| 1088 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1089 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1090 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1091 | |
| 1092 | //Wait that subs is cleaned |
| 1093 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1094 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1095 | xappConn1.TestMsgChanEmpty(t) |
| 1096 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1097 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1098 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | //----------------------------------------------------------------------------- |
| 1102 | // TestSubDelReqCollision |
| 1103 | // |
| 1104 | // stub stub |
| 1105 | // +-------+ +---------+ +---------+ |
| 1106 | // | xapp | | submgr | | e2term | |
| 1107 | // +-------+ +---------+ +---------+ |
| 1108 | // | | | |
| 1109 | // | [SUBS CREATE] | |
| 1110 | // | | | |
| 1111 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1112 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1113 | // |------------->| | |
| 1114 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1115 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1116 | // | |------------->| |
| 1117 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1118 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1119 | // | (same sub) | | |
| 1120 | // | (diff xid) | | |
| 1121 | // |------------->| | |
| 1122 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1123 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1124 | // | |<-------------| |
| 1125 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1126 | // | SubDelResp 1 | | |
| 1127 | // |<-------------| | |
| 1128 | // | | | |
| 1129 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1130 | // |<-------------| | |
| 1131 | // |
| 1132 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1133 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1134 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1135 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1136 | |
| 1137 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1138 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1139 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1140 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1141 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1142 | |
| 1143 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1144 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1147 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1148 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1150 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1151 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1152 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1153 | // hack as there is no real way to see has message be handled. |
| 1154 | // Previuos counter check just tells that is has been received by submgr |
| 1155 | // --> artificial delay |
| 1156 | <-time.After(1 * time.Second) |
| 1157 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1158 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1159 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1160 | |
| 1161 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1162 | xappConn1.RecvSubsDelResp(t, nil) |
| 1163 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1164 | |
| 1165 | //Wait that subs is cleaned |
| 1166 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1167 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1168 | xappConn1.TestMsgChanEmpty(t) |
| 1169 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1170 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1171 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1172 | } |
| 1173 | |
| 1174 | //----------------------------------------------------------------------------- |
| 1175 | // TestSubReqAndSubDelOkTwoParallel |
| 1176 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1177 | // stub stub stub |
| 1178 | // +-------+ +-------+ +---------+ +---------+ |
| 1179 | // | xapp | | xapp | | submgr | | e2term | |
| 1180 | // +-------+ +-------+ +---------+ +---------+ |
| 1181 | // | | | | |
| 1182 | // | | | | |
| 1183 | // | | | | |
| 1184 | // | | SubReq1 | | |
| 1185 | // | |------------->| | |
| 1186 | // | | | | |
| 1187 | // | | | SubReq1 | |
| 1188 | // | | |------------->| |
| 1189 | // | | | | |
| 1190 | // | SubReq2 | | |
| 1191 | // |------------------------>| | |
| 1192 | // | | | | |
| 1193 | // | | | SubReq2 | |
| 1194 | // | | |------------->| |
| 1195 | // | | | | |
| 1196 | // | | | SubResp1 | |
| 1197 | // | | |<-------------| |
| 1198 | // | | SubResp1 | | |
| 1199 | // | |<-------------| | |
| 1200 | // | | | | |
| 1201 | // | | | SubResp2 | |
| 1202 | // | | |<-------------| |
| 1203 | // | SubResp2 | | |
| 1204 | // |<------------------------| | |
| 1205 | // | | | | |
| 1206 | // | | [SUBS 1 DELETE] | |
| 1207 | // | | | | |
| 1208 | // | | [SUBS 2 DELETE] | |
| 1209 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1210 | // |
| 1211 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1212 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1213 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1214 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1215 | |
| 1216 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1218 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1219 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1220 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1221 | |
| 1222 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1223 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1224 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1225 | |
| 1226 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1227 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1228 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1229 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1230 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1231 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1232 | |
| 1233 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1234 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1235 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1236 | |
| 1237 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1238 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1239 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1240 | |
| 1241 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1242 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1243 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1244 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1245 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1246 | //Wait that subs is cleaned |
| 1247 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1248 | |
| 1249 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1250 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1251 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1252 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1253 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1254 | //Wait that subs is cleaned |
| 1255 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1256 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1257 | xappConn1.TestMsgChanEmpty(t) |
| 1258 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1259 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1260 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1261 | } |
| 1262 | |
| 1263 | //----------------------------------------------------------------------------- |
| 1264 | // TestSameSubsDiffRan |
| 1265 | // Same subscription to different RANs |
| 1266 | // |
| 1267 | // stub stub |
| 1268 | // +-------+ +---------+ +---------+ |
| 1269 | // | xapp | | submgr | | e2term | |
| 1270 | // +-------+ +---------+ +---------+ |
| 1271 | // | | | |
| 1272 | // | | | |
| 1273 | // | | | |
| 1274 | // | SubReq(r1) | | |
| 1275 | // |------------->| | |
| 1276 | // | | | |
| 1277 | // | | SubReq(r1) | |
| 1278 | // | |------------->| |
| 1279 | // | | | |
| 1280 | // | | SubResp(r1) | |
| 1281 | // | |<-------------| |
| 1282 | // | | | |
| 1283 | // | SubResp(r1) | | |
| 1284 | // |<-------------| | |
| 1285 | // | | | |
| 1286 | // | SubReq(r2) | | |
| 1287 | // |------------->| | |
| 1288 | // | | | |
| 1289 | // | | SubReq(r2) | |
| 1290 | // | |------------->| |
| 1291 | // | | | |
| 1292 | // | | SubResp(r2) | |
| 1293 | // | |<-------------| |
| 1294 | // | | | |
| 1295 | // | SubResp(r2) | | |
| 1296 | // |<-------------| | |
| 1297 | // | | | |
| 1298 | // | [SUBS r1 DELETE] | |
| 1299 | // | | | |
| 1300 | // | [SUBS r2 DELETE] | |
| 1301 | // | | | |
| 1302 | // |
| 1303 | //----------------------------------------------------------------------------- |
| 1304 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1305 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1306 | |
| 1307 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1308 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1309 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1310 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1311 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1312 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1313 | |
| 1314 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1315 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1316 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1317 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1318 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1320 | |
| 1321 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1322 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1323 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1324 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1325 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1326 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | //Wait that subs is cleaned |
| 1328 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1329 | |
| 1330 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1331 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1332 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1333 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1334 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1335 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1336 | //Wait that subs is cleaned |
| 1337 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1338 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1339 | xappConn1.TestMsgChanEmpty(t) |
| 1340 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1341 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1342 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1343 | } |
| 1344 | |
| 1345 | //----------------------------------------------------------------------------- |
| 1346 | // TestSubReqRetryInSubmgr |
| 1347 | // |
| 1348 | // stub stub |
| 1349 | // +-------+ +---------+ +---------+ |
| 1350 | // | xapp | | submgr | | e2term | |
| 1351 | // +-------+ +---------+ +---------+ |
| 1352 | // | | | |
| 1353 | // | SubReq | | |
| 1354 | // |------------->| | |
| 1355 | // | | | |
| 1356 | // | | SubReq | |
| 1357 | // | |------------->| |
| 1358 | // | | | |
| 1359 | // | | | |
| 1360 | // | | SubReq | |
| 1361 | // | |------------->| |
| 1362 | // | | | |
| 1363 | // | | SubResp | |
| 1364 | // | |<-------------| |
| 1365 | // | | | |
| 1366 | // | SubResp | | |
| 1367 | // |<-------------| | |
| 1368 | // | | | |
| 1369 | // | [SUBS DELETE] | |
| 1370 | // | | | |
| 1371 | // |
| 1372 | //----------------------------------------------------------------------------- |
| 1373 | |
| 1374 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1375 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1376 | |
| 1377 | // Init counter check |
| 1378 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1379 | Counter{cSubReqFromXapp, 1}, |
| 1380 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1381 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1382 | Counter{cSubReReqToE2, 1}, |
| 1383 | Counter{cSubRespFromE2, 1}, |
| 1384 | Counter{cSubRespToXapp, 1}, |
| 1385 | Counter{cSubDelReqFromXapp, 1}, |
| 1386 | Counter{cSubDelReqToE2, 1}, |
| 1387 | Counter{cSubDelRespFromE2, 1}, |
| 1388 | Counter{cSubDelRespToXapp, 1}, |
| 1389 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1390 | |
| 1391 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1392 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1393 | |
| 1394 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1395 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1396 | |
| 1397 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1398 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1399 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1400 | |
| 1401 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1402 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1403 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1404 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1405 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1406 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1407 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1408 | |
| 1409 | // Wait that subs is cleaned |
| 1410 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1411 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1412 | xappConn1.TestMsgChanEmpty(t) |
| 1413 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1414 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1415 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1416 | |
| 1417 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1418 | } |
| 1419 | |
| 1420 | //----------------------------------------------------------------------------- |
| 1421 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1422 | // |
| 1423 | // stub stub |
| 1424 | // +-------+ +---------+ +---------+ |
| 1425 | // | xapp | | submgr | | e2term | |
| 1426 | // +-------+ +---------+ +---------+ |
| 1427 | // | | | |
| 1428 | // | SubReq | | |
| 1429 | // |------------->| | |
| 1430 | // | | | |
| 1431 | // | | SubReq | |
| 1432 | // | |------------->| |
| 1433 | // | | | |
| 1434 | // | | | |
| 1435 | // | | SubReq | |
| 1436 | // | |------------->| |
| 1437 | // | | | |
| 1438 | // | | SubDelReq | |
| 1439 | // | |------------->| |
| 1440 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1441 | // | | SubDelResp | |
| 1442 | // | |<-------------| |
| 1443 | // | | | |
| 1444 | // |
| 1445 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1446 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1447 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1448 | |
| 1449 | // Init counter check |
| 1450 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1451 | Counter{cSubReqFromXapp, 1}, |
| 1452 | Counter{cSubReqToE2, 1}, |
| 1453 | Counter{cSubReReqToE2, 1}, |
| 1454 | Counter{cSubReqTimerExpiry, 2}, |
| 1455 | Counter{cSubDelReqToE2, 1}, |
| 1456 | Counter{cSubDelRespFromE2, 1}, |
| 1457 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1458 | |
| 1459 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1460 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1461 | |
| 1462 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1463 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1464 | |
| 1465 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1466 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1467 | |
| 1468 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1469 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1470 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1471 | |
| 1472 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1473 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1474 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1475 | xappConn1.TestMsgChanEmpty(t) |
| 1476 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1477 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1478 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1479 | |
| 1480 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1481 | } |
| 1482 | |
| 1483 | //----------------------------------------------------------------------------- |
| 1484 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1485 | // |
| 1486 | // stub stub |
| 1487 | // +-------+ +---------+ +---------+ |
| 1488 | // | xapp | | submgr | | e2term | |
| 1489 | // +-------+ +---------+ +---------+ |
| 1490 | // | | | |
| 1491 | // | SubReq | | |
| 1492 | // |------------->| | |
| 1493 | // | | | |
| 1494 | // | | SubReq | |
| 1495 | // | |------------->| |
| 1496 | // | | | |
| 1497 | // | | | |
| 1498 | // | | SubReq | |
| 1499 | // | |------------->| |
| 1500 | // | | | |
| 1501 | // | | SubDelReq | |
| 1502 | // | |------------->| |
| 1503 | // | | | |
| 1504 | // | | | |
| 1505 | // | | SubDelReq | |
| 1506 | // | |------------->| |
| 1507 | // | | | |
| 1508 | // | | | |
| 1509 | // |
| 1510 | //----------------------------------------------------------------------------- |
| 1511 | |
| 1512 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1513 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1514 | |
| 1515 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1516 | Counter{cSubReqFromXapp, 1}, |
| 1517 | Counter{cSubReqToE2, 1}, |
| 1518 | Counter{cSubReReqToE2, 1}, |
| 1519 | Counter{cSubReqTimerExpiry, 2}, |
| 1520 | Counter{cSubDelReqToE2, 1}, |
| 1521 | Counter{cSubDelReReqToE2, 1}, |
| 1522 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1523 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1524 | |
| 1525 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1526 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1527 | |
| 1528 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1529 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1530 | |
| 1531 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1532 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1533 | |
| 1534 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1535 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1536 | |
| 1537 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1538 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1539 | |
| 1540 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1541 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1542 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1543 | xappConn1.TestMsgChanEmpty(t) |
| 1544 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1545 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1546 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1547 | |
| 1548 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1549 | } |
| 1550 | |
| 1551 | //----------------------------------------------------------------------------- |
| 1552 | // TestSubReqSubFailRespInSubmgr |
| 1553 | // |
| 1554 | // stub stub |
| 1555 | // +-------+ +---------+ +---------+ |
| 1556 | // | xapp | | submgr | | e2term | |
| 1557 | // +-------+ +---------+ +---------+ |
| 1558 | // | | | |
| 1559 | // | SubReq | | |
| 1560 | // |------------->| | |
| 1561 | // | | | |
| 1562 | // | | SubReq | |
| 1563 | // | |------------->| |
| 1564 | // | | | |
| 1565 | // | | SubFail | |
| 1566 | // | |<-------------| |
| 1567 | // | | | |
| 1568 | // | SubFail | | |
| 1569 | // |<-------------| | |
| 1570 | // | | | |
| 1571 | // |
| 1572 | //----------------------------------------------------------------------------- |
| 1573 | |
| 1574 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1575 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1576 | |
| 1577 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1578 | Counter{cSubReqFromXapp, 1}, |
| 1579 | Counter{cSubReqToE2, 1}, |
| 1580 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1581 | Counter{cSubFailToXapp, 1}, |
| 1582 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1583 | |
| 1584 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1585 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1586 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1587 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1588 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1589 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1590 | fparams1.Set(crereq1) |
| 1591 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1592 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1593 | // Xapp: Receive SubsFail |
| 1594 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1595 | |
| 1596 | // Wait that subs is cleaned |
| 1597 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1598 | |
| 1599 | xappConn1.TestMsgChanEmpty(t) |
| 1600 | xappConn2.TestMsgChanEmpty(t) |
| 1601 | e2termConn1.TestMsgChanEmpty(t) |
| 1602 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1603 | |
| 1604 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1605 | } |
| 1606 | |
| 1607 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1608 | // TestSubDelReqRetryInSubmgr |
| 1609 | // |
| 1610 | // stub stub |
| 1611 | // +-------+ +---------+ +---------+ |
| 1612 | // | xapp | | submgr | | e2term | |
| 1613 | // +-------+ +---------+ +---------+ |
| 1614 | // | | | |
| 1615 | // | [SUBS CREATE] | |
| 1616 | // | | | |
| 1617 | // | | | |
| 1618 | // | SubDelReq | | |
| 1619 | // |------------->| | |
| 1620 | // | | | |
| 1621 | // | | SubDelReq | |
| 1622 | // | |------------->| |
| 1623 | // | | | |
| 1624 | // | | SubDelReq | |
| 1625 | // | |------------->| |
| 1626 | // | | | |
| 1627 | // | | SubDelResp | |
| 1628 | // | |<-------------| |
| 1629 | // | | | |
| 1630 | // | SubDelResp | | |
| 1631 | // |<-------------| | |
| 1632 | // |
| 1633 | //----------------------------------------------------------------------------- |
| 1634 | |
| 1635 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1636 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1637 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1638 | |
| 1639 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1640 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1641 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1642 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1643 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1644 | |
| 1645 | // Subs Delete |
| 1646 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1647 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1648 | |
| 1649 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1650 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1651 | |
| 1652 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1653 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1654 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1655 | |
| 1656 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1657 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1658 | |
| 1659 | // Wait that subs is cleaned |
| 1660 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1661 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1662 | xappConn1.TestMsgChanEmpty(t) |
| 1663 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1664 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1665 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1666 | } |
| 1667 | |
| 1668 | //----------------------------------------------------------------------------- |
| 1669 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1670 | // |
| 1671 | // stub stub |
| 1672 | // +-------+ +---------+ +---------+ |
| 1673 | // | xapp | | submgr | | e2term | |
| 1674 | // +-------+ +---------+ +---------+ |
| 1675 | // | | | |
| 1676 | // | [SUBS CREATE] | |
| 1677 | // | | | |
| 1678 | // | | | |
| 1679 | // | SubDelReq | | |
| 1680 | // |------------->| | |
| 1681 | // | | | |
| 1682 | // | | SubDelReq | |
| 1683 | // | |------------->| |
| 1684 | // | | | |
| 1685 | // | | SubDelReq | |
| 1686 | // | |------------->| |
| 1687 | // | | | |
| 1688 | // | | | |
| 1689 | // | SubDelResp | | |
| 1690 | // |<-------------| | |
| 1691 | // |
| 1692 | //----------------------------------------------------------------------------- |
| 1693 | |
| 1694 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1695 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1696 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1697 | |
| 1698 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1699 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1700 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1701 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1702 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1703 | |
| 1704 | // Subs Delete |
| 1705 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1706 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1707 | |
| 1708 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1709 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1710 | |
| 1711 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1712 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1713 | |
| 1714 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1715 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1716 | |
| 1717 | // Wait that subs is cleaned |
| 1718 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1719 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1720 | xappConn1.TestMsgChanEmpty(t) |
| 1721 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1722 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1723 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1724 | } |
| 1725 | |
| 1726 | //----------------------------------------------------------------------------- |
| 1727 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1728 | // |
| 1729 | // stub stub |
| 1730 | // +-------+ +---------+ +---------+ |
| 1731 | // | xapp | | submgr | | e2term | |
| 1732 | // +-------+ +---------+ +---------+ |
| 1733 | // | | | |
| 1734 | // | [SUBS CREATE] | |
| 1735 | // | | | |
| 1736 | // | | | |
| 1737 | // | SubDelReq | | |
| 1738 | // |------------->| | |
| 1739 | // | | | |
| 1740 | // | | SubDelReq | |
| 1741 | // | |------------->| |
| 1742 | // | | | |
| 1743 | // | | SubDelFail | |
| 1744 | // | |<-------------| |
| 1745 | // | | | |
| 1746 | // | SubDelResp | | |
| 1747 | // |<-------------| | |
| 1748 | // | | | |
| 1749 | // |
| 1750 | //----------------------------------------------------------------------------- |
| 1751 | |
| 1752 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1753 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1754 | |
| 1755 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1756 | Counter{cSubReqFromXapp, 1}, |
| 1757 | Counter{cSubReqToE2, 1}, |
| 1758 | Counter{cSubRespFromE2, 1}, |
| 1759 | Counter{cSubRespToXapp, 1}, |
| 1760 | Counter{cSubDelReqFromXapp, 1}, |
| 1761 | Counter{cSubDelReqToE2, 1}, |
| 1762 | Counter{cSubDelFailFromE2, 1}, |
| 1763 | Counter{cSubDelRespToXapp, 1}, |
| 1764 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1765 | |
| 1766 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1767 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1768 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1769 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1770 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1771 | |
| 1772 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1773 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1774 | |
| 1775 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1776 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1777 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1778 | |
| 1779 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1780 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1781 | |
| 1782 | // Wait that subs is cleaned |
| 1783 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1784 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1785 | xappConn1.TestMsgChanEmpty(t) |
| 1786 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1787 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1788 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1789 | |
| 1790 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1791 | } |
| 1792 | |
| 1793 | //----------------------------------------------------------------------------- |
| 1794 | // TestSubReqAndSubDelOkSameAction |
| 1795 | // |
| 1796 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1797 | // +-------+ +-------+ +---------+ +---------+ |
| 1798 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1799 | // +-------+ +-------+ +---------+ +---------+ |
| 1800 | // | | | | |
| 1801 | // | | | | |
| 1802 | // | | | | |
| 1803 | // | | SubReq1 | | |
| 1804 | // | |------------->| | |
| 1805 | // | | | | |
| 1806 | // | | | SubReq1 | |
| 1807 | // | | |------------->| |
| 1808 | // | | | SubResp1 | |
| 1809 | // | | |<-------------| |
| 1810 | // | | SubResp1 | | |
| 1811 | // | |<-------------| | |
| 1812 | // | | | | |
| 1813 | // | SubReq2 | | |
| 1814 | // |--------------------------->| | |
| 1815 | // | | | | |
| 1816 | // | SubResp2 | | |
| 1817 | // |<---------------------------| | |
| 1818 | // | | | | |
| 1819 | // | | SubDelReq 1 | | |
| 1820 | // | |------------->| | |
| 1821 | // | | | | |
| 1822 | // | | SubDelResp 1 | | |
| 1823 | // | |<-------------| | |
| 1824 | // | | | | |
| 1825 | // | SubDelReq 2 | | |
| 1826 | // |--------------------------->| | |
| 1827 | // | | | | |
| 1828 | // | | | SubDelReq 2 | |
| 1829 | // | | |------------->| |
| 1830 | // | | | | |
| 1831 | // | | | SubDelReq 2 | |
| 1832 | // | | |------------->| |
| 1833 | // | | | | |
| 1834 | // | SubDelResp 2 | | |
| 1835 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1836 | // |
| 1837 | //----------------------------------------------------------------------------- |
| 1838 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1839 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1840 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1841 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1842 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1843 | Counter{cSubReqFromXapp, 2}, |
| 1844 | Counter{cSubReqToE2, 1}, |
| 1845 | Counter{cSubRespFromE2, 1}, |
| 1846 | Counter{cSubRespToXapp, 2}, |
| 1847 | Counter{cMergedSubscriptions, 1}, |
| 1848 | Counter{cUnmergedSubscriptions, 1}, |
| 1849 | Counter{cSubDelReqFromXapp, 2}, |
| 1850 | Counter{cSubDelReqToE2, 1}, |
| 1851 | Counter{cSubDelRespFromE2, 1}, |
| 1852 | Counter{cSubDelRespToXapp, 2}, |
| 1853 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1854 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1855 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1856 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1857 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1858 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1859 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1860 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1861 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1862 | |
| 1863 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1864 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1865 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1866 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1867 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1868 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1869 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1870 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1871 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1872 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1873 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1874 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1875 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1876 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1877 | |
| 1878 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1879 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1880 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1881 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1882 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1883 | //Wait that subs is cleaned |
| 1884 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1885 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1886 | xappConn1.TestMsgChanEmpty(t) |
| 1887 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1888 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1889 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1890 | |
| 1891 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1892 | } |
| 1893 | |
| 1894 | //----------------------------------------------------------------------------- |
| 1895 | // TestSubReqAndSubDelOkSameActionParallel |
| 1896 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1897 | // stub stub stub |
| 1898 | // +-------+ +-------+ +---------+ +---------+ |
| 1899 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1900 | // +-------+ +-------+ +---------+ +---------+ |
| 1901 | // | | | | |
| 1902 | // | | | | |
| 1903 | // | | | | |
| 1904 | // | | SubReq1 | | |
| 1905 | // | |------------->| | |
| 1906 | // | | | | |
| 1907 | // | | | SubReq1 | |
| 1908 | // | | |------------->| |
| 1909 | // | SubReq2 | | |
| 1910 | // |--------------------------->| | |
| 1911 | // | | | SubResp1 | |
| 1912 | // | | |<-------------| |
| 1913 | // | | SubResp1 | | |
| 1914 | // | |<-------------| | |
| 1915 | // | | | | |
| 1916 | // | SubResp2 | | |
| 1917 | // |<---------------------------| | |
| 1918 | // | | | | |
| 1919 | // | | SubDelReq 1 | | |
| 1920 | // | |------------->| | |
| 1921 | // | | | | |
| 1922 | // | | SubDelResp 1 | | |
| 1923 | // | |<-------------| | |
| 1924 | // | | | | |
| 1925 | // | SubDelReq 2 | | |
| 1926 | // |--------------------------->| | |
| 1927 | // | | | | |
| 1928 | // | | | SubDelReq 2 | |
| 1929 | // | | |------------->| |
| 1930 | // | | | | |
| 1931 | // | | | SubDelReq 2 | |
| 1932 | // | | |------------->| |
| 1933 | // | | | | |
| 1934 | // | SubDelResp 2 | | |
| 1935 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1936 | // |
| 1937 | //----------------------------------------------------------------------------- |
| 1938 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1939 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1940 | |
| 1941 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1942 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1943 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1944 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1945 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1946 | |
| 1947 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1948 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1949 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1950 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1951 | |
| 1952 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1953 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1954 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1955 | |
| 1956 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1957 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1958 | |
| 1959 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1960 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1961 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1962 | |
| 1963 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1964 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1965 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1966 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1967 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1968 | |
| 1969 | //Wait that subs is cleaned |
| 1970 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1971 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1972 | xappConn1.TestMsgChanEmpty(t) |
| 1973 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1974 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1975 | mainCtrl.wait_registry_empty(t, 10) |
| 1976 | } |
| 1977 | |
| 1978 | //----------------------------------------------------------------------------- |
| 1979 | // TestSubReqAndSubDelNokSameActionParallel |
| 1980 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1981 | // stub stub stub |
| 1982 | // +-------+ +-------+ +---------+ +---------+ |
| 1983 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1984 | // +-------+ +-------+ +---------+ +---------+ |
| 1985 | // | | | | |
| 1986 | // | | | | |
| 1987 | // | | | | |
| 1988 | // | | SubReq1 | | |
| 1989 | // | |------------->| | |
| 1990 | // | | | | |
| 1991 | // | | | SubReq1 | |
| 1992 | // | | |------------->| |
| 1993 | // | SubReq2 | | |
| 1994 | // |--------------------------->| | |
| 1995 | // | | | SubFail1 | |
| 1996 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1997 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1998 | // | | SubFail1 | | |
| 1999 | // | |<-------------| | |
| 2000 | // | | | | |
| 2001 | // | SubFail2 | | |
| 2002 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2003 | // |
| 2004 | //----------------------------------------------------------------------------- |
| 2005 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2006 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2007 | |
| 2008 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2009 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2010 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2011 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2012 | |
| 2013 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2014 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2015 | |
| 2016 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2017 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2018 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2019 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2020 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2021 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2022 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2023 | // E2t: send SubsFail (first) |
| 2024 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 2025 | fparams1.Set(crereq1) |
| 2026 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 2027 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2028 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2029 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2030 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2031 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2032 | |
| 2033 | //Wait that subs is cleaned |
| 2034 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 2035 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2036 | xappConn1.TestMsgChanEmpty(t) |
| 2037 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2038 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2039 | mainCtrl.wait_registry_empty(t, 10) |
| 2040 | } |
| 2041 | |
| 2042 | //----------------------------------------------------------------------------- |
| 2043 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 2044 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2045 | // stub stub stub |
| 2046 | // +-------+ +-------+ +---------+ +---------+ |
| 2047 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2048 | // +-------+ +-------+ +---------+ +---------+ |
| 2049 | // | | | | |
| 2050 | // | | | | |
| 2051 | // | | | | |
| 2052 | // | | SubReq1 | | |
| 2053 | // | |------------->| | |
| 2054 | // | | | | |
| 2055 | // | | | SubReq1 | |
| 2056 | // | | |------------->| |
| 2057 | // | | SubReq2 | | |
| 2058 | // |--------------------------->| | |
| 2059 | // | | | | |
| 2060 | // | | | SubReq1 | |
| 2061 | // | | |------------->| |
| 2062 | // | | | | |
| 2063 | // | | | | |
| 2064 | // | | | SubDelReq | |
| 2065 | // | | |------------->| |
| 2066 | // | | | | |
| 2067 | // | | | SubDelResp | |
| 2068 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2069 | // |
| 2070 | //----------------------------------------------------------------------------- |
| 2071 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2072 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2073 | |
| 2074 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2075 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2076 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2077 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2078 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2079 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2080 | |
| 2081 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2082 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2083 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2084 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2085 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2086 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2087 | |
| 2088 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2089 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2090 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2091 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2092 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2093 | |
| 2094 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2095 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2096 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2097 | xappConn1.TestMsgChanEmpty(t) |
| 2098 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2099 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2100 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2101 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2102 | |
| 2103 | //----------------------------- Policy cases --------------------------------- |
| 2104 | //----------------------------------------------------------------------------- |
| 2105 | // TestSubReqPolicyAndSubDelOk |
| 2106 | // |
| 2107 | // stub stub |
| 2108 | // +-------+ +---------+ +---------+ |
| 2109 | // | xapp | | submgr | | e2term | |
| 2110 | // +-------+ +---------+ +---------+ |
| 2111 | // | | | |
| 2112 | // | SubReq | | |
| 2113 | // |------------->| | |
| 2114 | // | | | |
| 2115 | // | | SubReq | |
| 2116 | // | |------------->| |
| 2117 | // | | | |
| 2118 | // | | SubResp | |
| 2119 | // | |<-------------| |
| 2120 | // | | | |
| 2121 | // | SubResp | | |
| 2122 | // |<-------------| | |
| 2123 | // | | | |
| 2124 | // | | | |
| 2125 | // | SubDelReq | | |
| 2126 | // |------------->| | |
| 2127 | // | | | |
| 2128 | // | | SubDelReq | |
| 2129 | // | |------------->| |
| 2130 | // | | | |
| 2131 | // | | SubDelResp | |
| 2132 | // | |<-------------| |
| 2133 | // | | | |
| 2134 | // | SubDelResp | | |
| 2135 | // |<-------------| | |
| 2136 | // |
| 2137 | //----------------------------------------------------------------------------- |
| 2138 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2139 | CaseBegin("TestSubReqAndSubDelOk") |
| 2140 | |
| 2141 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2142 | rparams1.Init() |
| 2143 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2144 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2145 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2146 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2147 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2148 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2149 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2150 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2151 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2152 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2153 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2154 | |
| 2155 | //Wait that subs is cleaned |
| 2156 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2157 | |
| 2158 | xappConn1.TestMsgChanEmpty(t) |
| 2159 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2160 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2161 | mainCtrl.wait_registry_empty(t, 10) |
| 2162 | } |
| 2163 | |
| 2164 | //----------------------------------------------------------------------------- |
| 2165 | // TestSubReqPolicyChangeAndSubDelOk |
| 2166 | // |
| 2167 | // stub stub |
| 2168 | // +-------+ +---------+ +---------+ |
| 2169 | // | xapp | | submgr | | e2term | |
| 2170 | // +-------+ +---------+ +---------+ |
| 2171 | // | | | |
| 2172 | // | SubReq | | |
| 2173 | // |------------->| | |
| 2174 | // | | | |
| 2175 | // | | SubReq | |
| 2176 | // | |------------->| |
| 2177 | // | | | |
| 2178 | // | | SubResp | |
| 2179 | // | |<-------------| |
| 2180 | // | | | |
| 2181 | // | SubResp | | |
| 2182 | // |<-------------| | |
| 2183 | // | | | |
| 2184 | // | SubReq | | |
| 2185 | // |------------->| | |
| 2186 | // | | | |
| 2187 | // | | SubReq | |
| 2188 | // | |------------->| |
| 2189 | // | | | |
| 2190 | // | | SubResp | |
| 2191 | // | |<-------------| |
| 2192 | // | | | |
| 2193 | // | SubResp | | |
| 2194 | // |<-------------| | |
| 2195 | // | | | |
| 2196 | // | SubDelReq | | |
| 2197 | // |------------->| | |
| 2198 | // | | | |
| 2199 | // | | SubDelReq | |
| 2200 | // | |------------->| |
| 2201 | // | | | |
| 2202 | // | | SubDelResp | |
| 2203 | // | |<-------------| |
| 2204 | // | | | |
| 2205 | // | SubDelResp | | |
| 2206 | // |<-------------| | |
| 2207 | // |
| 2208 | //----------------------------------------------------------------------------- |
| 2209 | |
| 2210 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2211 | CaseBegin("TestSubReqAndSubDelOk") |
| 2212 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2213 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2214 | rparams1.Init() |
| 2215 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2216 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2217 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2218 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2219 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2220 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2221 | |
| 2222 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2223 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2224 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2225 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2226 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2227 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2228 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2229 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2230 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2231 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2232 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2233 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2234 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2235 | |
| 2236 | //Wait that subs is cleaned |
| 2237 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2238 | |
| 2239 | xappConn1.TestMsgChanEmpty(t) |
| 2240 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2241 | e2termConn1.TestMsgChanEmpty(t) |
| 2242 | mainCtrl.wait_registry_empty(t, 10) |
| 2243 | } |
| 2244 | |
| 2245 | //----------------------------------------------------------------------------- |
| 2246 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2247 | // |
| 2248 | // stub stub stub |
| 2249 | // +-------+ +---------+ +---------+ +---------+ |
| 2250 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2251 | // +-------+ +---------+ +---------+ +---------+ |
| 2252 | // | | | | |
| 2253 | // | | | | |
| 2254 | // | | | | |
| 2255 | // | SubReq1 | | | |
| 2256 | // |------------->| | | |
| 2257 | // | | | | |
| 2258 | // | | SubReq1 | | |
| 2259 | // | |------------->| | |
| 2260 | // | | | | |
| 2261 | // | SubReq2 | | | |
| 2262 | // |------------->| | | |
| 2263 | // | | | | |
| 2264 | // | | SubReq2 | | |
| 2265 | // | |---------------------------->| |
| 2266 | // | | | | |
| 2267 | // | | SubResp1 | | |
| 2268 | // | |<-------------| | |
| 2269 | // | SubResp1 | | | |
| 2270 | // |<-------------| | | |
| 2271 | // | | SubResp2 | | |
| 2272 | // | |<----------------------------| |
| 2273 | // | SubResp2 | | | |
| 2274 | // |<-------------| | | |
| 2275 | // | | | | |
| 2276 | // | [SUBS 1 DELETE] | | |
| 2277 | // | | | | |
| 2278 | // | [SUBS 2 DELETE] | | |
| 2279 | // | | | | |
| 2280 | // |
| 2281 | //----------------------------------------------------------------------------- |
| 2282 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2283 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2284 | |
| 2285 | //Req1 |
| 2286 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2287 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2288 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2289 | |
| 2290 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2291 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2292 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2293 | |
| 2294 | //Resp1 |
| 2295 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2296 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2297 | |
| 2298 | //Resp2 |
| 2299 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2300 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2301 | |
| 2302 | //Del1 |
| 2303 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2304 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2305 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2306 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2307 | //Wait that subs is cleaned |
| 2308 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2309 | |
| 2310 | //Del2 |
| 2311 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2312 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2313 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2314 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2315 | //Wait that subs is cleaned |
| 2316 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2317 | |
| 2318 | xappConn1.TestMsgChanEmpty(t) |
| 2319 | xappConn2.TestMsgChanEmpty(t) |
| 2320 | e2termConn1.TestMsgChanEmpty(t) |
| 2321 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2322 | mainCtrl.wait_registry_empty(t, 10) |
| 2323 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2324 | |
| 2325 | //----------------------------------------------------------------------------- |
| 2326 | // TestSubReqInsertAndSubDelOk |
| 2327 | // |
| 2328 | // stub stub |
| 2329 | // +-------+ +---------+ +---------+ |
| 2330 | // | xapp | | submgr | | e2term | |
| 2331 | // +-------+ +---------+ +---------+ |
| 2332 | // | | | |
| 2333 | // | SubReq | | |
| 2334 | // |------------->| | |
| 2335 | // | | | |
| 2336 | // | | SubReq | |
| 2337 | // | |------------->| |
| 2338 | // | | | |
| 2339 | // | | SubResp | |
| 2340 | // | |<-------------| |
| 2341 | // | | | |
| 2342 | // | SubResp | | |
| 2343 | // |<-------------| | |
| 2344 | // | | | |
| 2345 | // | | | |
| 2346 | // | SubDelReq | | |
| 2347 | // |------------->| | |
| 2348 | // | | | |
| 2349 | // | | SubDelReq | |
| 2350 | // | |------------->| |
| 2351 | // | | | |
| 2352 | // | | SubDelResp | |
| 2353 | // | |<-------------| |
| 2354 | // | | | |
| 2355 | // | SubDelResp | | |
| 2356 | // |<-------------| | |
| 2357 | // |
| 2358 | //----------------------------------------------------------------------------- |
| 2359 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2360 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2361 | |
| 2362 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2363 | rparams1.Init() |
| 2364 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2365 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2366 | |
| 2367 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2368 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2369 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2370 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2371 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2372 | |
| 2373 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2374 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2375 | |
| 2376 | //Wait that subs is cleaned |
| 2377 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2378 | |
| 2379 | xappConn1.TestMsgChanEmpty(t) |
| 2380 | xappConn2.TestMsgChanEmpty(t) |
| 2381 | e2termConn1.TestMsgChanEmpty(t) |
| 2382 | mainCtrl.wait_registry_empty(t, 10) |
| 2383 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2384 | |
| 2385 | //----------------------------------------------------------------------------- |
| 2386 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2387 | // |
| 2388 | // This case simulates case where xApp restarts and starts sending same |
| 2389 | // subscription requests which have already subscribed successfully |
| 2390 | |
| 2391 | // stub stub |
| 2392 | // +-------+ +---------+ +---------+ |
| 2393 | // | xapp | | submgr | | e2term | |
| 2394 | // +-------+ +---------+ +---------+ |
| 2395 | // | | | |
| 2396 | // | SubReq | | |
| 2397 | // |------------->| | |
| 2398 | // | | | |
| 2399 | // | | SubReq | |
| 2400 | // | |------------->| |
| 2401 | // | | | |
| 2402 | // | | SubResp | |
| 2403 | // | |<-------------| |
| 2404 | // | | | |
| 2405 | // | SubResp | | |
| 2406 | // |<-------------| | |
| 2407 | // | | | |
| 2408 | // | xApp restart | | |
| 2409 | // | | | |
| 2410 | // | SubReq | | |
| 2411 | // | (retrans with same xApp generated subid but diff xid) |
| 2412 | // |------------->| | |
| 2413 | // | | | |
| 2414 | // | SubResp | | |
| 2415 | // |<-------------| | |
| 2416 | // | | | |
| 2417 | // | [SUBS DELETE] | |
| 2418 | // | | | |
| 2419 | // |
| 2420 | //----------------------------------------------------------------------------- |
| 2421 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2422 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2423 | |
| 2424 | //Subs Create |
| 2425 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2426 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2427 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2428 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2429 | |
| 2430 | // xApp restart here |
| 2431 | // --> artificial delay |
| 2432 | <-time.After(1 * time.Second) |
| 2433 | |
| 2434 | //Subs Create |
| 2435 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2436 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2437 | |
| 2438 | //Subs Delete |
| 2439 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2440 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2441 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2442 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2443 | |
| 2444 | //Wait that subs is cleaned |
| 2445 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2446 | |
| 2447 | xappConn1.TestMsgChanEmpty(t) |
| 2448 | xappConn2.TestMsgChanEmpty(t) |
| 2449 | e2termConn1.TestMsgChanEmpty(t) |
| 2450 | mainCtrl.wait_registry_empty(t, 10) |
| 2451 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2452 | |
| 2453 | //----------------------------------------------------------------------------- |
| 2454 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2455 | // |
| 2456 | // stub stub |
| 2457 | // +-------+ +---------+ +---------+ |
| 2458 | // | xapp | | submgr | | e2term | |
| 2459 | // +-------+ +---------+ +---------+ |
| 2460 | // | | | |
| 2461 | // | SubReq | | |
| 2462 | // |------------->| | |
| 2463 | // | | | |
| 2464 | // | | SubReq | |
| 2465 | // | |------------->| |
| 2466 | // | | | |
| 2467 | // | | SubResp | |
| 2468 | // | <----| |
| 2469 | // | | |
| 2470 | // | Submgr restart | |
| 2471 | // | | |
| 2472 | // | | | |
| 2473 | // | | SubDelReq | |
| 2474 | // | |------------->| |
| 2475 | // | | | |
| 2476 | // | | SubDelResp | |
| 2477 | // | |<-------------| |
| 2478 | // | | | |
| 2479 | // |
| 2480 | //----------------------------------------------------------------------------- |
| 2481 | |
| 2482 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2483 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2484 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2485 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2486 | xappConn1.SendSubsReq(t, nil, nil) |
| 2487 | e2termConn1.RecvSubsReq(t) |
| 2488 | mainCtrl.SetResetTestFlag(t, false) |
| 2489 | |
| 2490 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2491 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2492 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2493 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2494 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2495 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2496 | mainCtrl.SimulateRestart(t) |
| 2497 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2498 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2499 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2500 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2501 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2502 | |
| 2503 | // Wait that subs is cleaned |
| 2504 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2505 | |
| 2506 | xappConn1.TestMsgChanEmpty(t) |
| 2507 | xappConn2.TestMsgChanEmpty(t) |
| 2508 | e2termConn1.TestMsgChanEmpty(t) |
| 2509 | mainCtrl.wait_registry_empty(t, 10) |
| 2510 | } |
| 2511 | |
| 2512 | //----------------------------------------------------------------------------- |
| 2513 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2514 | // |
| 2515 | // stub stub |
| 2516 | // +-------+ +---------+ +---------+ |
| 2517 | // | xapp | | submgr | | e2term | |
| 2518 | // +-------+ +---------+ +---------+ |
| 2519 | // | | | |
| 2520 | // | SubReq | | |
| 2521 | // |------------->| | |
| 2522 | // | | | |
| 2523 | // | | SubReq | |
| 2524 | // | |------------->| |
| 2525 | // | | | |
| 2526 | // | | SubResp | |
| 2527 | // | |<-------------| |
| 2528 | // | | | |
| 2529 | // | SubResp | | |
| 2530 | // |<-------------| | |
| 2531 | // | | | |
| 2532 | // | | |
| 2533 | // | Submgr restart | |
| 2534 | // | | |
| 2535 | // | SubDelReq | | |
| 2536 | // |------------->| | |
| 2537 | // | | | |
| 2538 | // | | SubDelReq | |
| 2539 | // | |------------->| |
| 2540 | // | | | |
| 2541 | // | | SubDelResp | |
| 2542 | // | |<-------------| |
| 2543 | // | | | |
| 2544 | // | SubDelResp | | |
| 2545 | // |<-------------| | |
| 2546 | // |
| 2547 | //----------------------------------------------------------------------------- |
| 2548 | |
| 2549 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2550 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2551 | |
| 2552 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2553 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2554 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2555 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2556 | |
| 2557 | // Check subscription |
| 2558 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2559 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2560 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2561 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2562 | |
| 2563 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2564 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2565 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2566 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2567 | // That needs to be completed before successful subscription query is possible |
| 2568 | <-time.After(time.Second * 1) |
| 2569 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2570 | // Check that subscription is restored correctly after restart |
| 2571 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2572 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2573 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2574 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2575 | |
| 2576 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2577 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2578 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2579 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2580 | |
| 2581 | //Wait that subs is cleaned |
| 2582 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2583 | |
| 2584 | xappConn1.TestMsgChanEmpty(t) |
| 2585 | xappConn2.TestMsgChanEmpty(t) |
| 2586 | e2termConn1.TestMsgChanEmpty(t) |
| 2587 | mainCtrl.wait_registry_empty(t, 10) |
| 2588 | } |
| 2589 | |
| 2590 | //----------------------------------------------------------------------------- |
| 2591 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2592 | // |
| 2593 | // stub stub |
| 2594 | // +-------+ +-------+ +---------+ +---------+ |
| 2595 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2596 | // +-------+ +-------+ +---------+ +---------+ |
| 2597 | // | | | | |
| 2598 | // | | | | |
| 2599 | // | | | | |
| 2600 | // | | SubReq1 | | |
| 2601 | // | |------------->| | |
| 2602 | // | | | | |
| 2603 | // | | | SubReq1 | |
| 2604 | // | | |------------->| |
| 2605 | // | | | SubResp1 | |
| 2606 | // | | |<-------------| |
| 2607 | // | | SubResp1 | | |
| 2608 | // | |<-------------| | |
| 2609 | // | | | | |
| 2610 | // | | |
| 2611 | // | submgr restart | |
| 2612 | // | | |
| 2613 | // | | | | |
| 2614 | // | | | | |
| 2615 | // | SubReq2 | | |
| 2616 | // |--------------------------->| | |
| 2617 | // | | | | |
| 2618 | // | SubResp2 | | |
| 2619 | // |<---------------------------| | |
| 2620 | // | | | | |
| 2621 | // | | SubDelReq 1 | | |
| 2622 | // | |------------->| | |
| 2623 | // | | | | |
| 2624 | // | | SubDelResp 1 | | |
| 2625 | // | |<-------------| | |
| 2626 | // | | | | |
| 2627 | // | | | | |
| 2628 | // | | |
| 2629 | // | submgr restart | |
| 2630 | // | | |
| 2631 | // | | | | |
| 2632 | // | SubDelReq 2 | | |
| 2633 | // |--------------------------->| | |
| 2634 | // | | | | |
| 2635 | // | | | SubDelReq 2 | |
| 2636 | // | | |------------->| |
| 2637 | // | | | | |
| 2638 | // | | | SubDelReq 2 | |
| 2639 | // | | |------------->| |
| 2640 | // | | | | |
| 2641 | // | SubDelResp 2 | | |
| 2642 | // |<---------------------------| | |
| 2643 | // |
| 2644 | //----------------------------------------------------------------------------- |
| 2645 | |
| 2646 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2647 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2648 | |
| 2649 | //Req1 |
| 2650 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2651 | rparams1.Init() |
| 2652 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2653 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2654 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2655 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2656 | |
| 2657 | //Req2 |
| 2658 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2659 | rparams2.Init() |
| 2660 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2661 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2662 | |
| 2663 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2664 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2665 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2666 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2667 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2668 | |
| 2669 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2670 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2671 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2672 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2673 | // That needs to be completed before successful subscription query is possible |
| 2674 | <-time.After(time.Second * 1) |
| 2675 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2676 | // Check that subscription is restored correctly after restart |
| 2677 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2678 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2679 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2680 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2681 | |
| 2682 | //Del1 |
| 2683 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2684 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2685 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2686 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2687 | |
| 2688 | mainCtrl.SimulateRestart(t) |
| 2689 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2690 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2691 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2692 | // Submgr need be ready before successful subscription deletion is possible |
| 2693 | <-time.After(time.Second * 1) |
| 2694 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2695 | //Del2 |
| 2696 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2697 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2698 | |
| 2699 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2700 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2701 | |
| 2702 | //Wait that subs is cleaned |
| 2703 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2704 | |
| 2705 | xappConn1.TestMsgChanEmpty(t) |
| 2706 | xappConn2.TestMsgChanEmpty(t) |
| 2707 | e2termConn1.TestMsgChanEmpty(t) |
| 2708 | mainCtrl.wait_registry_empty(t, 10) |
| 2709 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2710 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2711 | //***************************************************************************** |
| 2712 | // REST interface test cases |
| 2713 | //***************************************************************************** |
| 2714 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2715 | //----------------------------------------------------------------------------- |
| 2716 | // Test debug GET and POST requests |
| 2717 | // |
| 2718 | // curl |
| 2719 | // +-------+ +---------+ |
| 2720 | // | user | | submgr | |
| 2721 | // +-------+ +---------+ |
| 2722 | // | | |
| 2723 | // | GET/POST Req | |
| 2724 | // |------------->| |
| 2725 | // | Resp | |
| 2726 | // |<-------------| |
| 2727 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2728 | func TestGetSubscriptions(t *testing.T) { |
| 2729 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2730 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2731 | } |
| 2732 | |
| 2733 | func TestGetSymptomData(t *testing.T) { |
| 2734 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2735 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2736 | } |
| 2737 | |
| 2738 | func TestPostdeleteSubId(t *testing.T) { |
| 2739 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2740 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2741 | } |
| 2742 | |
| 2743 | func TestPostEmptyDb(t *testing.T) { |
| 2744 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2745 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2746 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2747 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2748 | func TestGetRestSubscriptions(t *testing.T) { |
| 2749 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2750 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2751 | } |
| 2752 | |
| 2753 | //----------------------------------------------------------------------------- |
| 2754 | // TestDelAllE2nodeSubsViaDebugIf |
| 2755 | // |
| 2756 | // stub stub stub |
| 2757 | // +-------+ +---------+ +---------+ +---------+ |
| 2758 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2759 | // +-------+ +---------+ +---------+ +---------+ |
| 2760 | // | | | | |
| 2761 | // | RESTSubReq | | | |
| 2762 | // |---------------->| | | |
| 2763 | // | RESTSubResp | | | |
| 2764 | // |<----------------| | | |
| 2765 | // | | RouteCreate | | |
| 2766 | // | |--------------------------->| |
| 2767 | // | | RouteResponse| | |
| 2768 | // | |<---------------------------| |
| 2769 | // | | SubReq | | |
| 2770 | // | |------------->| | |
| 2771 | // | | SubResp | | |
| 2772 | // | |<-------------| | |
| 2773 | // | RESTNotif1 | | | |
| 2774 | // |<----------------| | | |
| 2775 | // | | | | |
| 2776 | // | REST get_all_e2nodes | | |
| 2777 | // |---------------->| | | |
| 2778 | // | OK 200 | | | |
| 2779 | // |<----------------| | | |
| 2780 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2781 | // |---------------->| | | |
| 2782 | // | OK 200 | | | |
| 2783 | // |<----------------| | | |
| 2784 | // | | SubDelReq | | |
| 2785 | // | |------------->| | |
| 2786 | // | | SubDelResp | | |
| 2787 | // | |<-------------| | |
| 2788 | // | | | | |
| 2789 | // | | RouteDelete | | |
| 2790 | // | |--------------------------->| |
| 2791 | // | | RouteResponse| | |
| 2792 | // | |<---------------------------| |
| 2793 | // |
| 2794 | //----------------------------------------------------------------------------- |
| 2795 | |
| 2796 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2797 | |
| 2798 | // Init counter check |
| 2799 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2800 | Counter{cRestSubReqFromXapp, 1}, |
| 2801 | Counter{cRestSubRespToXapp, 1}, |
| 2802 | Counter{cSubReqToE2, 1}, |
| 2803 | Counter{cSubRespFromE2, 1}, |
| 2804 | Counter{cRestSubNotifToXapp, 1}, |
| 2805 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2806 | Counter{cSubDelReqToE2, 1}, |
| 2807 | Counter{cSubDelRespFromE2, 1}, |
| 2808 | Counter{cRestSubDelRespToXapp, 1}, |
| 2809 | }) |
| 2810 | |
| 2811 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2812 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2813 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2814 | |
| 2815 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2816 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2817 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2818 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2819 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2820 | |
| 2821 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2822 | |
| 2823 | var e2nodesList []string |
| 2824 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2825 | if err != nil { |
| 2826 | t.Errorf("Unmarshal error: %s", err) |
| 2827 | } |
| 2828 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2829 | |
| 2830 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2831 | var e2RestSubsMap map[string]RESTSubscription |
| 2832 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2833 | if err != nil { |
| 2834 | t.Errorf("Unmarshal error: %s", err) |
| 2835 | } |
| 2836 | |
| 2837 | if len(e2RestSubsMap) != 1 { |
| 2838 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2839 | } |
| 2840 | |
| 2841 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2842 | 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] | 2843 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2844 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2845 | |
| 2846 | // Wait that subs is cleaned |
| 2847 | waitSubsCleanup(t, e2SubsId, 10) |
| 2848 | mainCtrl.VerifyCounterValues(t) |
| 2849 | mainCtrl.VerifyAllClean(t) |
| 2850 | } |
| 2851 | |
| 2852 | //----------------------------------------------------------------------------- |
| 2853 | // TestDelAllxAppSubsViaDebugIf |
| 2854 | // |
| 2855 | // stub stub stub |
| 2856 | // +-------+ +---------+ +---------+ +---------+ |
| 2857 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2858 | // +-------+ +---------+ +---------+ +---------+ |
| 2859 | // | | | | |
| 2860 | // | RESTSubReq | | | |
| 2861 | // |---------------->| | | |
| 2862 | // | RESTSubResp | | | |
| 2863 | // |<----------------| | | |
| 2864 | // | | RouteCreate | | |
| 2865 | // | |--------------------------->| |
| 2866 | // | | RouteResponse| | |
| 2867 | // | |<---------------------------| |
| 2868 | // | | SubReq | | |
| 2869 | // | |------------->| | |
| 2870 | // | | SubResp | | |
| 2871 | // | |<-------------| | |
| 2872 | // | RESTNotif1 | | | |
| 2873 | // |<----------------| | | |
| 2874 | // | | | | |
| 2875 | // | REST get_all_xapps | | |
| 2876 | // |---------------->| | | |
| 2877 | // | OK 200 | | | |
| 2878 | // |<----------------| | | |
| 2879 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 2880 | // |---------------->| | | |
| 2881 | // | OK 200 | | | |
| 2882 | // |<----------------| | | |
| 2883 | // | | SubDelReq | | |
| 2884 | // | |------------->| | |
| 2885 | // | | SubDelResp | | |
| 2886 | // | |<-------------| | |
| 2887 | // | | | | |
| 2888 | // | | RouteDelete | | |
| 2889 | // | |--------------------------->| |
| 2890 | // | | RouteResponse| | |
| 2891 | // | |<---------------------------| |
| 2892 | // |
| 2893 | //----------------------------------------------------------------------------- |
| 2894 | |
| 2895 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 2896 | |
| 2897 | // Init counter check |
| 2898 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2899 | Counter{cRestSubReqFromXapp, 1}, |
| 2900 | Counter{cRestSubRespToXapp, 1}, |
| 2901 | Counter{cSubReqToE2, 1}, |
| 2902 | Counter{cSubRespFromE2, 1}, |
| 2903 | Counter{cRestSubNotifToXapp, 1}, |
| 2904 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2905 | Counter{cSubDelReqToE2, 1}, |
| 2906 | Counter{cSubDelRespFromE2, 1}, |
| 2907 | Counter{cRestSubDelRespToXapp, 1}, |
| 2908 | }) |
| 2909 | |
| 2910 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2911 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2912 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2913 | |
| 2914 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2915 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2916 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2917 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2918 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2919 | |
| 2920 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 2921 | |
| 2922 | var xappList []string |
| 2923 | err := json.Unmarshal(xappsJson, &xappList) |
| 2924 | if err != nil { |
| 2925 | t.Errorf("Unmarshal error: %s", err) |
| 2926 | } |
| 2927 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 2928 | |
| 2929 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2930 | 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] | 2931 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2932 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2933 | |
| 2934 | // Wait that subs is cleaned |
| 2935 | waitSubsCleanup(t, e2SubsId, 10) |
| 2936 | mainCtrl.VerifyCounterValues(t) |
| 2937 | mainCtrl.VerifyAllClean(t) |
| 2938 | } |
| 2939 | |
| 2940 | //----------------------------------------------------------------------------- |
| 2941 | // TestDelViaxAppSubsIf |
| 2942 | // |
| 2943 | // stub stub stub |
| 2944 | // +-------+ +---------+ +---------+ +---------+ |
| 2945 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2946 | // +-------+ +---------+ +---------+ +---------+ |
| 2947 | // | | | | |
| 2948 | // | RESTSubReq | | | |
| 2949 | // |---------------->| | | |
| 2950 | // | RESTSubResp | | | |
| 2951 | // |<----------------| | | |
| 2952 | // | | RouteCreate | | |
| 2953 | // | |--------------------------->| |
| 2954 | // | | RouteResponse| | |
| 2955 | // | |<---------------------------| |
| 2956 | // | | SubReq | | |
| 2957 | // | |------------->| | |
| 2958 | // | | SubResp | | |
| 2959 | // | |<-------------| | |
| 2960 | // | RESTNotif1 | | | |
| 2961 | // |<----------------| | | |
| 2962 | // | | | | |
| 2963 | // | REST get_xapp_rest_restsubscriptions | |
| 2964 | // |---------------->| | | |
| 2965 | // | OK 200 | | | |
| 2966 | // |<----------------| | | |
| 2967 | // | RESTSudDel | | | |
| 2968 | // |---------------->| | | Via user curl command (port 8088) |
| 2969 | // | RESTSudDel | | | |
| 2970 | // |<----------------| | | |
| 2971 | // | | SubDelReq | | |
| 2972 | // | |------------->| | |
| 2973 | // | | SubDelResp | | |
| 2974 | // | |<-------------| | |
| 2975 | // | | | | |
| 2976 | // | | RouteDelete | | |
| 2977 | // | |--------------------------->| |
| 2978 | // | | RouteResponse| | |
| 2979 | // | |<---------------------------| |
| 2980 | // |
| 2981 | //----------------------------------------------------------------------------- |
| 2982 | |
| 2983 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 2984 | |
| 2985 | // Init counter check |
| 2986 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2987 | Counter{cRestSubReqFromXapp, 1}, |
| 2988 | Counter{cRestSubRespToXapp, 1}, |
| 2989 | Counter{cSubReqToE2, 1}, |
| 2990 | Counter{cSubRespFromE2, 1}, |
| 2991 | Counter{cRestSubNotifToXapp, 1}, |
| 2992 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2993 | Counter{cSubDelReqToE2, 1}, |
| 2994 | Counter{cSubDelRespFromE2, 1}, |
| 2995 | Counter{cRestSubDelRespToXapp, 1}, |
| 2996 | }) |
| 2997 | |
| 2998 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2999 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3000 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3001 | |
| 3002 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3003 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3004 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3005 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3006 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 3007 | |
| 3008 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 3009 | |
| 3010 | var restSubsMap map[string]RESTSubscription |
| 3011 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 3012 | if err != nil { |
| 3013 | t.Errorf("Unmarshal error: %s", err) |
| 3014 | } |
| 3015 | _, ok := restSubsMap[restSubId] |
| 3016 | if !ok { |
| 3017 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 3018 | } |
| 3019 | |
| 3020 | var e2Subscriptions []Subscription |
| 3021 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 3022 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 3023 | if err != nil { |
| 3024 | t.Errorf("Unmarshal error: %s", err) |
| 3025 | } |
| 3026 | if len(e2Subscriptions) != 1 { |
| 3027 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 3028 | } |
| 3029 | |
| 3030 | // Simulate deletion through xapp REST test interface |
| 3031 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 3032 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3033 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3034 | |
| 3035 | // Wait that subs is cleaned |
| 3036 | waitSubsCleanup(t, e2SubsId, 10) |
| 3037 | mainCtrl.VerifyCounterValues(t) |
| 3038 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 3039 | } |
| 3040 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3041 | //----------------------------------------------------------------------------- |
| 3042 | // TestRESTSubReqAndRouteNok |
| 3043 | // |
| 3044 | // stub stub |
| 3045 | // +-------+ +---------+ +---------+ |
| 3046 | // | xapp | | submgr | | rtmgr | |
| 3047 | // +-------+ +---------+ +---------+ |
| 3048 | // | | | |
| 3049 | // | RESTSubReq | | |
| 3050 | // |---------------->| | |
| 3051 | // | | | |
| 3052 | // | RESTSubResp | | |
| 3053 | // |<----------------| | |
| 3054 | // | | RouteCreate | |
| 3055 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3056 | // | | RouteCreate | |
| 3057 | // | | status:400 | |
| 3058 | // | |(Bad request) | |
| 3059 | // | |<-------------| |
| 3060 | // | RESTNotif | | |
| 3061 | // |<----------------| | |
| 3062 | // | | | |
| 3063 | // | [SUBS INT DELETE] | |
| 3064 | // | | | |
| 3065 | // | RESTSubDelReq | | |
| 3066 | // |---------------->| | |
| 3067 | // | RESTSubDelResp | | |
| 3068 | // |<----------------| | |
| 3069 | // |
| 3070 | //----------------------------------------------------------------------------- |
| 3071 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3072 | |
| 3073 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3074 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3075 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3076 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3077 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3078 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3079 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3080 | }) |
| 3081 | |
| 3082 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3083 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3084 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 3085 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3086 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 3087 | |
| 3088 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3089 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3090 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3091 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3092 | waiter.WaitResult(t) |
| 3093 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3094 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3095 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3096 | |
| 3097 | // Del |
| 3098 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3099 | |
| 3100 | // Wait that subs is cleaned |
| 3101 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3102 | waitSubsCleanup(t, e2SubsId, 10) |
| 3103 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3104 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3105 | } |
| 3106 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3107 | //----------------------------------------------------------------------------- |
| 3108 | // TestRESTSubReqAndRouteUpdateNok |
| 3109 | // |
| 3110 | // stub stub stub stub |
| 3111 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3112 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3113 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3114 | // | | | | | |
| 3115 | // | RESTSubReq1 | | | |
| 3116 | // |------------------------>| | | |
| 3117 | // | RESTSubResp2 | | | |
| 3118 | // |<------------------------| | | |
| 3119 | // | | | | | |
| 3120 | // | | | RouteCreate | | |
| 3121 | // | | |------------->| | |
| 3122 | // | | | CreateResp | | |
| 3123 | // | | |<-------------| | |
| 3124 | // | | | SubReq | | |
| 3125 | // | | |---------------------------->| |
| 3126 | // | | | SubResp | | |
| 3127 | // | | |<----------------------------| |
| 3128 | // | RESTNotif1 | | | |
| 3129 | // |<------------------------| | | |
| 3130 | // | | | | | |
| 3131 | // | | RESTSubReq2 | | | |
| 3132 | // | |------------>| | | |
| 3133 | // | | RESTSubResp2| | | |
| 3134 | // | |<------------| | | |
| 3135 | // | | | RouteUpdate | | |
| 3136 | // | | |------------->| | |
| 3137 | // | | | RouteUpdate | | |
| 3138 | // | | | status:400 | | |
| 3139 | // | | |(Bad request) | | |
| 3140 | // | | |<-------------| | |
| 3141 | // | | RESTNotif2(unsuccessful) | | |
| 3142 | // | |<------------| | | |
| 3143 | // | | | | | |
| 3144 | // | [SUBS INT DELETE] | | |
| 3145 | // | | | | | |
| 3146 | // | RESTSubDelReq1 | | | |
| 3147 | // |------------------------>| | | |
| 3148 | // | RESTSubDelResp1 | | | |
| 3149 | // |<------------------------| | | |
| 3150 | // | | | | | |
| 3151 | // | | | [SUBS DELETE] | |
| 3152 | // |
| 3153 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3154 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3155 | |
| 3156 | //Init counter check |
| 3157 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3158 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3159 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3160 | Counter{cSubReqToE2, 1}, |
| 3161 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3162 | Counter{cRestSubNotifToXapp, 1}, |
| 3163 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3164 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3165 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3166 | Counter{cSubDelReqToE2, 1}, |
| 3167 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3168 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3169 | }) |
| 3170 | |
| 3171 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3172 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3173 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3174 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3175 | |
| 3176 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3177 | |
| 3178 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3179 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3180 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3181 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3182 | params.SetMeid("RAN_NAME_1") |
| 3183 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3184 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3185 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3186 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3187 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3188 | |
| 3189 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3190 | |
| 3191 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3192 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3193 | |
| 3194 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3195 | //Wait that subs is cleaned |
| 3196 | waitSubsCleanup(t, e2SubsId, 10) |
| 3197 | |
| 3198 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3199 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3200 | } |
| 3201 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3202 | //----------------------------------------------------------------------------- |
| 3203 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3204 | // |
| 3205 | // stub stub stub |
| 3206 | // +-------+ +---------+ +---------+ +---------+ |
| 3207 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3208 | // +-------+ +---------+ +---------+ +---------+ |
| 3209 | // | | | | |
| 3210 | // | RESTSubReq | | | |
| 3211 | // |---------------->| | | |
| 3212 | // | | | | |
| 3213 | // | RESTSubResp | | | |
| 3214 | // |<----------------| | | |
| 3215 | // | | SubReq | | |
| 3216 | // | |---------------------------->| |
| 3217 | // | | SubResp | | |
| 3218 | // | |<----------------------------| |
| 3219 | // | RESTNotif | | | |
| 3220 | // |<----------------| | | |
| 3221 | // | | | | |
| 3222 | // | | | | |
| 3223 | // | RESTSubDelReq | | | |
| 3224 | // |---------------->| | | |
| 3225 | // | RESTSubDelResp | | | |
| 3226 | // |<----------------| | | |
| 3227 | // | | SubSelReq | | |
| 3228 | // | |---------------------------->| |
| 3229 | // | | SubSelResp | | |
| 3230 | // | |<----------------------------| |
| 3231 | // | | RouteDelete | | |
| 3232 | // | |------------->| | |
| 3233 | // | | Routedelete | | |
| 3234 | // | | status:400 | | |
| 3235 | // | |(Bad request) | | |
| 3236 | // | |<-------------| | |
| 3237 | // |
| 3238 | //----------------------------------------------------------------------------- |
| 3239 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3240 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3241 | |
| 3242 | // Init counter check |
| 3243 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3244 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3245 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3246 | Counter{cSubReqToE2, 1}, |
| 3247 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3248 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3249 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3250 | Counter{cRouteDeleteFail, 1}, |
| 3251 | Counter{cSubDelReqToE2, 1}, |
| 3252 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3253 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3254 | }) |
| 3255 | |
| 3256 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3257 | |
| 3258 | //Subs Create |
| 3259 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3260 | |
| 3261 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3262 | |
| 3263 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3264 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3265 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3266 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3267 | waiter.WaitResult(t) |
| 3268 | |
| 3269 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3270 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3271 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3272 | } |
| 3273 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3274 | //----------------------------------------------------------------------------- |
| 3275 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3276 | // |
| 3277 | // stub stub stub stub |
| 3278 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3279 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3280 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3281 | // | | | | | |
| 3282 | // | RESTSubReq1 | | | |
| 3283 | // |------------------------>| | | |
| 3284 | // | RESTSubResp2 | | | |
| 3285 | // |<------------------------| | | |
| 3286 | // | | | | | |
| 3287 | // | | | RouteCreate | | |
| 3288 | // | | |------------->| | |
| 3289 | // | | | CreateResp | | |
| 3290 | // | | |<-------------| | |
| 3291 | // | | | SubReq | | |
| 3292 | // | | |---------------------------->| |
| 3293 | // | | | SubResp | | |
| 3294 | // | | |<----------------------------| |
| 3295 | // | RESTNotif1 | | | |
| 3296 | // |<------------------------| | | |
| 3297 | // | | | | | |
| 3298 | // | | RESTSubReq2 | | | |
| 3299 | // | |------------>| | | |
| 3300 | // | | RESTSubResp2| | | |
| 3301 | // | |<------------| | | |
| 3302 | // | | | RouteCreate | | |
| 3303 | // | | |------------->| | |
| 3304 | // | | | CreateResp | | |
| 3305 | // | | |<-------------| | |
| 3306 | // | | | SubReq | | |
| 3307 | // | | |---------------------------->| |
| 3308 | // | | | SubResp | | |
| 3309 | // | | |<----------------------------| |
| 3310 | // | | RESTNotif2 | | | |
| 3311 | // | |<------------| | | |
| 3312 | // | | | | | |
| 3313 | // | [SUBS INT DELETE] | | |
| 3314 | // | | | | | |
| 3315 | // | RESTSubDelReq1 | | | |
| 3316 | // |------------------------>| | | |
| 3317 | // | RESTSubDelResp1 | | | |
| 3318 | // |<------------------------| | | |
| 3319 | // | | | SubDelReq | | |
| 3320 | // | | |---------------------------->| |
| 3321 | // | | | SubDelResp | | |
| 3322 | // | | |<----------------------------| |
| 3323 | // | | | RouteUpdate | | |
| 3324 | // | | |------------->| | |
| 3325 | // | | | RouteUpdate | | |
| 3326 | // | | | status:400 | | |
| 3327 | // | | |(Bad request) | | |
| 3328 | // | | |<-------------| | |
| 3329 | // | | | | | |
| 3330 | // | | RESTSubDelReq2 | | |
| 3331 | // | |------------>| | | |
| 3332 | // | | RESTSubDelResp2 | | |
| 3333 | // | |<------------| | | |
| 3334 | // | | | SubDelReq | | |
| 3335 | // | | |---------------------------->| |
| 3336 | // | | | SubdelResp | | |
| 3337 | // | | |<----------------------------| |
| 3338 | // | | | RouteDelete | | |
| 3339 | // | | |------------->| | |
| 3340 | // | | | Deleteresp | | |
| 3341 | // | | |<-------------| | |
| 3342 | |
| 3343 | //----------------------------------------------------------------------------- |
| 3344 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3345 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3346 | |
| 3347 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3348 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3349 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3350 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3351 | Counter{cSubReqToE2, 1}, |
| 3352 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3353 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3354 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3355 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3356 | Counter{cSubDelReqToE2, 1}, |
| 3357 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3358 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3359 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3360 | }) |
| 3361 | |
| 3362 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3363 | |
| 3364 | //Subs Create |
| 3365 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3366 | |
| 3367 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3368 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3369 | |
| 3370 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3371 | |
| 3372 | //Del1, this shall fail on rtmgr side |
| 3373 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3374 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3375 | waiter.WaitResult(t) |
| 3376 | |
| 3377 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3378 | |
| 3379 | //Del2 |
| 3380 | deleteXapp2Subscription(t, &restSubId2) |
| 3381 | |
| 3382 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3383 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3384 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3385 | } |
| 3386 | |
| 3387 | //----------------------------------------------------------------------------- |
| 3388 | // TestRESTSubReqRetransmission |
| 3389 | // |
| 3390 | // stub stub |
| 3391 | // +-------+ +---------+ +---------+ |
| 3392 | // | xapp | | submgr | | e2term | |
| 3393 | // +-------+ +---------+ +---------+ |
| 3394 | // | | | |
| 3395 | // | RESTSubReq1 | | |
| 3396 | // |---------------->| | |
| 3397 | // | | | |
| 3398 | // | RESTSubResp | | |
| 3399 | // |<----------------| | |
| 3400 | // | | SubReq1 | |
| 3401 | // | |------------->| |
| 3402 | // | | | |
| 3403 | // | RESTSubReq2 | | |
| 3404 | // | (retrans) | | |
| 3405 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3406 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3407 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3408 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3409 | // | | SubResp1 | |
| 3410 | // | |<-------------| |
| 3411 | // | RESTNotif1 | | |
| 3412 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3413 | // | | | |
| 3414 | // | [SUBS DELETE] | |
| 3415 | // | | | |
| 3416 | // |
| 3417 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3418 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3419 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3420 | |
| 3421 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3422 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3423 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3424 | Counter{cSubReqToE2, 1}, |
| 3425 | Counter{cSubRespFromE2, 1}, |
| 3426 | Counter{cRestSubNotifToXapp, 1}, |
| 3427 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3428 | Counter{cSubDelReqToE2, 1}, |
| 3429 | Counter{cSubDelRespFromE2, 1}, |
| 3430 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3431 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3432 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3433 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3434 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3435 | |
| 3436 | // Subs Create |
| 3437 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3438 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3439 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3440 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3441 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3442 | xappConn1.SendRESTSubsReq(t, params) |
| 3443 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3444 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3445 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3446 | |
| 3447 | // 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] | 3448 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3449 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3450 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3451 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3452 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3453 | |
| 3454 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3455 | |
| 3456 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3457 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3458 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3459 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3460 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3461 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3462 | |
| 3463 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3464 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3465 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3466 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3467 | //----------------------------------------------------------------------------- |
| 3468 | // stub stub stub |
| 3469 | // +-------+ +---------+ +---------+ +---------+ |
| 3470 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3471 | // +-------+ +---------+ +---------+ +---------+ |
| 3472 | // | | | | |
| 3473 | // | RESTSubReq | | | |
| 3474 | // |---------------->| | | |
| 3475 | // | RESTSubResp | | | |
| 3476 | // |<----------------| | | |
| 3477 | // | | RouteCreate | | |
| 3478 | // | |--------------------------->| |
| 3479 | // | | RouteResponse| | |
| 3480 | // | |<---------------------------| // The order of these events may vary |
| 3481 | // | | SubReq | | |
| 3482 | // | |------------->| | // The order of these events may vary |
| 3483 | // | | SubResp | | |
| 3484 | // | |<-------------| | |
| 3485 | // | RESTNotif1 | | | |
| 3486 | // |<----------------| | | |
| 3487 | // | RESTSubReq | | | |
| 3488 | // | [RETRANS1] | | | |
| 3489 | // |---------------->| | | |
| 3490 | // | RESTNotif1 | | | |
| 3491 | // |<----------------| | | |
| 3492 | // | RESTSubReq | | | |
| 3493 | // | [RETRANS2] | | | |
| 3494 | // |---------------->| | | |
| 3495 | // | RESTNotif1 | | | |
| 3496 | // |<----------------| | | |
| 3497 | // | RESTSubDelReq | | | |
| 3498 | // |---------------->| | | |
| 3499 | // | | SubDelReq | | |
| 3500 | // | |------------->| | |
| 3501 | // | RESTSubDelResp| | | |
| 3502 | // |<----------------| | | |
| 3503 | // | | SubDelResp | | |
| 3504 | // | |<-------------| | |
| 3505 | // | | | | |
| 3506 | // |
| 3507 | //----------------------------------------------------------------------------- |
| 3508 | |
| 3509 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3510 | |
| 3511 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3512 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3513 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3514 | Counter{cRestSubRespToXapp, 3}, |
| 3515 | Counter{cSubReqToE2, 1}, |
| 3516 | Counter{cSubRespFromE2, 1}, |
| 3517 | Counter{cRestSubNotifToXapp, 3}, |
| 3518 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3519 | Counter{cSubDelReqToE2, 1}, |
| 3520 | Counter{cSubDelRespFromE2, 1}, |
| 3521 | Counter{cRestSubDelRespToXapp, 1}, |
| 3522 | }) |
| 3523 | |
| 3524 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3525 | |
| 3526 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3527 | |
| 3528 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3529 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3530 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3531 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3532 | //1.st resend |
| 3533 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3534 | |
| 3535 | assert.Equal(t, restSubId_resend, 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 | //2.nd resend |
| 3540 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3541 | |
| 3542 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3543 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3544 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3545 | |
| 3546 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3547 | |
| 3548 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3549 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3550 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3551 | } |
| 3552 | |
| 3553 | //----------------------------------------------------------------------------- |
| 3554 | // stub stub stub |
| 3555 | // +-------+ +---------+ +---------+ +---------+ |
| 3556 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3557 | // +-------+ +---------+ +---------+ +---------+ |
| 3558 | // | | | | |
| 3559 | // | RESTSubReq | | | |
| 3560 | // |---------------->| | | |
| 3561 | // | RESTSubResp | | | |
| 3562 | // |<----------------| | | |
| 3563 | // | | RouteCreate | | |
| 3564 | // | |--------------------------->| |
| 3565 | // | | RouteResponse| | |
| 3566 | // | |<---------------------------| // The order of these events may vary |
| 3567 | // | | SubReq | | |
| 3568 | // | |------------->| | // The order of these events may vary |
| 3569 | // | | SubResp | | |
| 3570 | // | |<-------------| | |
| 3571 | // | RESTNotif1 | | | |
| 3572 | // |<----------------| | | |
| 3573 | // | RESTSubReq | | | |
| 3574 | // | [RETRANS, with RESTsubsId] | | |
| 3575 | // |---------------->| | | |
| 3576 | // | RESTNotif1 | | | |
| 3577 | // |<----------------| | | |
| 3578 | // | RESTSubReq | | | |
| 3579 | // | [RETRANS, without RESTsubsId] | | |
| 3580 | // |---------------->| | | |
| 3581 | // | RESTNotif1 | | | |
| 3582 | // |<----------------| | | |
| 3583 | // | RESTSubDelReq | | | |
| 3584 | // |---------------->| | | |
| 3585 | // | | SubDelReq | | |
| 3586 | // | |------------->| | |
| 3587 | // | RESTSubDelResp| | | |
| 3588 | // |<----------------| | | |
| 3589 | // | | SubDelResp | | |
| 3590 | // | |<-------------| | |
| 3591 | // | | | | |
| 3592 | // |
| 3593 | //----------------------------------------------------------------------------- |
| 3594 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3595 | |
| 3596 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3597 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3598 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3599 | Counter{cRestSubRespToXapp, 3}, |
| 3600 | Counter{cSubReqToE2, 1}, |
| 3601 | Counter{cSubRespFromE2, 1}, |
| 3602 | Counter{cRestSubNotifToXapp, 3}, |
| 3603 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3604 | Counter{cSubDelReqToE2, 1}, |
| 3605 | Counter{cSubDelRespFromE2, 1}, |
| 3606 | Counter{cRestSubDelRespToXapp, 1}, |
| 3607 | }) |
| 3608 | |
| 3609 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3610 | |
| 3611 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3612 | |
| 3613 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3614 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3615 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3616 | |
| 3617 | //1.st resend with subscription ID |
| 3618 | params.SetSubscriptionID(&restSubId) |
| 3619 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3620 | |
| 3621 | assert.Equal(t, restSubId_resend, restSubId) |
| 3622 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3623 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3624 | |
| 3625 | //2.nd resend without subscription ID (faking app restart) |
| 3626 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3627 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3628 | |
| 3629 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3630 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3631 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3632 | |
| 3633 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3634 | |
| 3635 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3636 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3637 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3638 | } |
| 3639 | |
| 3640 | //----------------------------------------------------------------------------- |
| 3641 | // stub stub stub |
| 3642 | // +-------+ +---------+ +---------+ +---------+ |
| 3643 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3644 | // +-------+ +---------+ +---------+ +---------+ |
| 3645 | // | | | | |
| 3646 | // | RESTSubReq | | | |
| 3647 | // |---------------->| | | |
| 3648 | // | RESTSubResp | | | |
| 3649 | // |<----------------| | | |
| 3650 | // | | RouteCreate | | |
| 3651 | // | |--------------------------->| |
| 3652 | // | | RouteResponse| | |
| 3653 | // | |<---------------------------| |
| 3654 | // | | SubReq | | |
| 3655 | // | |------------->| | |
| 3656 | // | | SubResp | | |
| 3657 | // | |<-------------| | |
| 3658 | // | RESTNotif1 | | | |
| 3659 | // |<----------------| | | |
| 3660 | // | RESTSubReq | | | |
| 3661 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3662 | // |---------------->| | | |
| 3663 | // | RESTNotif1 | | | |
| 3664 | // | [for initial e2 subDetail] | | |
| 3665 | // |<----------------| | | |
| 3666 | // | | RouteCreate | | |
| 3667 | // | |--------------------------->| |
| 3668 | // | | RouteResponse| | |
| 3669 | // | |<---------------------------| |
| 3670 | // | | SubReq | | |
| 3671 | // | |------------->| | |
| 3672 | // | | SubResp | | |
| 3673 | // | |<-------------| | |
| 3674 | // | RESTNotif1 | | | |
| 3675 | // |<----------------| | | |
| 3676 | // | RESTSubReq | | | |
| 3677 | // | [with RESTsubsId initial request] | |
| 3678 | // |---------------->| | | |
| 3679 | // | RESTNotif1 | | | |
| 3680 | // |<----------------| | | |
| 3681 | // | RESTSubDelReq | | | |
| 3682 | // |---------------->| | | |
| 3683 | // | RESTSubDelResp| | | |
| 3684 | // |<----------------| | | |
| 3685 | // | | SubDelReq | | |
| 3686 | // | |------------->| | |
| 3687 | // | | SubDelResp | | |
| 3688 | // | |<-------------| | |
| 3689 | // | | SubDelReq | | |
| 3690 | // | |------------->| | |
| 3691 | // | | SubDelResp | | |
| 3692 | // | |<-------------| | |
| 3693 | // | | | | |
| 3694 | // |
| 3695 | //----------------------------------------------------------------------------- |
| 3696 | |
| 3697 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3698 | |
| 3699 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3700 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3701 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3702 | Counter{cRestSubRespToXapp, 3}, |
| 3703 | Counter{cSubReqToE2, 2}, |
| 3704 | Counter{cSubRespFromE2, 2}, |
| 3705 | Counter{cRestSubNotifToXapp, 4}, |
| 3706 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3707 | Counter{cSubDelReqToE2, 2}, |
| 3708 | Counter{cSubDelRespFromE2, 2}, |
| 3709 | Counter{cRestSubDelRespToXapp, 1}, |
| 3710 | }) |
| 3711 | |
| 3712 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3713 | |
| 3714 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3715 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3716 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3717 | |
| 3718 | // Send modified requst, this time with e2 subscriptions. |
| 3719 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3720 | params2.SetSubscriptionID(&restSubId) |
| 3721 | |
| 3722 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3723 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3724 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3725 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3726 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3727 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3728 | |
| 3729 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3730 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3731 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3732 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3733 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3734 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3735 | assert.NotEqual(t, e2SubsId2, 0) |
| 3736 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3737 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3738 | |
| 3739 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3740 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3741 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3742 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3743 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3744 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3745 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3746 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3747 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3748 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3749 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3750 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3751 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3752 | // Delete both e2 subscriptions |
| 3753 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3754 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3755 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3756 | |
| 3757 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3758 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3759 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3760 | } |
| 3761 | |
| 3762 | //----------------------------------------------------------------------------- |
| 3763 | // stub stub stub |
| 3764 | // +-------+ +---------+ +---------+ +---------+ |
| 3765 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3766 | // +-------+ +---------+ +---------+ +---------+ |
| 3767 | // | | | | |
| 3768 | // | RESTSubReq | | | |
| 3769 | // |---------------->| | | |
| 3770 | // | RESTSubResp | | | |
| 3771 | // |<----------------| | | |
| 3772 | // | | RouteCreate | | |
| 3773 | // | |--------------------------->| |
| 3774 | // | | RouteResponse| | |
| 3775 | // | |<---------------------------| |
| 3776 | // | | SubReq | | |
| 3777 | // | |------------->| | |
| 3778 | // | | SubResp | | |
| 3779 | // | |<-------------| | |
| 3780 | // | RESTNotif1 | | | |
| 3781 | // |<----------------| | | |
| 3782 | // | RESTSubReq | | | |
| 3783 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3784 | // |---------------->| | | |
| 3785 | // | RESTNotif1 | | | |
| 3786 | // | [for initial e2 subDetail] | | |
| 3787 | // |<----------------| | | |
| 3788 | // | | RouteCreate | | |
| 3789 | // | |--------------------------->| |
| 3790 | // | | RouteResponse| | |
| 3791 | // | |<---------------------------| |
| 3792 | // | | SubReq | | |
| 3793 | // | |------------->| | |
| 3794 | // | | SubResp | | |
| 3795 | // | |<-------------| | |
| 3796 | // | RESTNotif1 | | | |
| 3797 | // |<----------------| | | |
| 3798 | // | RESTSubReq | | | |
| 3799 | // | [without RESTsubsId initial request] | |
| 3800 | // |---------------->| | | |
| 3801 | // | RESTNotif1 | | | |
| 3802 | // |<----------------| | | |
| 3803 | // | RESTSubDelReq | | | |
| 3804 | // |---------------->| | | |
| 3805 | // | RESTSubDelResp| | | |
| 3806 | // |<----------------| | | |
| 3807 | // | | SubDelReq | | |
| 3808 | // | |------------->| | |
| 3809 | // | | SubDelResp | | |
| 3810 | // | |<-------------| | |
| 3811 | // | | SubDelReq | | |
| 3812 | // | |------------->| | |
| 3813 | // | | SubDelResp | | |
| 3814 | // | |<-------------| | |
| 3815 | // | | | | |
| 3816 | // |
| 3817 | //----------------------------------------------------------------------------- |
| 3818 | |
| 3819 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3820 | |
| 3821 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3822 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3823 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3824 | Counter{cRestSubRespToXapp, 3}, |
| 3825 | Counter{cSubReqToE2, 2}, |
| 3826 | Counter{cSubRespFromE2, 2}, |
| 3827 | Counter{cRestSubNotifToXapp, 4}, |
| 3828 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3829 | Counter{cSubDelReqToE2, 2}, |
| 3830 | Counter{cSubDelRespFromE2, 2}, |
| 3831 | Counter{cRestSubDelRespToXapp, 1}, |
| 3832 | }) |
| 3833 | |
| 3834 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3835 | |
| 3836 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3837 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3838 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3839 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3840 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3841 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3842 | params2.SetSubscriptionID(&restSubId) |
| 3843 | |
| 3844 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3845 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3846 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3847 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3848 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3849 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3850 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3851 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3852 | xappConn1.DecrementRequestCount() |
| 3853 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3854 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3855 | |
| 3856 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3857 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3858 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3859 | assert.NotEqual(t, e2SubsId2, 0) |
| 3860 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3861 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3862 | |
| 3863 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3864 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3865 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3866 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3867 | // md5sum shall find the original request |
| 3868 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3869 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3870 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3871 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3872 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3873 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3874 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3875 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3876 | // Delete both e2 subscriptions |
| 3877 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3878 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3879 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3880 | |
| 3881 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3882 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3883 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3884 | } |
| 3885 | |
| 3886 | //----------------------------------------------------------------------------- |
| 3887 | // stub stub stub |
| 3888 | // +-------+ +---------+ +---------+ +---------+ |
| 3889 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3890 | // +-------+ +---------+ +---------+ +---------+ |
| 3891 | // | | | | |
| 3892 | // | RESTSubReq | | | |
| 3893 | // |---------------->| | | |
| 3894 | // | RESTSubResp | | | |
| 3895 | // |<----------------| | | |
| 3896 | // | | RouteCreate | | |
| 3897 | // | |--------------------------->| |
| 3898 | // | | RouteResponse| | |
| 3899 | // | |<---------------------------| |
| 3900 | // | | SubReq | | |
| 3901 | // | |------------->| | |
| 3902 | // | | SubResp | | |
| 3903 | // | |<-------------| | |
| 3904 | // | RESTNotif1 | | | |
| 3905 | // |<----------------| | | |
| 3906 | // | RESTSubReq | | | |
| 3907 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3908 | // |---------------->| | | |
| 3909 | // | RESTNotif1 | | | |
| 3910 | // | [for initial e2 subDetail] | | |
| 3911 | // |<----------------| | | |
| 3912 | // | | RouteCreate | | |
| 3913 | // | |--------------------------->| |
| 3914 | // | | RouteResponse| | |
| 3915 | // | |<---------------------------| |
| 3916 | // | | SubReq | | |
| 3917 | // | |------------->| | |
| 3918 | // | | SubResp | | |
| 3919 | // | |<-------------| | |
| 3920 | // | RESTNotif1 | | | |
| 3921 | // |<----------------| | | |
| 3922 | // | RESTSubDelReq | | | |
| 3923 | // |---------------->| | | |
| 3924 | // | RESTSubDelResp| | | |
| 3925 | // |<----------------| | | |
| 3926 | // | | SubDelReq | | |
| 3927 | // | |------------->| | |
| 3928 | // | | SubDelResp | | |
| 3929 | // | |<-------------| | |
| 3930 | // | | SubDelReq | | |
| 3931 | // | |------------->| | |
| 3932 | // | | SubDelResp | | |
| 3933 | // | |<-------------| | |
| 3934 | // | RESTSubReq | | | |
| 3935 | // | [with RESTsubsId initial request] | |
| 3936 | // |---------------->| | | |
| 3937 | // | RESTSubResp | | | |
| 3938 | // |<----------------| | | |
| 3939 | // | | RouteCreate | | |
| 3940 | // | |--------------------------->| |
| 3941 | // | | RouteResponse| | |
| 3942 | // | |<---------------------------| |
| 3943 | // | | SubReq | | |
| 3944 | // | |------------->| | |
| 3945 | // | | SubResp | | |
| 3946 | // | |<-------------| | |
| 3947 | // | RESTNotif1 | | | |
| 3948 | // |<----------------| | | |
| 3949 | // | | | | |
| 3950 | // |
| 3951 | //----------------------------------------------------------------------------- |
| 3952 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3953 | |
| 3954 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3955 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3956 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3957 | Counter{cRestSubRespToXapp, 3}, |
| 3958 | Counter{cSubReqToE2, 3}, |
| 3959 | Counter{cSubRespFromE2, 3}, |
| 3960 | Counter{cRestSubNotifToXapp, 4}, |
| 3961 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3962 | Counter{cSubDelReqToE2, 3}, |
| 3963 | Counter{cSubDelRespFromE2, 3}, |
| 3964 | Counter{cRestSubDelRespToXapp, 2}, |
| 3965 | }) |
| 3966 | |
| 3967 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3968 | |
| 3969 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3970 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3971 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3972 | |
| 3973 | // Send modified requst, this time with e2 subscriptions. |
| 3974 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3975 | params2.SetSubscriptionID(&restSubId) |
| 3976 | |
| 3977 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3978 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3979 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3980 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3981 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3982 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3983 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3984 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3985 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3986 | |
| 3987 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3988 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3989 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3990 | assert.NotEqual(t, e2SubsId2, 0) |
| 3991 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3992 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3993 | |
| 3994 | // Delete both e2 subscriptions |
| 3995 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3996 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3997 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3998 | |
| 3999 | waitSubsCleanup(t, e2SubsId, 10) |
| 4000 | |
| 4001 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 4002 | // but the restsubscription has been already removed. This shall trigger a |
| 4003 | // fresh create. |
| 4004 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4005 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4006 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4007 | |
| 4008 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4009 | |
| 4010 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4011 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4012 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4013 | } |
| 4014 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4015 | //----------------------------------------------------------------------------- |
| 4016 | // TestRESTSubDelReqRetransmission |
| 4017 | // |
| 4018 | // stub stub |
| 4019 | // +-------+ +---------+ +---------+ |
| 4020 | // | xapp | | submgr | | e2term | |
| 4021 | // +-------+ +---------+ +---------+ |
| 4022 | // | | | |
| 4023 | // | RESTSubReq | | |
| 4024 | // |---------------->| | |
| 4025 | // | | | |
| 4026 | // | RESTSubResp | | |
| 4027 | // |<----------------| | |
| 4028 | // | | SubReq | |
| 4029 | // | |------------->| |
| 4030 | // | | SubResp | |
| 4031 | // | |<-------------| |
| 4032 | // | RESTNotif1 | | |
| 4033 | // |<----------------| | |
| 4034 | // | | | |
| 4035 | // | RESTSubDelReq | | |
| 4036 | // |---------------->| | |
| 4037 | // | RESTSubDelResp | | |
| 4038 | // |<----------------| | |
| 4039 | // | | SubDelReq | |
| 4040 | // | |------------->| |
| 4041 | // | RESTSubDelReq | | |
| 4042 | // |---------------->| | |
| 4043 | // | RESTSubDelResp | | |
| 4044 | // |<----------------| | |
| 4045 | // | | SubDelResp | |
| 4046 | // | |<-------------| |
| 4047 | // | | | |
| 4048 | // |
| 4049 | //----------------------------------------------------------------------------- |
| 4050 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4051 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | |
| 4053 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4054 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4055 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4056 | Counter{cSubReqToE2, 1}, |
| 4057 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4058 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4059 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4060 | Counter{cSubDelReqToE2, 1}, |
| 4061 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4062 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4063 | }) |
| 4064 | |
| 4065 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4066 | |
| 4067 | //Subs Create |
| 4068 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4069 | |
| 4070 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4071 | |
| 4072 | //Subs Delete |
| 4073 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4074 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4075 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4076 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4077 | seqBef := mainCtrl.get_msgcounter(t) |
| 4078 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4079 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 4080 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4081 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4082 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4083 | |
| 4084 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4085 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4086 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4087 | } |
| 4088 | |
| 4089 | //----------------------------------------------------------------------------- |
| 4090 | // TestRESTSubReqDelReq |
| 4091 | // |
| 4092 | // stub stub |
| 4093 | // +-------+ +---------+ +---------+ |
| 4094 | // | xapp | | submgr | | e2term | |
| 4095 | // +-------+ +---------+ +---------+ |
| 4096 | // | | | |
| 4097 | // | RESTSubReq | | |
| 4098 | // |---------------->| | |
| 4099 | // | | | |
| 4100 | // | RESTSubResp | | |
| 4101 | // |<----------------| | |
| 4102 | // | | SubReq | |
| 4103 | // | |------------->| |
| 4104 | // | RESTSubDelReq | | |
| 4105 | // |---------------->| | |
| 4106 | // | RESTSubDelResp | | |
| 4107 | // | unsuccess | | |
| 4108 | // |<----------------| | |
| 4109 | // | | SubResp | |
| 4110 | // | |<-------------| |
| 4111 | // | RESTNotif1 | | |
| 4112 | // |<----------------| | |
| 4113 | // | | | |
| 4114 | // | [SUBS DELETE] | |
| 4115 | // | | | |
| 4116 | // |
| 4117 | //----------------------------------------------------------------------------- |
| 4118 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4119 | |
| 4120 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4121 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4122 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4123 | Counter{cSubReqToE2, 1}, |
| 4124 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4125 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4126 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4127 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4128 | Counter{cSubDelReqToE2, 1}, |
| 4129 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4130 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4131 | }) |
| 4132 | |
| 4133 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4134 | |
| 4135 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4136 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4137 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4138 | |
| 4139 | // Del. This will fail as processing of the subscription |
| 4140 | // is still ongoing in submgr. Deletion is not allowed before |
| 4141 | // subscription creation has been completed. |
| 4142 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4143 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4144 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4145 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4146 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4147 | |
| 4148 | // Retry del |
| 4149 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4150 | |
| 4151 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4152 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4153 | |
| 4154 | // Wait that subs is cleaned |
| 4155 | waitSubsCleanup(t, e2SubsId, 10) |
| 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 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4162 | // |
| 4163 | // stub stub stub |
| 4164 | // +-------+ +-------+ +---------+ +---------+ |
| 4165 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4166 | // +-------+ +-------+ +---------+ +---------+ |
| 4167 | // | | | | |
| 4168 | // | | RESTSubReq1 | | |
| 4169 | // | |------------->| | |
| 4170 | // | | RESTSubResp1 | | |
| 4171 | // | |<-------------| | |
| 4172 | // | | | | |
| 4173 | // | | | SubReq1 | |
| 4174 | // | | |------------->| |
| 4175 | // | | | | |
| 4176 | // | RESTSubReq2 | | |
| 4177 | // |------------------------>| | |
| 4178 | // | RESTSubResp2 | | |
| 4179 | // |<------------------------| | |
| 4180 | // | | | | |
| 4181 | // | | | SubReq2 | |
| 4182 | // | | |------------->| |
| 4183 | // | | | | |
| 4184 | // | | | SubResp1 | |
| 4185 | // | | |<-------------| |
| 4186 | // | | RESTNotif1 | | |
| 4187 | // | |<-------------| | |
| 4188 | // | | | | |
| 4189 | // | | | SubResp2 | |
| 4190 | // | | |<-------------| |
| 4191 | // | RESTNotif2 | | |
| 4192 | // |<------------------------| | |
| 4193 | // | | | | |
| 4194 | // | | [SUBS 1 DELETE] | |
| 4195 | // | | | | |
| 4196 | // | | [SUBS 2 DELETE] | |
| 4197 | // | | | | |
| 4198 | // |
| 4199 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4200 | |
| 4201 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4202 | |
| 4203 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4204 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4205 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4206 | Counter{cSubReqToE2, 2}, |
| 4207 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4208 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4209 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4210 | Counter{cSubDelReqToE2, 2}, |
| 4211 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4212 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4213 | }) |
| 4214 | |
| 4215 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4216 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4217 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4218 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4219 | |
| 4220 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4221 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4222 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4223 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4224 | |
| 4225 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4226 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4227 | |
| 4228 | //XappConn1 receives both of the responses |
| 4229 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4230 | |
| 4231 | //Resp1 |
| 4232 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4233 | //Resp2 |
| 4234 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4235 | |
| 4236 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4237 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4238 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4239 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4240 | |
| 4241 | //Del1 |
| 4242 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4243 | //Del2 |
| 4244 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4245 | |
| 4246 | //Wait that subs is cleaned |
| 4247 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4248 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4249 | |
| 4250 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4251 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4252 | } |
| 4253 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4254 | //----------------------------------------------------------------------------- |
| 4255 | // TestRESTSameSubsDiffRan |
| 4256 | // Same subscription to different RANs |
| 4257 | // |
| 4258 | // stub stub |
| 4259 | // +-------+ +---------+ +---------+ |
| 4260 | // | xapp | | submgr | | e2term | |
| 4261 | // +-------+ +---------+ +---------+ |
| 4262 | // | | | |
| 4263 | // | RESTSubReq(r1) | | |
| 4264 | // |---------------->| | |
| 4265 | // | RESTSubResp(r1) | | |
| 4266 | // |<----------------| | |
| 4267 | // | | | |
| 4268 | // | | SubReq(r1) | |
| 4269 | // | |------------->| |
| 4270 | // | | | |
| 4271 | // | | SubResp(r1) | |
| 4272 | // | |<-------------| |
| 4273 | // | | | |
| 4274 | // | RESTNotif(r1) | | |
| 4275 | // |<----------------| | |
| 4276 | // | | | |
| 4277 | // | RESTSubReq(r2) | | |
| 4278 | // |---------------->| | |
| 4279 | // | | | |
| 4280 | // | RESTSubResp(r2) | | |
| 4281 | // |<----------------| | |
| 4282 | // | | SubReq(r2) | |
| 4283 | // | |------------->| |
| 4284 | // | | | |
| 4285 | // | | SubResp(r2) | |
| 4286 | // | |<-------------| |
| 4287 | // | | | |
| 4288 | // | RESTNotif(r2) | | |
| 4289 | // |<----------------| | |
| 4290 | // | | | |
| 4291 | // | [SUBS r1 DELETE] | |
| 4292 | // | | | |
| 4293 | // | [SUBS r2 DELETE] | |
| 4294 | // | | | |
| 4295 | // |
| 4296 | //----------------------------------------------------------------------------- |
| 4297 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4298 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4299 | |
| 4300 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4301 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4302 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4303 | Counter{cSubReqToE2, 2}, |
| 4304 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4305 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4306 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4307 | Counter{cSubDelReqToE2, 2}, |
| 4308 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4309 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4310 | }) |
| 4311 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4312 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4313 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4314 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4315 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4316 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4317 | params.SetMeid("RAN_NAME_2") |
| 4318 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4319 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4320 | |
| 4321 | //Del1 |
| 4322 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4323 | //Del2 |
| 4324 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4325 | |
| 4326 | //Wait that subs is cleaned |
| 4327 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4328 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4329 | |
| 4330 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4331 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4332 | } |
| 4333 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4334 | //----------------------------------------------------------------------------- |
| 4335 | // TestRESTSubReqRetryInSubmgr |
| 4336 | // |
| 4337 | // stub stub |
| 4338 | // +-------+ +---------+ +---------+ |
| 4339 | // | xapp | | submgr | | e2term | |
| 4340 | // +-------+ +---------+ +---------+ |
| 4341 | // | | | |
| 4342 | // | RESTSubReq | | |
| 4343 | // |---------------->| | |
| 4344 | // | RESTSubResp | | |
| 4345 | // |<----------------| | |
| 4346 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 4347 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4348 | // | | | |
| 4349 | // | | | |
| 4350 | // | | SubReq | |
| 4351 | // | |------------->| |
| 4352 | // | | SubResp | |
| 4353 | // | |<-------------| |
| 4354 | // | | | |
| 4355 | // | RESTNotif | | |
| 4356 | // |<----------------| | |
| 4357 | // | | | |
| 4358 | // | [SUBS DELETE] | |
| 4359 | // | | | |
| 4360 | // |
| 4361 | //----------------------------------------------------------------------------- |
| 4362 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4363 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4364 | |
| 4365 | // Init counter check |
| 4366 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4367 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4368 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4369 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4370 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4371 | Counter{cSubReReqToE2, 1}, |
| 4372 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4373 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4374 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4375 | Counter{cSubDelReqToE2, 1}, |
| 4376 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4377 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4378 | }) |
| 4379 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4380 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4381 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4382 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4383 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4384 | |
| 4385 | // Catch the first message and ignore it |
| 4386 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4387 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4388 | |
| 4389 | // The second request is being handled normally |
| 4390 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4391 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4392 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4393 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4394 | |
| 4395 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4396 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4397 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4398 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4399 | |
| 4400 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4401 | //Wait that subs is cleaned |
| 4402 | waitSubsCleanup(t, e2SubsId, 10) |
| 4403 | |
| 4404 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4405 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4406 | } |
| 4407 | |
| 4408 | //----------------------------------------------------------------------------- |
| 4409 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4410 | // |
| 4411 | // stub stub |
| 4412 | // +-------+ +---------+ +---------+ |
| 4413 | // | xapp | | submgr | | e2term | |
| 4414 | // +-------+ +---------+ +---------+ |
| 4415 | // | | | |
| 4416 | // | RESTSubReq | | |
| 4417 | // |---------------->| | |
| 4418 | // | | | |
| 4419 | // | RESTSubResp | | |
| 4420 | // |<----------------| | |
| 4421 | // | | SubReq | |
| 4422 | // | |------------->| |
| 4423 | // | | | |
| 4424 | // | | | |
| 4425 | // | | SubReq | |
| 4426 | // | |------------->| |
| 4427 | // | | | |
| 4428 | // | | SubDelReq | |
| 4429 | // | |------------->| |
| 4430 | // | | | |
| 4431 | // | | | |
| 4432 | // | | SubDelReq | |
| 4433 | // | |------------->| |
| 4434 | // | | | |
| 4435 | // | | | |
| 4436 | // | | SubDelResp | |
| 4437 | // | |<-------------| |
| 4438 | // | RESTNotif | | |
| 4439 | // | unsuccess | | |
| 4440 | // |<----------------| | |
| 4441 | // | | | |
| 4442 | // | [SUBS DELETE] | |
| 4443 | // | | | |
| 4444 | // |
| 4445 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4446 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4447 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4448 | |
| 4449 | // Init counter check |
| 4450 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4451 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4452 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4453 | Counter{cSubReqToE2, 1}, |
| 4454 | Counter{cSubReReqToE2, 1}, |
| 4455 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4456 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4457 | Counter{cSubDelReqToE2, 1}, |
| 4458 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4459 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4460 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4461 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4462 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4463 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4464 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4465 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4466 | |
| 4467 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4468 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4469 | |
| 4470 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4471 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4472 | |
| 4473 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4474 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4475 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4476 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4477 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4478 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4479 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4480 | // Wait that subs is cleaned |
| 4481 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4482 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4483 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4484 | } |
| 4485 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4486 | //----------------------------------------------------------------------------- |
| 4487 | // TestREST2eTermNotRespondingToSubReq |
| 4488 | // |
| 4489 | // stub stub |
| 4490 | // +-------+ +---------+ +---------+ |
| 4491 | // | xapp | | submgr | | e2term | |
| 4492 | // +-------+ +---------+ +---------+ |
| 4493 | // | | | |
| 4494 | // | RESTSubReq | | |
| 4495 | // |---------------->| | |
| 4496 | // | RESTSubResp | | |
| 4497 | // |<----------------| | |
| 4498 | // | | SubReq | |
| 4499 | // | |------------->| |
| 4500 | // | | | |
| 4501 | // | | SubReq | |
| 4502 | // | |------------->| |
| 4503 | // | | | |
| 4504 | // | | SubDelReq | |
| 4505 | // | |------------->| |
| 4506 | // | | | |
| 4507 | // | | SubDelReq | |
| 4508 | // | |------------->| |
| 4509 | // | RESTNotif(Unsuccessful) | |
| 4510 | // |<----------------| | |
| 4511 | // | | | |
| 4512 | // | RESTSubDelReq | | |
| 4513 | // |---------------->| | |
| 4514 | // | RESTSubDelResp | | |
| 4515 | // |<----------------| | |
| 4516 | // | | | |
| 4517 | // |
| 4518 | //----------------------------------------------------------------------------- |
| 4519 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4520 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4521 | |
| 4522 | // Init counter check |
| 4523 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4524 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4525 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4526 | Counter{cSubReqToE2, 1}, |
| 4527 | Counter{cSubReReqToE2, 1}, |
| 4528 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4529 | Counter{cSubDelReReqToE2, 1}, |
| 4530 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4531 | Counter{cSubDelReqToE2, 1}, |
| 4532 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4533 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4534 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4535 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4536 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4537 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4538 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4539 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | |
| 4541 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4542 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | |
| 4544 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4545 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4546 | |
| 4547 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4548 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4550 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4551 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4552 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4553 | |
| 4554 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4555 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4556 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4557 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4558 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4560 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4561 | } |
| 4562 | |
| 4563 | //----------------------------------------------------------------------------- |
| 4564 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4565 | // |
| 4566 | // stub stub |
| 4567 | // +-------+ +---------+ +---------+ |
| 4568 | // | xapp | | submgr | | e2term | |
| 4569 | // +-------+ +---------+ +---------+ |
| 4570 | // | | | |
| 4571 | // | RESTSubReq | | |
| 4572 | // |---------------->| | |
| 4573 | // | | | |
| 4574 | // | RESTSubResp | | |
| 4575 | // |<----------------| | |
| 4576 | // | | SubReq | |
| 4577 | // | |------------->| |
| 4578 | // | | | |
| 4579 | // | | | |
| 4580 | // | | SubReq | |
| 4581 | // | |------------->| |
| 4582 | // | | | |
| 4583 | // | | SubDelReq | |
| 4584 | // | |------------->| |
| 4585 | // | | | |
| 4586 | // | | | |
| 4587 | // | | SubDelReq | |
| 4588 | // | |------------->| |
| 4589 | // | | | |
| 4590 | // | | | |
| 4591 | // | | SubDelResp | |
| 4592 | // | |<-------------| |
| 4593 | // | RESTNotif | | |
| 4594 | // | unsuccess | | |
| 4595 | // |<----------------| | |
| 4596 | // | | | |
| 4597 | // | [SUBS DELETE] | |
| 4598 | // | | | |
| 4599 | // |
| 4600 | //----------------------------------------------------------------------------- |
| 4601 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | |
| 4603 | // Init counter check |
| 4604 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4605 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4606 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4607 | Counter{cSubReqToE2, 1}, |
| 4608 | Counter{cSubReReqToE2, 1}, |
| 4609 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4610 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4611 | Counter{cSubDelReqToE2, 1}, |
| 4612 | Counter{cSubDelReReqToE2, 1}, |
| 4613 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4614 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4615 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4616 | }) |
| 4617 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4618 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4619 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4620 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4621 | |
| 4622 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4623 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4624 | |
| 4625 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4626 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4627 | |
| 4628 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4629 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4630 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4631 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4632 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4633 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4634 | |
| 4635 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4636 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4637 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4638 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4639 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4640 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4641 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4642 | } |
| 4643 | |
| 4644 | //----------------------------------------------------------------------------- |
| 4645 | // TestRESTSubReqSubFailRespInSubmgr |
| 4646 | // |
| 4647 | // stub stub |
| 4648 | // +-------+ +---------+ +---------+ |
| 4649 | // | xapp | | submgr | | e2term | |
| 4650 | // +-------+ +---------+ +---------+ |
| 4651 | // | | | |
| 4652 | // | RESTSubReq | | |
| 4653 | // |---------------->| | |
| 4654 | // | | | |
| 4655 | // | RESTSubResp | | |
| 4656 | // |<----------------| | |
| 4657 | // | | SubReq | |
| 4658 | // | |------------->| |
| 4659 | // | | | |
| 4660 | // | | SubFail | |
| 4661 | // | |<-------------| |
| 4662 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4663 | // | RESTNotif | | |
| 4664 | // | unsuccess | | |
| 4665 | // |<----------------| | |
| 4666 | // | | | |
| 4667 | // | [SUBS DELETE] | |
| 4668 | // | | | |
| 4669 | // |
| 4670 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4671 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4672 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4673 | |
| 4674 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4675 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4676 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4677 | Counter{cSubReqToE2, 1}, |
| 4678 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4679 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4680 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4681 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4682 | }) |
| 4683 | |
| 4684 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4685 | const e2Timeout int64 = 2 |
| 4686 | const e2RetryCount int64 = 1 |
| 4687 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4688 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4689 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4690 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4691 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4692 | |
| 4693 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4694 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4695 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4696 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4697 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4698 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4699 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4700 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4701 | |
| 4702 | // REST subscription sill there to be deleted |
| 4703 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4704 | |
| 4705 | // Wait that subs is cleaned |
| 4706 | waitSubsCleanup(t, e2SubsId, 10) |
| 4707 | |
| 4708 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4709 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4710 | } |
| 4711 | |
| 4712 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 4713 | // TestRESTSubReqPartialResp |
| 4714 | // |
| 4715 | // stub stub |
| 4716 | // +-------+ +---------+ +---------+ |
| 4717 | // | xapp | | submgr | | e2term | |
| 4718 | // +-------+ +---------+ +---------+ |
| 4719 | // | | | |
| 4720 | // | RESTSubReq | | |
| 4721 | // |---------------->| | |
| 4722 | // | RESTSubResp | | |
| 4723 | // |<----------------| | |
| 4724 | // | | SubReq | |
| 4725 | // | |------------->| |
| 4726 | // | | SubResp | Partially accepted |
| 4727 | // | |<-------------| |
| 4728 | // | | | |
| 4729 | // | RESTNotif | | |
| 4730 | // |<----------------| | |
| 4731 | // | | | |
| 4732 | // | [SUBS DELETE] | |
| 4733 | // | | | |
| 4734 | // |
| 4735 | //----------------------------------------------------------------------------- |
| 4736 | |
| 4737 | func TestRESTSubReqPartialResp(t *testing.T) { |
| 4738 | |
| 4739 | // Init counter check |
| 4740 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4741 | Counter{cRestSubReqFromXapp, 1}, |
| 4742 | Counter{cRestSubRespToXapp, 1}, |
| 4743 | Counter{cSubReqToE2, 1}, |
| 4744 | Counter{cSubRespFromE2, 1}, |
| 4745 | Counter{cPartialSubRespFromE2, 1}, |
| 4746 | Counter{cRestSubNotifToXapp, 1}, |
| 4747 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4748 | Counter{cSubDelReqToE2, 1}, |
| 4749 | Counter{cSubDelRespFromE2, 1}, |
| 4750 | Counter{cRestSubDelRespToXapp, 1}, |
| 4751 | }) |
| 4752 | |
| 4753 | // Req |
| 4754 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4755 | |
| 4756 | actionId := int64(2) |
| 4757 | actionType := "report" |
| 4758 | actionDefinition := []int64{5678, 1} |
| 4759 | subsequestActionType := "continue" |
| 4760 | timeToWait := "w10ms" |
| 4761 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4762 | |
| 4763 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4764 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4765 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4766 | |
| 4767 | actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} |
| 4768 | actionNotAdmittedItem.ActionId = 1 |
| 4769 | actionNotAdmittedItem.Cause.Content = 1 |
| 4770 | actionNotAdmittedItem.Cause.Value = 8 |
| 4771 | actionNotAdmittedList := e2ap.ActionNotAdmittedList{} |
| 4772 | actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) |
| 4773 | e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) |
| 4774 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4775 | |
| 4776 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4777 | |
| 4778 | // Del |
| 4779 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4780 | |
| 4781 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4782 | //Wait that subs is cleaned |
| 4783 | waitSubsCleanup(t, e2SubsId, 10) |
| 4784 | |
| 4785 | mainCtrl.VerifyCounterValues(t) |
| 4786 | mainCtrl.VerifyAllClean(t) |
| 4787 | } |
| 4788 | |
| 4789 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4790 | // TestRESTSubDelReqRetryInSubmgr |
| 4791 | // |
| 4792 | // stub stub |
| 4793 | // +-------+ +---------+ +---------+ |
| 4794 | // | xapp | | submgr | | e2term | |
| 4795 | // +-------+ +---------+ +---------+ |
| 4796 | // | | | |
| 4797 | // | [SUBS CREATE] | |
| 4798 | // | | | |
| 4799 | // | | | |
| 4800 | // | RESTSubDelReq | | |
| 4801 | // |---------------->| | |
| 4802 | // | | | |
| 4803 | // | RESTSubDelResp | | |
| 4804 | // |<----------------| | |
| 4805 | // | | SubDelReq | |
| 4806 | // | |------------->| |
| 4807 | // | | | |
| 4808 | // | | SubDelReq | |
| 4809 | // | |------------->| |
| 4810 | // | | | |
| 4811 | // | | SubDelResp | |
| 4812 | // | |<-------------| |
| 4813 | // | | | |
| 4814 | // |
| 4815 | //----------------------------------------------------------------------------- |
| 4816 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4817 | |
| 4818 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4819 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4820 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4821 | Counter{cSubReqToE2, 1}, |
| 4822 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4823 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4824 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4825 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4826 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4827 | Counter{cSubDelReReqToE2, 1}, |
| 4828 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4829 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4830 | }) |
| 4831 | // Req |
| 4832 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4833 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4834 | |
| 4835 | // Del |
| 4836 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4837 | |
| 4838 | // E2t: Receive 1st SubsDelReq |
| 4839 | e2termConn1.RecvSubsDelReq(t) |
| 4840 | |
| 4841 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4842 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4843 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4844 | |
| 4845 | //Wait that subs is cleaned |
| 4846 | waitSubsCleanup(t, e2SubsId, 10) |
| 4847 | |
| 4848 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4849 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4850 | } |
| 4851 | |
| 4852 | //----------------------------------------------------------------------------- |
| 4853 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4854 | // |
| 4855 | // stub stub |
| 4856 | // +-------+ +---------+ +---------+ |
| 4857 | // | xapp | | submgr | | e2term | |
| 4858 | // +-------+ +---------+ +---------+ |
| 4859 | // | | | |
| 4860 | // | [SUBS CREATE] | |
| 4861 | // | | | |
| 4862 | // | | | |
| 4863 | // | RESTSubDelReq | | |
| 4864 | // |---------------->| | |
| 4865 | // | | | |
| 4866 | // | RESTSubDelResp | | |
| 4867 | // |<----------------| | |
| 4868 | // | | SubDelReq | |
| 4869 | // | |------------->| |
| 4870 | // | | | |
| 4871 | // | | SubDelReq | |
| 4872 | // | |------------->| |
| 4873 | // | | | |
| 4874 | // | | | |
| 4875 | // |
| 4876 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4877 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4878 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4879 | |
| 4880 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4881 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4882 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4883 | Counter{cSubReqToE2, 1}, |
| 4884 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4885 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4886 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4887 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4888 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4889 | Counter{cSubDelReReqToE2, 1}, |
| 4890 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4891 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4892 | }) |
| 4893 | |
| 4894 | // Req |
| 4895 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4896 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4897 | |
| 4898 | // Del |
| 4899 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4900 | |
| 4901 | // E2t: Receive 1st SubsDelReq |
| 4902 | e2termConn1.RecvSubsDelReq(t) |
| 4903 | |
| 4904 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4905 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4906 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4907 | |
| 4908 | //Wait that subs is cleaned |
| 4909 | waitSubsCleanup(t, e2SubsId, 10) |
| 4910 | |
| 4911 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4912 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4913 | } |
| 4914 | |
| 4915 | //----------------------------------------------------------------------------- |
| 4916 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4917 | // |
| 4918 | // stub stub |
| 4919 | // +-------+ +---------+ +---------+ |
| 4920 | // | xapp | | submgr | | e2term | |
| 4921 | // +-------+ +---------+ +---------+ |
| 4922 | // | | | |
| 4923 | // | [SUBS CREATE] | |
| 4924 | // | | | |
| 4925 | // | | | |
| 4926 | // | RESTSubDelReq | | |
| 4927 | // |---------------->| | |
| 4928 | // | | | |
| 4929 | // | RESTSubDelResp | | |
| 4930 | // |<----------------| | |
| 4931 | // | | SubDelReq | |
| 4932 | // | |------------->| |
| 4933 | // | | | |
| 4934 | // | | SubDelFail | |
| 4935 | // | |<-------------| |
| 4936 | // | | | |
| 4937 | // |
| 4938 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4939 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4940 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4941 | |
| 4942 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4943 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4944 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4945 | Counter{cSubReqToE2, 1}, |
| 4946 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4947 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4948 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4949 | Counter{cSubDelReqToE2, 1}, |
| 4950 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4951 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4952 | }) |
| 4953 | |
| 4954 | // Req |
| 4955 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4956 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4957 | |
| 4958 | // Del |
| 4959 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4960 | |
| 4961 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4962 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4963 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4964 | |
| 4965 | //Wait that subs is cleaned |
| 4966 | waitSubsCleanup(t, e2SubsId, 10) |
| 4967 | |
| 4968 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4969 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4970 | } |
| 4971 | |
| 4972 | //----------------------------------------------------------------------------- |
| 4973 | // TestRESTSubReqAndSubDelOkSameAction |
| 4974 | // |
| 4975 | // stub stub |
| 4976 | // +-------+ +-------+ +---------+ +---------+ |
| 4977 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4978 | // +-------+ +-------+ +---------+ +---------+ |
| 4979 | // | | | | |
| 4980 | // | | RESTSubReq1 | | |
| 4981 | // | |---------------->| | |
| 4982 | // | | | | |
| 4983 | // | | RESTSubResp1 | | |
| 4984 | // | |<----------------| | |
| 4985 | // | | | | |
| 4986 | // | | | SubReq1 | |
| 4987 | // | | |------------->| |
| 4988 | // | | | SubResp1 | |
| 4989 | // | | |<-------------| |
| 4990 | // | | RESTNotif1 | | |
| 4991 | // | |<----------------| | |
| 4992 | // | | | | |
| 4993 | // | RESTSubReq2 | | |
| 4994 | // |------------------------------>| | |
| 4995 | // | | | | |
| 4996 | // | RESTSubResp2 | | |
| 4997 | // |<------------------------------| | |
| 4998 | // | | | | |
| 4999 | // | | RESTNotif2 | | |
| 5000 | // |<------------------------------| | |
| 5001 | // | | | | |
| 5002 | // | | RESTSubDelReq1 | | |
| 5003 | // | |---------------->| | |
| 5004 | // | | | | |
| 5005 | // | | RESTSubDelResp1 | | |
| 5006 | // | |<----------------| | |
| 5007 | // | | | | |
| 5008 | // | RESTSubDelReq2 | | |
| 5009 | // |------------------------------>| | |
| 5010 | // | | | | |
| 5011 | // | RESTSubDelResp2 | | |
| 5012 | // |<------------------------------| | |
| 5013 | // | | | | |
| 5014 | // | | | SubDelReq2 | |
| 5015 | // | | |------------->| |
| 5016 | // | | | | |
| 5017 | // | | | SubDelResp2 | |
| 5018 | // | | |<-------------| |
| 5019 | // | | | | |
| 5020 | // |
| 5021 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5022 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5023 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5024 | |
| 5025 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5026 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5027 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5028 | Counter{cSubReqToE2, 1}, |
| 5029 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5030 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5031 | Counter{cMergedSubscriptions, 1}, |
| 5032 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5033 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5034 | Counter{cSubDelReqToE2, 1}, |
| 5035 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5036 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5037 | }) |
| 5038 | |
| 5039 | // Req1 |
| 5040 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5041 | |
| 5042 | //Subs Create |
| 5043 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5044 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5045 | |
| 5046 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5047 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5048 | params.SetMeid("RAN_NAME_1") |
| 5049 | |
| 5050 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5051 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5052 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5053 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5054 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5055 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5056 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5057 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5058 | |
| 5059 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5060 | |
| 5061 | // Del1 |
| 5062 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5063 | |
| 5064 | // Del2 |
| 5065 | deleteXapp2Subscription(t, &restSubId2) |
| 5066 | |
| 5067 | //Wait that subs is cleaned |
| 5068 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5069 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5070 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5071 | } |
| 5072 | |
| 5073 | //----------------------------------------------------------------------------- |
| 5074 | // TestSubReqAndSubDelOkSameActionParallel |
| 5075 | // |
| 5076 | // stub stub stub |
| 5077 | // +-------+ +-------+ +---------+ +---------+ |
| 5078 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5079 | // +-------+ +-------+ +---------+ +---------+ |
| 5080 | // | | | | |
| 5081 | // | | | | |
| 5082 | // | | | | |
| 5083 | // | | SubReq1 | | |
| 5084 | // | |------------->| | |
| 5085 | // | | | | |
| 5086 | // | | | SubReq1 | |
| 5087 | // | | |------------->| |
| 5088 | // | SubReq2 | | |
| 5089 | // |--------------------------->| | |
| 5090 | // | | | SubResp1 | |
| 5091 | // | | |<-------------| |
| 5092 | // | | SubResp1 | | |
| 5093 | // | |<-------------| | |
| 5094 | // | | | SubReq2 | |
| 5095 | // | | |------------->| |
| 5096 | // | | | | |
| 5097 | // | | | SubResp2 | |
| 5098 | // | | |<-------------| |
| 5099 | // | SubResp2 | | |
| 5100 | // |<---------------------------| | |
| 5101 | // | | | | |
| 5102 | // | | SubDelReq 1 | | |
| 5103 | // | |------------->| | |
| 5104 | // | | | | |
| 5105 | // | | SubDelResp 1 | | |
| 5106 | // | |<-------------| | |
| 5107 | // | | | | |
| 5108 | // | SubDelReq 2 | | |
| 5109 | // |--------------------------->| | |
| 5110 | // | | | | |
| 5111 | // | | | SubDelReq 2 | |
| 5112 | // | | |------------->| |
| 5113 | // | | | | |
| 5114 | // | | | SubDelReq 2 | |
| 5115 | // | | |------------->| |
| 5116 | // | | | | |
| 5117 | // | SubDelResp 2 | | |
| 5118 | // |<---------------------------| | |
| 5119 | // |
| 5120 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5121 | |
| 5122 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5123 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5124 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5125 | Counter{cSubReqToE2, 2}, |
| 5126 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5127 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5128 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5129 | Counter{cSubDelReqToE2, 2}, |
| 5130 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5131 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5132 | }) |
| 5133 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5134 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5135 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5136 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5137 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5138 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5139 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5140 | |
| 5141 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5142 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5143 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 5144 | |
| 5145 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5146 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 5147 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 5148 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5149 | |
| 5150 | // Del1 |
| 5151 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5152 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5153 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5154 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5155 | |
| 5156 | // Del2 |
| 5157 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5158 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 5159 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 5160 | |
| 5161 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5162 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5163 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5164 | } |
| 5165 | |
| 5166 | //----------------------------------------------------------------------------- |
| 5167 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 5168 | // |
| 5169 | // stub stub stub |
| 5170 | // +-------+ +-------+ +---------+ +---------+ |
| 5171 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5172 | // +-------+ +-------+ +---------+ +---------+ |
| 5173 | // | | | | |
| 5174 | // | | | | |
| 5175 | // | | | | |
| 5176 | // | | RESTSubReq1 | | |
| 5177 | // | |---------------->| | |
| 5178 | // | | | | |
| 5179 | // | | RESTSubResp1 | | |
| 5180 | // | |<----------------| | |
| 5181 | // | | | SubReq1 | |
| 5182 | // | | |------------->| |
| 5183 | // | RESTSubReq2 | | |
| 5184 | // |------------------------------>| | |
| 5185 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5186 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5187 | // |<------------------------------| | |
| 5188 | // | | | SubReq1 | |
| 5189 | // | | |------------->| |
| 5190 | // | | | | |
| 5191 | // | | | | |
| 5192 | // | | | SubDelReq | |
| 5193 | // | | |------------->| |
| 5194 | // | | | | |
| 5195 | // | | | SubDelResp | |
| 5196 | // | | |<-------------| |
| 5197 | // | | RESTNotif1 | | |
| 5198 | // | | unsuccess | | |
| 5199 | // | |<----------------| | |
| 5200 | // | RESTNotif2 | | |
| 5201 | // | | unsuccess | | |
| 5202 | // |<------------------------------| | |
| 5203 | // | | | | |
| 5204 | // | | RESTSubDelReq1 | | |
| 5205 | // | |---------------->| | |
| 5206 | // | | | | |
| 5207 | // | | RESTSubDelResp1 | | |
| 5208 | // | |<----------------| | |
| 5209 | // | | | | |
| 5210 | // | RESTSubDelReq2 | | |
| 5211 | // |------------------------------>| | |
| 5212 | // | | | | |
| 5213 | // | RESTSubDelResp2 | | |
| 5214 | // |<------------------------------| | |
| 5215 | // |
| 5216 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5217 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5218 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5219 | |
| 5220 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5221 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5222 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5223 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5224 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5225 | Counter{cSubReqTimerExpiry, 2}, |
| 5226 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5227 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5228 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5229 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5230 | Counter{cSubDelReqToE2, 1}, |
| 5231 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5232 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5233 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5234 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5235 | |
| 5236 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5237 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5238 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5239 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5240 | |
| 5241 | // Req2 |
| 5242 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5243 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5244 | params2.SetMeid("RAN_NAME_1") |
| 5245 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5246 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5247 | |
| 5248 | //Req1 (retransmitted) |
| 5249 | e2termConn1.RecvSubsReq(t) |
| 5250 | |
| 5251 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5252 | |
| 5253 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5254 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5255 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5256 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5257 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5258 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5259 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5260 | |
| 5261 | // Del1 |
| 5262 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5263 | |
| 5264 | // Del2 |
| 5265 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5266 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5267 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5269 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5270 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5271 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5272 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5273 | } |
| 5274 | |
| 5275 | //----------------------------------------------------------------------------- |
| 5276 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5277 | // |
| 5278 | // stub stub stub |
| 5279 | // +-------+ +-------+ +---------+ +---------+ |
| 5280 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5281 | // +-------+ +-------+ +---------+ +---------+ |
| 5282 | // | | | | |
| 5283 | // | | | | |
| 5284 | // | | | | |
| 5285 | // | | RESTSubReq1 | | |
| 5286 | // | |---------------->| | |
| 5287 | // | | | | |
| 5288 | // | | RESTSubResp1 | | |
| 5289 | // | |<----------------| | |
| 5290 | // | | | SubReq1 | |
| 5291 | // | | |------------->| |
| 5292 | // | RESTSubReq2 | | |
| 5293 | // |------------------------------>| | |
| 5294 | // | | | | |
| 5295 | // | RESTSubDelResp2 | | |
| 5296 | // |<------------------------------| | |
| 5297 | // | | | SubFail1 | |
| 5298 | // | | |<-------------| |
| 5299 | // | | | | |
| 5300 | // | | RESTNotif1 | | |
| 5301 | // | | unsuccess | | |
| 5302 | // | |<----------------| | |
| 5303 | // | RESTNotif2 | | |
| 5304 | // | | unsuccess | | |
| 5305 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5306 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5307 | // | | 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] | 5308 | // | |---------------->| | |
| 5309 | // | | | | |
| 5310 | // | | RESTSubDelResp1 | | |
| 5311 | // | |<----------------| | |
| 5312 | // | | | | |
| 5313 | // | RESTSubDelReq2 | | |
| 5314 | // |------------------------------>| | |
| 5315 | // | | | | |
| 5316 | // | RESTSubDelResp2 | | |
| 5317 | // |<------------------------------| | |
| 5318 | // |
| 5319 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5320 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5321 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5322 | |
| 5323 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5324 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5325 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5326 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5327 | Counter{cSubReqToE2, 1}, |
| 5328 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5329 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5330 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5331 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5332 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5333 | }) |
| 5334 | |
| 5335 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5336 | |
| 5337 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5338 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5339 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5340 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5341 | |
| 5342 | // Req2 |
| 5343 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5344 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5345 | params2.SetMeid("RAN_NAME_1") |
| 5346 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5347 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5348 | |
| 5349 | // E2t: send SubsFail (first) |
| 5350 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5351 | fparams1.Set(crereq1) |
| 5352 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5353 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5354 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5355 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5356 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5357 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5358 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5359 | |
| 5360 | // Del1 |
| 5361 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5362 | |
| 5363 | // Del2 |
| 5364 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5365 | |
| 5366 | //Wait that subs is cleaned |
| 5367 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5368 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5369 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5370 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5371 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5372 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5373 | //----------------------------------------------------------------------------- |
| 5374 | // TestRESTSubReqPolicyAndSubDelOk |
| 5375 | // |
| 5376 | // stub stub |
| 5377 | // +-------+ +---------+ +---------+ |
| 5378 | // | xapp | | submgr | | e2term | |
| 5379 | // +-------+ +---------+ +---------+ |
| 5380 | // | | | |
| 5381 | // | RESTSubReq | | |
| 5382 | // |--------------->| | |
| 5383 | // | RESTSubResp | | |
| 5384 | // |<---------------| | |
| 5385 | // | | | |
| 5386 | // | | SubReq | |
| 5387 | // | |------------->| |
| 5388 | // | | | |
| 5389 | // | | SubResp | |
| 5390 | // | |<-------------| |
| 5391 | // | | | |
| 5392 | // | RESTNotif | | |
| 5393 | // |<---------------| | |
| 5394 | // | | | |
| 5395 | // | | | |
| 5396 | // | RESTSubDelReq | | |
| 5397 | // |--------------->| | |
| 5398 | // | RESTSubDelResp | | |
| 5399 | // |<---------------| | |
| 5400 | // | | | |
| 5401 | // | | SubDelReq | |
| 5402 | // | |------------->| |
| 5403 | // | | | |
| 5404 | // | | SubDelResp | |
| 5405 | // | |<-------------| |
| 5406 | // | | | |
| 5407 | // |
| 5408 | //----------------------------------------------------------------------------- |
| 5409 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5410 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5411 | |
| 5412 | // Init counter check |
| 5413 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5414 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5415 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5416 | Counter{cSubReqToE2, 1}, |
| 5417 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5418 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5419 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5420 | Counter{cSubDelReqToE2, 1}, |
| 5421 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5422 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5423 | }) |
| 5424 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5425 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5426 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5427 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5428 | |
| 5429 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5430 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5431 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5432 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5433 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5434 | |
| 5435 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5436 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5437 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5438 | |
| 5439 | // Wait that subs is cleaned |
| 5440 | waitSubsCleanup(t, e2SubsId, 10) |
| 5441 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5442 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5443 | } |
| 5444 | |
| 5445 | //----------------------------------------------------------------------------- |
| 5446 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5447 | // |
| 5448 | // stub stub |
| 5449 | // +-------+ +---------+ +---------+ |
| 5450 | // | xapp | | submgr | | e2term | |
| 5451 | // +-------+ +---------+ +---------+ |
| 5452 | // | | | |
| 5453 | // | RESTSubReq | | |
| 5454 | // |---------------->| | |
| 5455 | // | | | |
| 5456 | // | RESTSubResp | | |
| 5457 | // |<----------------| | |
| 5458 | // | | SubReq | |
| 5459 | // | |------------->| |
| 5460 | // | | | |
| 5461 | // | | SubResp | |
| 5462 | // | |<-------------| |
| 5463 | // | | | |
| 5464 | // | RESTNotif | | |
| 5465 | // |<----------------| | |
| 5466 | // | | | |
| 5467 | // | RESTSubReq | | |
| 5468 | // |---------------->| | |
| 5469 | // | | | |
| 5470 | // | RESTSubResp | | |
| 5471 | // |<----------------| | |
| 5472 | // | | SubReq | |
| 5473 | // | |------------->| |
| 5474 | // | | | |
| 5475 | // | | SubResp | |
| 5476 | // | |<-------------| |
| 5477 | // | | | |
| 5478 | // | RESTNotif | | |
| 5479 | // |<----------------| | |
| 5480 | // | | | |
| 5481 | // | RESTSubDelReq | | |
| 5482 | // |---------------->| | |
| 5483 | // | | | |
| 5484 | // | | SubDelReq | |
| 5485 | // | |------------->| |
| 5486 | // | | | |
| 5487 | // | | SubDelResp | |
| 5488 | // | |<-------------| |
| 5489 | // | | | |
| 5490 | // | RESTSubDelResp | | |
| 5491 | // |<----------------| | |
| 5492 | // |
| 5493 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5494 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5495 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5496 | |
| 5497 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5498 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5499 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5500 | Counter{cSubReqToE2, 2}, |
| 5501 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5502 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5503 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5504 | Counter{cSubDelReqToE2, 1}, |
| 5505 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5506 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5507 | }) |
| 5508 | |
| 5509 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5510 | const e2Timeout int64 = 1 |
| 5511 | const e2RetryCount int64 = 0 |
| 5512 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5513 | |
| 5514 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5515 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5516 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5517 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5518 | |
| 5519 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5520 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5521 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5522 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5523 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5524 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5525 | params.SetTimeToWait("w200ms") |
| 5526 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5527 | |
| 5528 | // Del |
| 5529 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5530 | |
| 5531 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5532 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5533 | |
| 5534 | // Wait that subs is cleaned |
| 5535 | waitSubsCleanup(t, e2SubsId, 10) |
| 5536 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5537 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5538 | } |
| 5539 | |
| 5540 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5541 | // TestRESTSubReqPolicyChangeNOk |
| 5542 | // |
| 5543 | // stub stub |
| 5544 | // +-------+ +---------+ +---------+ |
| 5545 | // | xapp | | submgr | | e2term | |
| 5546 | // +-------+ +---------+ +---------+ |
| 5547 | // | | | |
| 5548 | // | RESTSubReq | | |
| 5549 | // |---------------->| | |
| 5550 | // | | | |
| 5551 | // | RESTSubResp | | |
| 5552 | // |<----------------| | |
| 5553 | // | | SubReq | |
| 5554 | // | |------------->| |
| 5555 | // | | | |
| 5556 | // | | SubResp | |
| 5557 | // | |<-------------| |
| 5558 | // | | | |
| 5559 | // | RESTNotif | | |
| 5560 | // |<----------------| | |
| 5561 | // | | | |
| 5562 | // | RESTSubReq | | |
| 5563 | // |---------------->| | |
| 5564 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5565 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5566 | // | | | |
| 5567 | // | RESTSubDelReq | | |
| 5568 | // |---------------->| | |
| 5569 | // | | | |
| 5570 | // | | SubDelReq | |
| 5571 | // | |------------->| |
| 5572 | // | | | |
| 5573 | // | | SubDelResp | |
| 5574 | // | |<-------------| |
| 5575 | // | | | |
| 5576 | // | RESTSubDelResp | | |
| 5577 | // |<----------------| | |
| 5578 | // |
| 5579 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5580 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5581 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5582 | |
| 5583 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5584 | Counter{cRestSubReqFromXapp, 2}, |
| 5585 | Counter{cRestSubRespToXapp, 1}, |
| 5586 | Counter{cSubReqToE2, 1}, |
| 5587 | Counter{cSubRespFromE2, 1}, |
| 5588 | Counter{cRestSubNotifToXapp, 1}, |
| 5589 | Counter{cRestSubFailToXapp, 1}, |
| 5590 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5591 | Counter{cSubDelReqToE2, 1}, |
| 5592 | Counter{cSubDelRespFromE2, 1}, |
| 5593 | Counter{cRestSubDelRespToXapp, 1}, |
| 5594 | }) |
| 5595 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5596 | // Req |
| 5597 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5598 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5599 | |
| 5600 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5601 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5602 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5603 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5604 | params.SetSubscriptionID(&restSubIdUpd) |
| 5605 | params.SetTimeToWait("w200ms") |
| 5606 | |
| 5607 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5608 | assert.Equal(t, restSubId2, "") |
| 5609 | |
| 5610 | // Del |
| 5611 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5612 | |
| 5613 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5614 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5615 | |
| 5616 | // Wait that subs is cleaned |
| 5617 | waitSubsCleanup(t, e2SubsId, 10) |
| 5618 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5619 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5620 | } |
| 5621 | |
| 5622 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5623 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5624 | // |
| 5625 | // stub stub stub |
| 5626 | // +-------+ +---------+ +---------+ +---------+ |
| 5627 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5628 | // +-------+ +---------+ +---------+ +---------+ |
| 5629 | // | | | | |
| 5630 | // | | | | |
| 5631 | // | | | | |
| 5632 | // | RESTSubReq1 | | | |
| 5633 | // |---------------->| | | |
| 5634 | // | | | | |
| 5635 | // | RESTSubResp1 | | | |
| 5636 | // |<----------------| | | |
| 5637 | // | | SubReq1 | | |
| 5638 | // | |------------->| | |
| 5639 | // | | | | |
| 5640 | // | RESTSubReq2 | | | |
| 5641 | // |---------------->| | | |
| 5642 | // | | | | |
| 5643 | // | RESTSubResp2 | | | |
| 5644 | // |<----------------| | | |
| 5645 | // | | SubReq2 | | |
| 5646 | // | |---------------------------->| |
| 5647 | // | | | | |
| 5648 | // | | SubResp1 | | |
| 5649 | // | |<-------------| | |
| 5650 | // | RESTNotif1 | | | |
| 5651 | // |<----------------| | | |
| 5652 | // | | SubResp2 | | |
| 5653 | // | |<----------------------------| |
| 5654 | // | RESTNotif2 | | | |
| 5655 | // |<----------------| | | |
| 5656 | // | | | | |
| 5657 | // | [SUBS 1 DELETE] | | |
| 5658 | // | | | | |
| 5659 | // | [SUBS 2 DELETE] | | |
| 5660 | // | | | | |
| 5661 | // |
| 5662 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5663 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5664 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5665 | |
| 5666 | // Init counter check |
| 5667 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5668 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5669 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5670 | Counter{cSubReqToE2, 2}, |
| 5671 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5672 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5673 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5674 | Counter{cSubDelReqToE2, 2}, |
| 5675 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5676 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5677 | }) |
| 5678 | |
| 5679 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5680 | |
| 5681 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5682 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5683 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5684 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5685 | |
| 5686 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5687 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5688 | params.SetMeid("RAN_NAME_11") |
| 5689 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5690 | // would not work as notification would not be received |
| 5691 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5692 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5693 | |
| 5694 | // Resp1 |
| 5695 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5696 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5697 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5698 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5699 | |
| 5700 | // Resp2 |
| 5701 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5702 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5703 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5704 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5705 | |
| 5706 | // Delete1 |
| 5707 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5708 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5709 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5710 | |
| 5711 | // Wait that subs is cleaned |
| 5712 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5713 | |
| 5714 | // Delete2 |
| 5715 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5716 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5717 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5718 | |
| 5719 | // Wait that subs is cleaned |
| 5720 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5721 | |
| 5722 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5723 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5724 | } |
| 5725 | |
| 5726 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5727 | // TestRESTSubReqInsertAndSubDelOk |
| 5728 | // |
| 5729 | // stub stub |
| 5730 | // +-------+ +---------+ +---------+ |
| 5731 | // | xapp | | submgr | | e2term | |
| 5732 | // +-------+ +---------+ +---------+ |
| 5733 | // | | | |
| 5734 | // | RestSubReq | | |
| 5735 | // |---------------->| | |
| 5736 | // | | | |
| 5737 | // | RESTSubResp | | |
| 5738 | // |<----------------| | |
| 5739 | // | | | |
| 5740 | // | | SubReq | |
| 5741 | // | |------------->| |
| 5742 | // | | | |
| 5743 | // | | SubResp | |
| 5744 | // | |<-------------| |
| 5745 | // | RESTNotif | | |
| 5746 | // |<----------------| | |
| 5747 | // | ... | ... | |
| 5748 | // | | | |
| 5749 | // | RESTSubDelReq | | |
| 5750 | // |---------------->| | |
| 5751 | // | | | |
| 5752 | // | | SubDelReq | |
| 5753 | // | |------------->| |
| 5754 | // | | | |
| 5755 | // | | SubDelResp | |
| 5756 | // | |<-------------| |
| 5757 | // | | | |
| 5758 | // | RESTSubDelResp| | |
| 5759 | // |<----------------| | |
| 5760 | // |
| 5761 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5762 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5763 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5764 | |
| 5765 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5766 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5767 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5768 | Counter{cSubReqToE2, 1}, |
| 5769 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5770 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5771 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5772 | Counter{cSubDelReqToE2, 1}, |
| 5773 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5774 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5775 | }) |
| 5776 | |
| 5777 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5778 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5779 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5780 | params.SetSubActionTypes("insert") |
| 5781 | |
| 5782 | // Req |
| 5783 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5784 | |
| 5785 | // Del |
| 5786 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5787 | |
| 5788 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5789 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5790 | |
| 5791 | // Wait that subs is cleaned |
| 5792 | waitSubsCleanup(t, e2SubsId, 10) |
| 5793 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5794 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5795 | } |
| 5796 | |
| 5797 | //----------------------------------------------------------------------------- |
| 5798 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5799 | // |
| 5800 | // stub stub |
| 5801 | // +-------+ +---------+ +---------+ |
| 5802 | // | xapp | | submgr | | e2term | |
| 5803 | // +-------+ +---------+ +---------+ |
| 5804 | // | | | |
| 5805 | // | RESTSubReq | | |
| 5806 | // |------------->| | |
| 5807 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5808 | // | RESTSubResp | | |
| 5809 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5810 | // | | SubReq | |
| 5811 | // | |------------->| |
| 5812 | // | | | |
| 5813 | // | | SubResp | |
| 5814 | // | <----| |
| 5815 | // | | |
| 5816 | // | Submgr restart | |
| 5817 | // | | |
| 5818 | // | | | |
| 5819 | // | | SubDelReq | |
| 5820 | // | |------------->| |
| 5821 | // | | | |
| 5822 | // | | SubDelResp | |
| 5823 | // | |<-------------| |
| 5824 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5825 | // | RESTNotif | | |
| 5826 | // | unsuccess | | |
| 5827 | // |<-------------| | |
| 5828 | // | | | |
| 5829 | // | RESTSubDelReq| | |
| 5830 | // |------------->| | |
| 5831 | // | | | |
| 5832 | // |RESTSubDelResp| | |
| 5833 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5834 | // |
| 5835 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5836 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5837 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5838 | |
| 5839 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5840 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5841 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5842 | Counter{cSubReqToE2, 1}, |
| 5843 | Counter{cSubDelReqFromXapp, 1}, |
| 5844 | Counter{cSubDelReqToE2, 1}, |
| 5845 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5846 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5847 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5848 | }) |
| 5849 | |
| 5850 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5851 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5852 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5853 | |
| 5854 | //Req |
| 5855 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5856 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5857 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5858 | |
| 5859 | e2termConn1.RecvSubsReq(t) |
| 5860 | |
| 5861 | mainCtrl.SetResetTestFlag(t, false) |
| 5862 | |
| 5863 | mainCtrl.SimulateRestart(t) |
| 5864 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5865 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5866 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5867 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5868 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5869 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5870 | //Del |
| 5871 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5872 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5873 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5874 | e2termConn1.TestMsgChanEmpty(t) |
| 5875 | mainCtrl.wait_registry_empty(t, 10) |
| 5876 | |
| 5877 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5878 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5879 | } |
| 5880 | |
| 5881 | //----------------------------------------------------------------------------- |
| 5882 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5883 | // |
| 5884 | // stub stub |
| 5885 | // +-------+ +---------+ +---------+ |
| 5886 | // | xapp | | submgr | | e2term | |
| 5887 | // +-------+ +---------+ +---------+ |
| 5888 | // | | | |
| 5889 | // | RESTSubReq | | |
| 5890 | // |---------------->| | |
| 5891 | // | | | |
| 5892 | // | RESTSubResp | | |
| 5893 | // |<----------------| | |
| 5894 | // | | SubReq | |
| 5895 | // | |------------->| |
| 5896 | // | | | |
| 5897 | // | | SubResp | |
| 5898 | // | |<-------------| |
| 5899 | // | | | |
| 5900 | // | RESTNotif | | |
| 5901 | // |<----------------| | |
| 5902 | // | | | |
| 5903 | // | | |
| 5904 | // | Submgr restart | |
| 5905 | // | | | |
| 5906 | // | RESTSubDelReq | | |
| 5907 | // |---------------->| | |
| 5908 | // | | | |
| 5909 | // | | SubDelReq | |
| 5910 | // | |------------->| |
| 5911 | // | | | |
| 5912 | // | | SubDelResp | |
| 5913 | // | |<-------------| |
| 5914 | // | | | |
| 5915 | // | RESTSubDelResp | | |
| 5916 | // |<----------------| | |
| 5917 | // |
| 5918 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5919 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5920 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5921 | |
| 5922 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5923 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5924 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5925 | Counter{cSubReqToE2, 1}, |
| 5926 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5927 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5928 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5929 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5930 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5931 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5932 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5933 | |
| 5934 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5935 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5936 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5937 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5938 | |
| 5939 | // Check subscription |
| 5940 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5941 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5942 | mainCtrl.SimulateRestart(t) |
| 5943 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5944 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5945 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5946 | // That needs to be completed before successful subscription query is possible |
| 5947 | <-time.After(time.Second * 1) |
| 5948 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5949 | // Check subscription |
| 5950 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5951 | |
| 5952 | // Delete subscription |
| 5953 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5954 | |
| 5955 | //Wait that subs is cleaned |
| 5956 | waitSubsCleanup(t, e2SubsId, 10) |
| 5957 | |
| 5958 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5959 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5960 | } |
| 5961 | |
| 5962 | //----------------------------------------------------------------------------- |
| 5963 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5964 | // |
| 5965 | // stub stub |
| 5966 | // +-------+ +-------+ +---------+ +---------+ |
| 5967 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5968 | // +-------+ +-------+ +---------+ +---------+ |
| 5969 | // | | | | |
| 5970 | // | | RESTSubReq1 | | |
| 5971 | // | |---------------->| | |
| 5972 | // | | | | |
| 5973 | // | | RESTSubResp1 | | |
| 5974 | // | |<----------------| | |
| 5975 | // | | | | |
| 5976 | // | | | SubReq1 | |
| 5977 | // | | |------------->| |
| 5978 | // | | | SubResp1 | |
| 5979 | // | | |<-------------| |
| 5980 | // | | RESTNotif1 | | |
| 5981 | // | |<----------------| | |
| 5982 | // | | | | |
| 5983 | // | RESTSubReq2 | | |
| 5984 | // |------------------------------>| | |
| 5985 | // | | | | |
| 5986 | // | RESTSubResp2 | | |
| 5987 | // |<------------------------------| | |
| 5988 | // | | | | |
| 5989 | // | | RESTNotif2 | | |
| 5990 | // |<------------------------------| | |
| 5991 | // | | | | |
| 5992 | // | | Submgr restart | |
| 5993 | // | | | | |
| 5994 | // | | RESTSubDelReq1 | | |
| 5995 | // | |---------------->| | |
| 5996 | // | | | | |
| 5997 | // | | RESTSubDelResp1 | | |
| 5998 | // | |<----------------| | |
| 5999 | // | | | | |
| 6000 | // | | Submgr restart | |
| 6001 | // | | | | |
| 6002 | // | RESTSubDelReq2 | | |
| 6003 | // |------------------------------>| | |
| 6004 | // | | | | |
| 6005 | // | RESTSubDelResp2 | | |
| 6006 | // |<------------------------------| | |
| 6007 | // | | | | |
| 6008 | // | | | SubDelReq2 | |
| 6009 | // | | |------------->| |
| 6010 | // | | | | |
| 6011 | // | | | SubDelResp2 | |
| 6012 | // | | |<-------------| |
| 6013 | // | | | | |
| 6014 | // |
| 6015 | //----------------------------------------------------------------------------- |
| 6016 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6017 | |
| 6018 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6019 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6020 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6021 | Counter{cSubReqToE2, 1}, |
| 6022 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6023 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6024 | Counter{cMergedSubscriptions, 1}, |
| 6025 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6026 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6027 | Counter{cSubDelReqToE2, 1}, |
| 6028 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6029 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6030 | }) |
| 6031 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6032 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6033 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6034 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6035 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6036 | |
| 6037 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6038 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6039 | params.SetMeid("RAN_NAME_1") |
| 6040 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6041 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6042 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6043 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6044 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6045 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6046 | |
| 6047 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 6048 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6049 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6050 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 6051 | |
| 6052 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6053 | // That needs to be completed before successful subscription delete is possible |
| 6054 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6055 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6056 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6057 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 6058 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6059 | // 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] | 6060 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6061 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6062 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 6063 | |
| 6064 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6065 | // That needs to be completed before successful subscription query is possible |
| 6066 | <-time.After(time.Second * 1) |
| 6067 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6068 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 6069 | |
| 6070 | // Delete subscription 2 |
| 6071 | deleteXapp2Subscription(t, &restSubId2) |
| 6072 | |
| 6073 | //Wait that subs is cleaned |
| 6074 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6075 | |
| 6076 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6077 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6078 | } |
| 6079 | |
| 6080 | //----------------------------------------------------------------------------- |
| 6081 | // TestRESTReportSubReqAndSubDelOk |
| 6082 | // |
| 6083 | // stub stub |
| 6084 | // +-------+ +---------+ +---------+ |
| 6085 | // | xapp | | submgr | | e2term | |
| 6086 | // +-------+ +---------+ +---------+ |
| 6087 | // | | | |
| 6088 | // | RestSubReq | | |
| 6089 | // |---------------->| | |
| 6090 | // | | | |
| 6091 | // | RESTSubResp | | |
| 6092 | // |<----------------| | |
| 6093 | // | | | |
| 6094 | // | | SubReq | |
| 6095 | // | |------------->| |
| 6096 | // | | | |
| 6097 | // | | SubResp | |
| 6098 | // | |<-------------| |
| 6099 | // | RESTNotif | | |
| 6100 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6101 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6102 | // | |------------->| |
| 6103 | // | | | |
| 6104 | // | | SubResp | |
| 6105 | // | |<-------------| |
| 6106 | // | RESTNotif | | |
| 6107 | // |<----------------| | |
| 6108 | // | ... | ... | |
| 6109 | // | | | |
| 6110 | // | | | |
| 6111 | // | RESTSubDelReq | | |
| 6112 | // |---------------->| | |
| 6113 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6114 | // | RESTSubDelResp| | |
| 6115 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6116 | // | | SubDelReq | |
| 6117 | // | |------------->| |
| 6118 | // | | | |
| 6119 | // | | SubDelResp | |
| 6120 | // | |<-------------| |
| 6121 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6122 | // |
| 6123 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6124 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6125 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6126 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6127 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6128 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6129 | } |
| 6130 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6131 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6132 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6133 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6134 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6135 | Counter{cRestSubReqFromXapp, 1}, |
| 6136 | Counter{cRestSubRespToXapp, 1}, |
| 6137 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6138 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 6139 | Counter{cRestSubNotifToXapp, 1}, |
| 6140 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6141 | Counter{cRestSubDelRespToXapp, 1}, |
| 6142 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6143 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 6144 | }) |
| 6145 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6146 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6147 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6148 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6149 | |
| 6150 | var e2SubsId []uint32 |
| 6151 | for i := 0; i < subReqCount; i++ { |
| 6152 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6153 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6154 | |
| 6155 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6156 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6157 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6158 | e2SubsId = append(e2SubsId, instanceId) |
| 6159 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6160 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 6161 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 6162 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 6163 | |
| 6164 | } |
| 6165 | |
| 6166 | // Del |
| 6167 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6168 | |
| 6169 | for i := 0; i < subReqCount; i++ { |
| 6170 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6171 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6172 | } |
| 6173 | |
| 6174 | // Wait that subs is cleaned |
| 6175 | for i := 0; i < subReqCount; i++ { |
| 6176 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6177 | } |
| 6178 | |
| 6179 | xappConn1.TestMsgChanEmpty(t) |
| 6180 | e2termConn1.TestMsgChanEmpty(t) |
| 6181 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6182 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6183 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6184 | } |
| 6185 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6186 | //----------------------------------------------------------------------------- |
| 6187 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6188 | // |
| 6189 | // stub stub |
| 6190 | // +-------+ +---------+ +---------+ |
| 6191 | // | xapp | | submgr | | e2term | |
| 6192 | // +-------+ +---------+ +---------+ |
| 6193 | // | | | |
| 6194 | // | RestSubReq | | |
| 6195 | // |---------------->| | |
| 6196 | // | | | |
| 6197 | // | RESTSubResp | | |
| 6198 | // |<----------------| | |
| 6199 | // | | | |
| 6200 | // | | SubReq | |
| 6201 | // | |------------->| |
| 6202 | // | | | |
| 6203 | // | | SubResp | |
| 6204 | // | |<-------------| |
| 6205 | // | RESTNotif | | |
| 6206 | // |<----------------| | |
| 6207 | // | | SubReq | |
| 6208 | // | |------------->| |
| 6209 | // | | | |
| 6210 | // | | SubResp | |
| 6211 | // | |<-------------| |
| 6212 | // | RESTNotif | | |
| 6213 | // |<----------------| | |
| 6214 | // | | | |
| 6215 | // | RESTSubDelReq | | |
| 6216 | // |---------------->| | |
| 6217 | // | | | |
| 6218 | // | RESTSubDelResp| | |
| 6219 | // |<----------------| | |
| 6220 | // | | SubDelReq | |
| 6221 | // | |------------->| |
| 6222 | // | | | |
| 6223 | // | | SubDelResp | |
| 6224 | // | |<-------------| |
| 6225 | // | | | |
| 6226 | // | | SubDelReq | |
| 6227 | // | |------------->| |
| 6228 | // | | | |
| 6229 | // | | SubDelResp | |
| 6230 | // | |<-------------| |
| 6231 | // | | | |
| 6232 | // |
| 6233 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6234 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6235 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6236 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6237 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6238 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6239 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6240 | Counter{cSubReqToE2, 2}, |
| 6241 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6242 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6243 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6244 | Counter{cSubDelReqToE2, 2}, |
| 6245 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6246 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6247 | }) |
| 6248 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6249 | const subReqCount int = 2 |
| 6250 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6251 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6252 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6253 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6254 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6255 | |
| 6256 | assert.Equal(t, len(e2SubsIds), 2) |
| 6257 | |
| 6258 | // Del |
| 6259 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6260 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6261 | |
| 6262 | xappConn1.TestMsgChanEmpty(t) |
| 6263 | e2termConn1.TestMsgChanEmpty(t) |
| 6264 | mainCtrl.wait_registry_empty(t, 10) |
| 6265 | |
| 6266 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6267 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6268 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6269 | |
| 6270 | //----------------------------------------------------------------------------- |
| 6271 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6272 | // |
| 6273 | // stub stub |
| 6274 | // +-------+ +---------+ +---------+ |
| 6275 | // | xapp | | submgr | | e2term | |
| 6276 | // +-------+ +---------+ +---------+ |
| 6277 | // | | | |
| 6278 | // | RestSubReq | | |
| 6279 | // |---------------->| | |
| 6280 | // | | | |
| 6281 | // | RESTSubResp | | |
| 6282 | // |<----------------| | |
| 6283 | // | | | ------ |
| 6284 | // | | SubReq | |
| 6285 | // | |------------->| |
| 6286 | // | | | E2 subscription x 19 |
| 6287 | // | | SubResp | |
| 6288 | // | |<-------------| |
| 6289 | // | RESTNotif | | |
| 6290 | // |<----------------| | |
| 6291 | // | | | ------ |
| 6292 | // | RESTSubDelReq | | |
| 6293 | // |---------------->| | |
| 6294 | // | | | |
| 6295 | // | RESTSubDelResp| | |
| 6296 | // |<----------------| | |
| 6297 | // | | SubDelReq | ------ |
| 6298 | // | |------------->| |
| 6299 | // | | | E2 subscription delete x 19 |
| 6300 | // | | SubDelResp | |
| 6301 | // | |<-------------| |
| 6302 | // | | | ------ |
| 6303 | // | | | |
| 6304 | // |
| 6305 | //----------------------------------------------------------------------------- |
| 6306 | |
| 6307 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6308 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6309 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6310 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6311 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6312 | Counter{cSubReqToE2, 19}, |
| 6313 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6314 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6315 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6316 | Counter{cSubDelReqToE2, 19}, |
| 6317 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6318 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6319 | }) |
| 6320 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6321 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6322 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6323 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6324 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6325 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6326 | |
| 6327 | assert.Equal(t, len(e2SubsIds), 19) |
| 6328 | |
| 6329 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6330 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6331 | |
| 6332 | xappConn1.TestMsgChanEmpty(t) |
| 6333 | e2termConn1.TestMsgChanEmpty(t) |
| 6334 | mainCtrl.wait_registry_empty(t, 10) |
| 6335 | |
| 6336 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6337 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6338 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6339 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6340 | //----------------------------------------------------------------------------- |
| 6341 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6342 | // |
| 6343 | // stub stub |
| 6344 | // +-------+ +---------+ +---------+ |
| 6345 | // | xapp | | submgr | | e2term | |
| 6346 | // +-------+ +---------+ +---------+ |
| 6347 | // | | | |
| 6348 | // | RestSubReq | | |
| 6349 | // |---------------->| | |
| 6350 | // | | | |
| 6351 | // | RESTSubResp | | |
| 6352 | // |<----------------| | |
| 6353 | // | | | |
| 6354 | // | | SubReq | |
| 6355 | // | |------------->| |
| 6356 | // | | | |
| 6357 | // | | SubResp | |
| 6358 | // | |<-------------| |
| 6359 | // | RESTNotif | | |
| 6360 | // |<----------------| | |
| 6361 | // | | SubReq | |
| 6362 | // | |------------->| |
| 6363 | // | | | |
| 6364 | // | | SubResp | |
| 6365 | // | |<-------------| |
| 6366 | // | RESTNotif | | |
| 6367 | // |<----------------| | |
| 6368 | // | | | |
| 6369 | // | RESTSubDelReq | | |
| 6370 | // |---------------->| | |
| 6371 | // | | | |
| 6372 | // | RESTSubDelResp| | |
| 6373 | // |<----------------| | |
| 6374 | // | | SubDelReq | |
| 6375 | // | |------------->| |
| 6376 | // | | | |
| 6377 | // | | SubDelResp | |
| 6378 | // | |<-------------| |
| 6379 | // | | | |
| 6380 | // | | SubDelReq | |
| 6381 | // | |------------->| |
| 6382 | // | | | |
| 6383 | // | | SubDelResp | |
| 6384 | // | |<-------------| |
| 6385 | // | | | |
| 6386 | // |
| 6387 | //----------------------------------------------------------------------------- |
| 6388 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6389 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6390 | |
| 6391 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6392 | |
| 6393 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6394 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6395 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6396 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6397 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6398 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6399 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6400 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6401 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6402 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6403 | }) |
| 6404 | |
| 6405 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6406 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6407 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6408 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6409 | |
| 6410 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6411 | |
| 6412 | // Del |
| 6413 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6414 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6415 | |
| 6416 | xappConn1.TestMsgChanEmpty(t) |
| 6417 | e2termConn1.TestMsgChanEmpty(t) |
| 6418 | mainCtrl.wait_registry_empty(t, 10) |
| 6419 | |
| 6420 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6421 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6422 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6423 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6424 | //----------------------------------------------------------------------------- |
| 6425 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6426 | // |
| 6427 | // stub stub |
| 6428 | // +-------+ +---------+ +---------+ |
| 6429 | // | xapp | | submgr | | e2term | |
| 6430 | // +-------+ +---------+ +---------+ |
| 6431 | // | | | |
| 6432 | // | RestSubReq | | |
| 6433 | // |---------------->| | |
| 6434 | // | | | |
| 6435 | // | RESTSubResp | | |
| 6436 | // |<----------------| | |
| 6437 | // | | | |
| 6438 | // | | SubReq | |
| 6439 | // | |------------->| |
| 6440 | // | | | |
| 6441 | // | | SubResp | |
| 6442 | // | |<-------------| |
| 6443 | // | RESTNotif | | |
| 6444 | // |<----------------| | |
| 6445 | // | | SubReq | |
| 6446 | // | |------------->| |
| 6447 | // | | | |
| 6448 | // | | SubResp | |
| 6449 | // | |<-------------| |
| 6450 | // | RESTNotif | | |
| 6451 | // |<----------------| | |
| 6452 | // | | | |
| 6453 | // | RESTSubDelReq | | |
| 6454 | // |---------------->| | |
| 6455 | // | | | |
| 6456 | // | RESTSubDelResp| | |
| 6457 | // |<----------------| | |
| 6458 | // | | SubDelReq | |
| 6459 | // | |------------->| |
| 6460 | // | | | |
| 6461 | // | | SubDelResp | |
| 6462 | // | |<-------------| |
| 6463 | // | | | |
| 6464 | // | | SubDelReq | |
| 6465 | // | |------------->| |
| 6466 | // | | | |
| 6467 | // | | SubDelResp | |
| 6468 | // | |<-------------| |
| 6469 | // | | | |
| 6470 | // |
| 6471 | //----------------------------------------------------------------------------- |
| 6472 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6473 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6474 | |
| 6475 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6476 | |
| 6477 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6478 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6479 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6480 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6481 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6482 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6483 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6484 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6485 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6486 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6487 | }) |
| 6488 | |
| 6489 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6490 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6491 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6492 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6493 | |
| 6494 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6495 | |
| 6496 | // Del |
| 6497 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6498 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6499 | |
| 6500 | xappConn1.TestMsgChanEmpty(t) |
| 6501 | e2termConn1.TestMsgChanEmpty(t) |
| 6502 | mainCtrl.wait_registry_empty(t, 10) |
| 6503 | |
| 6504 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6505 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6506 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6507 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6508 | //----------------------------------------------------------------------------- |
| 6509 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6510 | // |
| 6511 | // stub stub |
| 6512 | // +-------+ +---------+ +---------+ |
| 6513 | // | xapp | | submgr | | e2term | |
| 6514 | // +-------+ +---------+ +---------+ |
| 6515 | // | | | |
| 6516 | // | RestSubReq | | |
| 6517 | // |---------------->| | |
| 6518 | // | | | |
| 6519 | // | RESTSubResp | | |
| 6520 | // |<----------------| | |
| 6521 | // | | | ------ |
| 6522 | // | | SubReq | |
| 6523 | // | |------------->| |
| 6524 | // | | | E2 subscription x 19 |
| 6525 | // | | SubResp | |
| 6526 | // | |<-------------| |
| 6527 | // | RESTNotif | | |
| 6528 | // |<----------------| | |
| 6529 | // | | | ------ |
| 6530 | // | RESTSubDelReq | | |
| 6531 | // |---------------->| | |
| 6532 | // | | | |
| 6533 | // | RESTSubDelResp| | |
| 6534 | // |<----------------| | |
| 6535 | // | | SubDelReq | ------ |
| 6536 | // | |------------->| |
| 6537 | // | | | E2 subscription delete x 19 |
| 6538 | // | | SubDelResp | |
| 6539 | // | |<-------------| |
| 6540 | // | | | ------ |
| 6541 | // | | | |
| 6542 | // |
| 6543 | //----------------------------------------------------------------------------- |
| 6544 | |
| 6545 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6546 | |
| 6547 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6548 | |
| 6549 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6550 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6551 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6552 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6553 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6554 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6555 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6556 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6557 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6558 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6559 | }) |
| 6560 | |
| 6561 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6562 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6563 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6564 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6565 | |
| 6566 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6567 | |
| 6568 | // Del |
| 6569 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6570 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6571 | |
| 6572 | xappConn1.TestMsgChanEmpty(t) |
| 6573 | e2termConn1.TestMsgChanEmpty(t) |
| 6574 | mainCtrl.wait_registry_empty(t, 10) |
| 6575 | |
| 6576 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6577 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6578 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6579 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6580 | //----------------------------------------------------------------------------- |
| 6581 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6582 | // |
| 6583 | // stub stub stub |
| 6584 | // +-------+ +-------+ +---------+ +---------+ |
| 6585 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6586 | // +-------+ +-------+ +---------+ +---------+ |
| 6587 | // | | | | |
| 6588 | // | | RESTSubReq1 | | |
| 6589 | // | |------------->| | |
| 6590 | // | | RESTSubResp1 | | |
| 6591 | // | |<-------------| | |
| 6592 | // | | | | |
| 6593 | // | | | SubReq1 | |
| 6594 | // | | |------------->| |
| 6595 | // | | | | |
| 6596 | // | RESTSubReq2 | | |
| 6597 | // |------------------------>| | |
| 6598 | // | RESTSubResp2 | | |
| 6599 | // |<------------------------| | |
| 6600 | // | | | | |
| 6601 | // | | | SubReq2 | |
| 6602 | // | | |------------->| |
| 6603 | // | | | | |
| 6604 | // | | | SubResp1 | |
| 6605 | // | | |<-------------| |
| 6606 | // | | RESTNotif1 | | |
| 6607 | // | |<-------------| | |
| 6608 | // | | | | |
| 6609 | // | | | SubResp2 | |
| 6610 | // | | |<-------------| |
| 6611 | // | RESTNotif2 | | |
| 6612 | // |<------------------------| | |
| 6613 | // | | | | |
| 6614 | // | | [SUBS 1 DELETE] | |
| 6615 | // | | | | |
| 6616 | // | | [SUBS 2 DELETE] | |
| 6617 | // | | | | |
| 6618 | // |
| 6619 | //----------------------------------------------------------------------------- |
| 6620 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6621 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6622 | |
| 6623 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6624 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6625 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6626 | Counter{cSubReqToE2, 2}, |
| 6627 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6628 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6629 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6630 | Counter{cSubDelReqToE2, 2}, |
| 6631 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6632 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6633 | }) |
| 6634 | |
| 6635 | // Req1 |
| 6636 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6637 | |
| 6638 | //Subs Create |
| 6639 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6640 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6641 | |
| 6642 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6643 | |
| 6644 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6645 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6646 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6647 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6648 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6649 | |
| 6650 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6651 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6652 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6653 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6654 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6655 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6656 | |
| 6657 | deleteXapp1Subscription(t, &restSubId1) |
| 6658 | deleteXapp2Subscription(t, &restSubId2) |
| 6659 | |
| 6660 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6661 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6662 | |
| 6663 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6664 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6665 | } |
| 6666 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6667 | //----------------------------------------------------------------------------- |
| 6668 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6669 | // |
| 6670 | // stub stub stub |
| 6671 | // +-------+ +-------+ +---------+ +---------+ |
| 6672 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6673 | // +-------+ +-------+ +---------+ +---------+ |
| 6674 | // | | | | |
| 6675 | // | | RESTSubReq1 | | |
| 6676 | // | |------------->| | |
| 6677 | // | | RESTSubResp1 | | |
| 6678 | // | |<-------------| | |
| 6679 | // | | | | |
| 6680 | // | | | SubReq1 | |
| 6681 | // | | |------------->| |
| 6682 | // | | | | |
| 6683 | // | RESTSubReq2 | | |
| 6684 | // |------------------------>| | |
| 6685 | // | RESTSubResp2 | | |
| 6686 | // |<------------------------| | |
| 6687 | // | | | | |
| 6688 | // | | | SubReq2 | |
| 6689 | // | | |------------->| |
| 6690 | // | | | | |
| 6691 | // | | | SubResp1 | |
| 6692 | // | | |<-------------| |
| 6693 | // | | RESTNotif1 | | |
| 6694 | // | |<-------------| | |
| 6695 | // | | | | |
| 6696 | // | | | SubResp2 | |
| 6697 | // | | |<-------------| |
| 6698 | // | RESTNotif2 | | |
| 6699 | // |<------------------------| | |
| 6700 | // | | | | |
| 6701 | // | | [SUBS 1 DELETE] | |
| 6702 | // | | | | |
| 6703 | // | | [SUBS 2 DELETE] | |
| 6704 | // | | | | |
| 6705 | // |
| 6706 | //----------------------------------------------------------------------------- |
| 6707 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6708 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6709 | |
| 6710 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6711 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6712 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6713 | Counter{cSubReqToE2, 2}, |
| 6714 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6715 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6716 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6717 | Counter{cSubDelReqToE2, 2}, |
| 6718 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6719 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6720 | }) |
| 6721 | |
| 6722 | // Req1 |
| 6723 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6724 | |
| 6725 | //Subs Create |
| 6726 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6727 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6728 | |
| 6729 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6730 | |
| 6731 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6732 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6733 | params.SetMeid("RAN_NAME_1") |
| 6734 | |
| 6735 | actionId := int64(1) |
| 6736 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6737 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6738 | subsequestActionType := "continue" |
| 6739 | timeToWait := "w10ms" |
| 6740 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6741 | |
| 6742 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6743 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6744 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6745 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6746 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6747 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6748 | |
| 6749 | deleteXapp1Subscription(t, &restSubId1) |
| 6750 | deleteXapp2Subscription(t, &restSubId2) |
| 6751 | |
| 6752 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6753 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6754 | |
| 6755 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6756 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6757 | } |
| 6758 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6759 | //----------------------------------------------------------------------------- |
| 6760 | // TestRESTSubReqReportSameActionDiffActionID |
| 6761 | // |
| 6762 | // stub stub stub |
| 6763 | // +-------+ +-------+ +---------+ +---------+ |
| 6764 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6765 | // +-------+ +-------+ +---------+ +---------+ |
| 6766 | // | | | | |
| 6767 | // | | RESTSubReq1 | | |
| 6768 | // | |------------->| | |
| 6769 | // | | RESTSubResp1 | | |
| 6770 | // | |<-------------| | |
| 6771 | // | | | | |
| 6772 | // | | | SubReq1 | |
| 6773 | // | | |------------->| |
| 6774 | // | | | | |
| 6775 | // | RESTSubReq2 | | |
| 6776 | // |------------------------>| | |
| 6777 | // | RESTSubResp2 | | |
| 6778 | // |<------------------------| | |
| 6779 | // | | | | |
| 6780 | // | | | SubReq2 | |
| 6781 | // | | |------------->| |
| 6782 | // | | | | |
| 6783 | // | | | SubResp1 | |
| 6784 | // | | |<-------------| |
| 6785 | // | | RESTNotif1 | | |
| 6786 | // | |<-------------| | |
| 6787 | // | | | | |
| 6788 | // | | | SubResp2 | |
| 6789 | // | | |<-------------| |
| 6790 | // | RESTNotif2 | | |
| 6791 | // |<------------------------| | |
| 6792 | // | | | | |
| 6793 | // | | [SUBS 1 DELETE] | |
| 6794 | // | | | | |
| 6795 | // | | [SUBS 2 DELETE] | |
| 6796 | // | | | | |
| 6797 | // |
| 6798 | //----------------------------------------------------------------------------- |
| 6799 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6800 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6801 | |
| 6802 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6803 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6804 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6805 | Counter{cSubReqToE2, 2}, |
| 6806 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6807 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6808 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6809 | Counter{cSubDelReqToE2, 2}, |
| 6810 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6811 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6812 | }) |
| 6813 | |
| 6814 | // Req1 |
| 6815 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6816 | |
| 6817 | //Subs Create |
| 6818 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6819 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6820 | |
| 6821 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6822 | |
| 6823 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6824 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6825 | params.SetMeid("RAN_NAME_1") |
| 6826 | params.SetSubActionIDs(int64(2)) |
| 6827 | |
| 6828 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6829 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6830 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6831 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6832 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6833 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6834 | |
| 6835 | deleteXapp1Subscription(t, &restSubId1) |
| 6836 | deleteXapp2Subscription(t, &restSubId2) |
| 6837 | |
| 6838 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6839 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6840 | |
| 6841 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6842 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6843 | } |
| 6844 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6845 | //----------------------------------------------------------------------------- |
| 6846 | // TestRESTSubReqDiffActionType |
| 6847 | // |
| 6848 | // stub stub stub |
| 6849 | // +-------+ +-------+ +---------+ +---------+ |
| 6850 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6851 | // +-------+ +-------+ +---------+ +---------+ |
| 6852 | // | | | | |
| 6853 | // | | RESTSubReq1 | | |
| 6854 | // | |------------->| | |
| 6855 | // | | RESTSubResp1 | | |
| 6856 | // | |<-------------| | |
| 6857 | // | | | | |
| 6858 | // | | | SubReq1 | |
| 6859 | // | | |------------->| |
| 6860 | // | | | | |
| 6861 | // | RESTSubReq2 | | |
| 6862 | // |------------------------>| | |
| 6863 | // | RESTSubResp2 | | |
| 6864 | // |<------------------------| | |
| 6865 | // | | | | |
| 6866 | // | | | SubReq2 | |
| 6867 | // | | |------------->| |
| 6868 | // | | | | |
| 6869 | // | | | SubResp1 | |
| 6870 | // | | |<-------------| |
| 6871 | // | | RESTNotif1 | | |
| 6872 | // | |<-------------| | |
| 6873 | // | | | | |
| 6874 | // | | | SubResp2 | |
| 6875 | // | | |<-------------| |
| 6876 | // | RESTNotif2 | | |
| 6877 | // |<------------------------| | |
| 6878 | // | | | | |
| 6879 | // | | [SUBS 1 DELETE] | |
| 6880 | // | | | | |
| 6881 | // | | [SUBS 2 DELETE] | |
| 6882 | // | | | | |
| 6883 | // |
| 6884 | //----------------------------------------------------------------------------- |
| 6885 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6886 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6887 | |
| 6888 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6889 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6890 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6891 | Counter{cSubReqToE2, 2}, |
| 6892 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6893 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6894 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6895 | Counter{cSubDelReqToE2, 2}, |
| 6896 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6897 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6898 | }) |
| 6899 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6900 | const e2Timeout int64 = 2 |
| 6901 | const e2RetryCount int64 = 2 |
| 6902 | const routingNeeded bool = true |
| 6903 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6904 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6905 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6906 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6907 | |
| 6908 | //Subs Create |
| 6909 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6910 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6911 | |
| 6912 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6913 | |
| 6914 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6915 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6916 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6917 | params.SetMeid("RAN_NAME_1") |
| 6918 | |
| 6919 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6920 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6921 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6922 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6923 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6924 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6925 | |
| 6926 | deleteXapp1Subscription(t, &restSubId1) |
| 6927 | deleteXapp2Subscription(t, &restSubId2) |
| 6928 | |
| 6929 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6930 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6931 | |
| 6932 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6933 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6934 | } |
| 6935 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6936 | //----------------------------------------------------------------------------- |
| 6937 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 6938 | // |
| 6939 | // stub stub stub |
| 6940 | // +-------+ +-------+ +---------+ +---------+ |
| 6941 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6942 | // +-------+ +-------+ +---------+ +---------+ |
| 6943 | // | | | | |
| 6944 | // | | RESTSubReq1 | | |
| 6945 | // | |------------->| | |
| 6946 | // | | RESTSubResp1 | | |
| 6947 | // | |<-------------| | |
| 6948 | // | | | | |
| 6949 | // | | | SubReq1 | |
| 6950 | // | | |------------->| |
| 6951 | // | | | | |
| 6952 | // | RESTSubReq2 | | |
| 6953 | // |------------------------>| | |
| 6954 | // | RESTSubResp2 | | |
| 6955 | // |<------------------------| | |
| 6956 | // | | | | |
| 6957 | // | | | SubReq2 | |
| 6958 | // | | |------------->| |
| 6959 | // | | | | |
| 6960 | // | | | SubResp1 | |
| 6961 | // | | |<-------------| |
| 6962 | // | | RESTNotif1 | | |
| 6963 | // | |<-------------| | |
| 6964 | // | | | | |
| 6965 | // | | | SubResp2 | |
| 6966 | // | | |<-------------| |
| 6967 | // | RESTNotif2 | | |
| 6968 | // |<------------------------| | |
| 6969 | // | | | | |
| 6970 | // | | [SUBS 1 DELETE] | |
| 6971 | // | | | | |
| 6972 | // | | [SUBS 2 DELETE] | |
| 6973 | // | | | | |
| 6974 | // |
| 6975 | //----------------------------------------------------------------------------- |
| 6976 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6977 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6978 | |
| 6979 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6980 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6981 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6982 | Counter{cSubReqToE2, 2}, |
| 6983 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6984 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6985 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6986 | Counter{cSubDelReqToE2, 2}, |
| 6987 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6988 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6989 | }) |
| 6990 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6991 | const e2Timeout int64 = 2 |
| 6992 | const e2RetryCount int64 = 2 |
| 6993 | const routingNeeded bool = true |
| 6994 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6995 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6996 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6997 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6998 | |
| 6999 | //Subs Create |
| 7000 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7001 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7002 | |
| 7003 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7004 | |
| 7005 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7006 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7007 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7008 | params.SetMeid("RAN_NAME_1") |
| 7009 | |
| 7010 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7011 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7012 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7013 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7014 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7015 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7016 | |
| 7017 | deleteXapp1Subscription(t, &restSubId1) |
| 7018 | deleteXapp2Subscription(t, &restSubId2) |
| 7019 | |
| 7020 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7021 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7022 | |
| 7023 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7024 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7025 | } |
| 7026 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7027 | //----------------------------------------------------------------------------- |
| 7028 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 7029 | // |
| 7030 | // stub stub stub |
| 7031 | // +-------+ +-------+ +---------+ +---------+ |
| 7032 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7033 | // +-------+ +-------+ +---------+ +---------+ |
| 7034 | // | | | | |
| 7035 | // | | RESTSubReq1 | | |
| 7036 | // | |------------->| | |
| 7037 | // | | RESTSubResp1 | | |
| 7038 | // | |<-------------| | |
| 7039 | // | | | | |
| 7040 | // | | | SubReq1 | |
| 7041 | // | | |------------->| |
| 7042 | // | | | | |
| 7043 | // | RESTSubReq2 | | |
| 7044 | // |------------------------>| | |
| 7045 | // | RESTSubResp2 | | |
| 7046 | // |<------------------------| | |
| 7047 | // | | | | |
| 7048 | // | | | SubReq2 | |
| 7049 | // | | |------------->| |
| 7050 | // | | | | |
| 7051 | // | | | SubResp1 | |
| 7052 | // | | |<-------------| |
| 7053 | // | | RESTNotif1 | | |
| 7054 | // | |<-------------| | |
| 7055 | // | | | | |
| 7056 | // | | | SubResp2 | |
| 7057 | // | | |<-------------| |
| 7058 | // | RESTNotif2 | | |
| 7059 | // |<------------------------| | |
| 7060 | // | | | | |
| 7061 | // | | [SUBS 1 DELETE] | |
| 7062 | // | | | | |
| 7063 | // | | [SUBS 2 DELETE] | |
| 7064 | // | | | | |
| 7065 | // |
| 7066 | //----------------------------------------------------------------------------- |
| 7067 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7068 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7069 | |
| 7070 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7071 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7072 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7073 | Counter{cSubReqToE2, 2}, |
| 7074 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7075 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7076 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7077 | Counter{cSubDelReqToE2, 2}, |
| 7078 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7079 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7080 | }) |
| 7081 | |
| 7082 | // Req1 |
| 7083 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7084 | |
| 7085 | //Subs Create |
| 7086 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7087 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7088 | |
| 7089 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7090 | |
| 7091 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7092 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7093 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7094 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7095 | params.SetSubActionDefinition(actionDefinition) |
| 7096 | |
| 7097 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7098 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7099 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7100 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7101 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7102 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7103 | |
| 7104 | deleteXapp1Subscription(t, &restSubId1) |
| 7105 | deleteXapp2Subscription(t, &restSubId2) |
| 7106 | |
| 7107 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7108 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7109 | |
| 7110 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7111 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7112 | } |
| 7113 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7114 | //----------------------------------------------------------------------------- |
| 7115 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 7116 | // |
| 7117 | // stub stub stub |
| 7118 | // +-------+ +-------+ +---------+ +---------+ |
| 7119 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7120 | // +-------+ +-------+ +---------+ +---------+ |
| 7121 | // | | | | |
| 7122 | // | | RESTSubReq1 | | |
| 7123 | // | |------------->| | |
| 7124 | // | | RESTSubResp1 | | |
| 7125 | // | |<-------------| | |
| 7126 | // | | | | |
| 7127 | // | | | SubReq1 | |
| 7128 | // | | |------------->| |
| 7129 | // | | | | |
| 7130 | // | RESTSubReq2 | | |
| 7131 | // |------------------------>| | |
| 7132 | // | RESTSubResp2 | | |
| 7133 | // |<------------------------| | |
| 7134 | // | | | | |
| 7135 | // | | | SubReq2 | |
| 7136 | // | | |------------->| |
| 7137 | // | | | | |
| 7138 | // | | | SubResp1 | |
| 7139 | // | | |<-------------| |
| 7140 | // | | RESTNotif1 | | |
| 7141 | // | |<-------------| | |
| 7142 | // | | | | |
| 7143 | // | | | SubResp2 | |
| 7144 | // | | |<-------------| |
| 7145 | // | RESTNotif2 | | |
| 7146 | // |<------------------------| | |
| 7147 | // | | | | |
| 7148 | // | | [SUBS 1 DELETE] | |
| 7149 | // | | | | |
| 7150 | // | | [SUBS 2 DELETE] | |
| 7151 | // | | | | |
| 7152 | // |
| 7153 | //----------------------------------------------------------------------------- |
| 7154 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7155 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7156 | |
| 7157 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7158 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7159 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7160 | Counter{cSubReqToE2, 2}, |
| 7161 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7162 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7163 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7164 | Counter{cSubDelReqToE2, 2}, |
| 7165 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7166 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7167 | }) |
| 7168 | |
| 7169 | // Req1 |
| 7170 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7171 | |
| 7172 | //Subs Create |
| 7173 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7174 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7175 | |
| 7176 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7177 | |
| 7178 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7179 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7180 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7181 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7182 | params.SetSubActionDefinition(actionDefinition) |
| 7183 | |
| 7184 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7185 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7186 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7187 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7188 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7189 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7190 | |
| 7191 | deleteXapp1Subscription(t, &restSubId1) |
| 7192 | deleteXapp2Subscription(t, &restSubId2) |
| 7193 | |
| 7194 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7195 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7196 | |
| 7197 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7198 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7199 | } |
| 7200 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7201 | //----------------------------------------------------------------------------- |
| 7202 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7203 | // |
| 7204 | // stub stub stub |
| 7205 | // +-------+ +-------+ +---------+ +---------+ |
| 7206 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7207 | // +-------+ +-------+ +---------+ +---------+ |
| 7208 | // | | | | |
| 7209 | // | | RESTSubReq1 | | |
| 7210 | // | |------------->| | |
| 7211 | // | | RESTSubResp1 | | |
| 7212 | // | |<-------------| | |
| 7213 | // | | | | |
| 7214 | // | | | SubReq1 | |
| 7215 | // | | |------------->| |
| 7216 | // | | | | |
| 7217 | // | RESTSubReq2 | | |
| 7218 | // |------------------------>| | |
| 7219 | // | RESTSubResp2 | | |
| 7220 | // |<------------------------| | |
| 7221 | // | | | | |
| 7222 | // | | | SubReq2 | |
| 7223 | // | | |------------->| |
| 7224 | // | | | | |
| 7225 | // | | | SubResp1 | |
| 7226 | // | | |<-------------| |
| 7227 | // | | RESTNotif1 | | |
| 7228 | // | |<-------------| | |
| 7229 | // | | | | |
| 7230 | // | | | SubResp2 | |
| 7231 | // | | |<-------------| |
| 7232 | // | RESTNotif2 | | |
| 7233 | // |<------------------------| | |
| 7234 | // | | | | |
| 7235 | // | | [SUBS 1 DELETE] | |
| 7236 | // | | | | |
| 7237 | // | | [SUBS 2 DELETE] | |
| 7238 | // | | | | |
| 7239 | // |
| 7240 | //----------------------------------------------------------------------------- |
| 7241 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7242 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7243 | |
| 7244 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7245 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7246 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7247 | Counter{cSubReqToE2, 2}, |
| 7248 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7249 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7250 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7251 | Counter{cSubDelReqToE2, 2}, |
| 7252 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7253 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7254 | }) |
| 7255 | |
| 7256 | // Req1 |
| 7257 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7258 | |
| 7259 | //Subs Create |
| 7260 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7261 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7262 | |
| 7263 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7264 | |
| 7265 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7266 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7267 | params.SetMeid("RAN_NAME_1") |
| 7268 | params.SetTimeToWait("w200ms") |
| 7269 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7270 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7271 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7272 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7273 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7274 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7275 | |
| 7276 | deleteXapp1Subscription(t, &restSubId1) |
| 7277 | deleteXapp2Subscription(t, &restSubId2) |
| 7278 | |
| 7279 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7280 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7281 | |
| 7282 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7283 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7284 | } |
| 7285 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7286 | //----------------------------------------------------------------------------- |
| 7287 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7288 | // |
| 7289 | // stub stub |
| 7290 | // +-------+ +---------+ +---------+ |
| 7291 | // | xapp | | submgr | | e2term | |
| 7292 | // +-------+ +---------+ +---------+ |
| 7293 | // | | | |
| 7294 | // | RestSubReq | | |
| 7295 | // |---------------->| | |
| 7296 | // | | | |
| 7297 | // | RESTSubResp | | |
| 7298 | // |<----------------| | |
| 7299 | // | | | |
| 7300 | // | | SubReq | |
| 7301 | // | |------------->| |
| 7302 | // | | | |
| 7303 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7304 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7305 | // | | | |
| 7306 | // | | SubReq | |
| 7307 | // | |------------->| |
| 7308 | // | | | |
| 7309 | // | | SubFail | Duplicated action |
| 7310 | // | |<-------------| |
| 7311 | // | RESTNotif (fail)| | |
| 7312 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7313 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7314 | // | [SUBS DELETE] | |
| 7315 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7316 | // |
| 7317 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7318 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7319 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7320 | |
| 7321 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7322 | Counter{cRestSubReqFromXapp, 1}, |
| 7323 | Counter{cRestSubRespToXapp, 1}, |
| 7324 | Counter{cSubReqToE2, 1}, |
| 7325 | Counter{cSubReqTimerExpiry, 1}, |
| 7326 | Counter{cSubReReqToE2, 1}, |
| 7327 | Counter{cSubRespFromE2, 1}, |
| 7328 | Counter{cSubFailFromE2, 1}, |
| 7329 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7330 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7331 | Counter{cRestSubDelRespToXapp, 1}, |
| 7332 | }) |
| 7333 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7334 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7335 | |
| 7336 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7337 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7338 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7339 | |
| 7340 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7341 | // Decode of this response fails which will result resending original request |
| 7342 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7343 | |
| 7344 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7345 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7346 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7347 | |
| 7348 | // Subscription already created in E2 Node. |
| 7349 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7350 | fparams.Set(crereq) |
| 7351 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7352 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7353 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7354 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7355 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7356 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7357 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7358 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7359 | // Wait that subs is cleaned |
| 7360 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7361 | |
| 7362 | xappConn1.TestMsgChanEmpty(t) |
| 7363 | e2termConn1.TestMsgChanEmpty(t) |
| 7364 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7365 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7366 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7367 | } |
| 7368 | |
| 7369 | //----------------------------------------------------------------------------- |
| 7370 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7371 | // |
| 7372 | // stub stub |
| 7373 | // +-------+ +---------+ +---------+ |
| 7374 | // | xapp | | submgr | | e2term | |
| 7375 | // +-------+ +---------+ +---------+ |
| 7376 | // | | | |
| 7377 | // | RestSubReq | | |
| 7378 | // |---------------->| | |
| 7379 | // | | | |
| 7380 | // | RESTSubResp | | |
| 7381 | // |<----------------| | |
| 7382 | // | | | |
| 7383 | // | | SubReq | |
| 7384 | // | |------------->| |
| 7385 | // | | | |
| 7386 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7387 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7388 | // | | | |
| 7389 | // | | SubReq | |
| 7390 | // | |------------->| |
| 7391 | // | | | |
| 7392 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7393 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7394 | // | RESTNotif (fail)| | |
| 7395 | // |<----------------| | |
| 7396 | // | | SubDelReq | |
| 7397 | // | |------------->| |
| 7398 | // | | | |
| 7399 | // | | SubDelResp | |
| 7400 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7401 | // | | | |
| 7402 | // | [SUBS DELETE] | |
| 7403 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7404 | // |
| 7405 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7406 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7407 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7408 | |
| 7409 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7410 | Counter{cRestSubReqFromXapp, 1}, |
| 7411 | Counter{cRestSubRespToXapp, 1}, |
| 7412 | Counter{cSubReqToE2, 1}, |
| 7413 | Counter{cSubReqTimerExpiry, 2}, |
| 7414 | Counter{cSubReReqToE2, 1}, |
| 7415 | Counter{cSubRespFromE2, 1}, |
| 7416 | Counter{cSubFailFromE2, 1}, |
| 7417 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7418 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7419 | Counter{cRestSubDelRespToXapp, 1}, |
| 7420 | Counter{cSubDelReqToE2, 1}, |
| 7421 | Counter{cSubDelRespFromE2, 1}, |
| 7422 | }) |
| 7423 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7424 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7425 | |
| 7426 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7427 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7428 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7429 | |
| 7430 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7431 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7432 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7433 | orgInstanceId := crereq.RequestId.InstanceId |
| 7434 | crereq.RequestId.InstanceId = 0 |
| 7435 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7436 | |
| 7437 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7438 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7439 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7440 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7441 | // 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] | 7442 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7443 | fparams.Set(crereq) |
| 7444 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7445 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7446 | |
| 7447 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7448 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7449 | |
| 7450 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7451 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7452 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7453 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7454 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7455 | // Wait that subs is cleaned |
| 7456 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7457 | |
| 7458 | xappConn1.TestMsgChanEmpty(t) |
| 7459 | e2termConn1.TestMsgChanEmpty(t) |
| 7460 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7461 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7462 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7463 | } |
| 7464 | |
| 7465 | //----------------------------------------------------------------------------- |
| 7466 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7467 | // |
| 7468 | // stub stub |
| 7469 | // +-------+ +---------+ +---------+ |
| 7470 | // | xapp | | submgr | | e2term | |
| 7471 | // +-------+ +---------+ +---------+ |
| 7472 | // | | | |
| 7473 | // | RestSubReq | | |
| 7474 | // |---------------->| | |
| 7475 | // | | | |
| 7476 | // | RESTSubResp | | |
| 7477 | // |<----------------| | |
| 7478 | // | | | |
| 7479 | // | | SubReq | |
| 7480 | // | |------------->| |
| 7481 | // | | | |
| 7482 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7483 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7484 | // | | | |
| 7485 | // | | SubReq | |
| 7486 | // | |------------->| |
| 7487 | // | | | |
| 7488 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7489 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7490 | // | RESTNotif (fail)| | |
| 7491 | // |<----------------| | |
| 7492 | // | | SubDelReq | |
| 7493 | // | |------------->| |
| 7494 | // | | | |
| 7495 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7496 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7497 | // | | | |
| 7498 | // | | SubDelReq | |
| 7499 | // | |------------->| |
| 7500 | // | | | |
| 7501 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7502 | // | |<-------------| Ongoing transaction not found. |
| 7503 | // | | | |
| 7504 | // | [SUBS DELETE] | |
| 7505 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7506 | // |
| 7507 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7508 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7509 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7510 | |
| 7511 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7512 | Counter{cRestSubReqFromXapp, 1}, |
| 7513 | Counter{cRestSubRespToXapp, 1}, |
| 7514 | Counter{cSubReqToE2, 1}, |
| 7515 | Counter{cSubReqTimerExpiry, 2}, |
| 7516 | Counter{cSubReReqToE2, 1}, |
| 7517 | Counter{cSubRespFromE2, 1}, |
| 7518 | Counter{cSubFailFromE2, 1}, |
| 7519 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7520 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7521 | Counter{cRestSubDelRespToXapp, 1}, |
| 7522 | Counter{cSubDelReqToE2, 1}, |
| 7523 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7524 | Counter{cSubDelReReqToE2, 1}, |
| 7525 | Counter{cSubDelRespFromE2, 2}, |
| 7526 | }) |
| 7527 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7528 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7529 | |
| 7530 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7531 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7532 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7533 | |
| 7534 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7535 | |
| 7536 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7537 | // No transaction exist for this response which will result resending original request |
| 7538 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7539 | |
| 7540 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7541 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7542 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7543 | |
| 7544 | // Subscription already created in E2 Node. |
| 7545 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7546 | fparams.Set(crereq) |
| 7547 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7548 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7549 | |
| 7550 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7551 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7552 | |
| 7553 | // Resending happens because there no transaction |
| 7554 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7555 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7556 | |
| 7557 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7558 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7559 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7560 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7561 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7562 | // Wait that subs is cleaned |
| 7563 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7564 | |
| 7565 | xappConn1.TestMsgChanEmpty(t) |
| 7566 | e2termConn1.TestMsgChanEmpty(t) |
| 7567 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7568 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7569 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7570 | } |
| 7571 | |
| 7572 | //----------------------------------------------------------------------------- |
| 7573 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7574 | // |
| 7575 | // stub stub |
| 7576 | // +-------+ +---------+ +---------+ |
| 7577 | // | xapp | | submgr | | e2term | |
| 7578 | // +-------+ +---------+ +---------+ |
| 7579 | // | | | |
| 7580 | // | RestSubReq | | |
| 7581 | // |---------------->| | |
| 7582 | // | | | |
| 7583 | // | RESTSubResp | | |
| 7584 | // |<----------------| | |
| 7585 | // | | | |
| 7586 | // | | SubReq | |
| 7587 | // | |------------->| |
| 7588 | // | | | |
| 7589 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7590 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7591 | // | | | |
| 7592 | // | | SubReq | |
| 7593 | // | |------------->| |
| 7594 | // | | | |
| 7595 | // | | SubFail | Duplicated action |
| 7596 | // | |<-------------| |
| 7597 | // | RESTNotif (fail)| | |
| 7598 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7599 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7600 | // | [SUBS DELETE] | |
| 7601 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7602 | // |
| 7603 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7604 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7605 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7606 | |
| 7607 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7608 | Counter{cRestSubReqFromXapp, 1}, |
| 7609 | Counter{cRestSubRespToXapp, 1}, |
| 7610 | Counter{cSubReqToE2, 1}, |
| 7611 | Counter{cSubReqTimerExpiry, 1}, |
| 7612 | Counter{cSubReReqToE2, 1}, |
| 7613 | Counter{cSubFailFromE2, 2}, |
| 7614 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7615 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7616 | Counter{cRestSubDelRespToXapp, 1}, |
| 7617 | }) |
| 7618 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7619 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7620 | |
| 7621 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7622 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7623 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7624 | |
| 7625 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7626 | |
| 7627 | // Decode of this response fails which will result resending original request |
| 7628 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7629 | |
| 7630 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7631 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7632 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7633 | |
| 7634 | // Subscription already created in E2 Node. |
| 7635 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7636 | fparams.Set(crereq) |
| 7637 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7638 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7639 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7640 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7641 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7642 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7643 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7644 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7645 | // Wait that subs is cleaned |
| 7646 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7647 | |
| 7648 | xappConn1.TestMsgChanEmpty(t) |
| 7649 | e2termConn1.TestMsgChanEmpty(t) |
| 7650 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7651 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7652 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7653 | } |
| 7654 | |
| 7655 | //----------------------------------------------------------------------------- |
| 7656 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7657 | // |
| 7658 | // stub stub |
| 7659 | // +-------+ +---------+ +---------+ |
| 7660 | // | xapp | | submgr | | e2term | |
| 7661 | // +-------+ +---------+ +---------+ |
| 7662 | // | | | |
| 7663 | // | RestSubReq | | |
| 7664 | // |---------------->| | |
| 7665 | // | | | |
| 7666 | // | RESTSubResp | | |
| 7667 | // |<----------------| | |
| 7668 | // | | | |
| 7669 | // | | SubReq | |
| 7670 | // | |------------->| |
| 7671 | // | | | |
| 7672 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7673 | // | |<-------------| 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] | 7674 | // | | | |
| 7675 | // | | SubReq | |
| 7676 | // | |------------->| |
| 7677 | // | | | |
| 7678 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7679 | // | |<-------------|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] | 7680 | // | RESTNotif (fail)| | |
| 7681 | // |<----------------| | |
| 7682 | // | | SubDelReq | |
| 7683 | // | |------------->| |
| 7684 | // | | | |
| 7685 | // | | SubDelResp | |
| 7686 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7687 | // | | | |
| 7688 | // | [SUBS DELETE] | |
| 7689 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7690 | // |
| 7691 | //----------------------------------------------------------------------------- |
| 7692 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7693 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7694 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7695 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7696 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7697 | Counter{cRestSubReqFromXapp, 1}, |
| 7698 | Counter{cRestSubRespToXapp, 1}, |
| 7699 | Counter{cSubReqToE2, 1}, |
| 7700 | Counter{cSubReqTimerExpiry, 2}, |
| 7701 | Counter{cSubReReqToE2, 1}, |
| 7702 | Counter{cSubFailFromE2, 2}, |
| 7703 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7704 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7705 | Counter{cRestSubDelRespToXapp, 1}, |
| 7706 | Counter{cSubDelReqToE2, 1}, |
| 7707 | Counter{cSubDelRespFromE2, 1}, |
| 7708 | }) |
| 7709 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7710 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7711 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7712 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7713 | |
| 7714 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7715 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7716 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7717 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7718 | fparams.Set(crereq) |
| 7719 | fparams.Fail.RequestId.InstanceId = 0 |
| 7720 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7721 | |
| 7722 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7723 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7724 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7725 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7726 | // 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] | 7727 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7728 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7729 | |
| 7730 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7731 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7732 | |
| 7733 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7734 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7735 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7736 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7737 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7738 | // Wait that subs is cleaned |
| 7739 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7740 | |
| 7741 | xappConn1.TestMsgChanEmpty(t) |
| 7742 | e2termConn1.TestMsgChanEmpty(t) |
| 7743 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7744 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7745 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7746 | } |
| 7747 | |
| 7748 | //----------------------------------------------------------------------------- |
| 7749 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7750 | // |
| 7751 | // stub stub |
| 7752 | // +-------+ +---------+ +---------+ |
| 7753 | // | xapp | | submgr | | e2term | |
| 7754 | // +-------+ +---------+ +---------+ |
| 7755 | // | | | |
| 7756 | // | RestSubReq | | |
| 7757 | // |---------------->| | |
| 7758 | // | | | |
| 7759 | // | RESTSubResp | | |
| 7760 | // |<----------------| | |
| 7761 | // | | | |
| 7762 | // | | SubReq | |
| 7763 | // | |------------->| |
| 7764 | // | | | |
| 7765 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7766 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7767 | // | | | |
| 7768 | // | | SubReq | |
| 7769 | // | |------------->| |
| 7770 | // | | | |
| 7771 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7772 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7773 | // | RESTNotif (fail)| | |
| 7774 | // |<----------------| | |
| 7775 | // | | SubDelReq | |
| 7776 | // | |------------->| |
| 7777 | // | | | |
| 7778 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7779 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7780 | // | | | |
| 7781 | // | | SubDelReq | |
| 7782 | // | |------------->| |
| 7783 | // | | | |
| 7784 | // | | SubDelResp | |
| 7785 | // | |<-------------| Ongoing transaction not found. |
| 7786 | // | | | |
| 7787 | // | [SUBS DELETE] | |
| 7788 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7789 | // |
| 7790 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7791 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7792 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7793 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7794 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7795 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7796 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7797 | Counter{cRestSubReqFromXapp, 1}, |
| 7798 | Counter{cRestSubRespToXapp, 1}, |
| 7799 | Counter{cSubReqToE2, 1}, |
| 7800 | Counter{cSubReqTimerExpiry, 2}, |
| 7801 | Counter{cSubReReqToE2, 1}, |
| 7802 | Counter{cSubFailFromE2, 2}, |
| 7803 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7804 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7805 | Counter{cRestSubDelRespToXapp, 1}, |
| 7806 | Counter{cSubDelReqToE2, 1}, |
| 7807 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7808 | Counter{cSubDelReReqToE2, 1}, |
| 7809 | Counter{cSubDelRespFromE2, 2}, |
| 7810 | }) |
| 7811 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7812 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7813 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7814 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7815 | |
| 7816 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7817 | |
| 7818 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7819 | |
| 7820 | // No transaction exist for this response which will result resending original request |
| 7821 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7822 | fparams.Set(crereq) |
| 7823 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7824 | |
| 7825 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7826 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7827 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7828 | |
| 7829 | // Subscription already created in E2 Node. |
| 7830 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7831 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7832 | |
| 7833 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7834 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7835 | |
| 7836 | // Resending happens because there no transaction |
| 7837 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7838 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7839 | |
| 7840 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7841 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7842 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7843 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7844 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7845 | // Wait that subs is cleaned |
| 7846 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7847 | |
| 7848 | xappConn1.TestMsgChanEmpty(t) |
| 7849 | e2termConn1.TestMsgChanEmpty(t) |
| 7850 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7851 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7852 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7853 | } |
| 7854 | |
| 7855 | //----------------------------------------------------------------------------- |
| 7856 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7857 | // |
| 7858 | // stub stub |
| 7859 | // +-------+ +---------+ +---------+ |
| 7860 | // | xapp | | submgr | | e2term | |
| 7861 | // +-------+ +---------+ +---------+ |
| 7862 | // | | | |
| 7863 | // | [SUBS CREATE] | |
| 7864 | // | | | |
| 7865 | // | | | |
| 7866 | // | RESTSubDelReq | | |
| 7867 | // |---------------->| | |
| 7868 | // | | | |
| 7869 | // | RESTSubDelResp | | |
| 7870 | // |<----------------| | |
| 7871 | // | | | |
| 7872 | // | | SubDelReq | |
| 7873 | // | |------------->| |
| 7874 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7875 | // | | SubDelResp | ASN.1 decode fails. |
| 7876 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7877 | // | | | |
| 7878 | // | | SubDelReq | |
| 7879 | // | |------------->| |
| 7880 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7881 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7882 | // | |<-------------| |
| 7883 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7884 | // | [SUBS DELETE] | |
| 7885 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7886 | // |
| 7887 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7888 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7889 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7890 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7891 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7892 | Counter{cRestSubReqFromXapp, 1}, |
| 7893 | Counter{cRestSubRespToXapp, 1}, |
| 7894 | Counter{cSubReqToE2, 1}, |
| 7895 | Counter{cSubRespFromE2, 1}, |
| 7896 | Counter{cRestSubNotifToXapp, 1}, |
| 7897 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7898 | Counter{cRestSubDelRespToXapp, 1}, |
| 7899 | Counter{cSubDelReqToE2, 1}, |
| 7900 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7901 | Counter{cSubDelReReqToE2, 1}, |
| 7902 | Counter{cSubDelFailFromE2, 1}, |
| 7903 | Counter{cSubDelRespFromE2, 1}, |
| 7904 | }) |
| 7905 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7906 | // Req |
| 7907 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7908 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7909 | |
| 7910 | // Del |
| 7911 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7912 | |
| 7913 | // E2t: Receive 1st SubsDelReq |
| 7914 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7915 | |
| 7916 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7917 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7918 | |
| 7919 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7920 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7921 | |
| 7922 | // Subscription does not exist in in E2 Node. |
| 7923 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7924 | |
| 7925 | // Wait that subs is cleaned |
| 7926 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7927 | |
| 7928 | xappConn1.TestMsgChanEmpty(t) |
| 7929 | e2termConn1.TestMsgChanEmpty(t) |
| 7930 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7931 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7932 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7933 | } |
| 7934 | |
| 7935 | //----------------------------------------------------------------------------- |
| 7936 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 7937 | // |
| 7938 | // stub stub |
| 7939 | // +-------+ +---------+ +---------+ |
| 7940 | // | xapp | | submgr | | e2term | |
| 7941 | // +-------+ +---------+ +---------+ |
| 7942 | // | | | |
| 7943 | // | [SUBS CREATE] | |
| 7944 | // | | | |
| 7945 | // | | | |
| 7946 | // | RESTSubDelReq | | |
| 7947 | // |---------------->| | |
| 7948 | // | | | |
| 7949 | // | RESTSubDelResp | | |
| 7950 | // |<----------------| | |
| 7951 | // | | | |
| 7952 | // | | SubDelReq | |
| 7953 | // | |------------->| |
| 7954 | // | | | |
| 7955 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7956 | // | |<-------------| 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] | 7957 | // | | | |
| 7958 | // | | SubDelReq | |
| 7959 | // | |------------->| |
| 7960 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7961 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7962 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7963 | // | | | |
| 7964 | // | [SUBS DELETE] | |
| 7965 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7966 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7967 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7968 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7969 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7970 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7971 | Counter{cRestSubReqFromXapp, 1}, |
| 7972 | Counter{cRestSubRespToXapp, 1}, |
| 7973 | Counter{cSubReqToE2, 1}, |
| 7974 | Counter{cSubRespFromE2, 1}, |
| 7975 | Counter{cRestSubNotifToXapp, 1}, |
| 7976 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7977 | Counter{cRestSubDelRespToXapp, 1}, |
| 7978 | Counter{cSubDelReqToE2, 1}, |
| 7979 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7980 | Counter{cSubDelReReqToE2, 1}, |
| 7981 | Counter{cSubDelRespFromE2, 1}, |
| 7982 | Counter{cSubDelFailFromE2, 1}, |
| 7983 | }) |
| 7984 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7985 | // Req |
| 7986 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7987 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7988 | |
| 7989 | // Del |
| 7990 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7991 | |
| 7992 | // E2t: Receive 1st SubsDelReq |
| 7993 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7994 | |
| 7995 | // Unknown instanceId in this response which will result resending original request |
| 7996 | delreq.RequestId.InstanceId = 0 |
| 7997 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7998 | |
| 7999 | // E2t: Receive 2nd SubsDelReq |
| 8000 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8001 | |
| 8002 | // Subscription does not exist in in E2 Node. |
| 8003 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8004 | |
| 8005 | // Wait that subs is cleaned |
| 8006 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8007 | |
| 8008 | xappConn1.TestMsgChanEmpty(t) |
| 8009 | e2termConn1.TestMsgChanEmpty(t) |
| 8010 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8011 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8012 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8013 | } |
| 8014 | |
| 8015 | //----------------------------------------------------------------------------- |
| 8016 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 8017 | // |
| 8018 | // stub stub |
| 8019 | // +-------+ +---------+ +---------+ |
| 8020 | // | xapp | | submgr | | e2term | |
| 8021 | // +-------+ +---------+ +---------+ |
| 8022 | // | | | |
| 8023 | // | [SUBS CREATE] | |
| 8024 | // | | | |
| 8025 | // | | | |
| 8026 | // | RESTSubDelReq | | |
| 8027 | // |---------------->| | |
| 8028 | // | | | |
| 8029 | // | RESTSubDelResp | | |
| 8030 | // |<----------------| | |
| 8031 | // | | | |
| 8032 | // | | SubDelReq | |
| 8033 | // | |------------->| |
| 8034 | // | | | |
| 8035 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8036 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8037 | // | | | |
| 8038 | // | | SubDelReq | |
| 8039 | // | |------------->| |
| 8040 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8041 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8042 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8043 | // | | | |
| 8044 | // | [SUBS DELETE] | |
| 8045 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8046 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8047 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8048 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8049 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8050 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8051 | Counter{cRestSubReqFromXapp, 1}, |
| 8052 | Counter{cRestSubRespToXapp, 1}, |
| 8053 | Counter{cSubReqToE2, 1}, |
| 8054 | Counter{cSubRespFromE2, 1}, |
| 8055 | Counter{cRestSubNotifToXapp, 1}, |
| 8056 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8057 | Counter{cRestSubDelRespToXapp, 1}, |
| 8058 | Counter{cSubDelReqToE2, 1}, |
| 8059 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8060 | Counter{cSubDelReReqToE2, 1}, |
| 8061 | Counter{cSubDelRespFromE2, 1}, |
| 8062 | Counter{cSubDelFailFromE2, 1}, |
| 8063 | }) |
| 8064 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8065 | // Req |
| 8066 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8067 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8068 | |
| 8069 | // Del |
| 8070 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8071 | |
| 8072 | // E2t: Receive 1st SubsDelReq |
| 8073 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8074 | |
| 8075 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8076 | |
| 8077 | // No transaction exist for this response which will result resending original request |
| 8078 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8079 | |
| 8080 | // E2t: Receive 2nd SubsDelReq |
| 8081 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8082 | |
| 8083 | // Subscription does not exist in in E2 Node. |
| 8084 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8085 | |
| 8086 | // Wait that subs is cleaned |
| 8087 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8088 | |
| 8089 | xappConn1.TestMsgChanEmpty(t) |
| 8090 | e2termConn1.TestMsgChanEmpty(t) |
| 8091 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8092 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8093 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8094 | } |
| 8095 | |
| 8096 | //----------------------------------------------------------------------------- |
| 8097 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 8098 | // |
| 8099 | // stub stub |
| 8100 | // +-------+ +---------+ +---------+ |
| 8101 | // | xapp | | submgr | | e2term | |
| 8102 | // +-------+ +---------+ +---------+ |
| 8103 | // | | | |
| 8104 | // | [SUBS CREATE] | |
| 8105 | // | | | |
| 8106 | // | | | |
| 8107 | // | RESTSubDelReq | | |
| 8108 | // |---------------->| | |
| 8109 | // | | | |
| 8110 | // | RESTSubDelResp | | |
| 8111 | // |<----------------| | |
| 8112 | // | | | |
| 8113 | // | | SubDelReq | |
| 8114 | // | |------------->| |
| 8115 | // | | | |
| 8116 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8117 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8118 | // | | | |
| 8119 | // | | SubDelReq | |
| 8120 | // | |------------->| |
| 8121 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8122 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8123 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8124 | // | | | |
| 8125 | // | [SUBS DELETE] | |
| 8126 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8127 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8128 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8129 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8130 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8131 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8132 | Counter{cRestSubReqFromXapp, 1}, |
| 8133 | Counter{cRestSubRespToXapp, 1}, |
| 8134 | Counter{cSubReqToE2, 1}, |
| 8135 | Counter{cSubRespFromE2, 1}, |
| 8136 | Counter{cRestSubNotifToXapp, 1}, |
| 8137 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8138 | Counter{cRestSubDelRespToXapp, 1}, |
| 8139 | Counter{cSubDelReqToE2, 1}, |
| 8140 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8141 | Counter{cSubDelReReqToE2, 1}, |
| 8142 | Counter{cSubDelFailFromE2, 2}, |
| 8143 | }) |
| 8144 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8145 | // Req |
| 8146 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8147 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8148 | |
| 8149 | // Del |
| 8150 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8151 | |
| 8152 | // E2t: Receive 1st SubsDelReq |
| 8153 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8154 | |
| 8155 | // Decode of this response fails which will result resending original request |
| 8156 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 8157 | |
| 8158 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8159 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8160 | |
| 8161 | // Subscription does not exist in in E2 Node. |
| 8162 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8163 | |
| 8164 | // Wait that subs is cleaned |
| 8165 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8166 | |
| 8167 | xappConn1.TestMsgChanEmpty(t) |
| 8168 | e2termConn1.TestMsgChanEmpty(t) |
| 8169 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8170 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8171 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8172 | } |
| 8173 | |
| 8174 | //----------------------------------------------------------------------------- |
| 8175 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8176 | // |
| 8177 | // stub stub |
| 8178 | // +-------+ +---------+ +---------+ |
| 8179 | // | xapp | | submgr | | e2term | |
| 8180 | // +-------+ +---------+ +---------+ |
| 8181 | // | | | |
| 8182 | // | [SUBS CREATE] | |
| 8183 | // | | | |
| 8184 | // | | | |
| 8185 | // | RESTSubDelReq | | |
| 8186 | // |---------------->| | |
| 8187 | // | | | |
| 8188 | // | RESTSubDelResp | | |
| 8189 | // |<----------------| | |
| 8190 | // | | | |
| 8191 | // | | SubDelReq | |
| 8192 | // | |------------->| |
| 8193 | // | | | |
| 8194 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8195 | // | |<-------------| 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] | 8196 | // | | | |
| 8197 | // | | SubDelReq | |
| 8198 | // | |------------->| |
| 8199 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8200 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8201 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8202 | // | | | |
| 8203 | // | [SUBS DELETE] | |
| 8204 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8205 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8206 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8207 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8208 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8209 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8210 | Counter{cRestSubReqFromXapp, 1}, |
| 8211 | Counter{cRestSubRespToXapp, 1}, |
| 8212 | Counter{cSubReqToE2, 1}, |
| 8213 | Counter{cSubRespFromE2, 1}, |
| 8214 | Counter{cRestSubNotifToXapp, 1}, |
| 8215 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8216 | Counter{cRestSubDelRespToXapp, 1}, |
| 8217 | Counter{cSubDelReqToE2, 1}, |
| 8218 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8219 | Counter{cSubDelReReqToE2, 1}, |
| 8220 | Counter{cSubDelFailFromE2, 2}, |
| 8221 | }) |
| 8222 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8223 | // Req |
| 8224 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8225 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8226 | |
| 8227 | // Del |
| 8228 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8229 | |
| 8230 | // E2t: Receive 1st SubsDelReq |
| 8231 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8232 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8233 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8234 | delreq.RequestId.InstanceId = 0 |
| 8235 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8236 | |
| 8237 | // E2t: Receive 2nd SubsDelReq |
| 8238 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8239 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8240 | // 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] | 8241 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8242 | |
| 8243 | // Wait that subs is cleaned |
| 8244 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8245 | |
| 8246 | xappConn1.TestMsgChanEmpty(t) |
| 8247 | e2termConn1.TestMsgChanEmpty(t) |
| 8248 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8249 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8250 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8251 | } |
| 8252 | |
| 8253 | //----------------------------------------------------------------------------- |
| 8254 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8255 | // |
| 8256 | // stub stub |
| 8257 | // +-------+ +---------+ +---------+ |
| 8258 | // | xapp | | submgr | | e2term | |
| 8259 | // +-------+ +---------+ +---------+ |
| 8260 | // | | | |
| 8261 | // | [SUBS CREATE] | |
| 8262 | // | | | |
| 8263 | // | | | |
| 8264 | // | RESTSubDelReq | | |
| 8265 | // |---------------->| | |
| 8266 | // | | | |
| 8267 | // | RESTSubDelResp | | |
| 8268 | // |<----------------| | |
| 8269 | // | | | |
| 8270 | // | | SubDelReq | |
| 8271 | // | |------------->| |
| 8272 | // | | | |
| 8273 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8274 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8275 | // | | | |
| 8276 | // | | SubDelReq | |
| 8277 | // | |------------->| |
| 8278 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8279 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8280 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8281 | // | | | |
| 8282 | // | [SUBS DELETE] | |
| 8283 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8284 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8285 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8286 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8287 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8288 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8289 | Counter{cRestSubReqFromXapp, 1}, |
| 8290 | Counter{cRestSubRespToXapp, 1}, |
| 8291 | Counter{cSubReqToE2, 1}, |
| 8292 | Counter{cSubRespFromE2, 1}, |
| 8293 | Counter{cRestSubNotifToXapp, 1}, |
| 8294 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8295 | Counter{cRestSubDelRespToXapp, 1}, |
| 8296 | Counter{cSubDelReqToE2, 1}, |
| 8297 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8298 | Counter{cSubDelReReqToE2, 1}, |
| 8299 | Counter{cSubDelFailFromE2, 2}, |
| 8300 | }) |
| 8301 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8302 | // Req |
| 8303 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8304 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8305 | |
| 8306 | // Del |
| 8307 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8308 | |
| 8309 | // E2t: Receive 1st SubsDelReq |
| 8310 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8311 | |
| 8312 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8313 | |
| 8314 | // No transaction exist for this response which will result resending original request |
| 8315 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8316 | |
| 8317 | // E2t: Receive 2nd SubsDelReq |
| 8318 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8319 | |
| 8320 | // Subscription does not exist in in E2 Node. |
| 8321 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8322 | |
| 8323 | // Wait that subs is cleaned |
| 8324 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8325 | |
| 8326 | xappConn1.TestMsgChanEmpty(t) |
| 8327 | e2termConn1.TestMsgChanEmpty(t) |
| 8328 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8329 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8330 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8331 | } |
| 8332 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8333 | //----------------------------------------------------------------------------- |
| 8334 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8335 | // |
| 8336 | // stub stub |
| 8337 | // +-------+ +---------+ +---------+ |
| 8338 | // | xapp | | submgr | | e2term | |
| 8339 | // +-------+ +---------+ +---------+ |
| 8340 | // | | | |
| 8341 | // | RESTSubReq | | |
| 8342 | // |---------------->| | |
| 8343 | // | | | |
| 8344 | // | RESTSubResp | | |
| 8345 | // |<----------------| | |
| 8346 | // | | | |
| 8347 | // | ASN.1 encode fails | |
| 8348 | // | | | |
| 8349 | // | | SubDelReq | |
| 8350 | // | |------------->| |
| 8351 | // | | | |
| 8352 | // | | SubDelFail | |
| 8353 | // | |<-------------| |
| 8354 | // | | | |
| 8355 | // | RESTNotif | | |
| 8356 | // | unsuccess | | |
| 8357 | // |<----------------| | |
| 8358 | // | | | |
| 8359 | // | [SUBS DELETE] | |
| 8360 | // | | | |
| 8361 | // |
| 8362 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8363 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8364 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8365 | |
| 8366 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8367 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8368 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8369 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8370 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8371 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8372 | }) |
| 8373 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8374 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8375 | |
| 8376 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8377 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8378 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8379 | |
| 8380 | // Req |
| 8381 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8382 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8383 | |
| 8384 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8385 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8386 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8387 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8388 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8389 | |
| 8390 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8391 | |
| 8392 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8393 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8394 | // Wait that subs is cleaned |
| 8395 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8396 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8397 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8398 | } |
| 8399 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8400 | //----------------------------------------------------------------------------- |
| 8401 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8402 | // |
| 8403 | // stub stub |
| 8404 | // +-------+ +---------+ +---------+ |
| 8405 | // | xapp | | submgr | | e2term | |
| 8406 | // +-------+ +---------+ +---------+ |
| 8407 | // | | | |
| 8408 | // | RESTSubReq | | |
| 8409 | // |---------------->| | |
| 8410 | // | | | |
| 8411 | // | RESTSubResp | | |
| 8412 | // |<----------------| | |
| 8413 | // | | SubReq | |
| 8414 | // | |------------->| |
| 8415 | // | | | |
| 8416 | // | | SubResp | |
| 8417 | // | |<-------------| |
| 8418 | // | | | |
| 8419 | // | RESTNotif | | |
| 8420 | // |<----------------| | |
| 8421 | // | | | |
| 8422 | // | RESTSubReq | | Policy modification |
| 8423 | // |---------------->| | |
| 8424 | // | | | |
| 8425 | // | RESTSubResp | | |
| 8426 | // |<----------------| | |
| 8427 | // | | SubReq | |
| 8428 | // | |------------->| |
| 8429 | // | | | |
| 8430 | // | | | |
| 8431 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8432 | // |<----------------| | |
| 8433 | // | | | |
| 8434 | // | RESTSubDelReq | | |
| 8435 | // |---------------->| | |
| 8436 | // | | | |
| 8437 | // | | SubDelReq | |
| 8438 | // | |------------->| |
| 8439 | // | | | |
| 8440 | // | | SubDelResp | |
| 8441 | // | |<-------------| |
| 8442 | // | | | |
| 8443 | // | RESTSubDelResp | | |
| 8444 | // |<----------------| | |
| 8445 | // |
| 8446 | //----------------------------------------------------------------------------- |
| 8447 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8448 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8449 | |
| 8450 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8451 | Counter{cRestSubReqFromXapp, 2}, |
| 8452 | Counter{cRestSubRespToXapp, 2}, |
| 8453 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8454 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8455 | Counter{cSubRespFromE2, 1}, |
| 8456 | Counter{cRestSubNotifToXapp, 1}, |
| 8457 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8458 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8459 | Counter{cSubDelReqToE2, 1}, |
| 8460 | Counter{cSubDelRespFromE2, 1}, |
| 8461 | Counter{cRestSubDelRespToXapp, 1}, |
| 8462 | }) |
| 8463 | |
| 8464 | const e2Timeout int64 = 1 |
| 8465 | const e2RetryCount int64 = 0 |
| 8466 | const routingNeeded bool = false |
| 8467 | |
| 8468 | // Req1 |
| 8469 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8470 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8471 | |
| 8472 | // Subs Create |
| 8473 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8474 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8475 | |
| 8476 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8477 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8478 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8479 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8480 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8481 | |
| 8482 | // Policy change |
| 8483 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8484 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8485 | params.SetSubscriptionID(&restSubId) |
| 8486 | params.SetTimeToWait("w200ms") |
| 8487 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8488 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8489 | |
| 8490 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8491 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8492 | // SubsResp is missing, e2SubsId will be 0 |
| 8493 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8494 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8495 | |
| 8496 | // Del |
| 8497 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8498 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8499 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8500 | |
| 8501 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8502 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8503 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8504 | } |
| 8505 | |
| 8506 | //----------------------------------------------------------------------------- |
| 8507 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8508 | // |
| 8509 | // stub stub |
| 8510 | // +-------+ +---------+ +---------+ |
| 8511 | // | xapp | | submgr | | e2term | |
| 8512 | // +-------+ +---------+ +---------+ |
| 8513 | // | | | |
| 8514 | // | RESTSubReq | | |
| 8515 | // |---------------->| | |
| 8516 | // | | | |
| 8517 | // | RESTSubResp | | |
| 8518 | // |<----------------| | |
| 8519 | // | | SubReq | |
| 8520 | // | |------------->| |
| 8521 | // | | | |
| 8522 | // | | SubResp | |
| 8523 | // | |<-------------| |
| 8524 | // | | | |
| 8525 | // | RESTNotif | | |
| 8526 | // |<----------------| | |
| 8527 | // | | | |
| 8528 | // | RESTSubReq | | |
| 8529 | // |---------------->| | |
| 8530 | // | | | |
| 8531 | // | RESTSubResp | | |
| 8532 | // |<----------------| | |
| 8533 | // | | SubReq | |
| 8534 | // | |------------->| |
| 8535 | // | | |
| 8536 | // | Submgr restart | |
| 8537 | // | | | |
| 8538 | // | RESTSubDelReq | | |
| 8539 | // |---------------->| | |
| 8540 | // | | | |
| 8541 | // | | SubDelReq | |
| 8542 | // | |------------->| |
| 8543 | // | | | |
| 8544 | // | | SubDelResp | |
| 8545 | // | |<-------------| |
| 8546 | // | | | |
| 8547 | // | RESTSubDelResp | | |
| 8548 | // |<----------------| | |
| 8549 | // |
| 8550 | //----------------------------------------------------------------------------- |
| 8551 | |
| 8552 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8553 | |
| 8554 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8555 | Counter{cRestSubReqFromXapp, 2}, |
| 8556 | Counter{cRestSubRespToXapp, 2}, |
| 8557 | Counter{cSubReqToE2, 2}, |
| 8558 | Counter{cSubRespFromE2, 1}, |
| 8559 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8560 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8561 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8562 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8563 | Counter{cRestSubDelRespToXapp, 1}, |
| 8564 | }) |
| 8565 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8566 | const e2Timeout int64 = 1 |
| 8567 | const e2RetryCount int64 = 0 |
| 8568 | const routingNeeded bool = false |
| 8569 | |
| 8570 | // Req1 |
| 8571 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8572 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8573 | // Create subscription |
| 8574 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8575 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8576 | |
| 8577 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8578 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8579 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8580 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8581 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8582 | |
| 8583 | // Check subscription |
| 8584 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8585 | |
| 8586 | // Policy change |
| 8587 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8588 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8589 | params.SetSubscriptionID(&restSubId) |
| 8590 | params.SetTimeToWait("w200ms") |
| 8591 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8592 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8593 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8594 | |
| 8595 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8596 | mainCtrl.SetResetTestFlag(t, false) |
| 8597 | |
| 8598 | // SubsResp is missing due to submgr restart |
| 8599 | |
| 8600 | mainCtrl.SimulateRestart(t) |
| 8601 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8602 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8603 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8604 | // That needs to be completed before successful subscription query is possible |
| 8605 | <-time.After(time.Second * 1) |
| 8606 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8607 | // Check subscription |
| 8608 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8609 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8610 | // Delete subscription |
| 8611 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8612 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8613 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8614 | |
| 8615 | //Wait that subs is cleaned |
| 8616 | waitSubsCleanup(t, e2SubsId, 10) |
| 8617 | |
| 8618 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8619 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8620 | } |
| 8621 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8622 | //////////////////////////////////////////////////////////////////////////////////// |
| 8623 | // Services for UT cases |
| 8624 | //////////////////////////////////////////////////////////////////////////////////// |
| 8625 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8626 | const host string = "localhost" |
| 8627 | |
| 8628 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8629 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8630 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8631 | } |
| 8632 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8633 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8634 | |
| 8635 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8636 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8637 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8638 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8639 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8640 | |
| 8641 | return restSubId, e2SubsId |
| 8642 | } |
| 8643 | |
| 8644 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8645 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8646 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8647 | if meid != "" { |
| 8648 | params.SetMeid(meid) |
| 8649 | } |
| 8650 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8651 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8652 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8653 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8654 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8655 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8656 | |
| 8657 | return restSubId, e2SubsId |
| 8658 | } |
| 8659 | |
| 8660 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8661 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8662 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8663 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8664 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8665 | |
| 8666 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8667 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8668 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8669 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8670 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8671 | |
| 8672 | return restSubId, e2SubsId |
| 8673 | } |
| 8674 | |
| 8675 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8676 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8677 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8678 | |
| 8679 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8680 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8681 | fparams1.Set(crereq1) |
| 8682 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8683 | |
| 8684 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8685 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8686 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8687 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8688 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8689 | |
| 8690 | return restSubId, e2SubsId |
| 8691 | } |
| 8692 | |
| 8693 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8694 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8695 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8696 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8697 | } |
| 8698 | |
| 8699 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8700 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8701 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8702 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8703 | } |
| 8704 | |
| 8705 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8706 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8707 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8708 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8709 | } |
| 8710 | |
| 8711 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8712 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8713 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8714 | assert.Equal(t, meid, resp[0].Meid) |
| 8715 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8716 | } |
| 8717 | |
| 8718 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8719 | //Wait that subs is cleaned |
| 8720 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8721 | |
| 8722 | xappConn1.TestMsgChanEmpty(t) |
| 8723 | xappConn2.TestMsgChanEmpty(t) |
| 8724 | e2termConn1.TestMsgChanEmpty(t) |
| 8725 | mainCtrl.wait_registry_empty(t, timeout) |
| 8726 | } |
| 8727 | |
| 8728 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8729 | |
| 8730 | var e2SubsId []uint32 |
| 8731 | |
| 8732 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8733 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8734 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8735 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8736 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8737 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8738 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8739 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8740 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8741 | <-time.After(100 * time.Millisecond) |
| 8742 | } |
| 8743 | return e2SubsId |
| 8744 | } |
| 8745 | |
| 8746 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8747 | |
| 8748 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8749 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8750 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8751 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8752 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8753 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8754 | <-time.After(100 * time.Millisecond) |
| 8755 | } |
| 8756 | |
| 8757 | // Wait that subs is cleaned |
| 8758 | for i := 0; i < len(e2SubsIds); i++ { |
| 8759 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8760 | } |
| 8761 | |
| 8762 | } |