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 | |
| 950 | mainCtrl.c.e2ap.SetE2IEOrderCheck(0) |
| 951 | |
| 952 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 953 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 954 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 955 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 956 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
| 957 | |
| 958 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 959 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 960 | |
| 961 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 962 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 963 | |
| 964 | //Wait that subs is cleaned |
| 965 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 966 | |
| 967 | xappConn1.TestMsgChanEmpty(t) |
| 968 | xappConn2.TestMsgChanEmpty(t) |
| 969 | e2termConn1.TestMsgChanEmpty(t) |
| 970 | mainCtrl.wait_registry_empty(t, 10) |
| 971 | |
| 972 | mainCtrl.VerifyCounterValues(t) |
| 973 | mainCtrl.c.e2ap.SetE2IEOrderCheck(1) |
| 974 | } |
| 975 | |
| 976 | //----------------------------------------------------------------------------- |
| 977 | |
| 978 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 979 | // TestSubReqRetransmission |
| 980 | // |
| 981 | // stub stub |
| 982 | // +-------+ +---------+ +---------+ |
| 983 | // | xapp | | submgr | | e2term | |
| 984 | // +-------+ +---------+ +---------+ |
| 985 | // | | | |
| 986 | // | SubReq | | |
| 987 | // |------------->| | |
| 988 | // | | | |
| 989 | // | | SubReq | |
| 990 | // | |------------->| |
| 991 | // | | | |
| 992 | // | SubReq | | |
| 993 | // | (retrans) | | |
| 994 | // |------------->| | |
| 995 | // | | | |
| 996 | // | | SubResp | |
| 997 | // | |<-------------| |
| 998 | // | | | |
| 999 | // | SubResp | | |
| 1000 | // |<-------------| | |
| 1001 | // | | | |
| 1002 | // | [SUBS DELETE] | |
| 1003 | // | | | |
| 1004 | // |
| 1005 | //----------------------------------------------------------------------------- |
| 1006 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1007 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1008 | |
| 1009 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1010 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1011 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1012 | |
| 1013 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1014 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1015 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1016 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1017 | // hack as there is no real way to see has message be handled. |
| 1018 | // Previuos counter check just tells that is has been received by submgr |
| 1019 | // --> artificial delay |
| 1020 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1021 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1022 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1023 | |
| 1024 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1025 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1026 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1027 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1028 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1029 | |
| 1030 | //Wait that subs is cleaned |
| 1031 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1032 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1033 | xappConn1.TestMsgChanEmpty(t) |
| 1034 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1035 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1036 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1037 | } |
| 1038 | |
| 1039 | //----------------------------------------------------------------------------- |
| 1040 | // TestSubDelReqRetransmission |
| 1041 | // |
| 1042 | // stub stub |
| 1043 | // +-------+ +---------+ +---------+ |
| 1044 | // | xapp | | submgr | | e2term | |
| 1045 | // +-------+ +---------+ +---------+ |
| 1046 | // | | | |
| 1047 | // | [SUBS CREATE] | |
| 1048 | // | | | |
| 1049 | // | | | |
| 1050 | // | SubDelReq | | |
| 1051 | // |------------->| | |
| 1052 | // | | | |
| 1053 | // | | SubDelReq | |
| 1054 | // | |------------->| |
| 1055 | // | | | |
| 1056 | // | SubDelReq | | |
| 1057 | // | (same sub) | | |
| 1058 | // | (same xid) | | |
| 1059 | // |------------->| | |
| 1060 | // | | | |
| 1061 | // | | SubDelResp | |
| 1062 | // | |<-------------| |
| 1063 | // | | | |
| 1064 | // | SubDelResp | | |
| 1065 | // |<-------------| | |
| 1066 | // |
| 1067 | //----------------------------------------------------------------------------- |
| 1068 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1069 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1070 | |
| 1071 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1072 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1073 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1074 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1075 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1076 | |
| 1077 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1078 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1079 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1080 | |
| 1081 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1082 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1083 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1084 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1085 | // hack as there is no real way to see has message be handled. |
| 1086 | // Previuos counter check just tells that is has been received by submgr |
| 1087 | // --> artificial delay |
| 1088 | <-time.After(1 * time.Second) |
| 1089 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1090 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1091 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1092 | |
| 1093 | //Wait that subs is cleaned |
| 1094 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1095 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1096 | xappConn1.TestMsgChanEmpty(t) |
| 1097 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1098 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1099 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1100 | } |
| 1101 | |
| 1102 | //----------------------------------------------------------------------------- |
| 1103 | // TestSubDelReqCollision |
| 1104 | // |
| 1105 | // stub stub |
| 1106 | // +-------+ +---------+ +---------+ |
| 1107 | // | xapp | | submgr | | e2term | |
| 1108 | // +-------+ +---------+ +---------+ |
| 1109 | // | | | |
| 1110 | // | [SUBS CREATE] | |
| 1111 | // | | | |
| 1112 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1113 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1114 | // |------------->| | |
| 1115 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1116 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1117 | // | |------------->| |
| 1118 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1119 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1120 | // | (same sub) | | |
| 1121 | // | (diff xid) | | |
| 1122 | // |------------->| | |
| 1123 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1124 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1125 | // | |<-------------| |
| 1126 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1127 | // | SubDelResp 1 | | |
| 1128 | // |<-------------| | |
| 1129 | // | | | |
| 1130 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1131 | // |<-------------| | |
| 1132 | // |
| 1133 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1134 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1135 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1137 | |
| 1138 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1139 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1140 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1141 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1142 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | |
| 1144 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1145 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1146 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1148 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1149 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1150 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1151 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1153 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1154 | // hack as there is no real way to see has message be handled. |
| 1155 | // Previuos counter check just tells that is has been received by submgr |
| 1156 | // --> artificial delay |
| 1157 | <-time.After(1 * time.Second) |
| 1158 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1159 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1160 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1161 | |
| 1162 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1163 | xappConn1.RecvSubsDelResp(t, nil) |
| 1164 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1165 | |
| 1166 | //Wait that subs is cleaned |
| 1167 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1168 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1169 | xappConn1.TestMsgChanEmpty(t) |
| 1170 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1171 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1172 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | //----------------------------------------------------------------------------- |
| 1176 | // TestSubReqAndSubDelOkTwoParallel |
| 1177 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1178 | // stub stub stub |
| 1179 | // +-------+ +-------+ +---------+ +---------+ |
| 1180 | // | xapp | | xapp | | submgr | | e2term | |
| 1181 | // +-------+ +-------+ +---------+ +---------+ |
| 1182 | // | | | | |
| 1183 | // | | | | |
| 1184 | // | | | | |
| 1185 | // | | SubReq1 | | |
| 1186 | // | |------------->| | |
| 1187 | // | | | | |
| 1188 | // | | | SubReq1 | |
| 1189 | // | | |------------->| |
| 1190 | // | | | | |
| 1191 | // | SubReq2 | | |
| 1192 | // |------------------------>| | |
| 1193 | // | | | | |
| 1194 | // | | | SubReq2 | |
| 1195 | // | | |------------->| |
| 1196 | // | | | | |
| 1197 | // | | | SubResp1 | |
| 1198 | // | | |<-------------| |
| 1199 | // | | SubResp1 | | |
| 1200 | // | |<-------------| | |
| 1201 | // | | | | |
| 1202 | // | | | SubResp2 | |
| 1203 | // | | |<-------------| |
| 1204 | // | SubResp2 | | |
| 1205 | // |<------------------------| | |
| 1206 | // | | | | |
| 1207 | // | | [SUBS 1 DELETE] | |
| 1208 | // | | | | |
| 1209 | // | | [SUBS 2 DELETE] | |
| 1210 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1211 | // |
| 1212 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1213 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1214 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1215 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1216 | |
| 1217 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1218 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1219 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1220 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1221 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1222 | |
| 1223 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1224 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1225 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1226 | |
| 1227 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1228 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1229 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1230 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1231 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1232 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1233 | |
| 1234 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1235 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1236 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1237 | |
| 1238 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1239 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1240 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1241 | |
| 1242 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1243 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1244 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1245 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1246 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1247 | //Wait that subs is cleaned |
| 1248 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1249 | |
| 1250 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1251 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1252 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1253 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1254 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1255 | //Wait that subs is cleaned |
| 1256 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1257 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1258 | xappConn1.TestMsgChanEmpty(t) |
| 1259 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1260 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1261 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1262 | } |
| 1263 | |
| 1264 | //----------------------------------------------------------------------------- |
| 1265 | // TestSameSubsDiffRan |
| 1266 | // Same subscription to different RANs |
| 1267 | // |
| 1268 | // stub stub |
| 1269 | // +-------+ +---------+ +---------+ |
| 1270 | // | xapp | | submgr | | e2term | |
| 1271 | // +-------+ +---------+ +---------+ |
| 1272 | // | | | |
| 1273 | // | | | |
| 1274 | // | | | |
| 1275 | // | SubReq(r1) | | |
| 1276 | // |------------->| | |
| 1277 | // | | | |
| 1278 | // | | SubReq(r1) | |
| 1279 | // | |------------->| |
| 1280 | // | | | |
| 1281 | // | | SubResp(r1) | |
| 1282 | // | |<-------------| |
| 1283 | // | | | |
| 1284 | // | SubResp(r1) | | |
| 1285 | // |<-------------| | |
| 1286 | // | | | |
| 1287 | // | SubReq(r2) | | |
| 1288 | // |------------->| | |
| 1289 | // | | | |
| 1290 | // | | SubReq(r2) | |
| 1291 | // | |------------->| |
| 1292 | // | | | |
| 1293 | // | | SubResp(r2) | |
| 1294 | // | |<-------------| |
| 1295 | // | | | |
| 1296 | // | SubResp(r2) | | |
| 1297 | // |<-------------| | |
| 1298 | // | | | |
| 1299 | // | [SUBS r1 DELETE] | |
| 1300 | // | | | |
| 1301 | // | [SUBS r2 DELETE] | |
| 1302 | // | | | |
| 1303 | // |
| 1304 | //----------------------------------------------------------------------------- |
| 1305 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1306 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1307 | |
| 1308 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1309 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1310 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1311 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1312 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1313 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1314 | |
| 1315 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1316 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1317 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1318 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1319 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1320 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1321 | |
| 1322 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1323 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1324 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1325 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1326 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1327 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1328 | //Wait that subs is cleaned |
| 1329 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1330 | |
| 1331 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1332 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1333 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1334 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1335 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1336 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1337 | //Wait that subs is cleaned |
| 1338 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1339 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1340 | xappConn1.TestMsgChanEmpty(t) |
| 1341 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1342 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1343 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1344 | } |
| 1345 | |
| 1346 | //----------------------------------------------------------------------------- |
| 1347 | // TestSubReqRetryInSubmgr |
| 1348 | // |
| 1349 | // stub stub |
| 1350 | // +-------+ +---------+ +---------+ |
| 1351 | // | xapp | | submgr | | e2term | |
| 1352 | // +-------+ +---------+ +---------+ |
| 1353 | // | | | |
| 1354 | // | SubReq | | |
| 1355 | // |------------->| | |
| 1356 | // | | | |
| 1357 | // | | SubReq | |
| 1358 | // | |------------->| |
| 1359 | // | | | |
| 1360 | // | | | |
| 1361 | // | | SubReq | |
| 1362 | // | |------------->| |
| 1363 | // | | | |
| 1364 | // | | SubResp | |
| 1365 | // | |<-------------| |
| 1366 | // | | | |
| 1367 | // | SubResp | | |
| 1368 | // |<-------------| | |
| 1369 | // | | | |
| 1370 | // | [SUBS DELETE] | |
| 1371 | // | | | |
| 1372 | // |
| 1373 | //----------------------------------------------------------------------------- |
| 1374 | |
| 1375 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1376 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1377 | |
| 1378 | // Init counter check |
| 1379 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1380 | Counter{cSubReqFromXapp, 1}, |
| 1381 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1382 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1383 | Counter{cSubReReqToE2, 1}, |
| 1384 | Counter{cSubRespFromE2, 1}, |
| 1385 | Counter{cSubRespToXapp, 1}, |
| 1386 | Counter{cSubDelReqFromXapp, 1}, |
| 1387 | Counter{cSubDelReqToE2, 1}, |
| 1388 | Counter{cSubDelRespFromE2, 1}, |
| 1389 | Counter{cSubDelRespToXapp, 1}, |
| 1390 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1391 | |
| 1392 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1393 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1394 | |
| 1395 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1396 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1397 | |
| 1398 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1399 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1400 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1401 | |
| 1402 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1403 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1404 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1405 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1406 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1407 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1408 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1409 | |
| 1410 | // Wait that subs is cleaned |
| 1411 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1412 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1413 | xappConn1.TestMsgChanEmpty(t) |
| 1414 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1415 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1416 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1417 | |
| 1418 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1419 | } |
| 1420 | |
| 1421 | //----------------------------------------------------------------------------- |
| 1422 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1423 | // |
| 1424 | // stub stub |
| 1425 | // +-------+ +---------+ +---------+ |
| 1426 | // | xapp | | submgr | | e2term | |
| 1427 | // +-------+ +---------+ +---------+ |
| 1428 | // | | | |
| 1429 | // | SubReq | | |
| 1430 | // |------------->| | |
| 1431 | // | | | |
| 1432 | // | | SubReq | |
| 1433 | // | |------------->| |
| 1434 | // | | | |
| 1435 | // | | | |
| 1436 | // | | SubReq | |
| 1437 | // | |------------->| |
| 1438 | // | | | |
| 1439 | // | | SubDelReq | |
| 1440 | // | |------------->| |
| 1441 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1442 | // | | SubDelResp | |
| 1443 | // | |<-------------| |
| 1444 | // | | | |
| 1445 | // |
| 1446 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1447 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1448 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1449 | |
| 1450 | // Init counter check |
| 1451 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1452 | Counter{cSubReqFromXapp, 1}, |
| 1453 | Counter{cSubReqToE2, 1}, |
| 1454 | Counter{cSubReReqToE2, 1}, |
| 1455 | Counter{cSubReqTimerExpiry, 2}, |
| 1456 | Counter{cSubDelReqToE2, 1}, |
| 1457 | Counter{cSubDelRespFromE2, 1}, |
| 1458 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1459 | |
| 1460 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1461 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1462 | |
| 1463 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1464 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1465 | |
| 1466 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1467 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1468 | |
| 1469 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1470 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1471 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1472 | |
| 1473 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1474 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1475 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1476 | xappConn1.TestMsgChanEmpty(t) |
| 1477 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1478 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1479 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1480 | |
| 1481 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1482 | } |
| 1483 | |
| 1484 | //----------------------------------------------------------------------------- |
| 1485 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1486 | // |
| 1487 | // stub stub |
| 1488 | // +-------+ +---------+ +---------+ |
| 1489 | // | xapp | | submgr | | e2term | |
| 1490 | // +-------+ +---------+ +---------+ |
| 1491 | // | | | |
| 1492 | // | SubReq | | |
| 1493 | // |------------->| | |
| 1494 | // | | | |
| 1495 | // | | SubReq | |
| 1496 | // | |------------->| |
| 1497 | // | | | |
| 1498 | // | | | |
| 1499 | // | | SubReq | |
| 1500 | // | |------------->| |
| 1501 | // | | | |
| 1502 | // | | SubDelReq | |
| 1503 | // | |------------->| |
| 1504 | // | | | |
| 1505 | // | | | |
| 1506 | // | | SubDelReq | |
| 1507 | // | |------------->| |
| 1508 | // | | | |
| 1509 | // | | | |
| 1510 | // |
| 1511 | //----------------------------------------------------------------------------- |
| 1512 | |
| 1513 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1514 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1515 | |
| 1516 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1517 | Counter{cSubReqFromXapp, 1}, |
| 1518 | Counter{cSubReqToE2, 1}, |
| 1519 | Counter{cSubReReqToE2, 1}, |
| 1520 | Counter{cSubReqTimerExpiry, 2}, |
| 1521 | Counter{cSubDelReqToE2, 1}, |
| 1522 | Counter{cSubDelReReqToE2, 1}, |
| 1523 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1524 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1525 | |
| 1526 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1527 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1528 | |
| 1529 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1530 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1531 | |
| 1532 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1533 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1534 | |
| 1535 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1536 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1537 | |
| 1538 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1539 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1540 | |
| 1541 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1542 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1543 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1544 | xappConn1.TestMsgChanEmpty(t) |
| 1545 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1546 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1547 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1548 | |
| 1549 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1550 | } |
| 1551 | |
| 1552 | //----------------------------------------------------------------------------- |
| 1553 | // TestSubReqSubFailRespInSubmgr |
| 1554 | // |
| 1555 | // stub stub |
| 1556 | // +-------+ +---------+ +---------+ |
| 1557 | // | xapp | | submgr | | e2term | |
| 1558 | // +-------+ +---------+ +---------+ |
| 1559 | // | | | |
| 1560 | // | SubReq | | |
| 1561 | // |------------->| | |
| 1562 | // | | | |
| 1563 | // | | SubReq | |
| 1564 | // | |------------->| |
| 1565 | // | | | |
| 1566 | // | | SubFail | |
| 1567 | // | |<-------------| |
| 1568 | // | | | |
| 1569 | // | SubFail | | |
| 1570 | // |<-------------| | |
| 1571 | // | | | |
| 1572 | // |
| 1573 | //----------------------------------------------------------------------------- |
| 1574 | |
| 1575 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1576 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1577 | |
| 1578 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1579 | Counter{cSubReqFromXapp, 1}, |
| 1580 | Counter{cSubReqToE2, 1}, |
| 1581 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1582 | Counter{cSubFailToXapp, 1}, |
| 1583 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1584 | |
| 1585 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1586 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1587 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1588 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1589 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1590 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1591 | fparams1.Set(crereq1) |
| 1592 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1593 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1594 | // Xapp: Receive SubsFail |
| 1595 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1596 | |
| 1597 | // Wait that subs is cleaned |
| 1598 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1599 | |
| 1600 | xappConn1.TestMsgChanEmpty(t) |
| 1601 | xappConn2.TestMsgChanEmpty(t) |
| 1602 | e2termConn1.TestMsgChanEmpty(t) |
| 1603 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1604 | |
| 1605 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1606 | } |
| 1607 | |
| 1608 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1609 | // TestSubDelReqRetryInSubmgr |
| 1610 | // |
| 1611 | // stub stub |
| 1612 | // +-------+ +---------+ +---------+ |
| 1613 | // | xapp | | submgr | | e2term | |
| 1614 | // +-------+ +---------+ +---------+ |
| 1615 | // | | | |
| 1616 | // | [SUBS CREATE] | |
| 1617 | // | | | |
| 1618 | // | | | |
| 1619 | // | SubDelReq | | |
| 1620 | // |------------->| | |
| 1621 | // | | | |
| 1622 | // | | SubDelReq | |
| 1623 | // | |------------->| |
| 1624 | // | | | |
| 1625 | // | | SubDelReq | |
| 1626 | // | |------------->| |
| 1627 | // | | | |
| 1628 | // | | SubDelResp | |
| 1629 | // | |<-------------| |
| 1630 | // | | | |
| 1631 | // | SubDelResp | | |
| 1632 | // |<-------------| | |
| 1633 | // |
| 1634 | //----------------------------------------------------------------------------- |
| 1635 | |
| 1636 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1637 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1638 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1639 | |
| 1640 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1641 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1642 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1643 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1644 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1645 | |
| 1646 | // Subs Delete |
| 1647 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1648 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1649 | |
| 1650 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1651 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1652 | |
| 1653 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1654 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1655 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1656 | |
| 1657 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1658 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1659 | |
| 1660 | // Wait that subs is cleaned |
| 1661 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1662 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1663 | xappConn1.TestMsgChanEmpty(t) |
| 1664 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1665 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1666 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1667 | } |
| 1668 | |
| 1669 | //----------------------------------------------------------------------------- |
| 1670 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1671 | // |
| 1672 | // stub stub |
| 1673 | // +-------+ +---------+ +---------+ |
| 1674 | // | xapp | | submgr | | e2term | |
| 1675 | // +-------+ +---------+ +---------+ |
| 1676 | // | | | |
| 1677 | // | [SUBS CREATE] | |
| 1678 | // | | | |
| 1679 | // | | | |
| 1680 | // | SubDelReq | | |
| 1681 | // |------------->| | |
| 1682 | // | | | |
| 1683 | // | | SubDelReq | |
| 1684 | // | |------------->| |
| 1685 | // | | | |
| 1686 | // | | SubDelReq | |
| 1687 | // | |------------->| |
| 1688 | // | | | |
| 1689 | // | | | |
| 1690 | // | SubDelResp | | |
| 1691 | // |<-------------| | |
| 1692 | // |
| 1693 | //----------------------------------------------------------------------------- |
| 1694 | |
| 1695 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1696 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1697 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1698 | |
| 1699 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1700 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1701 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1702 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1703 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1704 | |
| 1705 | // Subs Delete |
| 1706 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1707 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1708 | |
| 1709 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1710 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1711 | |
| 1712 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1713 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1714 | |
| 1715 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1716 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1717 | |
| 1718 | // Wait that subs is cleaned |
| 1719 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1720 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1721 | xappConn1.TestMsgChanEmpty(t) |
| 1722 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1723 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1724 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1725 | } |
| 1726 | |
| 1727 | //----------------------------------------------------------------------------- |
| 1728 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1729 | // |
| 1730 | // stub stub |
| 1731 | // +-------+ +---------+ +---------+ |
| 1732 | // | xapp | | submgr | | e2term | |
| 1733 | // +-------+ +---------+ +---------+ |
| 1734 | // | | | |
| 1735 | // | [SUBS CREATE] | |
| 1736 | // | | | |
| 1737 | // | | | |
| 1738 | // | SubDelReq | | |
| 1739 | // |------------->| | |
| 1740 | // | | | |
| 1741 | // | | SubDelReq | |
| 1742 | // | |------------->| |
| 1743 | // | | | |
| 1744 | // | | SubDelFail | |
| 1745 | // | |<-------------| |
| 1746 | // | | | |
| 1747 | // | SubDelResp | | |
| 1748 | // |<-------------| | |
| 1749 | // | | | |
| 1750 | // |
| 1751 | //----------------------------------------------------------------------------- |
| 1752 | |
| 1753 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1754 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1755 | |
| 1756 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1757 | Counter{cSubReqFromXapp, 1}, |
| 1758 | Counter{cSubReqToE2, 1}, |
| 1759 | Counter{cSubRespFromE2, 1}, |
| 1760 | Counter{cSubRespToXapp, 1}, |
| 1761 | Counter{cSubDelReqFromXapp, 1}, |
| 1762 | Counter{cSubDelReqToE2, 1}, |
| 1763 | Counter{cSubDelFailFromE2, 1}, |
| 1764 | Counter{cSubDelRespToXapp, 1}, |
| 1765 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1766 | |
| 1767 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1769 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1770 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1771 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1772 | |
| 1773 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1774 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1775 | |
| 1776 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1777 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1778 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1779 | |
| 1780 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1781 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1782 | |
| 1783 | // Wait that subs is cleaned |
| 1784 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1785 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1786 | xappConn1.TestMsgChanEmpty(t) |
| 1787 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1788 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1789 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1790 | |
| 1791 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1792 | } |
| 1793 | |
| 1794 | //----------------------------------------------------------------------------- |
| 1795 | // TestSubReqAndSubDelOkSameAction |
| 1796 | // |
| 1797 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1798 | // +-------+ +-------+ +---------+ +---------+ |
| 1799 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1800 | // +-------+ +-------+ +---------+ +---------+ |
| 1801 | // | | | | |
| 1802 | // | | | | |
| 1803 | // | | | | |
| 1804 | // | | SubReq1 | | |
| 1805 | // | |------------->| | |
| 1806 | // | | | | |
| 1807 | // | | | SubReq1 | |
| 1808 | // | | |------------->| |
| 1809 | // | | | SubResp1 | |
| 1810 | // | | |<-------------| |
| 1811 | // | | SubResp1 | | |
| 1812 | // | |<-------------| | |
| 1813 | // | | | | |
| 1814 | // | SubReq2 | | |
| 1815 | // |--------------------------->| | |
| 1816 | // | | | | |
| 1817 | // | SubResp2 | | |
| 1818 | // |<---------------------------| | |
| 1819 | // | | | | |
| 1820 | // | | SubDelReq 1 | | |
| 1821 | // | |------------->| | |
| 1822 | // | | | | |
| 1823 | // | | SubDelResp 1 | | |
| 1824 | // | |<-------------| | |
| 1825 | // | | | | |
| 1826 | // | SubDelReq 2 | | |
| 1827 | // |--------------------------->| | |
| 1828 | // | | | | |
| 1829 | // | | | SubDelReq 2 | |
| 1830 | // | | |------------->| |
| 1831 | // | | | | |
| 1832 | // | | | SubDelReq 2 | |
| 1833 | // | | |------------->| |
| 1834 | // | | | | |
| 1835 | // | SubDelResp 2 | | |
| 1836 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1837 | // |
| 1838 | //----------------------------------------------------------------------------- |
| 1839 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1840 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1841 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1842 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1843 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1844 | Counter{cSubReqFromXapp, 2}, |
| 1845 | Counter{cSubReqToE2, 1}, |
| 1846 | Counter{cSubRespFromE2, 1}, |
| 1847 | Counter{cSubRespToXapp, 2}, |
| 1848 | Counter{cMergedSubscriptions, 1}, |
| 1849 | Counter{cUnmergedSubscriptions, 1}, |
| 1850 | Counter{cSubDelReqFromXapp, 2}, |
| 1851 | Counter{cSubDelReqToE2, 1}, |
| 1852 | Counter{cSubDelRespFromE2, 1}, |
| 1853 | Counter{cSubDelRespToXapp, 2}, |
| 1854 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1855 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1856 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1857 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1858 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1859 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1860 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1861 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1862 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1863 | |
| 1864 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1865 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1866 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1867 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1868 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1869 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1870 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1871 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1872 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1873 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1874 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1875 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1876 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1877 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1878 | |
| 1879 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1880 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1881 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1882 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1883 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1884 | //Wait that subs is cleaned |
| 1885 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1886 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1887 | xappConn1.TestMsgChanEmpty(t) |
| 1888 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1889 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1890 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1891 | |
| 1892 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1893 | } |
| 1894 | |
| 1895 | //----------------------------------------------------------------------------- |
| 1896 | // TestSubReqAndSubDelOkSameActionParallel |
| 1897 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1898 | // stub stub stub |
| 1899 | // +-------+ +-------+ +---------+ +---------+ |
| 1900 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1901 | // +-------+ +-------+ +---------+ +---------+ |
| 1902 | // | | | | |
| 1903 | // | | | | |
| 1904 | // | | | | |
| 1905 | // | | SubReq1 | | |
| 1906 | // | |------------->| | |
| 1907 | // | | | | |
| 1908 | // | | | SubReq1 | |
| 1909 | // | | |------------->| |
| 1910 | // | SubReq2 | | |
| 1911 | // |--------------------------->| | |
| 1912 | // | | | SubResp1 | |
| 1913 | // | | |<-------------| |
| 1914 | // | | SubResp1 | | |
| 1915 | // | |<-------------| | |
| 1916 | // | | | | |
| 1917 | // | SubResp2 | | |
| 1918 | // |<---------------------------| | |
| 1919 | // | | | | |
| 1920 | // | | SubDelReq 1 | | |
| 1921 | // | |------------->| | |
| 1922 | // | | | | |
| 1923 | // | | SubDelResp 1 | | |
| 1924 | // | |<-------------| | |
| 1925 | // | | | | |
| 1926 | // | SubDelReq 2 | | |
| 1927 | // |--------------------------->| | |
| 1928 | // | | | | |
| 1929 | // | | | SubDelReq 2 | |
| 1930 | // | | |------------->| |
| 1931 | // | | | | |
| 1932 | // | | | SubDelReq 2 | |
| 1933 | // | | |------------->| |
| 1934 | // | | | | |
| 1935 | // | SubDelResp 2 | | |
| 1936 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1937 | // |
| 1938 | //----------------------------------------------------------------------------- |
| 1939 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1940 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1941 | |
| 1942 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1943 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1944 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1945 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1946 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1947 | |
| 1948 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1949 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1950 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1951 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1952 | |
| 1953 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1954 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1955 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1956 | |
| 1957 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1958 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1959 | |
| 1960 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1961 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1962 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1963 | |
| 1964 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1965 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1966 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1967 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1968 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1969 | |
| 1970 | //Wait that subs is cleaned |
| 1971 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1972 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1973 | xappConn1.TestMsgChanEmpty(t) |
| 1974 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1975 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1976 | mainCtrl.wait_registry_empty(t, 10) |
| 1977 | } |
| 1978 | |
| 1979 | //----------------------------------------------------------------------------- |
| 1980 | // TestSubReqAndSubDelNokSameActionParallel |
| 1981 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1982 | // stub stub stub |
| 1983 | // +-------+ +-------+ +---------+ +---------+ |
| 1984 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1985 | // +-------+ +-------+ +---------+ +---------+ |
| 1986 | // | | | | |
| 1987 | // | | | | |
| 1988 | // | | | | |
| 1989 | // | | SubReq1 | | |
| 1990 | // | |------------->| | |
| 1991 | // | | | | |
| 1992 | // | | | SubReq1 | |
| 1993 | // | | |------------->| |
| 1994 | // | SubReq2 | | |
| 1995 | // |--------------------------->| | |
| 1996 | // | | | SubFail1 | |
| 1997 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1998 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1999 | // | | SubFail1 | | |
| 2000 | // | |<-------------| | |
| 2001 | // | | | | |
| 2002 | // | SubFail2 | | |
| 2003 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2004 | // |
| 2005 | //----------------------------------------------------------------------------- |
| 2006 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2007 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2008 | |
| 2009 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2010 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2011 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2012 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2013 | |
| 2014 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2015 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2016 | |
| 2017 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2018 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2019 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2020 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2021 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2022 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2023 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 2024 | // E2t: send SubsFail (first) |
| 2025 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 2026 | fparams1.Set(crereq1) |
| 2027 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 2028 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2029 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2030 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2031 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2032 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2033 | |
| 2034 | //Wait that subs is cleaned |
| 2035 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 2036 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2037 | xappConn1.TestMsgChanEmpty(t) |
| 2038 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2039 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2040 | mainCtrl.wait_registry_empty(t, 10) |
| 2041 | } |
| 2042 | |
| 2043 | //----------------------------------------------------------------------------- |
| 2044 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 2045 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2046 | // stub stub stub |
| 2047 | // +-------+ +-------+ +---------+ +---------+ |
| 2048 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2049 | // +-------+ +-------+ +---------+ +---------+ |
| 2050 | // | | | | |
| 2051 | // | | | | |
| 2052 | // | | | | |
| 2053 | // | | SubReq1 | | |
| 2054 | // | |------------->| | |
| 2055 | // | | | | |
| 2056 | // | | | SubReq1 | |
| 2057 | // | | |------------->| |
| 2058 | // | | SubReq2 | | |
| 2059 | // |--------------------------->| | |
| 2060 | // | | | | |
| 2061 | // | | | SubReq1 | |
| 2062 | // | | |------------->| |
| 2063 | // | | | | |
| 2064 | // | | | | |
| 2065 | // | | | SubDelReq | |
| 2066 | // | | |------------->| |
| 2067 | // | | | | |
| 2068 | // | | | SubDelResp | |
| 2069 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2070 | // |
| 2071 | //----------------------------------------------------------------------------- |
| 2072 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2073 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2074 | |
| 2075 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2076 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2077 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2078 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2079 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2080 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2081 | |
| 2082 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2083 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2084 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2085 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2086 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 2087 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2088 | |
| 2089 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2090 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2091 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2092 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2093 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2094 | |
| 2095 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2096 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 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, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2102 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2103 | |
| 2104 | //----------------------------- Policy cases --------------------------------- |
| 2105 | //----------------------------------------------------------------------------- |
| 2106 | // TestSubReqPolicyAndSubDelOk |
| 2107 | // |
| 2108 | // stub stub |
| 2109 | // +-------+ +---------+ +---------+ |
| 2110 | // | xapp | | submgr | | e2term | |
| 2111 | // +-------+ +---------+ +---------+ |
| 2112 | // | | | |
| 2113 | // | SubReq | | |
| 2114 | // |------------->| | |
| 2115 | // | | | |
| 2116 | // | | SubReq | |
| 2117 | // | |------------->| |
| 2118 | // | | | |
| 2119 | // | | SubResp | |
| 2120 | // | |<-------------| |
| 2121 | // | | | |
| 2122 | // | SubResp | | |
| 2123 | // |<-------------| | |
| 2124 | // | | | |
| 2125 | // | | | |
| 2126 | // | SubDelReq | | |
| 2127 | // |------------->| | |
| 2128 | // | | | |
| 2129 | // | | SubDelReq | |
| 2130 | // | |------------->| |
| 2131 | // | | | |
| 2132 | // | | SubDelResp | |
| 2133 | // | |<-------------| |
| 2134 | // | | | |
| 2135 | // | SubDelResp | | |
| 2136 | // |<-------------| | |
| 2137 | // |
| 2138 | //----------------------------------------------------------------------------- |
| 2139 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2140 | CaseBegin("TestSubReqAndSubDelOk") |
| 2141 | |
| 2142 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2143 | rparams1.Init() |
| 2144 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2145 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2146 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2147 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2148 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2149 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2150 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2151 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2152 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2153 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2154 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2155 | |
| 2156 | //Wait that subs is cleaned |
| 2157 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2158 | |
| 2159 | xappConn1.TestMsgChanEmpty(t) |
| 2160 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2161 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2162 | mainCtrl.wait_registry_empty(t, 10) |
| 2163 | } |
| 2164 | |
| 2165 | //----------------------------------------------------------------------------- |
| 2166 | // TestSubReqPolicyChangeAndSubDelOk |
| 2167 | // |
| 2168 | // stub stub |
| 2169 | // +-------+ +---------+ +---------+ |
| 2170 | // | xapp | | submgr | | e2term | |
| 2171 | // +-------+ +---------+ +---------+ |
| 2172 | // | | | |
| 2173 | // | SubReq | | |
| 2174 | // |------------->| | |
| 2175 | // | | | |
| 2176 | // | | SubReq | |
| 2177 | // | |------------->| |
| 2178 | // | | | |
| 2179 | // | | SubResp | |
| 2180 | // | |<-------------| |
| 2181 | // | | | |
| 2182 | // | SubResp | | |
| 2183 | // |<-------------| | |
| 2184 | // | | | |
| 2185 | // | SubReq | | |
| 2186 | // |------------->| | |
| 2187 | // | | | |
| 2188 | // | | SubReq | |
| 2189 | // | |------------->| |
| 2190 | // | | | |
| 2191 | // | | SubResp | |
| 2192 | // | |<-------------| |
| 2193 | // | | | |
| 2194 | // | SubResp | | |
| 2195 | // |<-------------| | |
| 2196 | // | | | |
| 2197 | // | SubDelReq | | |
| 2198 | // |------------->| | |
| 2199 | // | | | |
| 2200 | // | | SubDelReq | |
| 2201 | // | |------------->| |
| 2202 | // | | | |
| 2203 | // | | SubDelResp | |
| 2204 | // | |<-------------| |
| 2205 | // | | | |
| 2206 | // | SubDelResp | | |
| 2207 | // |<-------------| | |
| 2208 | // |
| 2209 | //----------------------------------------------------------------------------- |
| 2210 | |
| 2211 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2212 | CaseBegin("TestSubReqAndSubDelOk") |
| 2213 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2214 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2215 | rparams1.Init() |
| 2216 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2217 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2218 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2219 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2220 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2221 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2222 | |
| 2223 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2224 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2225 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2226 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2227 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2228 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2229 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2230 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2231 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2232 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2233 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2234 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2235 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2236 | |
| 2237 | //Wait that subs is cleaned |
| 2238 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2239 | |
| 2240 | xappConn1.TestMsgChanEmpty(t) |
| 2241 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2242 | e2termConn1.TestMsgChanEmpty(t) |
| 2243 | mainCtrl.wait_registry_empty(t, 10) |
| 2244 | } |
| 2245 | |
| 2246 | //----------------------------------------------------------------------------- |
| 2247 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2248 | // |
| 2249 | // stub stub stub |
| 2250 | // +-------+ +---------+ +---------+ +---------+ |
| 2251 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2252 | // +-------+ +---------+ +---------+ +---------+ |
| 2253 | // | | | | |
| 2254 | // | | | | |
| 2255 | // | | | | |
| 2256 | // | SubReq1 | | | |
| 2257 | // |------------->| | | |
| 2258 | // | | | | |
| 2259 | // | | SubReq1 | | |
| 2260 | // | |------------->| | |
| 2261 | // | | | | |
| 2262 | // | SubReq2 | | | |
| 2263 | // |------------->| | | |
| 2264 | // | | | | |
| 2265 | // | | SubReq2 | | |
| 2266 | // | |---------------------------->| |
| 2267 | // | | | | |
| 2268 | // | | SubResp1 | | |
| 2269 | // | |<-------------| | |
| 2270 | // | SubResp1 | | | |
| 2271 | // |<-------------| | | |
| 2272 | // | | SubResp2 | | |
| 2273 | // | |<----------------------------| |
| 2274 | // | SubResp2 | | | |
| 2275 | // |<-------------| | | |
| 2276 | // | | | | |
| 2277 | // | [SUBS 1 DELETE] | | |
| 2278 | // | | | | |
| 2279 | // | [SUBS 2 DELETE] | | |
| 2280 | // | | | | |
| 2281 | // |
| 2282 | //----------------------------------------------------------------------------- |
| 2283 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2284 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2285 | |
| 2286 | //Req1 |
| 2287 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2288 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2289 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2290 | |
| 2291 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2292 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2293 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2294 | |
| 2295 | //Resp1 |
| 2296 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2297 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2298 | |
| 2299 | //Resp2 |
| 2300 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2301 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2302 | |
| 2303 | //Del1 |
| 2304 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2305 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2306 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2307 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2308 | //Wait that subs is cleaned |
| 2309 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2310 | |
| 2311 | //Del2 |
| 2312 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2313 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2314 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2315 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2316 | //Wait that subs is cleaned |
| 2317 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2318 | |
| 2319 | xappConn1.TestMsgChanEmpty(t) |
| 2320 | xappConn2.TestMsgChanEmpty(t) |
| 2321 | e2termConn1.TestMsgChanEmpty(t) |
| 2322 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2323 | mainCtrl.wait_registry_empty(t, 10) |
| 2324 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2325 | |
| 2326 | //----------------------------------------------------------------------------- |
| 2327 | // TestSubReqInsertAndSubDelOk |
| 2328 | // |
| 2329 | // stub stub |
| 2330 | // +-------+ +---------+ +---------+ |
| 2331 | // | xapp | | submgr | | e2term | |
| 2332 | // +-------+ +---------+ +---------+ |
| 2333 | // | | | |
| 2334 | // | SubReq | | |
| 2335 | // |------------->| | |
| 2336 | // | | | |
| 2337 | // | | SubReq | |
| 2338 | // | |------------->| |
| 2339 | // | | | |
| 2340 | // | | SubResp | |
| 2341 | // | |<-------------| |
| 2342 | // | | | |
| 2343 | // | SubResp | | |
| 2344 | // |<-------------| | |
| 2345 | // | | | |
| 2346 | // | | | |
| 2347 | // | SubDelReq | | |
| 2348 | // |------------->| | |
| 2349 | // | | | |
| 2350 | // | | SubDelReq | |
| 2351 | // | |------------->| |
| 2352 | // | | | |
| 2353 | // | | SubDelResp | |
| 2354 | // | |<-------------| |
| 2355 | // | | | |
| 2356 | // | SubDelResp | | |
| 2357 | // |<-------------| | |
| 2358 | // |
| 2359 | //----------------------------------------------------------------------------- |
| 2360 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2361 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2362 | |
| 2363 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2364 | rparams1.Init() |
| 2365 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2366 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2367 | |
| 2368 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2369 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2370 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2371 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2372 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2373 | |
| 2374 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2375 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2376 | |
| 2377 | //Wait that subs is cleaned |
| 2378 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2379 | |
| 2380 | xappConn1.TestMsgChanEmpty(t) |
| 2381 | xappConn2.TestMsgChanEmpty(t) |
| 2382 | e2termConn1.TestMsgChanEmpty(t) |
| 2383 | mainCtrl.wait_registry_empty(t, 10) |
| 2384 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2385 | |
| 2386 | //----------------------------------------------------------------------------- |
| 2387 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2388 | // |
| 2389 | // This case simulates case where xApp restarts and starts sending same |
| 2390 | // subscription requests which have already subscribed successfully |
| 2391 | |
| 2392 | // stub stub |
| 2393 | // +-------+ +---------+ +---------+ |
| 2394 | // | xapp | | submgr | | e2term | |
| 2395 | // +-------+ +---------+ +---------+ |
| 2396 | // | | | |
| 2397 | // | SubReq | | |
| 2398 | // |------------->| | |
| 2399 | // | | | |
| 2400 | // | | SubReq | |
| 2401 | // | |------------->| |
| 2402 | // | | | |
| 2403 | // | | SubResp | |
| 2404 | // | |<-------------| |
| 2405 | // | | | |
| 2406 | // | SubResp | | |
| 2407 | // |<-------------| | |
| 2408 | // | | | |
| 2409 | // | xApp restart | | |
| 2410 | // | | | |
| 2411 | // | SubReq | | |
| 2412 | // | (retrans with same xApp generated subid but diff xid) |
| 2413 | // |------------->| | |
| 2414 | // | | | |
| 2415 | // | SubResp | | |
| 2416 | // |<-------------| | |
| 2417 | // | | | |
| 2418 | // | [SUBS DELETE] | |
| 2419 | // | | | |
| 2420 | // |
| 2421 | //----------------------------------------------------------------------------- |
| 2422 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2423 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2424 | |
| 2425 | //Subs Create |
| 2426 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2427 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2428 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2429 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2430 | |
| 2431 | // xApp restart here |
| 2432 | // --> artificial delay |
| 2433 | <-time.After(1 * time.Second) |
| 2434 | |
| 2435 | //Subs Create |
| 2436 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2437 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2438 | |
| 2439 | //Subs Delete |
| 2440 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2441 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2442 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2443 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2444 | |
| 2445 | //Wait that subs is cleaned |
| 2446 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2447 | |
| 2448 | xappConn1.TestMsgChanEmpty(t) |
| 2449 | xappConn2.TestMsgChanEmpty(t) |
| 2450 | e2termConn1.TestMsgChanEmpty(t) |
| 2451 | mainCtrl.wait_registry_empty(t, 10) |
| 2452 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2453 | |
| 2454 | //----------------------------------------------------------------------------- |
| 2455 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2456 | // |
| 2457 | // stub stub |
| 2458 | // +-------+ +---------+ +---------+ |
| 2459 | // | xapp | | submgr | | e2term | |
| 2460 | // +-------+ +---------+ +---------+ |
| 2461 | // | | | |
| 2462 | // | SubReq | | |
| 2463 | // |------------->| | |
| 2464 | // | | | |
| 2465 | // | | SubReq | |
| 2466 | // | |------------->| |
| 2467 | // | | | |
| 2468 | // | | SubResp | |
| 2469 | // | <----| |
| 2470 | // | | |
| 2471 | // | Submgr restart | |
| 2472 | // | | |
| 2473 | // | | | |
| 2474 | // | | SubDelReq | |
| 2475 | // | |------------->| |
| 2476 | // | | | |
| 2477 | // | | SubDelResp | |
| 2478 | // | |<-------------| |
| 2479 | // | | | |
| 2480 | // |
| 2481 | //----------------------------------------------------------------------------- |
| 2482 | |
| 2483 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2484 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2485 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2486 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2487 | xappConn1.SendSubsReq(t, nil, nil) |
| 2488 | e2termConn1.RecvSubsReq(t) |
| 2489 | mainCtrl.SetResetTestFlag(t, false) |
| 2490 | |
| 2491 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2492 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2493 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2494 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2495 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2496 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2497 | mainCtrl.SimulateRestart(t) |
| 2498 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2499 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2500 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2501 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2502 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2503 | |
| 2504 | // Wait that subs is cleaned |
| 2505 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2506 | |
| 2507 | xappConn1.TestMsgChanEmpty(t) |
| 2508 | xappConn2.TestMsgChanEmpty(t) |
| 2509 | e2termConn1.TestMsgChanEmpty(t) |
| 2510 | mainCtrl.wait_registry_empty(t, 10) |
| 2511 | } |
| 2512 | |
| 2513 | //----------------------------------------------------------------------------- |
| 2514 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2515 | // |
| 2516 | // stub stub |
| 2517 | // +-------+ +---------+ +---------+ |
| 2518 | // | xapp | | submgr | | e2term | |
| 2519 | // +-------+ +---------+ +---------+ |
| 2520 | // | | | |
| 2521 | // | SubReq | | |
| 2522 | // |------------->| | |
| 2523 | // | | | |
| 2524 | // | | SubReq | |
| 2525 | // | |------------->| |
| 2526 | // | | | |
| 2527 | // | | SubResp | |
| 2528 | // | |<-------------| |
| 2529 | // | | | |
| 2530 | // | SubResp | | |
| 2531 | // |<-------------| | |
| 2532 | // | | | |
| 2533 | // | | |
| 2534 | // | Submgr restart | |
| 2535 | // | | |
| 2536 | // | SubDelReq | | |
| 2537 | // |------------->| | |
| 2538 | // | | | |
| 2539 | // | | SubDelReq | |
| 2540 | // | |------------->| |
| 2541 | // | | | |
| 2542 | // | | SubDelResp | |
| 2543 | // | |<-------------| |
| 2544 | // | | | |
| 2545 | // | SubDelResp | | |
| 2546 | // |<-------------| | |
| 2547 | // |
| 2548 | //----------------------------------------------------------------------------- |
| 2549 | |
| 2550 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2551 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2552 | |
| 2553 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2554 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2555 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2556 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2557 | |
| 2558 | // Check subscription |
| 2559 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2560 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2561 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2562 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2563 | |
| 2564 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2565 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2566 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2567 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2568 | // That needs to be completed before successful subscription query is possible |
| 2569 | <-time.After(time.Second * 1) |
| 2570 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2571 | // Check that subscription is restored correctly after restart |
| 2572 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2573 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2574 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2575 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2576 | |
| 2577 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2578 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2579 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2580 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2581 | |
| 2582 | //Wait that subs is cleaned |
| 2583 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2584 | |
| 2585 | xappConn1.TestMsgChanEmpty(t) |
| 2586 | xappConn2.TestMsgChanEmpty(t) |
| 2587 | e2termConn1.TestMsgChanEmpty(t) |
| 2588 | mainCtrl.wait_registry_empty(t, 10) |
| 2589 | } |
| 2590 | |
| 2591 | //----------------------------------------------------------------------------- |
| 2592 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2593 | // |
| 2594 | // stub stub |
| 2595 | // +-------+ +-------+ +---------+ +---------+ |
| 2596 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2597 | // +-------+ +-------+ +---------+ +---------+ |
| 2598 | // | | | | |
| 2599 | // | | | | |
| 2600 | // | | | | |
| 2601 | // | | SubReq1 | | |
| 2602 | // | |------------->| | |
| 2603 | // | | | | |
| 2604 | // | | | SubReq1 | |
| 2605 | // | | |------------->| |
| 2606 | // | | | SubResp1 | |
| 2607 | // | | |<-------------| |
| 2608 | // | | SubResp1 | | |
| 2609 | // | |<-------------| | |
| 2610 | // | | | | |
| 2611 | // | | |
| 2612 | // | submgr restart | |
| 2613 | // | | |
| 2614 | // | | | | |
| 2615 | // | | | | |
| 2616 | // | SubReq2 | | |
| 2617 | // |--------------------------->| | |
| 2618 | // | | | | |
| 2619 | // | SubResp2 | | |
| 2620 | // |<---------------------------| | |
| 2621 | // | | | | |
| 2622 | // | | SubDelReq 1 | | |
| 2623 | // | |------------->| | |
| 2624 | // | | | | |
| 2625 | // | | SubDelResp 1 | | |
| 2626 | // | |<-------------| | |
| 2627 | // | | | | |
| 2628 | // | | | | |
| 2629 | // | | |
| 2630 | // | submgr restart | |
| 2631 | // | | |
| 2632 | // | | | | |
| 2633 | // | SubDelReq 2 | | |
| 2634 | // |--------------------------->| | |
| 2635 | // | | | | |
| 2636 | // | | | SubDelReq 2 | |
| 2637 | // | | |------------->| |
| 2638 | // | | | | |
| 2639 | // | | | SubDelReq 2 | |
| 2640 | // | | |------------->| |
| 2641 | // | | | | |
| 2642 | // | SubDelResp 2 | | |
| 2643 | // |<---------------------------| | |
| 2644 | // |
| 2645 | //----------------------------------------------------------------------------- |
| 2646 | |
| 2647 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2648 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2649 | |
| 2650 | //Req1 |
| 2651 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2652 | rparams1.Init() |
| 2653 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2654 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2655 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2656 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2657 | |
| 2658 | //Req2 |
| 2659 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2660 | rparams2.Init() |
| 2661 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2662 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2663 | |
| 2664 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2665 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2666 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2667 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2668 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2669 | |
| 2670 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2671 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2672 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2673 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2674 | // That needs to be completed before successful subscription query is possible |
| 2675 | <-time.After(time.Second * 1) |
| 2676 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2677 | // Check that subscription is restored correctly after restart |
| 2678 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2679 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2680 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2681 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2682 | |
| 2683 | //Del1 |
| 2684 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2685 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2686 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2687 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2688 | |
| 2689 | mainCtrl.SimulateRestart(t) |
| 2690 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 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 | // Submgr need be ready before successful subscription deletion is possible |
| 2694 | <-time.After(time.Second * 1) |
| 2695 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2696 | //Del2 |
| 2697 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2698 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2699 | |
| 2700 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2701 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2702 | |
| 2703 | //Wait that subs is cleaned |
| 2704 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2705 | |
| 2706 | xappConn1.TestMsgChanEmpty(t) |
| 2707 | xappConn2.TestMsgChanEmpty(t) |
| 2708 | e2termConn1.TestMsgChanEmpty(t) |
| 2709 | mainCtrl.wait_registry_empty(t, 10) |
| 2710 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2711 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2712 | //***************************************************************************** |
| 2713 | // REST interface test cases |
| 2714 | //***************************************************************************** |
| 2715 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2716 | //----------------------------------------------------------------------------- |
| 2717 | // Test debug GET and POST requests |
| 2718 | // |
| 2719 | // curl |
| 2720 | // +-------+ +---------+ |
| 2721 | // | user | | submgr | |
| 2722 | // +-------+ +---------+ |
| 2723 | // | | |
| 2724 | // | GET/POST Req | |
| 2725 | // |------------->| |
| 2726 | // | Resp | |
| 2727 | // |<-------------| |
| 2728 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2729 | func TestGetSubscriptions(t *testing.T) { |
| 2730 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2731 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2732 | } |
| 2733 | |
| 2734 | func TestGetSymptomData(t *testing.T) { |
| 2735 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2736 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2737 | } |
| 2738 | |
| 2739 | func TestPostdeleteSubId(t *testing.T) { |
| 2740 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2741 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2742 | } |
| 2743 | |
| 2744 | func TestPostEmptyDb(t *testing.T) { |
| 2745 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2746 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2747 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2748 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2749 | func TestGetRestSubscriptions(t *testing.T) { |
| 2750 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2751 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2752 | } |
| 2753 | |
| 2754 | //----------------------------------------------------------------------------- |
| 2755 | // TestDelAllE2nodeSubsViaDebugIf |
| 2756 | // |
| 2757 | // stub stub stub |
| 2758 | // +-------+ +---------+ +---------+ +---------+ |
| 2759 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2760 | // +-------+ +---------+ +---------+ +---------+ |
| 2761 | // | | | | |
| 2762 | // | RESTSubReq | | | |
| 2763 | // |---------------->| | | |
| 2764 | // | RESTSubResp | | | |
| 2765 | // |<----------------| | | |
| 2766 | // | | RouteCreate | | |
| 2767 | // | |--------------------------->| |
| 2768 | // | | RouteResponse| | |
| 2769 | // | |<---------------------------| |
| 2770 | // | | SubReq | | |
| 2771 | // | |------------->| | |
| 2772 | // | | SubResp | | |
| 2773 | // | |<-------------| | |
| 2774 | // | RESTNotif1 | | | |
| 2775 | // |<----------------| | | |
| 2776 | // | | | | |
| 2777 | // | REST get_all_e2nodes | | |
| 2778 | // |---------------->| | | |
| 2779 | // | OK 200 | | | |
| 2780 | // |<----------------| | | |
| 2781 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2782 | // |---------------->| | | |
| 2783 | // | OK 200 | | | |
| 2784 | // |<----------------| | | |
| 2785 | // | | SubDelReq | | |
| 2786 | // | |------------->| | |
| 2787 | // | | SubDelResp | | |
| 2788 | // | |<-------------| | |
| 2789 | // | | | | |
| 2790 | // | | RouteDelete | | |
| 2791 | // | |--------------------------->| |
| 2792 | // | | RouteResponse| | |
| 2793 | // | |<---------------------------| |
| 2794 | // |
| 2795 | //----------------------------------------------------------------------------- |
| 2796 | |
| 2797 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2798 | |
| 2799 | // Init counter check |
| 2800 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2801 | Counter{cRestSubReqFromXapp, 1}, |
| 2802 | Counter{cRestSubRespToXapp, 1}, |
| 2803 | Counter{cSubReqToE2, 1}, |
| 2804 | Counter{cSubRespFromE2, 1}, |
| 2805 | Counter{cRestSubNotifToXapp, 1}, |
| 2806 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2807 | Counter{cSubDelReqToE2, 1}, |
| 2808 | Counter{cSubDelRespFromE2, 1}, |
| 2809 | Counter{cRestSubDelRespToXapp, 1}, |
| 2810 | }) |
| 2811 | |
| 2812 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2813 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2814 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2815 | |
| 2816 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2817 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2818 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2819 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2820 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2821 | |
| 2822 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2823 | |
| 2824 | var e2nodesList []string |
| 2825 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2826 | if err != nil { |
| 2827 | t.Errorf("Unmarshal error: %s", err) |
| 2828 | } |
| 2829 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2830 | |
| 2831 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2832 | var e2RestSubsMap map[string]RESTSubscription |
| 2833 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2834 | if err != nil { |
| 2835 | t.Errorf("Unmarshal error: %s", err) |
| 2836 | } |
| 2837 | |
| 2838 | if len(e2RestSubsMap) != 1 { |
| 2839 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2840 | } |
| 2841 | |
| 2842 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2843 | 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] | 2844 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2845 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2846 | |
| 2847 | // Wait that subs is cleaned |
| 2848 | waitSubsCleanup(t, e2SubsId, 10) |
| 2849 | mainCtrl.VerifyCounterValues(t) |
| 2850 | mainCtrl.VerifyAllClean(t) |
| 2851 | } |
| 2852 | |
| 2853 | //----------------------------------------------------------------------------- |
| 2854 | // TestDelAllxAppSubsViaDebugIf |
| 2855 | // |
| 2856 | // stub stub stub |
| 2857 | // +-------+ +---------+ +---------+ +---------+ |
| 2858 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2859 | // +-------+ +---------+ +---------+ +---------+ |
| 2860 | // | | | | |
| 2861 | // | RESTSubReq | | | |
| 2862 | // |---------------->| | | |
| 2863 | // | RESTSubResp | | | |
| 2864 | // |<----------------| | | |
| 2865 | // | | RouteCreate | | |
| 2866 | // | |--------------------------->| |
| 2867 | // | | RouteResponse| | |
| 2868 | // | |<---------------------------| |
| 2869 | // | | SubReq | | |
| 2870 | // | |------------->| | |
| 2871 | // | | SubResp | | |
| 2872 | // | |<-------------| | |
| 2873 | // | RESTNotif1 | | | |
| 2874 | // |<----------------| | | |
| 2875 | // | | | | |
| 2876 | // | REST get_all_xapps | | |
| 2877 | // |---------------->| | | |
| 2878 | // | OK 200 | | | |
| 2879 | // |<----------------| | | |
| 2880 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 2881 | // |---------------->| | | |
| 2882 | // | OK 200 | | | |
| 2883 | // |<----------------| | | |
| 2884 | // | | SubDelReq | | |
| 2885 | // | |------------->| | |
| 2886 | // | | SubDelResp | | |
| 2887 | // | |<-------------| | |
| 2888 | // | | | | |
| 2889 | // | | RouteDelete | | |
| 2890 | // | |--------------------------->| |
| 2891 | // | | RouteResponse| | |
| 2892 | // | |<---------------------------| |
| 2893 | // |
| 2894 | //----------------------------------------------------------------------------- |
| 2895 | |
| 2896 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 2897 | |
| 2898 | // Init counter check |
| 2899 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2900 | Counter{cRestSubReqFromXapp, 1}, |
| 2901 | Counter{cRestSubRespToXapp, 1}, |
| 2902 | Counter{cSubReqToE2, 1}, |
| 2903 | Counter{cSubRespFromE2, 1}, |
| 2904 | Counter{cRestSubNotifToXapp, 1}, |
| 2905 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2906 | Counter{cSubDelReqToE2, 1}, |
| 2907 | Counter{cSubDelRespFromE2, 1}, |
| 2908 | Counter{cRestSubDelRespToXapp, 1}, |
| 2909 | }) |
| 2910 | |
| 2911 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2912 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2913 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2914 | |
| 2915 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2916 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2917 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2918 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2919 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2920 | |
| 2921 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 2922 | |
| 2923 | var xappList []string |
| 2924 | err := json.Unmarshal(xappsJson, &xappList) |
| 2925 | if err != nil { |
| 2926 | t.Errorf("Unmarshal error: %s", err) |
| 2927 | } |
| 2928 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 2929 | |
| 2930 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2931 | 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] | 2932 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2933 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2934 | |
| 2935 | // Wait that subs is cleaned |
| 2936 | waitSubsCleanup(t, e2SubsId, 10) |
| 2937 | mainCtrl.VerifyCounterValues(t) |
| 2938 | mainCtrl.VerifyAllClean(t) |
| 2939 | } |
| 2940 | |
| 2941 | //----------------------------------------------------------------------------- |
| 2942 | // TestDelViaxAppSubsIf |
| 2943 | // |
| 2944 | // stub stub stub |
| 2945 | // +-------+ +---------+ +---------+ +---------+ |
| 2946 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2947 | // +-------+ +---------+ +---------+ +---------+ |
| 2948 | // | | | | |
| 2949 | // | RESTSubReq | | | |
| 2950 | // |---------------->| | | |
| 2951 | // | RESTSubResp | | | |
| 2952 | // |<----------------| | | |
| 2953 | // | | RouteCreate | | |
| 2954 | // | |--------------------------->| |
| 2955 | // | | RouteResponse| | |
| 2956 | // | |<---------------------------| |
| 2957 | // | | SubReq | | |
| 2958 | // | |------------->| | |
| 2959 | // | | SubResp | | |
| 2960 | // | |<-------------| | |
| 2961 | // | RESTNotif1 | | | |
| 2962 | // |<----------------| | | |
| 2963 | // | | | | |
| 2964 | // | REST get_xapp_rest_restsubscriptions | |
| 2965 | // |---------------->| | | |
| 2966 | // | OK 200 | | | |
| 2967 | // |<----------------| | | |
| 2968 | // | RESTSudDel | | | |
| 2969 | // |---------------->| | | Via user curl command (port 8088) |
| 2970 | // | RESTSudDel | | | |
| 2971 | // |<----------------| | | |
| 2972 | // | | SubDelReq | | |
| 2973 | // | |------------->| | |
| 2974 | // | | SubDelResp | | |
| 2975 | // | |<-------------| | |
| 2976 | // | | | | |
| 2977 | // | | RouteDelete | | |
| 2978 | // | |--------------------------->| |
| 2979 | // | | RouteResponse| | |
| 2980 | // | |<---------------------------| |
| 2981 | // |
| 2982 | //----------------------------------------------------------------------------- |
| 2983 | |
| 2984 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 2985 | |
| 2986 | // Init counter check |
| 2987 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2988 | Counter{cRestSubReqFromXapp, 1}, |
| 2989 | Counter{cRestSubRespToXapp, 1}, |
| 2990 | Counter{cSubReqToE2, 1}, |
| 2991 | Counter{cSubRespFromE2, 1}, |
| 2992 | Counter{cRestSubNotifToXapp, 1}, |
| 2993 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2994 | Counter{cSubDelReqToE2, 1}, |
| 2995 | Counter{cSubDelRespFromE2, 1}, |
| 2996 | Counter{cRestSubDelRespToXapp, 1}, |
| 2997 | }) |
| 2998 | |
| 2999 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3000 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3001 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3002 | |
| 3003 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3004 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3005 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3006 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3007 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 3008 | |
| 3009 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 3010 | |
| 3011 | var restSubsMap map[string]RESTSubscription |
| 3012 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 3013 | if err != nil { |
| 3014 | t.Errorf("Unmarshal error: %s", err) |
| 3015 | } |
| 3016 | _, ok := restSubsMap[restSubId] |
| 3017 | if !ok { |
| 3018 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 3019 | } |
| 3020 | |
| 3021 | var e2Subscriptions []Subscription |
| 3022 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 3023 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 3024 | if err != nil { |
| 3025 | t.Errorf("Unmarshal error: %s", err) |
| 3026 | } |
| 3027 | if len(e2Subscriptions) != 1 { |
| 3028 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 3029 | } |
| 3030 | |
| 3031 | // Simulate deletion through xapp REST test interface |
| 3032 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 3033 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3034 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3035 | |
| 3036 | // Wait that subs is cleaned |
| 3037 | waitSubsCleanup(t, e2SubsId, 10) |
| 3038 | mainCtrl.VerifyCounterValues(t) |
| 3039 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 3040 | } |
| 3041 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3042 | //----------------------------------------------------------------------------- |
| 3043 | // TestRESTSubReqAndRouteNok |
| 3044 | // |
| 3045 | // stub stub |
| 3046 | // +-------+ +---------+ +---------+ |
| 3047 | // | xapp | | submgr | | rtmgr | |
| 3048 | // +-------+ +---------+ +---------+ |
| 3049 | // | | | |
| 3050 | // | RESTSubReq | | |
| 3051 | // |---------------->| | |
| 3052 | // | | | |
| 3053 | // | RESTSubResp | | |
| 3054 | // |<----------------| | |
| 3055 | // | | RouteCreate | |
| 3056 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3057 | // | | RouteCreate | |
| 3058 | // | | status:400 | |
| 3059 | // | |(Bad request) | |
| 3060 | // | |<-------------| |
| 3061 | // | RESTNotif | | |
| 3062 | // |<----------------| | |
| 3063 | // | | | |
| 3064 | // | [SUBS INT DELETE] | |
| 3065 | // | | | |
| 3066 | // | RESTSubDelReq | | |
| 3067 | // |---------------->| | |
| 3068 | // | RESTSubDelResp | | |
| 3069 | // |<----------------| | |
| 3070 | // |
| 3071 | //----------------------------------------------------------------------------- |
| 3072 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3073 | |
| 3074 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3075 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3076 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3077 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3078 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3079 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3080 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3081 | }) |
| 3082 | |
| 3083 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3084 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3085 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 3086 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3087 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 3088 | |
| 3089 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3090 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3091 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3092 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3093 | waiter.WaitResult(t) |
| 3094 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3095 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3096 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3097 | |
| 3098 | // Del |
| 3099 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3100 | |
| 3101 | // Wait that subs is cleaned |
| 3102 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3103 | waitSubsCleanup(t, e2SubsId, 10) |
| 3104 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3105 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3106 | } |
| 3107 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3108 | //----------------------------------------------------------------------------- |
| 3109 | // TestRESTSubReqAndRouteUpdateNok |
| 3110 | // |
| 3111 | // stub stub stub stub |
| 3112 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3113 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3114 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3115 | // | | | | | |
| 3116 | // | RESTSubReq1 | | | |
| 3117 | // |------------------------>| | | |
| 3118 | // | RESTSubResp2 | | | |
| 3119 | // |<------------------------| | | |
| 3120 | // | | | | | |
| 3121 | // | | | RouteCreate | | |
| 3122 | // | | |------------->| | |
| 3123 | // | | | CreateResp | | |
| 3124 | // | | |<-------------| | |
| 3125 | // | | | SubReq | | |
| 3126 | // | | |---------------------------->| |
| 3127 | // | | | SubResp | | |
| 3128 | // | | |<----------------------------| |
| 3129 | // | RESTNotif1 | | | |
| 3130 | // |<------------------------| | | |
| 3131 | // | | | | | |
| 3132 | // | | RESTSubReq2 | | | |
| 3133 | // | |------------>| | | |
| 3134 | // | | RESTSubResp2| | | |
| 3135 | // | |<------------| | | |
| 3136 | // | | | RouteUpdate | | |
| 3137 | // | | |------------->| | |
| 3138 | // | | | RouteUpdate | | |
| 3139 | // | | | status:400 | | |
| 3140 | // | | |(Bad request) | | |
| 3141 | // | | |<-------------| | |
| 3142 | // | | RESTNotif2(unsuccessful) | | |
| 3143 | // | |<------------| | | |
| 3144 | // | | | | | |
| 3145 | // | [SUBS INT DELETE] | | |
| 3146 | // | | | | | |
| 3147 | // | RESTSubDelReq1 | | | |
| 3148 | // |------------------------>| | | |
| 3149 | // | RESTSubDelResp1 | | | |
| 3150 | // |<------------------------| | | |
| 3151 | // | | | | | |
| 3152 | // | | | [SUBS DELETE] | |
| 3153 | // |
| 3154 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3155 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3156 | |
| 3157 | //Init counter check |
| 3158 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3159 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3160 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3161 | Counter{cSubReqToE2, 1}, |
| 3162 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3163 | Counter{cRestSubNotifToXapp, 1}, |
| 3164 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3165 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3166 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3167 | Counter{cSubDelReqToE2, 1}, |
| 3168 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3169 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3170 | }) |
| 3171 | |
| 3172 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3173 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3174 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3175 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3176 | |
| 3177 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3178 | |
| 3179 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3180 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3181 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3182 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3183 | params.SetMeid("RAN_NAME_1") |
| 3184 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3185 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3186 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3187 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3188 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3189 | |
| 3190 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3191 | |
| 3192 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3193 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3194 | |
| 3195 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3196 | //Wait that subs is cleaned |
| 3197 | waitSubsCleanup(t, e2SubsId, 10) |
| 3198 | |
| 3199 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3200 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3201 | } |
| 3202 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3203 | //----------------------------------------------------------------------------- |
| 3204 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3205 | // |
| 3206 | // stub stub stub |
| 3207 | // +-------+ +---------+ +---------+ +---------+ |
| 3208 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3209 | // +-------+ +---------+ +---------+ +---------+ |
| 3210 | // | | | | |
| 3211 | // | RESTSubReq | | | |
| 3212 | // |---------------->| | | |
| 3213 | // | | | | |
| 3214 | // | RESTSubResp | | | |
| 3215 | // |<----------------| | | |
| 3216 | // | | SubReq | | |
| 3217 | // | |---------------------------->| |
| 3218 | // | | SubResp | | |
| 3219 | // | |<----------------------------| |
| 3220 | // | RESTNotif | | | |
| 3221 | // |<----------------| | | |
| 3222 | // | | | | |
| 3223 | // | | | | |
| 3224 | // | RESTSubDelReq | | | |
| 3225 | // |---------------->| | | |
| 3226 | // | RESTSubDelResp | | | |
| 3227 | // |<----------------| | | |
| 3228 | // | | SubSelReq | | |
| 3229 | // | |---------------------------->| |
| 3230 | // | | SubSelResp | | |
| 3231 | // | |<----------------------------| |
| 3232 | // | | RouteDelete | | |
| 3233 | // | |------------->| | |
| 3234 | // | | Routedelete | | |
| 3235 | // | | status:400 | | |
| 3236 | // | |(Bad request) | | |
| 3237 | // | |<-------------| | |
| 3238 | // |
| 3239 | //----------------------------------------------------------------------------- |
| 3240 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3241 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3242 | |
| 3243 | // Init counter check |
| 3244 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3245 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3246 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3247 | Counter{cSubReqToE2, 1}, |
| 3248 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3249 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3250 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3251 | Counter{cRouteDeleteFail, 1}, |
| 3252 | Counter{cSubDelReqToE2, 1}, |
| 3253 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3254 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3255 | }) |
| 3256 | |
| 3257 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3258 | |
| 3259 | //Subs Create |
| 3260 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3261 | |
| 3262 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3263 | |
| 3264 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3265 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3266 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3267 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3268 | waiter.WaitResult(t) |
| 3269 | |
| 3270 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3271 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3272 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3273 | } |
| 3274 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3275 | //----------------------------------------------------------------------------- |
| 3276 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3277 | // |
| 3278 | // stub stub stub stub |
| 3279 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3280 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3281 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3282 | // | | | | | |
| 3283 | // | RESTSubReq1 | | | |
| 3284 | // |------------------------>| | | |
| 3285 | // | RESTSubResp2 | | | |
| 3286 | // |<------------------------| | | |
| 3287 | // | | | | | |
| 3288 | // | | | RouteCreate | | |
| 3289 | // | | |------------->| | |
| 3290 | // | | | CreateResp | | |
| 3291 | // | | |<-------------| | |
| 3292 | // | | | SubReq | | |
| 3293 | // | | |---------------------------->| |
| 3294 | // | | | SubResp | | |
| 3295 | // | | |<----------------------------| |
| 3296 | // | RESTNotif1 | | | |
| 3297 | // |<------------------------| | | |
| 3298 | // | | | | | |
| 3299 | // | | RESTSubReq2 | | | |
| 3300 | // | |------------>| | | |
| 3301 | // | | RESTSubResp2| | | |
| 3302 | // | |<------------| | | |
| 3303 | // | | | RouteCreate | | |
| 3304 | // | | |------------->| | |
| 3305 | // | | | CreateResp | | |
| 3306 | // | | |<-------------| | |
| 3307 | // | | | SubReq | | |
| 3308 | // | | |---------------------------->| |
| 3309 | // | | | SubResp | | |
| 3310 | // | | |<----------------------------| |
| 3311 | // | | RESTNotif2 | | | |
| 3312 | // | |<------------| | | |
| 3313 | // | | | | | |
| 3314 | // | [SUBS INT DELETE] | | |
| 3315 | // | | | | | |
| 3316 | // | RESTSubDelReq1 | | | |
| 3317 | // |------------------------>| | | |
| 3318 | // | RESTSubDelResp1 | | | |
| 3319 | // |<------------------------| | | |
| 3320 | // | | | SubDelReq | | |
| 3321 | // | | |---------------------------->| |
| 3322 | // | | | SubDelResp | | |
| 3323 | // | | |<----------------------------| |
| 3324 | // | | | RouteUpdate | | |
| 3325 | // | | |------------->| | |
| 3326 | // | | | RouteUpdate | | |
| 3327 | // | | | status:400 | | |
| 3328 | // | | |(Bad request) | | |
| 3329 | // | | |<-------------| | |
| 3330 | // | | | | | |
| 3331 | // | | RESTSubDelReq2 | | |
| 3332 | // | |------------>| | | |
| 3333 | // | | RESTSubDelResp2 | | |
| 3334 | // | |<------------| | | |
| 3335 | // | | | SubDelReq | | |
| 3336 | // | | |---------------------------->| |
| 3337 | // | | | SubdelResp | | |
| 3338 | // | | |<----------------------------| |
| 3339 | // | | | RouteDelete | | |
| 3340 | // | | |------------->| | |
| 3341 | // | | | Deleteresp | | |
| 3342 | // | | |<-------------| | |
| 3343 | |
| 3344 | //----------------------------------------------------------------------------- |
| 3345 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3346 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3347 | |
| 3348 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3349 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3350 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3351 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3352 | Counter{cSubReqToE2, 1}, |
| 3353 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3354 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3355 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3356 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3357 | Counter{cSubDelReqToE2, 1}, |
| 3358 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3359 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3360 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3361 | }) |
| 3362 | |
| 3363 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3364 | |
| 3365 | //Subs Create |
| 3366 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3367 | |
| 3368 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3369 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3370 | |
| 3371 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3372 | |
| 3373 | //Del1, this shall fail on rtmgr side |
| 3374 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3375 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3376 | waiter.WaitResult(t) |
| 3377 | |
| 3378 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3379 | |
| 3380 | //Del2 |
| 3381 | deleteXapp2Subscription(t, &restSubId2) |
| 3382 | |
| 3383 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3384 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3385 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3386 | } |
| 3387 | |
| 3388 | //----------------------------------------------------------------------------- |
| 3389 | // TestRESTSubReqRetransmission |
| 3390 | // |
| 3391 | // stub stub |
| 3392 | // +-------+ +---------+ +---------+ |
| 3393 | // | xapp | | submgr | | e2term | |
| 3394 | // +-------+ +---------+ +---------+ |
| 3395 | // | | | |
| 3396 | // | RESTSubReq1 | | |
| 3397 | // |---------------->| | |
| 3398 | // | | | |
| 3399 | // | RESTSubResp | | |
| 3400 | // |<----------------| | |
| 3401 | // | | SubReq1 | |
| 3402 | // | |------------->| |
| 3403 | // | | | |
| 3404 | // | RESTSubReq2 | | |
| 3405 | // | (retrans) | | |
| 3406 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3407 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3408 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3409 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3410 | // | | SubResp1 | |
| 3411 | // | |<-------------| |
| 3412 | // | RESTNotif1 | | |
| 3413 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3414 | // | | | |
| 3415 | // | [SUBS DELETE] | |
| 3416 | // | | | |
| 3417 | // |
| 3418 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3419 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3420 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3421 | |
| 3422 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3423 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3424 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3425 | Counter{cSubReqToE2, 1}, |
| 3426 | Counter{cSubRespFromE2, 1}, |
| 3427 | Counter{cRestSubNotifToXapp, 1}, |
| 3428 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3429 | Counter{cSubDelReqToE2, 1}, |
| 3430 | Counter{cSubDelRespFromE2, 1}, |
| 3431 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3432 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3433 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3434 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3435 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3436 | |
| 3437 | // Subs Create |
| 3438 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3439 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3440 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3441 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3442 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3443 | xappConn1.SendRESTSubsReq(t, params) |
| 3444 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3445 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3446 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3447 | |
| 3448 | // 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] | 3449 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3450 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3451 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3452 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3453 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3454 | |
| 3455 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3456 | |
| 3457 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3458 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3459 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3460 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3461 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3462 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3463 | |
| 3464 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3465 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3466 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3467 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3468 | //----------------------------------------------------------------------------- |
| 3469 | // stub stub stub |
| 3470 | // +-------+ +---------+ +---------+ +---------+ |
| 3471 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3472 | // +-------+ +---------+ +---------+ +---------+ |
| 3473 | // | | | | |
| 3474 | // | RESTSubReq | | | |
| 3475 | // |---------------->| | | |
| 3476 | // | RESTSubResp | | | |
| 3477 | // |<----------------| | | |
| 3478 | // | | RouteCreate | | |
| 3479 | // | |--------------------------->| |
| 3480 | // | | RouteResponse| | |
| 3481 | // | |<---------------------------| // The order of these events may vary |
| 3482 | // | | SubReq | | |
| 3483 | // | |------------->| | // The order of these events may vary |
| 3484 | // | | SubResp | | |
| 3485 | // | |<-------------| | |
| 3486 | // | RESTNotif1 | | | |
| 3487 | // |<----------------| | | |
| 3488 | // | RESTSubReq | | | |
| 3489 | // | [RETRANS1] | | | |
| 3490 | // |---------------->| | | |
| 3491 | // | RESTNotif1 | | | |
| 3492 | // |<----------------| | | |
| 3493 | // | RESTSubReq | | | |
| 3494 | // | [RETRANS2] | | | |
| 3495 | // |---------------->| | | |
| 3496 | // | RESTNotif1 | | | |
| 3497 | // |<----------------| | | |
| 3498 | // | RESTSubDelReq | | | |
| 3499 | // |---------------->| | | |
| 3500 | // | | SubDelReq | | |
| 3501 | // | |------------->| | |
| 3502 | // | RESTSubDelResp| | | |
| 3503 | // |<----------------| | | |
| 3504 | // | | SubDelResp | | |
| 3505 | // | |<-------------| | |
| 3506 | // | | | | |
| 3507 | // |
| 3508 | //----------------------------------------------------------------------------- |
| 3509 | |
| 3510 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3511 | |
| 3512 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3513 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3514 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3515 | Counter{cRestSubRespToXapp, 3}, |
| 3516 | Counter{cSubReqToE2, 1}, |
| 3517 | Counter{cSubRespFromE2, 1}, |
| 3518 | Counter{cRestSubNotifToXapp, 3}, |
| 3519 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3520 | Counter{cSubDelReqToE2, 1}, |
| 3521 | Counter{cSubDelRespFromE2, 1}, |
| 3522 | Counter{cRestSubDelRespToXapp, 1}, |
| 3523 | }) |
| 3524 | |
| 3525 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3526 | |
| 3527 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3528 | |
| 3529 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3530 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3531 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3532 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3533 | //1.st resend |
| 3534 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3535 | |
| 3536 | assert.Equal(t, restSubId_resend, restSubId) |
| 3537 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3538 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3539 | |
| 3540 | //2.nd resend |
| 3541 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3542 | |
| 3543 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3544 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3545 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3546 | |
| 3547 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3548 | |
| 3549 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3550 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3551 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3552 | } |
| 3553 | |
| 3554 | //----------------------------------------------------------------------------- |
| 3555 | // stub stub stub |
| 3556 | // +-------+ +---------+ +---------+ +---------+ |
| 3557 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3558 | // +-------+ +---------+ +---------+ +---------+ |
| 3559 | // | | | | |
| 3560 | // | RESTSubReq | | | |
| 3561 | // |---------------->| | | |
| 3562 | // | RESTSubResp | | | |
| 3563 | // |<----------------| | | |
| 3564 | // | | RouteCreate | | |
| 3565 | // | |--------------------------->| |
| 3566 | // | | RouteResponse| | |
| 3567 | // | |<---------------------------| // The order of these events may vary |
| 3568 | // | | SubReq | | |
| 3569 | // | |------------->| | // The order of these events may vary |
| 3570 | // | | SubResp | | |
| 3571 | // | |<-------------| | |
| 3572 | // | RESTNotif1 | | | |
| 3573 | // |<----------------| | | |
| 3574 | // | RESTSubReq | | | |
| 3575 | // | [RETRANS, with RESTsubsId] | | |
| 3576 | // |---------------->| | | |
| 3577 | // | RESTNotif1 | | | |
| 3578 | // |<----------------| | | |
| 3579 | // | RESTSubReq | | | |
| 3580 | // | [RETRANS, without RESTsubsId] | | |
| 3581 | // |---------------->| | | |
| 3582 | // | RESTNotif1 | | | |
| 3583 | // |<----------------| | | |
| 3584 | // | RESTSubDelReq | | | |
| 3585 | // |---------------->| | | |
| 3586 | // | | SubDelReq | | |
| 3587 | // | |------------->| | |
| 3588 | // | RESTSubDelResp| | | |
| 3589 | // |<----------------| | | |
| 3590 | // | | SubDelResp | | |
| 3591 | // | |<-------------| | |
| 3592 | // | | | | |
| 3593 | // |
| 3594 | //----------------------------------------------------------------------------- |
| 3595 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3596 | |
| 3597 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3598 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3599 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3600 | Counter{cRestSubRespToXapp, 3}, |
| 3601 | Counter{cSubReqToE2, 1}, |
| 3602 | Counter{cSubRespFromE2, 1}, |
| 3603 | Counter{cRestSubNotifToXapp, 3}, |
| 3604 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3605 | Counter{cSubDelReqToE2, 1}, |
| 3606 | Counter{cSubDelRespFromE2, 1}, |
| 3607 | Counter{cRestSubDelRespToXapp, 1}, |
| 3608 | }) |
| 3609 | |
| 3610 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3611 | |
| 3612 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3613 | |
| 3614 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3615 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3616 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3617 | |
| 3618 | //1.st resend with subscription ID |
| 3619 | params.SetSubscriptionID(&restSubId) |
| 3620 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3621 | |
| 3622 | assert.Equal(t, restSubId_resend, restSubId) |
| 3623 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3624 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3625 | |
| 3626 | //2.nd resend without subscription ID (faking app restart) |
| 3627 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3628 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3629 | |
| 3630 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3631 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3632 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3633 | |
| 3634 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3635 | |
| 3636 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3637 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3638 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3639 | } |
| 3640 | |
| 3641 | //----------------------------------------------------------------------------- |
| 3642 | // stub stub stub |
| 3643 | // +-------+ +---------+ +---------+ +---------+ |
| 3644 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3645 | // +-------+ +---------+ +---------+ +---------+ |
| 3646 | // | | | | |
| 3647 | // | RESTSubReq | | | |
| 3648 | // |---------------->| | | |
| 3649 | // | RESTSubResp | | | |
| 3650 | // |<----------------| | | |
| 3651 | // | | RouteCreate | | |
| 3652 | // | |--------------------------->| |
| 3653 | // | | RouteResponse| | |
| 3654 | // | |<---------------------------| |
| 3655 | // | | SubReq | | |
| 3656 | // | |------------->| | |
| 3657 | // | | SubResp | | |
| 3658 | // | |<-------------| | |
| 3659 | // | RESTNotif1 | | | |
| 3660 | // |<----------------| | | |
| 3661 | // | RESTSubReq | | | |
| 3662 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3663 | // |---------------->| | | |
| 3664 | // | RESTNotif1 | | | |
| 3665 | // | [for initial e2 subDetail] | | |
| 3666 | // |<----------------| | | |
| 3667 | // | | RouteCreate | | |
| 3668 | // | |--------------------------->| |
| 3669 | // | | RouteResponse| | |
| 3670 | // | |<---------------------------| |
| 3671 | // | | SubReq | | |
| 3672 | // | |------------->| | |
| 3673 | // | | SubResp | | |
| 3674 | // | |<-------------| | |
| 3675 | // | RESTNotif1 | | | |
| 3676 | // |<----------------| | | |
| 3677 | // | RESTSubReq | | | |
| 3678 | // | [with RESTsubsId initial request] | |
| 3679 | // |---------------->| | | |
| 3680 | // | RESTNotif1 | | | |
| 3681 | // |<----------------| | | |
| 3682 | // | RESTSubDelReq | | | |
| 3683 | // |---------------->| | | |
| 3684 | // | RESTSubDelResp| | | |
| 3685 | // |<----------------| | | |
| 3686 | // | | SubDelReq | | |
| 3687 | // | |------------->| | |
| 3688 | // | | SubDelResp | | |
| 3689 | // | |<-------------| | |
| 3690 | // | | SubDelReq | | |
| 3691 | // | |------------->| | |
| 3692 | // | | SubDelResp | | |
| 3693 | // | |<-------------| | |
| 3694 | // | | | | |
| 3695 | // |
| 3696 | //----------------------------------------------------------------------------- |
| 3697 | |
| 3698 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3699 | |
| 3700 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3701 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3702 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3703 | Counter{cRestSubRespToXapp, 3}, |
| 3704 | Counter{cSubReqToE2, 2}, |
| 3705 | Counter{cSubRespFromE2, 2}, |
| 3706 | Counter{cRestSubNotifToXapp, 4}, |
| 3707 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3708 | Counter{cSubDelReqToE2, 2}, |
| 3709 | Counter{cSubDelRespFromE2, 2}, |
| 3710 | Counter{cRestSubDelRespToXapp, 1}, |
| 3711 | }) |
| 3712 | |
| 3713 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3714 | |
| 3715 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3716 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3717 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3718 | |
| 3719 | // Send modified requst, this time with e2 subscriptions. |
| 3720 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3721 | params2.SetSubscriptionID(&restSubId) |
| 3722 | |
| 3723 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3724 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3725 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3726 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3727 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3728 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3729 | |
| 3730 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3731 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3732 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3733 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3734 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3735 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3736 | assert.NotEqual(t, e2SubsId2, 0) |
| 3737 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3738 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3739 | |
| 3740 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3741 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3742 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3743 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3744 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3745 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3746 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3747 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3748 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3749 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3750 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3751 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3752 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3753 | // Delete both e2 subscriptions |
| 3754 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3755 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3756 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3757 | |
| 3758 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3759 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3760 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3761 | } |
| 3762 | |
| 3763 | //----------------------------------------------------------------------------- |
| 3764 | // stub stub stub |
| 3765 | // +-------+ +---------+ +---------+ +---------+ |
| 3766 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3767 | // +-------+ +---------+ +---------+ +---------+ |
| 3768 | // | | | | |
| 3769 | // | RESTSubReq | | | |
| 3770 | // |---------------->| | | |
| 3771 | // | RESTSubResp | | | |
| 3772 | // |<----------------| | | |
| 3773 | // | | RouteCreate | | |
| 3774 | // | |--------------------------->| |
| 3775 | // | | RouteResponse| | |
| 3776 | // | |<---------------------------| |
| 3777 | // | | SubReq | | |
| 3778 | // | |------------->| | |
| 3779 | // | | SubResp | | |
| 3780 | // | |<-------------| | |
| 3781 | // | RESTNotif1 | | | |
| 3782 | // |<----------------| | | |
| 3783 | // | RESTSubReq | | | |
| 3784 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3785 | // |---------------->| | | |
| 3786 | // | RESTNotif1 | | | |
| 3787 | // | [for initial e2 subDetail] | | |
| 3788 | // |<----------------| | | |
| 3789 | // | | RouteCreate | | |
| 3790 | // | |--------------------------->| |
| 3791 | // | | RouteResponse| | |
| 3792 | // | |<---------------------------| |
| 3793 | // | | SubReq | | |
| 3794 | // | |------------->| | |
| 3795 | // | | SubResp | | |
| 3796 | // | |<-------------| | |
| 3797 | // | RESTNotif1 | | | |
| 3798 | // |<----------------| | | |
| 3799 | // | RESTSubReq | | | |
| 3800 | // | [without RESTsubsId initial request] | |
| 3801 | // |---------------->| | | |
| 3802 | // | RESTNotif1 | | | |
| 3803 | // |<----------------| | | |
| 3804 | // | RESTSubDelReq | | | |
| 3805 | // |---------------->| | | |
| 3806 | // | RESTSubDelResp| | | |
| 3807 | // |<----------------| | | |
| 3808 | // | | SubDelReq | | |
| 3809 | // | |------------->| | |
| 3810 | // | | SubDelResp | | |
| 3811 | // | |<-------------| | |
| 3812 | // | | SubDelReq | | |
| 3813 | // | |------------->| | |
| 3814 | // | | SubDelResp | | |
| 3815 | // | |<-------------| | |
| 3816 | // | | | | |
| 3817 | // |
| 3818 | //----------------------------------------------------------------------------- |
| 3819 | |
| 3820 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3821 | |
| 3822 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3823 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3824 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3825 | Counter{cRestSubRespToXapp, 3}, |
| 3826 | Counter{cSubReqToE2, 2}, |
| 3827 | Counter{cSubRespFromE2, 2}, |
| 3828 | Counter{cRestSubNotifToXapp, 4}, |
| 3829 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3830 | Counter{cSubDelReqToE2, 2}, |
| 3831 | Counter{cSubDelRespFromE2, 2}, |
| 3832 | Counter{cRestSubDelRespToXapp, 1}, |
| 3833 | }) |
| 3834 | |
| 3835 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3836 | |
| 3837 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3838 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3839 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3840 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3841 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3842 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3843 | params2.SetSubscriptionID(&restSubId) |
| 3844 | |
| 3845 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3846 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3847 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3848 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3849 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3850 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3851 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3852 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3853 | xappConn1.DecrementRequestCount() |
| 3854 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3855 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3856 | |
| 3857 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3858 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3859 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3860 | assert.NotEqual(t, e2SubsId2, 0) |
| 3861 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3862 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3863 | |
| 3864 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3865 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3866 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3867 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3868 | // md5sum shall find the original request |
| 3869 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3870 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3871 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3872 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3873 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3874 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3875 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3876 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3877 | // Delete both e2 subscriptions |
| 3878 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3879 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3880 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3881 | |
| 3882 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3883 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3884 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3885 | } |
| 3886 | |
| 3887 | //----------------------------------------------------------------------------- |
| 3888 | // stub stub stub |
| 3889 | // +-------+ +---------+ +---------+ +---------+ |
| 3890 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3891 | // +-------+ +---------+ +---------+ +---------+ |
| 3892 | // | | | | |
| 3893 | // | RESTSubReq | | | |
| 3894 | // |---------------->| | | |
| 3895 | // | RESTSubResp | | | |
| 3896 | // |<----------------| | | |
| 3897 | // | | RouteCreate | | |
| 3898 | // | |--------------------------->| |
| 3899 | // | | RouteResponse| | |
| 3900 | // | |<---------------------------| |
| 3901 | // | | SubReq | | |
| 3902 | // | |------------->| | |
| 3903 | // | | SubResp | | |
| 3904 | // | |<-------------| | |
| 3905 | // | RESTNotif1 | | | |
| 3906 | // |<----------------| | | |
| 3907 | // | RESTSubReq | | | |
| 3908 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3909 | // |---------------->| | | |
| 3910 | // | RESTNotif1 | | | |
| 3911 | // | [for initial e2 subDetail] | | |
| 3912 | // |<----------------| | | |
| 3913 | // | | RouteCreate | | |
| 3914 | // | |--------------------------->| |
| 3915 | // | | RouteResponse| | |
| 3916 | // | |<---------------------------| |
| 3917 | // | | SubReq | | |
| 3918 | // | |------------->| | |
| 3919 | // | | SubResp | | |
| 3920 | // | |<-------------| | |
| 3921 | // | RESTNotif1 | | | |
| 3922 | // |<----------------| | | |
| 3923 | // | RESTSubDelReq | | | |
| 3924 | // |---------------->| | | |
| 3925 | // | RESTSubDelResp| | | |
| 3926 | // |<----------------| | | |
| 3927 | // | | SubDelReq | | |
| 3928 | // | |------------->| | |
| 3929 | // | | SubDelResp | | |
| 3930 | // | |<-------------| | |
| 3931 | // | | SubDelReq | | |
| 3932 | // | |------------->| | |
| 3933 | // | | SubDelResp | | |
| 3934 | // | |<-------------| | |
| 3935 | // | RESTSubReq | | | |
| 3936 | // | [with RESTsubsId initial request] | |
| 3937 | // |---------------->| | | |
| 3938 | // | RESTSubResp | | | |
| 3939 | // |<----------------| | | |
| 3940 | // | | RouteCreate | | |
| 3941 | // | |--------------------------->| |
| 3942 | // | | RouteResponse| | |
| 3943 | // | |<---------------------------| |
| 3944 | // | | SubReq | | |
| 3945 | // | |------------->| | |
| 3946 | // | | SubResp | | |
| 3947 | // | |<-------------| | |
| 3948 | // | RESTNotif1 | | | |
| 3949 | // |<----------------| | | |
| 3950 | // | | | | |
| 3951 | // |
| 3952 | //----------------------------------------------------------------------------- |
| 3953 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3954 | |
| 3955 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3956 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3957 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3958 | Counter{cRestSubRespToXapp, 3}, |
| 3959 | Counter{cSubReqToE2, 3}, |
| 3960 | Counter{cSubRespFromE2, 3}, |
| 3961 | Counter{cRestSubNotifToXapp, 4}, |
| 3962 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3963 | Counter{cSubDelReqToE2, 3}, |
| 3964 | Counter{cSubDelRespFromE2, 3}, |
| 3965 | Counter{cRestSubDelRespToXapp, 2}, |
| 3966 | }) |
| 3967 | |
| 3968 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3969 | |
| 3970 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3971 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3972 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3973 | |
| 3974 | // Send modified requst, this time with e2 subscriptions. |
| 3975 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3976 | params2.SetSubscriptionID(&restSubId) |
| 3977 | |
| 3978 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3979 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3980 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3981 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3982 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3983 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3984 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3985 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3986 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3987 | |
| 3988 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3989 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3990 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3991 | assert.NotEqual(t, e2SubsId2, 0) |
| 3992 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3993 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3994 | |
| 3995 | // Delete both e2 subscriptions |
| 3996 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3997 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3998 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3999 | |
| 4000 | waitSubsCleanup(t, e2SubsId, 10) |
| 4001 | |
| 4002 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 4003 | // but the restsubscription has been already removed. This shall trigger a |
| 4004 | // fresh create. |
| 4005 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4006 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 4007 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4008 | |
| 4009 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4010 | |
| 4011 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4012 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4013 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 4014 | } |
| 4015 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4016 | //----------------------------------------------------------------------------- |
| 4017 | // TestRESTSubDelReqRetransmission |
| 4018 | // |
| 4019 | // stub stub |
| 4020 | // +-------+ +---------+ +---------+ |
| 4021 | // | xapp | | submgr | | e2term | |
| 4022 | // +-------+ +---------+ +---------+ |
| 4023 | // | | | |
| 4024 | // | RESTSubReq | | |
| 4025 | // |---------------->| | |
| 4026 | // | | | |
| 4027 | // | RESTSubResp | | |
| 4028 | // |<----------------| | |
| 4029 | // | | SubReq | |
| 4030 | // | |------------->| |
| 4031 | // | | SubResp | |
| 4032 | // | |<-------------| |
| 4033 | // | RESTNotif1 | | |
| 4034 | // |<----------------| | |
| 4035 | // | | | |
| 4036 | // | RESTSubDelReq | | |
| 4037 | // |---------------->| | |
| 4038 | // | RESTSubDelResp | | |
| 4039 | // |<----------------| | |
| 4040 | // | | SubDelReq | |
| 4041 | // | |------------->| |
| 4042 | // | RESTSubDelReq | | |
| 4043 | // |---------------->| | |
| 4044 | // | RESTSubDelResp | | |
| 4045 | // |<----------------| | |
| 4046 | // | | SubDelResp | |
| 4047 | // | |<-------------| |
| 4048 | // | | | |
| 4049 | // |
| 4050 | //----------------------------------------------------------------------------- |
| 4051 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4053 | |
| 4054 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4055 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4056 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4057 | Counter{cSubReqToE2, 1}, |
| 4058 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4059 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4060 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4061 | Counter{cSubDelReqToE2, 1}, |
| 4062 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4063 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | }) |
| 4065 | |
| 4066 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4067 | |
| 4068 | //Subs Create |
| 4069 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4070 | |
| 4071 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4072 | |
| 4073 | //Subs Delete |
| 4074 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4075 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4076 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4077 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4078 | seqBef := mainCtrl.get_msgcounter(t) |
| 4079 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4080 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 4081 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4082 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4083 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4084 | |
| 4085 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4086 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4087 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4088 | } |
| 4089 | |
| 4090 | //----------------------------------------------------------------------------- |
| 4091 | // TestRESTSubReqDelReq |
| 4092 | // |
| 4093 | // stub stub |
| 4094 | // +-------+ +---------+ +---------+ |
| 4095 | // | xapp | | submgr | | e2term | |
| 4096 | // +-------+ +---------+ +---------+ |
| 4097 | // | | | |
| 4098 | // | RESTSubReq | | |
| 4099 | // |---------------->| | |
| 4100 | // | | | |
| 4101 | // | RESTSubResp | | |
| 4102 | // |<----------------| | |
| 4103 | // | | SubReq | |
| 4104 | // | |------------->| |
| 4105 | // | RESTSubDelReq | | |
| 4106 | // |---------------->| | |
| 4107 | // | RESTSubDelResp | | |
| 4108 | // | unsuccess | | |
| 4109 | // |<----------------| | |
| 4110 | // | | SubResp | |
| 4111 | // | |<-------------| |
| 4112 | // | RESTNotif1 | | |
| 4113 | // |<----------------| | |
| 4114 | // | | | |
| 4115 | // | [SUBS DELETE] | |
| 4116 | // | | | |
| 4117 | // |
| 4118 | //----------------------------------------------------------------------------- |
| 4119 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4120 | |
| 4121 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4122 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4123 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4124 | Counter{cSubReqToE2, 1}, |
| 4125 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4126 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4127 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4128 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4129 | Counter{cSubDelReqToE2, 1}, |
| 4130 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4131 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4132 | }) |
| 4133 | |
| 4134 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4135 | |
| 4136 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4137 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4138 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4139 | |
| 4140 | // Del. This will fail as processing of the subscription |
| 4141 | // is still ongoing in submgr. Deletion is not allowed before |
| 4142 | // subscription creation has been completed. |
| 4143 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4144 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4145 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4146 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4147 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4148 | |
| 4149 | // Retry del |
| 4150 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4151 | |
| 4152 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4153 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4154 | |
| 4155 | // Wait that subs is cleaned |
| 4156 | waitSubsCleanup(t, e2SubsId, 10) |
| 4157 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4158 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4159 | } |
| 4160 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4161 | //----------------------------------------------------------------------------- |
| 4162 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4163 | // |
| 4164 | // stub stub stub |
| 4165 | // +-------+ +-------+ +---------+ +---------+ |
| 4166 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4167 | // +-------+ +-------+ +---------+ +---------+ |
| 4168 | // | | | | |
| 4169 | // | | RESTSubReq1 | | |
| 4170 | // | |------------->| | |
| 4171 | // | | RESTSubResp1 | | |
| 4172 | // | |<-------------| | |
| 4173 | // | | | | |
| 4174 | // | | | SubReq1 | |
| 4175 | // | | |------------->| |
| 4176 | // | | | | |
| 4177 | // | RESTSubReq2 | | |
| 4178 | // |------------------------>| | |
| 4179 | // | RESTSubResp2 | | |
| 4180 | // |<------------------------| | |
| 4181 | // | | | | |
| 4182 | // | | | SubReq2 | |
| 4183 | // | | |------------->| |
| 4184 | // | | | | |
| 4185 | // | | | SubResp1 | |
| 4186 | // | | |<-------------| |
| 4187 | // | | RESTNotif1 | | |
| 4188 | // | |<-------------| | |
| 4189 | // | | | | |
| 4190 | // | | | SubResp2 | |
| 4191 | // | | |<-------------| |
| 4192 | // | RESTNotif2 | | |
| 4193 | // |<------------------------| | |
| 4194 | // | | | | |
| 4195 | // | | [SUBS 1 DELETE] | |
| 4196 | // | | | | |
| 4197 | // | | [SUBS 2 DELETE] | |
| 4198 | // | | | | |
| 4199 | // |
| 4200 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4201 | |
| 4202 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4203 | |
| 4204 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4205 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4206 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4207 | Counter{cSubReqToE2, 2}, |
| 4208 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4209 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4210 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4211 | Counter{cSubDelReqToE2, 2}, |
| 4212 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4213 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4214 | }) |
| 4215 | |
| 4216 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4217 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4218 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4219 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4220 | |
| 4221 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4222 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4223 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4224 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4225 | |
| 4226 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4227 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4228 | |
| 4229 | //XappConn1 receives both of the responses |
| 4230 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4231 | |
| 4232 | //Resp1 |
| 4233 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4234 | //Resp2 |
| 4235 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4236 | |
| 4237 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4238 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4239 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4240 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4241 | |
| 4242 | //Del1 |
| 4243 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4244 | //Del2 |
| 4245 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4246 | |
| 4247 | //Wait that subs is cleaned |
| 4248 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4249 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4250 | |
| 4251 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4252 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4253 | } |
| 4254 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4255 | //----------------------------------------------------------------------------- |
| 4256 | // TestRESTSameSubsDiffRan |
| 4257 | // Same subscription to different RANs |
| 4258 | // |
| 4259 | // stub stub |
| 4260 | // +-------+ +---------+ +---------+ |
| 4261 | // | xapp | | submgr | | e2term | |
| 4262 | // +-------+ +---------+ +---------+ |
| 4263 | // | | | |
| 4264 | // | RESTSubReq(r1) | | |
| 4265 | // |---------------->| | |
| 4266 | // | RESTSubResp(r1) | | |
| 4267 | // |<----------------| | |
| 4268 | // | | | |
| 4269 | // | | SubReq(r1) | |
| 4270 | // | |------------->| |
| 4271 | // | | | |
| 4272 | // | | SubResp(r1) | |
| 4273 | // | |<-------------| |
| 4274 | // | | | |
| 4275 | // | RESTNotif(r1) | | |
| 4276 | // |<----------------| | |
| 4277 | // | | | |
| 4278 | // | RESTSubReq(r2) | | |
| 4279 | // |---------------->| | |
| 4280 | // | | | |
| 4281 | // | RESTSubResp(r2) | | |
| 4282 | // |<----------------| | |
| 4283 | // | | SubReq(r2) | |
| 4284 | // | |------------->| |
| 4285 | // | | | |
| 4286 | // | | SubResp(r2) | |
| 4287 | // | |<-------------| |
| 4288 | // | | | |
| 4289 | // | RESTNotif(r2) | | |
| 4290 | // |<----------------| | |
| 4291 | // | | | |
| 4292 | // | [SUBS r1 DELETE] | |
| 4293 | // | | | |
| 4294 | // | [SUBS r2 DELETE] | |
| 4295 | // | | | |
| 4296 | // |
| 4297 | //----------------------------------------------------------------------------- |
| 4298 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4299 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4300 | |
| 4301 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4302 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4303 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4304 | Counter{cSubReqToE2, 2}, |
| 4305 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4306 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4307 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4308 | Counter{cSubDelReqToE2, 2}, |
| 4309 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4310 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4311 | }) |
| 4312 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4313 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4314 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4315 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4316 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4317 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4318 | params.SetMeid("RAN_NAME_2") |
| 4319 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4320 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4321 | |
| 4322 | //Del1 |
| 4323 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4324 | //Del2 |
| 4325 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4326 | |
| 4327 | //Wait that subs is cleaned |
| 4328 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4329 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4330 | |
| 4331 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4332 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4333 | } |
| 4334 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4335 | //----------------------------------------------------------------------------- |
| 4336 | // TestRESTSubReqRetryInSubmgr |
| 4337 | // |
| 4338 | // stub stub |
| 4339 | // +-------+ +---------+ +---------+ |
| 4340 | // | xapp | | submgr | | e2term | |
| 4341 | // +-------+ +---------+ +---------+ |
| 4342 | // | | | |
| 4343 | // | RESTSubReq | | |
| 4344 | // |---------------->| | |
| 4345 | // | RESTSubResp | | |
| 4346 | // |<----------------| | |
| 4347 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 4348 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4349 | // | | | |
| 4350 | // | | | |
| 4351 | // | | SubReq | |
| 4352 | // | |------------->| |
| 4353 | // | | SubResp | |
| 4354 | // | |<-------------| |
| 4355 | // | | | |
| 4356 | // | RESTNotif | | |
| 4357 | // |<----------------| | |
| 4358 | // | | | |
| 4359 | // | [SUBS DELETE] | |
| 4360 | // | | | |
| 4361 | // |
| 4362 | //----------------------------------------------------------------------------- |
| 4363 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4364 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4365 | |
| 4366 | // Init counter check |
| 4367 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4368 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4369 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4370 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4371 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4372 | Counter{cSubReReqToE2, 1}, |
| 4373 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4374 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4375 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4376 | Counter{cSubDelReqToE2, 1}, |
| 4377 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4378 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4379 | }) |
| 4380 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4381 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4383 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4384 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4385 | |
| 4386 | // Catch the first message and ignore it |
| 4387 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4388 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4389 | |
| 4390 | // The second request is being handled normally |
| 4391 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4392 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4393 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4394 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4395 | |
| 4396 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4397 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4398 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4399 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4400 | |
| 4401 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4402 | //Wait that subs is cleaned |
| 4403 | waitSubsCleanup(t, e2SubsId, 10) |
| 4404 | |
| 4405 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4406 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4407 | } |
| 4408 | |
| 4409 | //----------------------------------------------------------------------------- |
| 4410 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4411 | // |
| 4412 | // stub stub |
| 4413 | // +-------+ +---------+ +---------+ |
| 4414 | // | xapp | | submgr | | e2term | |
| 4415 | // +-------+ +---------+ +---------+ |
| 4416 | // | | | |
| 4417 | // | RESTSubReq | | |
| 4418 | // |---------------->| | |
| 4419 | // | | | |
| 4420 | // | RESTSubResp | | |
| 4421 | // |<----------------| | |
| 4422 | // | | SubReq | |
| 4423 | // | |------------->| |
| 4424 | // | | | |
| 4425 | // | | | |
| 4426 | // | | SubReq | |
| 4427 | // | |------------->| |
| 4428 | // | | | |
| 4429 | // | | SubDelReq | |
| 4430 | // | |------------->| |
| 4431 | // | | | |
| 4432 | // | | | |
| 4433 | // | | SubDelReq | |
| 4434 | // | |------------->| |
| 4435 | // | | | |
| 4436 | // | | | |
| 4437 | // | | SubDelResp | |
| 4438 | // | |<-------------| |
| 4439 | // | RESTNotif | | |
| 4440 | // | unsuccess | | |
| 4441 | // |<----------------| | |
| 4442 | // | | | |
| 4443 | // | [SUBS DELETE] | |
| 4444 | // | | | |
| 4445 | // |
| 4446 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4447 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4448 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4449 | |
| 4450 | // Init counter check |
| 4451 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4452 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4453 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4454 | Counter{cSubReqToE2, 1}, |
| 4455 | Counter{cSubReReqToE2, 1}, |
| 4456 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4457 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | Counter{cSubDelReqToE2, 1}, |
| 4459 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4460 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4461 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4462 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4463 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4464 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4465 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4466 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | |
| 4468 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4469 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4470 | |
| 4471 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4472 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4473 | |
| 4474 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4475 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4476 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4477 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4478 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4479 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4480 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4481 | // Wait that subs is cleaned |
| 4482 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4483 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4484 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4485 | } |
| 4486 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4487 | //----------------------------------------------------------------------------- |
| 4488 | // TestREST2eTermNotRespondingToSubReq |
| 4489 | // |
| 4490 | // stub stub |
| 4491 | // +-------+ +---------+ +---------+ |
| 4492 | // | xapp | | submgr | | e2term | |
| 4493 | // +-------+ +---------+ +---------+ |
| 4494 | // | | | |
| 4495 | // | RESTSubReq | | |
| 4496 | // |---------------->| | |
| 4497 | // | RESTSubResp | | |
| 4498 | // |<----------------| | |
| 4499 | // | | SubReq | |
| 4500 | // | |------------->| |
| 4501 | // | | | |
| 4502 | // | | SubReq | |
| 4503 | // | |------------->| |
| 4504 | // | | | |
| 4505 | // | | SubDelReq | |
| 4506 | // | |------------->| |
| 4507 | // | | | |
| 4508 | // | | SubDelReq | |
| 4509 | // | |------------->| |
| 4510 | // | RESTNotif(Unsuccessful) | |
| 4511 | // |<----------------| | |
| 4512 | // | | | |
| 4513 | // | RESTSubDelReq | | |
| 4514 | // |---------------->| | |
| 4515 | // | RESTSubDelResp | | |
| 4516 | // |<----------------| | |
| 4517 | // | | | |
| 4518 | // |
| 4519 | //----------------------------------------------------------------------------- |
| 4520 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4521 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4522 | |
| 4523 | // Init counter check |
| 4524 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4525 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4526 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4527 | Counter{cSubReqToE2, 1}, |
| 4528 | Counter{cSubReReqToE2, 1}, |
| 4529 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4530 | Counter{cSubDelReReqToE2, 1}, |
| 4531 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4532 | Counter{cSubDelReqToE2, 1}, |
| 4533 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4534 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4535 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4537 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4538 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4539 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4540 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4541 | |
| 4542 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4543 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4544 | |
| 4545 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4546 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4547 | |
| 4548 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4549 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4550 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4551 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4552 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4553 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4554 | |
| 4555 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4556 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4557 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4558 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4559 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4560 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4561 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | } |
| 4563 | |
| 4564 | //----------------------------------------------------------------------------- |
| 4565 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4566 | // |
| 4567 | // stub stub |
| 4568 | // +-------+ +---------+ +---------+ |
| 4569 | // | xapp | | submgr | | e2term | |
| 4570 | // +-------+ +---------+ +---------+ |
| 4571 | // | | | |
| 4572 | // | RESTSubReq | | |
| 4573 | // |---------------->| | |
| 4574 | // | | | |
| 4575 | // | RESTSubResp | | |
| 4576 | // |<----------------| | |
| 4577 | // | | SubReq | |
| 4578 | // | |------------->| |
| 4579 | // | | | |
| 4580 | // | | | |
| 4581 | // | | SubReq | |
| 4582 | // | |------------->| |
| 4583 | // | | | |
| 4584 | // | | SubDelReq | |
| 4585 | // | |------------->| |
| 4586 | // | | | |
| 4587 | // | | | |
| 4588 | // | | SubDelReq | |
| 4589 | // | |------------->| |
| 4590 | // | | | |
| 4591 | // | | | |
| 4592 | // | | SubDelResp | |
| 4593 | // | |<-------------| |
| 4594 | // | RESTNotif | | |
| 4595 | // | unsuccess | | |
| 4596 | // |<----------------| | |
| 4597 | // | | | |
| 4598 | // | [SUBS DELETE] | |
| 4599 | // | | | |
| 4600 | // |
| 4601 | //----------------------------------------------------------------------------- |
| 4602 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4603 | |
| 4604 | // Init counter check |
| 4605 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4606 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4607 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4608 | Counter{cSubReqToE2, 1}, |
| 4609 | Counter{cSubReReqToE2, 1}, |
| 4610 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4611 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4612 | Counter{cSubDelReqToE2, 1}, |
| 4613 | Counter{cSubDelReReqToE2, 1}, |
| 4614 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4615 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4616 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4617 | }) |
| 4618 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4619 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4620 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4621 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4622 | |
| 4623 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4624 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4625 | |
| 4626 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4627 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4628 | |
| 4629 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4630 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4631 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4632 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4633 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4634 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4635 | |
| 4636 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4637 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4638 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4639 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4640 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4641 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4642 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4643 | } |
| 4644 | |
| 4645 | //----------------------------------------------------------------------------- |
| 4646 | // TestRESTSubReqSubFailRespInSubmgr |
| 4647 | // |
| 4648 | // stub stub |
| 4649 | // +-------+ +---------+ +---------+ |
| 4650 | // | xapp | | submgr | | e2term | |
| 4651 | // +-------+ +---------+ +---------+ |
| 4652 | // | | | |
| 4653 | // | RESTSubReq | | |
| 4654 | // |---------------->| | |
| 4655 | // | | | |
| 4656 | // | RESTSubResp | | |
| 4657 | // |<----------------| | |
| 4658 | // | | SubReq | |
| 4659 | // | |------------->| |
| 4660 | // | | | |
| 4661 | // | | SubFail | |
| 4662 | // | |<-------------| |
| 4663 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4664 | // | RESTNotif | | |
| 4665 | // | unsuccess | | |
| 4666 | // |<----------------| | |
| 4667 | // | | | |
| 4668 | // | [SUBS DELETE] | |
| 4669 | // | | | |
| 4670 | // |
| 4671 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4672 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4673 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4674 | |
| 4675 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4676 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4677 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4678 | Counter{cSubReqToE2, 1}, |
| 4679 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4680 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4681 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4682 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4683 | }) |
| 4684 | |
| 4685 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4686 | const e2Timeout int64 = 2 |
| 4687 | const e2RetryCount int64 = 1 |
| 4688 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4689 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4690 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4691 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4692 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4693 | |
| 4694 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4695 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4696 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4697 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4698 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4699 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4700 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4701 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4702 | |
| 4703 | // REST subscription sill there to be deleted |
| 4704 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4705 | |
| 4706 | // Wait that subs is cleaned |
| 4707 | waitSubsCleanup(t, e2SubsId, 10) |
| 4708 | |
| 4709 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4710 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4711 | } |
| 4712 | |
| 4713 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 4714 | // TestRESTSubReqPartialResp |
| 4715 | // |
| 4716 | // stub stub |
| 4717 | // +-------+ +---------+ +---------+ |
| 4718 | // | xapp | | submgr | | e2term | |
| 4719 | // +-------+ +---------+ +---------+ |
| 4720 | // | | | |
| 4721 | // | RESTSubReq | | |
| 4722 | // |---------------->| | |
| 4723 | // | RESTSubResp | | |
| 4724 | // |<----------------| | |
| 4725 | // | | SubReq | |
| 4726 | // | |------------->| |
| 4727 | // | | SubResp | Partially accepted |
| 4728 | // | |<-------------| |
| 4729 | // | | | |
| 4730 | // | RESTNotif | | |
| 4731 | // |<----------------| | |
| 4732 | // | | | |
| 4733 | // | [SUBS DELETE] | |
| 4734 | // | | | |
| 4735 | // |
| 4736 | //----------------------------------------------------------------------------- |
| 4737 | |
| 4738 | func TestRESTSubReqPartialResp(t *testing.T) { |
| 4739 | |
| 4740 | // Init counter check |
| 4741 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4742 | Counter{cRestSubReqFromXapp, 1}, |
| 4743 | Counter{cRestSubRespToXapp, 1}, |
| 4744 | Counter{cSubReqToE2, 1}, |
| 4745 | Counter{cSubRespFromE2, 1}, |
| 4746 | Counter{cPartialSubRespFromE2, 1}, |
| 4747 | Counter{cRestSubNotifToXapp, 1}, |
| 4748 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4749 | Counter{cSubDelReqToE2, 1}, |
| 4750 | Counter{cSubDelRespFromE2, 1}, |
| 4751 | Counter{cRestSubDelRespToXapp, 1}, |
| 4752 | }) |
| 4753 | |
| 4754 | // Req |
| 4755 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4756 | |
| 4757 | actionId := int64(2) |
| 4758 | actionType := "report" |
| 4759 | actionDefinition := []int64{5678, 1} |
| 4760 | subsequestActionType := "continue" |
| 4761 | timeToWait := "w10ms" |
| 4762 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4763 | |
| 4764 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4765 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4766 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4767 | |
| 4768 | actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} |
| 4769 | actionNotAdmittedItem.ActionId = 1 |
| 4770 | actionNotAdmittedItem.Cause.Content = 1 |
| 4771 | actionNotAdmittedItem.Cause.Value = 8 |
| 4772 | actionNotAdmittedList := e2ap.ActionNotAdmittedList{} |
| 4773 | actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) |
| 4774 | e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) |
| 4775 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4776 | |
| 4777 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4778 | |
| 4779 | // Del |
| 4780 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4781 | |
| 4782 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4783 | //Wait that subs is cleaned |
| 4784 | waitSubsCleanup(t, e2SubsId, 10) |
| 4785 | |
| 4786 | mainCtrl.VerifyCounterValues(t) |
| 4787 | mainCtrl.VerifyAllClean(t) |
| 4788 | } |
| 4789 | |
| 4790 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4791 | // TestRESTSubDelReqRetryInSubmgr |
| 4792 | // |
| 4793 | // stub stub |
| 4794 | // +-------+ +---------+ +---------+ |
| 4795 | // | xapp | | submgr | | e2term | |
| 4796 | // +-------+ +---------+ +---------+ |
| 4797 | // | | | |
| 4798 | // | [SUBS CREATE] | |
| 4799 | // | | | |
| 4800 | // | | | |
| 4801 | // | RESTSubDelReq | | |
| 4802 | // |---------------->| | |
| 4803 | // | | | |
| 4804 | // | RESTSubDelResp | | |
| 4805 | // |<----------------| | |
| 4806 | // | | SubDelReq | |
| 4807 | // | |------------->| |
| 4808 | // | | | |
| 4809 | // | | SubDelReq | |
| 4810 | // | |------------->| |
| 4811 | // | | | |
| 4812 | // | | SubDelResp | |
| 4813 | // | |<-------------| |
| 4814 | // | | | |
| 4815 | // |
| 4816 | //----------------------------------------------------------------------------- |
| 4817 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4818 | |
| 4819 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4820 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4821 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4822 | Counter{cSubReqToE2, 1}, |
| 4823 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4824 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4825 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4826 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4827 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4828 | Counter{cSubDelReReqToE2, 1}, |
| 4829 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4830 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4831 | }) |
| 4832 | // Req |
| 4833 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4834 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4835 | |
| 4836 | // Del |
| 4837 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4838 | |
| 4839 | // E2t: Receive 1st SubsDelReq |
| 4840 | e2termConn1.RecvSubsDelReq(t) |
| 4841 | |
| 4842 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4843 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4844 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4845 | |
| 4846 | //Wait that subs is cleaned |
| 4847 | waitSubsCleanup(t, e2SubsId, 10) |
| 4848 | |
| 4849 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4850 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4851 | } |
| 4852 | |
| 4853 | //----------------------------------------------------------------------------- |
| 4854 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4855 | // |
| 4856 | // stub stub |
| 4857 | // +-------+ +---------+ +---------+ |
| 4858 | // | xapp | | submgr | | e2term | |
| 4859 | // +-------+ +---------+ +---------+ |
| 4860 | // | | | |
| 4861 | // | [SUBS CREATE] | |
| 4862 | // | | | |
| 4863 | // | | | |
| 4864 | // | RESTSubDelReq | | |
| 4865 | // |---------------->| | |
| 4866 | // | | | |
| 4867 | // | RESTSubDelResp | | |
| 4868 | // |<----------------| | |
| 4869 | // | | SubDelReq | |
| 4870 | // | |------------->| |
| 4871 | // | | | |
| 4872 | // | | SubDelReq | |
| 4873 | // | |------------->| |
| 4874 | // | | | |
| 4875 | // | | | |
| 4876 | // |
| 4877 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4878 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4879 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4880 | |
| 4881 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4882 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4883 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4884 | Counter{cSubReqToE2, 1}, |
| 4885 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4886 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4887 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4888 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4889 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4890 | Counter{cSubDelReReqToE2, 1}, |
| 4891 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4892 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4893 | }) |
| 4894 | |
| 4895 | // Req |
| 4896 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4897 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4898 | |
| 4899 | // Del |
| 4900 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4901 | |
| 4902 | // E2t: Receive 1st SubsDelReq |
| 4903 | e2termConn1.RecvSubsDelReq(t) |
| 4904 | |
| 4905 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4906 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4907 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4908 | |
| 4909 | //Wait that subs is cleaned |
| 4910 | waitSubsCleanup(t, e2SubsId, 10) |
| 4911 | |
| 4912 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4913 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4914 | } |
| 4915 | |
| 4916 | //----------------------------------------------------------------------------- |
| 4917 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4918 | // |
| 4919 | // stub stub |
| 4920 | // +-------+ +---------+ +---------+ |
| 4921 | // | xapp | | submgr | | e2term | |
| 4922 | // +-------+ +---------+ +---------+ |
| 4923 | // | | | |
| 4924 | // | [SUBS CREATE] | |
| 4925 | // | | | |
| 4926 | // | | | |
| 4927 | // | RESTSubDelReq | | |
| 4928 | // |---------------->| | |
| 4929 | // | | | |
| 4930 | // | RESTSubDelResp | | |
| 4931 | // |<----------------| | |
| 4932 | // | | SubDelReq | |
| 4933 | // | |------------->| |
| 4934 | // | | | |
| 4935 | // | | SubDelFail | |
| 4936 | // | |<-------------| |
| 4937 | // | | | |
| 4938 | // |
| 4939 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4940 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4941 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4942 | |
| 4943 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4944 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4945 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4946 | Counter{cSubReqToE2, 1}, |
| 4947 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4948 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4949 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4950 | Counter{cSubDelReqToE2, 1}, |
| 4951 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4952 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4953 | }) |
| 4954 | |
| 4955 | // Req |
| 4956 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4957 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4958 | |
| 4959 | // Del |
| 4960 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4961 | |
| 4962 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4963 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4964 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4965 | |
| 4966 | //Wait that subs is cleaned |
| 4967 | waitSubsCleanup(t, e2SubsId, 10) |
| 4968 | |
| 4969 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4970 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4971 | } |
| 4972 | |
| 4973 | //----------------------------------------------------------------------------- |
| 4974 | // TestRESTSubReqAndSubDelOkSameAction |
| 4975 | // |
| 4976 | // stub stub |
| 4977 | // +-------+ +-------+ +---------+ +---------+ |
| 4978 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4979 | // +-------+ +-------+ +---------+ +---------+ |
| 4980 | // | | | | |
| 4981 | // | | RESTSubReq1 | | |
| 4982 | // | |---------------->| | |
| 4983 | // | | | | |
| 4984 | // | | RESTSubResp1 | | |
| 4985 | // | |<----------------| | |
| 4986 | // | | | | |
| 4987 | // | | | SubReq1 | |
| 4988 | // | | |------------->| |
| 4989 | // | | | SubResp1 | |
| 4990 | // | | |<-------------| |
| 4991 | // | | RESTNotif1 | | |
| 4992 | // | |<----------------| | |
| 4993 | // | | | | |
| 4994 | // | RESTSubReq2 | | |
| 4995 | // |------------------------------>| | |
| 4996 | // | | | | |
| 4997 | // | RESTSubResp2 | | |
| 4998 | // |<------------------------------| | |
| 4999 | // | | | | |
| 5000 | // | | RESTNotif2 | | |
| 5001 | // |<------------------------------| | |
| 5002 | // | | | | |
| 5003 | // | | RESTSubDelReq1 | | |
| 5004 | // | |---------------->| | |
| 5005 | // | | | | |
| 5006 | // | | RESTSubDelResp1 | | |
| 5007 | // | |<----------------| | |
| 5008 | // | | | | |
| 5009 | // | RESTSubDelReq2 | | |
| 5010 | // |------------------------------>| | |
| 5011 | // | | | | |
| 5012 | // | RESTSubDelResp2 | | |
| 5013 | // |<------------------------------| | |
| 5014 | // | | | | |
| 5015 | // | | | SubDelReq2 | |
| 5016 | // | | |------------->| |
| 5017 | // | | | | |
| 5018 | // | | | SubDelResp2 | |
| 5019 | // | | |<-------------| |
| 5020 | // | | | | |
| 5021 | // |
| 5022 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5023 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5024 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5025 | |
| 5026 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5027 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5028 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5029 | Counter{cSubReqToE2, 1}, |
| 5030 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5031 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5032 | Counter{cMergedSubscriptions, 1}, |
| 5033 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5034 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5035 | Counter{cSubDelReqToE2, 1}, |
| 5036 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5037 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5038 | }) |
| 5039 | |
| 5040 | // Req1 |
| 5041 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5042 | |
| 5043 | //Subs Create |
| 5044 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5045 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5046 | |
| 5047 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5048 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5049 | params.SetMeid("RAN_NAME_1") |
| 5050 | |
| 5051 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5052 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5053 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5054 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 5055 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5056 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5057 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5058 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5059 | |
| 5060 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5061 | |
| 5062 | // Del1 |
| 5063 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5064 | |
| 5065 | // Del2 |
| 5066 | deleteXapp2Subscription(t, &restSubId2) |
| 5067 | |
| 5068 | //Wait that subs is cleaned |
| 5069 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5070 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5071 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5072 | } |
| 5073 | |
| 5074 | //----------------------------------------------------------------------------- |
| 5075 | // TestSubReqAndSubDelOkSameActionParallel |
| 5076 | // |
| 5077 | // stub stub stub |
| 5078 | // +-------+ +-------+ +---------+ +---------+ |
| 5079 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5080 | // +-------+ +-------+ +---------+ +---------+ |
| 5081 | // | | | | |
| 5082 | // | | | | |
| 5083 | // | | | | |
| 5084 | // | | SubReq1 | | |
| 5085 | // | |------------->| | |
| 5086 | // | | | | |
| 5087 | // | | | SubReq1 | |
| 5088 | // | | |------------->| |
| 5089 | // | SubReq2 | | |
| 5090 | // |--------------------------->| | |
| 5091 | // | | | SubResp1 | |
| 5092 | // | | |<-------------| |
| 5093 | // | | SubResp1 | | |
| 5094 | // | |<-------------| | |
| 5095 | // | | | SubReq2 | |
| 5096 | // | | |------------->| |
| 5097 | // | | | | |
| 5098 | // | | | SubResp2 | |
| 5099 | // | | |<-------------| |
| 5100 | // | SubResp2 | | |
| 5101 | // |<---------------------------| | |
| 5102 | // | | | | |
| 5103 | // | | SubDelReq 1 | | |
| 5104 | // | |------------->| | |
| 5105 | // | | | | |
| 5106 | // | | SubDelResp 1 | | |
| 5107 | // | |<-------------| | |
| 5108 | // | | | | |
| 5109 | // | SubDelReq 2 | | |
| 5110 | // |--------------------------->| | |
| 5111 | // | | | | |
| 5112 | // | | | SubDelReq 2 | |
| 5113 | // | | |------------->| |
| 5114 | // | | | | |
| 5115 | // | | | SubDelReq 2 | |
| 5116 | // | | |------------->| |
| 5117 | // | | | | |
| 5118 | // | SubDelResp 2 | | |
| 5119 | // |<---------------------------| | |
| 5120 | // |
| 5121 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5122 | |
| 5123 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5124 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5125 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5126 | Counter{cSubReqToE2, 2}, |
| 5127 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5128 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5129 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5130 | Counter{cSubDelReqToE2, 2}, |
| 5131 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5132 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5133 | }) |
| 5134 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5135 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5137 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5138 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5139 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5140 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5141 | |
| 5142 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5143 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5144 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 5145 | |
| 5146 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5147 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 5148 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 5149 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5150 | |
| 5151 | // Del1 |
| 5152 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5153 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5154 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5155 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5156 | |
| 5157 | // Del2 |
| 5158 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5159 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 5160 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 5161 | |
| 5162 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5163 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5164 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5165 | } |
| 5166 | |
| 5167 | //----------------------------------------------------------------------------- |
| 5168 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 5169 | // |
| 5170 | // stub stub stub |
| 5171 | // +-------+ +-------+ +---------+ +---------+ |
| 5172 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5173 | // +-------+ +-------+ +---------+ +---------+ |
| 5174 | // | | | | |
| 5175 | // | | | | |
| 5176 | // | | | | |
| 5177 | // | | RESTSubReq1 | | |
| 5178 | // | |---------------->| | |
| 5179 | // | | | | |
| 5180 | // | | RESTSubResp1 | | |
| 5181 | // | |<----------------| | |
| 5182 | // | | | SubReq1 | |
| 5183 | // | | |------------->| |
| 5184 | // | RESTSubReq2 | | |
| 5185 | // |------------------------------>| | |
| 5186 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5187 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5188 | // |<------------------------------| | |
| 5189 | // | | | SubReq1 | |
| 5190 | // | | |------------->| |
| 5191 | // | | | | |
| 5192 | // | | | | |
| 5193 | // | | | SubDelReq | |
| 5194 | // | | |------------->| |
| 5195 | // | | | | |
| 5196 | // | | | SubDelResp | |
| 5197 | // | | |<-------------| |
| 5198 | // | | RESTNotif1 | | |
| 5199 | // | | unsuccess | | |
| 5200 | // | |<----------------| | |
| 5201 | // | RESTNotif2 | | |
| 5202 | // | | unsuccess | | |
| 5203 | // |<------------------------------| | |
| 5204 | // | | | | |
| 5205 | // | | RESTSubDelReq1 | | |
| 5206 | // | |---------------->| | |
| 5207 | // | | | | |
| 5208 | // | | RESTSubDelResp1 | | |
| 5209 | // | |<----------------| | |
| 5210 | // | | | | |
| 5211 | // | RESTSubDelReq2 | | |
| 5212 | // |------------------------------>| | |
| 5213 | // | | | | |
| 5214 | // | RESTSubDelResp2 | | |
| 5215 | // |<------------------------------| | |
| 5216 | // |
| 5217 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5218 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5219 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5220 | |
| 5221 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5222 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5223 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5224 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5225 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5226 | Counter{cSubReqTimerExpiry, 2}, |
| 5227 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5228 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5229 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5230 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5231 | Counter{cSubDelReqToE2, 1}, |
| 5232 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5233 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5234 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5235 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5236 | |
| 5237 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5238 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5240 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5241 | |
| 5242 | // Req2 |
| 5243 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5244 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5245 | params2.SetMeid("RAN_NAME_1") |
| 5246 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5247 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5248 | |
| 5249 | //Req1 (retransmitted) |
| 5250 | e2termConn1.RecvSubsReq(t) |
| 5251 | |
| 5252 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5253 | |
| 5254 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5255 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5256 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5257 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5258 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5259 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5260 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5261 | |
| 5262 | // Del1 |
| 5263 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5264 | |
| 5265 | // Del2 |
| 5266 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5267 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5268 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5269 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5270 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5271 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5272 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5273 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5274 | } |
| 5275 | |
| 5276 | //----------------------------------------------------------------------------- |
| 5277 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5278 | // |
| 5279 | // stub stub stub |
| 5280 | // +-------+ +-------+ +---------+ +---------+ |
| 5281 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5282 | // +-------+ +-------+ +---------+ +---------+ |
| 5283 | // | | | | |
| 5284 | // | | | | |
| 5285 | // | | | | |
| 5286 | // | | RESTSubReq1 | | |
| 5287 | // | |---------------->| | |
| 5288 | // | | | | |
| 5289 | // | | RESTSubResp1 | | |
| 5290 | // | |<----------------| | |
| 5291 | // | | | SubReq1 | |
| 5292 | // | | |------------->| |
| 5293 | // | RESTSubReq2 | | |
| 5294 | // |------------------------------>| | |
| 5295 | // | | | | |
| 5296 | // | RESTSubDelResp2 | | |
| 5297 | // |<------------------------------| | |
| 5298 | // | | | SubFail1 | |
| 5299 | // | | |<-------------| |
| 5300 | // | | | | |
| 5301 | // | | RESTNotif1 | | |
| 5302 | // | | unsuccess | | |
| 5303 | // | |<----------------| | |
| 5304 | // | RESTNotif2 | | |
| 5305 | // | | unsuccess | | |
| 5306 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5307 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5308 | // | | 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] | 5309 | // | |---------------->| | |
| 5310 | // | | | | |
| 5311 | // | | RESTSubDelResp1 | | |
| 5312 | // | |<----------------| | |
| 5313 | // | | | | |
| 5314 | // | RESTSubDelReq2 | | |
| 5315 | // |------------------------------>| | |
| 5316 | // | | | | |
| 5317 | // | RESTSubDelResp2 | | |
| 5318 | // |<------------------------------| | |
| 5319 | // |
| 5320 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5321 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5322 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5323 | |
| 5324 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5325 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5326 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5327 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5328 | Counter{cSubReqToE2, 1}, |
| 5329 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5330 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5331 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5332 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5333 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5334 | }) |
| 5335 | |
| 5336 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5337 | |
| 5338 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5339 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5340 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5341 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5342 | |
| 5343 | // Req2 |
| 5344 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5345 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5346 | params2.SetMeid("RAN_NAME_1") |
| 5347 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5348 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5349 | |
| 5350 | // E2t: send SubsFail (first) |
| 5351 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5352 | fparams1.Set(crereq1) |
| 5353 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5354 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5355 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5356 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5357 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5358 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5359 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5360 | |
| 5361 | // Del1 |
| 5362 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5363 | |
| 5364 | // Del2 |
| 5365 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5366 | |
| 5367 | //Wait that subs is cleaned |
| 5368 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5369 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5370 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5371 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5372 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5373 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5374 | //----------------------------------------------------------------------------- |
| 5375 | // TestRESTSubReqPolicyAndSubDelOk |
| 5376 | // |
| 5377 | // stub stub |
| 5378 | // +-------+ +---------+ +---------+ |
| 5379 | // | xapp | | submgr | | e2term | |
| 5380 | // +-------+ +---------+ +---------+ |
| 5381 | // | | | |
| 5382 | // | RESTSubReq | | |
| 5383 | // |--------------->| | |
| 5384 | // | RESTSubResp | | |
| 5385 | // |<---------------| | |
| 5386 | // | | | |
| 5387 | // | | SubReq | |
| 5388 | // | |------------->| |
| 5389 | // | | | |
| 5390 | // | | SubResp | |
| 5391 | // | |<-------------| |
| 5392 | // | | | |
| 5393 | // | RESTNotif | | |
| 5394 | // |<---------------| | |
| 5395 | // | | | |
| 5396 | // | | | |
| 5397 | // | RESTSubDelReq | | |
| 5398 | // |--------------->| | |
| 5399 | // | RESTSubDelResp | | |
| 5400 | // |<---------------| | |
| 5401 | // | | | |
| 5402 | // | | SubDelReq | |
| 5403 | // | |------------->| |
| 5404 | // | | | |
| 5405 | // | | SubDelResp | |
| 5406 | // | |<-------------| |
| 5407 | // | | | |
| 5408 | // |
| 5409 | //----------------------------------------------------------------------------- |
| 5410 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5411 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5412 | |
| 5413 | // Init counter check |
| 5414 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5415 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5416 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5417 | Counter{cSubReqToE2, 1}, |
| 5418 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5419 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5420 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5421 | Counter{cSubDelReqToE2, 1}, |
| 5422 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5423 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5424 | }) |
| 5425 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5426 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5427 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5428 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5429 | |
| 5430 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5431 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5432 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5433 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5434 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5435 | |
| 5436 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5437 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5438 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5439 | |
| 5440 | // Wait that subs is cleaned |
| 5441 | waitSubsCleanup(t, e2SubsId, 10) |
| 5442 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5443 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5444 | } |
| 5445 | |
| 5446 | //----------------------------------------------------------------------------- |
| 5447 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5448 | // |
| 5449 | // stub stub |
| 5450 | // +-------+ +---------+ +---------+ |
| 5451 | // | xapp | | submgr | | e2term | |
| 5452 | // +-------+ +---------+ +---------+ |
| 5453 | // | | | |
| 5454 | // | RESTSubReq | | |
| 5455 | // |---------------->| | |
| 5456 | // | | | |
| 5457 | // | RESTSubResp | | |
| 5458 | // |<----------------| | |
| 5459 | // | | SubReq | |
| 5460 | // | |------------->| |
| 5461 | // | | | |
| 5462 | // | | SubResp | |
| 5463 | // | |<-------------| |
| 5464 | // | | | |
| 5465 | // | RESTNotif | | |
| 5466 | // |<----------------| | |
| 5467 | // | | | |
| 5468 | // | RESTSubReq | | |
| 5469 | // |---------------->| | |
| 5470 | // | | | |
| 5471 | // | RESTSubResp | | |
| 5472 | // |<----------------| | |
| 5473 | // | | SubReq | |
| 5474 | // | |------------->| |
| 5475 | // | | | |
| 5476 | // | | SubResp | |
| 5477 | // | |<-------------| |
| 5478 | // | | | |
| 5479 | // | RESTNotif | | |
| 5480 | // |<----------------| | |
| 5481 | // | | | |
| 5482 | // | RESTSubDelReq | | |
| 5483 | // |---------------->| | |
| 5484 | // | | | |
| 5485 | // | | SubDelReq | |
| 5486 | // | |------------->| |
| 5487 | // | | | |
| 5488 | // | | SubDelResp | |
| 5489 | // | |<-------------| |
| 5490 | // | | | |
| 5491 | // | RESTSubDelResp | | |
| 5492 | // |<----------------| | |
| 5493 | // |
| 5494 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5495 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5496 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5497 | |
| 5498 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5499 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5500 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5501 | Counter{cSubReqToE2, 2}, |
| 5502 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5503 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5504 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5505 | Counter{cSubDelReqToE2, 1}, |
| 5506 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5507 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5508 | }) |
| 5509 | |
| 5510 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5511 | const e2Timeout int64 = 1 |
| 5512 | const e2RetryCount int64 = 0 |
| 5513 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5514 | |
| 5515 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5516 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5517 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5518 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5519 | |
| 5520 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5521 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5522 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5523 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5524 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5525 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5526 | params.SetTimeToWait("w200ms") |
| 5527 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5528 | |
| 5529 | // Del |
| 5530 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5531 | |
| 5532 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5533 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5534 | |
| 5535 | // Wait that subs is cleaned |
| 5536 | waitSubsCleanup(t, e2SubsId, 10) |
| 5537 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5538 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5539 | } |
| 5540 | |
| 5541 | //----------------------------------------------------------------------------- |
aditverm | 323c77e | 2023-09-20 09:50:47 +0530 | [diff] [blame] | 5542 | // TestRESTSubReqPolicyChangeNokAndSubDelOk |
| 5543 | // |
| 5544 | // stub stub |
| 5545 | // +-------+ +---------+ +---------+ |
| 5546 | // | xapp | | submgr | | e2term | |
| 5547 | // +-------+ +---------+ +---------+ |
| 5548 | // | | | |
| 5549 | // | RESTSubReq | | |
| 5550 | // |---------------->| | |
| 5551 | // | | | |
| 5552 | // | RESTSubResp | | |
| 5553 | // |<----------------| | |
| 5554 | // | | SubReq | |
| 5555 | // | |------------->| |
| 5556 | // | | | |
| 5557 | // | | SubResp | |
| 5558 | // | |<-------------| |
| 5559 | // | | | |
| 5560 | // | RESTNotif | | |
| 5561 | // |<----------------| | |
| 5562 | // | | | |
| 5563 | // | RESTSubReq | | |
| 5564 | // |---------------->| | |
| 5565 | // | | | |
| 5566 | // | RESTSubResp | | |
| 5567 | // |<----------------| | |
| 5568 | // | | SubReq | |
| 5569 | // | |------------->| |
| 5570 | // | | | |
| 5571 | // | | SubFail | |
| 5572 | // | |<-------------| |
| 5573 | // | | | |
| 5574 | // | RESTNotif | | |
| 5575 | // |<----------------| | |
| 5576 | // | | | |
| 5577 | // | RESTSubDelReq | | |
| 5578 | // |---------------->| | |
| 5579 | // | | | |
| 5580 | // | | SubDelReq | |
| 5581 | // | |------------->| |
| 5582 | // | | | |
| 5583 | // | | SubDelResp | |
| 5584 | // | |<-------------| |
| 5585 | // | | | |
| 5586 | // | RESTSubDelResp | | |
| 5587 | // |<----------------| | |
| 5588 | // |
| 5589 | //----------------------------------------------------------------------------- |
| 5590 | |
| 5591 | func TestRESTSubReqPolicyChangeNokAndSubDelOk(t *testing.T) { |
| 5592 | |
| 5593 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5594 | Counter{cRestSubReqFromXapp, 2}, |
| 5595 | Counter{cRestSubRespToXapp, 2}, |
| 5596 | Counter{cSubReqToE2, 2}, |
| 5597 | Counter{cSubRespFromE2, 1}, |
| 5598 | Counter{cSubFailFromE2, 1}, |
| 5599 | Counter{cRestSubNotifToXapp, 1}, |
| 5600 | Counter{cRestSubFailNotifToXapp, 1}, |
| 5601 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5602 | Counter{cSubDelReqToE2, 1}, |
| 5603 | Counter{cSubDelRespFromE2, 1}, |
| 5604 | Counter{cRestSubDelRespToXapp, 1}, |
| 5605 | }) |
| 5606 | |
| 5607 | const subReqCount int = 1 |
| 5608 | const e2Timeout int64 = 1 |
| 5609 | const e2RetryCount int64 = 0 |
| 5610 | const routingNeeded bool = false |
| 5611 | |
| 5612 | // Req |
| 5613 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5614 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5615 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5616 | fmt.Printf("restSubId: %v", restSubId) |
| 5617 | |
| 5618 | // Policy change |
| 5619 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
| 5620 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5621 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5622 | params.SetSubscriptionID(&restSubId) |
| 5623 | params.SetTimeToWait("w200ms") |
| 5624 | |
| 5625 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 5626 | fmt.Printf("restSubId: %v", restSubId) |
| 5627 | |
| 5628 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5629 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
| 5630 | |
| 5631 | // Gnb sends RICSubscriptionFailure |
| 5632 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5633 | fparams.Set(crereq) |
| 5634 | fparams.SetCauseVal(0, 1, 5) // CauseRIC / function-resource-limit |
| 5635 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5636 | |
| 5637 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5638 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5639 | |
| 5640 | // Del |
| 5641 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5642 | |
| 5643 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5644 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5645 | |
| 5646 | // Wait that subs is cleaned |
| 5647 | waitSubsCleanup(t, e2SubsId, 10) |
| 5648 | mainCtrl.VerifyCounterValues(t) |
| 5649 | mainCtrl.VerifyAllClean(t) |
| 5650 | } |
| 5651 | |
| 5652 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5653 | // TestRESTSubReqPolicyChangeNOk |
| 5654 | // |
| 5655 | // stub stub |
| 5656 | // +-------+ +---------+ +---------+ |
| 5657 | // | xapp | | submgr | | e2term | |
| 5658 | // +-------+ +---------+ +---------+ |
| 5659 | // | | | |
| 5660 | // | RESTSubReq | | |
| 5661 | // |---------------->| | |
| 5662 | // | | | |
| 5663 | // | RESTSubResp | | |
| 5664 | // |<----------------| | |
| 5665 | // | | SubReq | |
| 5666 | // | |------------->| |
| 5667 | // | | | |
| 5668 | // | | SubResp | |
| 5669 | // | |<-------------| |
| 5670 | // | | | |
| 5671 | // | RESTNotif | | |
| 5672 | // |<----------------| | |
| 5673 | // | | | |
| 5674 | // | RESTSubReq | | |
| 5675 | // |---------------->| | |
| 5676 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5677 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5678 | // | | | |
| 5679 | // | RESTSubDelReq | | |
| 5680 | // |---------------->| | |
| 5681 | // | | | |
| 5682 | // | | SubDelReq | |
| 5683 | // | |------------->| |
| 5684 | // | | | |
| 5685 | // | | SubDelResp | |
| 5686 | // | |<-------------| |
| 5687 | // | | | |
| 5688 | // | RESTSubDelResp | | |
| 5689 | // |<----------------| | |
| 5690 | // |
| 5691 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5692 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5693 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5694 | |
| 5695 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5696 | Counter{cRestSubReqFromXapp, 2}, |
| 5697 | Counter{cRestSubRespToXapp, 1}, |
| 5698 | Counter{cSubReqToE2, 1}, |
| 5699 | Counter{cSubRespFromE2, 1}, |
| 5700 | Counter{cRestSubNotifToXapp, 1}, |
| 5701 | Counter{cRestSubFailToXapp, 1}, |
| 5702 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5703 | Counter{cSubDelReqToE2, 1}, |
| 5704 | Counter{cSubDelRespFromE2, 1}, |
| 5705 | Counter{cRestSubDelRespToXapp, 1}, |
| 5706 | }) |
| 5707 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5708 | // Req |
| 5709 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5710 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5711 | |
| 5712 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5713 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5714 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5715 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5716 | params.SetSubscriptionID(&restSubIdUpd) |
| 5717 | params.SetTimeToWait("w200ms") |
| 5718 | |
| 5719 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5720 | assert.Equal(t, restSubId2, "") |
| 5721 | |
| 5722 | // Del |
| 5723 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5724 | |
| 5725 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5726 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5727 | |
| 5728 | // Wait that subs is cleaned |
| 5729 | waitSubsCleanup(t, e2SubsId, 10) |
| 5730 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5731 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5732 | } |
| 5733 | |
| 5734 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5735 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5736 | // |
| 5737 | // stub stub stub |
| 5738 | // +-------+ +---------+ +---------+ +---------+ |
| 5739 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5740 | // +-------+ +---------+ +---------+ +---------+ |
| 5741 | // | | | | |
| 5742 | // | | | | |
| 5743 | // | | | | |
| 5744 | // | RESTSubReq1 | | | |
| 5745 | // |---------------->| | | |
| 5746 | // | | | | |
| 5747 | // | RESTSubResp1 | | | |
| 5748 | // |<----------------| | | |
| 5749 | // | | SubReq1 | | |
| 5750 | // | |------------->| | |
| 5751 | // | | | | |
| 5752 | // | RESTSubReq2 | | | |
| 5753 | // |---------------->| | | |
| 5754 | // | | | | |
| 5755 | // | RESTSubResp2 | | | |
| 5756 | // |<----------------| | | |
| 5757 | // | | SubReq2 | | |
| 5758 | // | |---------------------------->| |
| 5759 | // | | | | |
| 5760 | // | | SubResp1 | | |
| 5761 | // | |<-------------| | |
| 5762 | // | RESTNotif1 | | | |
| 5763 | // |<----------------| | | |
| 5764 | // | | SubResp2 | | |
| 5765 | // | |<----------------------------| |
| 5766 | // | RESTNotif2 | | | |
| 5767 | // |<----------------| | | |
| 5768 | // | | | | |
| 5769 | // | [SUBS 1 DELETE] | | |
| 5770 | // | | | | |
| 5771 | // | [SUBS 2 DELETE] | | |
| 5772 | // | | | | |
| 5773 | // |
| 5774 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5775 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5776 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5777 | |
| 5778 | // Init counter check |
| 5779 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5780 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5781 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5782 | Counter{cSubReqToE2, 2}, |
| 5783 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5784 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5785 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5786 | Counter{cSubDelReqToE2, 2}, |
| 5787 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5788 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5789 | }) |
| 5790 | |
| 5791 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5792 | |
| 5793 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5794 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5795 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5796 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5797 | |
| 5798 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5799 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5800 | params.SetMeid("RAN_NAME_11") |
| 5801 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5802 | // would not work as notification would not be received |
| 5803 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5804 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5805 | |
| 5806 | // Resp1 |
| 5807 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5808 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5809 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5810 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5811 | |
| 5812 | // Resp2 |
| 5813 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5814 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5815 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5816 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5817 | |
| 5818 | // Delete1 |
| 5819 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5820 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5821 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5822 | |
| 5823 | // Wait that subs is cleaned |
| 5824 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5825 | |
| 5826 | // Delete2 |
| 5827 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5828 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5829 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5830 | |
| 5831 | // Wait that subs is cleaned |
| 5832 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5833 | |
| 5834 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5835 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5836 | } |
| 5837 | |
| 5838 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5839 | // TestRESTSubReqInsertAndSubDelOk |
| 5840 | // |
| 5841 | // stub stub |
| 5842 | // +-------+ +---------+ +---------+ |
| 5843 | // | xapp | | submgr | | e2term | |
| 5844 | // +-------+ +---------+ +---------+ |
| 5845 | // | | | |
| 5846 | // | RestSubReq | | |
| 5847 | // |---------------->| | |
| 5848 | // | | | |
| 5849 | // | RESTSubResp | | |
| 5850 | // |<----------------| | |
| 5851 | // | | | |
| 5852 | // | | SubReq | |
| 5853 | // | |------------->| |
| 5854 | // | | | |
| 5855 | // | | SubResp | |
| 5856 | // | |<-------------| |
| 5857 | // | RESTNotif | | |
| 5858 | // |<----------------| | |
| 5859 | // | ... | ... | |
| 5860 | // | | | |
| 5861 | // | RESTSubDelReq | | |
| 5862 | // |---------------->| | |
| 5863 | // | | | |
| 5864 | // | | SubDelReq | |
| 5865 | // | |------------->| |
| 5866 | // | | | |
| 5867 | // | | SubDelResp | |
| 5868 | // | |<-------------| |
| 5869 | // | | | |
| 5870 | // | RESTSubDelResp| | |
| 5871 | // |<----------------| | |
| 5872 | // |
| 5873 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5874 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5875 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5876 | |
| 5877 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5878 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5879 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5880 | Counter{cSubReqToE2, 1}, |
| 5881 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5882 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5883 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5884 | Counter{cSubDelReqToE2, 1}, |
| 5885 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5886 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5887 | }) |
| 5888 | |
| 5889 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5890 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5891 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5892 | params.SetSubActionTypes("insert") |
| 5893 | |
| 5894 | // Req |
| 5895 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5896 | |
| 5897 | // Del |
| 5898 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5899 | |
| 5900 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5901 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5902 | |
| 5903 | // Wait that subs is cleaned |
| 5904 | waitSubsCleanup(t, e2SubsId, 10) |
| 5905 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5906 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5907 | } |
| 5908 | |
| 5909 | //----------------------------------------------------------------------------- |
| 5910 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5911 | // |
| 5912 | // stub stub |
| 5913 | // +-------+ +---------+ +---------+ |
| 5914 | // | xapp | | submgr | | e2term | |
| 5915 | // +-------+ +---------+ +---------+ |
| 5916 | // | | | |
| 5917 | // | RESTSubReq | | |
| 5918 | // |------------->| | |
| 5919 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5920 | // | RESTSubResp | | |
| 5921 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5922 | // | | SubReq | |
| 5923 | // | |------------->| |
| 5924 | // | | | |
| 5925 | // | | SubResp | |
| 5926 | // | <----| |
| 5927 | // | | |
| 5928 | // | Submgr restart | |
| 5929 | // | | |
| 5930 | // | | | |
| 5931 | // | | SubDelReq | |
| 5932 | // | |------------->| |
| 5933 | // | | | |
| 5934 | // | | SubDelResp | |
| 5935 | // | |<-------------| |
| 5936 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5937 | // | RESTNotif | | |
| 5938 | // | unsuccess | | |
| 5939 | // |<-------------| | |
| 5940 | // | | | |
| 5941 | // | RESTSubDelReq| | |
| 5942 | // |------------->| | |
| 5943 | // | | | |
| 5944 | // |RESTSubDelResp| | |
| 5945 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5946 | // |
| 5947 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5948 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5949 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5950 | |
| 5951 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5952 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5953 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5954 | Counter{cSubReqToE2, 1}, |
| 5955 | Counter{cSubDelReqFromXapp, 1}, |
| 5956 | Counter{cSubDelReqToE2, 1}, |
| 5957 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5958 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5959 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5960 | }) |
| 5961 | |
| 5962 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5963 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5964 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5965 | |
| 5966 | //Req |
| 5967 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5968 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5969 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5970 | |
| 5971 | e2termConn1.RecvSubsReq(t) |
| 5972 | |
| 5973 | mainCtrl.SetResetTestFlag(t, false) |
| 5974 | |
| 5975 | mainCtrl.SimulateRestart(t) |
| 5976 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5977 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5978 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5979 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5980 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5981 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5982 | //Del |
| 5983 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5984 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5985 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5986 | e2termConn1.TestMsgChanEmpty(t) |
| 5987 | mainCtrl.wait_registry_empty(t, 10) |
| 5988 | |
| 5989 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5990 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5991 | } |
| 5992 | |
| 5993 | //----------------------------------------------------------------------------- |
| 5994 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5995 | // |
| 5996 | // stub stub |
| 5997 | // +-------+ +---------+ +---------+ |
| 5998 | // | xapp | | submgr | | e2term | |
| 5999 | // +-------+ +---------+ +---------+ |
| 6000 | // | | | |
| 6001 | // | RESTSubReq | | |
| 6002 | // |---------------->| | |
| 6003 | // | | | |
| 6004 | // | RESTSubResp | | |
| 6005 | // |<----------------| | |
| 6006 | // | | SubReq | |
| 6007 | // | |------------->| |
| 6008 | // | | | |
| 6009 | // | | SubResp | |
| 6010 | // | |<-------------| |
| 6011 | // | | | |
| 6012 | // | RESTNotif | | |
| 6013 | // |<----------------| | |
| 6014 | // | | | |
| 6015 | // | | |
| 6016 | // | Submgr restart | |
| 6017 | // | | | |
| 6018 | // | RESTSubDelReq | | |
| 6019 | // |---------------->| | |
| 6020 | // | | | |
| 6021 | // | | SubDelReq | |
| 6022 | // | |------------->| |
| 6023 | // | | | |
| 6024 | // | | SubDelResp | |
| 6025 | // | |<-------------| |
| 6026 | // | | | |
| 6027 | // | RESTSubDelResp | | |
| 6028 | // |<----------------| | |
| 6029 | // |
| 6030 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6031 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6032 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6033 | |
| 6034 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6035 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6036 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6037 | Counter{cSubReqToE2, 1}, |
| 6038 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6039 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6040 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6041 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 6042 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6043 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6044 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6045 | |
| 6046 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6047 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6048 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6049 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6050 | |
| 6051 | // Check subscription |
| 6052 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6053 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6054 | mainCtrl.SimulateRestart(t) |
| 6055 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6056 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6057 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6058 | // That needs to be completed before successful subscription query is possible |
| 6059 | <-time.After(time.Second * 1) |
| 6060 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6061 | // Check subscription |
| 6062 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6063 | |
| 6064 | // Delete subscription |
| 6065 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 6066 | |
| 6067 | //Wait that subs is cleaned |
| 6068 | waitSubsCleanup(t, e2SubsId, 10) |
| 6069 | |
| 6070 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6071 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6072 | } |
| 6073 | |
| 6074 | //----------------------------------------------------------------------------- |
| 6075 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 6076 | // |
| 6077 | // stub stub |
| 6078 | // +-------+ +-------+ +---------+ +---------+ |
| 6079 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6080 | // +-------+ +-------+ +---------+ +---------+ |
| 6081 | // | | | | |
| 6082 | // | | RESTSubReq1 | | |
| 6083 | // | |---------------->| | |
| 6084 | // | | | | |
| 6085 | // | | RESTSubResp1 | | |
| 6086 | // | |<----------------| | |
| 6087 | // | | | | |
| 6088 | // | | | SubReq1 | |
| 6089 | // | | |------------->| |
| 6090 | // | | | SubResp1 | |
| 6091 | // | | |<-------------| |
| 6092 | // | | RESTNotif1 | | |
| 6093 | // | |<----------------| | |
| 6094 | // | | | | |
| 6095 | // | RESTSubReq2 | | |
| 6096 | // |------------------------------>| | |
| 6097 | // | | | | |
| 6098 | // | RESTSubResp2 | | |
| 6099 | // |<------------------------------| | |
| 6100 | // | | | | |
| 6101 | // | | RESTNotif2 | | |
| 6102 | // |<------------------------------| | |
| 6103 | // | | | | |
| 6104 | // | | Submgr restart | |
| 6105 | // | | | | |
| 6106 | // | | RESTSubDelReq1 | | |
| 6107 | // | |---------------->| | |
| 6108 | // | | | | |
| 6109 | // | | RESTSubDelResp1 | | |
| 6110 | // | |<----------------| | |
| 6111 | // | | | | |
| 6112 | // | | Submgr restart | |
| 6113 | // | | | | |
| 6114 | // | RESTSubDelReq2 | | |
| 6115 | // |------------------------------>| | |
| 6116 | // | | | | |
| 6117 | // | RESTSubDelResp2 | | |
| 6118 | // |<------------------------------| | |
| 6119 | // | | | | |
| 6120 | // | | | SubDelReq2 | |
| 6121 | // | | |------------->| |
| 6122 | // | | | | |
| 6123 | // | | | SubDelResp2 | |
| 6124 | // | | |<-------------| |
| 6125 | // | | | | |
| 6126 | // |
| 6127 | //----------------------------------------------------------------------------- |
| 6128 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6129 | |
| 6130 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6131 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6132 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6133 | Counter{cSubReqToE2, 1}, |
| 6134 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6135 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6136 | Counter{cMergedSubscriptions, 1}, |
| 6137 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6138 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6139 | Counter{cSubDelReqToE2, 1}, |
| 6140 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6141 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6142 | }) |
| 6143 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6144 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6145 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6146 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6147 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6148 | |
| 6149 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6150 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6151 | params.SetMeid("RAN_NAME_1") |
| 6152 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6153 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6154 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6155 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6156 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6157 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6158 | |
| 6159 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 6160 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6161 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6162 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 6163 | |
| 6164 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6165 | // That needs to be completed before successful subscription delete is possible |
| 6166 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6167 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6168 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6169 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 6170 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6171 | // 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] | 6172 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6173 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6174 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 6175 | |
| 6176 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6177 | // That needs to be completed before successful subscription query is possible |
| 6178 | <-time.After(time.Second * 1) |
| 6179 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6180 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 6181 | |
| 6182 | // Delete subscription 2 |
| 6183 | deleteXapp2Subscription(t, &restSubId2) |
| 6184 | |
| 6185 | //Wait that subs is cleaned |
| 6186 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6187 | |
| 6188 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6189 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6190 | } |
| 6191 | |
| 6192 | //----------------------------------------------------------------------------- |
| 6193 | // TestRESTReportSubReqAndSubDelOk |
| 6194 | // |
| 6195 | // stub stub |
| 6196 | // +-------+ +---------+ +---------+ |
| 6197 | // | xapp | | submgr | | e2term | |
| 6198 | // +-------+ +---------+ +---------+ |
| 6199 | // | | | |
| 6200 | // | RestSubReq | | |
| 6201 | // |---------------->| | |
| 6202 | // | | | |
| 6203 | // | RESTSubResp | | |
| 6204 | // |<----------------| | |
| 6205 | // | | | |
| 6206 | // | | SubReq | |
| 6207 | // | |------------->| |
| 6208 | // | | | |
| 6209 | // | | SubResp | |
| 6210 | // | |<-------------| |
| 6211 | // | RESTNotif | | |
| 6212 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6213 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6214 | // | |------------->| |
| 6215 | // | | | |
| 6216 | // | | SubResp | |
| 6217 | // | |<-------------| |
| 6218 | // | RESTNotif | | |
| 6219 | // |<----------------| | |
| 6220 | // | ... | ... | |
| 6221 | // | | | |
| 6222 | // | | | |
| 6223 | // | RESTSubDelReq | | |
| 6224 | // |---------------->| | |
| 6225 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6226 | // | RESTSubDelResp| | |
| 6227 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6228 | // | | SubDelReq | |
| 6229 | // | |------------->| |
| 6230 | // | | | |
| 6231 | // | | SubDelResp | |
| 6232 | // | |<-------------| |
| 6233 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6234 | // |
| 6235 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6236 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6237 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6238 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6239 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6240 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6241 | } |
| 6242 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6243 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6244 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6245 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6246 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6247 | Counter{cRestSubReqFromXapp, 1}, |
| 6248 | Counter{cRestSubRespToXapp, 1}, |
| 6249 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6250 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 6251 | Counter{cRestSubNotifToXapp, 1}, |
| 6252 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6253 | Counter{cRestSubDelRespToXapp, 1}, |
| 6254 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6255 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 6256 | }) |
| 6257 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6258 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6259 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6260 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6261 | |
| 6262 | var e2SubsId []uint32 |
| 6263 | for i := 0; i < subReqCount; i++ { |
| 6264 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6265 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6266 | |
| 6267 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6268 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6269 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6270 | e2SubsId = append(e2SubsId, instanceId) |
| 6271 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6272 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 6273 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 6274 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 6275 | |
| 6276 | } |
| 6277 | |
| 6278 | // Del |
| 6279 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6280 | |
| 6281 | for i := 0; i < subReqCount; i++ { |
| 6282 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6283 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6284 | } |
| 6285 | |
| 6286 | // Wait that subs is cleaned |
| 6287 | for i := 0; i < subReqCount; i++ { |
| 6288 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6289 | } |
| 6290 | |
| 6291 | xappConn1.TestMsgChanEmpty(t) |
| 6292 | e2termConn1.TestMsgChanEmpty(t) |
| 6293 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6294 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6295 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6296 | } |
| 6297 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6298 | //----------------------------------------------------------------------------- |
| 6299 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6300 | // |
| 6301 | // stub stub |
| 6302 | // +-------+ +---------+ +---------+ |
| 6303 | // | xapp | | submgr | | e2term | |
| 6304 | // +-------+ +---------+ +---------+ |
| 6305 | // | | | |
| 6306 | // | RestSubReq | | |
| 6307 | // |---------------->| | |
| 6308 | // | | | |
| 6309 | // | RESTSubResp | | |
| 6310 | // |<----------------| | |
| 6311 | // | | | |
| 6312 | // | | SubReq | |
| 6313 | // | |------------->| |
| 6314 | // | | | |
| 6315 | // | | SubResp | |
| 6316 | // | |<-------------| |
| 6317 | // | RESTNotif | | |
| 6318 | // |<----------------| | |
| 6319 | // | | SubReq | |
| 6320 | // | |------------->| |
| 6321 | // | | | |
| 6322 | // | | SubResp | |
| 6323 | // | |<-------------| |
| 6324 | // | RESTNotif | | |
| 6325 | // |<----------------| | |
| 6326 | // | | | |
| 6327 | // | RESTSubDelReq | | |
| 6328 | // |---------------->| | |
| 6329 | // | | | |
| 6330 | // | RESTSubDelResp| | |
| 6331 | // |<----------------| | |
| 6332 | // | | SubDelReq | |
| 6333 | // | |------------->| |
| 6334 | // | | | |
| 6335 | // | | SubDelResp | |
| 6336 | // | |<-------------| |
| 6337 | // | | | |
| 6338 | // | | SubDelReq | |
| 6339 | // | |------------->| |
| 6340 | // | | | |
| 6341 | // | | SubDelResp | |
| 6342 | // | |<-------------| |
| 6343 | // | | | |
| 6344 | // |
| 6345 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6346 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6347 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6348 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6349 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6350 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6351 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6352 | Counter{cSubReqToE2, 2}, |
| 6353 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6354 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6355 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6356 | Counter{cSubDelReqToE2, 2}, |
| 6357 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6358 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6359 | }) |
| 6360 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6361 | const subReqCount int = 2 |
| 6362 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6363 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6364 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6365 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6366 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6367 | |
| 6368 | assert.Equal(t, len(e2SubsIds), 2) |
| 6369 | |
| 6370 | // Del |
| 6371 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6372 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6373 | |
| 6374 | xappConn1.TestMsgChanEmpty(t) |
| 6375 | e2termConn1.TestMsgChanEmpty(t) |
| 6376 | mainCtrl.wait_registry_empty(t, 10) |
| 6377 | |
| 6378 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6379 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6380 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6381 | |
| 6382 | //----------------------------------------------------------------------------- |
| 6383 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6384 | // |
| 6385 | // stub stub |
| 6386 | // +-------+ +---------+ +---------+ |
| 6387 | // | xapp | | submgr | | e2term | |
| 6388 | // +-------+ +---------+ +---------+ |
| 6389 | // | | | |
| 6390 | // | RestSubReq | | |
| 6391 | // |---------------->| | |
| 6392 | // | | | |
| 6393 | // | RESTSubResp | | |
| 6394 | // |<----------------| | |
| 6395 | // | | | ------ |
| 6396 | // | | SubReq | |
| 6397 | // | |------------->| |
| 6398 | // | | | E2 subscription x 19 |
| 6399 | // | | SubResp | |
| 6400 | // | |<-------------| |
| 6401 | // | RESTNotif | | |
| 6402 | // |<----------------| | |
| 6403 | // | | | ------ |
| 6404 | // | RESTSubDelReq | | |
| 6405 | // |---------------->| | |
| 6406 | // | | | |
| 6407 | // | RESTSubDelResp| | |
| 6408 | // |<----------------| | |
| 6409 | // | | SubDelReq | ------ |
| 6410 | // | |------------->| |
| 6411 | // | | | E2 subscription delete x 19 |
| 6412 | // | | SubDelResp | |
| 6413 | // | |<-------------| |
| 6414 | // | | | ------ |
| 6415 | // | | | |
| 6416 | // |
| 6417 | //----------------------------------------------------------------------------- |
| 6418 | |
| 6419 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6420 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6421 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6422 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6423 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6424 | Counter{cSubReqToE2, 19}, |
| 6425 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6426 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6427 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6428 | Counter{cSubDelReqToE2, 19}, |
| 6429 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6430 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6431 | }) |
| 6432 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6433 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6434 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6435 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6436 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6437 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6438 | |
| 6439 | assert.Equal(t, len(e2SubsIds), 19) |
| 6440 | |
| 6441 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6442 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6443 | |
| 6444 | xappConn1.TestMsgChanEmpty(t) |
| 6445 | e2termConn1.TestMsgChanEmpty(t) |
| 6446 | mainCtrl.wait_registry_empty(t, 10) |
| 6447 | |
| 6448 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6449 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6450 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6451 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6452 | //----------------------------------------------------------------------------- |
| 6453 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6454 | // |
| 6455 | // stub stub |
| 6456 | // +-------+ +---------+ +---------+ |
| 6457 | // | xapp | | submgr | | e2term | |
| 6458 | // +-------+ +---------+ +---------+ |
| 6459 | // | | | |
| 6460 | // | RestSubReq | | |
| 6461 | // |---------------->| | |
| 6462 | // | | | |
| 6463 | // | RESTSubResp | | |
| 6464 | // |<----------------| | |
| 6465 | // | | | |
| 6466 | // | | SubReq | |
| 6467 | // | |------------->| |
| 6468 | // | | | |
| 6469 | // | | SubResp | |
| 6470 | // | |<-------------| |
| 6471 | // | RESTNotif | | |
| 6472 | // |<----------------| | |
| 6473 | // | | SubReq | |
| 6474 | // | |------------->| |
| 6475 | // | | | |
| 6476 | // | | SubResp | |
| 6477 | // | |<-------------| |
| 6478 | // | RESTNotif | | |
| 6479 | // |<----------------| | |
| 6480 | // | | | |
| 6481 | // | RESTSubDelReq | | |
| 6482 | // |---------------->| | |
| 6483 | // | | | |
| 6484 | // | RESTSubDelResp| | |
| 6485 | // |<----------------| | |
| 6486 | // | | SubDelReq | |
| 6487 | // | |------------->| |
| 6488 | // | | | |
| 6489 | // | | SubDelResp | |
| 6490 | // | |<-------------| |
| 6491 | // | | | |
| 6492 | // | | SubDelReq | |
| 6493 | // | |------------->| |
| 6494 | // | | | |
| 6495 | // | | SubDelResp | |
| 6496 | // | |<-------------| |
| 6497 | // | | | |
| 6498 | // |
| 6499 | //----------------------------------------------------------------------------- |
| 6500 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6501 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6502 | |
| 6503 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6504 | |
| 6505 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6506 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6507 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6508 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6509 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6510 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6511 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6512 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6513 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6514 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6515 | }) |
| 6516 | |
| 6517 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6518 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6519 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6520 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6521 | |
| 6522 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6523 | |
| 6524 | // Del |
| 6525 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6526 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6527 | |
| 6528 | xappConn1.TestMsgChanEmpty(t) |
| 6529 | e2termConn1.TestMsgChanEmpty(t) |
| 6530 | mainCtrl.wait_registry_empty(t, 10) |
| 6531 | |
| 6532 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6533 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6534 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6535 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6536 | //----------------------------------------------------------------------------- |
| 6537 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6538 | // |
| 6539 | // stub stub |
| 6540 | // +-------+ +---------+ +---------+ |
| 6541 | // | xapp | | submgr | | e2term | |
| 6542 | // +-------+ +---------+ +---------+ |
| 6543 | // | | | |
| 6544 | // | RestSubReq | | |
| 6545 | // |---------------->| | |
| 6546 | // | | | |
| 6547 | // | RESTSubResp | | |
| 6548 | // |<----------------| | |
| 6549 | // | | | |
| 6550 | // | | SubReq | |
| 6551 | // | |------------->| |
| 6552 | // | | | |
| 6553 | // | | SubResp | |
| 6554 | // | |<-------------| |
| 6555 | // | RESTNotif | | |
| 6556 | // |<----------------| | |
| 6557 | // | | SubReq | |
| 6558 | // | |------------->| |
| 6559 | // | | | |
| 6560 | // | | SubResp | |
| 6561 | // | |<-------------| |
| 6562 | // | RESTNotif | | |
| 6563 | // |<----------------| | |
| 6564 | // | | | |
| 6565 | // | RESTSubDelReq | | |
| 6566 | // |---------------->| | |
| 6567 | // | | | |
| 6568 | // | RESTSubDelResp| | |
| 6569 | // |<----------------| | |
| 6570 | // | | SubDelReq | |
| 6571 | // | |------------->| |
| 6572 | // | | | |
| 6573 | // | | SubDelResp | |
| 6574 | // | |<-------------| |
| 6575 | // | | | |
| 6576 | // | | SubDelReq | |
| 6577 | // | |------------->| |
| 6578 | // | | | |
| 6579 | // | | SubDelResp | |
| 6580 | // | |<-------------| |
| 6581 | // | | | |
| 6582 | // |
| 6583 | //----------------------------------------------------------------------------- |
| 6584 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6585 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6586 | |
| 6587 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6588 | |
| 6589 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6590 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6591 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6592 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6593 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6594 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6595 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6596 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6597 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6598 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6599 | }) |
| 6600 | |
| 6601 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6602 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6603 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6604 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6605 | |
| 6606 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6607 | |
| 6608 | // Del |
| 6609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6610 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6611 | |
| 6612 | xappConn1.TestMsgChanEmpty(t) |
| 6613 | e2termConn1.TestMsgChanEmpty(t) |
| 6614 | mainCtrl.wait_registry_empty(t, 10) |
| 6615 | |
| 6616 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6617 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6618 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6619 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6620 | //----------------------------------------------------------------------------- |
| 6621 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6622 | // |
| 6623 | // stub stub |
| 6624 | // +-------+ +---------+ +---------+ |
| 6625 | // | xapp | | submgr | | e2term | |
| 6626 | // +-------+ +---------+ +---------+ |
| 6627 | // | | | |
| 6628 | // | RestSubReq | | |
| 6629 | // |---------------->| | |
| 6630 | // | | | |
| 6631 | // | RESTSubResp | | |
| 6632 | // |<----------------| | |
| 6633 | // | | | ------ |
| 6634 | // | | SubReq | |
| 6635 | // | |------------->| |
| 6636 | // | | | E2 subscription x 19 |
| 6637 | // | | SubResp | |
| 6638 | // | |<-------------| |
| 6639 | // | RESTNotif | | |
| 6640 | // |<----------------| | |
| 6641 | // | | | ------ |
| 6642 | // | RESTSubDelReq | | |
| 6643 | // |---------------->| | |
| 6644 | // | | | |
| 6645 | // | RESTSubDelResp| | |
| 6646 | // |<----------------| | |
| 6647 | // | | SubDelReq | ------ |
| 6648 | // | |------------->| |
| 6649 | // | | | E2 subscription delete x 19 |
| 6650 | // | | SubDelResp | |
| 6651 | // | |<-------------| |
| 6652 | // | | | ------ |
| 6653 | // | | | |
| 6654 | // |
| 6655 | //----------------------------------------------------------------------------- |
| 6656 | |
| 6657 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6658 | |
| 6659 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6660 | |
| 6661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6662 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6663 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6664 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6665 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6666 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6667 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6668 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6669 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6670 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6671 | }) |
| 6672 | |
| 6673 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6674 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6675 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6676 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6677 | |
| 6678 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6679 | |
| 6680 | // Del |
| 6681 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6682 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6683 | |
| 6684 | xappConn1.TestMsgChanEmpty(t) |
| 6685 | e2termConn1.TestMsgChanEmpty(t) |
| 6686 | mainCtrl.wait_registry_empty(t, 10) |
| 6687 | |
| 6688 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6689 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6690 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6691 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6692 | //----------------------------------------------------------------------------- |
| 6693 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6694 | // |
| 6695 | // stub stub stub |
| 6696 | // +-------+ +-------+ +---------+ +---------+ |
| 6697 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6698 | // +-------+ +-------+ +---------+ +---------+ |
| 6699 | // | | | | |
| 6700 | // | | RESTSubReq1 | | |
| 6701 | // | |------------->| | |
| 6702 | // | | RESTSubResp1 | | |
| 6703 | // | |<-------------| | |
| 6704 | // | | | | |
| 6705 | // | | | SubReq1 | |
| 6706 | // | | |------------->| |
| 6707 | // | | | | |
| 6708 | // | RESTSubReq2 | | |
| 6709 | // |------------------------>| | |
| 6710 | // | RESTSubResp2 | | |
| 6711 | // |<------------------------| | |
| 6712 | // | | | | |
| 6713 | // | | | SubReq2 | |
| 6714 | // | | |------------->| |
| 6715 | // | | | | |
| 6716 | // | | | SubResp1 | |
| 6717 | // | | |<-------------| |
| 6718 | // | | RESTNotif1 | | |
| 6719 | // | |<-------------| | |
| 6720 | // | | | | |
| 6721 | // | | | SubResp2 | |
| 6722 | // | | |<-------------| |
| 6723 | // | RESTNotif2 | | |
| 6724 | // |<------------------------| | |
| 6725 | // | | | | |
| 6726 | // | | [SUBS 1 DELETE] | |
| 6727 | // | | | | |
| 6728 | // | | [SUBS 2 DELETE] | |
| 6729 | // | | | | |
| 6730 | // |
| 6731 | //----------------------------------------------------------------------------- |
| 6732 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6733 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6734 | |
| 6735 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6736 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6737 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6738 | Counter{cSubReqToE2, 2}, |
| 6739 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6740 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6741 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6742 | Counter{cSubDelReqToE2, 2}, |
| 6743 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6744 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6745 | }) |
| 6746 | |
| 6747 | // Req1 |
| 6748 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6749 | |
| 6750 | //Subs Create |
| 6751 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6752 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6753 | |
| 6754 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6755 | |
| 6756 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6757 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6758 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6759 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6760 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6761 | |
| 6762 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6763 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6764 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6765 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6766 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6767 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6768 | |
| 6769 | deleteXapp1Subscription(t, &restSubId1) |
| 6770 | deleteXapp2Subscription(t, &restSubId2) |
| 6771 | |
| 6772 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6773 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6774 | |
| 6775 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6776 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6777 | } |
| 6778 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6779 | //----------------------------------------------------------------------------- |
| 6780 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6781 | // |
| 6782 | // stub stub stub |
| 6783 | // +-------+ +-------+ +---------+ +---------+ |
| 6784 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6785 | // +-------+ +-------+ +---------+ +---------+ |
| 6786 | // | | | | |
| 6787 | // | | RESTSubReq1 | | |
| 6788 | // | |------------->| | |
| 6789 | // | | RESTSubResp1 | | |
| 6790 | // | |<-------------| | |
| 6791 | // | | | | |
| 6792 | // | | | SubReq1 | |
| 6793 | // | | |------------->| |
| 6794 | // | | | | |
| 6795 | // | RESTSubReq2 | | |
| 6796 | // |------------------------>| | |
| 6797 | // | RESTSubResp2 | | |
| 6798 | // |<------------------------| | |
| 6799 | // | | | | |
| 6800 | // | | | SubReq2 | |
| 6801 | // | | |------------->| |
| 6802 | // | | | | |
| 6803 | // | | | SubResp1 | |
| 6804 | // | | |<-------------| |
| 6805 | // | | RESTNotif1 | | |
| 6806 | // | |<-------------| | |
| 6807 | // | | | | |
| 6808 | // | | | SubResp2 | |
| 6809 | // | | |<-------------| |
| 6810 | // | RESTNotif2 | | |
| 6811 | // |<------------------------| | |
| 6812 | // | | | | |
| 6813 | // | | [SUBS 1 DELETE] | |
| 6814 | // | | | | |
| 6815 | // | | [SUBS 2 DELETE] | |
| 6816 | // | | | | |
| 6817 | // |
| 6818 | //----------------------------------------------------------------------------- |
| 6819 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6820 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6821 | |
| 6822 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6823 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6824 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6825 | Counter{cSubReqToE2, 2}, |
| 6826 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6827 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6828 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6829 | Counter{cSubDelReqToE2, 2}, |
| 6830 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6831 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6832 | }) |
| 6833 | |
| 6834 | // Req1 |
| 6835 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6836 | |
| 6837 | //Subs Create |
| 6838 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6839 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6840 | |
| 6841 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6842 | |
| 6843 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6844 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6845 | params.SetMeid("RAN_NAME_1") |
| 6846 | |
| 6847 | actionId := int64(1) |
| 6848 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6849 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6850 | subsequestActionType := "continue" |
| 6851 | timeToWait := "w10ms" |
| 6852 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6853 | |
| 6854 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6855 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6856 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6857 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6858 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6859 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6860 | |
| 6861 | deleteXapp1Subscription(t, &restSubId1) |
| 6862 | deleteXapp2Subscription(t, &restSubId2) |
| 6863 | |
| 6864 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6865 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6866 | |
| 6867 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6868 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6869 | } |
| 6870 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6871 | //----------------------------------------------------------------------------- |
| 6872 | // TestRESTSubReqReportSameActionDiffActionID |
| 6873 | // |
| 6874 | // stub stub stub |
| 6875 | // +-------+ +-------+ +---------+ +---------+ |
| 6876 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6877 | // +-------+ +-------+ +---------+ +---------+ |
| 6878 | // | | | | |
| 6879 | // | | RESTSubReq1 | | |
| 6880 | // | |------------->| | |
| 6881 | // | | RESTSubResp1 | | |
| 6882 | // | |<-------------| | |
| 6883 | // | | | | |
| 6884 | // | | | SubReq1 | |
| 6885 | // | | |------------->| |
| 6886 | // | | | | |
| 6887 | // | RESTSubReq2 | | |
| 6888 | // |------------------------>| | |
| 6889 | // | RESTSubResp2 | | |
| 6890 | // |<------------------------| | |
| 6891 | // | | | | |
| 6892 | // | | | SubReq2 | |
| 6893 | // | | |------------->| |
| 6894 | // | | | | |
| 6895 | // | | | SubResp1 | |
| 6896 | // | | |<-------------| |
| 6897 | // | | RESTNotif1 | | |
| 6898 | // | |<-------------| | |
| 6899 | // | | | | |
| 6900 | // | | | SubResp2 | |
| 6901 | // | | |<-------------| |
| 6902 | // | RESTNotif2 | | |
| 6903 | // |<------------------------| | |
| 6904 | // | | | | |
| 6905 | // | | [SUBS 1 DELETE] | |
| 6906 | // | | | | |
| 6907 | // | | [SUBS 2 DELETE] | |
| 6908 | // | | | | |
| 6909 | // |
| 6910 | //----------------------------------------------------------------------------- |
| 6911 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6912 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6913 | |
| 6914 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6915 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6916 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6917 | Counter{cSubReqToE2, 2}, |
| 6918 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6919 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6920 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6921 | Counter{cSubDelReqToE2, 2}, |
| 6922 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6923 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6924 | }) |
| 6925 | |
| 6926 | // Req1 |
| 6927 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6928 | |
| 6929 | //Subs Create |
| 6930 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6931 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6932 | |
| 6933 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6934 | |
| 6935 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6936 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6937 | params.SetMeid("RAN_NAME_1") |
| 6938 | params.SetSubActionIDs(int64(2)) |
| 6939 | |
| 6940 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6941 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6942 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6943 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6944 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6945 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6946 | |
| 6947 | deleteXapp1Subscription(t, &restSubId1) |
| 6948 | deleteXapp2Subscription(t, &restSubId2) |
| 6949 | |
| 6950 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6951 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6952 | |
| 6953 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6954 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6955 | } |
| 6956 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6957 | //----------------------------------------------------------------------------- |
| 6958 | // TestRESTSubReqDiffActionType |
| 6959 | // |
| 6960 | // stub stub stub |
| 6961 | // +-------+ +-------+ +---------+ +---------+ |
| 6962 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6963 | // +-------+ +-------+ +---------+ +---------+ |
| 6964 | // | | | | |
| 6965 | // | | RESTSubReq1 | | |
| 6966 | // | |------------->| | |
| 6967 | // | | RESTSubResp1 | | |
| 6968 | // | |<-------------| | |
| 6969 | // | | | | |
| 6970 | // | | | SubReq1 | |
| 6971 | // | | |------------->| |
| 6972 | // | | | | |
| 6973 | // | RESTSubReq2 | | |
| 6974 | // |------------------------>| | |
| 6975 | // | RESTSubResp2 | | |
| 6976 | // |<------------------------| | |
| 6977 | // | | | | |
| 6978 | // | | | SubReq2 | |
| 6979 | // | | |------------->| |
| 6980 | // | | | | |
| 6981 | // | | | SubResp1 | |
| 6982 | // | | |<-------------| |
| 6983 | // | | RESTNotif1 | | |
| 6984 | // | |<-------------| | |
| 6985 | // | | | | |
| 6986 | // | | | SubResp2 | |
| 6987 | // | | |<-------------| |
| 6988 | // | RESTNotif2 | | |
| 6989 | // |<------------------------| | |
| 6990 | // | | | | |
| 6991 | // | | [SUBS 1 DELETE] | |
| 6992 | // | | | | |
| 6993 | // | | [SUBS 2 DELETE] | |
| 6994 | // | | | | |
| 6995 | // |
| 6996 | //----------------------------------------------------------------------------- |
| 6997 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6998 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6999 | |
| 7000 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7001 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7002 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7003 | Counter{cSubReqToE2, 2}, |
| 7004 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7005 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7006 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7007 | Counter{cSubDelReqToE2, 2}, |
| 7008 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7009 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7010 | }) |
| 7011 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7012 | const e2Timeout int64 = 2 |
| 7013 | const e2RetryCount int64 = 2 |
| 7014 | const routingNeeded bool = true |
| 7015 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7016 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7017 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7018 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7019 | |
| 7020 | //Subs Create |
| 7021 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7022 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7023 | |
| 7024 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7025 | |
| 7026 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7027 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7028 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7029 | params.SetMeid("RAN_NAME_1") |
| 7030 | |
| 7031 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7032 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7033 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7034 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7035 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7036 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7037 | |
| 7038 | deleteXapp1Subscription(t, &restSubId1) |
| 7039 | deleteXapp2Subscription(t, &restSubId2) |
| 7040 | |
| 7041 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7042 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7043 | |
| 7044 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7045 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7046 | } |
| 7047 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7048 | //----------------------------------------------------------------------------- |
| 7049 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 7050 | // |
| 7051 | // stub stub stub |
| 7052 | // +-------+ +-------+ +---------+ +---------+ |
| 7053 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7054 | // +-------+ +-------+ +---------+ +---------+ |
| 7055 | // | | | | |
| 7056 | // | | RESTSubReq1 | | |
| 7057 | // | |------------->| | |
| 7058 | // | | RESTSubResp1 | | |
| 7059 | // | |<-------------| | |
| 7060 | // | | | | |
| 7061 | // | | | SubReq1 | |
| 7062 | // | | |------------->| |
| 7063 | // | | | | |
| 7064 | // | RESTSubReq2 | | |
| 7065 | // |------------------------>| | |
| 7066 | // | RESTSubResp2 | | |
| 7067 | // |<------------------------| | |
| 7068 | // | | | | |
| 7069 | // | | | SubReq2 | |
| 7070 | // | | |------------->| |
| 7071 | // | | | | |
| 7072 | // | | | SubResp1 | |
| 7073 | // | | |<-------------| |
| 7074 | // | | RESTNotif1 | | |
| 7075 | // | |<-------------| | |
| 7076 | // | | | | |
| 7077 | // | | | SubResp2 | |
| 7078 | // | | |<-------------| |
| 7079 | // | RESTNotif2 | | |
| 7080 | // |<------------------------| | |
| 7081 | // | | | | |
| 7082 | // | | [SUBS 1 DELETE] | |
| 7083 | // | | | | |
| 7084 | // | | [SUBS 2 DELETE] | |
| 7085 | // | | | | |
| 7086 | // |
| 7087 | //----------------------------------------------------------------------------- |
| 7088 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7089 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7090 | |
| 7091 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7092 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7093 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7094 | Counter{cSubReqToE2, 2}, |
| 7095 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7096 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7097 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7098 | Counter{cSubDelReqToE2, 2}, |
| 7099 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7100 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7101 | }) |
| 7102 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7103 | const e2Timeout int64 = 2 |
| 7104 | const e2RetryCount int64 = 2 |
| 7105 | const routingNeeded bool = true |
| 7106 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7107 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7108 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7109 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7110 | |
| 7111 | //Subs Create |
| 7112 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7113 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7114 | |
| 7115 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7116 | |
| 7117 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7118 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7119 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7120 | params.SetMeid("RAN_NAME_1") |
| 7121 | |
| 7122 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7123 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7124 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7125 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7126 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7127 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7128 | |
| 7129 | deleteXapp1Subscription(t, &restSubId1) |
| 7130 | deleteXapp2Subscription(t, &restSubId2) |
| 7131 | |
| 7132 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7133 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7134 | |
| 7135 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7136 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7137 | } |
| 7138 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7139 | //----------------------------------------------------------------------------- |
| 7140 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 7141 | // |
| 7142 | // stub stub stub |
| 7143 | // +-------+ +-------+ +---------+ +---------+ |
| 7144 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7145 | // +-------+ +-------+ +---------+ +---------+ |
| 7146 | // | | | | |
| 7147 | // | | RESTSubReq1 | | |
| 7148 | // | |------------->| | |
| 7149 | // | | RESTSubResp1 | | |
| 7150 | // | |<-------------| | |
| 7151 | // | | | | |
| 7152 | // | | | SubReq1 | |
| 7153 | // | | |------------->| |
| 7154 | // | | | | |
| 7155 | // | RESTSubReq2 | | |
| 7156 | // |------------------------>| | |
| 7157 | // | RESTSubResp2 | | |
| 7158 | // |<------------------------| | |
| 7159 | // | | | | |
| 7160 | // | | | SubReq2 | |
| 7161 | // | | |------------->| |
| 7162 | // | | | | |
| 7163 | // | | | SubResp1 | |
| 7164 | // | | |<-------------| |
| 7165 | // | | RESTNotif1 | | |
| 7166 | // | |<-------------| | |
| 7167 | // | | | | |
| 7168 | // | | | SubResp2 | |
| 7169 | // | | |<-------------| |
| 7170 | // | RESTNotif2 | | |
| 7171 | // |<------------------------| | |
| 7172 | // | | | | |
| 7173 | // | | [SUBS 1 DELETE] | |
| 7174 | // | | | | |
| 7175 | // | | [SUBS 2 DELETE] | |
| 7176 | // | | | | |
| 7177 | // |
| 7178 | //----------------------------------------------------------------------------- |
| 7179 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7180 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7181 | |
| 7182 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7183 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7184 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7185 | Counter{cSubReqToE2, 2}, |
| 7186 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7187 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7188 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7189 | Counter{cSubDelReqToE2, 2}, |
| 7190 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7191 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7192 | }) |
| 7193 | |
| 7194 | // Req1 |
| 7195 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7196 | |
| 7197 | //Subs Create |
| 7198 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7199 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7200 | |
| 7201 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7202 | |
| 7203 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7204 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7205 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7206 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7207 | params.SetSubActionDefinition(actionDefinition) |
| 7208 | |
| 7209 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7210 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7211 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7212 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7213 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7214 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7215 | |
| 7216 | deleteXapp1Subscription(t, &restSubId1) |
| 7217 | deleteXapp2Subscription(t, &restSubId2) |
| 7218 | |
| 7219 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7220 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7221 | |
| 7222 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7223 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7224 | } |
| 7225 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7226 | //----------------------------------------------------------------------------- |
| 7227 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 7228 | // |
| 7229 | // stub stub stub |
| 7230 | // +-------+ +-------+ +---------+ +---------+ |
| 7231 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7232 | // +-------+ +-------+ +---------+ +---------+ |
| 7233 | // | | | | |
| 7234 | // | | RESTSubReq1 | | |
| 7235 | // | |------------->| | |
| 7236 | // | | RESTSubResp1 | | |
| 7237 | // | |<-------------| | |
| 7238 | // | | | | |
| 7239 | // | | | SubReq1 | |
| 7240 | // | | |------------->| |
| 7241 | // | | | | |
| 7242 | // | RESTSubReq2 | | |
| 7243 | // |------------------------>| | |
| 7244 | // | RESTSubResp2 | | |
| 7245 | // |<------------------------| | |
| 7246 | // | | | | |
| 7247 | // | | | SubReq2 | |
| 7248 | // | | |------------->| |
| 7249 | // | | | | |
| 7250 | // | | | SubResp1 | |
| 7251 | // | | |<-------------| |
| 7252 | // | | RESTNotif1 | | |
| 7253 | // | |<-------------| | |
| 7254 | // | | | | |
| 7255 | // | | | SubResp2 | |
| 7256 | // | | |<-------------| |
| 7257 | // | RESTNotif2 | | |
| 7258 | // |<------------------------| | |
| 7259 | // | | | | |
| 7260 | // | | [SUBS 1 DELETE] | |
| 7261 | // | | | | |
| 7262 | // | | [SUBS 2 DELETE] | |
| 7263 | // | | | | |
| 7264 | // |
| 7265 | //----------------------------------------------------------------------------- |
| 7266 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7267 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7268 | |
| 7269 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7270 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7271 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7272 | Counter{cSubReqToE2, 2}, |
| 7273 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7274 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7275 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7276 | Counter{cSubDelReqToE2, 2}, |
| 7277 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7278 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7279 | }) |
| 7280 | |
| 7281 | // Req1 |
| 7282 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7283 | |
| 7284 | //Subs Create |
| 7285 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7286 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7287 | |
| 7288 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7289 | |
| 7290 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7291 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7292 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7293 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7294 | params.SetSubActionDefinition(actionDefinition) |
| 7295 | |
| 7296 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7297 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7298 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7299 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7300 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7301 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7302 | |
| 7303 | deleteXapp1Subscription(t, &restSubId1) |
| 7304 | deleteXapp2Subscription(t, &restSubId2) |
| 7305 | |
| 7306 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7307 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7308 | |
| 7309 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7310 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7311 | } |
| 7312 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7313 | //----------------------------------------------------------------------------- |
| 7314 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7315 | // |
| 7316 | // stub stub stub |
| 7317 | // +-------+ +-------+ +---------+ +---------+ |
| 7318 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7319 | // +-------+ +-------+ +---------+ +---------+ |
| 7320 | // | | | | |
| 7321 | // | | RESTSubReq1 | | |
| 7322 | // | |------------->| | |
| 7323 | // | | RESTSubResp1 | | |
| 7324 | // | |<-------------| | |
| 7325 | // | | | | |
| 7326 | // | | | SubReq1 | |
| 7327 | // | | |------------->| |
| 7328 | // | | | | |
| 7329 | // | RESTSubReq2 | | |
| 7330 | // |------------------------>| | |
| 7331 | // | RESTSubResp2 | | |
| 7332 | // |<------------------------| | |
| 7333 | // | | | | |
| 7334 | // | | | SubReq2 | |
| 7335 | // | | |------------->| |
| 7336 | // | | | | |
| 7337 | // | | | SubResp1 | |
| 7338 | // | | |<-------------| |
| 7339 | // | | RESTNotif1 | | |
| 7340 | // | |<-------------| | |
| 7341 | // | | | | |
| 7342 | // | | | SubResp2 | |
| 7343 | // | | |<-------------| |
| 7344 | // | RESTNotif2 | | |
| 7345 | // |<------------------------| | |
| 7346 | // | | | | |
| 7347 | // | | [SUBS 1 DELETE] | |
| 7348 | // | | | | |
| 7349 | // | | [SUBS 2 DELETE] | |
| 7350 | // | | | | |
| 7351 | // |
| 7352 | //----------------------------------------------------------------------------- |
| 7353 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7354 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7355 | |
| 7356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7357 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7358 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7359 | Counter{cSubReqToE2, 2}, |
| 7360 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7361 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7362 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7363 | Counter{cSubDelReqToE2, 2}, |
| 7364 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7365 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7366 | }) |
| 7367 | |
| 7368 | // Req1 |
| 7369 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7370 | |
| 7371 | //Subs Create |
| 7372 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7373 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7374 | |
| 7375 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7376 | |
| 7377 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7378 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7379 | params.SetMeid("RAN_NAME_1") |
| 7380 | params.SetTimeToWait("w200ms") |
| 7381 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7382 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7383 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7384 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7385 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7386 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7387 | |
| 7388 | deleteXapp1Subscription(t, &restSubId1) |
| 7389 | deleteXapp2Subscription(t, &restSubId2) |
| 7390 | |
| 7391 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7392 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7393 | |
| 7394 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7395 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7396 | } |
| 7397 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7398 | //----------------------------------------------------------------------------- |
| 7399 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7400 | // |
| 7401 | // stub stub |
| 7402 | // +-------+ +---------+ +---------+ |
| 7403 | // | xapp | | submgr | | e2term | |
| 7404 | // +-------+ +---------+ +---------+ |
| 7405 | // | | | |
| 7406 | // | RestSubReq | | |
| 7407 | // |---------------->| | |
| 7408 | // | | | |
| 7409 | // | RESTSubResp | | |
| 7410 | // |<----------------| | |
| 7411 | // | | | |
| 7412 | // | | SubReq | |
| 7413 | // | |------------->| |
| 7414 | // | | | |
| 7415 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7416 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7417 | // | | | |
| 7418 | // | | SubReq | |
| 7419 | // | |------------->| |
| 7420 | // | | | |
| 7421 | // | | SubFail | Duplicated action |
| 7422 | // | |<-------------| |
| 7423 | // | RESTNotif (fail)| | |
| 7424 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7425 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7426 | // | [SUBS DELETE] | |
| 7427 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7428 | // |
| 7429 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7430 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7431 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7432 | |
| 7433 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7434 | Counter{cRestSubReqFromXapp, 1}, |
| 7435 | Counter{cRestSubRespToXapp, 1}, |
| 7436 | Counter{cSubReqToE2, 1}, |
| 7437 | Counter{cSubReqTimerExpiry, 1}, |
| 7438 | Counter{cSubReReqToE2, 1}, |
| 7439 | Counter{cSubRespFromE2, 1}, |
| 7440 | Counter{cSubFailFromE2, 1}, |
| 7441 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7442 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7443 | Counter{cRestSubDelRespToXapp, 1}, |
| 7444 | }) |
| 7445 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7446 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7447 | |
| 7448 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7449 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7450 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7451 | |
| 7452 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7453 | // Decode of this response fails which will result resending original request |
| 7454 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7455 | |
| 7456 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7457 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7458 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7459 | |
| 7460 | // Subscription already created in E2 Node. |
| 7461 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7462 | fparams.Set(crereq) |
| 7463 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7464 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7465 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7466 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7467 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7468 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7469 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7470 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7471 | // Wait that subs is cleaned |
| 7472 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7473 | |
| 7474 | xappConn1.TestMsgChanEmpty(t) |
| 7475 | e2termConn1.TestMsgChanEmpty(t) |
| 7476 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7477 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7478 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7479 | } |
| 7480 | |
| 7481 | //----------------------------------------------------------------------------- |
| 7482 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7483 | // |
| 7484 | // stub stub |
| 7485 | // +-------+ +---------+ +---------+ |
| 7486 | // | xapp | | submgr | | e2term | |
| 7487 | // +-------+ +---------+ +---------+ |
| 7488 | // | | | |
| 7489 | // | RestSubReq | | |
| 7490 | // |---------------->| | |
| 7491 | // | | | |
| 7492 | // | RESTSubResp | | |
| 7493 | // |<----------------| | |
| 7494 | // | | | |
| 7495 | // | | SubReq | |
| 7496 | // | |------------->| |
| 7497 | // | | | |
| 7498 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7499 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7500 | // | | | |
| 7501 | // | | SubReq | |
| 7502 | // | |------------->| |
| 7503 | // | | | |
| 7504 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7505 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7506 | // | RESTNotif (fail)| | |
| 7507 | // |<----------------| | |
| 7508 | // | | SubDelReq | |
| 7509 | // | |------------->| |
| 7510 | // | | | |
| 7511 | // | | SubDelResp | |
| 7512 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7513 | // | | | |
| 7514 | // | [SUBS DELETE] | |
| 7515 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7516 | // |
| 7517 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7518 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7519 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7520 | |
| 7521 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7522 | Counter{cRestSubReqFromXapp, 1}, |
| 7523 | Counter{cRestSubRespToXapp, 1}, |
| 7524 | Counter{cSubReqToE2, 1}, |
| 7525 | Counter{cSubReqTimerExpiry, 2}, |
| 7526 | Counter{cSubReReqToE2, 1}, |
| 7527 | Counter{cSubRespFromE2, 1}, |
| 7528 | Counter{cSubFailFromE2, 1}, |
| 7529 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7530 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7531 | Counter{cRestSubDelRespToXapp, 1}, |
| 7532 | Counter{cSubDelReqToE2, 1}, |
| 7533 | Counter{cSubDelRespFromE2, 1}, |
| 7534 | }) |
| 7535 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7536 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7537 | |
| 7538 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7539 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7540 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7541 | |
| 7542 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7543 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7544 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7545 | orgInstanceId := crereq.RequestId.InstanceId |
| 7546 | crereq.RequestId.InstanceId = 0 |
| 7547 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7548 | |
| 7549 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7550 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7551 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7552 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7553 | // 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] | 7554 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7555 | fparams.Set(crereq) |
| 7556 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7557 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7558 | |
| 7559 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7560 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7561 | |
| 7562 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7563 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7564 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7565 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7566 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7567 | // Wait that subs is cleaned |
| 7568 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7569 | |
| 7570 | xappConn1.TestMsgChanEmpty(t) |
| 7571 | e2termConn1.TestMsgChanEmpty(t) |
| 7572 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7573 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7574 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7575 | } |
| 7576 | |
| 7577 | //----------------------------------------------------------------------------- |
| 7578 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7579 | // |
| 7580 | // stub stub |
| 7581 | // +-------+ +---------+ +---------+ |
| 7582 | // | xapp | | submgr | | e2term | |
| 7583 | // +-------+ +---------+ +---------+ |
| 7584 | // | | | |
| 7585 | // | RestSubReq | | |
| 7586 | // |---------------->| | |
| 7587 | // | | | |
| 7588 | // | RESTSubResp | | |
| 7589 | // |<----------------| | |
| 7590 | // | | | |
| 7591 | // | | SubReq | |
| 7592 | // | |------------->| |
| 7593 | // | | | |
| 7594 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7595 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7596 | // | | | |
| 7597 | // | | SubReq | |
| 7598 | // | |------------->| |
| 7599 | // | | | |
| 7600 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7601 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7602 | // | RESTNotif (fail)| | |
| 7603 | // |<----------------| | |
| 7604 | // | | SubDelReq | |
| 7605 | // | |------------->| |
| 7606 | // | | | |
| 7607 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7608 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7609 | // | | | |
| 7610 | // | | SubDelReq | |
| 7611 | // | |------------->| |
| 7612 | // | | | |
| 7613 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7614 | // | |<-------------| Ongoing transaction not found. |
| 7615 | // | | | |
| 7616 | // | [SUBS DELETE] | |
| 7617 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7618 | // |
| 7619 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7620 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7621 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7622 | |
| 7623 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7624 | Counter{cRestSubReqFromXapp, 1}, |
| 7625 | Counter{cRestSubRespToXapp, 1}, |
| 7626 | Counter{cSubReqToE2, 1}, |
| 7627 | Counter{cSubReqTimerExpiry, 2}, |
| 7628 | Counter{cSubReReqToE2, 1}, |
| 7629 | Counter{cSubRespFromE2, 1}, |
| 7630 | Counter{cSubFailFromE2, 1}, |
| 7631 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7632 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7633 | Counter{cRestSubDelRespToXapp, 1}, |
| 7634 | Counter{cSubDelReqToE2, 1}, |
| 7635 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7636 | Counter{cSubDelReReqToE2, 1}, |
| 7637 | Counter{cSubDelRespFromE2, 2}, |
| 7638 | }) |
| 7639 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7640 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7641 | |
| 7642 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7643 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7644 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7645 | |
| 7646 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7647 | |
| 7648 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7649 | // No transaction exist for this response which will result resending original request |
| 7650 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7651 | |
| 7652 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7653 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7654 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7655 | |
| 7656 | // Subscription already created in E2 Node. |
| 7657 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7658 | fparams.Set(crereq) |
| 7659 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7660 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7661 | |
| 7662 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7663 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7664 | |
| 7665 | // Resending happens because there no transaction |
| 7666 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7667 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7668 | |
| 7669 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7670 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7671 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7672 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7673 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7674 | // Wait that subs is cleaned |
| 7675 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7676 | |
| 7677 | xappConn1.TestMsgChanEmpty(t) |
| 7678 | e2termConn1.TestMsgChanEmpty(t) |
| 7679 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7680 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7681 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7682 | } |
| 7683 | |
| 7684 | //----------------------------------------------------------------------------- |
| 7685 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7686 | // |
| 7687 | // stub stub |
| 7688 | // +-------+ +---------+ +---------+ |
| 7689 | // | xapp | | submgr | | e2term | |
| 7690 | // +-------+ +---------+ +---------+ |
| 7691 | // | | | |
| 7692 | // | RestSubReq | | |
| 7693 | // |---------------->| | |
| 7694 | // | | | |
| 7695 | // | RESTSubResp | | |
| 7696 | // |<----------------| | |
| 7697 | // | | | |
| 7698 | // | | SubReq | |
| 7699 | // | |------------->| |
| 7700 | // | | | |
| 7701 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7702 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7703 | // | | | |
| 7704 | // | | SubReq | |
| 7705 | // | |------------->| |
| 7706 | // | | | |
| 7707 | // | | SubFail | Duplicated action |
| 7708 | // | |<-------------| |
| 7709 | // | RESTNotif (fail)| | |
| 7710 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7711 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7712 | // | [SUBS DELETE] | |
| 7713 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7714 | // |
| 7715 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7716 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7717 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7718 | |
| 7719 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7720 | Counter{cRestSubReqFromXapp, 1}, |
| 7721 | Counter{cRestSubRespToXapp, 1}, |
| 7722 | Counter{cSubReqToE2, 1}, |
| 7723 | Counter{cSubReqTimerExpiry, 1}, |
| 7724 | Counter{cSubReReqToE2, 1}, |
| 7725 | Counter{cSubFailFromE2, 2}, |
| 7726 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7727 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7728 | Counter{cRestSubDelRespToXapp, 1}, |
| 7729 | }) |
| 7730 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7731 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7732 | |
| 7733 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7734 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7735 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7736 | |
| 7737 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7738 | |
| 7739 | // Decode of this response fails which will result resending original request |
| 7740 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7741 | |
| 7742 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7743 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7744 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7745 | |
| 7746 | // Subscription already created in E2 Node. |
| 7747 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7748 | fparams.Set(crereq) |
| 7749 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7750 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7751 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7752 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7753 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7754 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7755 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7756 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7757 | // Wait that subs is cleaned |
| 7758 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7759 | |
| 7760 | xappConn1.TestMsgChanEmpty(t) |
| 7761 | e2termConn1.TestMsgChanEmpty(t) |
| 7762 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7763 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7764 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7765 | } |
| 7766 | |
| 7767 | //----------------------------------------------------------------------------- |
| 7768 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7769 | // |
| 7770 | // stub stub |
| 7771 | // +-------+ +---------+ +---------+ |
| 7772 | // | xapp | | submgr | | e2term | |
| 7773 | // +-------+ +---------+ +---------+ |
| 7774 | // | | | |
| 7775 | // | RestSubReq | | |
| 7776 | // |---------------->| | |
| 7777 | // | | | |
| 7778 | // | RESTSubResp | | |
| 7779 | // |<----------------| | |
| 7780 | // | | | |
| 7781 | // | | SubReq | |
| 7782 | // | |------------->| |
| 7783 | // | | | |
| 7784 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7785 | // | |<-------------| 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] | 7786 | // | | | |
| 7787 | // | | SubReq | |
| 7788 | // | |------------->| |
| 7789 | // | | | |
| 7790 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7791 | // | |<-------------|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] | 7792 | // | RESTNotif (fail)| | |
| 7793 | // |<----------------| | |
| 7794 | // | | SubDelReq | |
| 7795 | // | |------------->| |
| 7796 | // | | | |
| 7797 | // | | SubDelResp | |
| 7798 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7799 | // | | | |
| 7800 | // | [SUBS DELETE] | |
| 7801 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7802 | // |
| 7803 | //----------------------------------------------------------------------------- |
| 7804 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7805 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7806 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7807 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7808 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7809 | Counter{cRestSubReqFromXapp, 1}, |
| 7810 | Counter{cRestSubRespToXapp, 1}, |
| 7811 | Counter{cSubReqToE2, 1}, |
| 7812 | Counter{cSubReqTimerExpiry, 2}, |
| 7813 | Counter{cSubReReqToE2, 1}, |
| 7814 | Counter{cSubFailFromE2, 2}, |
| 7815 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7816 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7817 | Counter{cRestSubDelRespToXapp, 1}, |
| 7818 | Counter{cSubDelReqToE2, 1}, |
| 7819 | Counter{cSubDelRespFromE2, 1}, |
| 7820 | }) |
| 7821 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7822 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7823 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7824 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7825 | |
| 7826 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7827 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7828 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7829 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7830 | fparams.Set(crereq) |
| 7831 | fparams.Fail.RequestId.InstanceId = 0 |
| 7832 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7833 | |
| 7834 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7835 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7836 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7837 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7838 | // 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] | 7839 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7840 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7841 | |
| 7842 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7843 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7844 | |
| 7845 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7846 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7847 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7848 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7849 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7850 | // Wait that subs is cleaned |
| 7851 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7852 | |
| 7853 | xappConn1.TestMsgChanEmpty(t) |
| 7854 | e2termConn1.TestMsgChanEmpty(t) |
| 7855 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7856 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7857 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7858 | } |
| 7859 | |
| 7860 | //----------------------------------------------------------------------------- |
| 7861 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7862 | // |
| 7863 | // stub stub |
| 7864 | // +-------+ +---------+ +---------+ |
| 7865 | // | xapp | | submgr | | e2term | |
| 7866 | // +-------+ +---------+ +---------+ |
| 7867 | // | | | |
| 7868 | // | RestSubReq | | |
| 7869 | // |---------------->| | |
| 7870 | // | | | |
| 7871 | // | RESTSubResp | | |
| 7872 | // |<----------------| | |
| 7873 | // | | | |
| 7874 | // | | SubReq | |
| 7875 | // | |------------->| |
| 7876 | // | | | |
| 7877 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7878 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7879 | // | | | |
| 7880 | // | | SubReq | |
| 7881 | // | |------------->| |
| 7882 | // | | | |
| 7883 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7884 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7885 | // | RESTNotif (fail)| | |
| 7886 | // |<----------------| | |
| 7887 | // | | SubDelReq | |
| 7888 | // | |------------->| |
| 7889 | // | | | |
| 7890 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7891 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7892 | // | | | |
| 7893 | // | | SubDelReq | |
| 7894 | // | |------------->| |
| 7895 | // | | | |
| 7896 | // | | SubDelResp | |
| 7897 | // | |<-------------| Ongoing transaction not found. |
| 7898 | // | | | |
| 7899 | // | [SUBS DELETE] | |
| 7900 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7901 | // |
| 7902 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7903 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7904 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7905 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7906 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7907 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7908 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7909 | Counter{cRestSubReqFromXapp, 1}, |
| 7910 | Counter{cRestSubRespToXapp, 1}, |
| 7911 | Counter{cSubReqToE2, 1}, |
| 7912 | Counter{cSubReqTimerExpiry, 2}, |
| 7913 | Counter{cSubReReqToE2, 1}, |
| 7914 | Counter{cSubFailFromE2, 2}, |
| 7915 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7916 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7917 | Counter{cRestSubDelRespToXapp, 1}, |
| 7918 | Counter{cSubDelReqToE2, 1}, |
| 7919 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7920 | Counter{cSubDelReReqToE2, 1}, |
| 7921 | Counter{cSubDelRespFromE2, 2}, |
| 7922 | }) |
| 7923 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7924 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7925 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7926 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7927 | |
| 7928 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7929 | |
| 7930 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7931 | |
| 7932 | // No transaction exist for this response which will result resending original request |
| 7933 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7934 | fparams.Set(crereq) |
| 7935 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7936 | |
| 7937 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7938 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7939 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7940 | |
| 7941 | // Subscription already created in E2 Node. |
| 7942 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7943 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7944 | |
| 7945 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7946 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7947 | |
| 7948 | // Resending happens because there no transaction |
| 7949 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7950 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7951 | |
| 7952 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7953 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7954 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7955 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7956 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7957 | // Wait that subs is cleaned |
| 7958 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7959 | |
| 7960 | xappConn1.TestMsgChanEmpty(t) |
| 7961 | e2termConn1.TestMsgChanEmpty(t) |
| 7962 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7963 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7964 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7965 | } |
| 7966 | |
| 7967 | //----------------------------------------------------------------------------- |
| 7968 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7969 | // |
| 7970 | // stub stub |
| 7971 | // +-------+ +---------+ +---------+ |
| 7972 | // | xapp | | submgr | | e2term | |
| 7973 | // +-------+ +---------+ +---------+ |
| 7974 | // | | | |
| 7975 | // | [SUBS CREATE] | |
| 7976 | // | | | |
| 7977 | // | | | |
| 7978 | // | RESTSubDelReq | | |
| 7979 | // |---------------->| | |
| 7980 | // | | | |
| 7981 | // | RESTSubDelResp | | |
| 7982 | // |<----------------| | |
| 7983 | // | | | |
| 7984 | // | | SubDelReq | |
| 7985 | // | |------------->| |
| 7986 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7987 | // | | SubDelResp | ASN.1 decode fails. |
| 7988 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7989 | // | | | |
| 7990 | // | | SubDelReq | |
| 7991 | // | |------------->| |
| 7992 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7993 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7994 | // | |<-------------| |
| 7995 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7996 | // | [SUBS DELETE] | |
| 7997 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7998 | // |
| 7999 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8000 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8001 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8002 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8003 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8004 | Counter{cRestSubReqFromXapp, 1}, |
| 8005 | Counter{cRestSubRespToXapp, 1}, |
| 8006 | Counter{cSubReqToE2, 1}, |
| 8007 | Counter{cSubRespFromE2, 1}, |
| 8008 | Counter{cRestSubNotifToXapp, 1}, |
| 8009 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8010 | Counter{cRestSubDelRespToXapp, 1}, |
| 8011 | Counter{cSubDelReqToE2, 1}, |
| 8012 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8013 | Counter{cSubDelReReqToE2, 1}, |
| 8014 | Counter{cSubDelFailFromE2, 1}, |
| 8015 | Counter{cSubDelRespFromE2, 1}, |
| 8016 | }) |
| 8017 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8018 | // Req |
| 8019 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8020 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8021 | |
| 8022 | // Del |
| 8023 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8024 | |
| 8025 | // E2t: Receive 1st SubsDelReq |
| 8026 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8027 | |
| 8028 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8029 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8030 | |
| 8031 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8032 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8033 | |
| 8034 | // Subscription does not exist in in E2 Node. |
| 8035 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8036 | |
| 8037 | // Wait that subs is cleaned |
| 8038 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8039 | |
| 8040 | xappConn1.TestMsgChanEmpty(t) |
| 8041 | e2termConn1.TestMsgChanEmpty(t) |
| 8042 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8043 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8044 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8045 | } |
| 8046 | |
| 8047 | //----------------------------------------------------------------------------- |
| 8048 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 8049 | // |
| 8050 | // stub stub |
| 8051 | // +-------+ +---------+ +---------+ |
| 8052 | // | xapp | | submgr | | e2term | |
| 8053 | // +-------+ +---------+ +---------+ |
| 8054 | // | | | |
| 8055 | // | [SUBS CREATE] | |
| 8056 | // | | | |
| 8057 | // | | | |
| 8058 | // | RESTSubDelReq | | |
| 8059 | // |---------------->| | |
| 8060 | // | | | |
| 8061 | // | RESTSubDelResp | | |
| 8062 | // |<----------------| | |
| 8063 | // | | | |
| 8064 | // | | SubDelReq | |
| 8065 | // | |------------->| |
| 8066 | // | | | |
| 8067 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8068 | // | |<-------------| 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] | 8069 | // | | | |
| 8070 | // | | SubDelReq | |
| 8071 | // | |------------->| |
| 8072 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8073 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8074 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8075 | // | | | |
| 8076 | // | [SUBS DELETE] | |
| 8077 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8078 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8079 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8080 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8081 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8082 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8083 | Counter{cRestSubReqFromXapp, 1}, |
| 8084 | Counter{cRestSubRespToXapp, 1}, |
| 8085 | Counter{cSubReqToE2, 1}, |
| 8086 | Counter{cSubRespFromE2, 1}, |
| 8087 | Counter{cRestSubNotifToXapp, 1}, |
| 8088 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8089 | Counter{cRestSubDelRespToXapp, 1}, |
| 8090 | Counter{cSubDelReqToE2, 1}, |
| 8091 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8092 | Counter{cSubDelReReqToE2, 1}, |
| 8093 | Counter{cSubDelRespFromE2, 1}, |
| 8094 | Counter{cSubDelFailFromE2, 1}, |
| 8095 | }) |
| 8096 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8097 | // Req |
| 8098 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8099 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8100 | |
| 8101 | // Del |
| 8102 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8103 | |
| 8104 | // E2t: Receive 1st SubsDelReq |
| 8105 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8106 | |
| 8107 | // Unknown instanceId in this response which will result resending original request |
| 8108 | delreq.RequestId.InstanceId = 0 |
| 8109 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8110 | |
| 8111 | // E2t: Receive 2nd SubsDelReq |
| 8112 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8113 | |
| 8114 | // Subscription does not exist in in E2 Node. |
| 8115 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8116 | |
| 8117 | // Wait that subs is cleaned |
| 8118 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8119 | |
| 8120 | xappConn1.TestMsgChanEmpty(t) |
| 8121 | e2termConn1.TestMsgChanEmpty(t) |
| 8122 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8123 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8124 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8125 | } |
| 8126 | |
| 8127 | //----------------------------------------------------------------------------- |
| 8128 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 8129 | // |
| 8130 | // stub stub |
| 8131 | // +-------+ +---------+ +---------+ |
| 8132 | // | xapp | | submgr | | e2term | |
| 8133 | // +-------+ +---------+ +---------+ |
| 8134 | // | | | |
| 8135 | // | [SUBS CREATE] | |
| 8136 | // | | | |
| 8137 | // | | | |
| 8138 | // | RESTSubDelReq | | |
| 8139 | // |---------------->| | |
| 8140 | // | | | |
| 8141 | // | RESTSubDelResp | | |
| 8142 | // |<----------------| | |
| 8143 | // | | | |
| 8144 | // | | SubDelReq | |
| 8145 | // | |------------->| |
| 8146 | // | | | |
| 8147 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8148 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8149 | // | | | |
| 8150 | // | | SubDelReq | |
| 8151 | // | |------------->| |
| 8152 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8153 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8154 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8155 | // | | | |
| 8156 | // | [SUBS DELETE] | |
| 8157 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8158 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8159 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8160 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8161 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8162 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8163 | Counter{cRestSubReqFromXapp, 1}, |
| 8164 | Counter{cRestSubRespToXapp, 1}, |
| 8165 | Counter{cSubReqToE2, 1}, |
| 8166 | Counter{cSubRespFromE2, 1}, |
| 8167 | Counter{cRestSubNotifToXapp, 1}, |
| 8168 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8169 | Counter{cRestSubDelRespToXapp, 1}, |
| 8170 | Counter{cSubDelReqToE2, 1}, |
| 8171 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8172 | Counter{cSubDelReReqToE2, 1}, |
| 8173 | Counter{cSubDelRespFromE2, 1}, |
| 8174 | Counter{cSubDelFailFromE2, 1}, |
| 8175 | }) |
| 8176 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8177 | // Req |
| 8178 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8179 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8180 | |
| 8181 | // Del |
| 8182 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8183 | |
| 8184 | // E2t: Receive 1st SubsDelReq |
| 8185 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8186 | |
| 8187 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8188 | |
| 8189 | // No transaction exist for this response which will result resending original request |
| 8190 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8191 | |
| 8192 | // E2t: Receive 2nd SubsDelReq |
| 8193 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8194 | |
| 8195 | // Subscription does not exist in in E2 Node. |
| 8196 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8197 | |
| 8198 | // Wait that subs is cleaned |
| 8199 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8200 | |
| 8201 | xappConn1.TestMsgChanEmpty(t) |
| 8202 | e2termConn1.TestMsgChanEmpty(t) |
| 8203 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8204 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8205 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8206 | } |
| 8207 | |
| 8208 | //----------------------------------------------------------------------------- |
| 8209 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 8210 | // |
| 8211 | // stub stub |
| 8212 | // +-------+ +---------+ +---------+ |
| 8213 | // | xapp | | submgr | | e2term | |
| 8214 | // +-------+ +---------+ +---------+ |
| 8215 | // | | | |
| 8216 | // | [SUBS CREATE] | |
| 8217 | // | | | |
| 8218 | // | | | |
| 8219 | // | RESTSubDelReq | | |
| 8220 | // |---------------->| | |
| 8221 | // | | | |
| 8222 | // | RESTSubDelResp | | |
| 8223 | // |<----------------| | |
| 8224 | // | | | |
| 8225 | // | | SubDelReq | |
| 8226 | // | |------------->| |
| 8227 | // | | | |
| 8228 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8229 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8230 | // | | | |
| 8231 | // | | SubDelReq | |
| 8232 | // | |------------->| |
| 8233 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8234 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8235 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8236 | // | | | |
| 8237 | // | [SUBS DELETE] | |
| 8238 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8239 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8240 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8241 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8242 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8243 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8244 | Counter{cRestSubReqFromXapp, 1}, |
| 8245 | Counter{cRestSubRespToXapp, 1}, |
| 8246 | Counter{cSubReqToE2, 1}, |
| 8247 | Counter{cSubRespFromE2, 1}, |
| 8248 | Counter{cRestSubNotifToXapp, 1}, |
| 8249 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8250 | Counter{cRestSubDelRespToXapp, 1}, |
| 8251 | Counter{cSubDelReqToE2, 1}, |
| 8252 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8253 | Counter{cSubDelReReqToE2, 1}, |
| 8254 | Counter{cSubDelFailFromE2, 2}, |
| 8255 | }) |
| 8256 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8257 | // Req |
| 8258 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8259 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8260 | |
| 8261 | // Del |
| 8262 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8263 | |
| 8264 | // E2t: Receive 1st SubsDelReq |
| 8265 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8266 | |
| 8267 | // Decode of this response fails which will result resending original request |
| 8268 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 8269 | |
| 8270 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8271 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8272 | |
| 8273 | // Subscription does not exist in in E2 Node. |
| 8274 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8275 | |
| 8276 | // Wait that subs is cleaned |
| 8277 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8278 | |
| 8279 | xappConn1.TestMsgChanEmpty(t) |
| 8280 | e2termConn1.TestMsgChanEmpty(t) |
| 8281 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8282 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8283 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8284 | } |
| 8285 | |
| 8286 | //----------------------------------------------------------------------------- |
| 8287 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8288 | // |
| 8289 | // stub stub |
| 8290 | // +-------+ +---------+ +---------+ |
| 8291 | // | xapp | | submgr | | e2term | |
| 8292 | // +-------+ +---------+ +---------+ |
| 8293 | // | | | |
| 8294 | // | [SUBS CREATE] | |
| 8295 | // | | | |
| 8296 | // | | | |
| 8297 | // | RESTSubDelReq | | |
| 8298 | // |---------------->| | |
| 8299 | // | | | |
| 8300 | // | RESTSubDelResp | | |
| 8301 | // |<----------------| | |
| 8302 | // | | | |
| 8303 | // | | SubDelReq | |
| 8304 | // | |------------->| |
| 8305 | // | | | |
| 8306 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8307 | // | |<-------------| 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] | 8308 | // | | | |
| 8309 | // | | SubDelReq | |
| 8310 | // | |------------->| |
| 8311 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8312 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8313 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8314 | // | | | |
| 8315 | // | [SUBS DELETE] | |
| 8316 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8317 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8318 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8319 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8320 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8321 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8322 | Counter{cRestSubReqFromXapp, 1}, |
| 8323 | Counter{cRestSubRespToXapp, 1}, |
| 8324 | Counter{cSubReqToE2, 1}, |
| 8325 | Counter{cSubRespFromE2, 1}, |
| 8326 | Counter{cRestSubNotifToXapp, 1}, |
| 8327 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8328 | Counter{cRestSubDelRespToXapp, 1}, |
| 8329 | Counter{cSubDelReqToE2, 1}, |
| 8330 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8331 | Counter{cSubDelReReqToE2, 1}, |
| 8332 | Counter{cSubDelFailFromE2, 2}, |
| 8333 | }) |
| 8334 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8335 | // Req |
| 8336 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8337 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8338 | |
| 8339 | // Del |
| 8340 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8341 | |
| 8342 | // E2t: Receive 1st SubsDelReq |
| 8343 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8344 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8345 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8346 | delreq.RequestId.InstanceId = 0 |
| 8347 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8348 | |
| 8349 | // E2t: Receive 2nd SubsDelReq |
| 8350 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8351 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8352 | // 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] | 8353 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8354 | |
| 8355 | // Wait that subs is cleaned |
| 8356 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8357 | |
| 8358 | xappConn1.TestMsgChanEmpty(t) |
| 8359 | e2termConn1.TestMsgChanEmpty(t) |
| 8360 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8361 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8362 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8363 | } |
| 8364 | |
| 8365 | //----------------------------------------------------------------------------- |
| 8366 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8367 | // |
| 8368 | // stub stub |
| 8369 | // +-------+ +---------+ +---------+ |
| 8370 | // | xapp | | submgr | | e2term | |
| 8371 | // +-------+ +---------+ +---------+ |
| 8372 | // | | | |
| 8373 | // | [SUBS CREATE] | |
| 8374 | // | | | |
| 8375 | // | | | |
| 8376 | // | RESTSubDelReq | | |
| 8377 | // |---------------->| | |
| 8378 | // | | | |
| 8379 | // | RESTSubDelResp | | |
| 8380 | // |<----------------| | |
| 8381 | // | | | |
| 8382 | // | | SubDelReq | |
| 8383 | // | |------------->| |
| 8384 | // | | | |
| 8385 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8386 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8387 | // | | | |
| 8388 | // | | SubDelReq | |
| 8389 | // | |------------->| |
| 8390 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8391 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8392 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8393 | // | | | |
| 8394 | // | [SUBS DELETE] | |
| 8395 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8396 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8397 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8398 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8399 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8400 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8401 | Counter{cRestSubReqFromXapp, 1}, |
| 8402 | Counter{cRestSubRespToXapp, 1}, |
| 8403 | Counter{cSubReqToE2, 1}, |
| 8404 | Counter{cSubRespFromE2, 1}, |
| 8405 | Counter{cRestSubNotifToXapp, 1}, |
| 8406 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8407 | Counter{cRestSubDelRespToXapp, 1}, |
| 8408 | Counter{cSubDelReqToE2, 1}, |
| 8409 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8410 | Counter{cSubDelReReqToE2, 1}, |
| 8411 | Counter{cSubDelFailFromE2, 2}, |
| 8412 | }) |
| 8413 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8414 | // Req |
| 8415 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8416 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8417 | |
| 8418 | // Del |
| 8419 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8420 | |
| 8421 | // E2t: Receive 1st SubsDelReq |
| 8422 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8423 | |
| 8424 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8425 | |
| 8426 | // No transaction exist for this response which will result resending original request |
| 8427 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8428 | |
| 8429 | // E2t: Receive 2nd SubsDelReq |
| 8430 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8431 | |
| 8432 | // Subscription does not exist in in E2 Node. |
| 8433 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8434 | |
| 8435 | // Wait that subs is cleaned |
| 8436 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8437 | |
| 8438 | xappConn1.TestMsgChanEmpty(t) |
| 8439 | e2termConn1.TestMsgChanEmpty(t) |
| 8440 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8441 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8442 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8443 | } |
| 8444 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8445 | //----------------------------------------------------------------------------- |
| 8446 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8447 | // |
| 8448 | // stub stub |
| 8449 | // +-------+ +---------+ +---------+ |
| 8450 | // | xapp | | submgr | | e2term | |
| 8451 | // +-------+ +---------+ +---------+ |
| 8452 | // | | | |
| 8453 | // | RESTSubReq | | |
| 8454 | // |---------------->| | |
| 8455 | // | | | |
| 8456 | // | RESTSubResp | | |
| 8457 | // |<----------------| | |
| 8458 | // | | | |
| 8459 | // | ASN.1 encode fails | |
| 8460 | // | | | |
| 8461 | // | | SubDelReq | |
| 8462 | // | |------------->| |
| 8463 | // | | | |
| 8464 | // | | SubDelFail | |
| 8465 | // | |<-------------| |
| 8466 | // | | | |
| 8467 | // | RESTNotif | | |
| 8468 | // | unsuccess | | |
| 8469 | // |<----------------| | |
| 8470 | // | | | |
| 8471 | // | [SUBS DELETE] | |
| 8472 | // | | | |
| 8473 | // |
| 8474 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8475 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8476 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8477 | |
| 8478 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8479 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8480 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8481 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8482 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8483 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8484 | }) |
| 8485 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8486 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8487 | |
| 8488 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8489 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8490 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8491 | |
| 8492 | // Req |
| 8493 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8494 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8495 | |
| 8496 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8497 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8498 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8499 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8500 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8501 | |
| 8502 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8503 | |
| 8504 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8505 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8506 | // Wait that subs is cleaned |
| 8507 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8508 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8509 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8510 | } |
| 8511 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8512 | //----------------------------------------------------------------------------- |
| 8513 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8514 | // |
| 8515 | // stub stub |
| 8516 | // +-------+ +---------+ +---------+ |
| 8517 | // | xapp | | submgr | | e2term | |
| 8518 | // +-------+ +---------+ +---------+ |
| 8519 | // | | | |
| 8520 | // | RESTSubReq | | |
| 8521 | // |---------------->| | |
| 8522 | // | | | |
| 8523 | // | RESTSubResp | | |
| 8524 | // |<----------------| | |
| 8525 | // | | SubReq | |
| 8526 | // | |------------->| |
| 8527 | // | | | |
| 8528 | // | | SubResp | |
| 8529 | // | |<-------------| |
| 8530 | // | | | |
| 8531 | // | RESTNotif | | |
| 8532 | // |<----------------| | |
| 8533 | // | | | |
| 8534 | // | RESTSubReq | | Policy modification |
| 8535 | // |---------------->| | |
| 8536 | // | | | |
| 8537 | // | RESTSubResp | | |
| 8538 | // |<----------------| | |
| 8539 | // | | SubReq | |
| 8540 | // | |------------->| |
| 8541 | // | | | |
| 8542 | // | | | |
| 8543 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8544 | // |<----------------| | |
| 8545 | // | | | |
| 8546 | // | RESTSubDelReq | | |
| 8547 | // |---------------->| | |
| 8548 | // | | | |
| 8549 | // | | SubDelReq | |
| 8550 | // | |------------->| |
| 8551 | // | | | |
| 8552 | // | | SubDelResp | |
| 8553 | // | |<-------------| |
| 8554 | // | | | |
| 8555 | // | RESTSubDelResp | | |
| 8556 | // |<----------------| | |
| 8557 | // |
| 8558 | //----------------------------------------------------------------------------- |
| 8559 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8560 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8561 | |
| 8562 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8563 | Counter{cRestSubReqFromXapp, 2}, |
| 8564 | Counter{cRestSubRespToXapp, 2}, |
| 8565 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8566 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8567 | Counter{cSubRespFromE2, 1}, |
| 8568 | Counter{cRestSubNotifToXapp, 1}, |
| 8569 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8570 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8571 | Counter{cSubDelReqToE2, 1}, |
| 8572 | Counter{cSubDelRespFromE2, 1}, |
| 8573 | Counter{cRestSubDelRespToXapp, 1}, |
| 8574 | }) |
| 8575 | |
| 8576 | const e2Timeout int64 = 1 |
| 8577 | const e2RetryCount int64 = 0 |
| 8578 | const routingNeeded bool = false |
| 8579 | |
| 8580 | // Req1 |
| 8581 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8582 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8583 | |
| 8584 | // Subs Create |
| 8585 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8586 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8587 | |
| 8588 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8589 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8590 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8591 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8592 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8593 | |
| 8594 | // Policy change |
| 8595 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8596 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8597 | params.SetSubscriptionID(&restSubId) |
| 8598 | params.SetTimeToWait("w200ms") |
| 8599 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8600 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8601 | |
| 8602 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8603 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8604 | // SubsResp is missing, e2SubsId will be 0 |
| 8605 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8606 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8607 | |
| 8608 | // Del |
| 8609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8610 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8611 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8612 | |
| 8613 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8614 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8615 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8616 | } |
| 8617 | |
| 8618 | //----------------------------------------------------------------------------- |
| 8619 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8620 | // |
| 8621 | // stub stub |
| 8622 | // +-------+ +---------+ +---------+ |
| 8623 | // | xapp | | submgr | | e2term | |
| 8624 | // +-------+ +---------+ +---------+ |
| 8625 | // | | | |
| 8626 | // | RESTSubReq | | |
| 8627 | // |---------------->| | |
| 8628 | // | | | |
| 8629 | // | RESTSubResp | | |
| 8630 | // |<----------------| | |
| 8631 | // | | SubReq | |
| 8632 | // | |------------->| |
| 8633 | // | | | |
| 8634 | // | | SubResp | |
| 8635 | // | |<-------------| |
| 8636 | // | | | |
| 8637 | // | RESTNotif | | |
| 8638 | // |<----------------| | |
| 8639 | // | | | |
| 8640 | // | RESTSubReq | | |
| 8641 | // |---------------->| | |
| 8642 | // | | | |
| 8643 | // | RESTSubResp | | |
| 8644 | // |<----------------| | |
| 8645 | // | | SubReq | |
| 8646 | // | |------------->| |
| 8647 | // | | |
| 8648 | // | Submgr restart | |
| 8649 | // | | | |
| 8650 | // | RESTSubDelReq | | |
| 8651 | // |---------------->| | |
| 8652 | // | | | |
| 8653 | // | | SubDelReq | |
| 8654 | // | |------------->| |
| 8655 | // | | | |
| 8656 | // | | SubDelResp | |
| 8657 | // | |<-------------| |
| 8658 | // | | | |
| 8659 | // | RESTSubDelResp | | |
| 8660 | // |<----------------| | |
| 8661 | // |
| 8662 | //----------------------------------------------------------------------------- |
| 8663 | |
| 8664 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8665 | |
| 8666 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8667 | Counter{cRestSubReqFromXapp, 2}, |
| 8668 | Counter{cRestSubRespToXapp, 2}, |
| 8669 | Counter{cSubReqToE2, 2}, |
| 8670 | Counter{cSubRespFromE2, 1}, |
| 8671 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8672 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8673 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8674 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8675 | Counter{cRestSubDelRespToXapp, 1}, |
| 8676 | }) |
| 8677 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8678 | const e2Timeout int64 = 1 |
| 8679 | const e2RetryCount int64 = 0 |
| 8680 | const routingNeeded bool = false |
| 8681 | |
| 8682 | // Req1 |
| 8683 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8684 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8685 | // Create subscription |
| 8686 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8687 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8688 | |
| 8689 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8690 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8691 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8692 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8693 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8694 | |
| 8695 | // Check subscription |
| 8696 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8697 | |
| 8698 | // Policy change |
| 8699 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8700 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8701 | params.SetSubscriptionID(&restSubId) |
| 8702 | params.SetTimeToWait("w200ms") |
| 8703 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8704 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8705 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8706 | |
| 8707 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8708 | mainCtrl.SetResetTestFlag(t, false) |
| 8709 | |
| 8710 | // SubsResp is missing due to submgr restart |
| 8711 | |
| 8712 | mainCtrl.SimulateRestart(t) |
| 8713 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8714 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8715 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8716 | // That needs to be completed before successful subscription query is possible |
| 8717 | <-time.After(time.Second * 1) |
| 8718 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8719 | // Check subscription |
| 8720 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8721 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8722 | // Delete subscription |
| 8723 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8724 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8725 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8726 | |
| 8727 | //Wait that subs is cleaned |
| 8728 | waitSubsCleanup(t, e2SubsId, 10) |
| 8729 | |
| 8730 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8731 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8732 | } |
| 8733 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8734 | //////////////////////////////////////////////////////////////////////////////////// |
| 8735 | // Services for UT cases |
| 8736 | //////////////////////////////////////////////////////////////////////////////////// |
| 8737 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8738 | const host string = "localhost" |
| 8739 | |
| 8740 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8741 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8742 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8743 | } |
| 8744 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8745 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8746 | |
| 8747 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8748 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8749 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8750 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8751 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8752 | |
| 8753 | return restSubId, e2SubsId |
| 8754 | } |
| 8755 | |
| 8756 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8757 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8758 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8759 | if meid != "" { |
| 8760 | params.SetMeid(meid) |
| 8761 | } |
| 8762 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8763 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8764 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8765 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8766 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8767 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8768 | |
| 8769 | return restSubId, e2SubsId |
| 8770 | } |
| 8771 | |
| 8772 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8773 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8774 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8775 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8776 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8777 | |
| 8778 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8779 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8780 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8781 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8782 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8783 | |
| 8784 | return restSubId, e2SubsId |
| 8785 | } |
| 8786 | |
| 8787 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8788 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8789 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8790 | |
| 8791 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8792 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8793 | fparams1.Set(crereq1) |
| 8794 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8795 | |
| 8796 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8797 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8798 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8799 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8800 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8801 | |
| 8802 | return restSubId, e2SubsId |
| 8803 | } |
| 8804 | |
| 8805 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8806 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8807 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8808 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8809 | } |
| 8810 | |
| 8811 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8812 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8813 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8814 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8815 | } |
| 8816 | |
| 8817 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8818 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8819 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8820 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8821 | } |
| 8822 | |
| 8823 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8824 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8825 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8826 | assert.Equal(t, meid, resp[0].Meid) |
| 8827 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8828 | } |
| 8829 | |
| 8830 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8831 | //Wait that subs is cleaned |
| 8832 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8833 | |
| 8834 | xappConn1.TestMsgChanEmpty(t) |
| 8835 | xappConn2.TestMsgChanEmpty(t) |
| 8836 | e2termConn1.TestMsgChanEmpty(t) |
| 8837 | mainCtrl.wait_registry_empty(t, timeout) |
| 8838 | } |
| 8839 | |
| 8840 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8841 | |
| 8842 | var e2SubsId []uint32 |
| 8843 | |
| 8844 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8845 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8846 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8847 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8848 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8849 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8850 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8851 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8852 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8853 | <-time.After(100 * time.Millisecond) |
| 8854 | } |
| 8855 | return e2SubsId |
| 8856 | } |
| 8857 | |
| 8858 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8859 | |
| 8860 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8861 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8862 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8863 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8864 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8865 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8866 | <-time.After(100 * time.Millisecond) |
| 8867 | } |
| 8868 | |
| 8869 | // Wait that subs is cleaned |
| 8870 | for i := 0; i < len(e2SubsIds); i++ { |
| 8871 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8872 | } |
| 8873 | |
| 8874 | } |