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 | //----------------------------------------------------------------------------- |
| 885 | // TestSubReqRetransmission |
| 886 | // |
| 887 | // stub stub |
| 888 | // +-------+ +---------+ +---------+ |
| 889 | // | xapp | | submgr | | e2term | |
| 890 | // +-------+ +---------+ +---------+ |
| 891 | // | | | |
| 892 | // | SubReq | | |
| 893 | // |------------->| | |
| 894 | // | | | |
| 895 | // | | SubReq | |
| 896 | // | |------------->| |
| 897 | // | | | |
| 898 | // | SubReq | | |
| 899 | // | (retrans) | | |
| 900 | // |------------->| | |
| 901 | // | | | |
| 902 | // | | SubResp | |
| 903 | // | |<-------------| |
| 904 | // | | | |
| 905 | // | SubResp | | |
| 906 | // |<-------------| | |
| 907 | // | | | |
| 908 | // | [SUBS DELETE] | |
| 909 | // | | | |
| 910 | // |
| 911 | //----------------------------------------------------------------------------- |
| 912 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 913 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 914 | |
| 915 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 916 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 917 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 918 | |
| 919 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 920 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 921 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 922 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 923 | // hack as there is no real way to see has message be handled. |
| 924 | // Previuos counter check just tells that is has been received by submgr |
| 925 | // --> artificial delay |
| 926 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 927 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 928 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 929 | |
| 930 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 931 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 932 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 933 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 934 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 935 | |
| 936 | //Wait that subs is cleaned |
| 937 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 938 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 939 | xappConn1.TestMsgChanEmpty(t) |
| 940 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 941 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 942 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | //----------------------------------------------------------------------------- |
| 946 | // TestSubDelReqRetransmission |
| 947 | // |
| 948 | // stub stub |
| 949 | // +-------+ +---------+ +---------+ |
| 950 | // | xapp | | submgr | | e2term | |
| 951 | // +-------+ +---------+ +---------+ |
| 952 | // | | | |
| 953 | // | [SUBS CREATE] | |
| 954 | // | | | |
| 955 | // | | | |
| 956 | // | SubDelReq | | |
| 957 | // |------------->| | |
| 958 | // | | | |
| 959 | // | | SubDelReq | |
| 960 | // | |------------->| |
| 961 | // | | | |
| 962 | // | SubDelReq | | |
| 963 | // | (same sub) | | |
| 964 | // | (same xid) | | |
| 965 | // |------------->| | |
| 966 | // | | | |
| 967 | // | | SubDelResp | |
| 968 | // | |<-------------| |
| 969 | // | | | |
| 970 | // | SubDelResp | | |
| 971 | // |<-------------| | |
| 972 | // |
| 973 | //----------------------------------------------------------------------------- |
| 974 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 975 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 976 | |
| 977 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 978 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 979 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 980 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 981 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 982 | |
| 983 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 984 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 985 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 986 | |
| 987 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 988 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 989 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 990 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 991 | // hack as there is no real way to see has message be handled. |
| 992 | // Previuos counter check just tells that is has been received by submgr |
| 993 | // --> artificial delay |
| 994 | <-time.After(1 * time.Second) |
| 995 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 996 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 997 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 998 | |
| 999 | //Wait that subs is cleaned |
| 1000 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1001 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1002 | xappConn1.TestMsgChanEmpty(t) |
| 1003 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1004 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1005 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | //----------------------------------------------------------------------------- |
| 1009 | // TestSubDelReqCollision |
| 1010 | // |
| 1011 | // stub stub |
| 1012 | // +-------+ +---------+ +---------+ |
| 1013 | // | xapp | | submgr | | e2term | |
| 1014 | // +-------+ +---------+ +---------+ |
| 1015 | // | | | |
| 1016 | // | [SUBS CREATE] | |
| 1017 | // | | | |
| 1018 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1019 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1020 | // |------------->| | |
| 1021 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1022 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1023 | // | |------------->| |
| 1024 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1025 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1026 | // | (same sub) | | |
| 1027 | // | (diff xid) | | |
| 1028 | // |------------->| | |
| 1029 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1030 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1031 | // | |<-------------| |
| 1032 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1033 | // | SubDelResp 1 | | |
| 1034 | // |<-------------| | |
| 1035 | // | | | |
| 1036 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1037 | // |<-------------| | |
| 1038 | // |
| 1039 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1040 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1041 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1042 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1043 | |
| 1044 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1045 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1046 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1047 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1048 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1049 | |
| 1050 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1051 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1052 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1053 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1054 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1055 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1056 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1057 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1058 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1059 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1060 | // hack as there is no real way to see has message be handled. |
| 1061 | // Previuos counter check just tells that is has been received by submgr |
| 1062 | // --> artificial delay |
| 1063 | <-time.After(1 * time.Second) |
| 1064 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1065 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1066 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1067 | |
| 1068 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1069 | xappConn1.RecvSubsDelResp(t, nil) |
| 1070 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1071 | |
| 1072 | //Wait that subs is cleaned |
| 1073 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1074 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1075 | xappConn1.TestMsgChanEmpty(t) |
| 1076 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1077 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1078 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1079 | } |
| 1080 | |
| 1081 | //----------------------------------------------------------------------------- |
| 1082 | // TestSubReqAndSubDelOkTwoParallel |
| 1083 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1084 | // stub stub stub |
| 1085 | // +-------+ +-------+ +---------+ +---------+ |
| 1086 | // | xapp | | xapp | | submgr | | e2term | |
| 1087 | // +-------+ +-------+ +---------+ +---------+ |
| 1088 | // | | | | |
| 1089 | // | | | | |
| 1090 | // | | | | |
| 1091 | // | | SubReq1 | | |
| 1092 | // | |------------->| | |
| 1093 | // | | | | |
| 1094 | // | | | SubReq1 | |
| 1095 | // | | |------------->| |
| 1096 | // | | | | |
| 1097 | // | SubReq2 | | |
| 1098 | // |------------------------>| | |
| 1099 | // | | | | |
| 1100 | // | | | SubReq2 | |
| 1101 | // | | |------------->| |
| 1102 | // | | | | |
| 1103 | // | | | SubResp1 | |
| 1104 | // | | |<-------------| |
| 1105 | // | | SubResp1 | | |
| 1106 | // | |<-------------| | |
| 1107 | // | | | | |
| 1108 | // | | | SubResp2 | |
| 1109 | // | | |<-------------| |
| 1110 | // | SubResp2 | | |
| 1111 | // |<------------------------| | |
| 1112 | // | | | | |
| 1113 | // | | [SUBS 1 DELETE] | |
| 1114 | // | | | | |
| 1115 | // | | [SUBS 2 DELETE] | |
| 1116 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1117 | // |
| 1118 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1119 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1120 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1121 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1122 | |
| 1123 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1124 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1125 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1126 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1127 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1128 | |
| 1129 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1130 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1131 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1132 | |
| 1133 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1134 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1135 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1136 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1137 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1138 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1139 | |
| 1140 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1141 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1142 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | |
| 1144 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1146 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | |
| 1148 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1150 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1151 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1152 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1153 | //Wait that subs is cleaned |
| 1154 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1155 | |
| 1156 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1157 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1158 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1159 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1160 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1161 | //Wait that subs is cleaned |
| 1162 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1163 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1164 | xappConn1.TestMsgChanEmpty(t) |
| 1165 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1166 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1167 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | //----------------------------------------------------------------------------- |
| 1171 | // TestSameSubsDiffRan |
| 1172 | // Same subscription to different RANs |
| 1173 | // |
| 1174 | // stub stub |
| 1175 | // +-------+ +---------+ +---------+ |
| 1176 | // | xapp | | submgr | | e2term | |
| 1177 | // +-------+ +---------+ +---------+ |
| 1178 | // | | | |
| 1179 | // | | | |
| 1180 | // | | | |
| 1181 | // | SubReq(r1) | | |
| 1182 | // |------------->| | |
| 1183 | // | | | |
| 1184 | // | | SubReq(r1) | |
| 1185 | // | |------------->| |
| 1186 | // | | | |
| 1187 | // | | SubResp(r1) | |
| 1188 | // | |<-------------| |
| 1189 | // | | | |
| 1190 | // | SubResp(r1) | | |
| 1191 | // |<-------------| | |
| 1192 | // | | | |
| 1193 | // | SubReq(r2) | | |
| 1194 | // |------------->| | |
| 1195 | // | | | |
| 1196 | // | | SubReq(r2) | |
| 1197 | // | |------------->| |
| 1198 | // | | | |
| 1199 | // | | SubResp(r2) | |
| 1200 | // | |<-------------| |
| 1201 | // | | | |
| 1202 | // | SubResp(r2) | | |
| 1203 | // |<-------------| | |
| 1204 | // | | | |
| 1205 | // | [SUBS r1 DELETE] | |
| 1206 | // | | | |
| 1207 | // | [SUBS r2 DELETE] | |
| 1208 | // | | | |
| 1209 | // |
| 1210 | //----------------------------------------------------------------------------- |
| 1211 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1212 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1213 | |
| 1214 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1215 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1216 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1217 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1218 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1219 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1220 | |
| 1221 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1222 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1223 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1224 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1225 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1226 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1227 | |
| 1228 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1229 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1230 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1231 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1232 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1233 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1234 | //Wait that subs is cleaned |
| 1235 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1236 | |
| 1237 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1238 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1239 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1240 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1241 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1242 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1243 | //Wait that subs is cleaned |
| 1244 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1245 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1246 | xappConn1.TestMsgChanEmpty(t) |
| 1247 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1248 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1249 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1250 | } |
| 1251 | |
| 1252 | //----------------------------------------------------------------------------- |
| 1253 | // TestSubReqRetryInSubmgr |
| 1254 | // |
| 1255 | // stub stub |
| 1256 | // +-------+ +---------+ +---------+ |
| 1257 | // | xapp | | submgr | | e2term | |
| 1258 | // +-------+ +---------+ +---------+ |
| 1259 | // | | | |
| 1260 | // | SubReq | | |
| 1261 | // |------------->| | |
| 1262 | // | | | |
| 1263 | // | | SubReq | |
| 1264 | // | |------------->| |
| 1265 | // | | | |
| 1266 | // | | | |
| 1267 | // | | SubReq | |
| 1268 | // | |------------->| |
| 1269 | // | | | |
| 1270 | // | | SubResp | |
| 1271 | // | |<-------------| |
| 1272 | // | | | |
| 1273 | // | SubResp | | |
| 1274 | // |<-------------| | |
| 1275 | // | | | |
| 1276 | // | [SUBS DELETE] | |
| 1277 | // | | | |
| 1278 | // |
| 1279 | //----------------------------------------------------------------------------- |
| 1280 | |
| 1281 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1282 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1283 | |
| 1284 | // Init counter check |
| 1285 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1286 | Counter{cSubReqFromXapp, 1}, |
| 1287 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1288 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1289 | Counter{cSubReReqToE2, 1}, |
| 1290 | Counter{cSubRespFromE2, 1}, |
| 1291 | Counter{cSubRespToXapp, 1}, |
| 1292 | Counter{cSubDelReqFromXapp, 1}, |
| 1293 | Counter{cSubDelReqToE2, 1}, |
| 1294 | Counter{cSubDelRespFromE2, 1}, |
| 1295 | Counter{cSubDelRespToXapp, 1}, |
| 1296 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1297 | |
| 1298 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1299 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1300 | |
| 1301 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1302 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1303 | |
| 1304 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1305 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1306 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1307 | |
| 1308 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1309 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1310 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1311 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1312 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1313 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1314 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1315 | |
| 1316 | // Wait that subs is cleaned |
| 1317 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1318 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | xappConn1.TestMsgChanEmpty(t) |
| 1320 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1321 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1322 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1323 | |
| 1324 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1325 | } |
| 1326 | |
| 1327 | //----------------------------------------------------------------------------- |
| 1328 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1329 | // |
| 1330 | // stub stub |
| 1331 | // +-------+ +---------+ +---------+ |
| 1332 | // | xapp | | submgr | | e2term | |
| 1333 | // +-------+ +---------+ +---------+ |
| 1334 | // | | | |
| 1335 | // | SubReq | | |
| 1336 | // |------------->| | |
| 1337 | // | | | |
| 1338 | // | | SubReq | |
| 1339 | // | |------------->| |
| 1340 | // | | | |
| 1341 | // | | | |
| 1342 | // | | SubReq | |
| 1343 | // | |------------->| |
| 1344 | // | | | |
| 1345 | // | | SubDelReq | |
| 1346 | // | |------------->| |
| 1347 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1348 | // | | SubDelResp | |
| 1349 | // | |<-------------| |
| 1350 | // | | | |
| 1351 | // |
| 1352 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1353 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1354 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1355 | |
| 1356 | // Init counter check |
| 1357 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1358 | Counter{cSubReqFromXapp, 1}, |
| 1359 | Counter{cSubReqToE2, 1}, |
| 1360 | Counter{cSubReReqToE2, 1}, |
| 1361 | Counter{cSubReqTimerExpiry, 2}, |
| 1362 | Counter{cSubDelReqToE2, 1}, |
| 1363 | Counter{cSubDelRespFromE2, 1}, |
| 1364 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1365 | |
| 1366 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1367 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1368 | |
| 1369 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1370 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1371 | |
| 1372 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1373 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1374 | |
| 1375 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1376 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1377 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1378 | |
| 1379 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1380 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1381 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1382 | xappConn1.TestMsgChanEmpty(t) |
| 1383 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1384 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1385 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1386 | |
| 1387 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1388 | } |
| 1389 | |
| 1390 | //----------------------------------------------------------------------------- |
| 1391 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1392 | // |
| 1393 | // stub stub |
| 1394 | // +-------+ +---------+ +---------+ |
| 1395 | // | xapp | | submgr | | e2term | |
| 1396 | // +-------+ +---------+ +---------+ |
| 1397 | // | | | |
| 1398 | // | SubReq | | |
| 1399 | // |------------->| | |
| 1400 | // | | | |
| 1401 | // | | SubReq | |
| 1402 | // | |------------->| |
| 1403 | // | | | |
| 1404 | // | | | |
| 1405 | // | | SubReq | |
| 1406 | // | |------------->| |
| 1407 | // | | | |
| 1408 | // | | SubDelReq | |
| 1409 | // | |------------->| |
| 1410 | // | | | |
| 1411 | // | | | |
| 1412 | // | | SubDelReq | |
| 1413 | // | |------------->| |
| 1414 | // | | | |
| 1415 | // | | | |
| 1416 | // |
| 1417 | //----------------------------------------------------------------------------- |
| 1418 | |
| 1419 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1420 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1421 | |
| 1422 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1423 | Counter{cSubReqFromXapp, 1}, |
| 1424 | Counter{cSubReqToE2, 1}, |
| 1425 | Counter{cSubReReqToE2, 1}, |
| 1426 | Counter{cSubReqTimerExpiry, 2}, |
| 1427 | Counter{cSubDelReqToE2, 1}, |
| 1428 | Counter{cSubDelReReqToE2, 1}, |
| 1429 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1430 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1431 | |
| 1432 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1433 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1434 | |
| 1435 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1436 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1437 | |
| 1438 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1439 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1440 | |
| 1441 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1442 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1443 | |
| 1444 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1445 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1446 | |
| 1447 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1448 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1449 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1450 | xappConn1.TestMsgChanEmpty(t) |
| 1451 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1452 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1453 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1454 | |
| 1455 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1456 | } |
| 1457 | |
| 1458 | //----------------------------------------------------------------------------- |
| 1459 | // TestSubReqSubFailRespInSubmgr |
| 1460 | // |
| 1461 | // stub stub |
| 1462 | // +-------+ +---------+ +---------+ |
| 1463 | // | xapp | | submgr | | e2term | |
| 1464 | // +-------+ +---------+ +---------+ |
| 1465 | // | | | |
| 1466 | // | SubReq | | |
| 1467 | // |------------->| | |
| 1468 | // | | | |
| 1469 | // | | SubReq | |
| 1470 | // | |------------->| |
| 1471 | // | | | |
| 1472 | // | | SubFail | |
| 1473 | // | |<-------------| |
| 1474 | // | | | |
| 1475 | // | SubFail | | |
| 1476 | // |<-------------| | |
| 1477 | // | | | |
| 1478 | // |
| 1479 | //----------------------------------------------------------------------------- |
| 1480 | |
| 1481 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1482 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1483 | |
| 1484 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1485 | Counter{cSubReqFromXapp, 1}, |
| 1486 | Counter{cSubReqToE2, 1}, |
| 1487 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1488 | Counter{cSubFailToXapp, 1}, |
| 1489 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1490 | |
| 1491 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1492 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1493 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1494 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1495 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1496 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1497 | fparams1.Set(crereq1) |
| 1498 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1499 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1500 | // Xapp: Receive SubsFail |
| 1501 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1502 | |
| 1503 | // Wait that subs is cleaned |
| 1504 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1505 | |
| 1506 | xappConn1.TestMsgChanEmpty(t) |
| 1507 | xappConn2.TestMsgChanEmpty(t) |
| 1508 | e2termConn1.TestMsgChanEmpty(t) |
| 1509 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1510 | |
| 1511 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1512 | } |
| 1513 | |
| 1514 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1515 | // TestSubDelReqRetryInSubmgr |
| 1516 | // |
| 1517 | // stub stub |
| 1518 | // +-------+ +---------+ +---------+ |
| 1519 | // | xapp | | submgr | | e2term | |
| 1520 | // +-------+ +---------+ +---------+ |
| 1521 | // | | | |
| 1522 | // | [SUBS CREATE] | |
| 1523 | // | | | |
| 1524 | // | | | |
| 1525 | // | SubDelReq | | |
| 1526 | // |------------->| | |
| 1527 | // | | | |
| 1528 | // | | SubDelReq | |
| 1529 | // | |------------->| |
| 1530 | // | | | |
| 1531 | // | | SubDelReq | |
| 1532 | // | |------------->| |
| 1533 | // | | | |
| 1534 | // | | SubDelResp | |
| 1535 | // | |<-------------| |
| 1536 | // | | | |
| 1537 | // | SubDelResp | | |
| 1538 | // |<-------------| | |
| 1539 | // |
| 1540 | //----------------------------------------------------------------------------- |
| 1541 | |
| 1542 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1543 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1544 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1545 | |
| 1546 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1547 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1548 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1549 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1550 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1551 | |
| 1552 | // Subs Delete |
| 1553 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1554 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1555 | |
| 1556 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1557 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1558 | |
| 1559 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1560 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1561 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1562 | |
| 1563 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1564 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1565 | |
| 1566 | // Wait that subs is cleaned |
| 1567 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1568 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1569 | xappConn1.TestMsgChanEmpty(t) |
| 1570 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1571 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1572 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1573 | } |
| 1574 | |
| 1575 | //----------------------------------------------------------------------------- |
| 1576 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1577 | // |
| 1578 | // stub stub |
| 1579 | // +-------+ +---------+ +---------+ |
| 1580 | // | xapp | | submgr | | e2term | |
| 1581 | // +-------+ +---------+ +---------+ |
| 1582 | // | | | |
| 1583 | // | [SUBS CREATE] | |
| 1584 | // | | | |
| 1585 | // | | | |
| 1586 | // | SubDelReq | | |
| 1587 | // |------------->| | |
| 1588 | // | | | |
| 1589 | // | | SubDelReq | |
| 1590 | // | |------------->| |
| 1591 | // | | | |
| 1592 | // | | SubDelReq | |
| 1593 | // | |------------->| |
| 1594 | // | | | |
| 1595 | // | | | |
| 1596 | // | SubDelResp | | |
| 1597 | // |<-------------| | |
| 1598 | // |
| 1599 | //----------------------------------------------------------------------------- |
| 1600 | |
| 1601 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1602 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1603 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1604 | |
| 1605 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1606 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1607 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1608 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1609 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1610 | |
| 1611 | // Subs Delete |
| 1612 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1613 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1614 | |
| 1615 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1616 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1617 | |
| 1618 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1619 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1620 | |
| 1621 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1622 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1623 | |
| 1624 | // Wait that subs is cleaned |
| 1625 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1626 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1627 | xappConn1.TestMsgChanEmpty(t) |
| 1628 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1629 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1630 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1631 | } |
| 1632 | |
| 1633 | //----------------------------------------------------------------------------- |
| 1634 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1635 | // |
| 1636 | // stub stub |
| 1637 | // +-------+ +---------+ +---------+ |
| 1638 | // | xapp | | submgr | | e2term | |
| 1639 | // +-------+ +---------+ +---------+ |
| 1640 | // | | | |
| 1641 | // | [SUBS CREATE] | |
| 1642 | // | | | |
| 1643 | // | | | |
| 1644 | // | SubDelReq | | |
| 1645 | // |------------->| | |
| 1646 | // | | | |
| 1647 | // | | SubDelReq | |
| 1648 | // | |------------->| |
| 1649 | // | | | |
| 1650 | // | | SubDelFail | |
| 1651 | // | |<-------------| |
| 1652 | // | | | |
| 1653 | // | SubDelResp | | |
| 1654 | // |<-------------| | |
| 1655 | // | | | |
| 1656 | // |
| 1657 | //----------------------------------------------------------------------------- |
| 1658 | |
| 1659 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1660 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1661 | |
| 1662 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1663 | Counter{cSubReqFromXapp, 1}, |
| 1664 | Counter{cSubReqToE2, 1}, |
| 1665 | Counter{cSubRespFromE2, 1}, |
| 1666 | Counter{cSubRespToXapp, 1}, |
| 1667 | Counter{cSubDelReqFromXapp, 1}, |
| 1668 | Counter{cSubDelReqToE2, 1}, |
| 1669 | Counter{cSubDelFailFromE2, 1}, |
| 1670 | Counter{cSubDelRespToXapp, 1}, |
| 1671 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1672 | |
| 1673 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1674 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1675 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1676 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1677 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1678 | |
| 1679 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1680 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1681 | |
| 1682 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1683 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1684 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1685 | |
| 1686 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1687 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1688 | |
| 1689 | // Wait that subs is cleaned |
| 1690 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1691 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1692 | xappConn1.TestMsgChanEmpty(t) |
| 1693 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1694 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1695 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1696 | |
| 1697 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | //----------------------------------------------------------------------------- |
| 1701 | // TestSubReqAndSubDelOkSameAction |
| 1702 | // |
| 1703 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1704 | // +-------+ +-------+ +---------+ +---------+ |
| 1705 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1706 | // +-------+ +-------+ +---------+ +---------+ |
| 1707 | // | | | | |
| 1708 | // | | | | |
| 1709 | // | | | | |
| 1710 | // | | SubReq1 | | |
| 1711 | // | |------------->| | |
| 1712 | // | | | | |
| 1713 | // | | | SubReq1 | |
| 1714 | // | | |------------->| |
| 1715 | // | | | SubResp1 | |
| 1716 | // | | |<-------------| |
| 1717 | // | | SubResp1 | | |
| 1718 | // | |<-------------| | |
| 1719 | // | | | | |
| 1720 | // | SubReq2 | | |
| 1721 | // |--------------------------->| | |
| 1722 | // | | | | |
| 1723 | // | SubResp2 | | |
| 1724 | // |<---------------------------| | |
| 1725 | // | | | | |
| 1726 | // | | SubDelReq 1 | | |
| 1727 | // | |------------->| | |
| 1728 | // | | | | |
| 1729 | // | | SubDelResp 1 | | |
| 1730 | // | |<-------------| | |
| 1731 | // | | | | |
| 1732 | // | SubDelReq 2 | | |
| 1733 | // |--------------------------->| | |
| 1734 | // | | | | |
| 1735 | // | | | SubDelReq 2 | |
| 1736 | // | | |------------->| |
| 1737 | // | | | | |
| 1738 | // | | | SubDelReq 2 | |
| 1739 | // | | |------------->| |
| 1740 | // | | | | |
| 1741 | // | SubDelResp 2 | | |
| 1742 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1743 | // |
| 1744 | //----------------------------------------------------------------------------- |
| 1745 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1746 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1747 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1748 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1749 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1750 | Counter{cSubReqFromXapp, 2}, |
| 1751 | Counter{cSubReqToE2, 1}, |
| 1752 | Counter{cSubRespFromE2, 1}, |
| 1753 | Counter{cSubRespToXapp, 2}, |
| 1754 | Counter{cMergedSubscriptions, 1}, |
| 1755 | Counter{cUnmergedSubscriptions, 1}, |
| 1756 | Counter{cSubDelReqFromXapp, 2}, |
| 1757 | Counter{cSubDelReqToE2, 1}, |
| 1758 | Counter{cSubDelRespFromE2, 1}, |
| 1759 | Counter{cSubDelRespToXapp, 2}, |
| 1760 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1761 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1762 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1763 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1764 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1765 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1766 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1767 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1768 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1769 | |
| 1770 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1771 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1772 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1773 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1774 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1775 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1776 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1777 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1778 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1779 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1780 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1781 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1782 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1783 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1784 | |
| 1785 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1786 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1787 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1788 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1789 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1790 | //Wait that subs is cleaned |
| 1791 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1792 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1793 | xappConn1.TestMsgChanEmpty(t) |
| 1794 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1795 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1796 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1797 | |
| 1798 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1799 | } |
| 1800 | |
| 1801 | //----------------------------------------------------------------------------- |
| 1802 | // TestSubReqAndSubDelOkSameActionParallel |
| 1803 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1804 | // stub stub stub |
| 1805 | // +-------+ +-------+ +---------+ +---------+ |
| 1806 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1807 | // +-------+ +-------+ +---------+ +---------+ |
| 1808 | // | | | | |
| 1809 | // | | | | |
| 1810 | // | | | | |
| 1811 | // | | SubReq1 | | |
| 1812 | // | |------------->| | |
| 1813 | // | | | | |
| 1814 | // | | | SubReq1 | |
| 1815 | // | | |------------->| |
| 1816 | // | SubReq2 | | |
| 1817 | // |--------------------------->| | |
| 1818 | // | | | SubResp1 | |
| 1819 | // | | |<-------------| |
| 1820 | // | | SubResp1 | | |
| 1821 | // | |<-------------| | |
| 1822 | // | | | | |
| 1823 | // | SubResp2 | | |
| 1824 | // |<---------------------------| | |
| 1825 | // | | | | |
| 1826 | // | | SubDelReq 1 | | |
| 1827 | // | |------------->| | |
| 1828 | // | | | | |
| 1829 | // | | SubDelResp 1 | | |
| 1830 | // | |<-------------| | |
| 1831 | // | | | | |
| 1832 | // | SubDelReq 2 | | |
| 1833 | // |--------------------------->| | |
| 1834 | // | | | | |
| 1835 | // | | | SubDelReq 2 | |
| 1836 | // | | |------------->| |
| 1837 | // | | | | |
| 1838 | // | | | SubDelReq 2 | |
| 1839 | // | | |------------->| |
| 1840 | // | | | | |
| 1841 | // | SubDelResp 2 | | |
| 1842 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1843 | // |
| 1844 | //----------------------------------------------------------------------------- |
| 1845 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1846 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1847 | |
| 1848 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1849 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1850 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1851 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1852 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1853 | |
| 1854 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1855 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1856 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1857 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1858 | |
| 1859 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1860 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1861 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1862 | |
| 1863 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1864 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1865 | |
| 1866 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1867 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1868 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1869 | |
| 1870 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1871 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1872 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1873 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1874 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1875 | |
| 1876 | //Wait that subs is cleaned |
| 1877 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1878 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1879 | xappConn1.TestMsgChanEmpty(t) |
| 1880 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1881 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1882 | mainCtrl.wait_registry_empty(t, 10) |
| 1883 | } |
| 1884 | |
| 1885 | //----------------------------------------------------------------------------- |
| 1886 | // TestSubReqAndSubDelNokSameActionParallel |
| 1887 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1888 | // stub stub stub |
| 1889 | // +-------+ +-------+ +---------+ +---------+ |
| 1890 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1891 | // +-------+ +-------+ +---------+ +---------+ |
| 1892 | // | | | | |
| 1893 | // | | | | |
| 1894 | // | | | | |
| 1895 | // | | SubReq1 | | |
| 1896 | // | |------------->| | |
| 1897 | // | | | | |
| 1898 | // | | | SubReq1 | |
| 1899 | // | | |------------->| |
| 1900 | // | SubReq2 | | |
| 1901 | // |--------------------------->| | |
| 1902 | // | | | SubFail1 | |
| 1903 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1904 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1905 | // | | SubFail1 | | |
| 1906 | // | |<-------------| | |
| 1907 | // | | | | |
| 1908 | // | SubFail2 | | |
| 1909 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1910 | // |
| 1911 | //----------------------------------------------------------------------------- |
| 1912 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1913 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1914 | |
| 1915 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1916 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1917 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1918 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1919 | |
| 1920 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1921 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1922 | |
| 1923 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1924 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1925 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1926 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1927 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1928 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1929 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1930 | // E2t: send SubsFail (first) |
| 1931 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1932 | fparams1.Set(crereq1) |
| 1933 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1934 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1935 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1936 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1937 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1938 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1939 | |
| 1940 | //Wait that subs is cleaned |
| 1941 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1942 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1943 | xappConn1.TestMsgChanEmpty(t) |
| 1944 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1945 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1946 | mainCtrl.wait_registry_empty(t, 10) |
| 1947 | } |
| 1948 | |
| 1949 | //----------------------------------------------------------------------------- |
| 1950 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1951 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1952 | // stub stub stub |
| 1953 | // +-------+ +-------+ +---------+ +---------+ |
| 1954 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1955 | // +-------+ +-------+ +---------+ +---------+ |
| 1956 | // | | | | |
| 1957 | // | | | | |
| 1958 | // | | | | |
| 1959 | // | | SubReq1 | | |
| 1960 | // | |------------->| | |
| 1961 | // | | | | |
| 1962 | // | | | SubReq1 | |
| 1963 | // | | |------------->| |
| 1964 | // | | SubReq2 | | |
| 1965 | // |--------------------------->| | |
| 1966 | // | | | | |
| 1967 | // | | | SubReq1 | |
| 1968 | // | | |------------->| |
| 1969 | // | | | | |
| 1970 | // | | | | |
| 1971 | // | | | SubDelReq | |
| 1972 | // | | |------------->| |
| 1973 | // | | | | |
| 1974 | // | | | SubDelResp | |
| 1975 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1976 | // |
| 1977 | //----------------------------------------------------------------------------- |
| 1978 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1979 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1980 | |
| 1981 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1982 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1983 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1984 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1985 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1986 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1987 | |
| 1988 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1989 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1990 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1991 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1992 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1993 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1994 | |
| 1995 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1996 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1997 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1998 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1999 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2000 | |
| 2001 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2002 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2003 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2004 | xappConn1.TestMsgChanEmpty(t) |
| 2005 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2006 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2007 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2008 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2009 | |
| 2010 | //----------------------------- Policy cases --------------------------------- |
| 2011 | //----------------------------------------------------------------------------- |
| 2012 | // TestSubReqPolicyAndSubDelOk |
| 2013 | // |
| 2014 | // stub stub |
| 2015 | // +-------+ +---------+ +---------+ |
| 2016 | // | xapp | | submgr | | e2term | |
| 2017 | // +-------+ +---------+ +---------+ |
| 2018 | // | | | |
| 2019 | // | SubReq | | |
| 2020 | // |------------->| | |
| 2021 | // | | | |
| 2022 | // | | SubReq | |
| 2023 | // | |------------->| |
| 2024 | // | | | |
| 2025 | // | | SubResp | |
| 2026 | // | |<-------------| |
| 2027 | // | | | |
| 2028 | // | SubResp | | |
| 2029 | // |<-------------| | |
| 2030 | // | | | |
| 2031 | // | | | |
| 2032 | // | SubDelReq | | |
| 2033 | // |------------->| | |
| 2034 | // | | | |
| 2035 | // | | SubDelReq | |
| 2036 | // | |------------->| |
| 2037 | // | | | |
| 2038 | // | | SubDelResp | |
| 2039 | // | |<-------------| |
| 2040 | // | | | |
| 2041 | // | SubDelResp | | |
| 2042 | // |<-------------| | |
| 2043 | // |
| 2044 | //----------------------------------------------------------------------------- |
| 2045 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2046 | CaseBegin("TestSubReqAndSubDelOk") |
| 2047 | |
| 2048 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2049 | rparams1.Init() |
| 2050 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2051 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2052 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2053 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2054 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2055 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2056 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2057 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2058 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2059 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2060 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2061 | |
| 2062 | //Wait that subs is cleaned |
| 2063 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2064 | |
| 2065 | xappConn1.TestMsgChanEmpty(t) |
| 2066 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2067 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2068 | mainCtrl.wait_registry_empty(t, 10) |
| 2069 | } |
| 2070 | |
| 2071 | //----------------------------------------------------------------------------- |
| 2072 | // TestSubReqPolicyChangeAndSubDelOk |
| 2073 | // |
| 2074 | // stub stub |
| 2075 | // +-------+ +---------+ +---------+ |
| 2076 | // | xapp | | submgr | | e2term | |
| 2077 | // +-------+ +---------+ +---------+ |
| 2078 | // | | | |
| 2079 | // | SubReq | | |
| 2080 | // |------------->| | |
| 2081 | // | | | |
| 2082 | // | | SubReq | |
| 2083 | // | |------------->| |
| 2084 | // | | | |
| 2085 | // | | SubResp | |
| 2086 | // | |<-------------| |
| 2087 | // | | | |
| 2088 | // | SubResp | | |
| 2089 | // |<-------------| | |
| 2090 | // | | | |
| 2091 | // | SubReq | | |
| 2092 | // |------------->| | |
| 2093 | // | | | |
| 2094 | // | | SubReq | |
| 2095 | // | |------------->| |
| 2096 | // | | | |
| 2097 | // | | SubResp | |
| 2098 | // | |<-------------| |
| 2099 | // | | | |
| 2100 | // | SubResp | | |
| 2101 | // |<-------------| | |
| 2102 | // | | | |
| 2103 | // | SubDelReq | | |
| 2104 | // |------------->| | |
| 2105 | // | | | |
| 2106 | // | | SubDelReq | |
| 2107 | // | |------------->| |
| 2108 | // | | | |
| 2109 | // | | SubDelResp | |
| 2110 | // | |<-------------| |
| 2111 | // | | | |
| 2112 | // | SubDelResp | | |
| 2113 | // |<-------------| | |
| 2114 | // |
| 2115 | //----------------------------------------------------------------------------- |
| 2116 | |
| 2117 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2118 | CaseBegin("TestSubReqAndSubDelOk") |
| 2119 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2120 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2121 | rparams1.Init() |
| 2122 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2123 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2124 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2125 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2126 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2127 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2128 | |
| 2129 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2130 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2131 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2132 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2133 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2134 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2135 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2136 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2137 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2138 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2139 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2140 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2141 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2142 | |
| 2143 | //Wait that subs is cleaned |
| 2144 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2145 | |
| 2146 | xappConn1.TestMsgChanEmpty(t) |
| 2147 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2148 | e2termConn1.TestMsgChanEmpty(t) |
| 2149 | mainCtrl.wait_registry_empty(t, 10) |
| 2150 | } |
| 2151 | |
| 2152 | //----------------------------------------------------------------------------- |
| 2153 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2154 | // |
| 2155 | // stub stub stub |
| 2156 | // +-------+ +---------+ +---------+ +---------+ |
| 2157 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2158 | // +-------+ +---------+ +---------+ +---------+ |
| 2159 | // | | | | |
| 2160 | // | | | | |
| 2161 | // | | | | |
| 2162 | // | SubReq1 | | | |
| 2163 | // |------------->| | | |
| 2164 | // | | | | |
| 2165 | // | | SubReq1 | | |
| 2166 | // | |------------->| | |
| 2167 | // | | | | |
| 2168 | // | SubReq2 | | | |
| 2169 | // |------------->| | | |
| 2170 | // | | | | |
| 2171 | // | | SubReq2 | | |
| 2172 | // | |---------------------------->| |
| 2173 | // | | | | |
| 2174 | // | | SubResp1 | | |
| 2175 | // | |<-------------| | |
| 2176 | // | SubResp1 | | | |
| 2177 | // |<-------------| | | |
| 2178 | // | | SubResp2 | | |
| 2179 | // | |<----------------------------| |
| 2180 | // | SubResp2 | | | |
| 2181 | // |<-------------| | | |
| 2182 | // | | | | |
| 2183 | // | [SUBS 1 DELETE] | | |
| 2184 | // | | | | |
| 2185 | // | [SUBS 2 DELETE] | | |
| 2186 | // | | | | |
| 2187 | // |
| 2188 | //----------------------------------------------------------------------------- |
| 2189 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2190 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2191 | |
| 2192 | //Req1 |
| 2193 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2194 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2195 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2196 | |
| 2197 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2198 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2199 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2200 | |
| 2201 | //Resp1 |
| 2202 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2203 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2204 | |
| 2205 | //Resp2 |
| 2206 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2207 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2208 | |
| 2209 | //Del1 |
| 2210 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2211 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2212 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2213 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2214 | //Wait that subs is cleaned |
| 2215 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2216 | |
| 2217 | //Del2 |
| 2218 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2219 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2220 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2221 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2222 | //Wait that subs is cleaned |
| 2223 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2224 | |
| 2225 | xappConn1.TestMsgChanEmpty(t) |
| 2226 | xappConn2.TestMsgChanEmpty(t) |
| 2227 | e2termConn1.TestMsgChanEmpty(t) |
| 2228 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2229 | mainCtrl.wait_registry_empty(t, 10) |
| 2230 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2231 | |
| 2232 | //----------------------------------------------------------------------------- |
| 2233 | // TestSubReqInsertAndSubDelOk |
| 2234 | // |
| 2235 | // stub stub |
| 2236 | // +-------+ +---------+ +---------+ |
| 2237 | // | xapp | | submgr | | e2term | |
| 2238 | // +-------+ +---------+ +---------+ |
| 2239 | // | | | |
| 2240 | // | SubReq | | |
| 2241 | // |------------->| | |
| 2242 | // | | | |
| 2243 | // | | SubReq | |
| 2244 | // | |------------->| |
| 2245 | // | | | |
| 2246 | // | | SubResp | |
| 2247 | // | |<-------------| |
| 2248 | // | | | |
| 2249 | // | SubResp | | |
| 2250 | // |<-------------| | |
| 2251 | // | | | |
| 2252 | // | | | |
| 2253 | // | SubDelReq | | |
| 2254 | // |------------->| | |
| 2255 | // | | | |
| 2256 | // | | SubDelReq | |
| 2257 | // | |------------->| |
| 2258 | // | | | |
| 2259 | // | | SubDelResp | |
| 2260 | // | |<-------------| |
| 2261 | // | | | |
| 2262 | // | SubDelResp | | |
| 2263 | // |<-------------| | |
| 2264 | // |
| 2265 | //----------------------------------------------------------------------------- |
| 2266 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2267 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2268 | |
| 2269 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2270 | rparams1.Init() |
| 2271 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2272 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2273 | |
| 2274 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2275 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2276 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2277 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2278 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2279 | |
| 2280 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2281 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2282 | |
| 2283 | //Wait that subs is cleaned |
| 2284 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2285 | |
| 2286 | xappConn1.TestMsgChanEmpty(t) |
| 2287 | xappConn2.TestMsgChanEmpty(t) |
| 2288 | e2termConn1.TestMsgChanEmpty(t) |
| 2289 | mainCtrl.wait_registry_empty(t, 10) |
| 2290 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2291 | |
| 2292 | //----------------------------------------------------------------------------- |
| 2293 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2294 | // |
| 2295 | // This case simulates case where xApp restarts and starts sending same |
| 2296 | // subscription requests which have already subscribed successfully |
| 2297 | |
| 2298 | // stub stub |
| 2299 | // +-------+ +---------+ +---------+ |
| 2300 | // | xapp | | submgr | | e2term | |
| 2301 | // +-------+ +---------+ +---------+ |
| 2302 | // | | | |
| 2303 | // | SubReq | | |
| 2304 | // |------------->| | |
| 2305 | // | | | |
| 2306 | // | | SubReq | |
| 2307 | // | |------------->| |
| 2308 | // | | | |
| 2309 | // | | SubResp | |
| 2310 | // | |<-------------| |
| 2311 | // | | | |
| 2312 | // | SubResp | | |
| 2313 | // |<-------------| | |
| 2314 | // | | | |
| 2315 | // | xApp restart | | |
| 2316 | // | | | |
| 2317 | // | SubReq | | |
| 2318 | // | (retrans with same xApp generated subid but diff xid) |
| 2319 | // |------------->| | |
| 2320 | // | | | |
| 2321 | // | SubResp | | |
| 2322 | // |<-------------| | |
| 2323 | // | | | |
| 2324 | // | [SUBS DELETE] | |
| 2325 | // | | | |
| 2326 | // |
| 2327 | //----------------------------------------------------------------------------- |
| 2328 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2329 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2330 | |
| 2331 | //Subs Create |
| 2332 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2333 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2334 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2335 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2336 | |
| 2337 | // xApp restart here |
| 2338 | // --> artificial delay |
| 2339 | <-time.After(1 * time.Second) |
| 2340 | |
| 2341 | //Subs Create |
| 2342 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2343 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2344 | |
| 2345 | //Subs Delete |
| 2346 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2347 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2348 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2349 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2350 | |
| 2351 | //Wait that subs is cleaned |
| 2352 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2353 | |
| 2354 | xappConn1.TestMsgChanEmpty(t) |
| 2355 | xappConn2.TestMsgChanEmpty(t) |
| 2356 | e2termConn1.TestMsgChanEmpty(t) |
| 2357 | mainCtrl.wait_registry_empty(t, 10) |
| 2358 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2359 | |
| 2360 | //----------------------------------------------------------------------------- |
| 2361 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2362 | // |
| 2363 | // stub stub |
| 2364 | // +-------+ +---------+ +---------+ |
| 2365 | // | xapp | | submgr | | e2term | |
| 2366 | // +-------+ +---------+ +---------+ |
| 2367 | // | | | |
| 2368 | // | SubReq | | |
| 2369 | // |------------->| | |
| 2370 | // | | | |
| 2371 | // | | SubReq | |
| 2372 | // | |------------->| |
| 2373 | // | | | |
| 2374 | // | | SubResp | |
| 2375 | // | <----| |
| 2376 | // | | |
| 2377 | // | Submgr restart | |
| 2378 | // | | |
| 2379 | // | | | |
| 2380 | // | | SubDelReq | |
| 2381 | // | |------------->| |
| 2382 | // | | | |
| 2383 | // | | SubDelResp | |
| 2384 | // | |<-------------| |
| 2385 | // | | | |
| 2386 | // |
| 2387 | //----------------------------------------------------------------------------- |
| 2388 | |
| 2389 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2390 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2391 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2392 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2393 | xappConn1.SendSubsReq(t, nil, nil) |
| 2394 | e2termConn1.RecvSubsReq(t) |
| 2395 | mainCtrl.SetResetTestFlag(t, false) |
| 2396 | |
| 2397 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2398 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2399 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2400 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2401 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2402 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2403 | mainCtrl.SimulateRestart(t) |
| 2404 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2405 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2406 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2407 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2408 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2409 | |
| 2410 | // Wait that subs is cleaned |
| 2411 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2412 | |
| 2413 | xappConn1.TestMsgChanEmpty(t) |
| 2414 | xappConn2.TestMsgChanEmpty(t) |
| 2415 | e2termConn1.TestMsgChanEmpty(t) |
| 2416 | mainCtrl.wait_registry_empty(t, 10) |
| 2417 | } |
| 2418 | |
| 2419 | //----------------------------------------------------------------------------- |
| 2420 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2421 | // |
| 2422 | // stub stub |
| 2423 | // +-------+ +---------+ +---------+ |
| 2424 | // | xapp | | submgr | | e2term | |
| 2425 | // +-------+ +---------+ +---------+ |
| 2426 | // | | | |
| 2427 | // | SubReq | | |
| 2428 | // |------------->| | |
| 2429 | // | | | |
| 2430 | // | | SubReq | |
| 2431 | // | |------------->| |
| 2432 | // | | | |
| 2433 | // | | SubResp | |
| 2434 | // | |<-------------| |
| 2435 | // | | | |
| 2436 | // | SubResp | | |
| 2437 | // |<-------------| | |
| 2438 | // | | | |
| 2439 | // | | |
| 2440 | // | Submgr restart | |
| 2441 | // | | |
| 2442 | // | SubDelReq | | |
| 2443 | // |------------->| | |
| 2444 | // | | | |
| 2445 | // | | SubDelReq | |
| 2446 | // | |------------->| |
| 2447 | // | | | |
| 2448 | // | | SubDelResp | |
| 2449 | // | |<-------------| |
| 2450 | // | | | |
| 2451 | // | SubDelResp | | |
| 2452 | // |<-------------| | |
| 2453 | // |
| 2454 | //----------------------------------------------------------------------------- |
| 2455 | |
| 2456 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2457 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2458 | |
| 2459 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2460 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2461 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2462 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2463 | |
| 2464 | // Check subscription |
| 2465 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2466 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2467 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2468 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2469 | |
| 2470 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2471 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2472 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2473 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2474 | // That needs to be completed before successful subscription query is possible |
| 2475 | <-time.After(time.Second * 1) |
| 2476 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2477 | // Check that subscription is restored correctly after restart |
| 2478 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2479 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2480 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2481 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2482 | |
| 2483 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2484 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2485 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2486 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2487 | |
| 2488 | //Wait that subs is cleaned |
| 2489 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2490 | |
| 2491 | xappConn1.TestMsgChanEmpty(t) |
| 2492 | xappConn2.TestMsgChanEmpty(t) |
| 2493 | e2termConn1.TestMsgChanEmpty(t) |
| 2494 | mainCtrl.wait_registry_empty(t, 10) |
| 2495 | } |
| 2496 | |
| 2497 | //----------------------------------------------------------------------------- |
| 2498 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2499 | // |
| 2500 | // stub stub |
| 2501 | // +-------+ +-------+ +---------+ +---------+ |
| 2502 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2503 | // +-------+ +-------+ +---------+ +---------+ |
| 2504 | // | | | | |
| 2505 | // | | | | |
| 2506 | // | | | | |
| 2507 | // | | SubReq1 | | |
| 2508 | // | |------------->| | |
| 2509 | // | | | | |
| 2510 | // | | | SubReq1 | |
| 2511 | // | | |------------->| |
| 2512 | // | | | SubResp1 | |
| 2513 | // | | |<-------------| |
| 2514 | // | | SubResp1 | | |
| 2515 | // | |<-------------| | |
| 2516 | // | | | | |
| 2517 | // | | |
| 2518 | // | submgr restart | |
| 2519 | // | | |
| 2520 | // | | | | |
| 2521 | // | | | | |
| 2522 | // | SubReq2 | | |
| 2523 | // |--------------------------->| | |
| 2524 | // | | | | |
| 2525 | // | SubResp2 | | |
| 2526 | // |<---------------------------| | |
| 2527 | // | | | | |
| 2528 | // | | SubDelReq 1 | | |
| 2529 | // | |------------->| | |
| 2530 | // | | | | |
| 2531 | // | | SubDelResp 1 | | |
| 2532 | // | |<-------------| | |
| 2533 | // | | | | |
| 2534 | // | | | | |
| 2535 | // | | |
| 2536 | // | submgr restart | |
| 2537 | // | | |
| 2538 | // | | | | |
| 2539 | // | SubDelReq 2 | | |
| 2540 | // |--------------------------->| | |
| 2541 | // | | | | |
| 2542 | // | | | SubDelReq 2 | |
| 2543 | // | | |------------->| |
| 2544 | // | | | | |
| 2545 | // | | | SubDelReq 2 | |
| 2546 | // | | |------------->| |
| 2547 | // | | | | |
| 2548 | // | SubDelResp 2 | | |
| 2549 | // |<---------------------------| | |
| 2550 | // |
| 2551 | //----------------------------------------------------------------------------- |
| 2552 | |
| 2553 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2554 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2555 | |
| 2556 | //Req1 |
| 2557 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2558 | rparams1.Init() |
| 2559 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2560 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2561 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2562 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2563 | |
| 2564 | //Req2 |
| 2565 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2566 | rparams2.Init() |
| 2567 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2568 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2569 | |
| 2570 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2571 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2572 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2573 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2574 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2575 | |
| 2576 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2577 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2578 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2579 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2580 | // That needs to be completed before successful subscription query is possible |
| 2581 | <-time.After(time.Second * 1) |
| 2582 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2583 | // Check that subscription is restored correctly after restart |
| 2584 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2585 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2586 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2587 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2588 | |
| 2589 | //Del1 |
| 2590 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2591 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2592 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2593 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2594 | |
| 2595 | mainCtrl.SimulateRestart(t) |
| 2596 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2597 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2598 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2599 | // Submgr need be ready before successful subscription deletion is possible |
| 2600 | <-time.After(time.Second * 1) |
| 2601 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2602 | //Del2 |
| 2603 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2604 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2605 | |
| 2606 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2607 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2608 | |
| 2609 | //Wait that subs is cleaned |
| 2610 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2611 | |
| 2612 | xappConn1.TestMsgChanEmpty(t) |
| 2613 | xappConn2.TestMsgChanEmpty(t) |
| 2614 | e2termConn1.TestMsgChanEmpty(t) |
| 2615 | mainCtrl.wait_registry_empty(t, 10) |
| 2616 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2617 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2618 | //***************************************************************************** |
| 2619 | // REST interface test cases |
| 2620 | //***************************************************************************** |
| 2621 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2622 | //----------------------------------------------------------------------------- |
| 2623 | // Test debug GET and POST requests |
| 2624 | // |
| 2625 | // curl |
| 2626 | // +-------+ +---------+ |
| 2627 | // | user | | submgr | |
| 2628 | // +-------+ +---------+ |
| 2629 | // | | |
| 2630 | // | GET/POST Req | |
| 2631 | // |------------->| |
| 2632 | // | Resp | |
| 2633 | // |<-------------| |
| 2634 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2635 | func TestGetSubscriptions(t *testing.T) { |
| 2636 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2637 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2638 | } |
| 2639 | |
| 2640 | func TestGetSymptomData(t *testing.T) { |
| 2641 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2642 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2643 | } |
| 2644 | |
| 2645 | func TestPostdeleteSubId(t *testing.T) { |
| 2646 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2647 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2648 | } |
| 2649 | |
| 2650 | func TestPostEmptyDb(t *testing.T) { |
| 2651 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2652 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2653 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2654 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2655 | func TestGetRestSubscriptions(t *testing.T) { |
| 2656 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 2657 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2658 | } |
| 2659 | |
| 2660 | //----------------------------------------------------------------------------- |
| 2661 | // TestDelAllE2nodeSubsViaDebugIf |
| 2662 | // |
| 2663 | // stub stub stub |
| 2664 | // +-------+ +---------+ +---------+ +---------+ |
| 2665 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2666 | // +-------+ +---------+ +---------+ +---------+ |
| 2667 | // | | | | |
| 2668 | // | RESTSubReq | | | |
| 2669 | // |---------------->| | | |
| 2670 | // | RESTSubResp | | | |
| 2671 | // |<----------------| | | |
| 2672 | // | | RouteCreate | | |
| 2673 | // | |--------------------------->| |
| 2674 | // | | RouteResponse| | |
| 2675 | // | |<---------------------------| |
| 2676 | // | | SubReq | | |
| 2677 | // | |------------->| | |
| 2678 | // | | SubResp | | |
| 2679 | // | |<-------------| | |
| 2680 | // | RESTNotif1 | | | |
| 2681 | // |<----------------| | | |
| 2682 | // | | | | |
| 2683 | // | REST get_all_e2nodes | | |
| 2684 | // |---------------->| | | |
| 2685 | // | OK 200 | | | |
| 2686 | // |<----------------| | | |
| 2687 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2688 | // |---------------->| | | |
| 2689 | // | OK 200 | | | |
| 2690 | // |<----------------| | | |
| 2691 | // | | SubDelReq | | |
| 2692 | // | |------------->| | |
| 2693 | // | | SubDelResp | | |
| 2694 | // | |<-------------| | |
| 2695 | // | | | | |
| 2696 | // | | RouteDelete | | |
| 2697 | // | |--------------------------->| |
| 2698 | // | | RouteResponse| | |
| 2699 | // | |<---------------------------| |
| 2700 | // |
| 2701 | //----------------------------------------------------------------------------- |
| 2702 | |
| 2703 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2704 | |
| 2705 | // Init counter check |
| 2706 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2707 | Counter{cRestSubReqFromXapp, 1}, |
| 2708 | Counter{cRestSubRespToXapp, 1}, |
| 2709 | Counter{cSubReqToE2, 1}, |
| 2710 | Counter{cSubRespFromE2, 1}, |
| 2711 | Counter{cRestSubNotifToXapp, 1}, |
| 2712 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2713 | Counter{cSubDelReqToE2, 1}, |
| 2714 | Counter{cSubDelRespFromE2, 1}, |
| 2715 | Counter{cRestSubDelRespToXapp, 1}, |
| 2716 | }) |
| 2717 | |
| 2718 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2719 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2720 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2721 | |
| 2722 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2723 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2724 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2725 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2726 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2727 | |
| 2728 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2729 | |
| 2730 | var e2nodesList []string |
| 2731 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2732 | if err != nil { |
| 2733 | t.Errorf("Unmarshal error: %s", err) |
| 2734 | } |
| 2735 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2736 | |
| 2737 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2738 | var e2RestSubsMap map[string]RESTSubscription |
| 2739 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2740 | if err != nil { |
| 2741 | t.Errorf("Unmarshal error: %s", err) |
| 2742 | } |
| 2743 | |
| 2744 | if len(e2RestSubsMap) != 1 { |
| 2745 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2746 | } |
| 2747 | |
| 2748 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2749 | 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] | 2750 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2751 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2752 | |
| 2753 | // Wait that subs is cleaned |
| 2754 | waitSubsCleanup(t, e2SubsId, 10) |
| 2755 | mainCtrl.VerifyCounterValues(t) |
| 2756 | mainCtrl.VerifyAllClean(t) |
| 2757 | } |
| 2758 | |
| 2759 | //----------------------------------------------------------------------------- |
| 2760 | // TestDelAllxAppSubsViaDebugIf |
| 2761 | // |
| 2762 | // stub stub stub |
| 2763 | // +-------+ +---------+ +---------+ +---------+ |
| 2764 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2765 | // +-------+ +---------+ +---------+ +---------+ |
| 2766 | // | | | | |
| 2767 | // | RESTSubReq | | | |
| 2768 | // |---------------->| | | |
| 2769 | // | RESTSubResp | | | |
| 2770 | // |<----------------| | | |
| 2771 | // | | RouteCreate | | |
| 2772 | // | |--------------------------->| |
| 2773 | // | | RouteResponse| | |
| 2774 | // | |<---------------------------| |
| 2775 | // | | SubReq | | |
| 2776 | // | |------------->| | |
| 2777 | // | | SubResp | | |
| 2778 | // | |<-------------| | |
| 2779 | // | RESTNotif1 | | | |
| 2780 | // |<----------------| | | |
| 2781 | // | | | | |
| 2782 | // | REST get_all_xapps | | |
| 2783 | // |---------------->| | | |
| 2784 | // | OK 200 | | | |
| 2785 | // |<----------------| | | |
| 2786 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 2787 | // |---------------->| | | |
| 2788 | // | OK 200 | | | |
| 2789 | // |<----------------| | | |
| 2790 | // | | SubDelReq | | |
| 2791 | // | |------------->| | |
| 2792 | // | | SubDelResp | | |
| 2793 | // | |<-------------| | |
| 2794 | // | | | | |
| 2795 | // | | RouteDelete | | |
| 2796 | // | |--------------------------->| |
| 2797 | // | | RouteResponse| | |
| 2798 | // | |<---------------------------| |
| 2799 | // |
| 2800 | //----------------------------------------------------------------------------- |
| 2801 | |
| 2802 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 2803 | |
| 2804 | // Init counter check |
| 2805 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2806 | Counter{cRestSubReqFromXapp, 1}, |
| 2807 | Counter{cRestSubRespToXapp, 1}, |
| 2808 | Counter{cSubReqToE2, 1}, |
| 2809 | Counter{cSubRespFromE2, 1}, |
| 2810 | Counter{cRestSubNotifToXapp, 1}, |
| 2811 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2812 | Counter{cSubDelReqToE2, 1}, |
| 2813 | Counter{cSubDelRespFromE2, 1}, |
| 2814 | Counter{cRestSubDelRespToXapp, 1}, |
| 2815 | }) |
| 2816 | |
| 2817 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2818 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2819 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2820 | |
| 2821 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2822 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2823 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2824 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2825 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2826 | |
| 2827 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 2828 | |
| 2829 | var xappList []string |
| 2830 | err := json.Unmarshal(xappsJson, &xappList) |
| 2831 | if err != nil { |
| 2832 | t.Errorf("Unmarshal error: %s", err) |
| 2833 | } |
| 2834 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 2835 | |
| 2836 | // Simulate deletion through REST test and debug interface |
Anssi Mannila | d13ba63 | 2022-01-04 14:22:26 +0200 | [diff] [blame] | 2837 | 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] | 2838 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2839 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2840 | |
| 2841 | // Wait that subs is cleaned |
| 2842 | waitSubsCleanup(t, e2SubsId, 10) |
| 2843 | mainCtrl.VerifyCounterValues(t) |
| 2844 | mainCtrl.VerifyAllClean(t) |
| 2845 | } |
| 2846 | |
| 2847 | //----------------------------------------------------------------------------- |
| 2848 | // TestDelViaxAppSubsIf |
| 2849 | // |
| 2850 | // stub stub stub |
| 2851 | // +-------+ +---------+ +---------+ +---------+ |
| 2852 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2853 | // +-------+ +---------+ +---------+ +---------+ |
| 2854 | // | | | | |
| 2855 | // | RESTSubReq | | | |
| 2856 | // |---------------->| | | |
| 2857 | // | RESTSubResp | | | |
| 2858 | // |<----------------| | | |
| 2859 | // | | RouteCreate | | |
| 2860 | // | |--------------------------->| |
| 2861 | // | | RouteResponse| | |
| 2862 | // | |<---------------------------| |
| 2863 | // | | SubReq | | |
| 2864 | // | |------------->| | |
| 2865 | // | | SubResp | | |
| 2866 | // | |<-------------| | |
| 2867 | // | RESTNotif1 | | | |
| 2868 | // |<----------------| | | |
| 2869 | // | | | | |
| 2870 | // | REST get_xapp_rest_restsubscriptions | |
| 2871 | // |---------------->| | | |
| 2872 | // | OK 200 | | | |
| 2873 | // |<----------------| | | |
| 2874 | // | RESTSudDel | | | |
| 2875 | // |---------------->| | | Via user curl command (port 8088) |
| 2876 | // | RESTSudDel | | | |
| 2877 | // |<----------------| | | |
| 2878 | // | | SubDelReq | | |
| 2879 | // | |------------->| | |
| 2880 | // | | SubDelResp | | |
| 2881 | // | |<-------------| | |
| 2882 | // | | | | |
| 2883 | // | | RouteDelete | | |
| 2884 | // | |--------------------------->| |
| 2885 | // | | RouteResponse| | |
| 2886 | // | |<---------------------------| |
| 2887 | // |
| 2888 | //----------------------------------------------------------------------------- |
| 2889 | |
| 2890 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 2891 | |
| 2892 | // Init counter check |
| 2893 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2894 | Counter{cRestSubReqFromXapp, 1}, |
| 2895 | Counter{cRestSubRespToXapp, 1}, |
| 2896 | Counter{cSubReqToE2, 1}, |
| 2897 | Counter{cSubRespFromE2, 1}, |
| 2898 | Counter{cRestSubNotifToXapp, 1}, |
| 2899 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2900 | Counter{cSubDelReqToE2, 1}, |
| 2901 | Counter{cSubDelRespFromE2, 1}, |
| 2902 | Counter{cRestSubDelRespToXapp, 1}, |
| 2903 | }) |
| 2904 | |
| 2905 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2906 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2907 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2908 | |
| 2909 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2910 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2911 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2912 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2913 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2914 | |
| 2915 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 2916 | |
| 2917 | var restSubsMap map[string]RESTSubscription |
| 2918 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 2919 | if err != nil { |
| 2920 | t.Errorf("Unmarshal error: %s", err) |
| 2921 | } |
| 2922 | _, ok := restSubsMap[restSubId] |
| 2923 | if !ok { |
| 2924 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 2925 | } |
| 2926 | |
| 2927 | var e2Subscriptions []Subscription |
| 2928 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 2929 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 2930 | if err != nil { |
| 2931 | t.Errorf("Unmarshal error: %s", err) |
| 2932 | } |
| 2933 | if len(e2Subscriptions) != 1 { |
| 2934 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 2935 | } |
| 2936 | |
| 2937 | // Simulate deletion through xapp REST test interface |
| 2938 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 2939 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2940 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2941 | |
| 2942 | // Wait that subs is cleaned |
| 2943 | waitSubsCleanup(t, e2SubsId, 10) |
| 2944 | mainCtrl.VerifyCounterValues(t) |
| 2945 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2946 | } |
| 2947 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2948 | //----------------------------------------------------------------------------- |
| 2949 | // TestRESTSubReqAndRouteNok |
| 2950 | // |
| 2951 | // stub stub |
| 2952 | // +-------+ +---------+ +---------+ |
| 2953 | // | xapp | | submgr | | rtmgr | |
| 2954 | // +-------+ +---------+ +---------+ |
| 2955 | // | | | |
| 2956 | // | RESTSubReq | | |
| 2957 | // |---------------->| | |
| 2958 | // | | | |
| 2959 | // | RESTSubResp | | |
| 2960 | // |<----------------| | |
| 2961 | // | | RouteCreate | |
| 2962 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2963 | // | | RouteCreate | |
| 2964 | // | | status:400 | |
| 2965 | // | |(Bad request) | |
| 2966 | // | |<-------------| |
| 2967 | // | RESTNotif | | |
| 2968 | // |<----------------| | |
| 2969 | // | | | |
| 2970 | // | [SUBS INT DELETE] | |
| 2971 | // | | | |
| 2972 | // | RESTSubDelReq | | |
| 2973 | // |---------------->| | |
| 2974 | // | RESTSubDelResp | | |
| 2975 | // |<----------------| | |
| 2976 | // |
| 2977 | //----------------------------------------------------------------------------- |
| 2978 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2979 | |
| 2980 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2981 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2982 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2983 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2984 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2985 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2986 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2987 | }) |
| 2988 | |
| 2989 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2990 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2991 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2992 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2993 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2994 | |
| 2995 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2996 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2997 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2998 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2999 | waiter.WaitResult(t) |
| 3000 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3001 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3002 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3003 | |
| 3004 | // Del |
| 3005 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3006 | |
| 3007 | // Wait that subs is cleaned |
| 3008 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3009 | waitSubsCleanup(t, e2SubsId, 10) |
| 3010 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3011 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3012 | } |
| 3013 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3014 | //----------------------------------------------------------------------------- |
| 3015 | // TestRESTSubReqAndRouteUpdateNok |
| 3016 | // |
| 3017 | // stub stub stub stub |
| 3018 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3019 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3020 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3021 | // | | | | | |
| 3022 | // | RESTSubReq1 | | | |
| 3023 | // |------------------------>| | | |
| 3024 | // | RESTSubResp2 | | | |
| 3025 | // |<------------------------| | | |
| 3026 | // | | | | | |
| 3027 | // | | | RouteCreate | | |
| 3028 | // | | |------------->| | |
| 3029 | // | | | CreateResp | | |
| 3030 | // | | |<-------------| | |
| 3031 | // | | | SubReq | | |
| 3032 | // | | |---------------------------->| |
| 3033 | // | | | SubResp | | |
| 3034 | // | | |<----------------------------| |
| 3035 | // | RESTNotif1 | | | |
| 3036 | // |<------------------------| | | |
| 3037 | // | | | | | |
| 3038 | // | | RESTSubReq2 | | | |
| 3039 | // | |------------>| | | |
| 3040 | // | | RESTSubResp2| | | |
| 3041 | // | |<------------| | | |
| 3042 | // | | | RouteUpdate | | |
| 3043 | // | | |------------->| | |
| 3044 | // | | | RouteUpdate | | |
| 3045 | // | | | status:400 | | |
| 3046 | // | | |(Bad request) | | |
| 3047 | // | | |<-------------| | |
| 3048 | // | | RESTNotif2(unsuccessful) | | |
| 3049 | // | |<------------| | | |
| 3050 | // | | | | | |
| 3051 | // | [SUBS INT DELETE] | | |
| 3052 | // | | | | | |
| 3053 | // | RESTSubDelReq1 | | | |
| 3054 | // |------------------------>| | | |
| 3055 | // | RESTSubDelResp1 | | | |
| 3056 | // |<------------------------| | | |
| 3057 | // | | | | | |
| 3058 | // | | | [SUBS DELETE] | |
| 3059 | // |
| 3060 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3061 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3062 | |
| 3063 | //Init counter check |
| 3064 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3065 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3066 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3067 | Counter{cSubReqToE2, 1}, |
| 3068 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3069 | Counter{cRestSubNotifToXapp, 1}, |
| 3070 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3071 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3072 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3073 | Counter{cSubDelReqToE2, 1}, |
| 3074 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3075 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3076 | }) |
| 3077 | |
| 3078 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3079 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3080 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3081 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3082 | |
| 3083 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3084 | |
| 3085 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3086 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3087 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3088 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3089 | params.SetMeid("RAN_NAME_1") |
| 3090 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3091 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3092 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3093 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3094 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3095 | |
| 3096 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3097 | |
| 3098 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3099 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3100 | |
| 3101 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3102 | //Wait that subs is cleaned |
| 3103 | waitSubsCleanup(t, e2SubsId, 10) |
| 3104 | |
| 3105 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3106 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3107 | } |
| 3108 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3109 | //----------------------------------------------------------------------------- |
| 3110 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3111 | // |
| 3112 | // stub stub stub |
| 3113 | // +-------+ +---------+ +---------+ +---------+ |
| 3114 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3115 | // +-------+ +---------+ +---------+ +---------+ |
| 3116 | // | | | | |
| 3117 | // | RESTSubReq | | | |
| 3118 | // |---------------->| | | |
| 3119 | // | | | | |
| 3120 | // | RESTSubResp | | | |
| 3121 | // |<----------------| | | |
| 3122 | // | | SubReq | | |
| 3123 | // | |---------------------------->| |
| 3124 | // | | SubResp | | |
| 3125 | // | |<----------------------------| |
| 3126 | // | RESTNotif | | | |
| 3127 | // |<----------------| | | |
| 3128 | // | | | | |
| 3129 | // | | | | |
| 3130 | // | RESTSubDelReq | | | |
| 3131 | // |---------------->| | | |
| 3132 | // | RESTSubDelResp | | | |
| 3133 | // |<----------------| | | |
| 3134 | // | | SubSelReq | | |
| 3135 | // | |---------------------------->| |
| 3136 | // | | SubSelResp | | |
| 3137 | // | |<----------------------------| |
| 3138 | // | | RouteDelete | | |
| 3139 | // | |------------->| | |
| 3140 | // | | Routedelete | | |
| 3141 | // | | status:400 | | |
| 3142 | // | |(Bad request) | | |
| 3143 | // | |<-------------| | |
| 3144 | // |
| 3145 | //----------------------------------------------------------------------------- |
| 3146 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3147 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3148 | |
| 3149 | // Init counter check |
| 3150 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3151 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3152 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3153 | Counter{cSubReqToE2, 1}, |
| 3154 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3155 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3156 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3157 | Counter{cRouteDeleteFail, 1}, |
| 3158 | Counter{cSubDelReqToE2, 1}, |
| 3159 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3160 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3161 | }) |
| 3162 | |
| 3163 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3164 | |
| 3165 | //Subs Create |
| 3166 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3167 | |
| 3168 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3169 | |
| 3170 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3171 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3172 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3173 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3174 | waiter.WaitResult(t) |
| 3175 | |
| 3176 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3177 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3178 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3179 | } |
| 3180 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3181 | //----------------------------------------------------------------------------- |
| 3182 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3183 | // |
| 3184 | // stub stub stub stub |
| 3185 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3186 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3187 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3188 | // | | | | | |
| 3189 | // | RESTSubReq1 | | | |
| 3190 | // |------------------------>| | | |
| 3191 | // | RESTSubResp2 | | | |
| 3192 | // |<------------------------| | | |
| 3193 | // | | | | | |
| 3194 | // | | | RouteCreate | | |
| 3195 | // | | |------------->| | |
| 3196 | // | | | CreateResp | | |
| 3197 | // | | |<-------------| | |
| 3198 | // | | | SubReq | | |
| 3199 | // | | |---------------------------->| |
| 3200 | // | | | SubResp | | |
| 3201 | // | | |<----------------------------| |
| 3202 | // | RESTNotif1 | | | |
| 3203 | // |<------------------------| | | |
| 3204 | // | | | | | |
| 3205 | // | | RESTSubReq2 | | | |
| 3206 | // | |------------>| | | |
| 3207 | // | | RESTSubResp2| | | |
| 3208 | // | |<------------| | | |
| 3209 | // | | | RouteCreate | | |
| 3210 | // | | |------------->| | |
| 3211 | // | | | CreateResp | | |
| 3212 | // | | |<-------------| | |
| 3213 | // | | | SubReq | | |
| 3214 | // | | |---------------------------->| |
| 3215 | // | | | SubResp | | |
| 3216 | // | | |<----------------------------| |
| 3217 | // | | RESTNotif2 | | | |
| 3218 | // | |<------------| | | |
| 3219 | // | | | | | |
| 3220 | // | [SUBS INT DELETE] | | |
| 3221 | // | | | | | |
| 3222 | // | RESTSubDelReq1 | | | |
| 3223 | // |------------------------>| | | |
| 3224 | // | RESTSubDelResp1 | | | |
| 3225 | // |<------------------------| | | |
| 3226 | // | | | SubDelReq | | |
| 3227 | // | | |---------------------------->| |
| 3228 | // | | | SubDelResp | | |
| 3229 | // | | |<----------------------------| |
| 3230 | // | | | RouteUpdate | | |
| 3231 | // | | |------------->| | |
| 3232 | // | | | RouteUpdate | | |
| 3233 | // | | | status:400 | | |
| 3234 | // | | |(Bad request) | | |
| 3235 | // | | |<-------------| | |
| 3236 | // | | | | | |
| 3237 | // | | RESTSubDelReq2 | | |
| 3238 | // | |------------>| | | |
| 3239 | // | | RESTSubDelResp2 | | |
| 3240 | // | |<------------| | | |
| 3241 | // | | | SubDelReq | | |
| 3242 | // | | |---------------------------->| |
| 3243 | // | | | SubdelResp | | |
| 3244 | // | | |<----------------------------| |
| 3245 | // | | | RouteDelete | | |
| 3246 | // | | |------------->| | |
| 3247 | // | | | Deleteresp | | |
| 3248 | // | | |<-------------| | |
| 3249 | |
| 3250 | //----------------------------------------------------------------------------- |
| 3251 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3252 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3253 | |
| 3254 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3255 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3256 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3257 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3258 | Counter{cSubReqToE2, 1}, |
| 3259 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3260 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3261 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3262 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3263 | Counter{cSubDelReqToE2, 1}, |
| 3264 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3265 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3266 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3267 | }) |
| 3268 | |
| 3269 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3270 | |
| 3271 | //Subs Create |
| 3272 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3273 | |
| 3274 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3275 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3276 | |
| 3277 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3278 | |
| 3279 | //Del1, this shall fail on rtmgr side |
| 3280 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3281 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3282 | waiter.WaitResult(t) |
| 3283 | |
| 3284 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3285 | |
| 3286 | //Del2 |
| 3287 | deleteXapp2Subscription(t, &restSubId2) |
| 3288 | |
| 3289 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3290 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3291 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3292 | } |
| 3293 | |
| 3294 | //----------------------------------------------------------------------------- |
| 3295 | // TestRESTSubReqRetransmission |
| 3296 | // |
| 3297 | // stub stub |
| 3298 | // +-------+ +---------+ +---------+ |
| 3299 | // | xapp | | submgr | | e2term | |
| 3300 | // +-------+ +---------+ +---------+ |
| 3301 | // | | | |
| 3302 | // | RESTSubReq1 | | |
| 3303 | // |---------------->| | |
| 3304 | // | | | |
| 3305 | // | RESTSubResp | | |
| 3306 | // |<----------------| | |
| 3307 | // | | SubReq1 | |
| 3308 | // | |------------->| |
| 3309 | // | | | |
| 3310 | // | RESTSubReq2 | | |
| 3311 | // | (retrans) | | |
| 3312 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3313 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3314 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3315 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3316 | // | | SubResp1 | |
| 3317 | // | |<-------------| |
| 3318 | // | RESTNotif1 | | |
| 3319 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3320 | // | | | |
| 3321 | // | [SUBS DELETE] | |
| 3322 | // | | | |
| 3323 | // |
| 3324 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3325 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3327 | |
| 3328 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3329 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3330 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3331 | Counter{cSubReqToE2, 1}, |
| 3332 | Counter{cSubRespFromE2, 1}, |
| 3333 | Counter{cRestSubNotifToXapp, 1}, |
| 3334 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3335 | Counter{cSubDelReqToE2, 1}, |
| 3336 | Counter{cSubDelRespFromE2, 1}, |
| 3337 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3338 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3339 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3340 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3341 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3342 | |
| 3343 | // Subs Create |
| 3344 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3345 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3346 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3347 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3348 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3349 | xappConn1.SendRESTSubsReq(t, params) |
| 3350 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3351 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3352 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3353 | |
| 3354 | // 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] | 3355 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3356 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3357 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3358 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3359 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3360 | |
| 3361 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3362 | |
| 3363 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3364 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3365 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3366 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3367 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3368 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3369 | |
| 3370 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3371 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3372 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3373 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3374 | //----------------------------------------------------------------------------- |
| 3375 | // stub stub stub |
| 3376 | // +-------+ +---------+ +---------+ +---------+ |
| 3377 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3378 | // +-------+ +---------+ +---------+ +---------+ |
| 3379 | // | | | | |
| 3380 | // | RESTSubReq | | | |
| 3381 | // |---------------->| | | |
| 3382 | // | RESTSubResp | | | |
| 3383 | // |<----------------| | | |
| 3384 | // | | RouteCreate | | |
| 3385 | // | |--------------------------->| |
| 3386 | // | | RouteResponse| | |
| 3387 | // | |<---------------------------| // The order of these events may vary |
| 3388 | // | | SubReq | | |
| 3389 | // | |------------->| | // The order of these events may vary |
| 3390 | // | | SubResp | | |
| 3391 | // | |<-------------| | |
| 3392 | // | RESTNotif1 | | | |
| 3393 | // |<----------------| | | |
| 3394 | // | RESTSubReq | | | |
| 3395 | // | [RETRANS1] | | | |
| 3396 | // |---------------->| | | |
| 3397 | // | RESTNotif1 | | | |
| 3398 | // |<----------------| | | |
| 3399 | // | RESTSubReq | | | |
| 3400 | // | [RETRANS2] | | | |
| 3401 | // |---------------->| | | |
| 3402 | // | RESTNotif1 | | | |
| 3403 | // |<----------------| | | |
| 3404 | // | RESTSubDelReq | | | |
| 3405 | // |---------------->| | | |
| 3406 | // | | SubDelReq | | |
| 3407 | // | |------------->| | |
| 3408 | // | RESTSubDelResp| | | |
| 3409 | // |<----------------| | | |
| 3410 | // | | SubDelResp | | |
| 3411 | // | |<-------------| | |
| 3412 | // | | | | |
| 3413 | // |
| 3414 | //----------------------------------------------------------------------------- |
| 3415 | |
| 3416 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3417 | |
| 3418 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3419 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3420 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3421 | Counter{cRestSubRespToXapp, 3}, |
| 3422 | Counter{cSubReqToE2, 1}, |
| 3423 | Counter{cSubRespFromE2, 1}, |
| 3424 | Counter{cRestSubNotifToXapp, 3}, |
| 3425 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3426 | Counter{cSubDelReqToE2, 1}, |
| 3427 | Counter{cSubDelRespFromE2, 1}, |
| 3428 | Counter{cRestSubDelRespToXapp, 1}, |
| 3429 | }) |
| 3430 | |
| 3431 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3432 | |
| 3433 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3434 | |
| 3435 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3436 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3437 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3438 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3439 | //1.st resend |
| 3440 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3441 | |
| 3442 | assert.Equal(t, restSubId_resend, restSubId) |
| 3443 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3444 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3445 | |
| 3446 | //2.nd resend |
| 3447 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3448 | |
| 3449 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3450 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3451 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3452 | |
| 3453 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3454 | |
| 3455 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3456 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3457 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3458 | } |
| 3459 | |
| 3460 | //----------------------------------------------------------------------------- |
| 3461 | // stub stub stub |
| 3462 | // +-------+ +---------+ +---------+ +---------+ |
| 3463 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3464 | // +-------+ +---------+ +---------+ +---------+ |
| 3465 | // | | | | |
| 3466 | // | RESTSubReq | | | |
| 3467 | // |---------------->| | | |
| 3468 | // | RESTSubResp | | | |
| 3469 | // |<----------------| | | |
| 3470 | // | | RouteCreate | | |
| 3471 | // | |--------------------------->| |
| 3472 | // | | RouteResponse| | |
| 3473 | // | |<---------------------------| // The order of these events may vary |
| 3474 | // | | SubReq | | |
| 3475 | // | |------------->| | // The order of these events may vary |
| 3476 | // | | SubResp | | |
| 3477 | // | |<-------------| | |
| 3478 | // | RESTNotif1 | | | |
| 3479 | // |<----------------| | | |
| 3480 | // | RESTSubReq | | | |
| 3481 | // | [RETRANS, with RESTsubsId] | | |
| 3482 | // |---------------->| | | |
| 3483 | // | RESTNotif1 | | | |
| 3484 | // |<----------------| | | |
| 3485 | // | RESTSubReq | | | |
| 3486 | // | [RETRANS, without RESTsubsId] | | |
| 3487 | // |---------------->| | | |
| 3488 | // | RESTNotif1 | | | |
| 3489 | // |<----------------| | | |
| 3490 | // | RESTSubDelReq | | | |
| 3491 | // |---------------->| | | |
| 3492 | // | | SubDelReq | | |
| 3493 | // | |------------->| | |
| 3494 | // | RESTSubDelResp| | | |
| 3495 | // |<----------------| | | |
| 3496 | // | | SubDelResp | | |
| 3497 | // | |<-------------| | |
| 3498 | // | | | | |
| 3499 | // |
| 3500 | //----------------------------------------------------------------------------- |
| 3501 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3502 | |
| 3503 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3504 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3505 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3506 | Counter{cRestSubRespToXapp, 3}, |
| 3507 | Counter{cSubReqToE2, 1}, |
| 3508 | Counter{cSubRespFromE2, 1}, |
| 3509 | Counter{cRestSubNotifToXapp, 3}, |
| 3510 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3511 | Counter{cSubDelReqToE2, 1}, |
| 3512 | Counter{cSubDelRespFromE2, 1}, |
| 3513 | Counter{cRestSubDelRespToXapp, 1}, |
| 3514 | }) |
| 3515 | |
| 3516 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3517 | |
| 3518 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3519 | |
| 3520 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3521 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3522 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3523 | |
| 3524 | //1.st resend with subscription ID |
| 3525 | params.SetSubscriptionID(&restSubId) |
| 3526 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3527 | |
| 3528 | assert.Equal(t, restSubId_resend, restSubId) |
| 3529 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3530 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3531 | |
| 3532 | //2.nd resend without subscription ID (faking app restart) |
| 3533 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3534 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3535 | |
| 3536 | assert.Equal(t, restSubId_resend2, 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 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3541 | |
| 3542 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3543 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3544 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3545 | } |
| 3546 | |
| 3547 | //----------------------------------------------------------------------------- |
| 3548 | // stub stub stub |
| 3549 | // +-------+ +---------+ +---------+ +---------+ |
| 3550 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3551 | // +-------+ +---------+ +---------+ +---------+ |
| 3552 | // | | | | |
| 3553 | // | RESTSubReq | | | |
| 3554 | // |---------------->| | | |
| 3555 | // | RESTSubResp | | | |
| 3556 | // |<----------------| | | |
| 3557 | // | | RouteCreate | | |
| 3558 | // | |--------------------------->| |
| 3559 | // | | RouteResponse| | |
| 3560 | // | |<---------------------------| |
| 3561 | // | | SubReq | | |
| 3562 | // | |------------->| | |
| 3563 | // | | SubResp | | |
| 3564 | // | |<-------------| | |
| 3565 | // | RESTNotif1 | | | |
| 3566 | // |<----------------| | | |
| 3567 | // | RESTSubReq | | | |
| 3568 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3569 | // |---------------->| | | |
| 3570 | // | RESTNotif1 | | | |
| 3571 | // | [for initial e2 subDetail] | | |
| 3572 | // |<----------------| | | |
| 3573 | // | | RouteCreate | | |
| 3574 | // | |--------------------------->| |
| 3575 | // | | RouteResponse| | |
| 3576 | // | |<---------------------------| |
| 3577 | // | | SubReq | | |
| 3578 | // | |------------->| | |
| 3579 | // | | SubResp | | |
| 3580 | // | |<-------------| | |
| 3581 | // | RESTNotif1 | | | |
| 3582 | // |<----------------| | | |
| 3583 | // | RESTSubReq | | | |
| 3584 | // | [with RESTsubsId initial request] | |
| 3585 | // |---------------->| | | |
| 3586 | // | RESTNotif1 | | | |
| 3587 | // |<----------------| | | |
| 3588 | // | RESTSubDelReq | | | |
| 3589 | // |---------------->| | | |
| 3590 | // | RESTSubDelResp| | | |
| 3591 | // |<----------------| | | |
| 3592 | // | | SubDelReq | | |
| 3593 | // | |------------->| | |
| 3594 | // | | SubDelResp | | |
| 3595 | // | |<-------------| | |
| 3596 | // | | SubDelReq | | |
| 3597 | // | |------------->| | |
| 3598 | // | | SubDelResp | | |
| 3599 | // | |<-------------| | |
| 3600 | // | | | | |
| 3601 | // |
| 3602 | //----------------------------------------------------------------------------- |
| 3603 | |
| 3604 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3605 | |
| 3606 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3607 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3608 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3609 | Counter{cRestSubRespToXapp, 3}, |
| 3610 | Counter{cSubReqToE2, 2}, |
| 3611 | Counter{cSubRespFromE2, 2}, |
| 3612 | Counter{cRestSubNotifToXapp, 4}, |
| 3613 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3614 | Counter{cSubDelReqToE2, 2}, |
| 3615 | Counter{cSubDelRespFromE2, 2}, |
| 3616 | Counter{cRestSubDelRespToXapp, 1}, |
| 3617 | }) |
| 3618 | |
| 3619 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3620 | |
| 3621 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3622 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3623 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3624 | |
| 3625 | // Send modified requst, this time with e2 subscriptions. |
| 3626 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3627 | params2.SetSubscriptionID(&restSubId) |
| 3628 | |
| 3629 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3630 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3631 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3632 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3633 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3634 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3635 | |
| 3636 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3637 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3638 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3639 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3640 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3641 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3642 | assert.NotEqual(t, e2SubsId2, 0) |
| 3643 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3644 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3645 | |
| 3646 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3647 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3648 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3649 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3650 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3651 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3652 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3653 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3654 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3655 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3656 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3657 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3658 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3659 | // Delete both e2 subscriptions |
| 3660 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3661 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3662 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3663 | |
| 3664 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3665 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3666 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3667 | } |
| 3668 | |
| 3669 | //----------------------------------------------------------------------------- |
| 3670 | // stub stub stub |
| 3671 | // +-------+ +---------+ +---------+ +---------+ |
| 3672 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3673 | // +-------+ +---------+ +---------+ +---------+ |
| 3674 | // | | | | |
| 3675 | // | RESTSubReq | | | |
| 3676 | // |---------------->| | | |
| 3677 | // | RESTSubResp | | | |
| 3678 | // |<----------------| | | |
| 3679 | // | | RouteCreate | | |
| 3680 | // | |--------------------------->| |
| 3681 | // | | RouteResponse| | |
| 3682 | // | |<---------------------------| |
| 3683 | // | | SubReq | | |
| 3684 | // | |------------->| | |
| 3685 | // | | SubResp | | |
| 3686 | // | |<-------------| | |
| 3687 | // | RESTNotif1 | | | |
| 3688 | // |<----------------| | | |
| 3689 | // | RESTSubReq | | | |
| 3690 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3691 | // |---------------->| | | |
| 3692 | // | RESTNotif1 | | | |
| 3693 | // | [for initial e2 subDetail] | | |
| 3694 | // |<----------------| | | |
| 3695 | // | | RouteCreate | | |
| 3696 | // | |--------------------------->| |
| 3697 | // | | RouteResponse| | |
| 3698 | // | |<---------------------------| |
| 3699 | // | | SubReq | | |
| 3700 | // | |------------->| | |
| 3701 | // | | SubResp | | |
| 3702 | // | |<-------------| | |
| 3703 | // | RESTNotif1 | | | |
| 3704 | // |<----------------| | | |
| 3705 | // | RESTSubReq | | | |
| 3706 | // | [without RESTsubsId initial request] | |
| 3707 | // |---------------->| | | |
| 3708 | // | RESTNotif1 | | | |
| 3709 | // |<----------------| | | |
| 3710 | // | RESTSubDelReq | | | |
| 3711 | // |---------------->| | | |
| 3712 | // | RESTSubDelResp| | | |
| 3713 | // |<----------------| | | |
| 3714 | // | | SubDelReq | | |
| 3715 | // | |------------->| | |
| 3716 | // | | SubDelResp | | |
| 3717 | // | |<-------------| | |
| 3718 | // | | SubDelReq | | |
| 3719 | // | |------------->| | |
| 3720 | // | | SubDelResp | | |
| 3721 | // | |<-------------| | |
| 3722 | // | | | | |
| 3723 | // |
| 3724 | //----------------------------------------------------------------------------- |
| 3725 | |
| 3726 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3727 | |
| 3728 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3729 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3730 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3731 | Counter{cRestSubRespToXapp, 3}, |
| 3732 | Counter{cSubReqToE2, 2}, |
| 3733 | Counter{cSubRespFromE2, 2}, |
| 3734 | Counter{cRestSubNotifToXapp, 4}, |
| 3735 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3736 | Counter{cSubDelReqToE2, 2}, |
| 3737 | Counter{cSubDelRespFromE2, 2}, |
| 3738 | Counter{cRestSubDelRespToXapp, 1}, |
| 3739 | }) |
| 3740 | |
| 3741 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3742 | |
| 3743 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3744 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3745 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3746 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3747 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3748 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3749 | params2.SetSubscriptionID(&restSubId) |
| 3750 | |
| 3751 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3752 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3753 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3754 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3755 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3756 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3757 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3758 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3759 | xappConn1.DecrementRequestCount() |
| 3760 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3761 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3762 | |
| 3763 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3764 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3765 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3766 | assert.NotEqual(t, e2SubsId2, 0) |
| 3767 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3768 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3769 | |
| 3770 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3771 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3772 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3773 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3774 | // md5sum shall find the original request |
| 3775 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3776 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3777 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3778 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3779 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3780 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3781 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3782 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3783 | // Delete both e2 subscriptions |
| 3784 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3785 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3786 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3787 | |
| 3788 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3789 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3790 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3791 | } |
| 3792 | |
| 3793 | //----------------------------------------------------------------------------- |
| 3794 | // stub stub stub |
| 3795 | // +-------+ +---------+ +---------+ +---------+ |
| 3796 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3797 | // +-------+ +---------+ +---------+ +---------+ |
| 3798 | // | | | | |
| 3799 | // | RESTSubReq | | | |
| 3800 | // |---------------->| | | |
| 3801 | // | RESTSubResp | | | |
| 3802 | // |<----------------| | | |
| 3803 | // | | RouteCreate | | |
| 3804 | // | |--------------------------->| |
| 3805 | // | | RouteResponse| | |
| 3806 | // | |<---------------------------| |
| 3807 | // | | SubReq | | |
| 3808 | // | |------------->| | |
| 3809 | // | | SubResp | | |
| 3810 | // | |<-------------| | |
| 3811 | // | RESTNotif1 | | | |
| 3812 | // |<----------------| | | |
| 3813 | // | RESTSubReq | | | |
| 3814 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3815 | // |---------------->| | | |
| 3816 | // | RESTNotif1 | | | |
| 3817 | // | [for initial e2 subDetail] | | |
| 3818 | // |<----------------| | | |
| 3819 | // | | RouteCreate | | |
| 3820 | // | |--------------------------->| |
| 3821 | // | | RouteResponse| | |
| 3822 | // | |<---------------------------| |
| 3823 | // | | SubReq | | |
| 3824 | // | |------------->| | |
| 3825 | // | | SubResp | | |
| 3826 | // | |<-------------| | |
| 3827 | // | RESTNotif1 | | | |
| 3828 | // |<----------------| | | |
| 3829 | // | RESTSubDelReq | | | |
| 3830 | // |---------------->| | | |
| 3831 | // | RESTSubDelResp| | | |
| 3832 | // |<----------------| | | |
| 3833 | // | | SubDelReq | | |
| 3834 | // | |------------->| | |
| 3835 | // | | SubDelResp | | |
| 3836 | // | |<-------------| | |
| 3837 | // | | SubDelReq | | |
| 3838 | // | |------------->| | |
| 3839 | // | | SubDelResp | | |
| 3840 | // | |<-------------| | |
| 3841 | // | RESTSubReq | | | |
| 3842 | // | [with RESTsubsId initial request] | |
| 3843 | // |---------------->| | | |
| 3844 | // | RESTSubResp | | | |
| 3845 | // |<----------------| | | |
| 3846 | // | | RouteCreate | | |
| 3847 | // | |--------------------------->| |
| 3848 | // | | RouteResponse| | |
| 3849 | // | |<---------------------------| |
| 3850 | // | | SubReq | | |
| 3851 | // | |------------->| | |
| 3852 | // | | SubResp | | |
| 3853 | // | |<-------------| | |
| 3854 | // | RESTNotif1 | | | |
| 3855 | // |<----------------| | | |
| 3856 | // | | | | |
| 3857 | // |
| 3858 | //----------------------------------------------------------------------------- |
| 3859 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3860 | |
| 3861 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3862 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3863 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3864 | Counter{cRestSubRespToXapp, 3}, |
| 3865 | Counter{cSubReqToE2, 3}, |
| 3866 | Counter{cSubRespFromE2, 3}, |
| 3867 | Counter{cRestSubNotifToXapp, 4}, |
| 3868 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3869 | Counter{cSubDelReqToE2, 3}, |
| 3870 | Counter{cSubDelRespFromE2, 3}, |
| 3871 | Counter{cRestSubDelRespToXapp, 2}, |
| 3872 | }) |
| 3873 | |
| 3874 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3875 | |
| 3876 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3877 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3878 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3879 | |
| 3880 | // Send modified requst, this time with e2 subscriptions. |
| 3881 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3882 | params2.SetSubscriptionID(&restSubId) |
| 3883 | |
| 3884 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3885 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3886 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3887 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3888 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3889 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3890 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3891 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3892 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3893 | |
| 3894 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3895 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3896 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3897 | assert.NotEqual(t, e2SubsId2, 0) |
| 3898 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3899 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3900 | |
| 3901 | // Delete both e2 subscriptions |
| 3902 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3903 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3904 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3905 | |
| 3906 | waitSubsCleanup(t, e2SubsId, 10) |
| 3907 | |
| 3908 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3909 | // but the restsubscription has been already removed. This shall trigger a |
| 3910 | // fresh create. |
| 3911 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3912 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3913 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3914 | |
| 3915 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3916 | |
| 3917 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3918 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3919 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3920 | } |
| 3921 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3922 | //----------------------------------------------------------------------------- |
| 3923 | // TestRESTSubDelReqRetransmission |
| 3924 | // |
| 3925 | // stub stub |
| 3926 | // +-------+ +---------+ +---------+ |
| 3927 | // | xapp | | submgr | | e2term | |
| 3928 | // +-------+ +---------+ +---------+ |
| 3929 | // | | | |
| 3930 | // | RESTSubReq | | |
| 3931 | // |---------------->| | |
| 3932 | // | | | |
| 3933 | // | RESTSubResp | | |
| 3934 | // |<----------------| | |
| 3935 | // | | SubReq | |
| 3936 | // | |------------->| |
| 3937 | // | | SubResp | |
| 3938 | // | |<-------------| |
| 3939 | // | RESTNotif1 | | |
| 3940 | // |<----------------| | |
| 3941 | // | | | |
| 3942 | // | RESTSubDelReq | | |
| 3943 | // |---------------->| | |
| 3944 | // | RESTSubDelResp | | |
| 3945 | // |<----------------| | |
| 3946 | // | | SubDelReq | |
| 3947 | // | |------------->| |
| 3948 | // | RESTSubDelReq | | |
| 3949 | // |---------------->| | |
| 3950 | // | RESTSubDelResp | | |
| 3951 | // |<----------------| | |
| 3952 | // | | SubDelResp | |
| 3953 | // | |<-------------| |
| 3954 | // | | | |
| 3955 | // |
| 3956 | //----------------------------------------------------------------------------- |
| 3957 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3958 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3959 | |
| 3960 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3961 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3962 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3963 | Counter{cSubReqToE2, 1}, |
| 3964 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3965 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3966 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3967 | Counter{cSubDelReqToE2, 1}, |
| 3968 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3969 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3970 | }) |
| 3971 | |
| 3972 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3973 | |
| 3974 | //Subs Create |
| 3975 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3976 | |
| 3977 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3978 | |
| 3979 | //Subs Delete |
| 3980 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3981 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3982 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3983 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3984 | seqBef := mainCtrl.get_msgcounter(t) |
| 3985 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3986 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3987 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3988 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3989 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3990 | |
| 3991 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3992 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3993 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3994 | } |
| 3995 | |
| 3996 | //----------------------------------------------------------------------------- |
| 3997 | // TestRESTSubReqDelReq |
| 3998 | // |
| 3999 | // stub stub |
| 4000 | // +-------+ +---------+ +---------+ |
| 4001 | // | xapp | | submgr | | e2term | |
| 4002 | // +-------+ +---------+ +---------+ |
| 4003 | // | | | |
| 4004 | // | RESTSubReq | | |
| 4005 | // |---------------->| | |
| 4006 | // | | | |
| 4007 | // | RESTSubResp | | |
| 4008 | // |<----------------| | |
| 4009 | // | | SubReq | |
| 4010 | // | |------------->| |
| 4011 | // | RESTSubDelReq | | |
| 4012 | // |---------------->| | |
| 4013 | // | RESTSubDelResp | | |
| 4014 | // | unsuccess | | |
| 4015 | // |<----------------| | |
| 4016 | // | | SubResp | |
| 4017 | // | |<-------------| |
| 4018 | // | RESTNotif1 | | |
| 4019 | // |<----------------| | |
| 4020 | // | | | |
| 4021 | // | [SUBS DELETE] | |
| 4022 | // | | | |
| 4023 | // |
| 4024 | //----------------------------------------------------------------------------- |
| 4025 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4026 | |
| 4027 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4028 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4029 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4030 | Counter{cSubReqToE2, 1}, |
| 4031 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4032 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4033 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4034 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4035 | Counter{cSubDelReqToE2, 1}, |
| 4036 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4037 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4038 | }) |
| 4039 | |
| 4040 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4041 | |
| 4042 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4043 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4044 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4045 | |
| 4046 | // Del. This will fail as processing of the subscription |
| 4047 | // is still ongoing in submgr. Deletion is not allowed before |
| 4048 | // subscription creation has been completed. |
| 4049 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4050 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4051 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4052 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4053 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4054 | |
| 4055 | // Retry del |
| 4056 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4057 | |
| 4058 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4059 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4060 | |
| 4061 | // Wait that subs is cleaned |
| 4062 | waitSubsCleanup(t, e2SubsId, 10) |
| 4063 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4064 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4065 | } |
| 4066 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4067 | //----------------------------------------------------------------------------- |
| 4068 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4069 | // |
| 4070 | // stub stub stub |
| 4071 | // +-------+ +-------+ +---------+ +---------+ |
| 4072 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4073 | // +-------+ +-------+ +---------+ +---------+ |
| 4074 | // | | | | |
| 4075 | // | | RESTSubReq1 | | |
| 4076 | // | |------------->| | |
| 4077 | // | | RESTSubResp1 | | |
| 4078 | // | |<-------------| | |
| 4079 | // | | | | |
| 4080 | // | | | SubReq1 | |
| 4081 | // | | |------------->| |
| 4082 | // | | | | |
| 4083 | // | RESTSubReq2 | | |
| 4084 | // |------------------------>| | |
| 4085 | // | RESTSubResp2 | | |
| 4086 | // |<------------------------| | |
| 4087 | // | | | | |
| 4088 | // | | | SubReq2 | |
| 4089 | // | | |------------->| |
| 4090 | // | | | | |
| 4091 | // | | | SubResp1 | |
| 4092 | // | | |<-------------| |
| 4093 | // | | RESTNotif1 | | |
| 4094 | // | |<-------------| | |
| 4095 | // | | | | |
| 4096 | // | | | SubResp2 | |
| 4097 | // | | |<-------------| |
| 4098 | // | RESTNotif2 | | |
| 4099 | // |<------------------------| | |
| 4100 | // | | | | |
| 4101 | // | | [SUBS 1 DELETE] | |
| 4102 | // | | | | |
| 4103 | // | | [SUBS 2 DELETE] | |
| 4104 | // | | | | |
| 4105 | // |
| 4106 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4107 | |
| 4108 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4109 | |
| 4110 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4111 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4112 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4113 | Counter{cSubReqToE2, 2}, |
| 4114 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4115 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4116 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4117 | Counter{cSubDelReqToE2, 2}, |
| 4118 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4119 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4120 | }) |
| 4121 | |
| 4122 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4123 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4124 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4125 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4126 | |
| 4127 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4128 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4129 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4130 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4131 | |
| 4132 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4133 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4134 | |
| 4135 | //XappConn1 receives both of the responses |
| 4136 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4137 | |
| 4138 | //Resp1 |
| 4139 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4140 | //Resp2 |
| 4141 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4142 | |
| 4143 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4144 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4145 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4146 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4147 | |
| 4148 | //Del1 |
| 4149 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4150 | //Del2 |
| 4151 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4152 | |
| 4153 | //Wait that subs is cleaned |
| 4154 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4155 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4156 | |
| 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 | // TestRESTSameSubsDiffRan |
| 4163 | // Same subscription to different RANs |
| 4164 | // |
| 4165 | // stub stub |
| 4166 | // +-------+ +---------+ +---------+ |
| 4167 | // | xapp | | submgr | | e2term | |
| 4168 | // +-------+ +---------+ +---------+ |
| 4169 | // | | | |
| 4170 | // | RESTSubReq(r1) | | |
| 4171 | // |---------------->| | |
| 4172 | // | RESTSubResp(r1) | | |
| 4173 | // |<----------------| | |
| 4174 | // | | | |
| 4175 | // | | SubReq(r1) | |
| 4176 | // | |------------->| |
| 4177 | // | | | |
| 4178 | // | | SubResp(r1) | |
| 4179 | // | |<-------------| |
| 4180 | // | | | |
| 4181 | // | RESTNotif(r1) | | |
| 4182 | // |<----------------| | |
| 4183 | // | | | |
| 4184 | // | RESTSubReq(r2) | | |
| 4185 | // |---------------->| | |
| 4186 | // | | | |
| 4187 | // | RESTSubResp(r2) | | |
| 4188 | // |<----------------| | |
| 4189 | // | | SubReq(r2) | |
| 4190 | // | |------------->| |
| 4191 | // | | | |
| 4192 | // | | SubResp(r2) | |
| 4193 | // | |<-------------| |
| 4194 | // | | | |
| 4195 | // | RESTNotif(r2) | | |
| 4196 | // |<----------------| | |
| 4197 | // | | | |
| 4198 | // | [SUBS r1 DELETE] | |
| 4199 | // | | | |
| 4200 | // | [SUBS r2 DELETE] | |
| 4201 | // | | | |
| 4202 | // |
| 4203 | //----------------------------------------------------------------------------- |
| 4204 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4205 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4206 | |
| 4207 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4208 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4209 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4210 | Counter{cSubReqToE2, 2}, |
| 4211 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4212 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4213 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4214 | Counter{cSubDelReqToE2, 2}, |
| 4215 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4216 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4217 | }) |
| 4218 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4219 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4220 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4221 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4222 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4223 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4224 | params.SetMeid("RAN_NAME_2") |
| 4225 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4226 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4227 | |
| 4228 | //Del1 |
| 4229 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4230 | //Del2 |
| 4231 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4232 | |
| 4233 | //Wait that subs is cleaned |
| 4234 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4235 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4236 | |
| 4237 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4238 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4239 | } |
| 4240 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4241 | //----------------------------------------------------------------------------- |
| 4242 | // TestRESTSubReqRetryInSubmgr |
| 4243 | // |
| 4244 | // stub stub |
| 4245 | // +-------+ +---------+ +---------+ |
| 4246 | // | xapp | | submgr | | e2term | |
| 4247 | // +-------+ +---------+ +---------+ |
| 4248 | // | | | |
| 4249 | // | RESTSubReq | | |
| 4250 | // |---------------->| | |
| 4251 | // | RESTSubResp | | |
| 4252 | // |<----------------| | |
| 4253 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame] | 4254 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4255 | // | | | |
| 4256 | // | | | |
| 4257 | // | | SubReq | |
| 4258 | // | |------------->| |
| 4259 | // | | SubResp | |
| 4260 | // | |<-------------| |
| 4261 | // | | | |
| 4262 | // | RESTNotif | | |
| 4263 | // |<----------------| | |
| 4264 | // | | | |
| 4265 | // | [SUBS DELETE] | |
| 4266 | // | | | |
| 4267 | // |
| 4268 | //----------------------------------------------------------------------------- |
| 4269 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4270 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4271 | |
| 4272 | // Init counter check |
| 4273 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4274 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4275 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4276 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4277 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4278 | Counter{cSubReReqToE2, 1}, |
| 4279 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4280 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4281 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4282 | Counter{cSubDelReqToE2, 1}, |
| 4283 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4284 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4285 | }) |
| 4286 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4287 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4288 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4289 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4290 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4291 | |
| 4292 | // Catch the first message and ignore it |
| 4293 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4294 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4295 | |
| 4296 | // The second request is being handled normally |
| 4297 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4298 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4299 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4300 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4301 | |
| 4302 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4303 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4304 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4305 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4306 | |
| 4307 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4308 | //Wait that subs is cleaned |
| 4309 | waitSubsCleanup(t, e2SubsId, 10) |
| 4310 | |
| 4311 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4312 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4313 | } |
| 4314 | |
| 4315 | //----------------------------------------------------------------------------- |
| 4316 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4317 | // |
| 4318 | // stub stub |
| 4319 | // +-------+ +---------+ +---------+ |
| 4320 | // | xapp | | submgr | | e2term | |
| 4321 | // +-------+ +---------+ +---------+ |
| 4322 | // | | | |
| 4323 | // | RESTSubReq | | |
| 4324 | // |---------------->| | |
| 4325 | // | | | |
| 4326 | // | RESTSubResp | | |
| 4327 | // |<----------------| | |
| 4328 | // | | SubReq | |
| 4329 | // | |------------->| |
| 4330 | // | | | |
| 4331 | // | | | |
| 4332 | // | | SubReq | |
| 4333 | // | |------------->| |
| 4334 | // | | | |
| 4335 | // | | SubDelReq | |
| 4336 | // | |------------->| |
| 4337 | // | | | |
| 4338 | // | | | |
| 4339 | // | | SubDelReq | |
| 4340 | // | |------------->| |
| 4341 | // | | | |
| 4342 | // | | | |
| 4343 | // | | SubDelResp | |
| 4344 | // | |<-------------| |
| 4345 | // | RESTNotif | | |
| 4346 | // | unsuccess | | |
| 4347 | // |<----------------| | |
| 4348 | // | | | |
| 4349 | // | [SUBS DELETE] | |
| 4350 | // | | | |
| 4351 | // |
| 4352 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4353 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4354 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4355 | |
| 4356 | // Init counter check |
| 4357 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4358 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4359 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4360 | Counter{cSubReqToE2, 1}, |
| 4361 | Counter{cSubReReqToE2, 1}, |
| 4362 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4363 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4364 | Counter{cSubDelReqToE2, 1}, |
| 4365 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4366 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4367 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4368 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4369 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4370 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4371 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4372 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4373 | |
| 4374 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4375 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4376 | |
| 4377 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4378 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4379 | |
| 4380 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4381 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4383 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4384 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4385 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4386 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4387 | // Wait that subs is cleaned |
| 4388 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4389 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4390 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4391 | } |
| 4392 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4393 | //----------------------------------------------------------------------------- |
| 4394 | // TestREST2eTermNotRespondingToSubReq |
| 4395 | // |
| 4396 | // stub stub |
| 4397 | // +-------+ +---------+ +---------+ |
| 4398 | // | xapp | | submgr | | e2term | |
| 4399 | // +-------+ +---------+ +---------+ |
| 4400 | // | | | |
| 4401 | // | RESTSubReq | | |
| 4402 | // |---------------->| | |
| 4403 | // | RESTSubResp | | |
| 4404 | // |<----------------| | |
| 4405 | // | | SubReq | |
| 4406 | // | |------------->| |
| 4407 | // | | | |
| 4408 | // | | SubReq | |
| 4409 | // | |------------->| |
| 4410 | // | | | |
| 4411 | // | | SubDelReq | |
| 4412 | // | |------------->| |
| 4413 | // | | | |
| 4414 | // | | SubDelReq | |
| 4415 | // | |------------->| |
| 4416 | // | RESTNotif(Unsuccessful) | |
| 4417 | // |<----------------| | |
| 4418 | // | | | |
| 4419 | // | RESTSubDelReq | | |
| 4420 | // |---------------->| | |
| 4421 | // | RESTSubDelResp | | |
| 4422 | // |<----------------| | |
| 4423 | // | | | |
| 4424 | // |
| 4425 | //----------------------------------------------------------------------------- |
| 4426 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4428 | |
| 4429 | // Init counter check |
| 4430 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4431 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4432 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4433 | Counter{cSubReqToE2, 1}, |
| 4434 | Counter{cSubReReqToE2, 1}, |
| 4435 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4436 | Counter{cSubDelReReqToE2, 1}, |
| 4437 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4438 | Counter{cSubDelReqToE2, 1}, |
| 4439 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4440 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4441 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4442 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4443 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4444 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4445 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4446 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4447 | |
| 4448 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4449 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4450 | |
| 4451 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4452 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4453 | |
| 4454 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4455 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4456 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4457 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4459 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4460 | |
| 4461 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4462 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4463 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4464 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4465 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4466 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4467 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4468 | } |
| 4469 | |
| 4470 | //----------------------------------------------------------------------------- |
| 4471 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4472 | // |
| 4473 | // stub stub |
| 4474 | // +-------+ +---------+ +---------+ |
| 4475 | // | xapp | | submgr | | e2term | |
| 4476 | // +-------+ +---------+ +---------+ |
| 4477 | // | | | |
| 4478 | // | RESTSubReq | | |
| 4479 | // |---------------->| | |
| 4480 | // | | | |
| 4481 | // | RESTSubResp | | |
| 4482 | // |<----------------| | |
| 4483 | // | | SubReq | |
| 4484 | // | |------------->| |
| 4485 | // | | | |
| 4486 | // | | | |
| 4487 | // | | SubReq | |
| 4488 | // | |------------->| |
| 4489 | // | | | |
| 4490 | // | | SubDelReq | |
| 4491 | // | |------------->| |
| 4492 | // | | | |
| 4493 | // | | | |
| 4494 | // | | SubDelReq | |
| 4495 | // | |------------->| |
| 4496 | // | | | |
| 4497 | // | | | |
| 4498 | // | | SubDelResp | |
| 4499 | // | |<-------------| |
| 4500 | // | RESTNotif | | |
| 4501 | // | unsuccess | | |
| 4502 | // |<----------------| | |
| 4503 | // | | | |
| 4504 | // | [SUBS DELETE] | |
| 4505 | // | | | |
| 4506 | // |
| 4507 | //----------------------------------------------------------------------------- |
| 4508 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4509 | |
| 4510 | // Init counter check |
| 4511 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4512 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4513 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4514 | Counter{cSubReqToE2, 1}, |
| 4515 | Counter{cSubReReqToE2, 1}, |
| 4516 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4517 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4518 | Counter{cSubDelReqToE2, 1}, |
| 4519 | Counter{cSubDelReReqToE2, 1}, |
| 4520 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4521 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4522 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4523 | }) |
| 4524 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4525 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4526 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4527 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4528 | |
| 4529 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4530 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4531 | |
| 4532 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4533 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4534 | |
| 4535 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4536 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4537 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4538 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4539 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4540 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4541 | |
| 4542 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4543 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4544 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4545 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4546 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4547 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4548 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | } |
| 4550 | |
| 4551 | //----------------------------------------------------------------------------- |
| 4552 | // TestRESTSubReqSubFailRespInSubmgr |
| 4553 | // |
| 4554 | // stub stub |
| 4555 | // +-------+ +---------+ +---------+ |
| 4556 | // | xapp | | submgr | | e2term | |
| 4557 | // +-------+ +---------+ +---------+ |
| 4558 | // | | | |
| 4559 | // | RESTSubReq | | |
| 4560 | // |---------------->| | |
| 4561 | // | | | |
| 4562 | // | RESTSubResp | | |
| 4563 | // |<----------------| | |
| 4564 | // | | SubReq | |
| 4565 | // | |------------->| |
| 4566 | // | | | |
| 4567 | // | | SubFail | |
| 4568 | // | |<-------------| |
| 4569 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4570 | // | RESTNotif | | |
| 4571 | // | unsuccess | | |
| 4572 | // |<----------------| | |
| 4573 | // | | | |
| 4574 | // | [SUBS DELETE] | |
| 4575 | // | | | |
| 4576 | // |
| 4577 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4578 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4580 | |
| 4581 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4582 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4583 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4584 | Counter{cSubReqToE2, 1}, |
| 4585 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4586 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4587 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4588 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4589 | }) |
| 4590 | |
| 4591 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4592 | const e2Timeout int64 = 2 |
| 4593 | const e2RetryCount int64 = 1 |
| 4594 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4595 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4596 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4597 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4598 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4599 | |
| 4600 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4601 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4602 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4603 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4604 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4605 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4606 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4607 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4608 | |
| 4609 | // REST subscription sill there to be deleted |
| 4610 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4611 | |
| 4612 | // Wait that subs is cleaned |
| 4613 | waitSubsCleanup(t, e2SubsId, 10) |
| 4614 | |
| 4615 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4616 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4617 | } |
| 4618 | |
| 4619 | //----------------------------------------------------------------------------- |
Anssi Mannila | 56233b0 | 2022-01-24 13:26:42 +0200 | [diff] [blame] | 4620 | // TestRESTSubReqPartialResp |
| 4621 | // |
| 4622 | // stub stub |
| 4623 | // +-------+ +---------+ +---------+ |
| 4624 | // | xapp | | submgr | | e2term | |
| 4625 | // +-------+ +---------+ +---------+ |
| 4626 | // | | | |
| 4627 | // | RESTSubReq | | |
| 4628 | // |---------------->| | |
| 4629 | // | RESTSubResp | | |
| 4630 | // |<----------------| | |
| 4631 | // | | SubReq | |
| 4632 | // | |------------->| |
| 4633 | // | | SubResp | Partially accepted |
| 4634 | // | |<-------------| |
| 4635 | // | | | |
| 4636 | // | RESTNotif | | |
| 4637 | // |<----------------| | |
| 4638 | // | | | |
| 4639 | // | [SUBS DELETE] | |
| 4640 | // | | | |
| 4641 | // |
| 4642 | //----------------------------------------------------------------------------- |
| 4643 | |
| 4644 | func TestRESTSubReqPartialResp(t *testing.T) { |
| 4645 | |
| 4646 | // Init counter check |
| 4647 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4648 | Counter{cRestSubReqFromXapp, 1}, |
| 4649 | Counter{cRestSubRespToXapp, 1}, |
| 4650 | Counter{cSubReqToE2, 1}, |
| 4651 | Counter{cSubRespFromE2, 1}, |
| 4652 | Counter{cPartialSubRespFromE2, 1}, |
| 4653 | Counter{cRestSubNotifToXapp, 1}, |
| 4654 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4655 | Counter{cSubDelReqToE2, 1}, |
| 4656 | Counter{cSubDelRespFromE2, 1}, |
| 4657 | Counter{cRestSubDelRespToXapp, 1}, |
| 4658 | }) |
| 4659 | |
| 4660 | // Req |
| 4661 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 4662 | |
| 4663 | actionId := int64(2) |
| 4664 | actionType := "report" |
| 4665 | actionDefinition := []int64{5678, 1} |
| 4666 | subsequestActionType := "continue" |
| 4667 | timeToWait := "w10ms" |
| 4668 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4669 | |
| 4670 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4671 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4672 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4673 | |
| 4674 | actionNotAdmittedItem := e2ap.ActionNotAdmittedItem{} |
| 4675 | actionNotAdmittedItem.ActionId = 1 |
| 4676 | actionNotAdmittedItem.Cause.Content = 1 |
| 4677 | actionNotAdmittedItem.Cause.Value = 8 |
| 4678 | actionNotAdmittedList := e2ap.ActionNotAdmittedList{} |
| 4679 | actionNotAdmittedList.Items = append(actionNotAdmittedList.Items, actionNotAdmittedItem) |
| 4680 | e2termConn1.SendPartialSubsResp(t, crereq, cremsg, actionNotAdmittedList) |
| 4681 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4682 | |
| 4683 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4684 | |
| 4685 | // Del |
| 4686 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4687 | |
| 4688 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4689 | //Wait that subs is cleaned |
| 4690 | waitSubsCleanup(t, e2SubsId, 10) |
| 4691 | |
| 4692 | mainCtrl.VerifyCounterValues(t) |
| 4693 | mainCtrl.VerifyAllClean(t) |
| 4694 | } |
| 4695 | |
| 4696 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4697 | // TestRESTSubDelReqRetryInSubmgr |
| 4698 | // |
| 4699 | // stub stub |
| 4700 | // +-------+ +---------+ +---------+ |
| 4701 | // | xapp | | submgr | | e2term | |
| 4702 | // +-------+ +---------+ +---------+ |
| 4703 | // | | | |
| 4704 | // | [SUBS CREATE] | |
| 4705 | // | | | |
| 4706 | // | | | |
| 4707 | // | RESTSubDelReq | | |
| 4708 | // |---------------->| | |
| 4709 | // | | | |
| 4710 | // | RESTSubDelResp | | |
| 4711 | // |<----------------| | |
| 4712 | // | | SubDelReq | |
| 4713 | // | |------------->| |
| 4714 | // | | | |
| 4715 | // | | SubDelReq | |
| 4716 | // | |------------->| |
| 4717 | // | | | |
| 4718 | // | | SubDelResp | |
| 4719 | // | |<-------------| |
| 4720 | // | | | |
| 4721 | // |
| 4722 | //----------------------------------------------------------------------------- |
| 4723 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4724 | |
| 4725 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4726 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4727 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4728 | Counter{cSubReqToE2, 1}, |
| 4729 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4730 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4731 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4732 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4733 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4734 | Counter{cSubDelReReqToE2, 1}, |
| 4735 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4736 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4737 | }) |
| 4738 | // Req |
| 4739 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4740 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4741 | |
| 4742 | // Del |
| 4743 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4744 | |
| 4745 | // E2t: Receive 1st SubsDelReq |
| 4746 | e2termConn1.RecvSubsDelReq(t) |
| 4747 | |
| 4748 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4749 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4750 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4751 | |
| 4752 | //Wait that subs is cleaned |
| 4753 | waitSubsCleanup(t, e2SubsId, 10) |
| 4754 | |
| 4755 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4756 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4757 | } |
| 4758 | |
| 4759 | //----------------------------------------------------------------------------- |
| 4760 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4761 | // |
| 4762 | // stub stub |
| 4763 | // +-------+ +---------+ +---------+ |
| 4764 | // | xapp | | submgr | | e2term | |
| 4765 | // +-------+ +---------+ +---------+ |
| 4766 | // | | | |
| 4767 | // | [SUBS CREATE] | |
| 4768 | // | | | |
| 4769 | // | | | |
| 4770 | // | RESTSubDelReq | | |
| 4771 | // |---------------->| | |
| 4772 | // | | | |
| 4773 | // | RESTSubDelResp | | |
| 4774 | // |<----------------| | |
| 4775 | // | | SubDelReq | |
| 4776 | // | |------------->| |
| 4777 | // | | | |
| 4778 | // | | SubDelReq | |
| 4779 | // | |------------->| |
| 4780 | // | | | |
| 4781 | // | | | |
| 4782 | // |
| 4783 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4784 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4785 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4786 | |
| 4787 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4788 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4789 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4790 | Counter{cSubReqToE2, 1}, |
| 4791 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4792 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4793 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4794 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4795 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4796 | Counter{cSubDelReReqToE2, 1}, |
| 4797 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4798 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4799 | }) |
| 4800 | |
| 4801 | // Req |
| 4802 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4803 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4804 | |
| 4805 | // Del |
| 4806 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4807 | |
| 4808 | // E2t: Receive 1st SubsDelReq |
| 4809 | e2termConn1.RecvSubsDelReq(t) |
| 4810 | |
| 4811 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4812 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4813 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4814 | |
| 4815 | //Wait that subs is cleaned |
| 4816 | waitSubsCleanup(t, e2SubsId, 10) |
| 4817 | |
| 4818 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4819 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4820 | } |
| 4821 | |
| 4822 | //----------------------------------------------------------------------------- |
| 4823 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4824 | // |
| 4825 | // stub stub |
| 4826 | // +-------+ +---------+ +---------+ |
| 4827 | // | xapp | | submgr | | e2term | |
| 4828 | // +-------+ +---------+ +---------+ |
| 4829 | // | | | |
| 4830 | // | [SUBS CREATE] | |
| 4831 | // | | | |
| 4832 | // | | | |
| 4833 | // | RESTSubDelReq | | |
| 4834 | // |---------------->| | |
| 4835 | // | | | |
| 4836 | // | RESTSubDelResp | | |
| 4837 | // |<----------------| | |
| 4838 | // | | SubDelReq | |
| 4839 | // | |------------->| |
| 4840 | // | | | |
| 4841 | // | | SubDelFail | |
| 4842 | // | |<-------------| |
| 4843 | // | | | |
| 4844 | // |
| 4845 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4846 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4847 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4848 | |
| 4849 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4850 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4851 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4852 | Counter{cSubReqToE2, 1}, |
| 4853 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4854 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4855 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4856 | Counter{cSubDelReqToE2, 1}, |
| 4857 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4858 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4859 | }) |
| 4860 | |
| 4861 | // Req |
| 4862 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4863 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4864 | |
| 4865 | // Del |
| 4866 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4867 | |
| 4868 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4869 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4870 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4871 | |
| 4872 | //Wait that subs is cleaned |
| 4873 | waitSubsCleanup(t, e2SubsId, 10) |
| 4874 | |
| 4875 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4876 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4877 | } |
| 4878 | |
| 4879 | //----------------------------------------------------------------------------- |
| 4880 | // TestRESTSubReqAndSubDelOkSameAction |
| 4881 | // |
| 4882 | // stub stub |
| 4883 | // +-------+ +-------+ +---------+ +---------+ |
| 4884 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4885 | // +-------+ +-------+ +---------+ +---------+ |
| 4886 | // | | | | |
| 4887 | // | | RESTSubReq1 | | |
| 4888 | // | |---------------->| | |
| 4889 | // | | | | |
| 4890 | // | | RESTSubResp1 | | |
| 4891 | // | |<----------------| | |
| 4892 | // | | | | |
| 4893 | // | | | SubReq1 | |
| 4894 | // | | |------------->| |
| 4895 | // | | | SubResp1 | |
| 4896 | // | | |<-------------| |
| 4897 | // | | RESTNotif1 | | |
| 4898 | // | |<----------------| | |
| 4899 | // | | | | |
| 4900 | // | RESTSubReq2 | | |
| 4901 | // |------------------------------>| | |
| 4902 | // | | | | |
| 4903 | // | RESTSubResp2 | | |
| 4904 | // |<------------------------------| | |
| 4905 | // | | | | |
| 4906 | // | | RESTNotif2 | | |
| 4907 | // |<------------------------------| | |
| 4908 | // | | | | |
| 4909 | // | | RESTSubDelReq1 | | |
| 4910 | // | |---------------->| | |
| 4911 | // | | | | |
| 4912 | // | | RESTSubDelResp1 | | |
| 4913 | // | |<----------------| | |
| 4914 | // | | | | |
| 4915 | // | RESTSubDelReq2 | | |
| 4916 | // |------------------------------>| | |
| 4917 | // | | | | |
| 4918 | // | RESTSubDelResp2 | | |
| 4919 | // |<------------------------------| | |
| 4920 | // | | | | |
| 4921 | // | | | SubDelReq2 | |
| 4922 | // | | |------------->| |
| 4923 | // | | | | |
| 4924 | // | | | SubDelResp2 | |
| 4925 | // | | |<-------------| |
| 4926 | // | | | | |
| 4927 | // |
| 4928 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4929 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4930 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4931 | |
| 4932 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4933 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4934 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4935 | Counter{cSubReqToE2, 1}, |
| 4936 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4937 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4938 | Counter{cMergedSubscriptions, 1}, |
| 4939 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4940 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4941 | Counter{cSubDelReqToE2, 1}, |
| 4942 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4943 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4944 | }) |
| 4945 | |
| 4946 | // Req1 |
| 4947 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4948 | |
| 4949 | //Subs Create |
| 4950 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4951 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4952 | |
| 4953 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4954 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4955 | params.SetMeid("RAN_NAME_1") |
| 4956 | |
| 4957 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4958 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4959 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4960 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4961 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4962 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4963 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4964 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4965 | |
| 4966 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4967 | |
| 4968 | // Del1 |
| 4969 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4970 | |
| 4971 | // Del2 |
| 4972 | deleteXapp2Subscription(t, &restSubId2) |
| 4973 | |
| 4974 | //Wait that subs is cleaned |
| 4975 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4976 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4977 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4978 | } |
| 4979 | |
| 4980 | //----------------------------------------------------------------------------- |
| 4981 | // TestSubReqAndSubDelOkSameActionParallel |
| 4982 | // |
| 4983 | // stub stub stub |
| 4984 | // +-------+ +-------+ +---------+ +---------+ |
| 4985 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4986 | // +-------+ +-------+ +---------+ +---------+ |
| 4987 | // | | | | |
| 4988 | // | | | | |
| 4989 | // | | | | |
| 4990 | // | | SubReq1 | | |
| 4991 | // | |------------->| | |
| 4992 | // | | | | |
| 4993 | // | | | SubReq1 | |
| 4994 | // | | |------------->| |
| 4995 | // | SubReq2 | | |
| 4996 | // |--------------------------->| | |
| 4997 | // | | | SubResp1 | |
| 4998 | // | | |<-------------| |
| 4999 | // | | SubResp1 | | |
| 5000 | // | |<-------------| | |
| 5001 | // | | | SubReq2 | |
| 5002 | // | | |------------->| |
| 5003 | // | | | | |
| 5004 | // | | | SubResp2 | |
| 5005 | // | | |<-------------| |
| 5006 | // | SubResp2 | | |
| 5007 | // |<---------------------------| | |
| 5008 | // | | | | |
| 5009 | // | | SubDelReq 1 | | |
| 5010 | // | |------------->| | |
| 5011 | // | | | | |
| 5012 | // | | SubDelResp 1 | | |
| 5013 | // | |<-------------| | |
| 5014 | // | | | | |
| 5015 | // | SubDelReq 2 | | |
| 5016 | // |--------------------------->| | |
| 5017 | // | | | | |
| 5018 | // | | | SubDelReq 2 | |
| 5019 | // | | |------------->| |
| 5020 | // | | | | |
| 5021 | // | | | SubDelReq 2 | |
| 5022 | // | | |------------->| |
| 5023 | // | | | | |
| 5024 | // | SubDelResp 2 | | |
| 5025 | // |<---------------------------| | |
| 5026 | // |
| 5027 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5028 | |
| 5029 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5030 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5031 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5032 | Counter{cSubReqToE2, 2}, |
| 5033 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5034 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5035 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5036 | Counter{cSubDelReqToE2, 2}, |
| 5037 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5038 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5039 | }) |
| 5040 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5041 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5042 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5043 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5044 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5045 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5046 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5047 | |
| 5048 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5049 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5050 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 5051 | |
| 5052 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5053 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 5054 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 5055 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5056 | |
| 5057 | // Del1 |
| 5058 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5059 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5060 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5061 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5062 | |
| 5063 | // Del2 |
| 5064 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5065 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 5066 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 5067 | |
| 5068 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5069 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5070 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5071 | } |
| 5072 | |
| 5073 | //----------------------------------------------------------------------------- |
| 5074 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 5075 | // |
| 5076 | // stub stub stub |
| 5077 | // +-------+ +-------+ +---------+ +---------+ |
| 5078 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5079 | // +-------+ +-------+ +---------+ +---------+ |
| 5080 | // | | | | |
| 5081 | // | | | | |
| 5082 | // | | | | |
| 5083 | // | | RESTSubReq1 | | |
| 5084 | // | |---------------->| | |
| 5085 | // | | | | |
| 5086 | // | | RESTSubResp1 | | |
| 5087 | // | |<----------------| | |
| 5088 | // | | | SubReq1 | |
| 5089 | // | | |------------->| |
| 5090 | // | RESTSubReq2 | | |
| 5091 | // |------------------------------>| | |
| 5092 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5093 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5094 | // |<------------------------------| | |
| 5095 | // | | | SubReq1 | |
| 5096 | // | | |------------->| |
| 5097 | // | | | | |
| 5098 | // | | | | |
| 5099 | // | | | SubDelReq | |
| 5100 | // | | |------------->| |
| 5101 | // | | | | |
| 5102 | // | | | SubDelResp | |
| 5103 | // | | |<-------------| |
| 5104 | // | | RESTNotif1 | | |
| 5105 | // | | unsuccess | | |
| 5106 | // | |<----------------| | |
| 5107 | // | RESTNotif2 | | |
| 5108 | // | | unsuccess | | |
| 5109 | // |<------------------------------| | |
| 5110 | // | | | | |
| 5111 | // | | RESTSubDelReq1 | | |
| 5112 | // | |---------------->| | |
| 5113 | // | | | | |
| 5114 | // | | RESTSubDelResp1 | | |
| 5115 | // | |<----------------| | |
| 5116 | // | | | | |
| 5117 | // | RESTSubDelReq2 | | |
| 5118 | // |------------------------------>| | |
| 5119 | // | | | | |
| 5120 | // | RESTSubDelResp2 | | |
| 5121 | // |<------------------------------| | |
| 5122 | // |
| 5123 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5124 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5125 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5126 | |
| 5127 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5128 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5129 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5130 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5131 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5132 | Counter{cSubReqTimerExpiry, 2}, |
| 5133 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5134 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5135 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5136 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5137 | Counter{cSubDelReqToE2, 1}, |
| 5138 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5139 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5140 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5141 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5142 | |
| 5143 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5144 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5145 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5146 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5147 | |
| 5148 | // Req2 |
| 5149 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5150 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5151 | params2.SetMeid("RAN_NAME_1") |
| 5152 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5153 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5154 | |
| 5155 | //Req1 (retransmitted) |
| 5156 | e2termConn1.RecvSubsReq(t) |
| 5157 | |
| 5158 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5159 | |
| 5160 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5161 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5162 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5163 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5164 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5165 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5166 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5167 | |
| 5168 | // Del1 |
| 5169 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5170 | |
| 5171 | // Del2 |
| 5172 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5173 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5174 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5175 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5176 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5177 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5178 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5179 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5180 | } |
| 5181 | |
| 5182 | //----------------------------------------------------------------------------- |
| 5183 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5184 | // |
| 5185 | // stub stub stub |
| 5186 | // +-------+ +-------+ +---------+ +---------+ |
| 5187 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5188 | // +-------+ +-------+ +---------+ +---------+ |
| 5189 | // | | | | |
| 5190 | // | | | | |
| 5191 | // | | | | |
| 5192 | // | | RESTSubReq1 | | |
| 5193 | // | |---------------->| | |
| 5194 | // | | | | |
| 5195 | // | | RESTSubResp1 | | |
| 5196 | // | |<----------------| | |
| 5197 | // | | | SubReq1 | |
| 5198 | // | | |------------->| |
| 5199 | // | RESTSubReq2 | | |
| 5200 | // |------------------------------>| | |
| 5201 | // | | | | |
| 5202 | // | RESTSubDelResp2 | | |
| 5203 | // |<------------------------------| | |
| 5204 | // | | | SubFail1 | |
| 5205 | // | | |<-------------| |
| 5206 | // | | | | |
| 5207 | // | | RESTNotif1 | | |
| 5208 | // | | unsuccess | | |
| 5209 | // | |<----------------| | |
| 5210 | // | RESTNotif2 | | |
| 5211 | // | | unsuccess | | |
| 5212 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5213 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5214 | // | | 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] | 5215 | // | |---------------->| | |
| 5216 | // | | | | |
| 5217 | // | | RESTSubDelResp1 | | |
| 5218 | // | |<----------------| | |
| 5219 | // | | | | |
| 5220 | // | RESTSubDelReq2 | | |
| 5221 | // |------------------------------>| | |
| 5222 | // | | | | |
| 5223 | // | RESTSubDelResp2 | | |
| 5224 | // |<------------------------------| | |
| 5225 | // |
| 5226 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5227 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5228 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5229 | |
| 5230 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5231 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5232 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5233 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5234 | Counter{cSubReqToE2, 1}, |
| 5235 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5236 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5237 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5238 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5239 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5240 | }) |
| 5241 | |
| 5242 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5243 | |
| 5244 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5245 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5246 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5247 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5248 | |
| 5249 | // Req2 |
| 5250 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5251 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5252 | params2.SetMeid("RAN_NAME_1") |
| 5253 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5254 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5255 | |
| 5256 | // E2t: send SubsFail (first) |
| 5257 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5258 | fparams1.Set(crereq1) |
| 5259 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5260 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5261 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5262 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5263 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5264 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5265 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5266 | |
| 5267 | // Del1 |
| 5268 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5269 | |
| 5270 | // Del2 |
| 5271 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5272 | |
| 5273 | //Wait that subs is cleaned |
| 5274 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5275 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5276 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5277 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5278 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5279 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5280 | //----------------------------------------------------------------------------- |
| 5281 | // TestRESTSubReqPolicyAndSubDelOk |
| 5282 | // |
| 5283 | // stub stub |
| 5284 | // +-------+ +---------+ +---------+ |
| 5285 | // | xapp | | submgr | | e2term | |
| 5286 | // +-------+ +---------+ +---------+ |
| 5287 | // | | | |
| 5288 | // | RESTSubReq | | |
| 5289 | // |--------------->| | |
| 5290 | // | RESTSubResp | | |
| 5291 | // |<---------------| | |
| 5292 | // | | | |
| 5293 | // | | SubReq | |
| 5294 | // | |------------->| |
| 5295 | // | | | |
| 5296 | // | | SubResp | |
| 5297 | // | |<-------------| |
| 5298 | // | | | |
| 5299 | // | RESTNotif | | |
| 5300 | // |<---------------| | |
| 5301 | // | | | |
| 5302 | // | | | |
| 5303 | // | RESTSubDelReq | | |
| 5304 | // |--------------->| | |
| 5305 | // | RESTSubDelResp | | |
| 5306 | // |<---------------| | |
| 5307 | // | | | |
| 5308 | // | | SubDelReq | |
| 5309 | // | |------------->| |
| 5310 | // | | | |
| 5311 | // | | SubDelResp | |
| 5312 | // | |<-------------| |
| 5313 | // | | | |
| 5314 | // |
| 5315 | //----------------------------------------------------------------------------- |
| 5316 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5317 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5318 | |
| 5319 | // Init counter check |
| 5320 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5321 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5322 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5323 | Counter{cSubReqToE2, 1}, |
| 5324 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5325 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5326 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5327 | Counter{cSubDelReqToE2, 1}, |
| 5328 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5329 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5330 | }) |
| 5331 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5332 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5333 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5334 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5335 | |
| 5336 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5337 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5338 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5339 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5340 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5341 | |
| 5342 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5343 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5344 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5345 | |
| 5346 | // Wait that subs is cleaned |
| 5347 | waitSubsCleanup(t, e2SubsId, 10) |
| 5348 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5349 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5350 | } |
| 5351 | |
| 5352 | //----------------------------------------------------------------------------- |
| 5353 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5354 | // |
| 5355 | // stub stub |
| 5356 | // +-------+ +---------+ +---------+ |
| 5357 | // | xapp | | submgr | | e2term | |
| 5358 | // +-------+ +---------+ +---------+ |
| 5359 | // | | | |
| 5360 | // | RESTSubReq | | |
| 5361 | // |---------------->| | |
| 5362 | // | | | |
| 5363 | // | RESTSubResp | | |
| 5364 | // |<----------------| | |
| 5365 | // | | SubReq | |
| 5366 | // | |------------->| |
| 5367 | // | | | |
| 5368 | // | | SubResp | |
| 5369 | // | |<-------------| |
| 5370 | // | | | |
| 5371 | // | RESTNotif | | |
| 5372 | // |<----------------| | |
| 5373 | // | | | |
| 5374 | // | RESTSubReq | | |
| 5375 | // |---------------->| | |
| 5376 | // | | | |
| 5377 | // | RESTSubResp | | |
| 5378 | // |<----------------| | |
| 5379 | // | | SubReq | |
| 5380 | // | |------------->| |
| 5381 | // | | | |
| 5382 | // | | SubResp | |
| 5383 | // | |<-------------| |
| 5384 | // | | | |
| 5385 | // | RESTNotif | | |
| 5386 | // |<----------------| | |
| 5387 | // | | | |
| 5388 | // | RESTSubDelReq | | |
| 5389 | // |---------------->| | |
| 5390 | // | | | |
| 5391 | // | | SubDelReq | |
| 5392 | // | |------------->| |
| 5393 | // | | | |
| 5394 | // | | SubDelResp | |
| 5395 | // | |<-------------| |
| 5396 | // | | | |
| 5397 | // | RESTSubDelResp | | |
| 5398 | // |<----------------| | |
| 5399 | // |
| 5400 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5401 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5402 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5403 | |
| 5404 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5405 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5406 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5407 | Counter{cSubReqToE2, 2}, |
| 5408 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5409 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5410 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5411 | Counter{cSubDelReqToE2, 1}, |
| 5412 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5413 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5414 | }) |
| 5415 | |
| 5416 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5417 | const e2Timeout int64 = 1 |
| 5418 | const e2RetryCount int64 = 0 |
| 5419 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5420 | |
| 5421 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5422 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5423 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5424 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5425 | |
| 5426 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5427 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5428 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5429 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5430 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5431 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5432 | params.SetTimeToWait("w200ms") |
| 5433 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5434 | |
| 5435 | // Del |
| 5436 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5437 | |
| 5438 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5439 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5440 | |
| 5441 | // Wait that subs is cleaned |
| 5442 | waitSubsCleanup(t, e2SubsId, 10) |
| 5443 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5444 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5445 | } |
| 5446 | |
| 5447 | //----------------------------------------------------------------------------- |
aditverm | 323c77e | 2023-09-20 09:50:47 +0530 | [diff] [blame^] | 5448 | // TestRESTSubReqPolicyChangeNokAndSubDelOk |
| 5449 | // |
| 5450 | // stub stub |
| 5451 | // +-------+ +---------+ +---------+ |
| 5452 | // | xapp | | submgr | | e2term | |
| 5453 | // +-------+ +---------+ +---------+ |
| 5454 | // | | | |
| 5455 | // | RESTSubReq | | |
| 5456 | // |---------------->| | |
| 5457 | // | | | |
| 5458 | // | RESTSubResp | | |
| 5459 | // |<----------------| | |
| 5460 | // | | SubReq | |
| 5461 | // | |------------->| |
| 5462 | // | | | |
| 5463 | // | | SubResp | |
| 5464 | // | |<-------------| |
| 5465 | // | | | |
| 5466 | // | RESTNotif | | |
| 5467 | // |<----------------| | |
| 5468 | // | | | |
| 5469 | // | RESTSubReq | | |
| 5470 | // |---------------->| | |
| 5471 | // | | | |
| 5472 | // | RESTSubResp | | |
| 5473 | // |<----------------| | |
| 5474 | // | | SubReq | |
| 5475 | // | |------------->| |
| 5476 | // | | | |
| 5477 | // | | SubFail | |
| 5478 | // | |<-------------| |
| 5479 | // | | | |
| 5480 | // | RESTNotif | | |
| 5481 | // |<----------------| | |
| 5482 | // | | | |
| 5483 | // | RESTSubDelReq | | |
| 5484 | // |---------------->| | |
| 5485 | // | | | |
| 5486 | // | | SubDelReq | |
| 5487 | // | |------------->| |
| 5488 | // | | | |
| 5489 | // | | SubDelResp | |
| 5490 | // | |<-------------| |
| 5491 | // | | | |
| 5492 | // | RESTSubDelResp | | |
| 5493 | // |<----------------| | |
| 5494 | // |
| 5495 | //----------------------------------------------------------------------------- |
| 5496 | |
| 5497 | func TestRESTSubReqPolicyChangeNokAndSubDelOk(t *testing.T) { |
| 5498 | |
| 5499 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5500 | Counter{cRestSubReqFromXapp, 2}, |
| 5501 | Counter{cRestSubRespToXapp, 2}, |
| 5502 | Counter{cSubReqToE2, 2}, |
| 5503 | Counter{cSubRespFromE2, 1}, |
| 5504 | Counter{cSubFailFromE2, 1}, |
| 5505 | Counter{cRestSubNotifToXapp, 1}, |
| 5506 | Counter{cRestSubFailNotifToXapp, 1}, |
| 5507 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5508 | Counter{cSubDelReqToE2, 1}, |
| 5509 | Counter{cSubDelRespFromE2, 1}, |
| 5510 | Counter{cRestSubDelRespToXapp, 1}, |
| 5511 | }) |
| 5512 | |
| 5513 | const subReqCount int = 1 |
| 5514 | const e2Timeout int64 = 1 |
| 5515 | const e2RetryCount int64 = 0 |
| 5516 | const routingNeeded bool = false |
| 5517 | |
| 5518 | // Req |
| 5519 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5520 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5521 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5522 | fmt.Printf("restSubId: %v", restSubId) |
| 5523 | |
| 5524 | // Policy change |
| 5525 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
| 5526 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5527 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 5528 | params.SetSubscriptionID(&restSubId) |
| 5529 | params.SetTimeToWait("w200ms") |
| 5530 | |
| 5531 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 5532 | fmt.Printf("restSubId: %v", restSubId) |
| 5533 | |
| 5534 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5535 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
| 5536 | |
| 5537 | // Gnb sends RICSubscriptionFailure |
| 5538 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5539 | fparams.Set(crereq) |
| 5540 | fparams.SetCauseVal(0, 1, 5) // CauseRIC / function-resource-limit |
| 5541 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5542 | |
| 5543 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5544 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5545 | |
| 5546 | // Del |
| 5547 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5548 | |
| 5549 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5550 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5551 | |
| 5552 | // Wait that subs is cleaned |
| 5553 | waitSubsCleanup(t, e2SubsId, 10) |
| 5554 | mainCtrl.VerifyCounterValues(t) |
| 5555 | mainCtrl.VerifyAllClean(t) |
| 5556 | } |
| 5557 | |
| 5558 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5559 | // TestRESTSubReqPolicyChangeNOk |
| 5560 | // |
| 5561 | // stub stub |
| 5562 | // +-------+ +---------+ +---------+ |
| 5563 | // | xapp | | submgr | | e2term | |
| 5564 | // +-------+ +---------+ +---------+ |
| 5565 | // | | | |
| 5566 | // | RESTSubReq | | |
| 5567 | // |---------------->| | |
| 5568 | // | | | |
| 5569 | // | RESTSubResp | | |
| 5570 | // |<----------------| | |
| 5571 | // | | SubReq | |
| 5572 | // | |------------->| |
| 5573 | // | | | |
| 5574 | // | | SubResp | |
| 5575 | // | |<-------------| |
| 5576 | // | | | |
| 5577 | // | RESTNotif | | |
| 5578 | // |<----------------| | |
| 5579 | // | | | |
| 5580 | // | RESTSubReq | | |
| 5581 | // |---------------->| | |
| 5582 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5583 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5584 | // | | | |
| 5585 | // | RESTSubDelReq | | |
| 5586 | // |---------------->| | |
| 5587 | // | | | |
| 5588 | // | | SubDelReq | |
| 5589 | // | |------------->| |
| 5590 | // | | | |
| 5591 | // | | SubDelResp | |
| 5592 | // | |<-------------| |
| 5593 | // | | | |
| 5594 | // | RESTSubDelResp | | |
| 5595 | // |<----------------| | |
| 5596 | // |
| 5597 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5598 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5599 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5600 | |
| 5601 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5602 | Counter{cRestSubReqFromXapp, 2}, |
| 5603 | Counter{cRestSubRespToXapp, 1}, |
| 5604 | Counter{cSubReqToE2, 1}, |
| 5605 | Counter{cSubRespFromE2, 1}, |
| 5606 | Counter{cRestSubNotifToXapp, 1}, |
| 5607 | Counter{cRestSubFailToXapp, 1}, |
| 5608 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5609 | Counter{cSubDelReqToE2, 1}, |
| 5610 | Counter{cSubDelRespFromE2, 1}, |
| 5611 | Counter{cRestSubDelRespToXapp, 1}, |
| 5612 | }) |
| 5613 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5614 | // Req |
| 5615 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5616 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5617 | |
| 5618 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5619 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5620 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5621 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5622 | params.SetSubscriptionID(&restSubIdUpd) |
| 5623 | params.SetTimeToWait("w200ms") |
| 5624 | |
| 5625 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5626 | assert.Equal(t, restSubId2, "") |
| 5627 | |
| 5628 | // Del |
| 5629 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5630 | |
| 5631 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5632 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5633 | |
| 5634 | // Wait that subs is cleaned |
| 5635 | waitSubsCleanup(t, e2SubsId, 10) |
| 5636 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5637 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5638 | } |
| 5639 | |
| 5640 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5641 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5642 | // |
| 5643 | // stub stub stub |
| 5644 | // +-------+ +---------+ +---------+ +---------+ |
| 5645 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5646 | // +-------+ +---------+ +---------+ +---------+ |
| 5647 | // | | | | |
| 5648 | // | | | | |
| 5649 | // | | | | |
| 5650 | // | RESTSubReq1 | | | |
| 5651 | // |---------------->| | | |
| 5652 | // | | | | |
| 5653 | // | RESTSubResp1 | | | |
| 5654 | // |<----------------| | | |
| 5655 | // | | SubReq1 | | |
| 5656 | // | |------------->| | |
| 5657 | // | | | | |
| 5658 | // | RESTSubReq2 | | | |
| 5659 | // |---------------->| | | |
| 5660 | // | | | | |
| 5661 | // | RESTSubResp2 | | | |
| 5662 | // |<----------------| | | |
| 5663 | // | | SubReq2 | | |
| 5664 | // | |---------------------------->| |
| 5665 | // | | | | |
| 5666 | // | | SubResp1 | | |
| 5667 | // | |<-------------| | |
| 5668 | // | RESTNotif1 | | | |
| 5669 | // |<----------------| | | |
| 5670 | // | | SubResp2 | | |
| 5671 | // | |<----------------------------| |
| 5672 | // | RESTNotif2 | | | |
| 5673 | // |<----------------| | | |
| 5674 | // | | | | |
| 5675 | // | [SUBS 1 DELETE] | | |
| 5676 | // | | | | |
| 5677 | // | [SUBS 2 DELETE] | | |
| 5678 | // | | | | |
| 5679 | // |
| 5680 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5681 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5682 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5683 | |
| 5684 | // Init counter check |
| 5685 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5686 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5687 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5688 | Counter{cSubReqToE2, 2}, |
| 5689 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5690 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5691 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5692 | Counter{cSubDelReqToE2, 2}, |
| 5693 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5694 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5695 | }) |
| 5696 | |
| 5697 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5698 | |
| 5699 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5700 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5701 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5702 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5703 | |
| 5704 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5705 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5706 | params.SetMeid("RAN_NAME_11") |
| 5707 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5708 | // would not work as notification would not be received |
| 5709 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5710 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5711 | |
| 5712 | // Resp1 |
| 5713 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5714 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5715 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5716 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5717 | |
| 5718 | // Resp2 |
| 5719 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5720 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5721 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5722 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5723 | |
| 5724 | // Delete1 |
| 5725 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5726 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5727 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5728 | |
| 5729 | // Wait that subs is cleaned |
| 5730 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5731 | |
| 5732 | // Delete2 |
| 5733 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5734 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5735 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5736 | |
| 5737 | // Wait that subs is cleaned |
| 5738 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5739 | |
| 5740 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5741 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5742 | } |
| 5743 | |
| 5744 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5745 | // TestRESTSubReqInsertAndSubDelOk |
| 5746 | // |
| 5747 | // stub stub |
| 5748 | // +-------+ +---------+ +---------+ |
| 5749 | // | xapp | | submgr | | e2term | |
| 5750 | // +-------+ +---------+ +---------+ |
| 5751 | // | | | |
| 5752 | // | RestSubReq | | |
| 5753 | // |---------------->| | |
| 5754 | // | | | |
| 5755 | // | RESTSubResp | | |
| 5756 | // |<----------------| | |
| 5757 | // | | | |
| 5758 | // | | SubReq | |
| 5759 | // | |------------->| |
| 5760 | // | | | |
| 5761 | // | | SubResp | |
| 5762 | // | |<-------------| |
| 5763 | // | RESTNotif | | |
| 5764 | // |<----------------| | |
| 5765 | // | ... | ... | |
| 5766 | // | | | |
| 5767 | // | RESTSubDelReq | | |
| 5768 | // |---------------->| | |
| 5769 | // | | | |
| 5770 | // | | SubDelReq | |
| 5771 | // | |------------->| |
| 5772 | // | | | |
| 5773 | // | | SubDelResp | |
| 5774 | // | |<-------------| |
| 5775 | // | | | |
| 5776 | // | RESTSubDelResp| | |
| 5777 | // |<----------------| | |
| 5778 | // |
| 5779 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5780 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5781 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5782 | |
| 5783 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5784 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5785 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5786 | Counter{cSubReqToE2, 1}, |
| 5787 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5788 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5789 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5790 | Counter{cSubDelReqToE2, 1}, |
| 5791 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5792 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5793 | }) |
| 5794 | |
| 5795 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5796 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5797 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5798 | params.SetSubActionTypes("insert") |
| 5799 | |
| 5800 | // Req |
| 5801 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5802 | |
| 5803 | // Del |
| 5804 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5805 | |
| 5806 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5807 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5808 | |
| 5809 | // Wait that subs is cleaned |
| 5810 | waitSubsCleanup(t, e2SubsId, 10) |
| 5811 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5812 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5813 | } |
| 5814 | |
| 5815 | //----------------------------------------------------------------------------- |
| 5816 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5817 | // |
| 5818 | // stub stub |
| 5819 | // +-------+ +---------+ +---------+ |
| 5820 | // | xapp | | submgr | | e2term | |
| 5821 | // +-------+ +---------+ +---------+ |
| 5822 | // | | | |
| 5823 | // | RESTSubReq | | |
| 5824 | // |------------->| | |
| 5825 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5826 | // | RESTSubResp | | |
| 5827 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5828 | // | | SubReq | |
| 5829 | // | |------------->| |
| 5830 | // | | | |
| 5831 | // | | SubResp | |
| 5832 | // | <----| |
| 5833 | // | | |
| 5834 | // | Submgr restart | |
| 5835 | // | | |
| 5836 | // | | | |
| 5837 | // | | SubDelReq | |
| 5838 | // | |------------->| |
| 5839 | // | | | |
| 5840 | // | | SubDelResp | |
| 5841 | // | |<-------------| |
| 5842 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5843 | // | RESTNotif | | |
| 5844 | // | unsuccess | | |
| 5845 | // |<-------------| | |
| 5846 | // | | | |
| 5847 | // | RESTSubDelReq| | |
| 5848 | // |------------->| | |
| 5849 | // | | | |
| 5850 | // |RESTSubDelResp| | |
| 5851 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5852 | // |
| 5853 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5854 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5855 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5856 | |
| 5857 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5858 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5859 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5860 | Counter{cSubReqToE2, 1}, |
| 5861 | Counter{cSubDelReqFromXapp, 1}, |
| 5862 | Counter{cSubDelReqToE2, 1}, |
| 5863 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5864 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5865 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5866 | }) |
| 5867 | |
| 5868 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5869 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5870 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5871 | |
| 5872 | //Req |
| 5873 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5874 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5875 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5876 | |
| 5877 | e2termConn1.RecvSubsReq(t) |
| 5878 | |
| 5879 | mainCtrl.SetResetTestFlag(t, false) |
| 5880 | |
| 5881 | mainCtrl.SimulateRestart(t) |
| 5882 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5883 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5884 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5885 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5886 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5887 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5888 | //Del |
| 5889 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5890 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5891 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5892 | e2termConn1.TestMsgChanEmpty(t) |
| 5893 | mainCtrl.wait_registry_empty(t, 10) |
| 5894 | |
| 5895 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5896 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5897 | } |
| 5898 | |
| 5899 | //----------------------------------------------------------------------------- |
| 5900 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5901 | // |
| 5902 | // stub stub |
| 5903 | // +-------+ +---------+ +---------+ |
| 5904 | // | xapp | | submgr | | e2term | |
| 5905 | // +-------+ +---------+ +---------+ |
| 5906 | // | | | |
| 5907 | // | RESTSubReq | | |
| 5908 | // |---------------->| | |
| 5909 | // | | | |
| 5910 | // | RESTSubResp | | |
| 5911 | // |<----------------| | |
| 5912 | // | | SubReq | |
| 5913 | // | |------------->| |
| 5914 | // | | | |
| 5915 | // | | SubResp | |
| 5916 | // | |<-------------| |
| 5917 | // | | | |
| 5918 | // | RESTNotif | | |
| 5919 | // |<----------------| | |
| 5920 | // | | | |
| 5921 | // | | |
| 5922 | // | Submgr restart | |
| 5923 | // | | | |
| 5924 | // | RESTSubDelReq | | |
| 5925 | // |---------------->| | |
| 5926 | // | | | |
| 5927 | // | | SubDelReq | |
| 5928 | // | |------------->| |
| 5929 | // | | | |
| 5930 | // | | SubDelResp | |
| 5931 | // | |<-------------| |
| 5932 | // | | | |
| 5933 | // | RESTSubDelResp | | |
| 5934 | // |<----------------| | |
| 5935 | // |
| 5936 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5937 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5938 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5939 | |
| 5940 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5941 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5942 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5943 | Counter{cSubReqToE2, 1}, |
| 5944 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5945 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5946 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5947 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5948 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5949 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5950 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5951 | |
| 5952 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5953 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5954 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5955 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5956 | |
| 5957 | // Check subscription |
| 5958 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5959 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5960 | mainCtrl.SimulateRestart(t) |
| 5961 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5962 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5963 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5964 | // That needs to be completed before successful subscription query is possible |
| 5965 | <-time.After(time.Second * 1) |
| 5966 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5967 | // Check subscription |
| 5968 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5969 | |
| 5970 | // Delete subscription |
| 5971 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5972 | |
| 5973 | //Wait that subs is cleaned |
| 5974 | waitSubsCleanup(t, e2SubsId, 10) |
| 5975 | |
| 5976 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5977 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5978 | } |
| 5979 | |
| 5980 | //----------------------------------------------------------------------------- |
| 5981 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5982 | // |
| 5983 | // stub stub |
| 5984 | // +-------+ +-------+ +---------+ +---------+ |
| 5985 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5986 | // +-------+ +-------+ +---------+ +---------+ |
| 5987 | // | | | | |
| 5988 | // | | RESTSubReq1 | | |
| 5989 | // | |---------------->| | |
| 5990 | // | | | | |
| 5991 | // | | RESTSubResp1 | | |
| 5992 | // | |<----------------| | |
| 5993 | // | | | | |
| 5994 | // | | | SubReq1 | |
| 5995 | // | | |------------->| |
| 5996 | // | | | SubResp1 | |
| 5997 | // | | |<-------------| |
| 5998 | // | | RESTNotif1 | | |
| 5999 | // | |<----------------| | |
| 6000 | // | | | | |
| 6001 | // | RESTSubReq2 | | |
| 6002 | // |------------------------------>| | |
| 6003 | // | | | | |
| 6004 | // | RESTSubResp2 | | |
| 6005 | // |<------------------------------| | |
| 6006 | // | | | | |
| 6007 | // | | RESTNotif2 | | |
| 6008 | // |<------------------------------| | |
| 6009 | // | | | | |
| 6010 | // | | Submgr restart | |
| 6011 | // | | | | |
| 6012 | // | | RESTSubDelReq1 | | |
| 6013 | // | |---------------->| | |
| 6014 | // | | | | |
| 6015 | // | | RESTSubDelResp1 | | |
| 6016 | // | |<----------------| | |
| 6017 | // | | | | |
| 6018 | // | | Submgr restart | |
| 6019 | // | | | | |
| 6020 | // | RESTSubDelReq2 | | |
| 6021 | // |------------------------------>| | |
| 6022 | // | | | | |
| 6023 | // | RESTSubDelResp2 | | |
| 6024 | // |<------------------------------| | |
| 6025 | // | | | | |
| 6026 | // | | | SubDelReq2 | |
| 6027 | // | | |------------->| |
| 6028 | // | | | | |
| 6029 | // | | | SubDelResp2 | |
| 6030 | // | | |<-------------| |
| 6031 | // | | | | |
| 6032 | // |
| 6033 | //----------------------------------------------------------------------------- |
| 6034 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6035 | |
| 6036 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6037 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6038 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6039 | Counter{cSubReqToE2, 1}, |
| 6040 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6041 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6042 | Counter{cMergedSubscriptions, 1}, |
| 6043 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6044 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6045 | Counter{cSubDelReqToE2, 1}, |
| 6046 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6047 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6048 | }) |
| 6049 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6050 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6051 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6052 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6053 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6054 | |
| 6055 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6056 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6057 | params.SetMeid("RAN_NAME_1") |
| 6058 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6059 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6060 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6061 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 6062 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6063 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6064 | |
| 6065 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 6066 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6067 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6068 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 6069 | |
| 6070 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6071 | // That needs to be completed before successful subscription delete is possible |
| 6072 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6073 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6074 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6075 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 6076 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6077 | // 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] | 6078 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6079 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 6080 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 6081 | |
| 6082 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 6083 | // That needs to be completed before successful subscription query is possible |
| 6084 | <-time.After(time.Second * 1) |
| 6085 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6086 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 6087 | |
| 6088 | // Delete subscription 2 |
| 6089 | deleteXapp2Subscription(t, &restSubId2) |
| 6090 | |
| 6091 | //Wait that subs is cleaned |
| 6092 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6093 | |
| 6094 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6095 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6096 | } |
| 6097 | |
| 6098 | //----------------------------------------------------------------------------- |
| 6099 | // TestRESTReportSubReqAndSubDelOk |
| 6100 | // |
| 6101 | // stub stub |
| 6102 | // +-------+ +---------+ +---------+ |
| 6103 | // | xapp | | submgr | | e2term | |
| 6104 | // +-------+ +---------+ +---------+ |
| 6105 | // | | | |
| 6106 | // | RestSubReq | | |
| 6107 | // |---------------->| | |
| 6108 | // | | | |
| 6109 | // | RESTSubResp | | |
| 6110 | // |<----------------| | |
| 6111 | // | | | |
| 6112 | // | | SubReq | |
| 6113 | // | |------------->| |
| 6114 | // | | | |
| 6115 | // | | SubResp | |
| 6116 | // | |<-------------| |
| 6117 | // | RESTNotif | | |
| 6118 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6119 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6120 | // | |------------->| |
| 6121 | // | | | |
| 6122 | // | | SubResp | |
| 6123 | // | |<-------------| |
| 6124 | // | RESTNotif | | |
| 6125 | // |<----------------| | |
| 6126 | // | ... | ... | |
| 6127 | // | | | |
| 6128 | // | | | |
| 6129 | // | RESTSubDelReq | | |
| 6130 | // |---------------->| | |
| 6131 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6132 | // | RESTSubDelResp| | |
| 6133 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6134 | // | | SubDelReq | |
| 6135 | // | |------------->| |
| 6136 | // | | | |
| 6137 | // | | SubDelResp | |
| 6138 | // | |<-------------| |
| 6139 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6140 | // |
| 6141 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 6142 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6143 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6144 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6145 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6146 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6147 | } |
| 6148 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6149 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6150 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6151 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6152 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6153 | Counter{cRestSubReqFromXapp, 1}, |
| 6154 | Counter{cRestSubRespToXapp, 1}, |
| 6155 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6156 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 6157 | Counter{cRestSubNotifToXapp, 1}, |
| 6158 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6159 | Counter{cRestSubDelRespToXapp, 1}, |
| 6160 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6161 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 6162 | }) |
| 6163 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6164 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6165 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6166 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6167 | |
| 6168 | var e2SubsId []uint32 |
| 6169 | for i := 0; i < subReqCount; i++ { |
| 6170 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6171 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6172 | |
| 6173 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6174 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6175 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6176 | e2SubsId = append(e2SubsId, instanceId) |
| 6177 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6178 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 6179 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 6180 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 6181 | |
| 6182 | } |
| 6183 | |
| 6184 | // Del |
| 6185 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6186 | |
| 6187 | for i := 0; i < subReqCount; i++ { |
| 6188 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6189 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6190 | } |
| 6191 | |
| 6192 | // Wait that subs is cleaned |
| 6193 | for i := 0; i < subReqCount; i++ { |
| 6194 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6195 | } |
| 6196 | |
| 6197 | xappConn1.TestMsgChanEmpty(t) |
| 6198 | e2termConn1.TestMsgChanEmpty(t) |
| 6199 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6200 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6201 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6202 | } |
| 6203 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6204 | //----------------------------------------------------------------------------- |
| 6205 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6206 | // |
| 6207 | // stub stub |
| 6208 | // +-------+ +---------+ +---------+ |
| 6209 | // | xapp | | submgr | | e2term | |
| 6210 | // +-------+ +---------+ +---------+ |
| 6211 | // | | | |
| 6212 | // | RestSubReq | | |
| 6213 | // |---------------->| | |
| 6214 | // | | | |
| 6215 | // | RESTSubResp | | |
| 6216 | // |<----------------| | |
| 6217 | // | | | |
| 6218 | // | | SubReq | |
| 6219 | // | |------------->| |
| 6220 | // | | | |
| 6221 | // | | SubResp | |
| 6222 | // | |<-------------| |
| 6223 | // | RESTNotif | | |
| 6224 | // |<----------------| | |
| 6225 | // | | SubReq | |
| 6226 | // | |------------->| |
| 6227 | // | | | |
| 6228 | // | | SubResp | |
| 6229 | // | |<-------------| |
| 6230 | // | RESTNotif | | |
| 6231 | // |<----------------| | |
| 6232 | // | | | |
| 6233 | // | RESTSubDelReq | | |
| 6234 | // |---------------->| | |
| 6235 | // | | | |
| 6236 | // | RESTSubDelResp| | |
| 6237 | // |<----------------| | |
| 6238 | // | | SubDelReq | |
| 6239 | // | |------------->| |
| 6240 | // | | | |
| 6241 | // | | SubDelResp | |
| 6242 | // | |<-------------| |
| 6243 | // | | | |
| 6244 | // | | SubDelReq | |
| 6245 | // | |------------->| |
| 6246 | // | | | |
| 6247 | // | | SubDelResp | |
| 6248 | // | |<-------------| |
| 6249 | // | | | |
| 6250 | // |
| 6251 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6252 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6253 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6254 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6255 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6256 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6257 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6258 | Counter{cSubReqToE2, 2}, |
| 6259 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6260 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6261 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6262 | Counter{cSubDelReqToE2, 2}, |
| 6263 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6264 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6265 | }) |
| 6266 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6267 | const subReqCount int = 2 |
| 6268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6269 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6270 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6271 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6272 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6273 | |
| 6274 | assert.Equal(t, len(e2SubsIds), 2) |
| 6275 | |
| 6276 | // Del |
| 6277 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6278 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6279 | |
| 6280 | xappConn1.TestMsgChanEmpty(t) |
| 6281 | e2termConn1.TestMsgChanEmpty(t) |
| 6282 | mainCtrl.wait_registry_empty(t, 10) |
| 6283 | |
| 6284 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6285 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6286 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6287 | |
| 6288 | //----------------------------------------------------------------------------- |
| 6289 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6290 | // |
| 6291 | // stub stub |
| 6292 | // +-------+ +---------+ +---------+ |
| 6293 | // | xapp | | submgr | | e2term | |
| 6294 | // +-------+ +---------+ +---------+ |
| 6295 | // | | | |
| 6296 | // | RestSubReq | | |
| 6297 | // |---------------->| | |
| 6298 | // | | | |
| 6299 | // | RESTSubResp | | |
| 6300 | // |<----------------| | |
| 6301 | // | | | ------ |
| 6302 | // | | SubReq | |
| 6303 | // | |------------->| |
| 6304 | // | | | E2 subscription x 19 |
| 6305 | // | | SubResp | |
| 6306 | // | |<-------------| |
| 6307 | // | RESTNotif | | |
| 6308 | // |<----------------| | |
| 6309 | // | | | ------ |
| 6310 | // | RESTSubDelReq | | |
| 6311 | // |---------------->| | |
| 6312 | // | | | |
| 6313 | // | RESTSubDelResp| | |
| 6314 | // |<----------------| | |
| 6315 | // | | SubDelReq | ------ |
| 6316 | // | |------------->| |
| 6317 | // | | | E2 subscription delete x 19 |
| 6318 | // | | SubDelResp | |
| 6319 | // | |<-------------| |
| 6320 | // | | | ------ |
| 6321 | // | | | |
| 6322 | // |
| 6323 | //----------------------------------------------------------------------------- |
| 6324 | |
| 6325 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6326 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6327 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6328 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6329 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6330 | Counter{cSubReqToE2, 19}, |
| 6331 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6332 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6333 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6334 | Counter{cSubDelReqToE2, 19}, |
| 6335 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6336 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6337 | }) |
| 6338 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6339 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6340 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6341 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6342 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6343 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6344 | |
| 6345 | assert.Equal(t, len(e2SubsIds), 19) |
| 6346 | |
| 6347 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6348 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6349 | |
| 6350 | xappConn1.TestMsgChanEmpty(t) |
| 6351 | e2termConn1.TestMsgChanEmpty(t) |
| 6352 | mainCtrl.wait_registry_empty(t, 10) |
| 6353 | |
| 6354 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6355 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6356 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6357 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6358 | //----------------------------------------------------------------------------- |
| 6359 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6360 | // |
| 6361 | // stub stub |
| 6362 | // +-------+ +---------+ +---------+ |
| 6363 | // | xapp | | submgr | | e2term | |
| 6364 | // +-------+ +---------+ +---------+ |
| 6365 | // | | | |
| 6366 | // | RestSubReq | | |
| 6367 | // |---------------->| | |
| 6368 | // | | | |
| 6369 | // | RESTSubResp | | |
| 6370 | // |<----------------| | |
| 6371 | // | | | |
| 6372 | // | | SubReq | |
| 6373 | // | |------------->| |
| 6374 | // | | | |
| 6375 | // | | SubResp | |
| 6376 | // | |<-------------| |
| 6377 | // | RESTNotif | | |
| 6378 | // |<----------------| | |
| 6379 | // | | SubReq | |
| 6380 | // | |------------->| |
| 6381 | // | | | |
| 6382 | // | | SubResp | |
| 6383 | // | |<-------------| |
| 6384 | // | RESTNotif | | |
| 6385 | // |<----------------| | |
| 6386 | // | | | |
| 6387 | // | RESTSubDelReq | | |
| 6388 | // |---------------->| | |
| 6389 | // | | | |
| 6390 | // | RESTSubDelResp| | |
| 6391 | // |<----------------| | |
| 6392 | // | | SubDelReq | |
| 6393 | // | |------------->| |
| 6394 | // | | | |
| 6395 | // | | SubDelResp | |
| 6396 | // | |<-------------| |
| 6397 | // | | | |
| 6398 | // | | SubDelReq | |
| 6399 | // | |------------->| |
| 6400 | // | | | |
| 6401 | // | | SubDelResp | |
| 6402 | // | |<-------------| |
| 6403 | // | | | |
| 6404 | // |
| 6405 | //----------------------------------------------------------------------------- |
| 6406 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6407 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6408 | |
| 6409 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6410 | |
| 6411 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6412 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6413 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6414 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6415 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6416 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6417 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6418 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6419 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6420 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6421 | }) |
| 6422 | |
| 6423 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6424 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6425 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6426 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6427 | |
| 6428 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6429 | |
| 6430 | // Del |
| 6431 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6432 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6433 | |
| 6434 | xappConn1.TestMsgChanEmpty(t) |
| 6435 | e2termConn1.TestMsgChanEmpty(t) |
| 6436 | mainCtrl.wait_registry_empty(t, 10) |
| 6437 | |
| 6438 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6439 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6440 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6441 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6442 | //----------------------------------------------------------------------------- |
| 6443 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6444 | // |
| 6445 | // stub stub |
| 6446 | // +-------+ +---------+ +---------+ |
| 6447 | // | xapp | | submgr | | e2term | |
| 6448 | // +-------+ +---------+ +---------+ |
| 6449 | // | | | |
| 6450 | // | RestSubReq | | |
| 6451 | // |---------------->| | |
| 6452 | // | | | |
| 6453 | // | RESTSubResp | | |
| 6454 | // |<----------------| | |
| 6455 | // | | | |
| 6456 | // | | SubReq | |
| 6457 | // | |------------->| |
| 6458 | // | | | |
| 6459 | // | | SubResp | |
| 6460 | // | |<-------------| |
| 6461 | // | RESTNotif | | |
| 6462 | // |<----------------| | |
| 6463 | // | | SubReq | |
| 6464 | // | |------------->| |
| 6465 | // | | | |
| 6466 | // | | SubResp | |
| 6467 | // | |<-------------| |
| 6468 | // | RESTNotif | | |
| 6469 | // |<----------------| | |
| 6470 | // | | | |
| 6471 | // | RESTSubDelReq | | |
| 6472 | // |---------------->| | |
| 6473 | // | | | |
| 6474 | // | RESTSubDelResp| | |
| 6475 | // |<----------------| | |
| 6476 | // | | SubDelReq | |
| 6477 | // | |------------->| |
| 6478 | // | | | |
| 6479 | // | | SubDelResp | |
| 6480 | // | |<-------------| |
| 6481 | // | | | |
| 6482 | // | | SubDelReq | |
| 6483 | // | |------------->| |
| 6484 | // | | | |
| 6485 | // | | SubDelResp | |
| 6486 | // | |<-------------| |
| 6487 | // | | | |
| 6488 | // |
| 6489 | //----------------------------------------------------------------------------- |
| 6490 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6491 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6492 | |
| 6493 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6494 | |
| 6495 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6496 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6497 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6498 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6499 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6500 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6501 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6502 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6503 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6504 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6505 | }) |
| 6506 | |
| 6507 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6508 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6509 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6510 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6511 | |
| 6512 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6513 | |
| 6514 | // Del |
| 6515 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6516 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6517 | |
| 6518 | xappConn1.TestMsgChanEmpty(t) |
| 6519 | e2termConn1.TestMsgChanEmpty(t) |
| 6520 | mainCtrl.wait_registry_empty(t, 10) |
| 6521 | |
| 6522 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6523 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6524 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6525 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6526 | //----------------------------------------------------------------------------- |
| 6527 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6528 | // |
| 6529 | // stub stub |
| 6530 | // +-------+ +---------+ +---------+ |
| 6531 | // | xapp | | submgr | | e2term | |
| 6532 | // +-------+ +---------+ +---------+ |
| 6533 | // | | | |
| 6534 | // | RestSubReq | | |
| 6535 | // |---------------->| | |
| 6536 | // | | | |
| 6537 | // | RESTSubResp | | |
| 6538 | // |<----------------| | |
| 6539 | // | | | ------ |
| 6540 | // | | SubReq | |
| 6541 | // | |------------->| |
| 6542 | // | | | E2 subscription x 19 |
| 6543 | // | | SubResp | |
| 6544 | // | |<-------------| |
| 6545 | // | RESTNotif | | |
| 6546 | // |<----------------| | |
| 6547 | // | | | ------ |
| 6548 | // | RESTSubDelReq | | |
| 6549 | // |---------------->| | |
| 6550 | // | | | |
| 6551 | // | RESTSubDelResp| | |
| 6552 | // |<----------------| | |
| 6553 | // | | SubDelReq | ------ |
| 6554 | // | |------------->| |
| 6555 | // | | | E2 subscription delete x 19 |
| 6556 | // | | SubDelResp | |
| 6557 | // | |<-------------| |
| 6558 | // | | | ------ |
| 6559 | // | | | |
| 6560 | // |
| 6561 | //----------------------------------------------------------------------------- |
| 6562 | |
| 6563 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6564 | |
| 6565 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6566 | |
| 6567 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6568 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6569 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6570 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6571 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6572 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6573 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6574 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6575 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6576 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6577 | }) |
| 6578 | |
| 6579 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6580 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6581 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6582 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6583 | |
| 6584 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6585 | |
| 6586 | // Del |
| 6587 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6588 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6589 | |
| 6590 | xappConn1.TestMsgChanEmpty(t) |
| 6591 | e2termConn1.TestMsgChanEmpty(t) |
| 6592 | mainCtrl.wait_registry_empty(t, 10) |
| 6593 | |
| 6594 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6595 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6596 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6597 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6598 | //----------------------------------------------------------------------------- |
| 6599 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6600 | // |
| 6601 | // stub stub stub |
| 6602 | // +-------+ +-------+ +---------+ +---------+ |
| 6603 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6604 | // +-------+ +-------+ +---------+ +---------+ |
| 6605 | // | | | | |
| 6606 | // | | RESTSubReq1 | | |
| 6607 | // | |------------->| | |
| 6608 | // | | RESTSubResp1 | | |
| 6609 | // | |<-------------| | |
| 6610 | // | | | | |
| 6611 | // | | | SubReq1 | |
| 6612 | // | | |------------->| |
| 6613 | // | | | | |
| 6614 | // | RESTSubReq2 | | |
| 6615 | // |------------------------>| | |
| 6616 | // | RESTSubResp2 | | |
| 6617 | // |<------------------------| | |
| 6618 | // | | | | |
| 6619 | // | | | SubReq2 | |
| 6620 | // | | |------------->| |
| 6621 | // | | | | |
| 6622 | // | | | SubResp1 | |
| 6623 | // | | |<-------------| |
| 6624 | // | | RESTNotif1 | | |
| 6625 | // | |<-------------| | |
| 6626 | // | | | | |
| 6627 | // | | | SubResp2 | |
| 6628 | // | | |<-------------| |
| 6629 | // | RESTNotif2 | | |
| 6630 | // |<------------------------| | |
| 6631 | // | | | | |
| 6632 | // | | [SUBS 1 DELETE] | |
| 6633 | // | | | | |
| 6634 | // | | [SUBS 2 DELETE] | |
| 6635 | // | | | | |
| 6636 | // |
| 6637 | //----------------------------------------------------------------------------- |
| 6638 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6639 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6640 | |
| 6641 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6642 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6643 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6644 | Counter{cSubReqToE2, 2}, |
| 6645 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6646 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6647 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6648 | Counter{cSubDelReqToE2, 2}, |
| 6649 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6650 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6651 | }) |
| 6652 | |
| 6653 | // Req1 |
| 6654 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6655 | |
| 6656 | //Subs Create |
| 6657 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6658 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6659 | |
| 6660 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6661 | |
| 6662 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6663 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6664 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6665 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6666 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6667 | |
| 6668 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6669 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6670 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6671 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6672 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6673 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6674 | |
| 6675 | deleteXapp1Subscription(t, &restSubId1) |
| 6676 | deleteXapp2Subscription(t, &restSubId2) |
| 6677 | |
| 6678 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6679 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6680 | |
| 6681 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6682 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6683 | } |
| 6684 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6685 | //----------------------------------------------------------------------------- |
| 6686 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6687 | // |
| 6688 | // stub stub stub |
| 6689 | // +-------+ +-------+ +---------+ +---------+ |
| 6690 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6691 | // +-------+ +-------+ +---------+ +---------+ |
| 6692 | // | | | | |
| 6693 | // | | RESTSubReq1 | | |
| 6694 | // | |------------->| | |
| 6695 | // | | RESTSubResp1 | | |
| 6696 | // | |<-------------| | |
| 6697 | // | | | | |
| 6698 | // | | | SubReq1 | |
| 6699 | // | | |------------->| |
| 6700 | // | | | | |
| 6701 | // | RESTSubReq2 | | |
| 6702 | // |------------------------>| | |
| 6703 | // | RESTSubResp2 | | |
| 6704 | // |<------------------------| | |
| 6705 | // | | | | |
| 6706 | // | | | SubReq2 | |
| 6707 | // | | |------------->| |
| 6708 | // | | | | |
| 6709 | // | | | SubResp1 | |
| 6710 | // | | |<-------------| |
| 6711 | // | | RESTNotif1 | | |
| 6712 | // | |<-------------| | |
| 6713 | // | | | | |
| 6714 | // | | | SubResp2 | |
| 6715 | // | | |<-------------| |
| 6716 | // | RESTNotif2 | | |
| 6717 | // |<------------------------| | |
| 6718 | // | | | | |
| 6719 | // | | [SUBS 1 DELETE] | |
| 6720 | // | | | | |
| 6721 | // | | [SUBS 2 DELETE] | |
| 6722 | // | | | | |
| 6723 | // |
| 6724 | //----------------------------------------------------------------------------- |
| 6725 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6726 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6727 | |
| 6728 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6729 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6730 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6731 | Counter{cSubReqToE2, 2}, |
| 6732 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6733 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6734 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6735 | Counter{cSubDelReqToE2, 2}, |
| 6736 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6737 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6738 | }) |
| 6739 | |
| 6740 | // Req1 |
| 6741 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6742 | |
| 6743 | //Subs Create |
| 6744 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6745 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6746 | |
| 6747 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6748 | |
| 6749 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6750 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6751 | params.SetMeid("RAN_NAME_1") |
| 6752 | |
| 6753 | actionId := int64(1) |
| 6754 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6755 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6756 | subsequestActionType := "continue" |
| 6757 | timeToWait := "w10ms" |
| 6758 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6759 | |
| 6760 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6761 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6762 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6763 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6764 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6765 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6766 | |
| 6767 | deleteXapp1Subscription(t, &restSubId1) |
| 6768 | deleteXapp2Subscription(t, &restSubId2) |
| 6769 | |
| 6770 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6771 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6772 | |
| 6773 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6774 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6775 | } |
| 6776 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6777 | //----------------------------------------------------------------------------- |
| 6778 | // TestRESTSubReqReportSameActionDiffActionID |
| 6779 | // |
| 6780 | // stub stub stub |
| 6781 | // +-------+ +-------+ +---------+ +---------+ |
| 6782 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6783 | // +-------+ +-------+ +---------+ +---------+ |
| 6784 | // | | | | |
| 6785 | // | | RESTSubReq1 | | |
| 6786 | // | |------------->| | |
| 6787 | // | | RESTSubResp1 | | |
| 6788 | // | |<-------------| | |
| 6789 | // | | | | |
| 6790 | // | | | SubReq1 | |
| 6791 | // | | |------------->| |
| 6792 | // | | | | |
| 6793 | // | RESTSubReq2 | | |
| 6794 | // |------------------------>| | |
| 6795 | // | RESTSubResp2 | | |
| 6796 | // |<------------------------| | |
| 6797 | // | | | | |
| 6798 | // | | | SubReq2 | |
| 6799 | // | | |------------->| |
| 6800 | // | | | | |
| 6801 | // | | | SubResp1 | |
| 6802 | // | | |<-------------| |
| 6803 | // | | RESTNotif1 | | |
| 6804 | // | |<-------------| | |
| 6805 | // | | | | |
| 6806 | // | | | SubResp2 | |
| 6807 | // | | |<-------------| |
| 6808 | // | RESTNotif2 | | |
| 6809 | // |<------------------------| | |
| 6810 | // | | | | |
| 6811 | // | | [SUBS 1 DELETE] | |
| 6812 | // | | | | |
| 6813 | // | | [SUBS 2 DELETE] | |
| 6814 | // | | | | |
| 6815 | // |
| 6816 | //----------------------------------------------------------------------------- |
| 6817 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6818 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6819 | |
| 6820 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6821 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6822 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6823 | Counter{cSubReqToE2, 2}, |
| 6824 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6825 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6826 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6827 | Counter{cSubDelReqToE2, 2}, |
| 6828 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6829 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6830 | }) |
| 6831 | |
| 6832 | // Req1 |
| 6833 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6834 | |
| 6835 | //Subs Create |
| 6836 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6837 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6838 | |
| 6839 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6840 | |
| 6841 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6842 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6843 | params.SetMeid("RAN_NAME_1") |
| 6844 | params.SetSubActionIDs(int64(2)) |
| 6845 | |
| 6846 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6847 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6848 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6849 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6850 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6851 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6852 | |
| 6853 | deleteXapp1Subscription(t, &restSubId1) |
| 6854 | deleteXapp2Subscription(t, &restSubId2) |
| 6855 | |
| 6856 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6857 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6858 | |
| 6859 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6860 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6861 | } |
| 6862 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6863 | //----------------------------------------------------------------------------- |
| 6864 | // TestRESTSubReqDiffActionType |
| 6865 | // |
| 6866 | // stub stub stub |
| 6867 | // +-------+ +-------+ +---------+ +---------+ |
| 6868 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6869 | // +-------+ +-------+ +---------+ +---------+ |
| 6870 | // | | | | |
| 6871 | // | | RESTSubReq1 | | |
| 6872 | // | |------------->| | |
| 6873 | // | | RESTSubResp1 | | |
| 6874 | // | |<-------------| | |
| 6875 | // | | | | |
| 6876 | // | | | SubReq1 | |
| 6877 | // | | |------------->| |
| 6878 | // | | | | |
| 6879 | // | RESTSubReq2 | | |
| 6880 | // |------------------------>| | |
| 6881 | // | RESTSubResp2 | | |
| 6882 | // |<------------------------| | |
| 6883 | // | | | | |
| 6884 | // | | | SubReq2 | |
| 6885 | // | | |------------->| |
| 6886 | // | | | | |
| 6887 | // | | | SubResp1 | |
| 6888 | // | | |<-------------| |
| 6889 | // | | RESTNotif1 | | |
| 6890 | // | |<-------------| | |
| 6891 | // | | | | |
| 6892 | // | | | SubResp2 | |
| 6893 | // | | |<-------------| |
| 6894 | // | RESTNotif2 | | |
| 6895 | // |<------------------------| | |
| 6896 | // | | | | |
| 6897 | // | | [SUBS 1 DELETE] | |
| 6898 | // | | | | |
| 6899 | // | | [SUBS 2 DELETE] | |
| 6900 | // | | | | |
| 6901 | // |
| 6902 | //----------------------------------------------------------------------------- |
| 6903 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6904 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6905 | |
| 6906 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6907 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6908 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6909 | Counter{cSubReqToE2, 2}, |
| 6910 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6911 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6912 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6913 | Counter{cSubDelReqToE2, 2}, |
| 6914 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6915 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6916 | }) |
| 6917 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6918 | const e2Timeout int64 = 2 |
| 6919 | const e2RetryCount int64 = 2 |
| 6920 | const routingNeeded bool = true |
| 6921 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6922 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6923 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6924 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6925 | |
| 6926 | //Subs Create |
| 6927 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6928 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6929 | |
| 6930 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6931 | |
| 6932 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6933 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6934 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6935 | params.SetMeid("RAN_NAME_1") |
| 6936 | |
| 6937 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6938 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6939 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6940 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6941 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6942 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6943 | |
| 6944 | deleteXapp1Subscription(t, &restSubId1) |
| 6945 | deleteXapp2Subscription(t, &restSubId2) |
| 6946 | |
| 6947 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6948 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6949 | |
| 6950 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6951 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6952 | } |
| 6953 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6954 | //----------------------------------------------------------------------------- |
| 6955 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 6956 | // |
| 6957 | // stub stub stub |
| 6958 | // +-------+ +-------+ +---------+ +---------+ |
| 6959 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6960 | // +-------+ +-------+ +---------+ +---------+ |
| 6961 | // | | | | |
| 6962 | // | | RESTSubReq1 | | |
| 6963 | // | |------------->| | |
| 6964 | // | | RESTSubResp1 | | |
| 6965 | // | |<-------------| | |
| 6966 | // | | | | |
| 6967 | // | | | SubReq1 | |
| 6968 | // | | |------------->| |
| 6969 | // | | | | |
| 6970 | // | RESTSubReq2 | | |
| 6971 | // |------------------------>| | |
| 6972 | // | RESTSubResp2 | | |
| 6973 | // |<------------------------| | |
| 6974 | // | | | | |
| 6975 | // | | | SubReq2 | |
| 6976 | // | | |------------->| |
| 6977 | // | | | | |
| 6978 | // | | | SubResp1 | |
| 6979 | // | | |<-------------| |
| 6980 | // | | RESTNotif1 | | |
| 6981 | // | |<-------------| | |
| 6982 | // | | | | |
| 6983 | // | | | SubResp2 | |
| 6984 | // | | |<-------------| |
| 6985 | // | RESTNotif2 | | |
| 6986 | // |<------------------------| | |
| 6987 | // | | | | |
| 6988 | // | | [SUBS 1 DELETE] | |
| 6989 | // | | | | |
| 6990 | // | | [SUBS 2 DELETE] | |
| 6991 | // | | | | |
| 6992 | // |
| 6993 | //----------------------------------------------------------------------------- |
| 6994 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6995 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6996 | |
| 6997 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6998 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6999 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7000 | Counter{cSubReqToE2, 2}, |
| 7001 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7002 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7003 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7004 | Counter{cSubDelReqToE2, 2}, |
| 7005 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7006 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7007 | }) |
| 7008 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7009 | const e2Timeout int64 = 2 |
| 7010 | const e2RetryCount int64 = 2 |
| 7011 | const routingNeeded bool = true |
| 7012 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7013 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7014 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7015 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7016 | |
| 7017 | //Subs Create |
| 7018 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7019 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7020 | |
| 7021 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7022 | |
| 7023 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7024 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7025 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7026 | params.SetMeid("RAN_NAME_1") |
| 7027 | |
| 7028 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7029 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7030 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7031 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7032 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7033 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7034 | |
| 7035 | deleteXapp1Subscription(t, &restSubId1) |
| 7036 | deleteXapp2Subscription(t, &restSubId2) |
| 7037 | |
| 7038 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7039 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7040 | |
| 7041 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7042 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7043 | } |
| 7044 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7045 | //----------------------------------------------------------------------------- |
| 7046 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 7047 | // |
| 7048 | // stub stub stub |
| 7049 | // +-------+ +-------+ +---------+ +---------+ |
| 7050 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7051 | // +-------+ +-------+ +---------+ +---------+ |
| 7052 | // | | | | |
| 7053 | // | | RESTSubReq1 | | |
| 7054 | // | |------------->| | |
| 7055 | // | | RESTSubResp1 | | |
| 7056 | // | |<-------------| | |
| 7057 | // | | | | |
| 7058 | // | | | SubReq1 | |
| 7059 | // | | |------------->| |
| 7060 | // | | | | |
| 7061 | // | RESTSubReq2 | | |
| 7062 | // |------------------------>| | |
| 7063 | // | RESTSubResp2 | | |
| 7064 | // |<------------------------| | |
| 7065 | // | | | | |
| 7066 | // | | | SubReq2 | |
| 7067 | // | | |------------->| |
| 7068 | // | | | | |
| 7069 | // | | | SubResp1 | |
| 7070 | // | | |<-------------| |
| 7071 | // | | RESTNotif1 | | |
| 7072 | // | |<-------------| | |
| 7073 | // | | | | |
| 7074 | // | | | SubResp2 | |
| 7075 | // | | |<-------------| |
| 7076 | // | RESTNotif2 | | |
| 7077 | // |<------------------------| | |
| 7078 | // | | | | |
| 7079 | // | | [SUBS 1 DELETE] | |
| 7080 | // | | | | |
| 7081 | // | | [SUBS 2 DELETE] | |
| 7082 | // | | | | |
| 7083 | // |
| 7084 | //----------------------------------------------------------------------------- |
| 7085 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7086 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7087 | |
| 7088 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7089 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7090 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7091 | Counter{cSubReqToE2, 2}, |
| 7092 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7093 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7094 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7095 | Counter{cSubDelReqToE2, 2}, |
| 7096 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7097 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7098 | }) |
| 7099 | |
| 7100 | // Req1 |
| 7101 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7102 | |
| 7103 | //Subs Create |
| 7104 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7105 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7106 | |
| 7107 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7108 | |
| 7109 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7110 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7111 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7112 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7113 | params.SetSubActionDefinition(actionDefinition) |
| 7114 | |
| 7115 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7116 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7117 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7118 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7119 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7120 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7121 | |
| 7122 | deleteXapp1Subscription(t, &restSubId1) |
| 7123 | deleteXapp2Subscription(t, &restSubId2) |
| 7124 | |
| 7125 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7126 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7127 | |
| 7128 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7129 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7130 | } |
| 7131 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7132 | //----------------------------------------------------------------------------- |
| 7133 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 7134 | // |
| 7135 | // stub stub stub |
| 7136 | // +-------+ +-------+ +---------+ +---------+ |
| 7137 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7138 | // +-------+ +-------+ +---------+ +---------+ |
| 7139 | // | | | | |
| 7140 | // | | RESTSubReq1 | | |
| 7141 | // | |------------->| | |
| 7142 | // | | RESTSubResp1 | | |
| 7143 | // | |<-------------| | |
| 7144 | // | | | | |
| 7145 | // | | | SubReq1 | |
| 7146 | // | | |------------->| |
| 7147 | // | | | | |
| 7148 | // | RESTSubReq2 | | |
| 7149 | // |------------------------>| | |
| 7150 | // | RESTSubResp2 | | |
| 7151 | // |<------------------------| | |
| 7152 | // | | | | |
| 7153 | // | | | SubReq2 | |
| 7154 | // | | |------------->| |
| 7155 | // | | | | |
| 7156 | // | | | SubResp1 | |
| 7157 | // | | |<-------------| |
| 7158 | // | | RESTNotif1 | | |
| 7159 | // | |<-------------| | |
| 7160 | // | | | | |
| 7161 | // | | | SubResp2 | |
| 7162 | // | | |<-------------| |
| 7163 | // | RESTNotif2 | | |
| 7164 | // |<------------------------| | |
| 7165 | // | | | | |
| 7166 | // | | [SUBS 1 DELETE] | |
| 7167 | // | | | | |
| 7168 | // | | [SUBS 2 DELETE] | |
| 7169 | // | | | | |
| 7170 | // |
| 7171 | //----------------------------------------------------------------------------- |
| 7172 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7173 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7174 | |
| 7175 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7176 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7177 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7178 | Counter{cSubReqToE2, 2}, |
| 7179 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7180 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7181 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7182 | Counter{cSubDelReqToE2, 2}, |
| 7183 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7184 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7185 | }) |
| 7186 | |
| 7187 | // Req1 |
| 7188 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7189 | |
| 7190 | //Subs Create |
| 7191 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7192 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7193 | |
| 7194 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7195 | |
| 7196 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7197 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7198 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7199 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7200 | params.SetSubActionDefinition(actionDefinition) |
| 7201 | |
| 7202 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7203 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7204 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7205 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7206 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7207 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7208 | |
| 7209 | deleteXapp1Subscription(t, &restSubId1) |
| 7210 | deleteXapp2Subscription(t, &restSubId2) |
| 7211 | |
| 7212 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7213 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7214 | |
| 7215 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7216 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7217 | } |
| 7218 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7219 | //----------------------------------------------------------------------------- |
| 7220 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7221 | // |
| 7222 | // stub stub stub |
| 7223 | // +-------+ +-------+ +---------+ +---------+ |
| 7224 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7225 | // +-------+ +-------+ +---------+ +---------+ |
| 7226 | // | | | | |
| 7227 | // | | RESTSubReq1 | | |
| 7228 | // | |------------->| | |
| 7229 | // | | RESTSubResp1 | | |
| 7230 | // | |<-------------| | |
| 7231 | // | | | | |
| 7232 | // | | | SubReq1 | |
| 7233 | // | | |------------->| |
| 7234 | // | | | | |
| 7235 | // | RESTSubReq2 | | |
| 7236 | // |------------------------>| | |
| 7237 | // | RESTSubResp2 | | |
| 7238 | // |<------------------------| | |
| 7239 | // | | | | |
| 7240 | // | | | SubReq2 | |
| 7241 | // | | |------------->| |
| 7242 | // | | | | |
| 7243 | // | | | SubResp1 | |
| 7244 | // | | |<-------------| |
| 7245 | // | | RESTNotif1 | | |
| 7246 | // | |<-------------| | |
| 7247 | // | | | | |
| 7248 | // | | | SubResp2 | |
| 7249 | // | | |<-------------| |
| 7250 | // | RESTNotif2 | | |
| 7251 | // |<------------------------| | |
| 7252 | // | | | | |
| 7253 | // | | [SUBS 1 DELETE] | |
| 7254 | // | | | | |
| 7255 | // | | [SUBS 2 DELETE] | |
| 7256 | // | | | | |
| 7257 | // |
| 7258 | //----------------------------------------------------------------------------- |
| 7259 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7260 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7261 | |
| 7262 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7263 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7264 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7265 | Counter{cSubReqToE2, 2}, |
| 7266 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7267 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7268 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7269 | Counter{cSubDelReqToE2, 2}, |
| 7270 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7271 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7272 | }) |
| 7273 | |
| 7274 | // Req1 |
| 7275 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7276 | |
| 7277 | //Subs Create |
| 7278 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7279 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7280 | |
| 7281 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7282 | |
| 7283 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7284 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7285 | params.SetMeid("RAN_NAME_1") |
| 7286 | params.SetTimeToWait("w200ms") |
| 7287 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7288 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7289 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7290 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7291 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7292 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7293 | |
| 7294 | deleteXapp1Subscription(t, &restSubId1) |
| 7295 | deleteXapp2Subscription(t, &restSubId2) |
| 7296 | |
| 7297 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7298 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7299 | |
| 7300 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7301 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7302 | } |
| 7303 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7304 | //----------------------------------------------------------------------------- |
| 7305 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7306 | // |
| 7307 | // stub stub |
| 7308 | // +-------+ +---------+ +---------+ |
| 7309 | // | xapp | | submgr | | e2term | |
| 7310 | // +-------+ +---------+ +---------+ |
| 7311 | // | | | |
| 7312 | // | RestSubReq | | |
| 7313 | // |---------------->| | |
| 7314 | // | | | |
| 7315 | // | RESTSubResp | | |
| 7316 | // |<----------------| | |
| 7317 | // | | | |
| 7318 | // | | SubReq | |
| 7319 | // | |------------->| |
| 7320 | // | | | |
| 7321 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7322 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7323 | // | | | |
| 7324 | // | | SubReq | |
| 7325 | // | |------------->| |
| 7326 | // | | | |
| 7327 | // | | SubFail | Duplicated action |
| 7328 | // | |<-------------| |
| 7329 | // | RESTNotif (fail)| | |
| 7330 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7331 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7332 | // | [SUBS DELETE] | |
| 7333 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7334 | // |
| 7335 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7336 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7337 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7338 | |
| 7339 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7340 | Counter{cRestSubReqFromXapp, 1}, |
| 7341 | Counter{cRestSubRespToXapp, 1}, |
| 7342 | Counter{cSubReqToE2, 1}, |
| 7343 | Counter{cSubReqTimerExpiry, 1}, |
| 7344 | Counter{cSubReReqToE2, 1}, |
| 7345 | Counter{cSubRespFromE2, 1}, |
| 7346 | Counter{cSubFailFromE2, 1}, |
| 7347 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7348 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7349 | Counter{cRestSubDelRespToXapp, 1}, |
| 7350 | }) |
| 7351 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7352 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7353 | |
| 7354 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7355 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7356 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7357 | |
| 7358 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7359 | // Decode of this response fails which will result resending original request |
| 7360 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7361 | |
| 7362 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7363 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7364 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7365 | |
| 7366 | // Subscription already created in E2 Node. |
| 7367 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7368 | fparams.Set(crereq) |
| 7369 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7370 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7371 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7372 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7373 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7374 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7375 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7376 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7377 | // Wait that subs is cleaned |
| 7378 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7379 | |
| 7380 | xappConn1.TestMsgChanEmpty(t) |
| 7381 | e2termConn1.TestMsgChanEmpty(t) |
| 7382 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7383 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7384 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7385 | } |
| 7386 | |
| 7387 | //----------------------------------------------------------------------------- |
| 7388 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7389 | // |
| 7390 | // stub stub |
| 7391 | // +-------+ +---------+ +---------+ |
| 7392 | // | xapp | | submgr | | e2term | |
| 7393 | // +-------+ +---------+ +---------+ |
| 7394 | // | | | |
| 7395 | // | RestSubReq | | |
| 7396 | // |---------------->| | |
| 7397 | // | | | |
| 7398 | // | RESTSubResp | | |
| 7399 | // |<----------------| | |
| 7400 | // | | | |
| 7401 | // | | SubReq | |
| 7402 | // | |------------->| |
| 7403 | // | | | |
| 7404 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7405 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7406 | // | | | |
| 7407 | // | | SubReq | |
| 7408 | // | |------------->| |
| 7409 | // | | | |
| 7410 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7411 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7412 | // | RESTNotif (fail)| | |
| 7413 | // |<----------------| | |
| 7414 | // | | SubDelReq | |
| 7415 | // | |------------->| |
| 7416 | // | | | |
| 7417 | // | | SubDelResp | |
| 7418 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7419 | // | | | |
| 7420 | // | [SUBS DELETE] | |
| 7421 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7422 | // |
| 7423 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7424 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7425 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7426 | |
| 7427 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7428 | Counter{cRestSubReqFromXapp, 1}, |
| 7429 | Counter{cRestSubRespToXapp, 1}, |
| 7430 | Counter{cSubReqToE2, 1}, |
| 7431 | Counter{cSubReqTimerExpiry, 2}, |
| 7432 | Counter{cSubReReqToE2, 1}, |
| 7433 | Counter{cSubRespFromE2, 1}, |
| 7434 | Counter{cSubFailFromE2, 1}, |
| 7435 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7436 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7437 | Counter{cRestSubDelRespToXapp, 1}, |
| 7438 | Counter{cSubDelReqToE2, 1}, |
| 7439 | Counter{cSubDelRespFromE2, 1}, |
| 7440 | }) |
| 7441 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7442 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7443 | |
| 7444 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7445 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7446 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7447 | |
| 7448 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7449 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7450 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7451 | orgInstanceId := crereq.RequestId.InstanceId |
| 7452 | crereq.RequestId.InstanceId = 0 |
| 7453 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7454 | |
| 7455 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7456 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7457 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7458 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7459 | // 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] | 7460 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7461 | fparams.Set(crereq) |
| 7462 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7463 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7464 | |
| 7465 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7466 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7467 | |
| 7468 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7469 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7470 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7471 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7472 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7473 | // Wait that subs is cleaned |
| 7474 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7475 | |
| 7476 | xappConn1.TestMsgChanEmpty(t) |
| 7477 | e2termConn1.TestMsgChanEmpty(t) |
| 7478 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7479 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7480 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7481 | } |
| 7482 | |
| 7483 | //----------------------------------------------------------------------------- |
| 7484 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7485 | // |
| 7486 | // stub stub |
| 7487 | // +-------+ +---------+ +---------+ |
| 7488 | // | xapp | | submgr | | e2term | |
| 7489 | // +-------+ +---------+ +---------+ |
| 7490 | // | | | |
| 7491 | // | RestSubReq | | |
| 7492 | // |---------------->| | |
| 7493 | // | | | |
| 7494 | // | RESTSubResp | | |
| 7495 | // |<----------------| | |
| 7496 | // | | | |
| 7497 | // | | SubReq | |
| 7498 | // | |------------->| |
| 7499 | // | | | |
| 7500 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7501 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7502 | // | | | |
| 7503 | // | | SubReq | |
| 7504 | // | |------------->| |
| 7505 | // | | | |
| 7506 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7507 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7508 | // | RESTNotif (fail)| | |
| 7509 | // |<----------------| | |
| 7510 | // | | SubDelReq | |
| 7511 | // | |------------->| |
| 7512 | // | | | |
| 7513 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7514 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7515 | // | | | |
| 7516 | // | | SubDelReq | |
| 7517 | // | |------------->| |
| 7518 | // | | | |
| 7519 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7520 | // | |<-------------| Ongoing transaction not found. |
| 7521 | // | | | |
| 7522 | // | [SUBS DELETE] | |
| 7523 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7524 | // |
| 7525 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7526 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7527 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7528 | |
| 7529 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7530 | Counter{cRestSubReqFromXapp, 1}, |
| 7531 | Counter{cRestSubRespToXapp, 1}, |
| 7532 | Counter{cSubReqToE2, 1}, |
| 7533 | Counter{cSubReqTimerExpiry, 2}, |
| 7534 | Counter{cSubReReqToE2, 1}, |
| 7535 | Counter{cSubRespFromE2, 1}, |
| 7536 | Counter{cSubFailFromE2, 1}, |
| 7537 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7538 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7539 | Counter{cRestSubDelRespToXapp, 1}, |
| 7540 | Counter{cSubDelReqToE2, 1}, |
| 7541 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7542 | Counter{cSubDelReReqToE2, 1}, |
| 7543 | Counter{cSubDelRespFromE2, 2}, |
| 7544 | }) |
| 7545 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7546 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7547 | |
| 7548 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7549 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7550 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7551 | |
| 7552 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7553 | |
| 7554 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7555 | // No transaction exist for this response which will result resending original request |
| 7556 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7557 | |
| 7558 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7559 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7560 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7561 | |
| 7562 | // Subscription already created in E2 Node. |
| 7563 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7564 | fparams.Set(crereq) |
| 7565 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7566 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7567 | |
| 7568 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7569 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7570 | |
| 7571 | // Resending happens because there no transaction |
| 7572 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7573 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7574 | |
| 7575 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7576 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7577 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7578 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7579 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7580 | // Wait that subs is cleaned |
| 7581 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7582 | |
| 7583 | xappConn1.TestMsgChanEmpty(t) |
| 7584 | e2termConn1.TestMsgChanEmpty(t) |
| 7585 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7586 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7587 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7588 | } |
| 7589 | |
| 7590 | //----------------------------------------------------------------------------- |
| 7591 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7592 | // |
| 7593 | // stub stub |
| 7594 | // +-------+ +---------+ +---------+ |
| 7595 | // | xapp | | submgr | | e2term | |
| 7596 | // +-------+ +---------+ +---------+ |
| 7597 | // | | | |
| 7598 | // | RestSubReq | | |
| 7599 | // |---------------->| | |
| 7600 | // | | | |
| 7601 | // | RESTSubResp | | |
| 7602 | // |<----------------| | |
| 7603 | // | | | |
| 7604 | // | | SubReq | |
| 7605 | // | |------------->| |
| 7606 | // | | | |
| 7607 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7608 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7609 | // | | | |
| 7610 | // | | SubReq | |
| 7611 | // | |------------->| |
| 7612 | // | | | |
| 7613 | // | | SubFail | Duplicated action |
| 7614 | // | |<-------------| |
| 7615 | // | RESTNotif (fail)| | |
| 7616 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7617 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7618 | // | [SUBS DELETE] | |
| 7619 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7620 | // |
| 7621 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7622 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7623 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7624 | |
| 7625 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7626 | Counter{cRestSubReqFromXapp, 1}, |
| 7627 | Counter{cRestSubRespToXapp, 1}, |
| 7628 | Counter{cSubReqToE2, 1}, |
| 7629 | Counter{cSubReqTimerExpiry, 1}, |
| 7630 | Counter{cSubReReqToE2, 1}, |
| 7631 | Counter{cSubFailFromE2, 2}, |
| 7632 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7633 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7634 | Counter{cRestSubDelRespToXapp, 1}, |
| 7635 | }) |
| 7636 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7637 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7638 | |
| 7639 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7640 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7641 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7642 | |
| 7643 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7644 | |
| 7645 | // Decode of this response fails which will result resending original request |
| 7646 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7647 | |
| 7648 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7649 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7650 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7651 | |
| 7652 | // Subscription already created in E2 Node. |
| 7653 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7654 | fparams.Set(crereq) |
| 7655 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7656 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7657 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7658 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7659 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7660 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7661 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7662 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7663 | // Wait that subs is cleaned |
| 7664 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7665 | |
| 7666 | xappConn1.TestMsgChanEmpty(t) |
| 7667 | e2termConn1.TestMsgChanEmpty(t) |
| 7668 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7669 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7670 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7671 | } |
| 7672 | |
| 7673 | //----------------------------------------------------------------------------- |
| 7674 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7675 | // |
| 7676 | // stub stub |
| 7677 | // +-------+ +---------+ +---------+ |
| 7678 | // | xapp | | submgr | | e2term | |
| 7679 | // +-------+ +---------+ +---------+ |
| 7680 | // | | | |
| 7681 | // | RestSubReq | | |
| 7682 | // |---------------->| | |
| 7683 | // | | | |
| 7684 | // | RESTSubResp | | |
| 7685 | // |<----------------| | |
| 7686 | // | | | |
| 7687 | // | | SubReq | |
| 7688 | // | |------------->| |
| 7689 | // | | | |
| 7690 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7691 | // | |<-------------| 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] | 7692 | // | | | |
| 7693 | // | | SubReq | |
| 7694 | // | |------------->| |
| 7695 | // | | | |
| 7696 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7697 | // | |<-------------|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] | 7698 | // | RESTNotif (fail)| | |
| 7699 | // |<----------------| | |
| 7700 | // | | SubDelReq | |
| 7701 | // | |------------->| |
| 7702 | // | | | |
| 7703 | // | | SubDelResp | |
| 7704 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7705 | // | | | |
| 7706 | // | [SUBS DELETE] | |
| 7707 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7708 | // |
| 7709 | //----------------------------------------------------------------------------- |
| 7710 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7711 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7712 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7713 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7714 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7715 | Counter{cRestSubReqFromXapp, 1}, |
| 7716 | Counter{cRestSubRespToXapp, 1}, |
| 7717 | Counter{cSubReqToE2, 1}, |
| 7718 | Counter{cSubReqTimerExpiry, 2}, |
| 7719 | Counter{cSubReReqToE2, 1}, |
| 7720 | Counter{cSubFailFromE2, 2}, |
| 7721 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7722 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7723 | Counter{cRestSubDelRespToXapp, 1}, |
| 7724 | Counter{cSubDelReqToE2, 1}, |
| 7725 | Counter{cSubDelRespFromE2, 1}, |
| 7726 | }) |
| 7727 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7728 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7729 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7730 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7731 | |
| 7732 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7733 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7734 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7735 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7736 | fparams.Set(crereq) |
| 7737 | fparams.Fail.RequestId.InstanceId = 0 |
| 7738 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7739 | |
| 7740 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7741 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7742 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7743 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7744 | // 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] | 7745 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7746 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7747 | |
| 7748 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7749 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7750 | |
| 7751 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7752 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7753 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7754 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7755 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7756 | // Wait that subs is cleaned |
| 7757 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7758 | |
| 7759 | xappConn1.TestMsgChanEmpty(t) |
| 7760 | e2termConn1.TestMsgChanEmpty(t) |
| 7761 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7762 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7763 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7764 | } |
| 7765 | |
| 7766 | //----------------------------------------------------------------------------- |
| 7767 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7768 | // |
| 7769 | // stub stub |
| 7770 | // +-------+ +---------+ +---------+ |
| 7771 | // | xapp | | submgr | | e2term | |
| 7772 | // +-------+ +---------+ +---------+ |
| 7773 | // | | | |
| 7774 | // | RestSubReq | | |
| 7775 | // |---------------->| | |
| 7776 | // | | | |
| 7777 | // | RESTSubResp | | |
| 7778 | // |<----------------| | |
| 7779 | // | | | |
| 7780 | // | | SubReq | |
| 7781 | // | |------------->| |
| 7782 | // | | | |
| 7783 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7784 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7785 | // | | | |
| 7786 | // | | SubReq | |
| 7787 | // | |------------->| |
| 7788 | // | | | |
| 7789 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7790 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7791 | // | RESTNotif (fail)| | |
| 7792 | // |<----------------| | |
| 7793 | // | | SubDelReq | |
| 7794 | // | |------------->| |
| 7795 | // | | | |
| 7796 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7797 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7798 | // | | | |
| 7799 | // | | SubDelReq | |
| 7800 | // | |------------->| |
| 7801 | // | | | |
| 7802 | // | | SubDelResp | |
| 7803 | // | |<-------------| Ongoing transaction not found. |
| 7804 | // | | | |
| 7805 | // | [SUBS DELETE] | |
| 7806 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7807 | // |
| 7808 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7809 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7810 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7811 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7812 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7813 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7814 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7815 | Counter{cRestSubReqFromXapp, 1}, |
| 7816 | Counter{cRestSubRespToXapp, 1}, |
| 7817 | Counter{cSubReqToE2, 1}, |
| 7818 | Counter{cSubReqTimerExpiry, 2}, |
| 7819 | Counter{cSubReReqToE2, 1}, |
| 7820 | Counter{cSubFailFromE2, 2}, |
| 7821 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7822 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7823 | Counter{cRestSubDelRespToXapp, 1}, |
| 7824 | Counter{cSubDelReqToE2, 1}, |
| 7825 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7826 | Counter{cSubDelReReqToE2, 1}, |
| 7827 | Counter{cSubDelRespFromE2, 2}, |
| 7828 | }) |
| 7829 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7830 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7831 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7832 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7833 | |
| 7834 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7835 | |
| 7836 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7837 | |
| 7838 | // No transaction exist for this response which will result resending original request |
| 7839 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7840 | fparams.Set(crereq) |
| 7841 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7842 | |
| 7843 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7844 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7845 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7846 | |
| 7847 | // Subscription already created in E2 Node. |
| 7848 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7849 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7850 | |
| 7851 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7852 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7853 | |
| 7854 | // Resending happens because there no transaction |
| 7855 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7856 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7857 | |
| 7858 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7859 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7860 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7861 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7862 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7863 | // Wait that subs is cleaned |
| 7864 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7865 | |
| 7866 | xappConn1.TestMsgChanEmpty(t) |
| 7867 | e2termConn1.TestMsgChanEmpty(t) |
| 7868 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7869 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7870 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7871 | } |
| 7872 | |
| 7873 | //----------------------------------------------------------------------------- |
| 7874 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7875 | // |
| 7876 | // stub stub |
| 7877 | // +-------+ +---------+ +---------+ |
| 7878 | // | xapp | | submgr | | e2term | |
| 7879 | // +-------+ +---------+ +---------+ |
| 7880 | // | | | |
| 7881 | // | [SUBS CREATE] | |
| 7882 | // | | | |
| 7883 | // | | | |
| 7884 | // | RESTSubDelReq | | |
| 7885 | // |---------------->| | |
| 7886 | // | | | |
| 7887 | // | RESTSubDelResp | | |
| 7888 | // |<----------------| | |
| 7889 | // | | | |
| 7890 | // | | SubDelReq | |
| 7891 | // | |------------->| |
| 7892 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7893 | // | | SubDelResp | ASN.1 decode fails. |
| 7894 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7895 | // | | | |
| 7896 | // | | SubDelReq | |
| 7897 | // | |------------->| |
| 7898 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7899 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7900 | // | |<-------------| |
| 7901 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7902 | // | [SUBS DELETE] | |
| 7903 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7904 | // |
| 7905 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7906 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7907 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7908 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7909 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7910 | Counter{cRestSubReqFromXapp, 1}, |
| 7911 | Counter{cRestSubRespToXapp, 1}, |
| 7912 | Counter{cSubReqToE2, 1}, |
| 7913 | Counter{cSubRespFromE2, 1}, |
| 7914 | Counter{cRestSubNotifToXapp, 1}, |
| 7915 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7916 | Counter{cRestSubDelRespToXapp, 1}, |
| 7917 | Counter{cSubDelReqToE2, 1}, |
| 7918 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7919 | Counter{cSubDelReReqToE2, 1}, |
| 7920 | Counter{cSubDelFailFromE2, 1}, |
| 7921 | Counter{cSubDelRespFromE2, 1}, |
| 7922 | }) |
| 7923 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7924 | // Req |
| 7925 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7926 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7927 | |
| 7928 | // Del |
| 7929 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7930 | |
| 7931 | // E2t: Receive 1st SubsDelReq |
| 7932 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7933 | |
| 7934 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7935 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7936 | |
| 7937 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7938 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7939 | |
| 7940 | // Subscription does not exist in in E2 Node. |
| 7941 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7942 | |
| 7943 | // Wait that subs is cleaned |
| 7944 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7945 | |
| 7946 | xappConn1.TestMsgChanEmpty(t) |
| 7947 | e2termConn1.TestMsgChanEmpty(t) |
| 7948 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7949 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7950 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7951 | } |
| 7952 | |
| 7953 | //----------------------------------------------------------------------------- |
| 7954 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 7955 | // |
| 7956 | // stub stub |
| 7957 | // +-------+ +---------+ +---------+ |
| 7958 | // | xapp | | submgr | | e2term | |
| 7959 | // +-------+ +---------+ +---------+ |
| 7960 | // | | | |
| 7961 | // | [SUBS CREATE] | |
| 7962 | // | | | |
| 7963 | // | | | |
| 7964 | // | RESTSubDelReq | | |
| 7965 | // |---------------->| | |
| 7966 | // | | | |
| 7967 | // | RESTSubDelResp | | |
| 7968 | // |<----------------| | |
| 7969 | // | | | |
| 7970 | // | | SubDelReq | |
| 7971 | // | |------------->| |
| 7972 | // | | | |
| 7973 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7974 | // | |<-------------| 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] | 7975 | // | | | |
| 7976 | // | | SubDelReq | |
| 7977 | // | |------------->| |
| 7978 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7979 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7980 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7981 | // | | | |
| 7982 | // | [SUBS DELETE] | |
| 7983 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7984 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7985 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7986 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7987 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7988 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7989 | Counter{cRestSubReqFromXapp, 1}, |
| 7990 | Counter{cRestSubRespToXapp, 1}, |
| 7991 | Counter{cSubReqToE2, 1}, |
| 7992 | Counter{cSubRespFromE2, 1}, |
| 7993 | Counter{cRestSubNotifToXapp, 1}, |
| 7994 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7995 | Counter{cRestSubDelRespToXapp, 1}, |
| 7996 | Counter{cSubDelReqToE2, 1}, |
| 7997 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7998 | Counter{cSubDelReReqToE2, 1}, |
| 7999 | Counter{cSubDelRespFromE2, 1}, |
| 8000 | Counter{cSubDelFailFromE2, 1}, |
| 8001 | }) |
| 8002 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8003 | // Req |
| 8004 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8005 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8006 | |
| 8007 | // Del |
| 8008 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8009 | |
| 8010 | // E2t: Receive 1st SubsDelReq |
| 8011 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8012 | |
| 8013 | // Unknown instanceId in this response which will result resending original request |
| 8014 | delreq.RequestId.InstanceId = 0 |
| 8015 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8016 | |
| 8017 | // E2t: Receive 2nd SubsDelReq |
| 8018 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8019 | |
| 8020 | // Subscription does not exist in in E2 Node. |
| 8021 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8022 | |
| 8023 | // Wait that subs is cleaned |
| 8024 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8025 | |
| 8026 | xappConn1.TestMsgChanEmpty(t) |
| 8027 | e2termConn1.TestMsgChanEmpty(t) |
| 8028 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8029 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8030 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8031 | } |
| 8032 | |
| 8033 | //----------------------------------------------------------------------------- |
| 8034 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 8035 | // |
| 8036 | // stub stub |
| 8037 | // +-------+ +---------+ +---------+ |
| 8038 | // | xapp | | submgr | | e2term | |
| 8039 | // +-------+ +---------+ +---------+ |
| 8040 | // | | | |
| 8041 | // | [SUBS CREATE] | |
| 8042 | // | | | |
| 8043 | // | | | |
| 8044 | // | RESTSubDelReq | | |
| 8045 | // |---------------->| | |
| 8046 | // | | | |
| 8047 | // | RESTSubDelResp | | |
| 8048 | // |<----------------| | |
| 8049 | // | | | |
| 8050 | // | | SubDelReq | |
| 8051 | // | |------------->| |
| 8052 | // | | | |
| 8053 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8054 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8055 | // | | | |
| 8056 | // | | SubDelReq | |
| 8057 | // | |------------->| |
| 8058 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8059 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8060 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8061 | // | | | |
| 8062 | // | [SUBS DELETE] | |
| 8063 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8064 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8065 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8066 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8067 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8068 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8069 | Counter{cRestSubReqFromXapp, 1}, |
| 8070 | Counter{cRestSubRespToXapp, 1}, |
| 8071 | Counter{cSubReqToE2, 1}, |
| 8072 | Counter{cSubRespFromE2, 1}, |
| 8073 | Counter{cRestSubNotifToXapp, 1}, |
| 8074 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8075 | Counter{cRestSubDelRespToXapp, 1}, |
| 8076 | Counter{cSubDelReqToE2, 1}, |
| 8077 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8078 | Counter{cSubDelReReqToE2, 1}, |
| 8079 | Counter{cSubDelRespFromE2, 1}, |
| 8080 | Counter{cSubDelFailFromE2, 1}, |
| 8081 | }) |
| 8082 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8083 | // Req |
| 8084 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8085 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8086 | |
| 8087 | // Del |
| 8088 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8089 | |
| 8090 | // E2t: Receive 1st SubsDelReq |
| 8091 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8092 | |
| 8093 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8094 | |
| 8095 | // No transaction exist for this response which will result resending original request |
| 8096 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8097 | |
| 8098 | // E2t: Receive 2nd SubsDelReq |
| 8099 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8100 | |
| 8101 | // Subscription does not exist in in E2 Node. |
| 8102 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8103 | |
| 8104 | // Wait that subs is cleaned |
| 8105 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8106 | |
| 8107 | xappConn1.TestMsgChanEmpty(t) |
| 8108 | e2termConn1.TestMsgChanEmpty(t) |
| 8109 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8110 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8111 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8112 | } |
| 8113 | |
| 8114 | //----------------------------------------------------------------------------- |
| 8115 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 8116 | // |
| 8117 | // stub stub |
| 8118 | // +-------+ +---------+ +---------+ |
| 8119 | // | xapp | | submgr | | e2term | |
| 8120 | // +-------+ +---------+ +---------+ |
| 8121 | // | | | |
| 8122 | // | [SUBS CREATE] | |
| 8123 | // | | | |
| 8124 | // | | | |
| 8125 | // | RESTSubDelReq | | |
| 8126 | // |---------------->| | |
| 8127 | // | | | |
| 8128 | // | RESTSubDelResp | | |
| 8129 | // |<----------------| | |
| 8130 | // | | | |
| 8131 | // | | SubDelReq | |
| 8132 | // | |------------->| |
| 8133 | // | | | |
| 8134 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8135 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8136 | // | | | |
| 8137 | // | | SubDelReq | |
| 8138 | // | |------------->| |
| 8139 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8140 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8141 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8142 | // | | | |
| 8143 | // | [SUBS DELETE] | |
| 8144 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8145 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8146 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8147 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8148 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8149 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8150 | Counter{cRestSubReqFromXapp, 1}, |
| 8151 | Counter{cRestSubRespToXapp, 1}, |
| 8152 | Counter{cSubReqToE2, 1}, |
| 8153 | Counter{cSubRespFromE2, 1}, |
| 8154 | Counter{cRestSubNotifToXapp, 1}, |
| 8155 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8156 | Counter{cRestSubDelRespToXapp, 1}, |
| 8157 | Counter{cSubDelReqToE2, 1}, |
| 8158 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8159 | Counter{cSubDelReReqToE2, 1}, |
| 8160 | Counter{cSubDelFailFromE2, 2}, |
| 8161 | }) |
| 8162 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8163 | // Req |
| 8164 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8165 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8166 | |
| 8167 | // Del |
| 8168 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8169 | |
| 8170 | // E2t: Receive 1st SubsDelReq |
| 8171 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8172 | |
| 8173 | // Decode of this response fails which will result resending original request |
| 8174 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 8175 | |
| 8176 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 8177 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8178 | |
| 8179 | // Subscription does not exist in in E2 Node. |
| 8180 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8181 | |
| 8182 | // Wait that subs is cleaned |
| 8183 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8184 | |
| 8185 | xappConn1.TestMsgChanEmpty(t) |
| 8186 | e2termConn1.TestMsgChanEmpty(t) |
| 8187 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8188 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8189 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8190 | } |
| 8191 | |
| 8192 | //----------------------------------------------------------------------------- |
| 8193 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8194 | // |
| 8195 | // stub stub |
| 8196 | // +-------+ +---------+ +---------+ |
| 8197 | // | xapp | | submgr | | e2term | |
| 8198 | // +-------+ +---------+ +---------+ |
| 8199 | // | | | |
| 8200 | // | [SUBS CREATE] | |
| 8201 | // | | | |
| 8202 | // | | | |
| 8203 | // | RESTSubDelReq | | |
| 8204 | // |---------------->| | |
| 8205 | // | | | |
| 8206 | // | RESTSubDelResp | | |
| 8207 | // |<----------------| | |
| 8208 | // | | | |
| 8209 | // | | SubDelReq | |
| 8210 | // | |------------->| |
| 8211 | // | | | |
| 8212 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8213 | // | |<-------------| 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] | 8214 | // | | | |
| 8215 | // | | SubDelReq | |
| 8216 | // | |------------->| |
| 8217 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8218 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8219 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8220 | // | | | |
| 8221 | // | [SUBS DELETE] | |
| 8222 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8223 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8224 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8225 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8226 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8227 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8228 | Counter{cRestSubReqFromXapp, 1}, |
| 8229 | Counter{cRestSubRespToXapp, 1}, |
| 8230 | Counter{cSubReqToE2, 1}, |
| 8231 | Counter{cSubRespFromE2, 1}, |
| 8232 | Counter{cRestSubNotifToXapp, 1}, |
| 8233 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8234 | Counter{cRestSubDelRespToXapp, 1}, |
| 8235 | Counter{cSubDelReqToE2, 1}, |
| 8236 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8237 | Counter{cSubDelReReqToE2, 1}, |
| 8238 | Counter{cSubDelFailFromE2, 2}, |
| 8239 | }) |
| 8240 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8241 | // Req |
| 8242 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8243 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8244 | |
| 8245 | // Del |
| 8246 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8247 | |
| 8248 | // E2t: Receive 1st SubsDelReq |
| 8249 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8250 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8251 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8252 | delreq.RequestId.InstanceId = 0 |
| 8253 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8254 | |
| 8255 | // E2t: Receive 2nd SubsDelReq |
| 8256 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8257 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8258 | // 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] | 8259 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8260 | |
| 8261 | // Wait that subs is cleaned |
| 8262 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8263 | |
| 8264 | xappConn1.TestMsgChanEmpty(t) |
| 8265 | e2termConn1.TestMsgChanEmpty(t) |
| 8266 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8267 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8268 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8269 | } |
| 8270 | |
| 8271 | //----------------------------------------------------------------------------- |
| 8272 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8273 | // |
| 8274 | // stub stub |
| 8275 | // +-------+ +---------+ +---------+ |
| 8276 | // | xapp | | submgr | | e2term | |
| 8277 | // +-------+ +---------+ +---------+ |
| 8278 | // | | | |
| 8279 | // | [SUBS CREATE] | |
| 8280 | // | | | |
| 8281 | // | | | |
| 8282 | // | RESTSubDelReq | | |
| 8283 | // |---------------->| | |
| 8284 | // | | | |
| 8285 | // | RESTSubDelResp | | |
| 8286 | // |<----------------| | |
| 8287 | // | | | |
| 8288 | // | | SubDelReq | |
| 8289 | // | |------------->| |
| 8290 | // | | | |
| 8291 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8292 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8293 | // | | | |
| 8294 | // | | SubDelReq | |
| 8295 | // | |------------->| |
| 8296 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8297 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8298 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8299 | // | | | |
| 8300 | // | [SUBS DELETE] | |
| 8301 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8302 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8303 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8304 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8305 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8306 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8307 | Counter{cRestSubReqFromXapp, 1}, |
| 8308 | Counter{cRestSubRespToXapp, 1}, |
| 8309 | Counter{cSubReqToE2, 1}, |
| 8310 | Counter{cSubRespFromE2, 1}, |
| 8311 | Counter{cRestSubNotifToXapp, 1}, |
| 8312 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8313 | Counter{cRestSubDelRespToXapp, 1}, |
| 8314 | Counter{cSubDelReqToE2, 1}, |
| 8315 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8316 | Counter{cSubDelReReqToE2, 1}, |
| 8317 | Counter{cSubDelFailFromE2, 2}, |
| 8318 | }) |
| 8319 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8320 | // Req |
| 8321 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8322 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8323 | |
| 8324 | // Del |
| 8325 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8326 | |
| 8327 | // E2t: Receive 1st SubsDelReq |
| 8328 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8329 | |
| 8330 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8331 | |
| 8332 | // No transaction exist for this response which will result resending original request |
| 8333 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8334 | |
| 8335 | // E2t: Receive 2nd SubsDelReq |
| 8336 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8337 | |
| 8338 | // Subscription does not exist in in E2 Node. |
| 8339 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8340 | |
| 8341 | // Wait that subs is cleaned |
| 8342 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8343 | |
| 8344 | xappConn1.TestMsgChanEmpty(t) |
| 8345 | e2termConn1.TestMsgChanEmpty(t) |
| 8346 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8347 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8348 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8349 | } |
| 8350 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8351 | //----------------------------------------------------------------------------- |
| 8352 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8353 | // |
| 8354 | // stub stub |
| 8355 | // +-------+ +---------+ +---------+ |
| 8356 | // | xapp | | submgr | | e2term | |
| 8357 | // +-------+ +---------+ +---------+ |
| 8358 | // | | | |
| 8359 | // | RESTSubReq | | |
| 8360 | // |---------------->| | |
| 8361 | // | | | |
| 8362 | // | RESTSubResp | | |
| 8363 | // |<----------------| | |
| 8364 | // | | | |
| 8365 | // | ASN.1 encode fails | |
| 8366 | // | | | |
| 8367 | // | | SubDelReq | |
| 8368 | // | |------------->| |
| 8369 | // | | | |
| 8370 | // | | SubDelFail | |
| 8371 | // | |<-------------| |
| 8372 | // | | | |
| 8373 | // | RESTNotif | | |
| 8374 | // | unsuccess | | |
| 8375 | // |<----------------| | |
| 8376 | // | | | |
| 8377 | // | [SUBS DELETE] | |
| 8378 | // | | | |
| 8379 | // |
| 8380 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8381 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8382 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8383 | |
| 8384 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8385 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8386 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8387 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8388 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8389 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8390 | }) |
| 8391 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8392 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8393 | |
| 8394 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8395 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8396 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8397 | |
| 8398 | // Req |
| 8399 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8400 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8401 | |
| 8402 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8403 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8404 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8405 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8406 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8407 | |
| 8408 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8409 | |
| 8410 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8411 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8412 | // Wait that subs is cleaned |
| 8413 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8414 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8415 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8416 | } |
| 8417 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8418 | //----------------------------------------------------------------------------- |
| 8419 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8420 | // |
| 8421 | // stub stub |
| 8422 | // +-------+ +---------+ +---------+ |
| 8423 | // | xapp | | submgr | | e2term | |
| 8424 | // +-------+ +---------+ +---------+ |
| 8425 | // | | | |
| 8426 | // | RESTSubReq | | |
| 8427 | // |---------------->| | |
| 8428 | // | | | |
| 8429 | // | RESTSubResp | | |
| 8430 | // |<----------------| | |
| 8431 | // | | SubReq | |
| 8432 | // | |------------->| |
| 8433 | // | | | |
| 8434 | // | | SubResp | |
| 8435 | // | |<-------------| |
| 8436 | // | | | |
| 8437 | // | RESTNotif | | |
| 8438 | // |<----------------| | |
| 8439 | // | | | |
| 8440 | // | RESTSubReq | | Policy modification |
| 8441 | // |---------------->| | |
| 8442 | // | | | |
| 8443 | // | RESTSubResp | | |
| 8444 | // |<----------------| | |
| 8445 | // | | SubReq | |
| 8446 | // | |------------->| |
| 8447 | // | | | |
| 8448 | // | | | |
| 8449 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8450 | // |<----------------| | |
| 8451 | // | | | |
| 8452 | // | RESTSubDelReq | | |
| 8453 | // |---------------->| | |
| 8454 | // | | | |
| 8455 | // | | SubDelReq | |
| 8456 | // | |------------->| |
| 8457 | // | | | |
| 8458 | // | | SubDelResp | |
| 8459 | // | |<-------------| |
| 8460 | // | | | |
| 8461 | // | RESTSubDelResp | | |
| 8462 | // |<----------------| | |
| 8463 | // |
| 8464 | //----------------------------------------------------------------------------- |
| 8465 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8466 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8467 | |
| 8468 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8469 | Counter{cRestSubReqFromXapp, 2}, |
| 8470 | Counter{cRestSubRespToXapp, 2}, |
| 8471 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8472 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8473 | Counter{cSubRespFromE2, 1}, |
| 8474 | Counter{cRestSubNotifToXapp, 1}, |
| 8475 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8476 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8477 | Counter{cSubDelReqToE2, 1}, |
| 8478 | Counter{cSubDelRespFromE2, 1}, |
| 8479 | Counter{cRestSubDelRespToXapp, 1}, |
| 8480 | }) |
| 8481 | |
| 8482 | const e2Timeout int64 = 1 |
| 8483 | const e2RetryCount int64 = 0 |
| 8484 | const routingNeeded bool = false |
| 8485 | |
| 8486 | // Req1 |
| 8487 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8488 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8489 | |
| 8490 | // Subs Create |
| 8491 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8492 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8493 | |
| 8494 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8495 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8496 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8497 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8498 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8499 | |
| 8500 | // Policy change |
| 8501 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8502 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8503 | params.SetSubscriptionID(&restSubId) |
| 8504 | params.SetTimeToWait("w200ms") |
| 8505 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8506 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8507 | |
| 8508 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8509 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8510 | // SubsResp is missing, e2SubsId will be 0 |
| 8511 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8512 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8513 | |
| 8514 | // Del |
| 8515 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8516 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8517 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8518 | |
| 8519 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8520 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8521 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8522 | } |
| 8523 | |
| 8524 | //----------------------------------------------------------------------------- |
| 8525 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8526 | // |
| 8527 | // stub stub |
| 8528 | // +-------+ +---------+ +---------+ |
| 8529 | // | xapp | | submgr | | e2term | |
| 8530 | // +-------+ +---------+ +---------+ |
| 8531 | // | | | |
| 8532 | // | RESTSubReq | | |
| 8533 | // |---------------->| | |
| 8534 | // | | | |
| 8535 | // | RESTSubResp | | |
| 8536 | // |<----------------| | |
| 8537 | // | | SubReq | |
| 8538 | // | |------------->| |
| 8539 | // | | | |
| 8540 | // | | SubResp | |
| 8541 | // | |<-------------| |
| 8542 | // | | | |
| 8543 | // | RESTNotif | | |
| 8544 | // |<----------------| | |
| 8545 | // | | | |
| 8546 | // | RESTSubReq | | |
| 8547 | // |---------------->| | |
| 8548 | // | | | |
| 8549 | // | RESTSubResp | | |
| 8550 | // |<----------------| | |
| 8551 | // | | SubReq | |
| 8552 | // | |------------->| |
| 8553 | // | | |
| 8554 | // | Submgr restart | |
| 8555 | // | | | |
| 8556 | // | RESTSubDelReq | | |
| 8557 | // |---------------->| | |
| 8558 | // | | | |
| 8559 | // | | SubDelReq | |
| 8560 | // | |------------->| |
| 8561 | // | | | |
| 8562 | // | | SubDelResp | |
| 8563 | // | |<-------------| |
| 8564 | // | | | |
| 8565 | // | RESTSubDelResp | | |
| 8566 | // |<----------------| | |
| 8567 | // |
| 8568 | //----------------------------------------------------------------------------- |
| 8569 | |
| 8570 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8571 | |
| 8572 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8573 | Counter{cRestSubReqFromXapp, 2}, |
| 8574 | Counter{cRestSubRespToXapp, 2}, |
| 8575 | Counter{cSubReqToE2, 2}, |
| 8576 | Counter{cSubRespFromE2, 1}, |
| 8577 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8578 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8579 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8580 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8581 | Counter{cRestSubDelRespToXapp, 1}, |
| 8582 | }) |
| 8583 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8584 | const e2Timeout int64 = 1 |
| 8585 | const e2RetryCount int64 = 0 |
| 8586 | const routingNeeded bool = false |
| 8587 | |
| 8588 | // Req1 |
| 8589 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8590 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8591 | // Create subscription |
| 8592 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8593 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8594 | |
| 8595 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8596 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8597 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8598 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8599 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8600 | |
| 8601 | // Check subscription |
| 8602 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8603 | |
| 8604 | // Policy change |
| 8605 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8606 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8607 | params.SetSubscriptionID(&restSubId) |
| 8608 | params.SetTimeToWait("w200ms") |
| 8609 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8610 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8611 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8612 | |
| 8613 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8614 | mainCtrl.SetResetTestFlag(t, false) |
| 8615 | |
| 8616 | // SubsResp is missing due to submgr restart |
| 8617 | |
| 8618 | mainCtrl.SimulateRestart(t) |
| 8619 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8620 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8621 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8622 | // That needs to be completed before successful subscription query is possible |
| 8623 | <-time.After(time.Second * 1) |
| 8624 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8625 | // Check subscription |
| 8626 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8627 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8628 | // Delete subscription |
| 8629 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8630 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8631 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8632 | |
| 8633 | //Wait that subs is cleaned |
| 8634 | waitSubsCleanup(t, e2SubsId, 10) |
| 8635 | |
| 8636 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8637 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8638 | } |
| 8639 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8640 | //////////////////////////////////////////////////////////////////////////////////// |
| 8641 | // Services for UT cases |
| 8642 | //////////////////////////////////////////////////////////////////////////////////// |
| 8643 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8644 | const host string = "localhost" |
| 8645 | |
| 8646 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8647 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8648 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8649 | } |
| 8650 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8651 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8652 | |
| 8653 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8654 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8655 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8656 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8657 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8658 | |
| 8659 | return restSubId, e2SubsId |
| 8660 | } |
| 8661 | |
| 8662 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8663 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8664 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8665 | if meid != "" { |
| 8666 | params.SetMeid(meid) |
| 8667 | } |
| 8668 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8669 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8670 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8671 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8672 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8673 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8674 | |
| 8675 | return restSubId, e2SubsId |
| 8676 | } |
| 8677 | |
| 8678 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8679 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8680 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8681 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8682 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8683 | |
| 8684 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8685 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8686 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8687 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8688 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8689 | |
| 8690 | return restSubId, e2SubsId |
| 8691 | } |
| 8692 | |
| 8693 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8694 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8695 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8696 | |
| 8697 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8698 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8699 | fparams1.Set(crereq1) |
| 8700 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8701 | |
| 8702 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8703 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8704 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8705 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8706 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8707 | |
| 8708 | return restSubId, e2SubsId |
| 8709 | } |
| 8710 | |
| 8711 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8712 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8713 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8714 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8715 | } |
| 8716 | |
| 8717 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8718 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8719 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8720 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8721 | } |
| 8722 | |
| 8723 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8724 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8725 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8726 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8727 | } |
| 8728 | |
| 8729 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8730 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8731 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8732 | assert.Equal(t, meid, resp[0].Meid) |
| 8733 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8734 | } |
| 8735 | |
| 8736 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8737 | //Wait that subs is cleaned |
| 8738 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8739 | |
| 8740 | xappConn1.TestMsgChanEmpty(t) |
| 8741 | xappConn2.TestMsgChanEmpty(t) |
| 8742 | e2termConn1.TestMsgChanEmpty(t) |
| 8743 | mainCtrl.wait_registry_empty(t, timeout) |
| 8744 | } |
| 8745 | |
| 8746 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8747 | |
| 8748 | var e2SubsId []uint32 |
| 8749 | |
| 8750 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8751 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8752 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8753 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8754 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8755 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8756 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8757 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8758 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8759 | <-time.After(100 * time.Millisecond) |
| 8760 | } |
| 8761 | return e2SubsId |
| 8762 | } |
| 8763 | |
| 8764 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8765 | |
| 8766 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8767 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8768 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8769 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8770 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8771 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8772 | <-time.After(100 * time.Millisecond) |
| 8773 | } |
| 8774 | |
| 8775 | // Wait that subs is cleaned |
| 8776 | for i := 0; i < len(e2SubsIds); i++ { |
| 8777 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8778 | } |
| 8779 | |
| 8780 | } |