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" |
aditverm | 323c77e | 2023-09-20 09:50:47 +0530 | [diff] [blame] | 24 | "fmt" |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 25 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 26 | "testing" |
| 27 | "time" |
| 28 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 31 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 32 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 33 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 34 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 35 | ) |
| 36 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 37 | // In below test cases there is done only one retry for E2 messages |
| 38 | // In Helm chart retry count is currently 2 By default. Retry count |
| 39 | // used in test cases is defined in submgr-config.yaml file. |
| 40 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 41 | func TestSuiteSetup(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 42 | // The effect of this call shall endure though the UT suite! |
| 43 | // If this causes any issues, the previous interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 44 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 45 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 46 | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 47 | mainCtrl.InitAllCounterMap() |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 48 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 49 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 50 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 51 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 52 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 53 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 54 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 55 | Counter{cE2StateChangedToUp, 3}, |
| 56 | }) |
| 57 | |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 58 | // Current UT test cases use these ran names |
| 59 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 60 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 61 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 62 | |
| 63 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 64 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 65 | |
| 66 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 67 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 68 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 69 | |
| 70 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | //----------------------------------------------------------------------------- |
| 74 | // TestRESTSubReqAfterE2ConnBreak |
| 75 | // |
| 76 | // stub stub |
| 77 | // +-------+ +---------+ +---------+ |
| 78 | // | xapp | | submgr | | e2term | |
| 79 | // +-------+ +---------+ +---------+ |
| 80 | // | | | |
| 81 | // | [E2 Conn. DOWN] | |
| 82 | // | | | |
| 83 | // | RESTSubReq | | |
| 84 | // |---------------->| | |
| 85 | // | RESTSubFail | | |
| 86 | // |<----------------| | |
| 87 | // | | | |
| 88 | // |
| 89 | //----------------------------------------------------------------------------- |
| 90 | |
| 91 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 92 | |
| 93 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 94 | Counter{cRestSubReqFromXapp, 1}, |
| 95 | Counter{cRestReqRejDueE2Down, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 96 | Counter{cE2StateChangedToDown, 1}, |
| 97 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 98 | }) |
| 99 | |
| 100 | // E2 disconnect after E2term has received response |
| 101 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 102 | // Req |
| 103 | const subReqCount int = 1 |
| 104 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 105 | xappConn1.SendRESTSubsReq(t, params) |
| 106 | |
| 107 | // Restore E2 connection for following test cases |
| 108 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 109 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 110 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 111 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | //----------------------------------------------------------------------------- |
| 115 | // TestRESTSubReqE2ConnBreak |
| 116 | // |
| 117 | // stub stub |
| 118 | // +-------+ +---------+ +---------+ |
| 119 | // | xapp | | submgr | | e2term | |
| 120 | // +-------+ +---------+ +---------+ |
| 121 | // | | | |
| 122 | // | RESTSubReq | | |
| 123 | // |---------------->| | |
| 124 | // | RESTSubResp | | |
| 125 | // |<----------------| | |
| 126 | // | | SubReq | |
| 127 | // | |------------->| |
| 128 | // | | SubResp | |
| 129 | // | |<-------------| |
| 130 | // | | | |
| 131 | // | [E2 Conn. DOWN] | |
| 132 | // | [Int. SUBS DELETE] | |
| 133 | // | | | |
| 134 | // | RESTNotif(unsuccessful) | |
| 135 | // |<----------------| | |
| 136 | // | | | |
| 137 | // | | | |
| 138 | // |
| 139 | //----------------------------------------------------------------------------- |
| 140 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 141 | |
| 142 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 143 | Counter{cRestSubReqFromXapp, 1}, |
| 144 | Counter{cRestSubRespToXapp, 1}, |
| 145 | Counter{cSubReqToE2, 1}, |
| 146 | Counter{cSubRespFromE2, 1}, |
| 147 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 148 | Counter{cE2StateChangedToDown, 1}, |
| 149 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 150 | }) |
| 151 | |
| 152 | // Req |
| 153 | const subReqCount int = 1 |
| 154 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 155 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 156 | |
| 157 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 158 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 159 | |
| 160 | // E2 disconnect after E2term has received response |
| 161 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 162 | |
| 163 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 164 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 165 | |
| 166 | <-time.After(time.Second * 1) |
| 167 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 168 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 169 | |
| 170 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 171 | if err != nil { |
| 172 | xapp.Logger.Error("%v", err) |
| 173 | } else { |
| 174 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 175 | assert.Equal(t, 0, len(register)) |
| 176 | } |
| 177 | |
| 178 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 179 | if err != nil { |
| 180 | xapp.Logger.Error("%v", err) |
| 181 | } else { |
| 182 | assert.Equal(t, 0, len(restSubscriptions)) |
| 183 | } |
| 184 | |
| 185 | // Restore E2 connection for following test cases |
| 186 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 187 | |
| 188 | // Wait that subs is cleaned |
| 189 | waitSubsCleanup(t, e2SubsId, 10) |
| 190 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 191 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | //----------------------------------------------------------------------------- |
| 195 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 196 | // |
| 197 | // stub stub |
| 198 | // +-------+ +---------+ +---------+ |
| 199 | // | xapp | | submgr | | e2term | |
| 200 | // +-------+ +---------+ +---------+ |
| 201 | // | | | |
| 202 | // | [SUBS CREATE] | |
| 203 | // | | | |
| 204 | // | [E2 Conn. DOWN] | |
| 205 | // | | | |
| 206 | // | RESTSubDelReq | | |
| 207 | // |---------------->| | |
| 208 | // | | | |
| 209 | // | RESTSubDelResp | | |
| 210 | // |<----------------| | |
| 211 | // | | | |
| 212 | // | [No valid subscription found] | |
| 213 | // | | | |
| 214 | // |
| 215 | //----------------------------------------------------------------------------- |
| 216 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 217 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 218 | |
| 219 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 220 | Counter{cRestSubReqFromXapp, 1}, |
| 221 | Counter{cRestSubRespToXapp, 1}, |
| 222 | Counter{cSubReqToE2, 1}, |
| 223 | Counter{cSubRespFromE2, 1}, |
| 224 | Counter{cRestSubNotifToXapp, 1}, |
| 225 | Counter{cRestSubDelReqFromXapp, 1}, |
| 226 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 227 | Counter{cE2StateChangedToDown, 1}, |
| 228 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 229 | }) |
| 230 | |
| 231 | // Req |
| 232 | var params *teststube2ap.RESTSubsReqParams = nil |
| 233 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 234 | |
| 235 | // E2 disconnect after E2term has received response |
| 236 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 237 | |
| 238 | // Del |
| 239 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 240 | |
| 241 | <-time.After(time.Second * 1) |
| 242 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 243 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 244 | |
| 245 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 246 | if err != nil { |
| 247 | xapp.Logger.Error("%v", err) |
| 248 | } else { |
| 249 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 250 | assert.Equal(t, 0, len(register)) |
| 251 | } |
| 252 | |
| 253 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 254 | if err != nil { |
| 255 | xapp.Logger.Error("%v", err) |
| 256 | } else { |
| 257 | assert.Equal(t, 0, len(restSubscriptions)) |
| 258 | } |
| 259 | |
| 260 | // Restore E2 connection for following test cases |
| 261 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 262 | |
| 263 | // Wait that subs is cleaned |
| 264 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 265 | |
| 266 | xappConn1.TestMsgChanEmpty(t) |
| 267 | e2termConn1.TestMsgChanEmpty(t) |
| 268 | mainCtrl.wait_registry_empty(t, 10) |
| 269 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 270 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | //----------------------------------------------------------------------------- |
| 274 | // TestRESTOtherE2ConnectionChanges |
| 275 | // |
| 276 | |
| 277 | // stub stub |
| 278 | // +-------+ +---------+ +---------+ |
| 279 | // | xapp | | submgr | | e2term | |
| 280 | // +-------+ +---------+ +---------+ |
| 281 | // | | | |
| 282 | // | [SUBS CREATE] | |
| 283 | // | | | |
| 284 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 285 | // | [E2 CONNECTING] | |
| 286 | // | [E2 SHUTTING_DOWN] | |
| 287 | // | [E2 SHUT_DOWN] | |
| 288 | // | | | |
| 289 | // | [SUBS DELETE] | |
| 290 | // | | | |
| 291 | // |
| 292 | //----------------------------------------------------------------------------- |
| 293 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 294 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 295 | |
| 296 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 297 | Counter{cRestSubReqFromXapp, 1}, |
| 298 | Counter{cRestSubRespToXapp, 1}, |
| 299 | Counter{cSubReqToE2, 1}, |
| 300 | Counter{cSubRespFromE2, 1}, |
| 301 | Counter{cRestSubNotifToXapp, 1}, |
| 302 | Counter{cRestSubDelReqFromXapp, 1}, |
| 303 | Counter{cSubDelReqToE2, 1}, |
| 304 | Counter{cSubDelRespFromE2, 1}, |
| 305 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 306 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 307 | }) |
| 308 | |
| 309 | // Req |
| 310 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 311 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 312 | |
| 313 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 314 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 315 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 316 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 317 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 318 | // 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] | 319 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 320 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 321 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 322 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 323 | |
| 324 | // Del |
| 325 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 326 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 327 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 328 | |
| 329 | // Restore E2 connection for following test cases |
| 330 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 331 | |
| 332 | // Wait that subs is cleaned |
| 333 | waitSubsCleanup(t, e2SubsId, 10) |
| 334 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 335 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 336 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 337 | |
| 338 | //----------------------------------------------------------------------------- |
| 339 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 340 | // |
| 341 | // stub stub stub |
| 342 | // +-------+ +---------+ +---------+ +---------+ |
| 343 | // | xapp | | submgr | | e2term | | rtmgr | |
| 344 | // +-------+ +---------+ +---------+ +---------+ |
| 345 | // | | | | |
| 346 | // | RESTSubReq | | | |
| 347 | // |---------------->| | | |
| 348 | // | | RouteCreate | | |
| 349 | // | |--------------------------->| // The order of these events may vary |
| 350 | // | | | | |
| 351 | // | RESTSubResp | | | // The order of these events may vary |
| 352 | // |<----------------| | | |
| 353 | // | | RouteResponse| | |
| 354 | // | |<---------------------------| // The order of these events may vary |
| 355 | // | | | | |
| 356 | // | | SubReq | | |
| 357 | // | |------------->| | // The order of these events may vary |
| 358 | // | | | | |
| 359 | // | | SubResp | | |
| 360 | // | |<-------------| | |
| 361 | // | RESTNotif1 | | | |
| 362 | // |<----------------| | | |
| 363 | // | | | | |
| 364 | // | RESTSubDelReq | | | |
| 365 | // |---------------->| | | |
| 366 | // | | SubDelReq | | |
| 367 | // | |------------->| | |
| 368 | // | | | | |
| 369 | // | RESTSubDelResp| | | |
| 370 | // |<----------------| | | |
| 371 | // | | | | |
| 372 | // | | SubDelResp | | |
| 373 | // | |<-------------| | |
| 374 | // | | | | |
| 375 | // | | | | |
| 376 | // |
| 377 | //----------------------------------------------------------------------------- |
| 378 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 379 | |
| 380 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 381 | |
| 382 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 383 | |
| 384 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 385 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 386 | } |
| 387 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 388 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 389 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 390 | // |
| 391 | // stub stub stub |
| 392 | // +-------+ +---------+ +---------+ +---------+ |
| 393 | // | xapp | | submgr | | e2term | | rtmgr | |
| 394 | // +-------+ +---------+ +---------+ +---------+ |
| 395 | // | | | | |
| 396 | // | RESTSubReq | | | |
| 397 | // |---------------->| | | |
| 398 | // | | RouteCreate | | |
| 399 | // | |--------------------------->| // The order of these events may vary |
| 400 | // | | | | |
| 401 | // | RESTSubResp | | | // The order of these events may vary |
| 402 | // |<----------------| | | |
| 403 | // | | RouteResponse| | |
| 404 | // | |<---------------------------| // The order of these events may vary |
| 405 | // | | | | |
| 406 | // | | SubReq | | |
| 407 | // | |------------->| | // The order of these events may vary |
| 408 | // | | | | |
| 409 | // | | SubResp | | |
| 410 | // | |<-------------| | |
| 411 | // | RESTNotif1 | | | |
| 412 | // |<----------------| | | |
| 413 | // | | | | |
| 414 | // | RESTSubDelReq | | | |
| 415 | // |---------------->| | | |
| 416 | // | | | | |
| 417 | // | RESTSubDelResp| | | |
| 418 | // |<----------------| | | |
| 419 | // | | | | |
| 420 | // | | | | |
| 421 | // |
| 422 | //----------------------------------------------------------------------------- |
| 423 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 424 | |
| 425 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 426 | |
| 427 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 428 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 429 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 430 | |
| 431 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 432 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | //----------------------------------------------------------------------------- |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame] | 436 | // TestRESTSubReqAndE2APDeleteRespUnpackingError |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 437 | // |
| 438 | // stub stub stub |
| 439 | // +-------+ +---------+ +---------+ +---------+ |
| 440 | // | xapp | | submgr | | e2term | | rtmgr | |
| 441 | // +-------+ +---------+ +---------+ +---------+ |
| 442 | // | | | | |
| 443 | // | RESTSubReq | | | |
| 444 | // |---------------->| | | |
| 445 | // | | RouteCreate | | |
| 446 | // | |--------------------------->| // The order of these events may vary |
| 447 | // | | | | |
| 448 | // | RESTSubResp | | | // The order of these events may vary |
| 449 | // |<----------------| | | |
| 450 | // | | RouteResponse| | |
| 451 | // | |<---------------------------| // The order of these events may vary |
| 452 | // | | | | |
| 453 | // | | SubReq | | |
| 454 | // | |------------->| | // The order of these events may vary |
| 455 | // | | | | |
| 456 | // | | SubResp | | |
| 457 | // | |<-------------| | |
| 458 | // | RESTNotif1 | | | |
| 459 | // |<----------------| | | |
| 460 | // | | | | |
| 461 | // | RESTSubDelReq | | | |
| 462 | // |---------------->| | | |
| 463 | // | | SubDelReq | | |
| 464 | // | |------------->| | |
| 465 | // | | | | |
| 466 | // | RESTSubDelResp| | | |
| 467 | // |<----------------| | | // The order of these events may vary |
| 468 | // | | | | |
| 469 | // | | SubDelResp | | |
| 470 | // | |<-------------| | // 1.st NOK |
| 471 | // | | | | |
| 472 | // | | SubDelReq | | |
| 473 | // | |------------->| | |
| 474 | // | | | | |
| 475 | // | | SubDelResp | | |
| 476 | // | |<-------------| | // 2.nd NOK |
| 477 | // |
| 478 | //----------------------------------------------------------------------------- |
| 479 | |
Anssi Mannila | 483bd16 | 2022-01-20 11:11:48 +0200 | [diff] [blame] | 480 | func TestRESTSubReqAndE2APDeleteRespUnpackingError(t *testing.T) { |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 481 | |
| 482 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 483 | |
| 484 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 485 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 486 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 487 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 488 | |
| 489 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 490 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 491 | |
| 492 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 493 | |
| 494 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 495 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 499 | // TestSubReqAndRouteNok |
| 500 | // |
| 501 | // stub stub |
| 502 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 503 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 504 | // +-------+ +---------+ +---------+ |
| 505 | // | | | |
| 506 | // | SubReq | | |
| 507 | // |------------->| | |
| 508 | // | | | |
| 509 | // | | RouteCreate | |
| 510 | // | |------------->| |
| 511 | // | | | |
| 512 | // | | RouteCreate | |
| 513 | // | | status:400 | |
| 514 | // | |<-------------| |
| 515 | // | | | |
| 516 | // | [SUBS INT DELETE] | |
| 517 | // | | | |
| 518 | // |
| 519 | //----------------------------------------------------------------------------- |
| 520 | |
| 521 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 522 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 523 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 524 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 525 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 526 | Counter{cSubReqFromXapp, 1}, |
| 527 | Counter{cRouteCreateFail, 1}, |
| 528 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 529 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 530 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 531 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 532 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 533 | waiter.WaitResult(t) |
| 534 | |
| 535 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 536 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 537 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 538 | xappConn1.TestMsgChanEmpty(t) |
| 539 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 540 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 541 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 542 | |
| 543 | <-time.After(1 * time.Second) |
| 544 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 548 | // TestSubReqAndRouteUpdateNok |
| 549 | |
| 550 | // stub stub |
| 551 | // +-------+ +-------+ +---------+ +---------+ |
| 552 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 553 | // +-------+ +-------+ +---------+ +---------+ |
| 554 | // | | | | |
| 555 | // | [SUBS CREATE] | | |
| 556 | // | | | | |
| 557 | // | | | | |
| 558 | // | | | | |
| 559 | // | SubReq (mergeable) | | |
| 560 | // |--------------------------->| | | |
| 561 | // | | | | |
| 562 | // | | | RouteUpdate | |
| 563 | // | | |------------->| |
| 564 | // | | | | |
| 565 | // | | | RouteUpdate | |
| 566 | // | | | status:400 | |
| 567 | // | | |<-------------| |
| 568 | // | | | | |
| 569 | // | [SUBS INT DELETE] | | |
| 570 | // | | | | |
| 571 | // | | | | |
| 572 | // | [SUBS DELETE] | | |
| 573 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 574 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 575 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 576 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 577 | |
| 578 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 579 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 580 | Counter{cSubReqFromXapp, 2}, |
| 581 | Counter{cSubReqToE2, 1}, |
| 582 | Counter{cSubRespFromE2, 1}, |
| 583 | Counter{cSubRespToXapp, 1}, |
| 584 | Counter{cRouteCreateUpdateFail, 1}, |
| 585 | Counter{cSubDelReqFromXapp, 1}, |
| 586 | Counter{cSubDelReqToE2, 1}, |
| 587 | Counter{cSubDelRespFromE2, 1}, |
| 588 | Counter{cSubDelRespToXapp, 1}, |
| 589 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 590 | |
| 591 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 592 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 593 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 594 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 595 | |
| 596 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 597 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 598 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 599 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 600 | |
| 601 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 602 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 603 | xappConn2.SendSubsReq(t, nil, nil) |
| 604 | waiter.WaitResult(t) |
| 605 | |
| 606 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 607 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 608 | |
| 609 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 610 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 611 | |
| 612 | //Wait that subs is cleaned |
| 613 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 614 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 615 | |
| 616 | xappConn1.TestMsgChanEmpty(t) |
| 617 | xappConn2.TestMsgChanEmpty(t) |
| 618 | e2termConn1.TestMsgChanEmpty(t) |
| 619 | mainCtrl.wait_registry_empty(t, 10) |
| 620 | |
| 621 | mainCtrl.VerifyCounterValues(t) |
| 622 | } |
| 623 | |
| 624 | //----------------------------------------------------------------------------- |
| 625 | // TestSubDelReqAndRouteDeleteNok |
| 626 | // |
| 627 | // stub stub |
| 628 | // +-------+ +---------+ +---------+ +---------+ |
| 629 | // | xapp | | submgr | | e2term | | rtmgr | |
| 630 | // +-------+ +---------+ +---------+ +---------+ |
| 631 | // | | | | |
| 632 | // | [SUBS CREATE] | | |
| 633 | // | | | | |
| 634 | // | | | | |
| 635 | // | | | | |
| 636 | // | SubDelReq | | | |
| 637 | // |------------->| | | |
| 638 | // | | SubDelReq | | |
| 639 | // | |------------->| | |
| 640 | // | | SubDelRsp | | |
| 641 | // | |<-------------| | |
| 642 | // | SubDelRsp | | | |
| 643 | // |<-------------| | | |
| 644 | // | | RouteDelete | | |
| 645 | // | |---------------------------->| |
| 646 | // | | | | |
| 647 | // | | RouteDelete | | |
| 648 | // | | status:400 | | |
| 649 | // | |<----------------------------| |
| 650 | // | | | | |
| 651 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 652 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 653 | |
| 654 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 655 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 656 | Counter{cSubReqFromXapp, 1}, |
| 657 | Counter{cSubReqToE2, 1}, |
| 658 | Counter{cSubRespFromE2, 1}, |
| 659 | Counter{cSubRespToXapp, 1}, |
| 660 | Counter{cSubDelReqFromXapp, 1}, |
| 661 | Counter{cRouteDeleteFail, 1}, |
| 662 | Counter{cSubDelReqToE2, 1}, |
| 663 | Counter{cSubDelRespFromE2, 1}, |
| 664 | Counter{cSubDelRespToXapp, 1}, |
| 665 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 666 | |
| 667 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 668 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 669 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 670 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 671 | |
| 672 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 673 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 674 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 675 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 676 | |
| 677 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 678 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 679 | |
| 680 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 681 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 682 | waiter.WaitResult(t) |
| 683 | |
| 684 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 685 | |
| 686 | //Wait that subs is cleaned |
| 687 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 688 | |
| 689 | xappConn1.TestMsgChanEmpty(t) |
| 690 | xappConn2.TestMsgChanEmpty(t) |
| 691 | e2termConn1.TestMsgChanEmpty(t) |
| 692 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 693 | mainCtrl.VerifyCounterValues(t) |
| 694 | } |
| 695 | |
| 696 | //----------------------------------------------------------------------------- |
| 697 | // TestSubMergeDelAndRouteUpdateNok |
| 698 | // stub stub |
| 699 | // +-------+ +-------+ +---------+ +---------+ |
| 700 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 701 | // +-------+ +-------+ +---------+ +---------+ |
| 702 | // | | | | |
| 703 | // | | | | |
| 704 | // | | | | |
| 705 | // | | SubReq1 | | |
| 706 | // | |------------->| | |
| 707 | // | | | | |
| 708 | // | | | SubReq1 | |
| 709 | // | | |------------->| |
| 710 | // | | | SubResp1 | |
| 711 | // | | |<-------------| |
| 712 | // | | SubResp1 | | |
| 713 | // | |<-------------| | |
| 714 | // | | | | |
| 715 | // | SubReq2 | | |
| 716 | // |--------------------------->| | |
| 717 | // | | | | |
| 718 | // | SubResp2 | | |
| 719 | // |<---------------------------| | |
| 720 | // | | | | |
| 721 | // | | SubDelReq 1 | | |
| 722 | // | |------------->| | |
| 723 | // | | | RouteUpdate | |
| 724 | // | | |-----> rtmgr | |
| 725 | // | | | | |
| 726 | // | | | RouteUpdate | |
| 727 | // | | | status:400 | |
| 728 | // | | |<----- rtmgr | |
| 729 | // | | | | |
| 730 | // | | SubDelResp 1 | | |
| 731 | // | |<-------------| | |
| 732 | // | | | | |
| 733 | // | SubDelReq 2 | | |
| 734 | // |--------------------------->| | |
| 735 | // | | | | |
| 736 | // | | | SubDelReq 2 | |
| 737 | // | | |------------->| |
| 738 | // | | | | |
| 739 | // | | | SubDelReq 2 | |
| 740 | // | | |------------->| |
| 741 | // | | | | |
| 742 | // | SubDelResp 2 | | |
| 743 | // |<---------------------------| | |
| 744 | // |
| 745 | //----------------------------------------------------------------------------- |
| 746 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 747 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 748 | |
| 749 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 750 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 751 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 752 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 753 | Counter{cSubReqToE2, 1}, |
| 754 | Counter{cSubRespFromE2, 1}, |
| 755 | Counter{cSubRespToXapp, 2}, |
| 756 | Counter{cSubDelReqFromXapp, 2}, |
| 757 | Counter{cRouteDeleteUpdateFail, 1}, |
| 758 | Counter{cSubDelReqToE2, 1}, |
| 759 | Counter{cSubDelRespFromE2, 1}, |
| 760 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 761 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 762 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 763 | |
| 764 | //Req1 |
| 765 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 766 | rparams1.Init() |
| 767 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 768 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 769 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 770 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 771 | |
| 772 | //Req2 |
| 773 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 774 | rparams2.Init() |
| 775 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 776 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 777 | |
| 778 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 779 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 780 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 781 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 782 | |
| 783 | //Del1 |
| 784 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 785 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 786 | waiter.WaitResult(t) |
| 787 | |
| 788 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 789 | |
| 790 | //Del2 |
| 791 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 792 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 793 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 794 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 795 | //Wait that subs is cleaned |
| 796 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 797 | |
| 798 | xappConn1.TestMsgChanEmpty(t) |
| 799 | xappConn2.TestMsgChanEmpty(t) |
| 800 | e2termConn1.TestMsgChanEmpty(t) |
| 801 | mainCtrl.wait_registry_empty(t, 10) |
| 802 | |
| 803 | mainCtrl.VerifyCounterValues(t) |
| 804 | } |
| 805 | |
| 806 | //----------------------------------------------------------------------------- |
| 807 | |
| 808 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 809 | // TestSubReqAndSubDelOk |
| 810 | // |
| 811 | // stub stub |
| 812 | // +-------+ +---------+ +---------+ |
| 813 | // | xapp | | submgr | | e2term | |
| 814 | // +-------+ +---------+ +---------+ |
| 815 | // | | | |
| 816 | // | SubReq | | |
| 817 | // |------------->| | |
| 818 | // | | | |
| 819 | // | | SubReq | |
| 820 | // | |------------->| |
| 821 | // | | | |
| 822 | // | | SubResp | |
| 823 | // | |<-------------| |
| 824 | // | | | |
| 825 | // | SubResp | | |
| 826 | // |<-------------| | |
| 827 | // | | | |
| 828 | // | | | |
| 829 | // | SubDelReq | | |
| 830 | // |------------->| | |
| 831 | // | | | |
| 832 | // | | SubDelReq | |
| 833 | // | |------------->| |
| 834 | // | | | |
| 835 | // | | SubDelResp | |
| 836 | // | |<-------------| |
| 837 | // | | | |
| 838 | // | SubDelResp | | |
| 839 | // |<-------------| | |
| 840 | // |
| 841 | //----------------------------------------------------------------------------- |
| 842 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 843 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 844 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 845 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 846 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 847 | Counter{cSubReqFromXapp, 1}, |
| 848 | Counter{cSubReqToE2, 1}, |
| 849 | Counter{cSubRespFromE2, 1}, |
| 850 | Counter{cSubRespToXapp, 1}, |
| 851 | Counter{cSubDelReqFromXapp, 1}, |
| 852 | Counter{cSubDelReqToE2, 1}, |
| 853 | Counter{cSubDelRespFromE2, 1}, |
| 854 | Counter{cSubDelRespToXapp, 1}, |
| 855 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 856 | |
| 857 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 858 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 859 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 860 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 861 | |
| 862 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 863 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 864 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 865 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 866 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 867 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 868 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 869 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 870 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 871 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 872 | |
| 873 | //Wait that subs is cleaned |
| 874 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 875 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 876 | xappConn1.TestMsgChanEmpty(t) |
| 877 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 878 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 879 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 880 | |
| 881 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 882 | } |
| 883 | |
| 884 | //----------------------------------------------------------------------------- |
Himanshu Puorhit | 84662c4 | 2023-08-29 15:46:18 +0530 | [diff] [blame] | 885 | |
| 886 | //----------------------------------------------------------------------------- |
| 887 | // TestSubReqAndSubDelOkOutofOrderIEs |
| 888 | // |
| 889 | // stub stub |
| 890 | // +-------+ +---------+ +---------+ |
| 891 | // | xapp | | submgr | | e2term | |
| 892 | // +-------+ +---------+ +---------+ |
| 893 | // | | | |
| 894 | // | SubReq | | |
| 895 | // |------------->| | |
| 896 | // | | | |
| 897 | // | | SubReq | |
| 898 | // | |------------->| |
| 899 | // | | | |
| 900 | // | | SubResp | (Out of Order IEs) |
| 901 | // | |<-------------| |
| 902 | // | | | |
| 903 | // | SubResp | | |
| 904 | // |<-------------| | |
| 905 | // | | | |
| 906 | // | | | |
| 907 | // | SubDelReq | | |
| 908 | // |------------->| | |
| 909 | // | | | |
| 910 | // | | SubDelReq | |
| 911 | // | |------------->| |
| 912 | // | | | |
| 913 | // | | SubDelResp | |
| 914 | // | |<-------------| |
| 915 | // | | | |
| 916 | // | SubDelResp | | |
| 917 | // |<-------------| | |
| 918 | // |
| 919 | //----------------------------------------------------------------------------- |
| 920 | |
| 921 | func TestSubReqAndSubDelOkOutofOrderIEs(t *testing.T) { |
| 922 | CaseBegin("TestSubReqAndSubDelOkOutofOrderIEs") |
| 923 | |
| 924 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 925 | // Init counter check |
| 926 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 927 | Counter{cSubReqFromXapp, 1}, |
| 928 | Counter{cSubReqToE2, 1}, |
| 929 | Counter{cSubRespFromE2, 1}, |
| 930 | Counter{cSubRespToXapp, 1}, |
| 931 | Counter{cSubDelReqFromXapp, 1}, |
| 932 | Counter{cSubDelReqToE2, 1}, |
| 933 | Counter{cSubDelRespFromE2, 1}, |
| 934 | Counter{cSubDelRespToXapp, 1}, |
| 935 | }) |
| 936 | |
| 937 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 938 | if cretrans == nil { |
| 939 | t.Logf("Could not send SubsReq") |
| 940 | t.FailNow() |
| 941 | } |
| 942 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 943 | if crereq == nil || cremsg == nil { |
| 944 | t.Logf("Could not recieve SubsReq") |
| 945 | t.FailNow() |
| 946 | } |
| 947 | |
| 948 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 949 | |
Himanshu Puorhit | 84662c4 | 2023-08-29 15:46:18 +0530 | [diff] [blame] | 950 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 951 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 952 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 953 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 954 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
| 955 | |
| 956 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 957 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 958 | |
| 959 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 960 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 961 | |
| 962 | //Wait that subs is cleaned |
| 963 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 964 | |
| 965 | xappConn1.TestMsgChanEmpty(t) |
| 966 | xappConn2.TestMsgChanEmpty(t) |
| 967 | e2termConn1.TestMsgChanEmpty(t) |
| 968 | mainCtrl.wait_registry_empty(t, 10) |
| 969 | |
| 970 | mainCtrl.VerifyCounterValues(t) |
| 971 | mainCtrl.c.e2ap.SetE2IEOrderCheck(1) |
| 972 | } |
| 973 | |
| 974 | //----------------------------------------------------------------------------- |
| 975 | |
| 976 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 977 | // TestSubReqRetransmission |
| 978 | // |
| 979 | // stub stub |
| 980 | // +-------+ +---------+ +---------+ |
| 981 | // | xapp | | submgr | | e2term | |
| 982 | // +-------+ +---------+ +---------+ |
| 983 | // | | | |
| 984 | // | SubReq | | |
| 985 | // |------------->| | |
| 986 | // | | | |
| 987 | // | | SubReq | |
| 988 | // | |------------->| |
| 989 | // | | | |
| 990 | // | SubReq | | |
| 991 | // | (retrans) | | |
| 992 | // |------------->| | |
| 993 | // | | | |
| 994 | // | | SubResp | |
| 995 | // | |<-------------| |
| 996 | // | | | |
| 997 | // | SubResp | | |
| 998 | // |<-------------| | |
| 999 | // | | | |
| 1000 | // | [SUBS DELETE] | |
| 1001 | // | | | |
| 1002 | // |
| 1003 | //----------------------------------------------------------------------------- |
| 1004 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1005 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | |
| 1007 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1008 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1009 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1010 | |
| 1011 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1012 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1013 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1014 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1015 | // hack as there is no real way to see has message be handled. |
| 1016 | // Previuos counter check just tells that is has been received by submgr |
| 1017 | // --> artificial delay |
| 1018 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1019 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1020 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1021 | |
| 1022 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1023 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1024 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1025 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1026 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1027 | |
| 1028 | //Wait that subs is cleaned |
| 1029 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1030 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1031 | xappConn1.TestMsgChanEmpty(t) |
| 1032 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1033 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1034 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1035 | } |
| 1036 | |
| 1037 | //----------------------------------------------------------------------------- |
| 1038 | // TestSubDelReqRetransmission |
| 1039 | // |
| 1040 | // stub stub |
| 1041 | // +-------+ +---------+ +---------+ |
| 1042 | // | xapp | | submgr | | e2term | |
| 1043 | // +-------+ +---------+ +---------+ |
| 1044 | // | | | |
| 1045 | // | [SUBS CREATE] | |
| 1046 | // | | | |
| 1047 | // | | | |
| 1048 | // | SubDelReq | | |
| 1049 | // |------------->| | |
| 1050 | // | | | |
| 1051 | // | | SubDelReq | |
| 1052 | // | |------------->| |
| 1053 | // | | | |
| 1054 | // | SubDelReq | | |
| 1055 | // | (same sub) | | |
| 1056 | // | (same xid) | | |
| 1057 | // |------------->| | |
| 1058 | // | | | |
| 1059 | // | | SubDelResp | |
| 1060 | // | |<-------------| |
| 1061 | // | | | |
| 1062 | // | SubDelResp | | |
| 1063 | // |<-------------| | |
| 1064 | // |
| 1065 | //----------------------------------------------------------------------------- |
| 1066 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1067 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1068 | |
| 1069 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1070 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1071 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1072 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1073 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1074 | |
| 1075 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1076 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1077 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1078 | |
| 1079 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1080 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1081 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1082 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1083 | // hack as there is no real way to see has message be handled. |
| 1084 | // Previuos counter check just tells that is has been received by submgr |
| 1085 | // --> artificial delay |
| 1086 | <-time.After(1 * time.Second) |
| 1087 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1088 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1089 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1090 | |
| 1091 | //Wait that subs is cleaned |
| 1092 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1093 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1094 | xappConn1.TestMsgChanEmpty(t) |
| 1095 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1096 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1097 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1098 | } |
| 1099 | |
| 1100 | //----------------------------------------------------------------------------- |
| 1101 | // TestSubDelReqCollision |
| 1102 | // |
| 1103 | // stub stub |
| 1104 | // +-------+ +---------+ +---------+ |
| 1105 | // | xapp | | submgr | | e2term | |
| 1106 | // +-------+ +---------+ +---------+ |
| 1107 | // | | | |
| 1108 | // | [SUBS CREATE] | |
| 1109 | // | | | |
| 1110 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1111 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1112 | // |------------->| | |
| 1113 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1114 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1115 | // | |------------->| |
| 1116 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1117 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1118 | // | (same sub) | | |
| 1119 | // | (diff xid) | | |
| 1120 | // |------------->| | |
| 1121 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1122 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1123 | // | |<-------------| |
| 1124 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1125 | // | SubDelResp 1 | | |
| 1126 | // |<-------------| | |
| 1127 | // | | | |
| 1128 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1129 | // |<-------------| | |
| 1130 | // |
| 1131 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1132 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1133 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1134 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1135 | |
| 1136 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1137 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1138 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1139 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1140 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1141 | |
| 1142 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1143 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1144 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1145 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1146 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1148 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1149 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1150 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1151 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1152 | // hack as there is no real way to see has message be handled. |
| 1153 | // Previuos counter check just tells that is has been received by submgr |
| 1154 | // --> artificial delay |
| 1155 | <-time.After(1 * time.Second) |
| 1156 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1157 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1158 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1159 | |
| 1160 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1161 | xappConn1.RecvSubsDelResp(t, nil) |
| 1162 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1163 | |
| 1164 | //Wait that subs is cleaned |
| 1165 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1166 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1167 | xappConn1.TestMsgChanEmpty(t) |
| 1168 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1169 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1170 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1171 | } |
| 1172 | |
| 1173 | //----------------------------------------------------------------------------- |
| 1174 | // TestSubReqAndSubDelOkTwoParallel |
| 1175 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1176 | // stub stub stub |
| 1177 | // +-------+ +-------+ +---------+ +---------+ |
| 1178 | // | xapp | | xapp | | submgr | | e2term | |
| 1179 | // +-------+ +-------+ +---------+ +---------+ |
| 1180 | // | | | | |
| 1181 | // | | | | |
| 1182 | // | | | | |
| 1183 | // | | SubReq1 | | |
| 1184 | // | |------------->| | |
| 1185 | // | | | | |
| 1186 | // | | | SubReq1 | |
| 1187 | // | | |------------->| |
| 1188 | // | | | | |
| 1189 | // | SubReq2 | | |
| 1190 | // |------------------------>| | |
| 1191 | // | | | | |
| 1192 | // | | | SubReq2 | |
| 1193 | // | | |------------->| |
| 1194 | // | | | | |
| 1195 | // | | | SubResp1 | |
| 1196 | // | | |<-------------| |
| 1197 | // | | SubResp1 | | |
| 1198 | // | |<-------------| | |
| 1199 | // | | | | |
| 1200 | // | | | SubResp2 | |
| 1201 | // | | |<-------------| |
| 1202 | // | SubResp2 | | |
| 1203 | // |<------------------------| | |
| 1204 | // | | | | |
| 1205 | // | | [SUBS 1 DELETE] | |
| 1206 | // | | | | |
| 1207 | // | | [SUBS 2 DELETE] | |
| 1208 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1209 | // |
| 1210 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1211 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1212 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1213 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1214 | |
| 1215 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1216 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1217 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1218 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1219 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1220 | |
| 1221 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1222 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1223 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1224 | |
| 1225 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1226 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1227 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1228 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1229 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1230 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1231 | |
| 1232 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1233 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1234 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1235 | |
| 1236 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1237 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1238 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1239 | |
| 1240 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1241 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1242 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1243 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1244 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1245 | //Wait that subs is cleaned |
| 1246 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1247 | |
| 1248 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1249 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1250 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1251 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1252 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1253 | //Wait that subs is cleaned |
| 1254 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1255 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1256 | xappConn1.TestMsgChanEmpty(t) |
| 1257 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1258 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1259 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1260 | } |
| 1261 | |
| 1262 | //----------------------------------------------------------------------------- |
| 1263 | // TestSameSubsDiffRan |
| 1264 | // Same subscription to different RANs |
| 1265 | // |
| 1266 | // stub stub |
| 1267 | // +-------+ +---------+ +---------+ |
| 1268 | // | xapp | | submgr | | e2term | |
| 1269 | // +-------+ +---------+ +---------+ |
| 1270 | // | | | |
| 1271 | // | | | |
| 1272 | // | | | |
| 1273 | // | SubReq(r1) | | |
| 1274 | // |------------->| | |
| 1275 | // | | | |
| 1276 | // | | SubReq(r1) | |
| 1277 | // | |------------->| |
| 1278 | // | | | |
| 1279 | // | | SubResp(r1) | |
| 1280 | // | |<-------------| |
| 1281 | // | | | |
| 1282 | // | SubResp(r1) | | |
| 1283 | // |<-------------| | |
| 1284 | // | | | |
| 1285 | // | SubReq(r2) | | |
| 1286 | // |------------->| | |
| 1287 | // | | | |
| 1288 | // | | SubReq(r2) | |
| 1289 | // | |------------->| |
| 1290 | // | | | |
| 1291 | // | | SubResp(r2) | |
| 1292 | // | |<-------------| |
| 1293 | // | | | |
| 1294 | // | SubResp(r2) | | |
| 1295 | // |<-------------| | |
| 1296 | // | | | |
| 1297 | // | [SUBS r1 DELETE] | |
| 1298 | // | | | |
| 1299 | // | [SUBS r2 DELETE] | |
| 1300 | // | | | |
| 1301 | // |
| 1302 | //----------------------------------------------------------------------------- |
| 1303 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1304 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1305 | |
| 1306 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1307 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1308 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1309 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1310 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1311 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1312 | |
| 1313 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1314 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1315 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1316 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1317 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1318 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1319 | |
| 1320 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1321 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1322 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1323 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1324 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1325 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1326 | //Wait that subs is cleaned |
| 1327 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1328 | |
| 1329 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1330 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1331 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1332 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1333 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1334 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1335 | //Wait that subs is cleaned |
| 1336 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1337 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1338 | xappConn1.TestMsgChanEmpty(t) |
| 1339 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1340 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1341 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1342 | } |
| 1343 | |
| 1344 | //----------------------------------------------------------------------------- |
| 1345 | // TestSubReqRetryInSubmgr |
| 1346 | // |
| 1347 | // stub stub |
| 1348 | // +-------+ +---------+ +---------+ |
| 1349 | // | xapp | | submgr | | e2term | |
| 1350 | // +-------+ +---------+ +---------+ |
| 1351 | // | | | |
| 1352 | // | SubReq | | |
| 1353 | // |------------->| | |
| 1354 | // | | | |
| 1355 | // | | SubReq | |
| 1356 | // | |------------->| |
| 1357 | // | | | |
| 1358 | // | | | |
| 1359 | // | | SubReq | |
| 1360 | // | |------------->| |
| 1361 | // | | | |
| 1362 | // | | SubResp | |
| 1363 | // | |<-------------| |
| 1364 | // | | | |
| 1365 | // | SubResp | | |
| 1366 | // |<-------------| | |
| 1367 | // | | | |
| 1368 | // | [SUBS DELETE] | |
| 1369 | // | | | |
| 1370 | // |
| 1371 | //----------------------------------------------------------------------------- |
| 1372 | |
| 1373 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1374 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1375 | |
| 1376 | // Init counter check |
| 1377 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1378 | Counter{cSubReqFromXapp, 1}, |
| 1379 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1380 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1381 | Counter{cSubReReqToE2, 1}, |
| 1382 | Counter{cSubRespFromE2, 1}, |
| 1383 | Counter{cSubRespToXapp, 1}, |
| 1384 | Counter{cSubDelReqFromXapp, 1}, |
| 1385 | Counter{cSubDelReqToE2, 1}, |
| 1386 | Counter{cSubDelRespFromE2, 1}, |
| 1387 | Counter{cSubDelRespToXapp, 1}, |
| 1388 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1389 | |
| 1390 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1391 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1392 | |
| 1393 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1394 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1395 | |
| 1396 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1397 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1398 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1399 | |
| 1400 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1401 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1402 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1403 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1404 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1405 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1406 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1407 | |
| 1408 | // Wait that subs is cleaned |
| 1409 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1410 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1411 | xappConn1.TestMsgChanEmpty(t) |
| 1412 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1413 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1414 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1415 | |
| 1416 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1417 | } |
| 1418 | |
| 1419 | //----------------------------------------------------------------------------- |
| 1420 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1421 | // |
| 1422 | // stub stub |
| 1423 | // +-------+ +---------+ +---------+ |
| 1424 | // | xapp | | submgr | | e2term | |
| 1425 | // +-------+ +---------+ +---------+ |
| 1426 | // | | | |
| 1427 | // | SubReq | | |
| 1428 | // |------------->| | |
| 1429 | // | | | |
| 1430 | // | | SubReq | |
| 1431 | // | |------------->| |
| 1432 | // | | | |
| 1433 | // | | | |
| 1434 | // | | SubReq | |
| 1435 | // | |------------->| |
| 1436 | // | | | |
| 1437 | // | | SubDelReq | |
| 1438 | // | |------------->| |
| 1439 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1440 | // | | SubDelResp | |
| 1441 | // | |<-------------| |
| 1442 | // | | | |
| 1443 | // |
| 1444 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1445 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1446 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1447 | |
| 1448 | // Init counter check |
| 1449 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1450 | Counter{cSubReqFromXapp, 1}, |
| 1451 | Counter{cSubReqToE2, 1}, |
| 1452 | Counter{cSubReReqToE2, 1}, |
| 1453 | Counter{cSubReqTimerExpiry, 2}, |
| 1454 | Counter{cSubDelReqToE2, 1}, |
| 1455 | Counter{cSubDelRespFromE2, 1}, |
| 1456 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1457 | |
| 1458 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1459 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1460 | |
| 1461 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1462 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1463 | |
| 1464 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1465 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1466 | |
| 1467 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1468 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1469 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1470 | |
| 1471 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1472 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1473 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1474 | xappConn1.TestMsgChanEmpty(t) |
| 1475 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1476 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1477 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1478 | |
| 1479 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1480 | } |
| 1481 | |
| 1482 | //----------------------------------------------------------------------------- |
| 1483 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1484 | // |
| 1485 | // stub stub |
| 1486 | // +-------+ +---------+ +---------+ |
| 1487 | // | xapp | | submgr | | e2term | |
| 1488 | // +-------+ +---------+ +---------+ |
| 1489 | // | | | |
| 1490 | // | SubReq | | |
| 1491 | // |------------->| | |
| 1492 | // | | | |
| 1493 | // | | SubReq | |
| 1494 | // | |------------->| |
| 1495 | // | | | |
| 1496 | // | | | |
| 1497 | // | | SubReq | |
| 1498 | // | |------------->| |
| 1499 | // | | | |
| 1500 | // | | SubDelReq | |
| 1501 | // | |------------->| |
| 1502 | // | | | |
| 1503 | // | | | |
| 1504 | // | | SubDelReq | |
| 1505 | // | |------------->| |
| 1506 | // | | | |
| 1507 | // | | | |
| 1508 | // |
| 1509 | //----------------------------------------------------------------------------- |
| 1510 | |
| 1511 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1512 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1513 | |
| 1514 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1515 | Counter{cSubReqFromXapp, 1}, |
| 1516 | Counter{cSubReqToE2, 1}, |
| 1517 | Counter{cSubReReqToE2, 1}, |
| 1518 | Counter{cSubReqTimerExpiry, 2}, |
| 1519 | Counter{cSubDelReqToE2, 1}, |
| 1520 | Counter{cSubDelReReqToE2, 1}, |
| 1521 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1522 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1523 | |
| 1524 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1525 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1526 | |
| 1527 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1528 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1529 | |
| 1530 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1531 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1532 | |
| 1533 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1534 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1535 | |
| 1536 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1537 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1538 | |
| 1539 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1540 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1541 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1542 | xappConn1.TestMsgChanEmpty(t) |
| 1543 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1544 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1545 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1546 | |
| 1547 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1548 | } |
| 1549 | |
| 1550 | //----------------------------------------------------------------------------- |
| 1551 | // TestSubReqSubFailRespInSubmgr |
| 1552 | // |
| 1553 | // stub stub |
| 1554 | // +-------+ +---------+ +---------+ |
| 1555 | // | xapp | | submgr | | e2term | |
| 1556 | // +-------+ +---------+ +---------+ |
| 1557 | // | | | |
| 1558 | // | SubReq | | |
| 1559 | // |------------->| | |
| 1560 | // | | | |
| 1561 | // | | SubReq | |
| 1562 | // | |------------->| |
| 1563 | // | | | |
| 1564 | // | | SubFail | |
| 1565 | // | |<-------------| |
| 1566 | // | | | |
| 1567 | // | SubFail | | |
| 1568 | // |<-------------| | |
| 1569 | // | | | |
| 1570 | // |
| 1571 | //----------------------------------------------------------------------------- |
| 1572 | |
| 1573 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1574 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1575 | |
| 1576 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1577 | Counter{cSubReqFromXapp, 1}, |
| 1578 | Counter{cSubReqToE2, 1}, |
| 1579 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1580 | Counter{cSubFailToXapp, 1}, |
| 1581 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1582 | |
| 1583 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1584 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1585 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1586 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1587 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1588 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1589 | fparams1.Set(crereq1) |
| 1590 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1591 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1592 | // Xapp: Receive SubsFail |
| 1593 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1594 | |
| 1595 | // Wait that subs is cleaned |
| 1596 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1597 | |
| 1598 | xappConn1.TestMsgChanEmpty(t) |
| 1599 | xappConn2.TestMsgChanEmpty(t) |
| 1600 | e2termConn1.TestMsgChanEmpty(t) |
| 1601 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1602 | |
| 1603 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1604 | } |
| 1605 | |
| 1606 | //----------------------------------------------------------------------------- |
Himanshu Puorhit | d3fb160 | 2024-01-16 14:37:55 +0530 | [diff] [blame^] | 1607 | // TestSubReqSubFailRespInSubmgrOutofOrderIEs |
| 1608 | // |
| 1609 | // stub stub |
| 1610 | // +-------+ +---------+ +---------+ |
| 1611 | // | xapp | | submgr | | e2term | |
| 1612 | // +-------+ +---------+ +---------+ |
| 1613 | // | | | |
| 1614 | // | SubReq | | |
| 1615 | // |------------->| | |
| 1616 | // | | | |
| 1617 | // | | SubReq | |
| 1618 | // | |------------->| |
| 1619 | // | | | |
| 1620 | // | | SubFail | (Out of Order IEs) |
| 1621 | // | |<-------------| |
| 1622 | // | | | |
| 1623 | // | SubFail | | |
| 1624 | // |<-------------| | |
| 1625 | // | | | |
| 1626 | // |
| 1627 | //----------------------------------------------------------------------------- |
| 1628 | |
| 1629 | func TestSubReqSubFailRespInSubmgrOutofOrderIEs(t *testing.T) { |
| 1630 | CaseBegin("TestSubReqSubFailRespInSubmgrOutofOrderIEs start") |
| 1631 | |
| 1632 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 1633 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1634 | Counter{cSubReqFromXapp, 1}, |
| 1635 | Counter{cSubReqToE2, 1}, |
| 1636 | Counter{cSubFailFromE2, 1}, |
| 1637 | Counter{cSubFailToXapp, 1}, |
| 1638 | }) |
| 1639 | |
| 1640 | // Xapp: Send SubsReq |
| 1641 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 1642 | |
| 1643 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1644 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1645 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1646 | fparams1.Set(crereq1) |
| 1647 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1648 | |
| 1649 | // Xapp: Receive SubsFail |
| 1650 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1651 | |
| 1652 | // Wait that subs is cleaned |
| 1653 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1654 | |
| 1655 | xappConn1.TestMsgChanEmpty(t) |
| 1656 | xappConn2.TestMsgChanEmpty(t) |
| 1657 | e2termConn1.TestMsgChanEmpty(t) |
| 1658 | mainCtrl.wait_registry_empty(t, 10) |
| 1659 | |
| 1660 | mainCtrl.VerifyCounterValues(t) |
| 1661 | mainCtrl.c.e2ap.SetE2IEOrderCheck(1) |
| 1662 | } |
| 1663 | |
| 1664 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1665 | // TestSubDelReqRetryInSubmgr |
| 1666 | // |
| 1667 | // stub stub |
| 1668 | // +-------+ +---------+ +---------+ |
| 1669 | // | xapp | | submgr | | e2term | |
| 1670 | // +-------+ +---------+ +---------+ |
| 1671 | // | | | |
| 1672 | // | [SUBS CREATE] | |
| 1673 | // | | | |
| 1674 | // | | | |
| 1675 | // | SubDelReq | | |
| 1676 | // |------------->| | |
| 1677 | // | | | |
| 1678 | // | | SubDelReq | |
| 1679 | // | |------------->| |
| 1680 | // | | | |
| 1681 | // | | SubDelReq | |
| 1682 | // | |------------->| |
| 1683 | // | | | |
| 1684 | // | | SubDelResp | |
| 1685 | // | |<-------------| |
| 1686 | // | | | |
| 1687 | // | SubDelResp | | |
| 1688 | // |<-------------| | |
| 1689 | // |
| 1690 | //----------------------------------------------------------------------------- |
| 1691 | |
| 1692 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1693 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1694 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1695 | |
| 1696 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1697 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1698 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1699 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1700 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1701 | |
| 1702 | // Subs Delete |
| 1703 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1704 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1705 | |
| 1706 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1707 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1708 | |
| 1709 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1710 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1711 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1712 | |
| 1713 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1714 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1715 | |
| 1716 | // Wait that subs is cleaned |
| 1717 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1718 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1719 | xappConn1.TestMsgChanEmpty(t) |
| 1720 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1721 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1722 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1723 | } |
| 1724 | |
| 1725 | //----------------------------------------------------------------------------- |
| 1726 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1727 | // |
| 1728 | // stub stub |
| 1729 | // +-------+ +---------+ +---------+ |
| 1730 | // | xapp | | submgr | | e2term | |
| 1731 | // +-------+ +---------+ +---------+ |
| 1732 | // | | | |
| 1733 | // | [SUBS CREATE] | |
| 1734 | // | | | |
| 1735 | // | | | |
| 1736 | // | SubDelReq | | |
| 1737 | // |------------->| | |
| 1738 | // | | | |
| 1739 | // | | SubDelReq | |
| 1740 | // | |------------->| |
| 1741 | // | | | |
| 1742 | // | | SubDelReq | |
| 1743 | // | |------------->| |
| 1744 | // | | | |
| 1745 | // | | | |
| 1746 | // | SubDelResp | | |
| 1747 | // |<-------------| | |
| 1748 | // |
| 1749 | //----------------------------------------------------------------------------- |
| 1750 | |
| 1751 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1752 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1753 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1754 | |
| 1755 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1756 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1757 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1758 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1759 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1760 | |
| 1761 | // Subs Delete |
| 1762 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1763 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1764 | |
| 1765 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1766 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1767 | |
| 1768 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1769 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1770 | |
| 1771 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1773 | |
| 1774 | // Wait that subs is cleaned |
| 1775 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1776 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1777 | xappConn1.TestMsgChanEmpty(t) |
| 1778 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1779 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1780 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1781 | } |
| 1782 | |
| 1783 | //----------------------------------------------------------------------------- |
| 1784 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1785 | // |
| 1786 | // stub stub |
| 1787 | // +-------+ +---------+ +---------+ |
| 1788 | // | xapp | | submgr | | e2term | |
| 1789 | // +-------+ +---------+ +---------+ |
| 1790 | // | | | |
| 1791 | // | [SUBS CREATE] | |
| 1792 | // | | | |
| 1793 | // | | | |
| 1794 | // | SubDelReq | | |
| 1795 | // |------------->| | |
| 1796 | // | | | |
| 1797 | // | | SubDelReq | |
| 1798 | // | |------------->| |
| 1799 | // | | | |
| 1800 | // | | SubDelFail | |
| 1801 | // | |<-------------| |
| 1802 | // | | | |
| 1803 | // | SubDelResp | | |
| 1804 | // |<-------------| | |
| 1805 | // | | | |
| 1806 | // |
| 1807 | //----------------------------------------------------------------------------- |
| 1808 | |
| 1809 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1810 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1811 | |
| 1812 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1813 | Counter{cSubReqFromXapp, 1}, |
| 1814 | Counter{cSubReqToE2, 1}, |
| 1815 | Counter{cSubRespFromE2, 1}, |
| 1816 | Counter{cSubRespToXapp, 1}, |
| 1817 | Counter{cSubDelReqFromXapp, 1}, |
| 1818 | Counter{cSubDelReqToE2, 1}, |
| 1819 | Counter{cSubDelFailFromE2, 1}, |
| 1820 | Counter{cSubDelRespToXapp, 1}, |
| 1821 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1822 | |
| 1823 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1824 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1825 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1826 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1827 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1828 | |
| 1829 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1830 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1831 | |
| 1832 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1833 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1834 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1835 | |
| 1836 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1837 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1838 | |
| 1839 | // Wait that subs is cleaned |
| 1840 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1841 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1842 | xappConn1.TestMsgChanEmpty(t) |
| 1843 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1844 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1845 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1846 | |
| 1847 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1848 | } |
| 1849 | |
| 1850 | //----------------------------------------------------------------------------- |
Himanshu Puorhit | d3fb160 | 2024-01-16 14:37:55 +0530 | [diff] [blame^] | 1851 | // TestSubDelReqSubDelFailRespInSubmgrOutofOrderIEs |
| 1852 | // |
| 1853 | // stub stub |
| 1854 | // +-------+ +---------+ +---------+ |
| 1855 | // | xapp | | submgr | | e2term | |
| 1856 | // +-------+ +---------+ +---------+ |
| 1857 | // | | | |
| 1858 | // | [SUBS CREATE] | |
| 1859 | // | | | |
| 1860 | // | | | |
| 1861 | // | SubDelReq | | |
| 1862 | // |------------->| | |
| 1863 | // | | | |
| 1864 | // | | SubDelReq | |
| 1865 | // | |------------->| |
| 1866 | // | | | |
| 1867 | // | | SubDelFail | (Out of Order IEs) |
| 1868 | // | |<-------------| |
| 1869 | // | | | |
| 1870 | // | SubDelResp | | |
| 1871 | // |<-------------| | |
| 1872 | // | | | |
| 1873 | // |
| 1874 | //----------------------------------------------------------------------------- |
| 1875 | |
| 1876 | func TestSubDelReqSubDelFailRespInSubmgrOutofOrderIEs(t *testing.T) { |
| 1877 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
| 1878 | |
| 1879 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 1880 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1881 | Counter{cSubReqFromXapp, 1}, |
| 1882 | Counter{cSubReqToE2, 1}, |
| 1883 | Counter{cSubRespFromE2, 1}, |
| 1884 | Counter{cSubRespToXapp, 1}, |
| 1885 | Counter{cSubDelReqFromXapp, 1}, |
| 1886 | Counter{cSubDelReqToE2, 1}, |
| 1887 | Counter{cSubDelFailFromE2, 1}, |
| 1888 | Counter{cSubDelRespToXapp, 1}, |
| 1889 | }) |
| 1890 | |
| 1891 | // Subs Create |
| 1892 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 1893 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1894 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1895 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1896 | |
| 1897 | // Xapp: Send SubsDelReq |
| 1898 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1899 | |
| 1900 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 1901 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1902 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 1903 | |
| 1904 | // Xapp: Receive SubsDelResp |
| 1905 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1906 | |
| 1907 | // Wait that subs is cleaned |
| 1908 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1909 | |
| 1910 | xappConn1.TestMsgChanEmpty(t) |
| 1911 | xappConn2.TestMsgChanEmpty(t) |
| 1912 | e2termConn1.TestMsgChanEmpty(t) |
| 1913 | mainCtrl.wait_registry_empty(t, 10) |
| 1914 | |
| 1915 | mainCtrl.VerifyCounterValues(t) |
| 1916 | mainCtrl.c.e2ap.SetE2IEOrderCheck(1) |
| 1917 | } |
| 1918 | |
| 1919 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1920 | // TestSubReqAndSubDelOkSameAction |
| 1921 | // |
| 1922 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1923 | // +-------+ +-------+ +---------+ +---------+ |
| 1924 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1925 | // +-------+ +-------+ +---------+ +---------+ |
| 1926 | // | | | | |
| 1927 | // | | | | |
| 1928 | // | | | | |
| 1929 | // | | SubReq1 | | |
| 1930 | // | |------------->| | |
| 1931 | // | | | | |
| 1932 | // | | | SubReq1 | |
| 1933 | // | | |------------->| |
| 1934 | // | | | SubResp1 | |
| 1935 | // | | |<-------------| |
| 1936 | // | | SubResp1 | | |
| 1937 | // | |<-------------| | |
| 1938 | // | | | | |
| 1939 | // | SubReq2 | | |
| 1940 | // |--------------------------->| | |
| 1941 | // | | | | |
| 1942 | // | SubResp2 | | |
| 1943 | // |<---------------------------| | |
| 1944 | // | | | | |
| 1945 | // | | SubDelReq 1 | | |
| 1946 | // | |------------->| | |
| 1947 | // | | | | |
| 1948 | // | | SubDelResp 1 | | |
| 1949 | // | |<-------------| | |
| 1950 | // | | | | |
| 1951 | // | SubDelReq 2 | | |
| 1952 | // |--------------------------->| | |
| 1953 | // | | | | |
| 1954 | // | | | SubDelReq 2 | |
| 1955 | // | | |------------->| |
| 1956 | // | | | | |
| 1957 | // | | | SubDelReq 2 | |
| 1958 | // | | |------------->| |
| 1959 | // | | | | |
| 1960 | // | SubDelResp 2 | | |
| 1961 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1962 | // |
| 1963 | //----------------------------------------------------------------------------- |
| 1964 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1965 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1966 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1967 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1968 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1969 | Counter{cSubReqFromXapp, 2}, |
| 1970 | Counter{cSubReqToE2, 1}, |
| 1971 | Counter{cSubRespFromE2, 1}, |
| 1972 | Counter{cSubRespToXapp, 2}, |
| 1973 | Counter{cMergedSubscriptions, 1}, |
| 1974 | Counter{cUnmergedSubscriptions, 1}, |
| 1975 | Counter{cSubDelReqFromXapp, 2}, |
| 1976 | Counter{cSubDelReqToE2, 1}, |
| 1977 | Counter{cSubDelRespFromE2, 1}, |
| 1978 | Counter{cSubDelRespToXapp, 2}, |
| 1979 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1980 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1981 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1982 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1983 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1984 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1985 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1986 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1987 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1988 | |
| 1989 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1990 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1991 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1992 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1993 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1994 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1995 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1996 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1997 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1998 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1999 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2000 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2001 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2002 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2003 | |
| 2004 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2005 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2006 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2007 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2008 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2009 | //Wait that subs is cleaned |
| 2010 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2011 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2012 | xappConn1.TestMsgChanEmpty(t) |
| 2013 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2014 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2015 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 2016 | |
| 2017 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2018 | } |
| 2019 | |
| 2020 | //----------------------------------------------------------------------------- |
| 2021 | // TestSubReqAndSubDelOkSameActionParallel |
| 2022 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2023 | // stub stub stub |
| 2024 | // +-------+ +-------+ +---------+ +---------+ |
| 2025 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2026 | // +-------+ +-------+ +---------+ +---------+ |
| 2027 | // | | | | |
| 2028 | // | | | | |
| 2029 | // | | | | |
| 2030 | // | | SubReq1 | | |
| 2031 | // | |------------->| | |
| 2032 | // | | | | |
| 2033 | // | | | SubReq1 | |
| 2034 | // | | |------------->| |
| 2035 | // | SubReq2 | | |
| 2036 | // |--------------------------->| | |
| 2037 | // | | | SubResp1 | |
| 2038 | // | | |<-------------| |
| 2039 | // | | SubResp1 | | |
| 2040 | // | |<-------------| | |
| 2041 | // | | | | |
| 2042 | // | SubResp2 | | |
| 2043 | // |<---------------------------| | |
| 2044 | // | | | | |
| 2045 | // | | SubDelReq 1 | | |
| 2046 | // | |------------->| | |
| 2047 | // | | | | |
| 2048 | // | | SubDelResp 1 | | |
| 2049 | // | |<-------------| | |
| 2050 | // | | | | |
| 2051 | // | SubDelReq 2 | | |
| 2052 | // |--------------------------->| | |
| 2053 | // | | | | |
| 2054 | // | | | SubDelReq 2 | |
| 2055 | // | | |------------->| |
| 2056 | // | | | | |
| 2057 | // | | | SubDelReq 2 | |
| 2058 | // | | |------------->| |
| 2059 | // | | | | |
| 2060 | // | SubDelResp 2 | | |
| 2061 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2062 | // |
| 2063 | //----------------------------------------------------------------------------- |
| 2064 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2065 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2066 | |
| 2067 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2068 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2069 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2070 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2071 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2072 | |
| 2073 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2074 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2075 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2076 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2077 | |
| 2078 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2079 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2080 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2081 | |
| 2082 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2083 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2084 | |
| 2085 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2086 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2087 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2088 | |
| 2089 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2090 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2091 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2092 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2093 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2094 | |
| 2095 | //Wait that subs is cleaned |
| 2096 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2097 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2098 | xappConn1.TestMsgChanEmpty(t) |
| 2099 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2100 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2101 | mainCtrl.wait_registry_empty(t, 10) |
| 2102 | } |
| 2103 | |
| 2104 | //----------------------------------------------------------------------------- |
| 2105 | // TestSubReqAndSubDelNokSameActionParallel |
| 2106 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2107 | // stub stub stub |
| 2108 | // +-------+ +-------+ +---------+ +---------+ |
| 2109 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2110 | // +-------+ +-------+ +---------+ +---------+ |
| 2111 | // | | | | |
| 2112 | // | | | | |
| 2113 | // | | | | |
| 2114 | // | | SubReq1 | | |
| 2115 | // | |------------->| | |
| 2116 | // | | | | |
| 2117 | // | | | SubReq1 | |
| 2118 | // | | |------------->| |
| 2119 | // | SubReq2 | | |
| 2120 | // |--------------------------->| | |
| 2121 | // | | | SubFail1 | |
| 2122 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2123 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2124 | // | | SubFail1 | | |
| 2125 | // | |<-------------| | |
| 2126 | // | | | | |
| 2127 | // | SubFail2 | | |
| 2128 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2129 | // |
| 2130 | //----------------------------------------------------------------------------- |
| 2131 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2132 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2133 | |
| 2134 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2135 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2136 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2137 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2138 | |
| 2139 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2140 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2141 | |
| 2142 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2143 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2144 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2145 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2146 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2147 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2148 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2149 | // E2t: send SubsFail (first) |
| 2150 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 2151 | fparams1.Set(crereq1) |
| 2152 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 2153 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2154 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2155 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2156 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2157 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2158 | |
| 2159 | //Wait that subs is cleaned |
| 2160 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 2161 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2162 | xappConn1.TestMsgChanEmpty(t) |
| 2163 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2164 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2165 | mainCtrl.wait_registry_empty(t, 10) |
| 2166 | } |
| 2167 | |
| 2168 | //----------------------------------------------------------------------------- |
| 2169 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 2170 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2171 | // stub stub stub |
| 2172 | // +-------+ +-------+ +---------+ +---------+ |
| 2173 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2174 | // +-------+ +-------+ +---------+ +---------+ |
| 2175 | // | | | | |
| 2176 | // | | | | |
| 2177 | // | | | | |
| 2178 | // | | SubReq1 | | |
| 2179 | // | |------------->| | |
| 2180 | // | | | | |
| 2181 | // | | | SubReq1 | |
| 2182 | // | | |------------->| |
| 2183 | // | | SubReq2 | | |
| 2184 | // |--------------------------->| | |
| 2185 | // | | | | |
| 2186 | // | | | SubReq1 | |
| 2187 | // | | |------------->| |
| 2188 | // | | | | |
| 2189 | // | | | | |
| 2190 | // | | | SubDelReq | |
| 2191 | // | | |------------->| |
| 2192 | // | | | | |
| 2193 | // | | | SubDelResp | |
| 2194 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2195 | // |
| 2196 | //----------------------------------------------------------------------------- |
| 2197 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2198 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2199 | |
| 2200 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2201 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2202 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2203 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2204 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2205 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2206 | |
| 2207 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2208 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2209 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2210 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2211 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2212 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2213 | |
| 2214 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2215 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2216 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2217 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2218 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2219 | |
| 2220 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2221 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2222 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2223 | xappConn1.TestMsgChanEmpty(t) |
| 2224 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2225 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2226 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2227 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2228 | |
| 2229 | //----------------------------- Policy cases --------------------------------- |
| 2230 | //----------------------------------------------------------------------------- |
| 2231 | // TestSubReqPolicyAndSubDelOk |
| 2232 | // |
| 2233 | // stub stub |
| 2234 | // +-------+ +---------+ +---------+ |
| 2235 | // | xapp | | submgr | | e2term | |
| 2236 | // +-------+ +---------+ +---------+ |
| 2237 | // | | | |
| 2238 | // | SubReq | | |
| 2239 | // |------------->| | |
| 2240 | // | | | |
| 2241 | // | | SubReq | |
| 2242 | // | |------------->| |
| 2243 | // | | | |
| 2244 | // | | SubResp | |
| 2245 | // | |<-------------| |
| 2246 | // | | | |
| 2247 | // | SubResp | | |
| 2248 | // |<-------------| | |
| 2249 | // | | | |
| 2250 | // | | | |
| 2251 | // | SubDelReq | | |
| 2252 | // |------------->| | |
| 2253 | // | | | |
| 2254 | // | | SubDelReq | |
| 2255 | // | |------------->| |
| 2256 | // | | | |
| 2257 | // | | SubDelResp | |
| 2258 | // | |<-------------| |
| 2259 | // | | | |
| 2260 | // | SubDelResp | | |
| 2261 | // |<-------------| | |
| 2262 | // |
| 2263 | //----------------------------------------------------------------------------- |
| 2264 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2265 | CaseBegin("TestSubReqAndSubDelOk") |
| 2266 | |
| 2267 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2268 | rparams1.Init() |
| 2269 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2270 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2271 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2272 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2273 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2274 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2275 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2276 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2277 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2278 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2279 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2280 | |
| 2281 | //Wait that subs is cleaned |
| 2282 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2283 | |
| 2284 | xappConn1.TestMsgChanEmpty(t) |
| 2285 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2286 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2287 | mainCtrl.wait_registry_empty(t, 10) |
| 2288 | } |
| 2289 | |
| 2290 | //----------------------------------------------------------------------------- |
| 2291 | // TestSubReqPolicyChangeAndSubDelOk |
| 2292 | // |
| 2293 | // stub stub |
| 2294 | // +-------+ +---------+ +---------+ |
| 2295 | // | xapp | | submgr | | e2term | |
| 2296 | // +-------+ +---------+ +---------+ |
| 2297 | // | | | |
| 2298 | // | SubReq | | |
| 2299 | // |------------->| | |
| 2300 | // | | | |
| 2301 | // | | SubReq | |
| 2302 | // | |------------->| |
| 2303 | // | | | |
| 2304 | // | | SubResp | |
| 2305 | // | |<-------------| |
| 2306 | // | | | |
| 2307 | // | SubResp | | |
| 2308 | // |<-------------| | |
| 2309 | // | | | |
| 2310 | // | SubReq | | |
| 2311 | // |------------->| | |
| 2312 | // | | | |
| 2313 | // | | SubReq | |
| 2314 | // | |------------->| |
| 2315 | // | | | |
| 2316 | // | | SubResp | |
| 2317 | // | |<-------------| |
| 2318 | // | | | |
| 2319 | // | SubResp | | |
| 2320 | // |<-------------| | |
| 2321 | // | | | |
| 2322 | // | SubDelReq | | |
| 2323 | // |------------->| | |
| 2324 | // | | | |
| 2325 | // | | SubDelReq | |
| 2326 | // | |------------->| |
| 2327 | // | | | |
| 2328 | // | | SubDelResp | |
| 2329 | // | |<-------------| |
| 2330 | // | | | |
| 2331 | // | SubDelResp | | |
| 2332 | // |<-------------| | |
| 2333 | // |
| 2334 | //----------------------------------------------------------------------------- |
| 2335 | |
| 2336 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2337 | CaseBegin("TestSubReqAndSubDelOk") |
| 2338 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2339 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2340 | rparams1.Init() |
| 2341 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2342 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2343 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2344 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2345 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2346 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2347 | |
| 2348 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2349 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2350 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2351 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2352 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2353 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2354 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2355 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2356 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2357 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2358 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2359 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2360 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2361 | |
| 2362 | //Wait that subs is cleaned |
| 2363 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2364 | |
| 2365 | xappConn1.TestMsgChanEmpty(t) |
| 2366 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2367 | e2termConn1.TestMsgChanEmpty(t) |
| 2368 | mainCtrl.wait_registry_empty(t, 10) |
| 2369 | } |
| 2370 | |
| 2371 | //----------------------------------------------------------------------------- |
| 2372 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2373 | // |
| 2374 | // stub stub stub |
| 2375 | // +-------+ +---------+ +---------+ +---------+ |
| 2376 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2377 | // +-------+ +---------+ +---------+ +---------+ |
| 2378 | // | | | | |
| 2379 | // | | | | |
| 2380 | // | | | | |
| 2381 | // | SubReq1 | | | |
| 2382 | // |------------->| | | |
| 2383 | // | | | | |
| 2384 | // | | SubReq1 | | |
| 2385 | // | |------------->| | |
| 2386 | // | | | | |
| 2387 | // | SubReq2 | | | |
| 2388 | // |------------->| | | |
| 2389 | // | | | | |
| 2390 | // | | SubReq2 | | |
| 2391 | // | |---------------------------->| |
| 2392 | // | | | | |
| 2393 | // | | SubResp1 | | |
| 2394 | // | |<-------------| | |
| 2395 | // | SubResp1 | | | |
| 2396 | // |<-------------| | | |
| 2397 | // | | SubResp2 | | |
| 2398 | // | |<----------------------------| |
| 2399 | // | SubResp2 | | | |
| 2400 | // |<-------------| | | |
| 2401 | // | | | | |
| 2402 | // | [SUBS 1 DELETE] | | |
| 2403 | // | | | | |
| 2404 | // | [SUBS 2 DELETE] | | |
| 2405 | // | | | | |
| 2406 | // |
| 2407 | //----------------------------------------------------------------------------- |
| 2408 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2409 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2410 | |
| 2411 | //Req1 |
| 2412 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2413 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2414 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2415 | |
| 2416 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2417 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2418 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2419 | |
| 2420 | //Resp1 |
| 2421 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2422 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2423 | |
| 2424 | //Resp2 |
| 2425 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2426 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2427 | |
| 2428 | //Del1 |
| 2429 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2430 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2431 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2432 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2433 | //Wait that subs is cleaned |
| 2434 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2435 | |
| 2436 | //Del2 |
| 2437 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2438 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2439 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2440 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2441 | //Wait that subs is cleaned |
| 2442 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2443 | |
| 2444 | xappConn1.TestMsgChanEmpty(t) |
| 2445 | xappConn2.TestMsgChanEmpty(t) |
| 2446 | e2termConn1.TestMsgChanEmpty(t) |
| 2447 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2448 | mainCtrl.wait_registry_empty(t, 10) |
| 2449 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2450 | |
| 2451 | //----------------------------------------------------------------------------- |
| 2452 | // TestSubReqInsertAndSubDelOk |
| 2453 | // |
| 2454 | // stub stub |
| 2455 | // +-------+ +---------+ +---------+ |
| 2456 | // | xapp | | submgr | | e2term | |
| 2457 | // +-------+ +---------+ +---------+ |
| 2458 | // | | | |
| 2459 | // | SubReq | | |
| 2460 | // |------------->| | |
| 2461 | // | | | |
| 2462 | // | | SubReq | |
| 2463 | // | |------------->| |
| 2464 | // | | | |
| 2465 | // | | SubResp | |
| 2466 | // | |<-------------| |
| 2467 | // | | | |
| 2468 | // | SubResp | | |
| 2469 | // |<-------------| | |
| 2470 | // | | | |
| 2471 | // | | | |
| 2472 | // | SubDelReq | | |
| 2473 | // |------------->| | |
| 2474 | // | | | |
| 2475 | // | | SubDelReq | |
| 2476 | // | |------------->| |
| 2477 | // | | | |
| 2478 | // | | SubDelResp | |
| 2479 | // | |<-------------| |
| 2480 | // | | | |
| 2481 | // | SubDelResp | | |
| 2482 | // |<-------------| | |
| 2483 | // |
| 2484 | //----------------------------------------------------------------------------- |
| 2485 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2486 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2487 | |
| 2488 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2489 | rparams1.Init() |
| 2490 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2491 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2492 | |
| 2493 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2494 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2495 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2496 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2497 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2498 | |
| 2499 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2500 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2501 | |
| 2502 | //Wait that subs is cleaned |
| 2503 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2504 | |
| 2505 | xappConn1.TestMsgChanEmpty(t) |
| 2506 | xappConn2.TestMsgChanEmpty(t) |
| 2507 | e2termConn1.TestMsgChanEmpty(t) |
| 2508 | mainCtrl.wait_registry_empty(t, 10) |
| 2509 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2510 | |
| 2511 | //----------------------------------------------------------------------------- |
| 2512 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2513 | // |
| 2514 | // This case simulates case where xApp restarts and starts sending same |
| 2515 | // subscription requests which have already subscribed successfully |
| 2516 | |
| 2517 | // stub stub |
| 2518 | // +-------+ +---------+ +---------+ |
| 2519 | // | xapp | | submgr | | e2term | |
| 2520 | // +-------+ +---------+ +---------+ |
| 2521 | // | | | |
| 2522 | // | SubReq | | |
| 2523 | // |------------->| | |
| 2524 | // | | | |
| 2525 | // | | SubReq | |
| 2526 | // | |------------->| |
| 2527 | // | | | |
| 2528 | // | | SubResp | |
| 2529 | // | |<-------------| |
| 2530 | // | | | |
| 2531 | // | SubResp | | |
| 2532 | // |<-------------| | |
| 2533 | // | | | |
| 2534 | // | xApp restart | | |
| 2535 | // | | | |
| 2536 | // | SubReq | | |
| 2537 | // | (retrans with same xApp generated subid but diff xid) |
| 2538 | // |------------->| | |
| 2539 | // | | | |
| 2540 | // | SubResp | | |
| 2541 | // |<-------------| | |
| 2542 | // | | | |
| 2543 | // | [SUBS DELETE] | |
| 2544 | // | | | |
| 2545 | // |
| 2546 | //----------------------------------------------------------------------------- |
| 2547 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2548 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2549 | |
| 2550 | //Subs Create |
| 2551 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2552 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2553 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2554 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2555 | |
| 2556 | // xApp restart here |
| 2557 | // --> artificial delay |
| 2558 | <-time.After(1 * time.Second) |
| 2559 | |
| 2560 | //Subs Create |
| 2561 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2562 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2563 | |
| 2564 | //Subs Delete |
| 2565 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2566 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2567 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2568 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2569 | |
| 2570 | //Wait that subs is cleaned |
| 2571 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2572 | |
| 2573 | xappConn1.TestMsgChanEmpty(t) |
| 2574 | xappConn2.TestMsgChanEmpty(t) |
| 2575 | e2termConn1.TestMsgChanEmpty(t) |
| 2576 | mainCtrl.wait_registry_empty(t, 10) |
| 2577 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2578 | |
| 2579 | //----------------------------------------------------------------------------- |
| 2580 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2581 | // |
| 2582 | // stub stub |
| 2583 | // +-------+ +---------+ +---------+ |
| 2584 | // | xapp | | submgr | | e2term | |
| 2585 | // +-------+ +---------+ +---------+ |
| 2586 | // | | | |
| 2587 | // | SubReq | | |
| 2588 | // |------------->| | |
| 2589 | // | | | |
| 2590 | // | | SubReq | |
| 2591 | // | |------------->| |
| 2592 | // | | | |
| 2593 | // | | SubResp | |
| 2594 | // | <----| |
| 2595 | // | | |
| 2596 | // | Submgr restart | |
| 2597 | // | | |
| 2598 | // | | | |
| 2599 | // | | SubDelReq | |
| 2600 | // | |------------->| |
| 2601 | // | | | |
| 2602 | // | | SubDelResp | |
| 2603 | // | |<-------------| |
| 2604 | // | | | |
| 2605 | // |
| 2606 | //----------------------------------------------------------------------------- |
| 2607 | |
| 2608 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2609 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2610 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2611 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2612 | xappConn1.SendSubsReq(t, nil, nil) |
| 2613 | e2termConn1.RecvSubsReq(t) |
| 2614 | mainCtrl.SetResetTestFlag(t, false) |
| 2615 | |
| 2616 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2617 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2618 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2619 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2620 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2621 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2622 | mainCtrl.SimulateRestart(t) |
| 2623 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2624 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2625 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2626 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2627 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2628 | |
| 2629 | // Wait that subs is cleaned |
| 2630 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2631 | |
| 2632 | xappConn1.TestMsgChanEmpty(t) |
| 2633 | xappConn2.TestMsgChanEmpty(t) |
| 2634 | e2termConn1.TestMsgChanEmpty(t) |
| 2635 | mainCtrl.wait_registry_empty(t, 10) |
| 2636 | } |
| 2637 | |
| 2638 | //----------------------------------------------------------------------------- |
| 2639 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2640 | // |
| 2641 | // stub stub |
| 2642 | // +-------+ +---------+ +---------+ |
| 2643 | // | xapp | | submgr | | e2term | |
| 2644 | // +-------+ +---------+ +---------+ |
| 2645 | // | | | |
| 2646 | // | SubReq | | |
| 2647 | // |------------->| | |
| 2648 | // | | | |
| 2649 | // | | SubReq | |
| 2650 | // | |------------->| |
| 2651 | // | | | |
| 2652 | // | | SubResp | |
| 2653 | // | |<-------------| |
| 2654 | // | | | |
| 2655 | // | SubResp | | |
| 2656 | // |<-------------| | |
| 2657 | // | | | |
| 2658 | // | | |
| 2659 | // | Submgr restart | |
| 2660 | // | | |
| 2661 | // | SubDelReq | | |
| 2662 | // |------------->| | |
| 2663 | // | | | |
| 2664 | // | | SubDelReq | |
| 2665 | // | |------------->| |
| 2666 | // | | | |
| 2667 | // | | SubDelResp | |
| 2668 | // | |<-------------| |
| 2669 | // | | | |
| 2670 | // | SubDelResp | | |
| 2671 | // |<-------------| | |
| 2672 | // |
| 2673 | //----------------------------------------------------------------------------- |
| 2674 | |
| 2675 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2676 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2677 | |
| 2678 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2679 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2680 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2681 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2682 | |
| 2683 | // Check subscription |
| 2684 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2685 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2686 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2687 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2688 | |
| 2689 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2690 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2691 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2692 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2693 | // That needs to be completed before successful subscription query is possible |
| 2694 | <-time.After(time.Second * 1) |
| 2695 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2696 | // Check that subscription is restored correctly after restart |
| 2697 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2698 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2699 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2700 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2701 | |
| 2702 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2703 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2704 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2705 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2706 | |
| 2707 | //Wait that subs is cleaned |
| 2708 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2709 | |
| 2710 | xappConn1.TestMsgChanEmpty(t) |
| 2711 | xappConn2.TestMsgChanEmpty(t) |
| 2712 | e2termConn1.TestMsgChanEmpty(t) |
| 2713 | mainCtrl.wait_registry_empty(t, 10) |
| 2714 | } |
| 2715 | |
| 2716 | //----------------------------------------------------------------------------- |
| 2717 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2718 | // |
| 2719 | // stub stub |
| 2720 | // +-------+ +-------+ +---------+ +---------+ |
| 2721 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2722 | // +-------+ +-------+ +---------+ +---------+ |
| 2723 | // | | | | |
| 2724 | // | | | | |
| 2725 | // | | | | |
| 2726 | // | | SubReq1 | | |
| 2727 | // | |------------->| | |
| 2728 | // | | | | |
| 2729 | // | | | SubReq1 | |
| 2730 | // | | |------------->| |
| 2731 | // | | | SubResp1 | |
| 2732 | // | | |<-------------| |
| 2733 | // | | SubResp1 | | |
| 2734 | // | |<-------------| | |
| 2735 | // | | | | |
| 2736 | // | | |
| 2737 | // | submgr restart | |
| 2738 | // | | |
| 2739 | // | | | | |
| 2740 | // | | | | |
| 2741 | // | SubReq2 | | |
| 2742 | // |--------------------------->| | |
| 2743 | // | | | | |
| 2744 | // | SubResp2 | | |
| 2745 | // |<---------------------------| | |
| 2746 | // | | | | |
| 2747 | // | | SubDelReq 1 | | |
| 2748 | // | |------------->| | |
| 2749 | // | | | | |
| 2750 | // | | SubDelResp 1 | | |
| 2751 | // | |<-------------| | |
| 2752 | // | | | | |
| 2753 | // | | | | |
| 2754 | // | | |
| 2755 | // | submgr restart | |
| 2756 | // | | |
| 2757 | // | | | | |
| 2758 | // | SubDelReq 2 | | |
| 2759 | // |--------------------------->| | |
| 2760 | // | | | | |
| 2761 | // | | | SubDelReq 2 | |
| 2762 | // | | |------------->| |
| 2763 | // | | | | |
| 2764 | // | | | SubDelReq 2 | |
| 2765 | // | | |------------->| |
| 2766 | // | | | | |
| 2767 | // | SubDelResp 2 | | |
| 2768 | // |<---------------------------| | |
| 2769 | // |
| 2770 | //----------------------------------------------------------------------------- |
| 2771 | |
| 2772 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2773 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2774 | |
| 2775 | //Req1 |
| 2776 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2777 | rparams1.Init() |
| 2778 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2779 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2780 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2781 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2782 | |
| 2783 | //Req2 |
| 2784 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2785 | rparams2.Init() |
| 2786 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2787 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2788 | |
| 2789 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2790 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2791 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2792 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2793 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2794 | |
| 2795 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2796 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2797 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2798 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2799 | // That needs to be completed before successful subscription query is possible |
| 2800 | <-time.After(time.Second * 1) |
| 2801 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2802 | // Check that subscription is restored correctly after restart |
| 2803 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2804 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2805 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2806 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2807 | |
| 2808 | //Del1 |
| 2809 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2810 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2811 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2812 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2813 | |
| 2814 | mainCtrl.SimulateRestart(t) |
| 2815 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2816 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2817 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2818 | // Submgr need be ready before successful subscription deletion is possible |
| 2819 | <-time.After(time.Second * 1) |
| 2820 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2821 | //Del2 |
| 2822 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2823 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2824 | |
| 2825 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2826 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2827 | |
| 2828 | //Wait that subs is cleaned |
| 2829 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2830 | |
| 2831 | xappConn1.TestMsgChanEmpty(t) |
| 2832 | xappConn2.TestMsgChanEmpty(t) |
| 2833 | e2termConn1.TestMsgChanEmpty(t) |
| 2834 | mainCtrl.wait_registry_empty(t, 10) |
| 2835 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2836 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2837 | //***************************************************************************** |
| 2838 | // REST interface test cases |
| 2839 | //***************************************************************************** |
| 2840 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2841 | //----------------------------------------------------------------------------- |
| 2842 | // Test debug GET and POST requests |
| 2843 | // |
| 2844 | // curl |
| 2845 | // +-------+ +---------+ |
| 2846 | // | user | | submgr | |
| 2847 | // +-------+ +---------+ |
| 2848 | // | | |
| 2849 | // | GET/POST Req | |
| 2850 | // |------------->| |
| 2851 | // | Resp | |
| 2852 | // |<-------------| |
| 2853 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2854 | func TestGetSubscriptions(t *testing.T) { |
| 2855 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2856 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2857 | } |
| 2858 | |
| 2859 | func TestGetSymptomData(t *testing.T) { |
| 2860 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2861 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2862 | } |
| 2863 | |
| 2864 | func TestPostdeleteSubId(t *testing.T) { |
| 2865 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2866 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2867 | } |
| 2868 | |
| 2869 | func TestPostEmptyDb(t *testing.T) { |
| 2870 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2871 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2872 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2873 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2874 | func TestGetRestSubscriptions(t *testing.T) { |
| 2875 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2876 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2877 | } |
| 2878 | |
| 2879 | //----------------------------------------------------------------------------- |
| 2880 | // TestDelAllE2nodeSubsViaDebugIf |
| 2881 | // |
| 2882 | // stub stub stub |
| 2883 | // +-------+ +---------+ +---------+ +---------+ |
| 2884 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2885 | // +-------+ +---------+ +---------+ +---------+ |
| 2886 | // | | | | |
| 2887 | // | RESTSubReq | | | |
| 2888 | // |---------------->| | | |
| 2889 | // | RESTSubResp | | | |
| 2890 | // |<----------------| | | |
| 2891 | // | | RouteCreate | | |
| 2892 | // | |--------------------------->| |
| 2893 | // | | RouteResponse| | |
| 2894 | // | |<---------------------------| |
| 2895 | // | | SubReq | | |
| 2896 | // | |------------->| | |
| 2897 | // | | SubResp | | |
| 2898 | // | |<-------------| | |
| 2899 | // | RESTNotif1 | | | |
| 2900 | // |<----------------| | | |
| 2901 | // | | | | |
| 2902 | // | REST get_all_e2nodes | | |
| 2903 | // |---------------->| | | |
| 2904 | // | OK 200 | | | |
| 2905 | // |<----------------| | | |
| 2906 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2907 | // |---------------->| | | |
| 2908 | // | OK 200 | | | |
| 2909 | // |<----------------| | | |
| 2910 | // | | SubDelReq | | |
| 2911 | // | |------------->| | |
| 2912 | // | | SubDelResp | | |
| 2913 | // | |<-------------| | |
| 2914 | // | | | | |
| 2915 | // | | RouteDelete | | |
| 2916 | // | |--------------------------->| |
| 2917 | // | | RouteResponse| | |
| 2918 | // | |<---------------------------| |
| 2919 | // |
| 2920 | //----------------------------------------------------------------------------- |
| 2921 | |
| 2922 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2923 | |
| 2924 | // Init counter check |
| 2925 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2926 | Counter{cRestSubReqFromXapp, 1}, |
| 2927 | Counter{cRestSubRespToXapp, 1}, |
| 2928 | Counter{cSubReqToE2, 1}, |
| 2929 | Counter{cSubRespFromE2, 1}, |
| 2930 | Counter{cRestSubNotifToXapp, 1}, |
| 2931 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2932 | Counter{cSubDelReqToE2, 1}, |
| 2933 | Counter{cSubDelRespFromE2, 1}, |
| 2934 | Counter{cRestSubDelRespToXapp, 1}, |
| 2935 | }) |
| 2936 | |
| 2937 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2938 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2939 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2940 | |
| 2941 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2942 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2943 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2944 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2945 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2946 | |
| 2947 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2948 | |
| 2949 | var e2nodesList []string |
| 2950 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2951 | if err != nil { |
| 2952 | t.Errorf("Unmarshal error: %s", err) |
| 2953 | } |
| 2954 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2955 | |
| 2956 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2957 | var e2RestSubsMap map[string]RESTSubscription |
| 2958 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2959 | if err != nil { |
| 2960 | t.Errorf("Unmarshal error: %s", err) |
| 2961 | } |
| 2962 | |
| 2963 | if len(e2RestSubsMap) != 1 { |
| 2964 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2965 | } |
| 2966 | |
| 2967 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2968 | 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] | 2969 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2970 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2971 | |
| 2972 | // Wait that subs is cleaned |
| 2973 | waitSubsCleanup(t, e2SubsId, 10) |
| 2974 | mainCtrl.VerifyCounterValues(t) |
| 2975 | mainCtrl.VerifyAllClean(t) |
| 2976 | } |
| 2977 | |
| 2978 | //----------------------------------------------------------------------------- |
| 2979 | // TestDelAllxAppSubsViaDebugIf |
| 2980 | // |
| 2981 | // stub stub stub |
| 2982 | // +-------+ +---------+ +---------+ +---------+ |
| 2983 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2984 | // +-------+ +---------+ +---------+ +---------+ |
| 2985 | // | | | | |
| 2986 | // | RESTSubReq | | | |
| 2987 | // |---------------->| | | |
| 2988 | // | RESTSubResp | | | |
| 2989 | // |<----------------| | | |
| 2990 | // | | RouteCreate | | |
| 2991 | // | |--------------------------->| |
| 2992 | // | | RouteResponse| | |
| 2993 | // | |<---------------------------| |
| 2994 | // | | SubReq | | |
| 2995 | // | |------------->| | |
| 2996 | // | | SubResp | | |
| 2997 | // | |<-------------| | |
| 2998 | // | RESTNotif1 | | | |
| 2999 | // |<----------------| | | |
| 3000 | // | | | | |
| 3001 | // | REST get_all_xapps | | |
| 3002 | // |---------------->| | | |
| 3003 | // | OK 200 | | | |
| 3004 | // |<----------------| | | |
| 3005 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 3006 | // |---------------->| | | |
| 3007 | // | OK 200 | | | |
| 3008 | // |<----------------| | | |
| 3009 | // | | SubDelReq | | |
| 3010 | // | |------------->| | |
| 3011 | // | | SubDelResp | | |
| 3012 | // | |<-------------| | |
| 3013 | // | | | | |
| 3014 | // | | RouteDelete | | |
| 3015 | // | |--------------------------->| |
| 3016 | // | | RouteResponse| | |
| 3017 | // | |<---------------------------| |
| 3018 | // |
| 3019 | //----------------------------------------------------------------------------- |
| 3020 | |
| 3021 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 3022 | |
| 3023 | // Init counter check |
| 3024 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3025 | Counter{cRestSubReqFromXapp, 1}, |
| 3026 | Counter{cRestSubRespToXapp, 1}, |
| 3027 | Counter{cSubReqToE2, 1}, |
| 3028 | Counter{cSubRespFromE2, 1}, |
| 3029 | Counter{cRestSubNotifToXapp, 1}, |
| 3030 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3031 | Counter{cSubDelReqToE2, 1}, |
| 3032 | Counter{cSubDelRespFromE2, 1}, |
| 3033 | Counter{cRestSubDelRespToXapp, 1}, |
| 3034 | }) |
| 3035 | |
| 3036 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3037 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3038 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3039 | |
| 3040 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3041 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3042 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3043 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3044 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 3045 | |
| 3046 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 3047 | |
| 3048 | var xappList []string |
| 3049 | err := json.Unmarshal(xappsJson, &xappList) |
| 3050 | if err != nil { |
| 3051 | t.Errorf("Unmarshal error: %s", err) |
| 3052 | } |
| 3053 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 3054 | |
| 3055 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 3056 | 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] | 3057 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3059 | |
| 3060 | // Wait that subs is cleaned |
| 3061 | waitSubsCleanup(t, e2SubsId, 10) |
| 3062 | mainCtrl.VerifyCounterValues(t) |
| 3063 | mainCtrl.VerifyAllClean(t) |
| 3064 | } |
| 3065 | |
| 3066 | //----------------------------------------------------------------------------- |
| 3067 | // TestDelViaxAppSubsIf |
| 3068 | // |
| 3069 | // stub stub stub |
| 3070 | // +-------+ +---------+ +---------+ +---------+ |
| 3071 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3072 | // +-------+ +---------+ +---------+ +---------+ |
| 3073 | // | | | | |
| 3074 | // | RESTSubReq | | | |
| 3075 | // |---------------->| | | |
| 3076 | // | RESTSubResp | | | |
| 3077 | // |<----------------| | | |
| 3078 | // | | RouteCreate | | |
| 3079 | // | |--------------------------->| |
| 3080 | // | | RouteResponse| | |
| 3081 | // | |<---------------------------| |
| 3082 | // | | SubReq | | |
| 3083 | // | |------------->| | |
| 3084 | // | | SubResp | | |
| 3085 | // | |<-------------| | |
| 3086 | // | RESTNotif1 | | | |
| 3087 | // |<----------------| | | |
| 3088 | // | | | | |
| 3089 | // | REST get_xapp_rest_restsubscriptions | |
| 3090 | // |---------------->| | | |
| 3091 | // | OK 200 | | | |
| 3092 | // |<----------------| | | |
| 3093 | // | RESTSudDel | | | |
| 3094 | // |---------------->| | | Via user curl command (port 8088) |
| 3095 | // | RESTSudDel | | | |
| 3096 | // |<----------------| | | |
| 3097 | // | | SubDelReq | | |
| 3098 | // | |------------->| | |
| 3099 | // | | SubDelResp | | |
| 3100 | // | |<-------------| | |
| 3101 | // | | | | |
| 3102 | // | | RouteDelete | | |
| 3103 | // | |--------------------------->| |
| 3104 | // | | RouteResponse| | |
| 3105 | // | |<---------------------------| |
| 3106 | // |
| 3107 | //----------------------------------------------------------------------------- |
| 3108 | |
| 3109 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 3110 | |
| 3111 | // Init counter check |
| 3112 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3113 | Counter{cRestSubReqFromXapp, 1}, |
| 3114 | Counter{cRestSubRespToXapp, 1}, |
| 3115 | Counter{cSubReqToE2, 1}, |
| 3116 | Counter{cSubRespFromE2, 1}, |
| 3117 | Counter{cRestSubNotifToXapp, 1}, |
| 3118 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3119 | Counter{cSubDelReqToE2, 1}, |
| 3120 | Counter{cSubDelRespFromE2, 1}, |
| 3121 | Counter{cRestSubDelRespToXapp, 1}, |
| 3122 | }) |
| 3123 | |
| 3124 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3125 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3126 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3127 | |
| 3128 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3129 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3130 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3131 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3132 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 3133 | |
| 3134 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 3135 | |
| 3136 | var restSubsMap map[string]RESTSubscription |
| 3137 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 3138 | if err != nil { |
| 3139 | t.Errorf("Unmarshal error: %s", err) |
| 3140 | } |
| 3141 | _, ok := restSubsMap[restSubId] |
| 3142 | if !ok { |
| 3143 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 3144 | } |
| 3145 | |
| 3146 | var e2Subscriptions []Subscription |
| 3147 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 3148 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 3149 | if err != nil { |
| 3150 | t.Errorf("Unmarshal error: %s", err) |
| 3151 | } |
| 3152 | if len(e2Subscriptions) != 1 { |
| 3153 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 3154 | } |
| 3155 | |
| 3156 | // Simulate deletion through xapp REST test interface |
| 3157 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 3158 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3159 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3160 | |
| 3161 | // Wait that subs is cleaned |
| 3162 | waitSubsCleanup(t, e2SubsId, 10) |
| 3163 | mainCtrl.VerifyCounterValues(t) |
| 3164 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 3165 | } |
| 3166 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3167 | //----------------------------------------------------------------------------- |
| 3168 | // TestRESTSubReqAndRouteNok |
| 3169 | // |
| 3170 | // stub stub |
| 3171 | // +-------+ +---------+ +---------+ |
| 3172 | // | xapp | | submgr | | rtmgr | |
| 3173 | // +-------+ +---------+ +---------+ |
| 3174 | // | | | |
| 3175 | // | RESTSubReq | | |
| 3176 | // |---------------->| | |
| 3177 | // | | | |
| 3178 | // | RESTSubResp | | |
| 3179 | // |<----------------| | |
| 3180 | // | | RouteCreate | |
| 3181 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3182 | // | | RouteCreate | |
| 3183 | // | | status:400 | |
| 3184 | // | |(Bad request) | |
| 3185 | // | |<-------------| |
| 3186 | // | RESTNotif | | |
| 3187 | // |<----------------| | |
| 3188 | // | | | |
| 3189 | // | [SUBS INT DELETE] | |
| 3190 | // | | | |
| 3191 | // | RESTSubDelReq | | |
| 3192 | // |---------------->| | |
| 3193 | // | RESTSubDelResp | | |
| 3194 | // |<----------------| | |
| 3195 | // |
| 3196 | //----------------------------------------------------------------------------- |
| 3197 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3198 | |
| 3199 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3200 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3201 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3202 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3203 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3204 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3205 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3206 | }) |
| 3207 | |
| 3208 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3209 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3210 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 3211 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3212 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 3213 | |
| 3214 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3215 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3216 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3217 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3218 | waiter.WaitResult(t) |
| 3219 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3220 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3221 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3222 | |
| 3223 | // Del |
| 3224 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3225 | |
| 3226 | // Wait that subs is cleaned |
| 3227 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3228 | waitSubsCleanup(t, e2SubsId, 10) |
| 3229 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3230 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3231 | } |
| 3232 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3233 | //----------------------------------------------------------------------------- |
| 3234 | // TestRESTSubReqAndRouteUpdateNok |
| 3235 | // |
| 3236 | // stub stub stub stub |
| 3237 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3238 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3239 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3240 | // | | | | | |
| 3241 | // | RESTSubReq1 | | | |
| 3242 | // |------------------------>| | | |
| 3243 | // | RESTSubResp2 | | | |
| 3244 | // |<------------------------| | | |
| 3245 | // | | | | | |
| 3246 | // | | | RouteCreate | | |
| 3247 | // | | |------------->| | |
| 3248 | // | | | CreateResp | | |
| 3249 | // | | |<-------------| | |
| 3250 | // | | | SubReq | | |
| 3251 | // | | |---------------------------->| |
| 3252 | // | | | SubResp | | |
| 3253 | // | | |<----------------------------| |
| 3254 | // | RESTNotif1 | | | |
| 3255 | // |<------------------------| | | |
| 3256 | // | | | | | |
| 3257 | // | | RESTSubReq2 | | | |
| 3258 | // | |------------>| | | |
| 3259 | // | | RESTSubResp2| | | |
| 3260 | // | |<------------| | | |
| 3261 | // | | | RouteUpdate | | |
| 3262 | // | | |------------->| | |
| 3263 | // | | | RouteUpdate | | |
| 3264 | // | | | status:400 | | |
| 3265 | // | | |(Bad request) | | |
| 3266 | // | | |<-------------| | |
| 3267 | // | | RESTNotif2(unsuccessful) | | |
| 3268 | // | |<------------| | | |
| 3269 | // | | | | | |
| 3270 | // | [SUBS INT DELETE] | | |
| 3271 | // | | | | | |
| 3272 | // | RESTSubDelReq1 | | | |
| 3273 | // |------------------------>| | | |
| 3274 | // | RESTSubDelResp1 | | | |
| 3275 | // |<------------------------| | | |
| 3276 | // | | | | | |
| 3277 | // | | | [SUBS DELETE] | |
| 3278 | // |
| 3279 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3280 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3281 | |
| 3282 | //Init counter check |
| 3283 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3284 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3285 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3286 | Counter{cSubReqToE2, 1}, |
| 3287 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3288 | Counter{cRestSubNotifToXapp, 1}, |
| 3289 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3290 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3291 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3292 | Counter{cSubDelReqToE2, 1}, |
| 3293 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3294 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3295 | }) |
| 3296 | |
| 3297 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3298 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3299 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3300 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3301 | |
| 3302 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3303 | |
| 3304 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3305 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3306 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3307 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3308 | params.SetMeid("RAN_NAME_1") |
| 3309 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3310 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3311 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3312 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3313 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3314 | |
| 3315 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3316 | |
| 3317 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3318 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3319 | |
| 3320 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3321 | //Wait that subs is cleaned |
| 3322 | waitSubsCleanup(t, e2SubsId, 10) |
| 3323 | |
| 3324 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3325 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | } |
| 3327 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3328 | //----------------------------------------------------------------------------- |
| 3329 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3330 | // |
| 3331 | // stub stub stub |
| 3332 | // +-------+ +---------+ +---------+ +---------+ |
| 3333 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3334 | // +-------+ +---------+ +---------+ +---------+ |
| 3335 | // | | | | |
| 3336 | // | RESTSubReq | | | |
| 3337 | // |---------------->| | | |
| 3338 | // | | | | |
| 3339 | // | RESTSubResp | | | |
| 3340 | // |<----------------| | | |
| 3341 | // | | SubReq | | |
| 3342 | // | |---------------------------->| |
| 3343 | // | | SubResp | | |
| 3344 | // | |<----------------------------| |
| 3345 | // | RESTNotif | | | |
| 3346 | // |<----------------| | | |
| 3347 | // | | | | |
| 3348 | // | | | | |
| 3349 | // | RESTSubDelReq | | | |
| 3350 | // |---------------->| | | |
| 3351 | // | RESTSubDelResp | | | |
| 3352 | // |<----------------| | | |
| 3353 | // | | SubSelReq | | |
| 3354 | // | |---------------------------->| |
| 3355 | // | | SubSelResp | | |
| 3356 | // | |<----------------------------| |
| 3357 | // | | RouteDelete | | |
| 3358 | // | |------------->| | |
| 3359 | // | | Routedelete | | |
| 3360 | // | | status:400 | | |
| 3361 | // | |(Bad request) | | |
| 3362 | // | |<-------------| | |
| 3363 | // |
| 3364 | //----------------------------------------------------------------------------- |
| 3365 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3366 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3367 | |
| 3368 | // Init counter check |
| 3369 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3370 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3371 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3372 | Counter{cSubReqToE2, 1}, |
| 3373 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3374 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3375 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3376 | Counter{cRouteDeleteFail, 1}, |
| 3377 | Counter{cSubDelReqToE2, 1}, |
| 3378 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3379 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3380 | }) |
| 3381 | |
| 3382 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3383 | |
| 3384 | //Subs Create |
| 3385 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3386 | |
| 3387 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3388 | |
| 3389 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3390 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3391 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3392 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3393 | waiter.WaitResult(t) |
| 3394 | |
| 3395 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3396 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3397 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3398 | } |
| 3399 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3400 | //----------------------------------------------------------------------------- |
| 3401 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3402 | // |
| 3403 | // stub stub stub stub |
| 3404 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3405 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3406 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3407 | // | | | | | |
| 3408 | // | RESTSubReq1 | | | |
| 3409 | // |------------------------>| | | |
| 3410 | // | RESTSubResp2 | | | |
| 3411 | // |<------------------------| | | |
| 3412 | // | | | | | |
| 3413 | // | | | RouteCreate | | |
| 3414 | // | | |------------->| | |
| 3415 | // | | | CreateResp | | |
| 3416 | // | | |<-------------| | |
| 3417 | // | | | SubReq | | |
| 3418 | // | | |---------------------------->| |
| 3419 | // | | | SubResp | | |
| 3420 | // | | |<----------------------------| |
| 3421 | // | RESTNotif1 | | | |
| 3422 | // |<------------------------| | | |
| 3423 | // | | | | | |
| 3424 | // | | RESTSubReq2 | | | |
| 3425 | // | |------------>| | | |
| 3426 | // | | RESTSubResp2| | | |
| 3427 | // | |<------------| | | |
| 3428 | // | | | RouteCreate | | |
| 3429 | // | | |------------->| | |
| 3430 | // | | | CreateResp | | |
| 3431 | // | | |<-------------| | |
| 3432 | // | | | SubReq | | |
| 3433 | // | | |---------------------------->| |
| 3434 | // | | | SubResp | | |
| 3435 | // | | |<----------------------------| |
| 3436 | // | | RESTNotif2 | | | |
| 3437 | // | |<------------| | | |
| 3438 | // | | | | | |
| 3439 | // | [SUBS INT DELETE] | | |
| 3440 | // | | | | | |
| 3441 | // | RESTSubDelReq1 | | | |
| 3442 | // |------------------------>| | | |
| 3443 | // | RESTSubDelResp1 | | | |
| 3444 | // |<------------------------| | | |
| 3445 | // | | | SubDelReq | | |
| 3446 | // | | |---------------------------->| |
| 3447 | // | | | SubDelResp | | |
| 3448 | // | | |<----------------------------| |
| 3449 | // | | | RouteUpdate | | |
| 3450 | // | | |------------->| | |
| 3451 | // | | | RouteUpdate | | |
| 3452 | // | | | status:400 | | |
| 3453 | // | | |(Bad request) | | |
| 3454 | // | | |<-------------| | |
| 3455 | // | | | | | |
| 3456 | // | | RESTSubDelReq2 | | |
| 3457 | // | |------------>| | | |
| 3458 | // | | RESTSubDelResp2 | | |
| 3459 | // | |<------------| | | |
| 3460 | // | | | SubDelReq | | |
| 3461 | // | | |---------------------------->| |
| 3462 | // | | | SubdelResp | | |
| 3463 | // | | |<----------------------------| |
| 3464 | // | | | RouteDelete | | |
| 3465 | // | | |------------->| | |
| 3466 | // | | | Deleteresp | | |
| 3467 | // | | |<-------------| | |
| 3468 | |
| 3469 | //----------------------------------------------------------------------------- |
| 3470 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3471 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3472 | |
| 3473 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3474 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3475 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3476 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3477 | Counter{cSubReqToE2, 1}, |
| 3478 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3479 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3480 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3481 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3482 | Counter{cSubDelReqToE2, 1}, |
| 3483 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3484 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3485 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3486 | }) |
| 3487 | |
| 3488 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3489 | |
| 3490 | //Subs Create |
| 3491 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3492 | |
| 3493 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3494 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3495 | |
| 3496 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3497 | |
| 3498 | //Del1, this shall fail on rtmgr side |
| 3499 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3500 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3501 | waiter.WaitResult(t) |
| 3502 | |
| 3503 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3504 | |
| 3505 | //Del2 |
| 3506 | deleteXapp2Subscription(t, &restSubId2) |
| 3507 | |
| 3508 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3509 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3510 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3511 | } |
| 3512 | |
| 3513 | //----------------------------------------------------------------------------- |
| 3514 | // TestRESTSubReqRetransmission |
| 3515 | // |
| 3516 | // stub stub |
| 3517 | // +-------+ +---------+ +---------+ |
| 3518 | // | xapp | | submgr | | e2term | |
| 3519 | // +-------+ +---------+ +---------+ |
| 3520 | // | | | |
| 3521 | // | RESTSubReq1 | | |
| 3522 | // |---------------->| | |
| 3523 | // | | | |
| 3524 | // | RESTSubResp | | |
| 3525 | // |<----------------| | |
| 3526 | // | | SubReq1 | |
| 3527 | // | |------------->| |
| 3528 | // | | | |
| 3529 | // | RESTSubReq2 | | |
| 3530 | // | (retrans) | | |
| 3531 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3532 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3533 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3534 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3535 | // | | SubResp1 | |
| 3536 | // | |<-------------| |
| 3537 | // | RESTNotif1 | | |
| 3538 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3539 | // | | | |
| 3540 | // | [SUBS DELETE] | |
| 3541 | // | | | |
| 3542 | // |
| 3543 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3544 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3545 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3546 | |
| 3547 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3548 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3549 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3550 | Counter{cSubReqToE2, 1}, |
| 3551 | Counter{cSubRespFromE2, 1}, |
| 3552 | Counter{cRestSubNotifToXapp, 1}, |
| 3553 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3554 | Counter{cSubDelReqToE2, 1}, |
| 3555 | Counter{cSubDelRespFromE2, 1}, |
| 3556 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3557 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3558 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3559 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3560 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3561 | |
| 3562 | // Subs Create |
| 3563 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3564 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3565 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3566 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3567 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3568 | xappConn1.SendRESTSubsReq(t, params) |
| 3569 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3570 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3571 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3572 | |
| 3573 | // 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] | 3574 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3575 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3576 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3577 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3578 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3579 | |
| 3580 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3581 | |
| 3582 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3583 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3584 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3585 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3586 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3587 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3588 | |
| 3589 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3590 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3591 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3592 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3593 | //----------------------------------------------------------------------------- |
| 3594 | // stub stub stub |
| 3595 | // +-------+ +---------+ +---------+ +---------+ |
| 3596 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3597 | // +-------+ +---------+ +---------+ +---------+ |
| 3598 | // | | | | |
| 3599 | // | RESTSubReq | | | |
| 3600 | // |---------------->| | | |
| 3601 | // | RESTSubResp | | | |
| 3602 | // |<----------------| | | |
| 3603 | // | | RouteCreate | | |
| 3604 | // | |--------------------------->| |
| 3605 | // | | RouteResponse| | |
| 3606 | // | |<---------------------------| // The order of these events may vary |
| 3607 | // | | SubReq | | |
| 3608 | // | |------------->| | // The order of these events may vary |
| 3609 | // | | SubResp | | |
| 3610 | // | |<-------------| | |
| 3611 | // | RESTNotif1 | | | |
| 3612 | // |<----------------| | | |
| 3613 | // | RESTSubReq | | | |
| 3614 | // | [RETRANS1] | | | |
| 3615 | // |---------------->| | | |
| 3616 | // | RESTNotif1 | | | |
| 3617 | // |<----------------| | | |
| 3618 | // | RESTSubReq | | | |
| 3619 | // | [RETRANS2] | | | |
| 3620 | // |---------------->| | | |
| 3621 | // | RESTNotif1 | | | |
| 3622 | // |<----------------| | | |
| 3623 | // | RESTSubDelReq | | | |
| 3624 | // |---------------->| | | |
| 3625 | // | | SubDelReq | | |
| 3626 | // | |------------->| | |
| 3627 | // | RESTSubDelResp| | | |
| 3628 | // |<----------------| | | |
| 3629 | // | | SubDelResp | | |
| 3630 | // | |<-------------| | |
| 3631 | // | | | | |
| 3632 | // |
| 3633 | //----------------------------------------------------------------------------- |
| 3634 | |
| 3635 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3636 | |
| 3637 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3638 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3639 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3640 | Counter{cRestSubRespToXapp, 3}, |
| 3641 | Counter{cSubReqToE2, 1}, |
| 3642 | Counter{cSubRespFromE2, 1}, |
| 3643 | Counter{cRestSubNotifToXapp, 3}, |
| 3644 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3645 | Counter{cSubDelReqToE2, 1}, |
| 3646 | Counter{cSubDelRespFromE2, 1}, |
| 3647 | Counter{cRestSubDelRespToXapp, 1}, |
| 3648 | }) |
| 3649 | |
| 3650 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3651 | |
| 3652 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3653 | |
| 3654 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3655 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3656 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3657 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3658 | //1.st resend |
| 3659 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3660 | |
| 3661 | assert.Equal(t, restSubId_resend, restSubId) |
| 3662 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3663 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3664 | |
| 3665 | //2.nd resend |
| 3666 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3667 | |
| 3668 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3669 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3670 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3671 | |
| 3672 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3673 | |
| 3674 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3675 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3676 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3677 | } |
| 3678 | |
| 3679 | //----------------------------------------------------------------------------- |
| 3680 | // stub stub stub |
| 3681 | // +-------+ +---------+ +---------+ +---------+ |
| 3682 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3683 | // +-------+ +---------+ +---------+ +---------+ |
| 3684 | // | | | | |
| 3685 | // | RESTSubReq | | | |
| 3686 | // |---------------->| | | |
| 3687 | // | RESTSubResp | | | |
| 3688 | // |<----------------| | | |
| 3689 | // | | RouteCreate | | |
| 3690 | // | |--------------------------->| |
| 3691 | // | | RouteResponse| | |
| 3692 | // | |<---------------------------| // The order of these events may vary |
| 3693 | // | | SubReq | | |
| 3694 | // | |------------->| | // The order of these events may vary |
| 3695 | // | | SubResp | | |
| 3696 | // | |<-------------| | |
| 3697 | // | RESTNotif1 | | | |
| 3698 | // |<----------------| | | |
| 3699 | // | RESTSubReq | | | |
| 3700 | // | [RETRANS, with RESTsubsId] | | |
| 3701 | // |---------------->| | | |
| 3702 | // | RESTNotif1 | | | |
| 3703 | // |<----------------| | | |
| 3704 | // | RESTSubReq | | | |
| 3705 | // | [RETRANS, without RESTsubsId] | | |
| 3706 | // |---------------->| | | |
| 3707 | // | RESTNotif1 | | | |
| 3708 | // |<----------------| | | |
| 3709 | // | RESTSubDelReq | | | |
| 3710 | // |---------------->| | | |
| 3711 | // | | SubDelReq | | |
| 3712 | // | |------------->| | |
| 3713 | // | RESTSubDelResp| | | |
| 3714 | // |<----------------| | | |
| 3715 | // | | SubDelResp | | |
| 3716 | // | |<-------------| | |
| 3717 | // | | | | |
| 3718 | // |
| 3719 | //----------------------------------------------------------------------------- |
| 3720 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3721 | |
| 3722 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3723 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3724 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3725 | Counter{cRestSubRespToXapp, 3}, |
| 3726 | Counter{cSubReqToE2, 1}, |
| 3727 | Counter{cSubRespFromE2, 1}, |
| 3728 | Counter{cRestSubNotifToXapp, 3}, |
| 3729 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3730 | Counter{cSubDelReqToE2, 1}, |
| 3731 | Counter{cSubDelRespFromE2, 1}, |
| 3732 | Counter{cRestSubDelRespToXapp, 1}, |
| 3733 | }) |
| 3734 | |
| 3735 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3736 | |
| 3737 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3738 | |
| 3739 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3740 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3741 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3742 | |
| 3743 | //1.st resend with subscription ID |
| 3744 | params.SetSubscriptionID(&restSubId) |
| 3745 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3746 | |
| 3747 | assert.Equal(t, restSubId_resend, restSubId) |
| 3748 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3749 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3750 | |
| 3751 | //2.nd resend without subscription ID (faking app restart) |
| 3752 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3753 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3754 | |
| 3755 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3756 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3757 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3758 | |
| 3759 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3760 | |
| 3761 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3762 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3763 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3764 | } |
| 3765 | |
| 3766 | //----------------------------------------------------------------------------- |
| 3767 | // stub stub stub |
| 3768 | // +-------+ +---------+ +---------+ +---------+ |
| 3769 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3770 | // +-------+ +---------+ +---------+ +---------+ |
| 3771 | // | | | | |
| 3772 | // | RESTSubReq | | | |
| 3773 | // |---------------->| | | |
| 3774 | // | RESTSubResp | | | |
| 3775 | // |<----------------| | | |
| 3776 | // | | RouteCreate | | |
| 3777 | // | |--------------------------->| |
| 3778 | // | | RouteResponse| | |
| 3779 | // | |<---------------------------| |
| 3780 | // | | SubReq | | |
| 3781 | // | |------------->| | |
| 3782 | // | | SubResp | | |
| 3783 | // | |<-------------| | |
| 3784 | // | RESTNotif1 | | | |
| 3785 | // |<----------------| | | |
| 3786 | // | RESTSubReq | | | |
| 3787 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3788 | // |---------------->| | | |
| 3789 | // | RESTNotif1 | | | |
| 3790 | // | [for initial e2 subDetail] | | |
| 3791 | // |<----------------| | | |
| 3792 | // | | RouteCreate | | |
| 3793 | // | |--------------------------->| |
| 3794 | // | | RouteResponse| | |
| 3795 | // | |<---------------------------| |
| 3796 | // | | SubReq | | |
| 3797 | // | |------------->| | |
| 3798 | // | | SubResp | | |
| 3799 | // | |<-------------| | |
| 3800 | // | RESTNotif1 | | | |
| 3801 | // |<----------------| | | |
| 3802 | // | RESTSubReq | | | |
| 3803 | // | [with RESTsubsId initial request] | |
| 3804 | // |---------------->| | | |
| 3805 | // | RESTNotif1 | | | |
| 3806 | // |<----------------| | | |
| 3807 | // | RESTSubDelReq | | | |
| 3808 | // |---------------->| | | |
| 3809 | // | RESTSubDelResp| | | |
| 3810 | // |<----------------| | | |
| 3811 | // | | SubDelReq | | |
| 3812 | // | |------------->| | |
| 3813 | // | | SubDelResp | | |
| 3814 | // | |<-------------| | |
| 3815 | // | | SubDelReq | | |
| 3816 | // | |------------->| | |
| 3817 | // | | SubDelResp | | |
| 3818 | // | |<-------------| | |
| 3819 | // | | | | |
| 3820 | // |
| 3821 | //----------------------------------------------------------------------------- |
| 3822 | |
| 3823 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3824 | |
| 3825 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3826 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3827 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3828 | Counter{cRestSubRespToXapp, 3}, |
| 3829 | Counter{cSubReqToE2, 2}, |
| 3830 | Counter{cSubRespFromE2, 2}, |
| 3831 | Counter{cRestSubNotifToXapp, 4}, |
| 3832 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3833 | Counter{cSubDelReqToE2, 2}, |
| 3834 | Counter{cSubDelRespFromE2, 2}, |
| 3835 | Counter{cRestSubDelRespToXapp, 1}, |
| 3836 | }) |
| 3837 | |
| 3838 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3839 | |
| 3840 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3841 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3842 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3843 | |
| 3844 | // Send modified requst, this time with e2 subscriptions. |
| 3845 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3846 | params2.SetSubscriptionID(&restSubId) |
| 3847 | |
| 3848 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3849 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3850 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3851 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3852 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3853 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3854 | |
| 3855 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3856 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3857 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3858 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3859 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3860 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3861 | assert.NotEqual(t, e2SubsId2, 0) |
| 3862 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3863 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3864 | |
| 3865 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3866 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3867 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3868 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3869 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3870 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3871 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3872 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3873 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3874 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3875 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3876 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3877 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3878 | // Delete both e2 subscriptions |
| 3879 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3880 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3881 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3882 | |
| 3883 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3884 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3885 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3886 | } |
| 3887 | |
| 3888 | //----------------------------------------------------------------------------- |
| 3889 | // stub stub stub |
| 3890 | // +-------+ +---------+ +---------+ +---------+ |
| 3891 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3892 | // +-------+ +---------+ +---------+ +---------+ |
| 3893 | // | | | | |
| 3894 | // | RESTSubReq | | | |
| 3895 | // |---------------->| | | |
| 3896 | // | RESTSubResp | | | |
| 3897 | // |<----------------| | | |
| 3898 | // | | RouteCreate | | |
| 3899 | // | |--------------------------->| |
| 3900 | // | | RouteResponse| | |
| 3901 | // | |<---------------------------| |
| 3902 | // | | SubReq | | |
| 3903 | // | |------------->| | |
| 3904 | // | | SubResp | | |
| 3905 | // | |<-------------| | |
| 3906 | // | RESTNotif1 | | | |
| 3907 | // |<----------------| | | |
| 3908 | // | RESTSubReq | | | |
| 3909 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3910 | // |---------------->| | | |
| 3911 | // | RESTNotif1 | | | |
| 3912 | // | [for initial e2 subDetail] | | |
| 3913 | // |<----------------| | | |
| 3914 | // | | RouteCreate | | |
| 3915 | // | |--------------------------->| |
| 3916 | // | | RouteResponse| | |
| 3917 | // | |<---------------------------| |
| 3918 | // | | SubReq | | |
| 3919 | // | |------------->| | |
| 3920 | // | | SubResp | | |
| 3921 | // | |<-------------| | |
| 3922 | // | RESTNotif1 | | | |
| 3923 | // |<----------------| | | |
| 3924 | // | RESTSubReq | | | |
| 3925 | // | [without RESTsubsId initial request] | |
| 3926 | // |---------------->| | | |
| 3927 | // | RESTNotif1 | | | |
| 3928 | // |<----------------| | | |
| 3929 | // | RESTSubDelReq | | | |
| 3930 | // |---------------->| | | |
| 3931 | // | RESTSubDelResp| | | |
| 3932 | // |<----------------| | | |
| 3933 | // | | SubDelReq | | |
| 3934 | // | |------------->| | |
| 3935 | // | | SubDelResp | | |
| 3936 | // | |<-------------| | |
| 3937 | // | | SubDelReq | | |
| 3938 | // | |------------->| | |
| 3939 | // | | SubDelResp | | |
| 3940 | // | |<-------------| | |
| 3941 | // | | | | |
| 3942 | // |
| 3943 | //----------------------------------------------------------------------------- |
| 3944 | |
| 3945 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3946 | |
| 3947 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3948 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3949 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3950 | Counter{cRestSubRespToXapp, 3}, |
| 3951 | Counter{cSubReqToE2, 2}, |
| 3952 | Counter{cSubRespFromE2, 2}, |
| 3953 | Counter{cRestSubNotifToXapp, 4}, |
| 3954 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3955 | Counter{cSubDelReqToE2, 2}, |
| 3956 | Counter{cSubDelRespFromE2, 2}, |
| 3957 | Counter{cRestSubDelRespToXapp, 1}, |
| 3958 | }) |
| 3959 | |
| 3960 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3961 | |
| 3962 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3963 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3964 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3965 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3966 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3967 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3968 | params2.SetSubscriptionID(&restSubId) |
| 3969 | |
| 3970 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3971 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3972 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3973 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3974 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3975 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3976 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3977 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3978 | xappConn1.DecrementRequestCount() |
| 3979 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3980 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3981 | |
| 3982 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3983 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3984 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3985 | assert.NotEqual(t, e2SubsId2, 0) |
| 3986 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3987 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3988 | |
| 3989 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3990 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3991 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3992 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3993 | // md5sum shall find the original request |
| 3994 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3995 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3996 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3997 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3998 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3999 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4000 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 4001 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4002 | // Delete both e2 subscriptions |
| 4003 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4004 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 4005 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4006 | |
| 4007 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4008 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4009 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4010 | } |
| 4011 | |
| 4012 | //----------------------------------------------------------------------------- |
| 4013 | // stub stub stub |
| 4014 | // +-------+ +---------+ +---------+ +---------+ |
| 4015 | // | xapp | | submgr | | e2term | | rtmgr | |
| 4016 | // +-------+ +---------+ +---------+ +---------+ |
| 4017 | // | | | | |
| 4018 | // | RESTSubReq | | | |
| 4019 | // |---------------->| | | |
| 4020 | // | RESTSubResp | | | |
| 4021 | // |<----------------| | | |
| 4022 | // | | RouteCreate | | |
| 4023 | // | |--------------------------->| |
| 4024 | // | | RouteResponse| | |
| 4025 | // | |<---------------------------| |
| 4026 | // | | SubReq | | |
| 4027 | // | |------------->| | |
| 4028 | // | | SubResp | | |
| 4029 | // | |<-------------| | |
| 4030 | // | RESTNotif1 | | | |
| 4031 | // |<----------------| | | |
| 4032 | // | RESTSubReq | | | |
| 4033 | // | [with RestSUbsId + one additional e2 subDetail] |
| 4034 | // |---------------->| | | |
| 4035 | // | RESTNotif1 | | | |
| 4036 | // | [for initial e2 subDetail] | | |
| 4037 | // |<----------------| | | |
| 4038 | // | | RouteCreate | | |
| 4039 | // | |--------------------------->| |
| 4040 | // | | RouteResponse| | |
| 4041 | // | |<---------------------------| |
| 4042 | // | | SubReq | | |
| 4043 | // | |------------->| | |
| 4044 | // | | SubResp | | |
| 4045 | // | |<-------------| | |
| 4046 | // | RESTNotif1 | | | |
| 4047 | // |<----------------| | | |
| 4048 | // | RESTSubDelReq | | | |
| 4049 | // |---------------->| | | |
| 4050 | // | RESTSubDelResp| | | |
| 4051 | // |<----------------| | | |
| 4052 | // | | SubDelReq | | |
| 4053 | // | |------------->| | |
| 4054 | // | | SubDelResp | | |
| 4055 | // | |<-------------| | |
| 4056 | // | | SubDelReq | | |
| 4057 | // | |------------->| | |
| 4058 | // | | SubDelResp | | |
| 4059 | // | |<-------------| | |
| 4060 | // | RESTSubReq | | | |
| 4061 | // | [with RESTsubsId initial request] | |
| 4062 | // |---------------->| | | |
| 4063 | // | RESTSubResp | | | |
| 4064 | // |<----------------| | | |
| 4065 | // | | RouteCreate | | |
| 4066 | // | |--------------------------->| |
| 4067 | // | | RouteResponse| | |
| 4068 | // | |<---------------------------| |
| 4069 | // | | SubReq | | |
| 4070 | // | |------------->| | |
| 4071 | // | | SubResp | | |
| 4072 | // | |<-------------| | |
| 4073 | // | RESTNotif1 | | | |
| 4074 | // |<----------------| | | |
| 4075 | // | | | | |
| 4076 | // |
| 4077 | //----------------------------------------------------------------------------- |
| 4078 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4079 | |
| 4080 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4081 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4082 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4083 | Counter{cRestSubRespToXapp, 3}, |
| 4084 | Counter{cSubReqToE2, 3}, |
| 4085 | Counter{cSubRespFromE2, 3}, |
| 4086 | Counter{cRestSubNotifToXapp, 4}, |
| 4087 | Counter{cRestSubDelReqFromXapp, 2}, |
| 4088 | Counter{cSubDelReqToE2, 3}, |
| 4089 | Counter{cSubDelRespFromE2, 3}, |
| 4090 | Counter{cRestSubDelRespToXapp, 2}, |
| 4091 | }) |
| 4092 | |
| 4093 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4094 | |
| 4095 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4096 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4097 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4098 | |
| 4099 | // Send modified requst, this time with e2 subscriptions. |
| 4100 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 4101 | params2.SetSubscriptionID(&restSubId) |
| 4102 | |
| 4103 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4104 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4105 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 4106 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 4107 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4108 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 4109 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 4110 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4111 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4112 | |
| 4113 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 4114 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4115 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 4116 | assert.NotEqual(t, e2SubsId2, 0) |
| 4117 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4118 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4119 | |
| 4120 | // Delete both e2 subscriptions |
| 4121 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4122 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 4123 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4124 | |
| 4125 | waitSubsCleanup(t, e2SubsId, 10) |
| 4126 | |
| 4127 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 4128 | // but the restsubscription has been already removed. This shall trigger a |
| 4129 | // fresh create. |
| 4130 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4131 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4132 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4133 | |
| 4134 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4135 | |
| 4136 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4137 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4138 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4139 | } |
| 4140 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4141 | //----------------------------------------------------------------------------- |
| 4142 | // TestRESTSubDelReqRetransmission |
| 4143 | // |
| 4144 | // stub stub |
| 4145 | // +-------+ +---------+ +---------+ |
| 4146 | // | xapp | | submgr | | e2term | |
| 4147 | // +-------+ +---------+ +---------+ |
| 4148 | // | | | |
| 4149 | // | RESTSubReq | | |
| 4150 | // |---------------->| | |
| 4151 | // | | | |
| 4152 | // | RESTSubResp | | |
| 4153 | // |<----------------| | |
| 4154 | // | | SubReq | |
| 4155 | // | |------------->| |
| 4156 | // | | SubResp | |
| 4157 | // | |<-------------| |
| 4158 | // | RESTNotif1 | | |
| 4159 | // |<----------------| | |
| 4160 | // | | | |
| 4161 | // | RESTSubDelReq | | |
| 4162 | // |---------------->| | |
| 4163 | // | RESTSubDelResp | | |
| 4164 | // |<----------------| | |
| 4165 | // | | SubDelReq | |
| 4166 | // | |------------->| |
| 4167 | // | RESTSubDelReq | | |
| 4168 | // |---------------->| | |
| 4169 | // | RESTSubDelResp | | |
| 4170 | // |<----------------| | |
| 4171 | // | | SubDelResp | |
| 4172 | // | |<-------------| |
| 4173 | // | | | |
| 4174 | // |
| 4175 | //----------------------------------------------------------------------------- |
| 4176 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4177 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4178 | |
| 4179 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4180 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4181 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4182 | Counter{cSubReqToE2, 1}, |
| 4183 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4184 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4185 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4186 | Counter{cSubDelReqToE2, 1}, |
| 4187 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4188 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4189 | }) |
| 4190 | |
| 4191 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4192 | |
| 4193 | //Subs Create |
| 4194 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4195 | |
| 4196 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4197 | |
| 4198 | //Subs Delete |
| 4199 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4200 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4201 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4202 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4203 | seqBef := mainCtrl.get_msgcounter(t) |
| 4204 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4205 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 4206 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4207 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4208 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4209 | |
| 4210 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4211 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4212 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4213 | } |
| 4214 | |
| 4215 | //----------------------------------------------------------------------------- |
| 4216 | // TestRESTSubReqDelReq |
| 4217 | // |
| 4218 | // stub stub |
| 4219 | // +-------+ +---------+ +---------+ |
| 4220 | // | xapp | | submgr | | e2term | |
| 4221 | // +-------+ +---------+ +---------+ |
| 4222 | // | | | |
| 4223 | // | RESTSubReq | | |
| 4224 | // |---------------->| | |
| 4225 | // | | | |
| 4226 | // | RESTSubResp | | |
| 4227 | // |<----------------| | |
| 4228 | // | | SubReq | |
| 4229 | // | |------------->| |
| 4230 | // | RESTSubDelReq | | |
| 4231 | // |---------------->| | |
| 4232 | // | RESTSubDelResp | | |
| 4233 | // | unsuccess | | |
| 4234 | // |<----------------| | |
| 4235 | // | | SubResp | |
| 4236 | // | |<-------------| |
| 4237 | // | RESTNotif1 | | |
| 4238 | // |<----------------| | |
| 4239 | // | | | |
| 4240 | // | [SUBS DELETE] | |
| 4241 | // | | | |
| 4242 | // |
| 4243 | //----------------------------------------------------------------------------- |
| 4244 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4245 | |
| 4246 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4247 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4248 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4249 | Counter{cSubReqToE2, 1}, |
| 4250 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4251 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4252 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4253 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4254 | Counter{cSubDelReqToE2, 1}, |
| 4255 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4256 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4257 | }) |
| 4258 | |
| 4259 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4260 | |
| 4261 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4262 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4263 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4264 | |
| 4265 | // Del. This will fail as processing of the subscription |
| 4266 | // is still ongoing in submgr. Deletion is not allowed before |
| 4267 | // subscription creation has been completed. |
| 4268 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4269 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4270 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4271 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4272 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4273 | |
| 4274 | // Retry del |
| 4275 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4276 | |
| 4277 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4278 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4279 | |
| 4280 | // Wait that subs is cleaned |
| 4281 | waitSubsCleanup(t, e2SubsId, 10) |
| 4282 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4283 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4284 | } |
| 4285 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4286 | //----------------------------------------------------------------------------- |
| 4287 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4288 | // |
| 4289 | // stub stub stub |
| 4290 | // +-------+ +-------+ +---------+ +---------+ |
| 4291 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4292 | // +-------+ +-------+ +---------+ +---------+ |
| 4293 | // | | | | |
| 4294 | // | | RESTSubReq1 | | |
| 4295 | // | |------------->| | |
| 4296 | // | | RESTSubResp1 | | |
| 4297 | // | |<-------------| | |
| 4298 | // | | | | |
| 4299 | // | | | SubReq1 | |
| 4300 | // | | |------------->| |
| 4301 | // | | | | |
| 4302 | // | RESTSubReq2 | | |
| 4303 | // |------------------------>| | |
| 4304 | // | RESTSubResp2 | | |
| 4305 | // |<------------------------| | |
| 4306 | // | | | | |
| 4307 | // | | | SubReq2 | |
| 4308 | // | | |------------->| |
| 4309 | // | | | | |
| 4310 | // | | | SubResp1 | |
| 4311 | // | | |<-------------| |
| 4312 | // | | RESTNotif1 | | |
| 4313 | // | |<-------------| | |
| 4314 | // | | | | |
| 4315 | // | | | SubResp2 | |
| 4316 | // | | |<-------------| |
| 4317 | // | RESTNotif2 | | |
| 4318 | // |<------------------------| | |
| 4319 | // | | | | |
| 4320 | // | | [SUBS 1 DELETE] | |
| 4321 | // | | | | |
| 4322 | // | | [SUBS 2 DELETE] | |
| 4323 | // | | | | |
| 4324 | // |
| 4325 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4326 | |
| 4327 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4328 | |
| 4329 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4330 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4331 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4332 | Counter{cSubReqToE2, 2}, |
| 4333 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4334 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4335 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4336 | Counter{cSubDelReqToE2, 2}, |
| 4337 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4338 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4339 | }) |
| 4340 | |
| 4341 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4342 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4343 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4344 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4345 | |
| 4346 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4347 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4348 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4349 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4350 | |
| 4351 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4352 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4353 | |
| 4354 | //XappConn1 receives both of the responses |
| 4355 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4356 | |
| 4357 | //Resp1 |
| 4358 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4359 | //Resp2 |
| 4360 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4361 | |
| 4362 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4363 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4364 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4365 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4366 | |
| 4367 | //Del1 |
| 4368 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4369 | //Del2 |
| 4370 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4371 | |
| 4372 | //Wait that subs is cleaned |
| 4373 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4374 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4375 | |
| 4376 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4377 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4378 | } |
| 4379 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4380 | //----------------------------------------------------------------------------- |
| 4381 | // TestRESTSameSubsDiffRan |
| 4382 | // Same subscription to different RANs |
| 4383 | // |
| 4384 | // stub stub |
| 4385 | // +-------+ +---------+ +---------+ |
| 4386 | // | xapp | | submgr | | e2term | |
| 4387 | // +-------+ +---------+ +---------+ |
| 4388 | // | | | |
| 4389 | // | RESTSubReq(r1) | | |
| 4390 | // |---------------->| | |
| 4391 | // | RESTSubResp(r1) | | |
| 4392 | // |<----------------| | |
| 4393 | // | | | |
| 4394 | // | | SubReq(r1) | |
| 4395 | // | |------------->| |
| 4396 | // | | | |
| 4397 | // | | SubResp(r1) | |
| 4398 | // | |<-------------| |
| 4399 | // | | | |
| 4400 | // | RESTNotif(r1) | | |
| 4401 | // |<----------------| | |
| 4402 | // | | | |
| 4403 | // | RESTSubReq(r2) | | |
| 4404 | // |---------------->| | |
| 4405 | // | | | |
| 4406 | // | RESTSubResp(r2) | | |
| 4407 | // |<----------------| | |
| 4408 | // | | SubReq(r2) | |
| 4409 | // | |------------->| |
| 4410 | // | | | |
| 4411 | // | | SubResp(r2) | |
| 4412 | // | |<-------------| |
| 4413 | // | | | |
| 4414 | // | RESTNotif(r2) | | |
| 4415 | // |<----------------| | |
| 4416 | // | | | |
| 4417 | // | [SUBS r1 DELETE] | |
| 4418 | // | | | |
| 4419 | // | [SUBS r2 DELETE] | |
| 4420 | // | | | |
| 4421 | // |
| 4422 | //----------------------------------------------------------------------------- |
| 4423 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4424 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4425 | |
| 4426 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4427 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4428 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4429 | Counter{cSubReqToE2, 2}, |
| 4430 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4431 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4432 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4433 | Counter{cSubDelReqToE2, 2}, |
| 4434 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4435 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4436 | }) |
| 4437 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4438 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4439 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4440 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4441 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4442 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4443 | params.SetMeid("RAN_NAME_2") |
| 4444 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4445 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4446 | |
| 4447 | //Del1 |
| 4448 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4449 | //Del2 |
| 4450 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4451 | |
| 4452 | //Wait that subs is cleaned |
| 4453 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4454 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4455 | |
| 4456 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4457 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | } |
| 4459 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4460 | //----------------------------------------------------------------------------- |
| 4461 | // TestRESTSubReqRetryInSubmgr |
| 4462 | // |
| 4463 | // stub stub |
| 4464 | // +-------+ +---------+ +---------+ |
| 4465 | // | xapp | | submgr | | e2term | |
| 4466 | // +-------+ +---------+ +---------+ |
| 4467 | // | | | |
| 4468 | // | RESTSubReq | | |
| 4469 | // |---------------->| | |
| 4470 | // | RESTSubResp | | |
| 4471 | // |<----------------| | |
| 4472 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 4473 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4474 | // | | | |
| 4475 | // | | | |
| 4476 | // | | SubReq | |
| 4477 | // | |------------->| |
| 4478 | // | | SubResp | |
| 4479 | // | |<-------------| |
| 4480 | // | | | |
| 4481 | // | RESTNotif | | |
| 4482 | // |<----------------| | |
| 4483 | // | | | |
| 4484 | // | [SUBS DELETE] | |
| 4485 | // | | | |
| 4486 | // |
| 4487 | //----------------------------------------------------------------------------- |
| 4488 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4489 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4490 | |
| 4491 | // Init counter check |
| 4492 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4493 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4494 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4495 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4496 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4497 | Counter{cSubReReqToE2, 1}, |
| 4498 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4499 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4500 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4501 | Counter{cSubDelReqToE2, 1}, |
| 4502 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4503 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4504 | }) |
| 4505 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4506 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4507 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4508 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4509 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4510 | |
| 4511 | // Catch the first message and ignore it |
| 4512 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4513 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4514 | |
| 4515 | // The second request is being handled normally |
| 4516 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4517 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4518 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4519 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4520 | |
| 4521 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4522 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4523 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4524 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4525 | |
| 4526 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4527 | //Wait that subs is cleaned |
| 4528 | waitSubsCleanup(t, e2SubsId, 10) |
| 4529 | |
| 4530 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4531 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4532 | } |
| 4533 | |
| 4534 | //----------------------------------------------------------------------------- |
| 4535 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4536 | // |
| 4537 | // stub stub |
| 4538 | // +-------+ +---------+ +---------+ |
| 4539 | // | xapp | | submgr | | e2term | |
| 4540 | // +-------+ +---------+ +---------+ |
| 4541 | // | | | |
| 4542 | // | RESTSubReq | | |
| 4543 | // |---------------->| | |
| 4544 | // | | | |
| 4545 | // | RESTSubResp | | |
| 4546 | // |<----------------| | |
| 4547 | // | | SubReq | |
| 4548 | // | |------------->| |
| 4549 | // | | | |
| 4550 | // | | | |
| 4551 | // | | SubReq | |
| 4552 | // | |------------->| |
| 4553 | // | | | |
| 4554 | // | | SubDelReq | |
| 4555 | // | |------------->| |
| 4556 | // | | | |
| 4557 | // | | | |
| 4558 | // | | SubDelReq | |
| 4559 | // | |------------->| |
| 4560 | // | | | |
| 4561 | // | | | |
| 4562 | // | | SubDelResp | |
| 4563 | // | |<-------------| |
| 4564 | // | RESTNotif | | |
| 4565 | // | unsuccess | | |
| 4566 | // |<----------------| | |
| 4567 | // | | | |
| 4568 | // | [SUBS DELETE] | |
| 4569 | // | | | |
| 4570 | // |
| 4571 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4572 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4573 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4574 | |
| 4575 | // Init counter check |
| 4576 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4577 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4578 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | Counter{cSubReqToE2, 1}, |
| 4580 | Counter{cSubReReqToE2, 1}, |
| 4581 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4582 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4583 | Counter{cSubDelReqToE2, 1}, |
| 4584 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4585 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4586 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4587 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4588 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4589 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4590 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4591 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4592 | |
| 4593 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4594 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4595 | |
| 4596 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4597 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4598 | |
| 4599 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4600 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4601 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4603 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4604 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4605 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4606 | // Wait that subs is cleaned |
| 4607 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4608 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4609 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4610 | } |
| 4611 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4612 | //----------------------------------------------------------------------------- |
| 4613 | // TestREST2eTermNotRespondingToSubReq |
| 4614 | // |
| 4615 | // stub stub |
| 4616 | // +-------+ +---------+ +---------+ |
| 4617 | // | xapp | | submgr | | e2term | |
| 4618 | // +-------+ +---------+ +---------+ |
| 4619 | // | | | |
| 4620 | // | RESTSubReq | | |
| 4621 | // |---------------->| | |
| 4622 | // | RESTSubResp | | |
| 4623 | // |<----------------| | |
| 4624 | // | | SubReq | |
| 4625 | // | |------------->| |
| 4626 | // | | | |
| 4627 | // | | SubReq | |
| 4628 | // | |------------->| |
| 4629 | // | | | |
| 4630 | // | | SubDelReq | |
| 4631 | // | |------------->| |
| 4632 | // | | | |
| 4633 | // | | SubDelReq | |
| 4634 | // | |------------->| |
| 4635 | // | RESTNotif(Unsuccessful) | |
| 4636 | // |<----------------| | |
| 4637 | // | | | |
| 4638 | // | RESTSubDelReq | | |
| 4639 | // |---------------->| | |
| 4640 | // | RESTSubDelResp | | |
| 4641 | // |<----------------| | |
| 4642 | // | | | |
| 4643 | // |
| 4644 | //----------------------------------------------------------------------------- |
| 4645 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4646 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4647 | |
| 4648 | // Init counter check |
| 4649 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4650 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4651 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4652 | Counter{cSubReqToE2, 1}, |
| 4653 | Counter{cSubReReqToE2, 1}, |
| 4654 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4655 | Counter{cSubDelReReqToE2, 1}, |
| 4656 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4657 | Counter{cSubDelReqToE2, 1}, |
| 4658 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4659 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4660 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4661 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4662 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4663 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4664 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4665 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4666 | |
| 4667 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4668 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4669 | |
| 4670 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4671 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4672 | |
| 4673 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4674 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4675 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4676 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4677 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4678 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4679 | |
| 4680 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4681 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4682 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4683 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4684 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4685 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4686 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4687 | } |
| 4688 | |
| 4689 | //----------------------------------------------------------------------------- |
| 4690 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4691 | // |
| 4692 | // stub stub |
| 4693 | // +-------+ +---------+ +---------+ |
| 4694 | // | xapp | | submgr | | e2term | |
| 4695 | // +-------+ +---------+ +---------+ |
| 4696 | // | | | |
| 4697 | // | RESTSubReq | | |
| 4698 | // |---------------->| | |
| 4699 | // | | | |
| 4700 | // | RESTSubResp | | |
| 4701 | // |<----------------| | |
| 4702 | // | | SubReq | |
| 4703 | // | |------------->| |
| 4704 | // | | | |
| 4705 | // | | | |
| 4706 | // | | SubReq | |
| 4707 | // | |------------->| |
| 4708 | // | | | |
| 4709 | // | | SubDelReq | |
| 4710 | // | |------------->| |
| 4711 | // | | | |
| 4712 | // | | | |
| 4713 | // | | SubDelReq | |
| 4714 | // | |------------->| |
| 4715 | // | | | |
| 4716 | // | | | |
| 4717 | // | | SubDelResp | |
| 4718 | // | |<-------------| |
| 4719 | // | RESTNotif | | |
| 4720 | // | unsuccess | | |
| 4721 | // |<----------------| | |
| 4722 | // | | | |
| 4723 | // | [SUBS DELETE] | |
| 4724 | // | | | |
| 4725 | // |
| 4726 | //----------------------------------------------------------------------------- |
| 4727 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4728 | |
| 4729 | // Init counter check |
| 4730 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4731 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4732 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4733 | Counter{cSubReqToE2, 1}, |
| 4734 | Counter{cSubReReqToE2, 1}, |
| 4735 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4736 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4737 | Counter{cSubDelReqToE2, 1}, |
| 4738 | Counter{cSubDelReReqToE2, 1}, |
| 4739 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4740 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4741 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4742 | }) |
| 4743 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4744 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4745 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4746 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4747 | |
| 4748 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4749 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4750 | |
| 4751 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4752 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4753 | |
| 4754 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4755 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4756 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4757 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4758 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4759 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4760 | |
| 4761 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4762 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4763 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4764 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4765 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4766 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4767 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4768 | } |
| 4769 | |
| 4770 | //----------------------------------------------------------------------------- |
| 4771 | // TestRESTSubReqSubFailRespInSubmgr |
| 4772 | // |
| 4773 | // stub stub |
| 4774 | // +-------+ +---------+ +---------+ |
| 4775 | // | xapp | | submgr | | e2term | |
| 4776 | // +-------+ +---------+ +---------+ |
| 4777 | // | | | |
| 4778 | // | RESTSubReq | | |
| 4779 | // |---------------->| | |
| 4780 | // | | | |
| 4781 | // | RESTSubResp | | |
| 4782 | // |<----------------| | |
| 4783 | // | | SubReq | |
| 4784 | // | |------------->| |
| 4785 | // | | | |
| 4786 | // | | SubFail | |
| 4787 | // | |<-------------| |
| 4788 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4789 | // | RESTNotif | | |
| 4790 | // | unsuccess | | |
| 4791 | // |<----------------| | |
| 4792 | // | | | |
| 4793 | // | [SUBS DELETE] | |
| 4794 | // | | | |
| 4795 | // |
| 4796 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4797 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4798 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4799 | |
| 4800 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4801 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4802 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4803 | Counter{cSubReqToE2, 1}, |
| 4804 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4805 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4806 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4807 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4808 | }) |
| 4809 | |
| 4810 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4811 | const e2Timeout int64 = 2 |
| 4812 | const e2RetryCount int64 = 1 |
| 4813 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4814 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4815 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4816 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4817 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4818 | |
| 4819 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4820 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4821 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4822 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4823 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4824 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4825 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4826 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4827 | |
| 4828 | // REST subscription sill there to be deleted |
| 4829 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4830 | |
| 4831 | // Wait that subs is cleaned |
| 4832 | waitSubsCleanup(t, e2SubsId, 10) |
| 4833 | |
| 4834 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4835 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4836 | } |
| 4837 | |
| 4838 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 4839 | // TestRESTSubReqPartialResp |
| 4840 | // |
| 4841 | // stub stub |
| 4842 | // +-------+ +---------+ +---------+ |
| 4843 | // | xapp | | submgr | | e2term | |
| 4844 | // +-------+ +---------+ +---------+ |
| 4845 | // | | | |
| 4846 | // | RESTSubReq | | |
| 4847 | // |---------------->| | |
| 4848 | // | RESTSubResp | | |
| 4849 | // |<----------------| | |
| 4850 | // | | SubReq | |
| 4851 | // | |------------->| |
| 4852 | // | | SubResp | Partially accepted |
| 4853 | // | |<-------------| |
| 4854 | // | | | |
| 4855 | // | RESTNotif | | |
| 4856 | // |<----------------| | |
| 4857 | // | | | |
| 4858 | // | [SUBS DELETE] | |
| 4859 | // | | | |
| 4860 | // |
| 4861 | //----------------------------------------------------------------------------- |
| 4862 | |
| 4863 | func TestRESTSubReqPartialResp(t *testing.T) { |
| 4864 | |
| 4865 | // Init counter check |
| 4866 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4867 | Counter{cRestSubReqFromXapp, 1}, |
| 4868 | Counter{cRestSubRespToXapp, 1}, |
| 4869 | Counter{cSubReqToE2, 1}, |
| 4870 | Counter{cSubRespFromE2, 1}, |
| 4871 | Counter{cPartialSubRespFromE2, 1}, |
| 4872 | Counter{cRestSubNotifToXapp, 1}, |
| 4873 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4874 | Counter{cSubDelReqToE2, 1}, |
| 4875 | Counter{cSubDelRespFromE2, 1}, |
| 4876 | Counter{cRestSubDelRespToXapp, 1}, |
| 4877 | }) |
| 4878 | |
| 4879 | // Req |
| 4880 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4881 | |
| 4882 | actionId := int64(2) |
| 4883 | actionType := "report" |
| 4884 | actionDefinition := []int64{5678, 1} |
| 4885 | subsequestActionType := "continue" |
| 4886 | timeToWait := "w10ms" |
| 4887 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4888 | |
| 4889 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4890 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4891 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4892 | |
| 4893 | actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} |
| 4894 | actionNotAdmittedItem.ActionId = 1 |
| 4895 | actionNotAdmittedItem.Cause.Content = 1 |
| 4896 | actionNotAdmittedItem.Cause.Value = 8 |
| 4897 | actionNotAdmittedList := e2ap.ActionNotAdmittedList{} |
| 4898 | actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) |
| 4899 | e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) |
| 4900 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4901 | |
| 4902 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4903 | |
| 4904 | // Del |
| 4905 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4906 | |
| 4907 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4908 | //Wait that subs is cleaned |
| 4909 | waitSubsCleanup(t, e2SubsId, 10) |
| 4910 | |
| 4911 | mainCtrl.VerifyCounterValues(t) |
| 4912 | mainCtrl.VerifyAllClean(t) |
| 4913 | } |
| 4914 | |
| 4915 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4916 | // TestRESTSubDelReqRetryInSubmgr |
| 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 | // | | SubDelReq | |
| 4935 | // | |------------->| |
| 4936 | // | | | |
| 4937 | // | | SubDelResp | |
| 4938 | // | |<-------------| |
| 4939 | // | | | |
| 4940 | // |
| 4941 | //----------------------------------------------------------------------------- |
| 4942 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4943 | |
| 4944 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4945 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4946 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4947 | Counter{cSubReqToE2, 1}, |
| 4948 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4949 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4950 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4951 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4952 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4953 | Counter{cSubDelReReqToE2, 1}, |
| 4954 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4955 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4956 | }) |
| 4957 | // Req |
| 4958 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4959 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4960 | |
| 4961 | // Del |
| 4962 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4963 | |
| 4964 | // E2t: Receive 1st SubsDelReq |
| 4965 | e2termConn1.RecvSubsDelReq(t) |
| 4966 | |
| 4967 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4968 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4969 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4970 | |
| 4971 | //Wait that subs is cleaned |
| 4972 | waitSubsCleanup(t, e2SubsId, 10) |
| 4973 | |
| 4974 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4975 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4976 | } |
| 4977 | |
| 4978 | //----------------------------------------------------------------------------- |
| 4979 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4980 | // |
| 4981 | // stub stub |
| 4982 | // +-------+ +---------+ +---------+ |
| 4983 | // | xapp | | submgr | | e2term | |
| 4984 | // +-------+ +---------+ +---------+ |
| 4985 | // | | | |
| 4986 | // | [SUBS CREATE] | |
| 4987 | // | | | |
| 4988 | // | | | |
| 4989 | // | RESTSubDelReq | | |
| 4990 | // |---------------->| | |
| 4991 | // | | | |
| 4992 | // | RESTSubDelResp | | |
| 4993 | // |<----------------| | |
| 4994 | // | | SubDelReq | |
| 4995 | // | |------------->| |
| 4996 | // | | | |
| 4997 | // | | SubDelReq | |
| 4998 | // | |------------->| |
| 4999 | // | | | |
| 5000 | // | | | |
| 5001 | // |
| 5002 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5003 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5004 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5005 | |
| 5006 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5007 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5008 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5009 | Counter{cSubReqToE2, 1}, |
| 5010 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5011 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5012 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5013 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5014 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5015 | Counter{cSubDelReReqToE2, 1}, |
| 5016 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5017 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5018 | }) |
| 5019 | |
| 5020 | // Req |
| 5021 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5022 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5023 | |
| 5024 | // Del |
| 5025 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5026 | |
| 5027 | // E2t: Receive 1st SubsDelReq |
| 5028 | e2termConn1.RecvSubsDelReq(t) |
| 5029 | |
| 5030 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5031 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5032 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5033 | |
| 5034 | //Wait that subs is cleaned |
| 5035 | waitSubsCleanup(t, e2SubsId, 10) |
| 5036 | |
| 5037 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5038 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5039 | } |
| 5040 | |
| 5041 | //----------------------------------------------------------------------------- |
| 5042 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 5043 | // |
| 5044 | // stub stub |
| 5045 | // +-------+ +---------+ +---------+ |
| 5046 | // | xapp | | submgr | | e2term | |
| 5047 | // +-------+ +---------+ +---------+ |
| 5048 | // | | | |
| 5049 | // | [SUBS CREATE] | |
| 5050 | // | | | |
| 5051 | // | | | |
| 5052 | // | RESTSubDelReq | | |
| 5053 | // |---------------->| | |
| 5054 | // | | | |
| 5055 | // | RESTSubDelResp | | |
| 5056 | // |<----------------| | |
| 5057 | // | | SubDelReq | |
| 5058 | // | |------------->| |
| 5059 | // | | | |
| 5060 | // | | SubDelFail | |
| 5061 | // | |<-------------| |
| 5062 | // | | | |
| 5063 | // |
| 5064 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5065 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5066 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5067 | |
| 5068 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5069 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5070 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5071 | Counter{cSubReqToE2, 1}, |
| 5072 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5073 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5074 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5075 | Counter{cSubDelReqToE2, 1}, |
| 5076 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5077 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5078 | }) |
| 5079 | |
| 5080 | // Req |
| 5081 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5082 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5083 | |
| 5084 | // Del |
| 5085 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5086 | |
| 5087 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 5088 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5089 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5090 | |
| 5091 | //Wait that subs is cleaned |
| 5092 | waitSubsCleanup(t, e2SubsId, 10) |
| 5093 | |
| 5094 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5095 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5096 | } |
| 5097 | |
| 5098 | //----------------------------------------------------------------------------- |
| 5099 | // TestRESTSubReqAndSubDelOkSameAction |
| 5100 | // |
| 5101 | // stub stub |
| 5102 | // +-------+ +-------+ +---------+ +---------+ |
| 5103 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5104 | // +-------+ +-------+ +---------+ +---------+ |
| 5105 | // | | | | |
| 5106 | // | | RESTSubReq1 | | |
| 5107 | // | |---------------->| | |
| 5108 | // | | | | |
| 5109 | // | | RESTSubResp1 | | |
| 5110 | // | |<----------------| | |
| 5111 | // | | | | |
| 5112 | // | | | SubReq1 | |
| 5113 | // | | |------------->| |
| 5114 | // | | | SubResp1 | |
| 5115 | // | | |<-------------| |
| 5116 | // | | RESTNotif1 | | |
| 5117 | // | |<----------------| | |
| 5118 | // | | | | |
| 5119 | // | RESTSubReq2 | | |
| 5120 | // |------------------------------>| | |
| 5121 | // | | | | |
| 5122 | // | RESTSubResp2 | | |
| 5123 | // |<------------------------------| | |
| 5124 | // | | | | |
| 5125 | // | | RESTNotif2 | | |
| 5126 | // |<------------------------------| | |
| 5127 | // | | | | |
| 5128 | // | | RESTSubDelReq1 | | |
| 5129 | // | |---------------->| | |
| 5130 | // | | | | |
| 5131 | // | | RESTSubDelResp1 | | |
| 5132 | // | |<----------------| | |
| 5133 | // | | | | |
| 5134 | // | RESTSubDelReq2 | | |
| 5135 | // |------------------------------>| | |
| 5136 | // | | | | |
| 5137 | // | RESTSubDelResp2 | | |
| 5138 | // |<------------------------------| | |
| 5139 | // | | | | |
| 5140 | // | | | SubDelReq2 | |
| 5141 | // | | |------------->| |
| 5142 | // | | | | |
| 5143 | // | | | SubDelResp2 | |
| 5144 | // | | |<-------------| |
| 5145 | // | | | | |
| 5146 | // |
| 5147 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5148 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5149 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5150 | |
| 5151 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5152 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5153 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5154 | Counter{cSubReqToE2, 1}, |
| 5155 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5156 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5157 | Counter{cMergedSubscriptions, 1}, |
| 5158 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5159 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5160 | Counter{cSubDelReqToE2, 1}, |
| 5161 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5162 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5163 | }) |
| 5164 | |
| 5165 | // Req1 |
| 5166 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5167 | |
| 5168 | //Subs Create |
| 5169 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5170 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5171 | |
| 5172 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5173 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5174 | params.SetMeid("RAN_NAME_1") |
| 5175 | |
| 5176 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5177 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5178 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5179 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5180 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5181 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5182 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5183 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5184 | |
| 5185 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5186 | |
| 5187 | // Del1 |
| 5188 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5189 | |
| 5190 | // Del2 |
| 5191 | deleteXapp2Subscription(t, &restSubId2) |
| 5192 | |
| 5193 | //Wait that subs is cleaned |
| 5194 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5195 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5196 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5197 | } |
| 5198 | |
| 5199 | //----------------------------------------------------------------------------- |
| 5200 | // TestSubReqAndSubDelOkSameActionParallel |
| 5201 | // |
| 5202 | // stub stub stub |
| 5203 | // +-------+ +-------+ +---------+ +---------+ |
| 5204 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5205 | // +-------+ +-------+ +---------+ +---------+ |
| 5206 | // | | | | |
| 5207 | // | | | | |
| 5208 | // | | | | |
| 5209 | // | | SubReq1 | | |
| 5210 | // | |------------->| | |
| 5211 | // | | | | |
| 5212 | // | | | SubReq1 | |
| 5213 | // | | |------------->| |
| 5214 | // | SubReq2 | | |
| 5215 | // |--------------------------->| | |
| 5216 | // | | | SubResp1 | |
| 5217 | // | | |<-------------| |
| 5218 | // | | SubResp1 | | |
| 5219 | // | |<-------------| | |
| 5220 | // | | | SubReq2 | |
| 5221 | // | | |------------->| |
| 5222 | // | | | | |
| 5223 | // | | | SubResp2 | |
| 5224 | // | | |<-------------| |
| 5225 | // | SubResp2 | | |
| 5226 | // |<---------------------------| | |
| 5227 | // | | | | |
| 5228 | // | | SubDelReq 1 | | |
| 5229 | // | |------------->| | |
| 5230 | // | | | | |
| 5231 | // | | SubDelResp 1 | | |
| 5232 | // | |<-------------| | |
| 5233 | // | | | | |
| 5234 | // | SubDelReq 2 | | |
| 5235 | // |--------------------------->| | |
| 5236 | // | | | | |
| 5237 | // | | | SubDelReq 2 | |
| 5238 | // | | |------------->| |
| 5239 | // | | | | |
| 5240 | // | | | SubDelReq 2 | |
| 5241 | // | | |------------->| |
| 5242 | // | | | | |
| 5243 | // | SubDelResp 2 | | |
| 5244 | // |<---------------------------| | |
| 5245 | // |
| 5246 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5247 | |
| 5248 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5249 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5250 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5251 | Counter{cSubReqToE2, 2}, |
| 5252 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5253 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5254 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5255 | Counter{cSubDelReqToE2, 2}, |
| 5256 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5257 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5258 | }) |
| 5259 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5260 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5261 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5262 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5263 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5264 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5265 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5266 | |
| 5267 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5268 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5269 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 5270 | |
| 5271 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5272 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 5273 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 5274 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5275 | |
| 5276 | // Del1 |
| 5277 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5278 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5279 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5280 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5281 | |
| 5282 | // Del2 |
| 5283 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5284 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 5285 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 5286 | |
| 5287 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5288 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5289 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5290 | } |
| 5291 | |
| 5292 | //----------------------------------------------------------------------------- |
| 5293 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 5294 | // |
| 5295 | // stub stub stub |
| 5296 | // +-------+ +-------+ +---------+ +---------+ |
| 5297 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5298 | // +-------+ +-------+ +---------+ +---------+ |
| 5299 | // | | | | |
| 5300 | // | | | | |
| 5301 | // | | | | |
| 5302 | // | | RESTSubReq1 | | |
| 5303 | // | |---------------->| | |
| 5304 | // | | | | |
| 5305 | // | | RESTSubResp1 | | |
| 5306 | // | |<----------------| | |
| 5307 | // | | | SubReq1 | |
| 5308 | // | | |------------->| |
| 5309 | // | RESTSubReq2 | | |
| 5310 | // |------------------------------>| | |
| 5311 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5312 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5313 | // |<------------------------------| | |
| 5314 | // | | | SubReq1 | |
| 5315 | // | | |------------->| |
| 5316 | // | | | | |
| 5317 | // | | | | |
| 5318 | // | | | SubDelReq | |
| 5319 | // | | |------------->| |
| 5320 | // | | | | |
| 5321 | // | | | SubDelResp | |
| 5322 | // | | |<-------------| |
| 5323 | // | | RESTNotif1 | | |
| 5324 | // | | unsuccess | | |
| 5325 | // | |<----------------| | |
| 5326 | // | RESTNotif2 | | |
| 5327 | // | | unsuccess | | |
| 5328 | // |<------------------------------| | |
| 5329 | // | | | | |
| 5330 | // | | RESTSubDelReq1 | | |
| 5331 | // | |---------------->| | |
| 5332 | // | | | | |
| 5333 | // | | RESTSubDelResp1 | | |
| 5334 | // | |<----------------| | |
| 5335 | // | | | | |
| 5336 | // | RESTSubDelReq2 | | |
| 5337 | // |------------------------------>| | |
| 5338 | // | | | | |
| 5339 | // | RESTSubDelResp2 | | |
| 5340 | // |<------------------------------| | |
| 5341 | // |
| 5342 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5343 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5344 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5345 | |
| 5346 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5347 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5348 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5349 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5350 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5351 | Counter{cSubReqTimerExpiry, 2}, |
| 5352 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5353 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5354 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5355 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5356 | Counter{cSubDelReqToE2, 1}, |
| 5357 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5358 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5359 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5360 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5361 | |
| 5362 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5363 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5364 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5365 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5366 | |
| 5367 | // Req2 |
| 5368 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5369 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5370 | params2.SetMeid("RAN_NAME_1") |
| 5371 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5372 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5373 | |
| 5374 | //Req1 (retransmitted) |
| 5375 | e2termConn1.RecvSubsReq(t) |
| 5376 | |
| 5377 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5378 | |
| 5379 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5380 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5381 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5382 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5383 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5384 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5385 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5386 | |
| 5387 | // Del1 |
| 5388 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5389 | |
| 5390 | // Del2 |
| 5391 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5392 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5393 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5394 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5395 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5396 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5397 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5398 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5399 | } |
| 5400 | |
| 5401 | //----------------------------------------------------------------------------- |
| 5402 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5403 | // |
| 5404 | // stub stub stub |
| 5405 | // +-------+ +-------+ +---------+ +---------+ |
| 5406 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5407 | // +-------+ +-------+ +---------+ +---------+ |
| 5408 | // | | | | |
| 5409 | // | | | | |
| 5410 | // | | | | |
| 5411 | // | | RESTSubReq1 | | |
| 5412 | // | |---------------->| | |
| 5413 | // | | | | |
| 5414 | // | | RESTSubResp1 | | |
| 5415 | // | |<----------------| | |
| 5416 | // | | | SubReq1 | |
| 5417 | // | | |------------->| |
| 5418 | // | RESTSubReq2 | | |
| 5419 | // |------------------------------>| | |
| 5420 | // | | | | |
| 5421 | // | RESTSubDelResp2 | | |
| 5422 | // |<------------------------------| | |
| 5423 | // | | | SubFail1 | |
| 5424 | // | | |<-------------| |
| 5425 | // | | | | |
| 5426 | // | | RESTNotif1 | | |
| 5427 | // | | unsuccess | | |
| 5428 | // | |<----------------| | |
| 5429 | // | RESTNotif2 | | |
| 5430 | // | | unsuccess | | |
| 5431 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5432 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5433 | // | | 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] | 5434 | // | |---------------->| | |
| 5435 | // | | | | |
| 5436 | // | | RESTSubDelResp1 | | |
| 5437 | // | |<----------------| | |
| 5438 | // | | | | |
| 5439 | // | RESTSubDelReq2 | | |
| 5440 | // |------------------------------>| | |
| 5441 | // | | | | |
| 5442 | // | RESTSubDelResp2 | | |
| 5443 | // |<------------------------------| | |
| 5444 | // |
| 5445 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5446 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5447 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5448 | |
| 5449 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5450 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5451 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5452 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5453 | Counter{cSubReqToE2, 1}, |
| 5454 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5455 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5456 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5457 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5458 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5459 | }) |
| 5460 | |
| 5461 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5462 | |
| 5463 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5464 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5465 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5466 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5467 | |
| 5468 | // Req2 |
| 5469 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5470 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5471 | params2.SetMeid("RAN_NAME_1") |
| 5472 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5473 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5474 | |
| 5475 | // E2t: send SubsFail (first) |
| 5476 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5477 | fparams1.Set(crereq1) |
| 5478 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5479 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5480 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5481 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5482 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5483 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5484 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5485 | |
| 5486 | // Del1 |
| 5487 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5488 | |
| 5489 | // Del2 |
| 5490 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5491 | |
| 5492 | //Wait that subs is cleaned |
| 5493 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5494 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5495 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5496 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5497 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5498 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5499 | //----------------------------------------------------------------------------- |
| 5500 | // TestRESTSubReqPolicyAndSubDelOk |
| 5501 | // |
| 5502 | // stub stub |
| 5503 | // +-------+ +---------+ +---------+ |
| 5504 | // | xapp | | submgr | | e2term | |
| 5505 | // +-------+ +---------+ +---------+ |
| 5506 | // | | | |
| 5507 | // | RESTSubReq | | |
| 5508 | // |--------------->| | |
| 5509 | // | RESTSubResp | | |
| 5510 | // |<---------------| | |
| 5511 | // | | | |
| 5512 | // | | SubReq | |
| 5513 | // | |------------->| |
| 5514 | // | | | |
| 5515 | // | | SubResp | |
| 5516 | // | |<-------------| |
| 5517 | // | | | |
| 5518 | // | RESTNotif | | |
| 5519 | // |<---------------| | |
| 5520 | // | | | |
| 5521 | // | | | |
| 5522 | // | RESTSubDelReq | | |
| 5523 | // |--------------->| | |
| 5524 | // | RESTSubDelResp | | |
| 5525 | // |<---------------| | |
| 5526 | // | | | |
| 5527 | // | | SubDelReq | |
| 5528 | // | |------------->| |
| 5529 | // | | | |
| 5530 | // | | SubDelResp | |
| 5531 | // | |<-------------| |
| 5532 | // | | | |
| 5533 | // |
| 5534 | //----------------------------------------------------------------------------- |
| 5535 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5536 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5537 | |
| 5538 | // Init counter check |
| 5539 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5540 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5541 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5542 | Counter{cSubReqToE2, 1}, |
| 5543 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5544 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5545 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5546 | Counter{cSubDelReqToE2, 1}, |
| 5547 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5548 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5549 | }) |
| 5550 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5551 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5552 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5553 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5554 | |
| 5555 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5556 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5557 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5558 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5559 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5560 | |
| 5561 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5562 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5563 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5564 | |
| 5565 | // Wait that subs is cleaned |
| 5566 | waitSubsCleanup(t, e2SubsId, 10) |
| 5567 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5568 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5569 | } |
| 5570 | |
| 5571 | //----------------------------------------------------------------------------- |
| 5572 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5573 | // |
| 5574 | // stub stub |
| 5575 | // +-------+ +---------+ +---------+ |
| 5576 | // | xapp | | submgr | | e2term | |
| 5577 | // +-------+ +---------+ +---------+ |
| 5578 | // | | | |
| 5579 | // | RESTSubReq | | |
| 5580 | // |---------------->| | |
| 5581 | // | | | |
| 5582 | // | RESTSubResp | | |
| 5583 | // |<----------------| | |
| 5584 | // | | SubReq | |
| 5585 | // | |------------->| |
| 5586 | // | | | |
| 5587 | // | | SubResp | |
| 5588 | // | |<-------------| |
| 5589 | // | | | |
| 5590 | // | RESTNotif | | |
| 5591 | // |<----------------| | |
| 5592 | // | | | |
| 5593 | // | RESTSubReq | | |
| 5594 | // |---------------->| | |
| 5595 | // | | | |
| 5596 | // | RESTSubResp | | |
| 5597 | // |<----------------| | |
| 5598 | // | | SubReq | |
| 5599 | // | |------------->| |
| 5600 | // | | | |
| 5601 | // | | SubResp | |
| 5602 | // | |<-------------| |
| 5603 | // | | | |
| 5604 | // | RESTNotif | | |
| 5605 | // |<----------------| | |
| 5606 | // | | | |
| 5607 | // | RESTSubDelReq | | |
| 5608 | // |---------------->| | |
| 5609 | // | | | |
| 5610 | // | | SubDelReq | |
| 5611 | // | |------------->| |
| 5612 | // | | | |
| 5613 | // | | SubDelResp | |
| 5614 | // | |<-------------| |
| 5615 | // | | | |
| 5616 | // | RESTSubDelResp | | |
| 5617 | // |<----------------| | |
| 5618 | // |
| 5619 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5620 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5621 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5622 | |
| 5623 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5624 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5625 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5626 | Counter{cSubReqToE2, 2}, |
| 5627 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5628 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5629 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5630 | Counter{cSubDelReqToE2, 1}, |
| 5631 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5632 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5633 | }) |
| 5634 | |
| 5635 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5636 | const e2Timeout int64 = 1 |
| 5637 | const e2RetryCount int64 = 0 |
| 5638 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5639 | |
| 5640 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5641 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5642 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5643 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5644 | |
| 5645 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5646 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5647 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5648 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5649 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5650 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5651 | params.SetTimeToWait("w200ms") |
| 5652 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5653 | |
| 5654 | // Del |
| 5655 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5656 | |
| 5657 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5658 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5659 | |
| 5660 | // Wait that subs is cleaned |
| 5661 | waitSubsCleanup(t, e2SubsId, 10) |
| 5662 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5663 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5664 | } |
| 5665 | |
| 5666 | //----------------------------------------------------------------------------- |
aditverm | 323c77e | 2023-09-20 09:50:47 +0530 | [diff] [blame] | 5667 | // TestRESTSubReqPolicyChangeNokAndSubDelOk |
| 5668 | // |
| 5669 | // stub stub |
| 5670 | // +-------+ +---------+ +---------+ |
| 5671 | // | xapp | | submgr | | e2term | |
| 5672 | // +-------+ +---------+ +---------+ |
| 5673 | // | | | |
| 5674 | // | RESTSubReq | | |
| 5675 | // |---------------->| | |
| 5676 | // | | | |
| 5677 | // | RESTSubResp | | |
| 5678 | // |<----------------| | |
| 5679 | // | | SubReq | |
| 5680 | // | |------------->| |
| 5681 | // | | | |
| 5682 | // | | SubResp | |
| 5683 | // | |<-------------| |
| 5684 | // | | | |
| 5685 | // | RESTNotif | | |
| 5686 | // |<----------------| | |
| 5687 | // | | | |
| 5688 | // | RESTSubReq | | |
| 5689 | // |---------------->| | |
| 5690 | // | | | |
| 5691 | // | RESTSubResp | | |
| 5692 | // |<----------------| | |
| 5693 | // | | SubReq | |
| 5694 | // | |------------->| |
| 5695 | // | | | |
| 5696 | // | | SubFail | |
| 5697 | // | |<-------------| |
| 5698 | // | | | |
| 5699 | // | RESTNotif | | |
| 5700 | // |<----------------| | |
| 5701 | // | | | |
| 5702 | // | RESTSubDelReq | | |
| 5703 | // |---------------->| | |
| 5704 | // | | | |
| 5705 | // | | SubDelReq | |
| 5706 | // | |------------->| |
| 5707 | // | | | |
| 5708 | // | | SubDelResp | |
| 5709 | // | |<-------------| |
| 5710 | // | | | |
| 5711 | // | RESTSubDelResp | | |
| 5712 | // |<----------------| | |
| 5713 | // |
| 5714 | //----------------------------------------------------------------------------- |
| 5715 | |
| 5716 | func TestRESTSubReqPolicyChangeNokAndSubDelOk(t *testing.T) { |
| 5717 | |
| 5718 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5719 | Counter{cRestSubReqFromXapp, 2}, |
| 5720 | Counter{cRestSubRespToXapp, 2}, |
| 5721 | Counter{cSubReqToE2, 2}, |
| 5722 | Counter{cSubRespFromE2, 1}, |
| 5723 | Counter{cSubFailFromE2, 1}, |
| 5724 | Counter{cRestSubNotifToXapp, 1}, |
| 5725 | Counter{cRestSubFailNotifToXapp, 1}, |
| 5726 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5727 | Counter{cSubDelReqToE2, 1}, |
| 5728 | Counter{cSubDelRespFromE2, 1}, |
| 5729 | Counter{cRestSubDelRespToXapp, 1}, |
| 5730 | }) |
| 5731 | |
| 5732 | const subReqCount int = 1 |
| 5733 | const e2Timeout int64 = 1 |
| 5734 | const e2RetryCount int64 = 0 |
| 5735 | const routingNeeded bool = false |
| 5736 | |
| 5737 | // Req |
| 5738 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5739 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5740 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5741 | fmt.Printf("restSubId: %v", restSubId) |
| 5742 | |
| 5743 | // Policy change |
| 5744 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
| 5745 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5746 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5747 | params.SetSubscriptionID(&restSubId) |
| 5748 | params.SetTimeToWait("w200ms") |
| 5749 | |
| 5750 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 5751 | fmt.Printf("restSubId: %v", restSubId) |
| 5752 | |
| 5753 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5754 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
| 5755 | |
| 5756 | // Gnb sends RICSubscriptionFailure |
| 5757 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5758 | fparams.Set(crereq) |
| 5759 | fparams.SetCauseVal(0, 1, 5) // CauseRIC / function-resource-limit |
| 5760 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5761 | |
| 5762 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5763 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5764 | |
| 5765 | // Del |
| 5766 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5767 | |
| 5768 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5769 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5770 | |
| 5771 | // Wait that subs is cleaned |
| 5772 | waitSubsCleanup(t, e2SubsId, 10) |
| 5773 | mainCtrl.VerifyCounterValues(t) |
| 5774 | mainCtrl.VerifyAllClean(t) |
| 5775 | } |
| 5776 | |
| 5777 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5778 | // TestRESTSubReqPolicyChangeNOk |
| 5779 | // |
| 5780 | // stub stub |
| 5781 | // +-------+ +---------+ +---------+ |
| 5782 | // | xapp | | submgr | | e2term | |
| 5783 | // +-------+ +---------+ +---------+ |
| 5784 | // | | | |
| 5785 | // | RESTSubReq | | |
| 5786 | // |---------------->| | |
| 5787 | // | | | |
| 5788 | // | RESTSubResp | | |
| 5789 | // |<----------------| | |
| 5790 | // | | SubReq | |
| 5791 | // | |------------->| |
| 5792 | // | | | |
| 5793 | // | | SubResp | |
| 5794 | // | |<-------------| |
| 5795 | // | | | |
| 5796 | // | RESTNotif | | |
| 5797 | // |<----------------| | |
| 5798 | // | | | |
| 5799 | // | RESTSubReq | | |
| 5800 | // |---------------->| | |
| 5801 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5802 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5803 | // | | | |
| 5804 | // | RESTSubDelReq | | |
| 5805 | // |---------------->| | |
| 5806 | // | | | |
| 5807 | // | | SubDelReq | |
| 5808 | // | |------------->| |
| 5809 | // | | | |
| 5810 | // | | SubDelResp | |
| 5811 | // | |<-------------| |
| 5812 | // | | | |
| 5813 | // | RESTSubDelResp | | |
| 5814 | // |<----------------| | |
| 5815 | // |
| 5816 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5817 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5818 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5819 | |
| 5820 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5821 | Counter{cRestSubReqFromXapp, 2}, |
| 5822 | Counter{cRestSubRespToXapp, 1}, |
| 5823 | Counter{cSubReqToE2, 1}, |
| 5824 | Counter{cSubRespFromE2, 1}, |
| 5825 | Counter{cRestSubNotifToXapp, 1}, |
| 5826 | Counter{cRestSubFailToXapp, 1}, |
| 5827 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5828 | Counter{cSubDelReqToE2, 1}, |
| 5829 | Counter{cSubDelRespFromE2, 1}, |
| 5830 | Counter{cRestSubDelRespToXapp, 1}, |
| 5831 | }) |
| 5832 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5833 | // Req |
| 5834 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5835 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5836 | |
| 5837 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5838 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5839 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5840 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5841 | params.SetSubscriptionID(&restSubIdUpd) |
| 5842 | params.SetTimeToWait("w200ms") |
| 5843 | |
| 5844 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5845 | assert.Equal(t, restSubId2, "") |
| 5846 | |
| 5847 | // Del |
| 5848 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5849 | |
| 5850 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5851 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5852 | |
| 5853 | // Wait that subs is cleaned |
| 5854 | waitSubsCleanup(t, e2SubsId, 10) |
| 5855 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5856 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5857 | } |
| 5858 | |
| 5859 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5860 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5861 | // |
| 5862 | // stub stub stub |
| 5863 | // +-------+ +---------+ +---------+ +---------+ |
| 5864 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5865 | // +-------+ +---------+ +---------+ +---------+ |
| 5866 | // | | | | |
| 5867 | // | | | | |
| 5868 | // | | | | |
| 5869 | // | RESTSubReq1 | | | |
| 5870 | // |---------------->| | | |
| 5871 | // | | | | |
| 5872 | // | RESTSubResp1 | | | |
| 5873 | // |<----------------| | | |
| 5874 | // | | SubReq1 | | |
| 5875 | // | |------------->| | |
| 5876 | // | | | | |
| 5877 | // | RESTSubReq2 | | | |
| 5878 | // |---------------->| | | |
| 5879 | // | | | | |
| 5880 | // | RESTSubResp2 | | | |
| 5881 | // |<----------------| | | |
| 5882 | // | | SubReq2 | | |
| 5883 | // | |---------------------------->| |
| 5884 | // | | | | |
| 5885 | // | | SubResp1 | | |
| 5886 | // | |<-------------| | |
| 5887 | // | RESTNotif1 | | | |
| 5888 | // |<----------------| | | |
| 5889 | // | | SubResp2 | | |
| 5890 | // | |<----------------------------| |
| 5891 | // | RESTNotif2 | | | |
| 5892 | // |<----------------| | | |
| 5893 | // | | | | |
| 5894 | // | [SUBS 1 DELETE] | | |
| 5895 | // | | | | |
| 5896 | // | [SUBS 2 DELETE] | | |
| 5897 | // | | | | |
| 5898 | // |
| 5899 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5900 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5901 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5902 | |
| 5903 | // Init counter check |
| 5904 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5905 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5906 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5907 | Counter{cSubReqToE2, 2}, |
| 5908 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5909 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5910 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5911 | Counter{cSubDelReqToE2, 2}, |
| 5912 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5913 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5914 | }) |
| 5915 | |
| 5916 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5917 | |
| 5918 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5919 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5920 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5921 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5922 | |
| 5923 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5924 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5925 | params.SetMeid("RAN_NAME_11") |
| 5926 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5927 | // would not work as notification would not be received |
| 5928 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5929 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5930 | |
| 5931 | // Resp1 |
| 5932 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5933 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5934 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5935 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5936 | |
| 5937 | // Resp2 |
| 5938 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5939 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5940 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5941 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5942 | |
| 5943 | // Delete1 |
| 5944 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5945 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5946 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5947 | |
| 5948 | // Wait that subs is cleaned |
| 5949 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5950 | |
| 5951 | // Delete2 |
| 5952 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5953 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5954 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5955 | |
| 5956 | // Wait that subs is cleaned |
| 5957 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5958 | |
| 5959 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5960 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5961 | } |
| 5962 | |
| 5963 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5964 | // TestRESTSubReqInsertAndSubDelOk |
| 5965 | // |
| 5966 | // stub stub |
| 5967 | // +-------+ +---------+ +---------+ |
| 5968 | // | xapp | | submgr | | e2term | |
| 5969 | // +-------+ +---------+ +---------+ |
| 5970 | // | | | |
| 5971 | // | RestSubReq | | |
| 5972 | // |---------------->| | |
| 5973 | // | | | |
| 5974 | // | RESTSubResp | | |
| 5975 | // |<----------------| | |
| 5976 | // | | | |
| 5977 | // | | SubReq | |
| 5978 | // | |------------->| |
| 5979 | // | | | |
| 5980 | // | | SubResp | |
| 5981 | // | |<-------------| |
| 5982 | // | RESTNotif | | |
| 5983 | // |<----------------| | |
| 5984 | // | ... | ... | |
| 5985 | // | | | |
| 5986 | // | RESTSubDelReq | | |
| 5987 | // |---------------->| | |
| 5988 | // | | | |
| 5989 | // | | SubDelReq | |
| 5990 | // | |------------->| |
| 5991 | // | | | |
| 5992 | // | | SubDelResp | |
| 5993 | // | |<-------------| |
| 5994 | // | | | |
| 5995 | // | RESTSubDelResp| | |
| 5996 | // |<----------------| | |
| 5997 | // |
| 5998 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5999 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6000 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6001 | |
| 6002 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6003 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6004 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6005 | Counter{cSubReqToE2, 1}, |
| 6006 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6007 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6008 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6009 | Counter{cSubDelReqToE2, 1}, |
| 6010 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6011 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6012 | }) |
| 6013 | |
| 6014 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6015 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6016 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6017 | params.SetSubActionTypes("insert") |
| 6018 | |
| 6019 | // Req |
| 6020 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6021 | |
| 6022 | // Del |
| 6023 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6024 | |
| 6025 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6026 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6027 | |
| 6028 | // Wait that subs is cleaned |
| 6029 | waitSubsCleanup(t, e2SubsId, 10) |
| 6030 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6031 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6032 | } |
| 6033 | |
| 6034 | //----------------------------------------------------------------------------- |
| 6035 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 6036 | // |
| 6037 | // stub stub |
| 6038 | // +-------+ +---------+ +---------+ |
| 6039 | // | xapp | | submgr | | e2term | |
| 6040 | // +-------+ +---------+ +---------+ |
| 6041 | // | | | |
| 6042 | // | RESTSubReq | | |
| 6043 | // |------------->| | |
| 6044 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6045 | // | RESTSubResp | | |
| 6046 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6047 | // | | SubReq | |
| 6048 | // | |------------->| |
| 6049 | // | | | |
| 6050 | // | | SubResp | |
| 6051 | // | <----| |
| 6052 | // | | |
| 6053 | // | Submgr restart | |
| 6054 | // | | |
| 6055 | // | | | |
| 6056 | // | | SubDelReq | |
| 6057 | // | |------------->| |
| 6058 | // | | | |
| 6059 | // | | SubDelResp | |
| 6060 | // | |<-------------| |
| 6061 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6062 | // | RESTNotif | | |
| 6063 | // | unsuccess | | |
| 6064 | // |<-------------| | |
| 6065 | // | | | |
| 6066 | // | RESTSubDelReq| | |
| 6067 | // |------------->| | |
| 6068 | // | | | |
| 6069 | // |RESTSubDelResp| | |
| 6070 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6071 | // |
| 6072 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6073 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6074 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6075 | |
| 6076 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6077 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6078 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6079 | Counter{cSubReqToE2, 1}, |
| 6080 | Counter{cSubDelReqFromXapp, 1}, |
| 6081 | Counter{cSubDelReqToE2, 1}, |
| 6082 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6083 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6084 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6085 | }) |
| 6086 | |
| 6087 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6088 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6089 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6090 | |
| 6091 | //Req |
| 6092 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 6093 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6094 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6095 | |
| 6096 | e2termConn1.RecvSubsReq(t) |
| 6097 | |
| 6098 | mainCtrl.SetResetTestFlag(t, false) |
| 6099 | |
| 6100 | mainCtrl.SimulateRestart(t) |
| 6101 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 6102 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6103 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6104 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6105 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6106 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6107 | //Del |
| 6108 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6109 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6110 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6111 | e2termConn1.TestMsgChanEmpty(t) |
| 6112 | mainCtrl.wait_registry_empty(t, 10) |
| 6113 | |
| 6114 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6115 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6116 | } |
| 6117 | |
| 6118 | //----------------------------------------------------------------------------- |
| 6119 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6120 | // |
| 6121 | // stub stub |
| 6122 | // +-------+ +---------+ +---------+ |
| 6123 | // | xapp | | submgr | | e2term | |
| 6124 | // +-------+ +---------+ +---------+ |
| 6125 | // | | | |
| 6126 | // | RESTSubReq | | |
| 6127 | // |---------------->| | |
| 6128 | // | | | |
| 6129 | // | RESTSubResp | | |
| 6130 | // |<----------------| | |
| 6131 | // | | SubReq | |
| 6132 | // | |------------->| |
| 6133 | // | | | |
| 6134 | // | | SubResp | |
| 6135 | // | |<-------------| |
| 6136 | // | | | |
| 6137 | // | RESTNotif | | |
| 6138 | // |<----------------| | |
| 6139 | // | | | |
| 6140 | // | | |
| 6141 | // | Submgr restart | |
| 6142 | // | | | |
| 6143 | // | RESTSubDelReq | | |
| 6144 | // |---------------->| | |
| 6145 | // | | | |
| 6146 | // | | SubDelReq | |
| 6147 | // | |------------->| |
| 6148 | // | | | |
| 6149 | // | | SubDelResp | |
| 6150 | // | |<-------------| |
| 6151 | // | | | |
| 6152 | // | RESTSubDelResp | | |
| 6153 | // |<----------------| | |
| 6154 | // |
| 6155 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6156 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6157 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6158 | |
| 6159 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6160 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6161 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6162 | Counter{cSubReqToE2, 1}, |
| 6163 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6164 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6165 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6166 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6167 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6168 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6169 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6170 | |
| 6171 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6172 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6173 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6174 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6175 | |
| 6176 | // Check subscription |
| 6177 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6178 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6179 | mainCtrl.SimulateRestart(t) |
| 6180 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6181 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6182 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6183 | // That needs to be completed before successful subscription query is possible |
| 6184 | <-time.After(time.Second * 1) |
| 6185 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6186 | // Check subscription |
| 6187 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6188 | |
| 6189 | // Delete subscription |
| 6190 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 6191 | |
| 6192 | //Wait that subs is cleaned |
| 6193 | waitSubsCleanup(t, e2SubsId, 10) |
| 6194 | |
| 6195 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6196 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6197 | } |
| 6198 | |
| 6199 | //----------------------------------------------------------------------------- |
| 6200 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 6201 | // |
| 6202 | // stub stub |
| 6203 | // +-------+ +-------+ +---------+ +---------+ |
| 6204 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6205 | // +-------+ +-------+ +---------+ +---------+ |
| 6206 | // | | | | |
| 6207 | // | | RESTSubReq1 | | |
| 6208 | // | |---------------->| | |
| 6209 | // | | | | |
| 6210 | // | | RESTSubResp1 | | |
| 6211 | // | |<----------------| | |
| 6212 | // | | | | |
| 6213 | // | | | SubReq1 | |
| 6214 | // | | |------------->| |
| 6215 | // | | | SubResp1 | |
| 6216 | // | | |<-------------| |
| 6217 | // | | RESTNotif1 | | |
| 6218 | // | |<----------------| | |
| 6219 | // | | | | |
| 6220 | // | RESTSubReq2 | | |
| 6221 | // |------------------------------>| | |
| 6222 | // | | | | |
| 6223 | // | RESTSubResp2 | | |
| 6224 | // |<------------------------------| | |
| 6225 | // | | | | |
| 6226 | // | | RESTNotif2 | | |
| 6227 | // |<------------------------------| | |
| 6228 | // | | | | |
| 6229 | // | | Submgr restart | |
| 6230 | // | | | | |
| 6231 | // | | RESTSubDelReq1 | | |
| 6232 | // | |---------------->| | |
| 6233 | // | | | | |
| 6234 | // | | RESTSubDelResp1 | | |
| 6235 | // | |<----------------| | |
| 6236 | // | | | | |
| 6237 | // | | Submgr restart | |
| 6238 | // | | | | |
| 6239 | // | RESTSubDelReq2 | | |
| 6240 | // |------------------------------>| | |
| 6241 | // | | | | |
| 6242 | // | RESTSubDelResp2 | | |
| 6243 | // |<------------------------------| | |
| 6244 | // | | | | |
| 6245 | // | | | SubDelReq2 | |
| 6246 | // | | |------------->| |
| 6247 | // | | | | |
| 6248 | // | | | SubDelResp2 | |
| 6249 | // | | |<-------------| |
| 6250 | // | | | | |
| 6251 | // |
| 6252 | //----------------------------------------------------------------------------- |
| 6253 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6254 | |
| 6255 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6256 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6257 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6258 | Counter{cSubReqToE2, 1}, |
| 6259 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6260 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6261 | Counter{cMergedSubscriptions, 1}, |
| 6262 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6263 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6264 | Counter{cSubDelReqToE2, 1}, |
| 6265 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6266 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6267 | }) |
| 6268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6269 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6270 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6271 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6272 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6273 | |
| 6274 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6275 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6276 | params.SetMeid("RAN_NAME_1") |
| 6277 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6278 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6279 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6280 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6281 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6282 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6283 | |
| 6284 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 6285 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6286 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6287 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 6288 | |
| 6289 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6290 | // That needs to be completed before successful subscription delete is possible |
| 6291 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6292 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6293 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6294 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 6295 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6296 | // 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] | 6297 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6298 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6299 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 6300 | |
| 6301 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6302 | // That needs to be completed before successful subscription query is possible |
| 6303 | <-time.After(time.Second * 1) |
| 6304 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6305 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 6306 | |
| 6307 | // Delete subscription 2 |
| 6308 | deleteXapp2Subscription(t, &restSubId2) |
| 6309 | |
| 6310 | //Wait that subs is cleaned |
| 6311 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6312 | |
| 6313 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6314 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6315 | } |
| 6316 | |
| 6317 | //----------------------------------------------------------------------------- |
| 6318 | // TestRESTReportSubReqAndSubDelOk |
| 6319 | // |
| 6320 | // stub stub |
| 6321 | // +-------+ +---------+ +---------+ |
| 6322 | // | xapp | | submgr | | e2term | |
| 6323 | // +-------+ +---------+ +---------+ |
| 6324 | // | | | |
| 6325 | // | RestSubReq | | |
| 6326 | // |---------------->| | |
| 6327 | // | | | |
| 6328 | // | RESTSubResp | | |
| 6329 | // |<----------------| | |
| 6330 | // | | | |
| 6331 | // | | SubReq | |
| 6332 | // | |------------->| |
| 6333 | // | | | |
| 6334 | // | | SubResp | |
| 6335 | // | |<-------------| |
| 6336 | // | RESTNotif | | |
| 6337 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6338 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6339 | // | |------------->| |
| 6340 | // | | | |
| 6341 | // | | SubResp | |
| 6342 | // | |<-------------| |
| 6343 | // | RESTNotif | | |
| 6344 | // |<----------------| | |
| 6345 | // | ... | ... | |
| 6346 | // | | | |
| 6347 | // | | | |
| 6348 | // | RESTSubDelReq | | |
| 6349 | // |---------------->| | |
| 6350 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6351 | // | RESTSubDelResp| | |
| 6352 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6353 | // | | SubDelReq | |
| 6354 | // | |------------->| |
| 6355 | // | | | |
| 6356 | // | | SubDelResp | |
| 6357 | // | |<-------------| |
| 6358 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6359 | // |
| 6360 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6361 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6362 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6363 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6364 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6365 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6366 | } |
| 6367 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6368 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6369 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6370 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6371 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6372 | Counter{cRestSubReqFromXapp, 1}, |
| 6373 | Counter{cRestSubRespToXapp, 1}, |
| 6374 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6375 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 6376 | Counter{cRestSubNotifToXapp, 1}, |
| 6377 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6378 | Counter{cRestSubDelRespToXapp, 1}, |
| 6379 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6380 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 6381 | }) |
| 6382 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6383 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6384 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6385 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6386 | |
| 6387 | var e2SubsId []uint32 |
| 6388 | for i := 0; i < subReqCount; i++ { |
| 6389 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6390 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6391 | |
| 6392 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6393 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6394 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6395 | e2SubsId = append(e2SubsId, instanceId) |
| 6396 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6397 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 6398 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 6399 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 6400 | |
| 6401 | } |
| 6402 | |
| 6403 | // Del |
| 6404 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6405 | |
| 6406 | for i := 0; i < subReqCount; i++ { |
| 6407 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6408 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6409 | } |
| 6410 | |
| 6411 | // Wait that subs is cleaned |
| 6412 | for i := 0; i < subReqCount; i++ { |
| 6413 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6414 | } |
| 6415 | |
| 6416 | xappConn1.TestMsgChanEmpty(t) |
| 6417 | e2termConn1.TestMsgChanEmpty(t) |
| 6418 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6419 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6420 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6421 | } |
| 6422 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6423 | //----------------------------------------------------------------------------- |
| 6424 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6425 | // |
| 6426 | // stub stub |
| 6427 | // +-------+ +---------+ +---------+ |
| 6428 | // | xapp | | submgr | | e2term | |
| 6429 | // +-------+ +---------+ +---------+ |
| 6430 | // | | | |
| 6431 | // | RestSubReq | | |
| 6432 | // |---------------->| | |
| 6433 | // | | | |
| 6434 | // | RESTSubResp | | |
| 6435 | // |<----------------| | |
| 6436 | // | | | |
| 6437 | // | | SubReq | |
| 6438 | // | |------------->| |
| 6439 | // | | | |
| 6440 | // | | SubResp | |
| 6441 | // | |<-------------| |
| 6442 | // | RESTNotif | | |
| 6443 | // |<----------------| | |
| 6444 | // | | SubReq | |
| 6445 | // | |------------->| |
| 6446 | // | | | |
| 6447 | // | | SubResp | |
| 6448 | // | |<-------------| |
| 6449 | // | RESTNotif | | |
| 6450 | // |<----------------| | |
| 6451 | // | | | |
| 6452 | // | RESTSubDelReq | | |
| 6453 | // |---------------->| | |
| 6454 | // | | | |
| 6455 | // | RESTSubDelResp| | |
| 6456 | // |<----------------| | |
| 6457 | // | | SubDelReq | |
| 6458 | // | |------------->| |
| 6459 | // | | | |
| 6460 | // | | SubDelResp | |
| 6461 | // | |<-------------| |
| 6462 | // | | | |
| 6463 | // | | SubDelReq | |
| 6464 | // | |------------->| |
| 6465 | // | | | |
| 6466 | // | | SubDelResp | |
| 6467 | // | |<-------------| |
| 6468 | // | | | |
| 6469 | // |
| 6470 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6471 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6472 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6473 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6474 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6475 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6476 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6477 | Counter{cSubReqToE2, 2}, |
| 6478 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6479 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6480 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6481 | Counter{cSubDelReqToE2, 2}, |
| 6482 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6483 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6484 | }) |
| 6485 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6486 | const subReqCount int = 2 |
| 6487 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6488 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6489 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6490 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6491 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6492 | |
| 6493 | assert.Equal(t, len(e2SubsIds), 2) |
| 6494 | |
| 6495 | // Del |
| 6496 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6497 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6498 | |
| 6499 | xappConn1.TestMsgChanEmpty(t) |
| 6500 | e2termConn1.TestMsgChanEmpty(t) |
| 6501 | mainCtrl.wait_registry_empty(t, 10) |
| 6502 | |
| 6503 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6504 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6505 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6506 | |
| 6507 | //----------------------------------------------------------------------------- |
| 6508 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6509 | // |
| 6510 | // stub stub |
| 6511 | // +-------+ +---------+ +---------+ |
| 6512 | // | xapp | | submgr | | e2term | |
| 6513 | // +-------+ +---------+ +---------+ |
| 6514 | // | | | |
| 6515 | // | RestSubReq | | |
| 6516 | // |---------------->| | |
| 6517 | // | | | |
| 6518 | // | RESTSubResp | | |
| 6519 | // |<----------------| | |
| 6520 | // | | | ------ |
| 6521 | // | | SubReq | |
| 6522 | // | |------------->| |
| 6523 | // | | | E2 subscription x 19 |
| 6524 | // | | SubResp | |
| 6525 | // | |<-------------| |
| 6526 | // | RESTNotif | | |
| 6527 | // |<----------------| | |
| 6528 | // | | | ------ |
| 6529 | // | RESTSubDelReq | | |
| 6530 | // |---------------->| | |
| 6531 | // | | | |
| 6532 | // | RESTSubDelResp| | |
| 6533 | // |<----------------| | |
| 6534 | // | | SubDelReq | ------ |
| 6535 | // | |------------->| |
| 6536 | // | | | E2 subscription delete x 19 |
| 6537 | // | | SubDelResp | |
| 6538 | // | |<-------------| |
| 6539 | // | | | ------ |
| 6540 | // | | | |
| 6541 | // |
| 6542 | //----------------------------------------------------------------------------- |
| 6543 | |
| 6544 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6545 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6546 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6547 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6548 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6549 | Counter{cSubReqToE2, 19}, |
| 6550 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6551 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6552 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6553 | Counter{cSubDelReqToE2, 19}, |
| 6554 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6555 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6556 | }) |
| 6557 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6558 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6559 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6560 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6561 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6562 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6563 | |
| 6564 | assert.Equal(t, len(e2SubsIds), 19) |
| 6565 | |
| 6566 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6567 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6568 | |
| 6569 | xappConn1.TestMsgChanEmpty(t) |
| 6570 | e2termConn1.TestMsgChanEmpty(t) |
| 6571 | mainCtrl.wait_registry_empty(t, 10) |
| 6572 | |
| 6573 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6574 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6575 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6576 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6577 | //----------------------------------------------------------------------------- |
| 6578 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6579 | // |
| 6580 | // stub stub |
| 6581 | // +-------+ +---------+ +---------+ |
| 6582 | // | xapp | | submgr | | e2term | |
| 6583 | // +-------+ +---------+ +---------+ |
| 6584 | // | | | |
| 6585 | // | RestSubReq | | |
| 6586 | // |---------------->| | |
| 6587 | // | | | |
| 6588 | // | RESTSubResp | | |
| 6589 | // |<----------------| | |
| 6590 | // | | | |
| 6591 | // | | SubReq | |
| 6592 | // | |------------->| |
| 6593 | // | | | |
| 6594 | // | | SubResp | |
| 6595 | // | |<-------------| |
| 6596 | // | RESTNotif | | |
| 6597 | // |<----------------| | |
| 6598 | // | | SubReq | |
| 6599 | // | |------------->| |
| 6600 | // | | | |
| 6601 | // | | SubResp | |
| 6602 | // | |<-------------| |
| 6603 | // | RESTNotif | | |
| 6604 | // |<----------------| | |
| 6605 | // | | | |
| 6606 | // | RESTSubDelReq | | |
| 6607 | // |---------------->| | |
| 6608 | // | | | |
| 6609 | // | RESTSubDelResp| | |
| 6610 | // |<----------------| | |
| 6611 | // | | SubDelReq | |
| 6612 | // | |------------->| |
| 6613 | // | | | |
| 6614 | // | | SubDelResp | |
| 6615 | // | |<-------------| |
| 6616 | // | | | |
| 6617 | // | | SubDelReq | |
| 6618 | // | |------------->| |
| 6619 | // | | | |
| 6620 | // | | SubDelResp | |
| 6621 | // | |<-------------| |
| 6622 | // | | | |
| 6623 | // |
| 6624 | //----------------------------------------------------------------------------- |
| 6625 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6626 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6627 | |
| 6628 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6629 | |
| 6630 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6631 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6632 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6633 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6634 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6635 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6636 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6637 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6638 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6639 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6640 | }) |
| 6641 | |
| 6642 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6643 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6644 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6645 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6646 | |
| 6647 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6648 | |
| 6649 | // Del |
| 6650 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6651 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6652 | |
| 6653 | xappConn1.TestMsgChanEmpty(t) |
| 6654 | e2termConn1.TestMsgChanEmpty(t) |
| 6655 | mainCtrl.wait_registry_empty(t, 10) |
| 6656 | |
| 6657 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6658 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6659 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6660 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6661 | //----------------------------------------------------------------------------- |
| 6662 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6663 | // |
| 6664 | // stub stub |
| 6665 | // +-------+ +---------+ +---------+ |
| 6666 | // | xapp | | submgr | | e2term | |
| 6667 | // +-------+ +---------+ +---------+ |
| 6668 | // | | | |
| 6669 | // | RestSubReq | | |
| 6670 | // |---------------->| | |
| 6671 | // | | | |
| 6672 | // | RESTSubResp | | |
| 6673 | // |<----------------| | |
| 6674 | // | | | |
| 6675 | // | | SubReq | |
| 6676 | // | |------------->| |
| 6677 | // | | | |
| 6678 | // | | SubResp | |
| 6679 | // | |<-------------| |
| 6680 | // | RESTNotif | | |
| 6681 | // |<----------------| | |
| 6682 | // | | SubReq | |
| 6683 | // | |------------->| |
| 6684 | // | | | |
| 6685 | // | | SubResp | |
| 6686 | // | |<-------------| |
| 6687 | // | RESTNotif | | |
| 6688 | // |<----------------| | |
| 6689 | // | | | |
| 6690 | // | RESTSubDelReq | | |
| 6691 | // |---------------->| | |
| 6692 | // | | | |
| 6693 | // | RESTSubDelResp| | |
| 6694 | // |<----------------| | |
| 6695 | // | | SubDelReq | |
| 6696 | // | |------------->| |
| 6697 | // | | | |
| 6698 | // | | SubDelResp | |
| 6699 | // | |<-------------| |
| 6700 | // | | | |
| 6701 | // | | SubDelReq | |
| 6702 | // | |------------->| |
| 6703 | // | | | |
| 6704 | // | | SubDelResp | |
| 6705 | // | |<-------------| |
| 6706 | // | | | |
| 6707 | // |
| 6708 | //----------------------------------------------------------------------------- |
| 6709 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6710 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6711 | |
| 6712 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6713 | |
| 6714 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6715 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6716 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6717 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6718 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6719 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6720 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6721 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6722 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6723 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6724 | }) |
| 6725 | |
| 6726 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6727 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6728 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6729 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6730 | |
| 6731 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6732 | |
| 6733 | // Del |
| 6734 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6735 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6736 | |
| 6737 | xappConn1.TestMsgChanEmpty(t) |
| 6738 | e2termConn1.TestMsgChanEmpty(t) |
| 6739 | mainCtrl.wait_registry_empty(t, 10) |
| 6740 | |
| 6741 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6742 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6743 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6744 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6745 | //----------------------------------------------------------------------------- |
| 6746 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6747 | // |
| 6748 | // stub stub |
| 6749 | // +-------+ +---------+ +---------+ |
| 6750 | // | xapp | | submgr | | e2term | |
| 6751 | // +-------+ +---------+ +---------+ |
| 6752 | // | | | |
| 6753 | // | RestSubReq | | |
| 6754 | // |---------------->| | |
| 6755 | // | | | |
| 6756 | // | RESTSubResp | | |
| 6757 | // |<----------------| | |
| 6758 | // | | | ------ |
| 6759 | // | | SubReq | |
| 6760 | // | |------------->| |
| 6761 | // | | | E2 subscription x 19 |
| 6762 | // | | SubResp | |
| 6763 | // | |<-------------| |
| 6764 | // | RESTNotif | | |
| 6765 | // |<----------------| | |
| 6766 | // | | | ------ |
| 6767 | // | RESTSubDelReq | | |
| 6768 | // |---------------->| | |
| 6769 | // | | | |
| 6770 | // | RESTSubDelResp| | |
| 6771 | // |<----------------| | |
| 6772 | // | | SubDelReq | ------ |
| 6773 | // | |------------->| |
| 6774 | // | | | E2 subscription delete x 19 |
| 6775 | // | | SubDelResp | |
| 6776 | // | |<-------------| |
| 6777 | // | | | ------ |
| 6778 | // | | | |
| 6779 | // |
| 6780 | //----------------------------------------------------------------------------- |
| 6781 | |
| 6782 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6783 | |
| 6784 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6785 | |
| 6786 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6787 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6788 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6789 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6790 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6791 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6792 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6793 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6794 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6795 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6796 | }) |
| 6797 | |
| 6798 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6799 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6800 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6801 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6802 | |
| 6803 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6804 | |
| 6805 | // Del |
| 6806 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6807 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6808 | |
| 6809 | xappConn1.TestMsgChanEmpty(t) |
| 6810 | e2termConn1.TestMsgChanEmpty(t) |
| 6811 | mainCtrl.wait_registry_empty(t, 10) |
| 6812 | |
| 6813 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6814 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6815 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6816 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6817 | //----------------------------------------------------------------------------- |
| 6818 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6819 | // |
| 6820 | // stub stub stub |
| 6821 | // +-------+ +-------+ +---------+ +---------+ |
| 6822 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6823 | // +-------+ +-------+ +---------+ +---------+ |
| 6824 | // | | | | |
| 6825 | // | | RESTSubReq1 | | |
| 6826 | // | |------------->| | |
| 6827 | // | | RESTSubResp1 | | |
| 6828 | // | |<-------------| | |
| 6829 | // | | | | |
| 6830 | // | | | SubReq1 | |
| 6831 | // | | |------------->| |
| 6832 | // | | | | |
| 6833 | // | RESTSubReq2 | | |
| 6834 | // |------------------------>| | |
| 6835 | // | RESTSubResp2 | | |
| 6836 | // |<------------------------| | |
| 6837 | // | | | | |
| 6838 | // | | | SubReq2 | |
| 6839 | // | | |------------->| |
| 6840 | // | | | | |
| 6841 | // | | | SubResp1 | |
| 6842 | // | | |<-------------| |
| 6843 | // | | RESTNotif1 | | |
| 6844 | // | |<-------------| | |
| 6845 | // | | | | |
| 6846 | // | | | SubResp2 | |
| 6847 | // | | |<-------------| |
| 6848 | // | RESTNotif2 | | |
| 6849 | // |<------------------------| | |
| 6850 | // | | | | |
| 6851 | // | | [SUBS 1 DELETE] | |
| 6852 | // | | | | |
| 6853 | // | | [SUBS 2 DELETE] | |
| 6854 | // | | | | |
| 6855 | // |
| 6856 | //----------------------------------------------------------------------------- |
| 6857 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6858 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6859 | |
| 6860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6861 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6862 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6863 | Counter{cSubReqToE2, 2}, |
| 6864 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6865 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6866 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6867 | Counter{cSubDelReqToE2, 2}, |
| 6868 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6869 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6870 | }) |
| 6871 | |
| 6872 | // Req1 |
| 6873 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6874 | |
| 6875 | //Subs Create |
| 6876 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6877 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6878 | |
| 6879 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6880 | |
| 6881 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6882 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6883 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6884 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6885 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6886 | |
| 6887 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6888 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6889 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6890 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6891 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6892 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6893 | |
| 6894 | deleteXapp1Subscription(t, &restSubId1) |
| 6895 | deleteXapp2Subscription(t, &restSubId2) |
| 6896 | |
| 6897 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6898 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6899 | |
| 6900 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6901 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6902 | } |
| 6903 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6904 | //----------------------------------------------------------------------------- |
| 6905 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6906 | // |
| 6907 | // stub stub stub |
| 6908 | // +-------+ +-------+ +---------+ +---------+ |
| 6909 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6910 | // +-------+ +-------+ +---------+ +---------+ |
| 6911 | // | | | | |
| 6912 | // | | RESTSubReq1 | | |
| 6913 | // | |------------->| | |
| 6914 | // | | RESTSubResp1 | | |
| 6915 | // | |<-------------| | |
| 6916 | // | | | | |
| 6917 | // | | | SubReq1 | |
| 6918 | // | | |------------->| |
| 6919 | // | | | | |
| 6920 | // | RESTSubReq2 | | |
| 6921 | // |------------------------>| | |
| 6922 | // | RESTSubResp2 | | |
| 6923 | // |<------------------------| | |
| 6924 | // | | | | |
| 6925 | // | | | SubReq2 | |
| 6926 | // | | |------------->| |
| 6927 | // | | | | |
| 6928 | // | | | SubResp1 | |
| 6929 | // | | |<-------------| |
| 6930 | // | | RESTNotif1 | | |
| 6931 | // | |<-------------| | |
| 6932 | // | | | | |
| 6933 | // | | | SubResp2 | |
| 6934 | // | | |<-------------| |
| 6935 | // | RESTNotif2 | | |
| 6936 | // |<------------------------| | |
| 6937 | // | | | | |
| 6938 | // | | [SUBS 1 DELETE] | |
| 6939 | // | | | | |
| 6940 | // | | [SUBS 2 DELETE] | |
| 6941 | // | | | | |
| 6942 | // |
| 6943 | //----------------------------------------------------------------------------- |
| 6944 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6945 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6946 | |
| 6947 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6948 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6949 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6950 | Counter{cSubReqToE2, 2}, |
| 6951 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6952 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6953 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6954 | Counter{cSubDelReqToE2, 2}, |
| 6955 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6956 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6957 | }) |
| 6958 | |
| 6959 | // Req1 |
| 6960 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6961 | |
| 6962 | //Subs Create |
| 6963 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6964 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6965 | |
| 6966 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6967 | |
| 6968 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6969 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6970 | params.SetMeid("RAN_NAME_1") |
| 6971 | |
| 6972 | actionId := int64(1) |
| 6973 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6974 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6975 | subsequestActionType := "continue" |
| 6976 | timeToWait := "w10ms" |
| 6977 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6978 | |
| 6979 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6980 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6981 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6982 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6983 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6984 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6985 | |
| 6986 | deleteXapp1Subscription(t, &restSubId1) |
| 6987 | deleteXapp2Subscription(t, &restSubId2) |
| 6988 | |
| 6989 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6990 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6991 | |
| 6992 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6993 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6994 | } |
| 6995 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6996 | //----------------------------------------------------------------------------- |
| 6997 | // TestRESTSubReqReportSameActionDiffActionID |
| 6998 | // |
| 6999 | // stub stub stub |
| 7000 | // +-------+ +-------+ +---------+ +---------+ |
| 7001 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7002 | // +-------+ +-------+ +---------+ +---------+ |
| 7003 | // | | | | |
| 7004 | // | | RESTSubReq1 | | |
| 7005 | // | |------------->| | |
| 7006 | // | | RESTSubResp1 | | |
| 7007 | // | |<-------------| | |
| 7008 | // | | | | |
| 7009 | // | | | SubReq1 | |
| 7010 | // | | |------------->| |
| 7011 | // | | | | |
| 7012 | // | RESTSubReq2 | | |
| 7013 | // |------------------------>| | |
| 7014 | // | RESTSubResp2 | | |
| 7015 | // |<------------------------| | |
| 7016 | // | | | | |
| 7017 | // | | | SubReq2 | |
| 7018 | // | | |------------->| |
| 7019 | // | | | | |
| 7020 | // | | | SubResp1 | |
| 7021 | // | | |<-------------| |
| 7022 | // | | RESTNotif1 | | |
| 7023 | // | |<-------------| | |
| 7024 | // | | | | |
| 7025 | // | | | SubResp2 | |
| 7026 | // | | |<-------------| |
| 7027 | // | RESTNotif2 | | |
| 7028 | // |<------------------------| | |
| 7029 | // | | | | |
| 7030 | // | | [SUBS 1 DELETE] | |
| 7031 | // | | | | |
| 7032 | // | | [SUBS 2 DELETE] | |
| 7033 | // | | | | |
| 7034 | // |
| 7035 | //----------------------------------------------------------------------------- |
| 7036 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7037 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7038 | |
| 7039 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7040 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7041 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7042 | Counter{cSubReqToE2, 2}, |
| 7043 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7044 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7045 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7046 | Counter{cSubDelReqToE2, 2}, |
| 7047 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7048 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7049 | }) |
| 7050 | |
| 7051 | // Req1 |
| 7052 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7053 | |
| 7054 | //Subs Create |
| 7055 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7056 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7057 | |
| 7058 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7059 | |
| 7060 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7061 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7062 | params.SetMeid("RAN_NAME_1") |
| 7063 | params.SetSubActionIDs(int64(2)) |
| 7064 | |
| 7065 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7066 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7067 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7068 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7069 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7070 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7071 | |
| 7072 | deleteXapp1Subscription(t, &restSubId1) |
| 7073 | deleteXapp2Subscription(t, &restSubId2) |
| 7074 | |
| 7075 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7076 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7077 | |
| 7078 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7079 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7080 | } |
| 7081 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7082 | //----------------------------------------------------------------------------- |
| 7083 | // TestRESTSubReqDiffActionType |
| 7084 | // |
| 7085 | // stub stub stub |
| 7086 | // +-------+ +-------+ +---------+ +---------+ |
| 7087 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7088 | // +-------+ +-------+ +---------+ +---------+ |
| 7089 | // | | | | |
| 7090 | // | | RESTSubReq1 | | |
| 7091 | // | |------------->| | |
| 7092 | // | | RESTSubResp1 | | |
| 7093 | // | |<-------------| | |
| 7094 | // | | | | |
| 7095 | // | | | SubReq1 | |
| 7096 | // | | |------------->| |
| 7097 | // | | | | |
| 7098 | // | RESTSubReq2 | | |
| 7099 | // |------------------------>| | |
| 7100 | // | RESTSubResp2 | | |
| 7101 | // |<------------------------| | |
| 7102 | // | | | | |
| 7103 | // | | | SubReq2 | |
| 7104 | // | | |------------->| |
| 7105 | // | | | | |
| 7106 | // | | | SubResp1 | |
| 7107 | // | | |<-------------| |
| 7108 | // | | RESTNotif1 | | |
| 7109 | // | |<-------------| | |
| 7110 | // | | | | |
| 7111 | // | | | SubResp2 | |
| 7112 | // | | |<-------------| |
| 7113 | // | RESTNotif2 | | |
| 7114 | // |<------------------------| | |
| 7115 | // | | | | |
| 7116 | // | | [SUBS 1 DELETE] | |
| 7117 | // | | | | |
| 7118 | // | | [SUBS 2 DELETE] | |
| 7119 | // | | | | |
| 7120 | // |
| 7121 | //----------------------------------------------------------------------------- |
| 7122 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7123 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7124 | |
| 7125 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7126 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7127 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7128 | Counter{cSubReqToE2, 2}, |
| 7129 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7130 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7131 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7132 | Counter{cSubDelReqToE2, 2}, |
| 7133 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7134 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7135 | }) |
| 7136 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7137 | const e2Timeout int64 = 2 |
| 7138 | const e2RetryCount int64 = 2 |
| 7139 | const routingNeeded bool = true |
| 7140 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7141 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7142 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7143 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7144 | |
| 7145 | //Subs Create |
| 7146 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7147 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7148 | |
| 7149 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7150 | |
| 7151 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7152 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7153 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7154 | params.SetMeid("RAN_NAME_1") |
| 7155 | |
| 7156 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7157 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7158 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7159 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7160 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7161 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7162 | |
| 7163 | deleteXapp1Subscription(t, &restSubId1) |
| 7164 | deleteXapp2Subscription(t, &restSubId2) |
| 7165 | |
| 7166 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7167 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7168 | |
| 7169 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7170 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7171 | } |
| 7172 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7173 | //----------------------------------------------------------------------------- |
| 7174 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 7175 | // |
| 7176 | // stub stub stub |
| 7177 | // +-------+ +-------+ +---------+ +---------+ |
| 7178 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7179 | // +-------+ +-------+ +---------+ +---------+ |
| 7180 | // | | | | |
| 7181 | // | | RESTSubReq1 | | |
| 7182 | // | |------------->| | |
| 7183 | // | | RESTSubResp1 | | |
| 7184 | // | |<-------------| | |
| 7185 | // | | | | |
| 7186 | // | | | SubReq1 | |
| 7187 | // | | |------------->| |
| 7188 | // | | | | |
| 7189 | // | RESTSubReq2 | | |
| 7190 | // |------------------------>| | |
| 7191 | // | RESTSubResp2 | | |
| 7192 | // |<------------------------| | |
| 7193 | // | | | | |
| 7194 | // | | | SubReq2 | |
| 7195 | // | | |------------->| |
| 7196 | // | | | | |
| 7197 | // | | | SubResp1 | |
| 7198 | // | | |<-------------| |
| 7199 | // | | RESTNotif1 | | |
| 7200 | // | |<-------------| | |
| 7201 | // | | | | |
| 7202 | // | | | SubResp2 | |
| 7203 | // | | |<-------------| |
| 7204 | // | RESTNotif2 | | |
| 7205 | // |<------------------------| | |
| 7206 | // | | | | |
| 7207 | // | | [SUBS 1 DELETE] | |
| 7208 | // | | | | |
| 7209 | // | | [SUBS 2 DELETE] | |
| 7210 | // | | | | |
| 7211 | // |
| 7212 | //----------------------------------------------------------------------------- |
| 7213 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7214 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7215 | |
| 7216 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7217 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7218 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7219 | Counter{cSubReqToE2, 2}, |
| 7220 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7221 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7222 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7223 | Counter{cSubDelReqToE2, 2}, |
| 7224 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7225 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7226 | }) |
| 7227 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7228 | const e2Timeout int64 = 2 |
| 7229 | const e2RetryCount int64 = 2 |
| 7230 | const routingNeeded bool = true |
| 7231 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7232 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7233 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7234 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7235 | |
| 7236 | //Subs Create |
| 7237 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7238 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7239 | |
| 7240 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7241 | |
| 7242 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7243 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7244 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7245 | params.SetMeid("RAN_NAME_1") |
| 7246 | |
| 7247 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7248 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7249 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7250 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7251 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7252 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7253 | |
| 7254 | deleteXapp1Subscription(t, &restSubId1) |
| 7255 | deleteXapp2Subscription(t, &restSubId2) |
| 7256 | |
| 7257 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7258 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7259 | |
| 7260 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7261 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7262 | } |
| 7263 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7264 | //----------------------------------------------------------------------------- |
| 7265 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 7266 | // |
| 7267 | // stub stub stub |
| 7268 | // +-------+ +-------+ +---------+ +---------+ |
| 7269 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7270 | // +-------+ +-------+ +---------+ +---------+ |
| 7271 | // | | | | |
| 7272 | // | | RESTSubReq1 | | |
| 7273 | // | |------------->| | |
| 7274 | // | | RESTSubResp1 | | |
| 7275 | // | |<-------------| | |
| 7276 | // | | | | |
| 7277 | // | | | SubReq1 | |
| 7278 | // | | |------------->| |
| 7279 | // | | | | |
| 7280 | // | RESTSubReq2 | | |
| 7281 | // |------------------------>| | |
| 7282 | // | RESTSubResp2 | | |
| 7283 | // |<------------------------| | |
| 7284 | // | | | | |
| 7285 | // | | | SubReq2 | |
| 7286 | // | | |------------->| |
| 7287 | // | | | | |
| 7288 | // | | | SubResp1 | |
| 7289 | // | | |<-------------| |
| 7290 | // | | RESTNotif1 | | |
| 7291 | // | |<-------------| | |
| 7292 | // | | | | |
| 7293 | // | | | SubResp2 | |
| 7294 | // | | |<-------------| |
| 7295 | // | RESTNotif2 | | |
| 7296 | // |<------------------------| | |
| 7297 | // | | | | |
| 7298 | // | | [SUBS 1 DELETE] | |
| 7299 | // | | | | |
| 7300 | // | | [SUBS 2 DELETE] | |
| 7301 | // | | | | |
| 7302 | // |
| 7303 | //----------------------------------------------------------------------------- |
| 7304 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7305 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7306 | |
| 7307 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7308 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7309 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7310 | Counter{cSubReqToE2, 2}, |
| 7311 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7312 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7313 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7314 | Counter{cSubDelReqToE2, 2}, |
| 7315 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7316 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7317 | }) |
| 7318 | |
| 7319 | // Req1 |
| 7320 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7321 | |
| 7322 | //Subs Create |
| 7323 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7324 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7325 | |
| 7326 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7327 | |
| 7328 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7329 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7330 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7331 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7332 | params.SetSubActionDefinition(actionDefinition) |
| 7333 | |
| 7334 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7335 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7336 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7337 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7338 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7339 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7340 | |
| 7341 | deleteXapp1Subscription(t, &restSubId1) |
| 7342 | deleteXapp2Subscription(t, &restSubId2) |
| 7343 | |
| 7344 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7345 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7346 | |
| 7347 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7348 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7349 | } |
| 7350 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7351 | //----------------------------------------------------------------------------- |
| 7352 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 7353 | // |
| 7354 | // stub stub stub |
| 7355 | // +-------+ +-------+ +---------+ +---------+ |
| 7356 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7357 | // +-------+ +-------+ +---------+ +---------+ |
| 7358 | // | | | | |
| 7359 | // | | RESTSubReq1 | | |
| 7360 | // | |------------->| | |
| 7361 | // | | RESTSubResp1 | | |
| 7362 | // | |<-------------| | |
| 7363 | // | | | | |
| 7364 | // | | | SubReq1 | |
| 7365 | // | | |------------->| |
| 7366 | // | | | | |
| 7367 | // | RESTSubReq2 | | |
| 7368 | // |------------------------>| | |
| 7369 | // | RESTSubResp2 | | |
| 7370 | // |<------------------------| | |
| 7371 | // | | | | |
| 7372 | // | | | SubReq2 | |
| 7373 | // | | |------------->| |
| 7374 | // | | | | |
| 7375 | // | | | SubResp1 | |
| 7376 | // | | |<-------------| |
| 7377 | // | | RESTNotif1 | | |
| 7378 | // | |<-------------| | |
| 7379 | // | | | | |
| 7380 | // | | | SubResp2 | |
| 7381 | // | | |<-------------| |
| 7382 | // | RESTNotif2 | | |
| 7383 | // |<------------------------| | |
| 7384 | // | | | | |
| 7385 | // | | [SUBS 1 DELETE] | |
| 7386 | // | | | | |
| 7387 | // | | [SUBS 2 DELETE] | |
| 7388 | // | | | | |
| 7389 | // |
| 7390 | //----------------------------------------------------------------------------- |
| 7391 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7392 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7393 | |
| 7394 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7395 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7396 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7397 | Counter{cSubReqToE2, 2}, |
| 7398 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7399 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7400 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7401 | Counter{cSubDelReqToE2, 2}, |
| 7402 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7403 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7404 | }) |
| 7405 | |
| 7406 | // Req1 |
| 7407 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7408 | |
| 7409 | //Subs Create |
| 7410 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7411 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7412 | |
| 7413 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7414 | |
| 7415 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7416 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7417 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7418 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7419 | params.SetSubActionDefinition(actionDefinition) |
| 7420 | |
| 7421 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7422 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7423 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7424 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7425 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7426 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7427 | |
| 7428 | deleteXapp1Subscription(t, &restSubId1) |
| 7429 | deleteXapp2Subscription(t, &restSubId2) |
| 7430 | |
| 7431 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7432 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7433 | |
| 7434 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7435 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7436 | } |
| 7437 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7438 | //----------------------------------------------------------------------------- |
| 7439 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7440 | // |
| 7441 | // stub stub stub |
| 7442 | // +-------+ +-------+ +---------+ +---------+ |
| 7443 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7444 | // +-------+ +-------+ +---------+ +---------+ |
| 7445 | // | | | | |
| 7446 | // | | RESTSubReq1 | | |
| 7447 | // | |------------->| | |
| 7448 | // | | RESTSubResp1 | | |
| 7449 | // | |<-------------| | |
| 7450 | // | | | | |
| 7451 | // | | | SubReq1 | |
| 7452 | // | | |------------->| |
| 7453 | // | | | | |
| 7454 | // | RESTSubReq2 | | |
| 7455 | // |------------------------>| | |
| 7456 | // | RESTSubResp2 | | |
| 7457 | // |<------------------------| | |
| 7458 | // | | | | |
| 7459 | // | | | SubReq2 | |
| 7460 | // | | |------------->| |
| 7461 | // | | | | |
| 7462 | // | | | SubResp1 | |
| 7463 | // | | |<-------------| |
| 7464 | // | | RESTNotif1 | | |
| 7465 | // | |<-------------| | |
| 7466 | // | | | | |
| 7467 | // | | | SubResp2 | |
| 7468 | // | | |<-------------| |
| 7469 | // | RESTNotif2 | | |
| 7470 | // |<------------------------| | |
| 7471 | // | | | | |
| 7472 | // | | [SUBS 1 DELETE] | |
| 7473 | // | | | | |
| 7474 | // | | [SUBS 2 DELETE] | |
| 7475 | // | | | | |
| 7476 | // |
| 7477 | //----------------------------------------------------------------------------- |
| 7478 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7479 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7480 | |
| 7481 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7482 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7483 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7484 | Counter{cSubReqToE2, 2}, |
| 7485 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7486 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7487 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7488 | Counter{cSubDelReqToE2, 2}, |
| 7489 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7490 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7491 | }) |
| 7492 | |
| 7493 | // Req1 |
| 7494 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7495 | |
| 7496 | //Subs Create |
| 7497 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7498 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7499 | |
| 7500 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7501 | |
| 7502 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7503 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7504 | params.SetMeid("RAN_NAME_1") |
| 7505 | params.SetTimeToWait("w200ms") |
| 7506 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7507 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7508 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7509 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7510 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7511 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7512 | |
| 7513 | deleteXapp1Subscription(t, &restSubId1) |
| 7514 | deleteXapp2Subscription(t, &restSubId2) |
| 7515 | |
| 7516 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7517 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7518 | |
| 7519 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7520 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7521 | } |
| 7522 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7523 | //----------------------------------------------------------------------------- |
| 7524 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7525 | // |
| 7526 | // stub stub |
| 7527 | // +-------+ +---------+ +---------+ |
| 7528 | // | xapp | | submgr | | e2term | |
| 7529 | // +-------+ +---------+ +---------+ |
| 7530 | // | | | |
| 7531 | // | RestSubReq | | |
| 7532 | // |---------------->| | |
| 7533 | // | | | |
| 7534 | // | RESTSubResp | | |
| 7535 | // |<----------------| | |
| 7536 | // | | | |
| 7537 | // | | SubReq | |
| 7538 | // | |------------->| |
| 7539 | // | | | |
| 7540 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7541 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7542 | // | | | |
| 7543 | // | | SubReq | |
| 7544 | // | |------------->| |
| 7545 | // | | | |
| 7546 | // | | SubFail | Duplicated action |
| 7547 | // | |<-------------| |
| 7548 | // | RESTNotif (fail)| | |
| 7549 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7550 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7551 | // | [SUBS DELETE] | |
| 7552 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7553 | // |
| 7554 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7555 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7556 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7557 | |
| 7558 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7559 | Counter{cRestSubReqFromXapp, 1}, |
| 7560 | Counter{cRestSubRespToXapp, 1}, |
| 7561 | Counter{cSubReqToE2, 1}, |
| 7562 | Counter{cSubReqTimerExpiry, 1}, |
| 7563 | Counter{cSubReReqToE2, 1}, |
| 7564 | Counter{cSubRespFromE2, 1}, |
| 7565 | Counter{cSubFailFromE2, 1}, |
| 7566 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7567 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7568 | Counter{cRestSubDelRespToXapp, 1}, |
| 7569 | }) |
| 7570 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7571 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7572 | |
| 7573 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7574 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7575 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7576 | |
| 7577 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7578 | // Decode of this response fails which will result resending original request |
| 7579 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7580 | |
| 7581 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7582 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7583 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7584 | |
| 7585 | // Subscription already created in E2 Node. |
| 7586 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7587 | fparams.Set(crereq) |
| 7588 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7589 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7590 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7591 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7592 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7593 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7594 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7595 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7596 | // Wait that subs is cleaned |
| 7597 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7598 | |
| 7599 | xappConn1.TestMsgChanEmpty(t) |
| 7600 | e2termConn1.TestMsgChanEmpty(t) |
| 7601 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7602 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7603 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7604 | } |
| 7605 | |
| 7606 | //----------------------------------------------------------------------------- |
| 7607 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7608 | // |
| 7609 | // stub stub |
| 7610 | // +-------+ +---------+ +---------+ |
| 7611 | // | xapp | | submgr | | e2term | |
| 7612 | // +-------+ +---------+ +---------+ |
| 7613 | // | | | |
| 7614 | // | RestSubReq | | |
| 7615 | // |---------------->| | |
| 7616 | // | | | |
| 7617 | // | RESTSubResp | | |
| 7618 | // |<----------------| | |
| 7619 | // | | | |
| 7620 | // | | SubReq | |
| 7621 | // | |------------->| |
| 7622 | // | | | |
| 7623 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7624 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7625 | // | | | |
| 7626 | // | | SubReq | |
| 7627 | // | |------------->| |
| 7628 | // | | | |
| 7629 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7630 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7631 | // | RESTNotif (fail)| | |
| 7632 | // |<----------------| | |
| 7633 | // | | SubDelReq | |
| 7634 | // | |------------->| |
| 7635 | // | | | |
| 7636 | // | | SubDelResp | |
| 7637 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7638 | // | | | |
| 7639 | // | [SUBS DELETE] | |
| 7640 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7641 | // |
| 7642 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7643 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7644 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7645 | |
| 7646 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7647 | Counter{cRestSubReqFromXapp, 1}, |
| 7648 | Counter{cRestSubRespToXapp, 1}, |
| 7649 | Counter{cSubReqToE2, 1}, |
| 7650 | Counter{cSubReqTimerExpiry, 2}, |
| 7651 | Counter{cSubReReqToE2, 1}, |
| 7652 | Counter{cSubRespFromE2, 1}, |
| 7653 | Counter{cSubFailFromE2, 1}, |
| 7654 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7655 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7656 | Counter{cRestSubDelRespToXapp, 1}, |
| 7657 | Counter{cSubDelReqToE2, 1}, |
| 7658 | Counter{cSubDelRespFromE2, 1}, |
| 7659 | }) |
| 7660 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7661 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7662 | |
| 7663 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7664 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7665 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7666 | |
| 7667 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7668 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7669 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7670 | orgInstanceId := crereq.RequestId.InstanceId |
| 7671 | crereq.RequestId.InstanceId = 0 |
| 7672 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7673 | |
| 7674 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7675 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7676 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7677 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7678 | // 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] | 7679 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7680 | fparams.Set(crereq) |
| 7681 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7682 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7683 | |
| 7684 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7685 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7686 | |
| 7687 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7688 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7689 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7690 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7691 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7692 | // Wait that subs is cleaned |
| 7693 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7694 | |
| 7695 | xappConn1.TestMsgChanEmpty(t) |
| 7696 | e2termConn1.TestMsgChanEmpty(t) |
| 7697 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7698 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7699 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7700 | } |
| 7701 | |
| 7702 | //----------------------------------------------------------------------------- |
| 7703 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7704 | // |
| 7705 | // stub stub |
| 7706 | // +-------+ +---------+ +---------+ |
| 7707 | // | xapp | | submgr | | e2term | |
| 7708 | // +-------+ +---------+ +---------+ |
| 7709 | // | | | |
| 7710 | // | RestSubReq | | |
| 7711 | // |---------------->| | |
| 7712 | // | | | |
| 7713 | // | RESTSubResp | | |
| 7714 | // |<----------------| | |
| 7715 | // | | | |
| 7716 | // | | SubReq | |
| 7717 | // | |------------->| |
| 7718 | // | | | |
| 7719 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7720 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7721 | // | | | |
| 7722 | // | | SubReq | |
| 7723 | // | |------------->| |
| 7724 | // | | | |
| 7725 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7726 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7727 | // | RESTNotif (fail)| | |
| 7728 | // |<----------------| | |
| 7729 | // | | SubDelReq | |
| 7730 | // | |------------->| |
| 7731 | // | | | |
| 7732 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7733 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7734 | // | | | |
| 7735 | // | | SubDelReq | |
| 7736 | // | |------------->| |
| 7737 | // | | | |
| 7738 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7739 | // | |<-------------| Ongoing transaction not found. |
| 7740 | // | | | |
| 7741 | // | [SUBS DELETE] | |
| 7742 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7743 | // |
| 7744 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7745 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7746 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7747 | |
| 7748 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7749 | Counter{cRestSubReqFromXapp, 1}, |
| 7750 | Counter{cRestSubRespToXapp, 1}, |
| 7751 | Counter{cSubReqToE2, 1}, |
| 7752 | Counter{cSubReqTimerExpiry, 2}, |
| 7753 | Counter{cSubReReqToE2, 1}, |
| 7754 | Counter{cSubRespFromE2, 1}, |
| 7755 | Counter{cSubFailFromE2, 1}, |
| 7756 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7757 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7758 | Counter{cRestSubDelRespToXapp, 1}, |
| 7759 | Counter{cSubDelReqToE2, 1}, |
| 7760 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7761 | Counter{cSubDelReReqToE2, 1}, |
| 7762 | Counter{cSubDelRespFromE2, 2}, |
| 7763 | }) |
| 7764 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7765 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7766 | |
| 7767 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7768 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7769 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7770 | |
| 7771 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7772 | |
| 7773 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7774 | // No transaction exist for this response which will result resending original request |
| 7775 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7776 | |
| 7777 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7778 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7779 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7780 | |
| 7781 | // Subscription already created in E2 Node. |
| 7782 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7783 | fparams.Set(crereq) |
| 7784 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7785 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7786 | |
| 7787 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7788 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7789 | |
| 7790 | // Resending happens because there no transaction |
| 7791 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7792 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7793 | |
| 7794 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7795 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7796 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7797 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7798 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7799 | // Wait that subs is cleaned |
| 7800 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7801 | |
| 7802 | xappConn1.TestMsgChanEmpty(t) |
| 7803 | e2termConn1.TestMsgChanEmpty(t) |
| 7804 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7805 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7806 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7807 | } |
| 7808 | |
| 7809 | //----------------------------------------------------------------------------- |
| 7810 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7811 | // |
| 7812 | // stub stub |
| 7813 | // +-------+ +---------+ +---------+ |
| 7814 | // | xapp | | submgr | | e2term | |
| 7815 | // +-------+ +---------+ +---------+ |
| 7816 | // | | | |
| 7817 | // | RestSubReq | | |
| 7818 | // |---------------->| | |
| 7819 | // | | | |
| 7820 | // | RESTSubResp | | |
| 7821 | // |<----------------| | |
| 7822 | // | | | |
| 7823 | // | | SubReq | |
| 7824 | // | |------------->| |
| 7825 | // | | | |
| 7826 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7827 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7828 | // | | | |
| 7829 | // | | SubReq | |
| 7830 | // | |------------->| |
| 7831 | // | | | |
| 7832 | // | | SubFail | Duplicated action |
| 7833 | // | |<-------------| |
| 7834 | // | RESTNotif (fail)| | |
| 7835 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7836 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7837 | // | [SUBS DELETE] | |
| 7838 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7839 | // |
| 7840 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7841 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7842 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7843 | |
| 7844 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7845 | Counter{cRestSubReqFromXapp, 1}, |
| 7846 | Counter{cRestSubRespToXapp, 1}, |
| 7847 | Counter{cSubReqToE2, 1}, |
| 7848 | Counter{cSubReqTimerExpiry, 1}, |
| 7849 | Counter{cSubReReqToE2, 1}, |
| 7850 | Counter{cSubFailFromE2, 2}, |
| 7851 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7852 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7853 | Counter{cRestSubDelRespToXapp, 1}, |
| 7854 | }) |
| 7855 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7856 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7857 | |
| 7858 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7859 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7860 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7861 | |
| 7862 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7863 | |
| 7864 | // Decode of this response fails which will result resending original request |
| 7865 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7866 | |
| 7867 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7868 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7869 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7870 | |
| 7871 | // Subscription already created in E2 Node. |
| 7872 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7873 | fparams.Set(crereq) |
| 7874 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7875 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7876 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7877 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7878 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7879 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7880 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7881 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7882 | // Wait that subs is cleaned |
| 7883 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7884 | |
| 7885 | xappConn1.TestMsgChanEmpty(t) |
| 7886 | e2termConn1.TestMsgChanEmpty(t) |
| 7887 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7888 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7889 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7890 | } |
| 7891 | |
| 7892 | //----------------------------------------------------------------------------- |
| 7893 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7894 | // |
| 7895 | // stub stub |
| 7896 | // +-------+ +---------+ +---------+ |
| 7897 | // | xapp | | submgr | | e2term | |
| 7898 | // +-------+ +---------+ +---------+ |
| 7899 | // | | | |
| 7900 | // | RestSubReq | | |
| 7901 | // |---------------->| | |
| 7902 | // | | | |
| 7903 | // | RESTSubResp | | |
| 7904 | // |<----------------| | |
| 7905 | // | | | |
| 7906 | // | | SubReq | |
| 7907 | // | |------------->| |
| 7908 | // | | | |
| 7909 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7910 | // | |<-------------| 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] | 7911 | // | | | |
| 7912 | // | | SubReq | |
| 7913 | // | |------------->| |
| 7914 | // | | | |
| 7915 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7916 | // | |<-------------|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] | 7917 | // | RESTNotif (fail)| | |
| 7918 | // |<----------------| | |
| 7919 | // | | SubDelReq | |
| 7920 | // | |------------->| |
| 7921 | // | | | |
| 7922 | // | | SubDelResp | |
| 7923 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7924 | // | | | |
| 7925 | // | [SUBS DELETE] | |
| 7926 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7927 | // |
| 7928 | //----------------------------------------------------------------------------- |
| 7929 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7930 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7931 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7932 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7933 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7934 | Counter{cRestSubReqFromXapp, 1}, |
| 7935 | Counter{cRestSubRespToXapp, 1}, |
| 7936 | Counter{cSubReqToE2, 1}, |
| 7937 | Counter{cSubReqTimerExpiry, 2}, |
| 7938 | Counter{cSubReReqToE2, 1}, |
| 7939 | Counter{cSubFailFromE2, 2}, |
| 7940 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7941 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7942 | Counter{cRestSubDelRespToXapp, 1}, |
| 7943 | Counter{cSubDelReqToE2, 1}, |
| 7944 | Counter{cSubDelRespFromE2, 1}, |
| 7945 | }) |
| 7946 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7947 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7948 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7949 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7950 | |
| 7951 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7952 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7953 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7954 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7955 | fparams.Set(crereq) |
| 7956 | fparams.Fail.RequestId.InstanceId = 0 |
| 7957 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7958 | |
| 7959 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7960 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7961 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
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 | // 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] | 7964 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7965 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7966 | |
| 7967 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7968 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7969 | |
| 7970 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7971 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7972 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7973 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7974 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7975 | // Wait that subs is cleaned |
| 7976 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7977 | |
| 7978 | xappConn1.TestMsgChanEmpty(t) |
| 7979 | e2termConn1.TestMsgChanEmpty(t) |
| 7980 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7981 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7982 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7983 | } |
| 7984 | |
| 7985 | //----------------------------------------------------------------------------- |
| 7986 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7987 | // |
| 7988 | // stub stub |
| 7989 | // +-------+ +---------+ +---------+ |
| 7990 | // | xapp | | submgr | | e2term | |
| 7991 | // +-------+ +---------+ +---------+ |
| 7992 | // | | | |
| 7993 | // | RestSubReq | | |
| 7994 | // |---------------->| | |
| 7995 | // | | | |
| 7996 | // | RESTSubResp | | |
| 7997 | // |<----------------| | |
| 7998 | // | | | |
| 7999 | // | | SubReq | |
| 8000 | // | |------------->| |
| 8001 | // | | | |
| 8002 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8003 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8004 | // | | | |
| 8005 | // | | SubReq | |
| 8006 | // | |------------->| |
| 8007 | // | | | |
| 8008 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8009 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8010 | // | RESTNotif (fail)| | |
| 8011 | // |<----------------| | |
| 8012 | // | | SubDelReq | |
| 8013 | // | |------------->| |
| 8014 | // | | | |
| 8015 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8016 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 8017 | // | | | |
| 8018 | // | | SubDelReq | |
| 8019 | // | |------------->| |
| 8020 | // | | | |
| 8021 | // | | SubDelResp | |
| 8022 | // | |<-------------| Ongoing transaction not found. |
| 8023 | // | | | |
| 8024 | // | [SUBS DELETE] | |
| 8025 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8026 | // |
| 8027 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8028 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8029 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8030 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8031 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8032 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8033 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8034 | Counter{cRestSubReqFromXapp, 1}, |
| 8035 | Counter{cRestSubRespToXapp, 1}, |
| 8036 | Counter{cSubReqToE2, 1}, |
| 8037 | Counter{cSubReqTimerExpiry, 2}, |
| 8038 | Counter{cSubReReqToE2, 1}, |
| 8039 | Counter{cSubFailFromE2, 2}, |
| 8040 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8041 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8042 | Counter{cRestSubDelRespToXapp, 1}, |
| 8043 | Counter{cSubDelReqToE2, 1}, |
| 8044 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8045 | Counter{cSubDelReReqToE2, 1}, |
| 8046 | Counter{cSubDelRespFromE2, 2}, |
| 8047 | }) |
| 8048 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8049 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8050 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8051 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8052 | |
| 8053 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 8054 | |
| 8055 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 8056 | |
| 8057 | // No transaction exist for this response which will result resending original request |
| 8058 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 8059 | fparams.Set(crereq) |
| 8060 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 8061 | |
| 8062 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 8063 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8064 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8065 | |
| 8066 | // Subscription already created in E2 Node. |
| 8067 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 8068 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 8069 | |
| 8070 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8071 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8072 | |
| 8073 | // Resending happens because there no transaction |
| 8074 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8075 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8076 | |
| 8077 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8078 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8079 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8080 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8081 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8082 | // Wait that subs is cleaned |
| 8083 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 8084 | |
| 8085 | xappConn1.TestMsgChanEmpty(t) |
| 8086 | e2termConn1.TestMsgChanEmpty(t) |
| 8087 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8088 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8089 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8090 | } |
| 8091 | |
| 8092 | //----------------------------------------------------------------------------- |
| 8093 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 8094 | // |
| 8095 | // stub stub |
| 8096 | // +-------+ +---------+ +---------+ |
| 8097 | // | xapp | | submgr | | e2term | |
| 8098 | // +-------+ +---------+ +---------+ |
| 8099 | // | | | |
| 8100 | // | [SUBS CREATE] | |
| 8101 | // | | | |
| 8102 | // | | | |
| 8103 | // | RESTSubDelReq | | |
| 8104 | // |---------------->| | |
| 8105 | // | | | |
| 8106 | // | RESTSubDelResp | | |
| 8107 | // |<----------------| | |
| 8108 | // | | | |
| 8109 | // | | SubDelReq | |
| 8110 | // | |------------->| |
| 8111 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8112 | // | | SubDelResp | ASN.1 decode fails. |
| 8113 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8114 | // | | | |
| 8115 | // | | SubDelReq | |
| 8116 | // | |------------->| |
| 8117 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8118 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8119 | // | |<-------------| |
| 8120 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8121 | // | [SUBS DELETE] | |
| 8122 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8123 | // |
| 8124 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8125 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8126 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8127 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8128 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8129 | Counter{cRestSubReqFromXapp, 1}, |
| 8130 | Counter{cRestSubRespToXapp, 1}, |
| 8131 | Counter{cSubReqToE2, 1}, |
| 8132 | Counter{cSubRespFromE2, 1}, |
| 8133 | Counter{cRestSubNotifToXapp, 1}, |
| 8134 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8135 | Counter{cRestSubDelRespToXapp, 1}, |
| 8136 | Counter{cSubDelReqToE2, 1}, |
| 8137 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8138 | Counter{cSubDelReReqToE2, 1}, |
| 8139 | Counter{cSubDelFailFromE2, 1}, |
| 8140 | Counter{cSubDelRespFromE2, 1}, |
| 8141 | }) |
| 8142 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8143 | // Req |
| 8144 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8145 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8146 | |
| 8147 | // Del |
| 8148 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8149 | |
| 8150 | // E2t: Receive 1st SubsDelReq |
| 8151 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8152 | |
| 8153 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8154 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8155 | |
| 8156 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8157 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8158 | |
| 8159 | // Subscription does not exist in in E2 Node. |
| 8160 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8161 | |
| 8162 | // Wait that subs is cleaned |
| 8163 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8164 | |
| 8165 | xappConn1.TestMsgChanEmpty(t) |
| 8166 | e2termConn1.TestMsgChanEmpty(t) |
| 8167 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8168 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8169 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8170 | } |
| 8171 | |
| 8172 | //----------------------------------------------------------------------------- |
| 8173 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 8174 | // |
| 8175 | // stub stub |
| 8176 | // +-------+ +---------+ +---------+ |
| 8177 | // | xapp | | submgr | | e2term | |
| 8178 | // +-------+ +---------+ +---------+ |
| 8179 | // | | | |
| 8180 | // | [SUBS CREATE] | |
| 8181 | // | | | |
| 8182 | // | | | |
| 8183 | // | RESTSubDelReq | | |
| 8184 | // |---------------->| | |
| 8185 | // | | | |
| 8186 | // | RESTSubDelResp | | |
| 8187 | // |<----------------| | |
| 8188 | // | | | |
| 8189 | // | | SubDelReq | |
| 8190 | // | |------------->| |
| 8191 | // | | | |
| 8192 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8193 | // | |<-------------| 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] | 8194 | // | | | |
| 8195 | // | | SubDelReq | |
| 8196 | // | |------------->| |
| 8197 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8198 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8199 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8200 | // | | | |
| 8201 | // | [SUBS DELETE] | |
| 8202 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8203 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8204 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8205 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8206 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8207 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8208 | Counter{cRestSubReqFromXapp, 1}, |
| 8209 | Counter{cRestSubRespToXapp, 1}, |
| 8210 | Counter{cSubReqToE2, 1}, |
| 8211 | Counter{cSubRespFromE2, 1}, |
| 8212 | Counter{cRestSubNotifToXapp, 1}, |
| 8213 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8214 | Counter{cRestSubDelRespToXapp, 1}, |
| 8215 | Counter{cSubDelReqToE2, 1}, |
| 8216 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8217 | Counter{cSubDelReReqToE2, 1}, |
| 8218 | Counter{cSubDelRespFromE2, 1}, |
| 8219 | Counter{cSubDelFailFromE2, 1}, |
| 8220 | }) |
| 8221 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8222 | // Req |
| 8223 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8224 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8225 | |
| 8226 | // Del |
| 8227 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8228 | |
| 8229 | // E2t: Receive 1st SubsDelReq |
| 8230 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8231 | |
| 8232 | // Unknown instanceId in this response which will result resending original request |
| 8233 | delreq.RequestId.InstanceId = 0 |
| 8234 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8235 | |
| 8236 | // E2t: Receive 2nd SubsDelReq |
| 8237 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8238 | |
| 8239 | // Subscription does not exist in in E2 Node. |
| 8240 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8241 | |
| 8242 | // Wait that subs is cleaned |
| 8243 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8244 | |
| 8245 | xappConn1.TestMsgChanEmpty(t) |
| 8246 | e2termConn1.TestMsgChanEmpty(t) |
| 8247 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8248 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8249 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8250 | } |
| 8251 | |
| 8252 | //----------------------------------------------------------------------------- |
| 8253 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 8254 | // |
| 8255 | // stub stub |
| 8256 | // +-------+ +---------+ +---------+ |
| 8257 | // | xapp | | submgr | | e2term | |
| 8258 | // +-------+ +---------+ +---------+ |
| 8259 | // | | | |
| 8260 | // | [SUBS CREATE] | |
| 8261 | // | | | |
| 8262 | // | | | |
| 8263 | // | RESTSubDelReq | | |
| 8264 | // |---------------->| | |
| 8265 | // | | | |
| 8266 | // | RESTSubDelResp | | |
| 8267 | // |<----------------| | |
| 8268 | // | | | |
| 8269 | // | | SubDelReq | |
| 8270 | // | |------------->| |
| 8271 | // | | | |
| 8272 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8273 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8274 | // | | | |
| 8275 | // | | SubDelReq | |
| 8276 | // | |------------->| |
| 8277 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8278 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8279 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8280 | // | | | |
| 8281 | // | [SUBS DELETE] | |
| 8282 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8283 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8284 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8285 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8286 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8287 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8288 | Counter{cRestSubReqFromXapp, 1}, |
| 8289 | Counter{cRestSubRespToXapp, 1}, |
| 8290 | Counter{cSubReqToE2, 1}, |
| 8291 | Counter{cSubRespFromE2, 1}, |
| 8292 | Counter{cRestSubNotifToXapp, 1}, |
| 8293 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8294 | Counter{cRestSubDelRespToXapp, 1}, |
| 8295 | Counter{cSubDelReqToE2, 1}, |
| 8296 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8297 | Counter{cSubDelReReqToE2, 1}, |
| 8298 | Counter{cSubDelRespFromE2, 1}, |
| 8299 | Counter{cSubDelFailFromE2, 1}, |
| 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.SendSubsDelResp(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 | |
| 8333 | //----------------------------------------------------------------------------- |
| 8334 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 8335 | // |
| 8336 | // stub stub |
| 8337 | // +-------+ +---------+ +---------+ |
| 8338 | // | xapp | | submgr | | e2term | |
| 8339 | // +-------+ +---------+ +---------+ |
| 8340 | // | | | |
| 8341 | // | [SUBS CREATE] | |
| 8342 | // | | | |
| 8343 | // | | | |
| 8344 | // | RESTSubDelReq | | |
| 8345 | // |---------------->| | |
| 8346 | // | | | |
| 8347 | // | RESTSubDelResp | | |
| 8348 | // |<----------------| | |
| 8349 | // | | | |
| 8350 | // | | SubDelReq | |
| 8351 | // | |------------->| |
| 8352 | // | | | |
| 8353 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8354 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8355 | // | | | |
| 8356 | // | | SubDelReq | |
| 8357 | // | |------------->| |
| 8358 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8359 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8360 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8361 | // | | | |
| 8362 | // | [SUBS DELETE] | |
| 8363 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8364 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8365 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8366 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8367 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8368 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8369 | Counter{cRestSubReqFromXapp, 1}, |
| 8370 | Counter{cRestSubRespToXapp, 1}, |
| 8371 | Counter{cSubReqToE2, 1}, |
| 8372 | Counter{cSubRespFromE2, 1}, |
| 8373 | Counter{cRestSubNotifToXapp, 1}, |
| 8374 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8375 | Counter{cRestSubDelRespToXapp, 1}, |
| 8376 | Counter{cSubDelReqToE2, 1}, |
| 8377 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8378 | Counter{cSubDelReReqToE2, 1}, |
| 8379 | Counter{cSubDelFailFromE2, 2}, |
| 8380 | }) |
| 8381 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8382 | // Req |
| 8383 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8384 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8385 | |
| 8386 | // Del |
| 8387 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8388 | |
| 8389 | // E2t: Receive 1st SubsDelReq |
| 8390 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8391 | |
| 8392 | // Decode of this response fails which will result resending original request |
| 8393 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 8394 | |
| 8395 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8396 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8397 | |
| 8398 | // Subscription does not exist in in E2 Node. |
| 8399 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8400 | |
| 8401 | // Wait that subs is cleaned |
| 8402 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8403 | |
| 8404 | xappConn1.TestMsgChanEmpty(t) |
| 8405 | e2termConn1.TestMsgChanEmpty(t) |
| 8406 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8407 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8408 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8409 | } |
| 8410 | |
| 8411 | //----------------------------------------------------------------------------- |
| 8412 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8413 | // |
| 8414 | // stub stub |
| 8415 | // +-------+ +---------+ +---------+ |
| 8416 | // | xapp | | submgr | | e2term | |
| 8417 | // +-------+ +---------+ +---------+ |
| 8418 | // | | | |
| 8419 | // | [SUBS CREATE] | |
| 8420 | // | | | |
| 8421 | // | | | |
| 8422 | // | RESTSubDelReq | | |
| 8423 | // |---------------->| | |
| 8424 | // | | | |
| 8425 | // | RESTSubDelResp | | |
| 8426 | // |<----------------| | |
| 8427 | // | | | |
| 8428 | // | | SubDelReq | |
| 8429 | // | |------------->| |
| 8430 | // | | | |
| 8431 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8432 | // | |<-------------| 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] | 8433 | // | | | |
| 8434 | // | | SubDelReq | |
| 8435 | // | |------------->| |
| 8436 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8437 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8438 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8439 | // | | | |
| 8440 | // | [SUBS DELETE] | |
| 8441 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8442 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8443 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8444 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8445 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8446 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8447 | Counter{cRestSubReqFromXapp, 1}, |
| 8448 | Counter{cRestSubRespToXapp, 1}, |
| 8449 | Counter{cSubReqToE2, 1}, |
| 8450 | Counter{cSubRespFromE2, 1}, |
| 8451 | Counter{cRestSubNotifToXapp, 1}, |
| 8452 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8453 | Counter{cRestSubDelRespToXapp, 1}, |
| 8454 | Counter{cSubDelReqToE2, 1}, |
| 8455 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8456 | Counter{cSubDelReReqToE2, 1}, |
| 8457 | Counter{cSubDelFailFromE2, 2}, |
| 8458 | }) |
| 8459 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8460 | // Req |
| 8461 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8462 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8463 | |
| 8464 | // Del |
| 8465 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8466 | |
| 8467 | // E2t: Receive 1st SubsDelReq |
| 8468 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8469 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8470 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8471 | delreq.RequestId.InstanceId = 0 |
| 8472 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8473 | |
| 8474 | // E2t: Receive 2nd SubsDelReq |
| 8475 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8476 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8477 | // 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] | 8478 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8479 | |
| 8480 | // Wait that subs is cleaned |
| 8481 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8482 | |
| 8483 | xappConn1.TestMsgChanEmpty(t) |
| 8484 | e2termConn1.TestMsgChanEmpty(t) |
| 8485 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8486 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8487 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8488 | } |
| 8489 | |
| 8490 | //----------------------------------------------------------------------------- |
| 8491 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8492 | // |
| 8493 | // stub stub |
| 8494 | // +-------+ +---------+ +---------+ |
| 8495 | // | xapp | | submgr | | e2term | |
| 8496 | // +-------+ +---------+ +---------+ |
| 8497 | // | | | |
| 8498 | // | [SUBS CREATE] | |
| 8499 | // | | | |
| 8500 | // | | | |
| 8501 | // | RESTSubDelReq | | |
| 8502 | // |---------------->| | |
| 8503 | // | | | |
| 8504 | // | RESTSubDelResp | | |
| 8505 | // |<----------------| | |
| 8506 | // | | | |
| 8507 | // | | SubDelReq | |
| 8508 | // | |------------->| |
| 8509 | // | | | |
| 8510 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8511 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8512 | // | | | |
| 8513 | // | | SubDelReq | |
| 8514 | // | |------------->| |
| 8515 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8516 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8517 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8518 | // | | | |
| 8519 | // | [SUBS DELETE] | |
| 8520 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8521 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8522 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8523 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8524 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8525 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8526 | Counter{cRestSubReqFromXapp, 1}, |
| 8527 | Counter{cRestSubRespToXapp, 1}, |
| 8528 | Counter{cSubReqToE2, 1}, |
| 8529 | Counter{cSubRespFromE2, 1}, |
| 8530 | Counter{cRestSubNotifToXapp, 1}, |
| 8531 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8532 | Counter{cRestSubDelRespToXapp, 1}, |
| 8533 | Counter{cSubDelReqToE2, 1}, |
| 8534 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8535 | Counter{cSubDelReReqToE2, 1}, |
| 8536 | Counter{cSubDelFailFromE2, 2}, |
| 8537 | }) |
| 8538 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8539 | // Req |
| 8540 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8541 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8542 | |
| 8543 | // Del |
| 8544 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8545 | |
| 8546 | // E2t: Receive 1st SubsDelReq |
| 8547 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8548 | |
| 8549 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8550 | |
| 8551 | // No transaction exist for this response which will result resending original request |
| 8552 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8553 | |
| 8554 | // E2t: Receive 2nd SubsDelReq |
| 8555 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8556 | |
| 8557 | // Subscription does not exist in in E2 Node. |
| 8558 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8559 | |
| 8560 | // Wait that subs is cleaned |
| 8561 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8562 | |
| 8563 | xappConn1.TestMsgChanEmpty(t) |
| 8564 | e2termConn1.TestMsgChanEmpty(t) |
| 8565 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8566 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8567 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8568 | } |
| 8569 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8570 | //----------------------------------------------------------------------------- |
| 8571 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8572 | // |
| 8573 | // stub stub |
| 8574 | // +-------+ +---------+ +---------+ |
| 8575 | // | xapp | | submgr | | e2term | |
| 8576 | // +-------+ +---------+ +---------+ |
| 8577 | // | | | |
| 8578 | // | RESTSubReq | | |
| 8579 | // |---------------->| | |
| 8580 | // | | | |
| 8581 | // | RESTSubResp | | |
| 8582 | // |<----------------| | |
| 8583 | // | | | |
| 8584 | // | ASN.1 encode fails | |
| 8585 | // | | | |
| 8586 | // | | SubDelReq | |
| 8587 | // | |------------->| |
| 8588 | // | | | |
| 8589 | // | | SubDelFail | |
| 8590 | // | |<-------------| |
| 8591 | // | | | |
| 8592 | // | RESTNotif | | |
| 8593 | // | unsuccess | | |
| 8594 | // |<----------------| | |
| 8595 | // | | | |
| 8596 | // | [SUBS DELETE] | |
| 8597 | // | | | |
| 8598 | // |
| 8599 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8600 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8601 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8602 | |
| 8603 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8604 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8605 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8606 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8607 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8608 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8609 | }) |
| 8610 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8611 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8612 | |
| 8613 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8614 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8615 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8616 | |
| 8617 | // Req |
| 8618 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8619 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8620 | |
| 8621 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8622 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8623 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8624 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8625 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8626 | |
| 8627 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8628 | |
| 8629 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8630 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8631 | // Wait that subs is cleaned |
| 8632 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8633 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8634 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8635 | } |
| 8636 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8637 | //----------------------------------------------------------------------------- |
| 8638 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8639 | // |
| 8640 | // stub stub |
| 8641 | // +-------+ +---------+ +---------+ |
| 8642 | // | xapp | | submgr | | e2term | |
| 8643 | // +-------+ +---------+ +---------+ |
| 8644 | // | | | |
| 8645 | // | RESTSubReq | | |
| 8646 | // |---------------->| | |
| 8647 | // | | | |
| 8648 | // | RESTSubResp | | |
| 8649 | // |<----------------| | |
| 8650 | // | | SubReq | |
| 8651 | // | |------------->| |
| 8652 | // | | | |
| 8653 | // | | SubResp | |
| 8654 | // | |<-------------| |
| 8655 | // | | | |
| 8656 | // | RESTNotif | | |
| 8657 | // |<----------------| | |
| 8658 | // | | | |
| 8659 | // | RESTSubReq | | Policy modification |
| 8660 | // |---------------->| | |
| 8661 | // | | | |
| 8662 | // | RESTSubResp | | |
| 8663 | // |<----------------| | |
| 8664 | // | | SubReq | |
| 8665 | // | |------------->| |
| 8666 | // | | | |
| 8667 | // | | | |
| 8668 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8669 | // |<----------------| | |
| 8670 | // | | | |
| 8671 | // | RESTSubDelReq | | |
| 8672 | // |---------------->| | |
| 8673 | // | | | |
| 8674 | // | | SubDelReq | |
| 8675 | // | |------------->| |
| 8676 | // | | | |
| 8677 | // | | SubDelResp | |
| 8678 | // | |<-------------| |
| 8679 | // | | | |
| 8680 | // | RESTSubDelResp | | |
| 8681 | // |<----------------| | |
| 8682 | // |
| 8683 | //----------------------------------------------------------------------------- |
| 8684 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8685 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8686 | |
| 8687 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8688 | Counter{cRestSubReqFromXapp, 2}, |
| 8689 | Counter{cRestSubRespToXapp, 2}, |
| 8690 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8691 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8692 | Counter{cSubRespFromE2, 1}, |
| 8693 | Counter{cRestSubNotifToXapp, 1}, |
| 8694 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8695 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8696 | Counter{cSubDelReqToE2, 1}, |
| 8697 | Counter{cSubDelRespFromE2, 1}, |
| 8698 | Counter{cRestSubDelRespToXapp, 1}, |
| 8699 | }) |
| 8700 | |
| 8701 | const e2Timeout int64 = 1 |
| 8702 | const e2RetryCount int64 = 0 |
| 8703 | const routingNeeded bool = false |
| 8704 | |
| 8705 | // Req1 |
| 8706 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8707 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8708 | |
| 8709 | // Subs Create |
| 8710 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8711 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8712 | |
| 8713 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8714 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8715 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8716 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8717 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8718 | |
| 8719 | // Policy change |
| 8720 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8721 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8722 | params.SetSubscriptionID(&restSubId) |
| 8723 | params.SetTimeToWait("w200ms") |
| 8724 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8725 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8726 | |
| 8727 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8728 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8729 | // SubsResp is missing, e2SubsId will be 0 |
| 8730 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8731 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8732 | |
| 8733 | // Del |
| 8734 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8735 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8736 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8737 | |
| 8738 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8739 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8740 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8741 | } |
| 8742 | |
| 8743 | //----------------------------------------------------------------------------- |
| 8744 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8745 | // |
| 8746 | // stub stub |
| 8747 | // +-------+ +---------+ +---------+ |
| 8748 | // | xapp | | submgr | | e2term | |
| 8749 | // +-------+ +---------+ +---------+ |
| 8750 | // | | | |
| 8751 | // | RESTSubReq | | |
| 8752 | // |---------------->| | |
| 8753 | // | | | |
| 8754 | // | RESTSubResp | | |
| 8755 | // |<----------------| | |
| 8756 | // | | SubReq | |
| 8757 | // | |------------->| |
| 8758 | // | | | |
| 8759 | // | | SubResp | |
| 8760 | // | |<-------------| |
| 8761 | // | | | |
| 8762 | // | RESTNotif | | |
| 8763 | // |<----------------| | |
| 8764 | // | | | |
| 8765 | // | RESTSubReq | | |
| 8766 | // |---------------->| | |
| 8767 | // | | | |
| 8768 | // | RESTSubResp | | |
| 8769 | // |<----------------| | |
| 8770 | // | | SubReq | |
| 8771 | // | |------------->| |
| 8772 | // | | |
| 8773 | // | Submgr restart | |
| 8774 | // | | | |
| 8775 | // | RESTSubDelReq | | |
| 8776 | // |---------------->| | |
| 8777 | // | | | |
| 8778 | // | | SubDelReq | |
| 8779 | // | |------------->| |
| 8780 | // | | | |
| 8781 | // | | SubDelResp | |
| 8782 | // | |<-------------| |
| 8783 | // | | | |
| 8784 | // | RESTSubDelResp | | |
| 8785 | // |<----------------| | |
| 8786 | // |
| 8787 | //----------------------------------------------------------------------------- |
| 8788 | |
| 8789 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8790 | |
| 8791 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8792 | Counter{cRestSubReqFromXapp, 2}, |
| 8793 | Counter{cRestSubRespToXapp, 2}, |
| 8794 | Counter{cSubReqToE2, 2}, |
| 8795 | Counter{cSubRespFromE2, 1}, |
| 8796 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8797 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8798 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8799 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8800 | Counter{cRestSubDelRespToXapp, 1}, |
| 8801 | }) |
| 8802 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8803 | const e2Timeout int64 = 1 |
| 8804 | const e2RetryCount int64 = 0 |
| 8805 | const routingNeeded bool = false |
| 8806 | |
| 8807 | // Req1 |
| 8808 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8809 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8810 | // Create subscription |
| 8811 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8812 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8813 | |
| 8814 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8815 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8816 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8817 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8818 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8819 | |
| 8820 | // Check subscription |
| 8821 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8822 | |
| 8823 | // Policy change |
| 8824 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8825 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8826 | params.SetSubscriptionID(&restSubId) |
| 8827 | params.SetTimeToWait("w200ms") |
| 8828 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8829 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8830 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8831 | |
| 8832 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8833 | mainCtrl.SetResetTestFlag(t, false) |
| 8834 | |
| 8835 | // SubsResp is missing due to submgr restart |
| 8836 | |
| 8837 | mainCtrl.SimulateRestart(t) |
| 8838 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8839 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8840 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8841 | // That needs to be completed before successful subscription query is possible |
| 8842 | <-time.After(time.Second * 1) |
| 8843 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8844 | // Check subscription |
| 8845 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8846 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8847 | // Delete subscription |
| 8848 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8849 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8850 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8851 | |
| 8852 | //Wait that subs is cleaned |
| 8853 | waitSubsCleanup(t, e2SubsId, 10) |
| 8854 | |
| 8855 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8856 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8857 | } |
| 8858 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8859 | //////////////////////////////////////////////////////////////////////////////////// |
| 8860 | // Services for UT cases |
| 8861 | //////////////////////////////////////////////////////////////////////////////////// |
| 8862 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8863 | const host string = "localhost" |
| 8864 | |
| 8865 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8866 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8867 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8868 | } |
| 8869 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8870 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8871 | |
| 8872 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8873 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8874 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8875 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8876 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8877 | |
| 8878 | return restSubId, e2SubsId |
| 8879 | } |
| 8880 | |
| 8881 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8882 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8883 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8884 | if meid != "" { |
| 8885 | params.SetMeid(meid) |
| 8886 | } |
| 8887 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8888 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8889 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8890 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8891 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8892 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8893 | |
| 8894 | return restSubId, e2SubsId |
| 8895 | } |
| 8896 | |
| 8897 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8898 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8899 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8900 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8901 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8902 | |
| 8903 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8904 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8905 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8906 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8907 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8908 | |
| 8909 | return restSubId, e2SubsId |
| 8910 | } |
| 8911 | |
| 8912 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8913 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8914 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8915 | |
| 8916 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8917 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8918 | fparams1.Set(crereq1) |
| 8919 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8920 | |
| 8921 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8922 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8923 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8924 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8925 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8926 | |
| 8927 | return restSubId, e2SubsId |
| 8928 | } |
| 8929 | |
| 8930 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8931 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8932 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8933 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8934 | } |
| 8935 | |
| 8936 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8937 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8938 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8939 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8940 | } |
| 8941 | |
| 8942 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8943 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8944 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8945 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8946 | } |
| 8947 | |
| 8948 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8949 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8950 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8951 | assert.Equal(t, meid, resp[0].Meid) |
| 8952 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8953 | } |
| 8954 | |
| 8955 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8956 | //Wait that subs is cleaned |
| 8957 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8958 | |
| 8959 | xappConn1.TestMsgChanEmpty(t) |
| 8960 | xappConn2.TestMsgChanEmpty(t) |
| 8961 | e2termConn1.TestMsgChanEmpty(t) |
| 8962 | mainCtrl.wait_registry_empty(t, timeout) |
| 8963 | } |
| 8964 | |
| 8965 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8966 | |
| 8967 | var e2SubsId []uint32 |
| 8968 | |
| 8969 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8970 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8971 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8972 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8973 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8974 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8975 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8976 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8977 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8978 | <-time.After(100 * time.Millisecond) |
| 8979 | } |
| 8980 | return e2SubsId |
| 8981 | } |
| 8982 | |
| 8983 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8984 | |
| 8985 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8986 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8987 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8988 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8989 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8990 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8991 | <-time.After(100 * time.Millisecond) |
| 8992 | } |
| 8993 | |
| 8994 | // Wait that subs is cleaned |
| 8995 | for i := 0; i < len(e2SubsIds); i++ { |
| 8996 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8997 | } |
| 8998 | |
| 8999 | } |