Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 23 | "encoding/json" |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 24 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 25 | "testing" |
| 26 | "time" |
| 27 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 31 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 32 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 33 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 34 | ) |
| 35 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 36 | // In below test cases there is done only one retry for E2 messages |
| 37 | // In Helm chart retry count is currently 2 By default. Retry count |
| 38 | // used in test cases is defined in submgr-config.yaml file. |
| 39 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 40 | func TestSuiteSetup(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 41 | // The effect of this call shall endure though the UT suite! |
| 42 | // If this causes any issues, the previous interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 43 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 44 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 45 | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 46 | mainCtrl.InitAllCounterMap() |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 47 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Anssi Mannila | 3cdd2e0 | 2021-10-14 12:35:41 +0300 | [diff] [blame] | 48 | mainCtrl.c.restDuplicateCtrl.Init() |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 49 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 50 | } |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 51 | func TestRanStatusChangeViaSDLNotification(t *testing.T) { |
| 52 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 53 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 54 | Counter{cE2StateChangedToUp, 3}, |
| 55 | }) |
| 56 | |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 57 | // Current UT test cases use these ran names |
| 58 | xappRnibMock.CreateGnb("RAN_NAME_1", entities.ConnectionStatus_DISCONNECTED) |
| 59 | xappRnibMock.CreateGnb("RAN_NAME_11", entities.ConnectionStatus_DISCONNECTED) |
| 60 | xappRnibMock.CreateGnb("RAN_NAME_2", entities.ConnectionStatus_DISCONNECTED) |
| 61 | |
| 62 | mainCtrl.c.e2IfState.ReadE2ConfigurationFromRnib() |
| 63 | mainCtrl.c.e2IfState.SubscribeChannels() |
| 64 | |
| 65 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 66 | mainCtrl.SetE2State(t, "RAN_NAME_2_CONNECTED") |
| 67 | mainCtrl.SetE2State(t, "RAN_NAME_11_CONNECTED") |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 68 | |
| 69 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | //----------------------------------------------------------------------------- |
| 73 | // TestRESTSubReqAfterE2ConnBreak |
| 74 | // |
| 75 | // stub stub |
| 76 | // +-------+ +---------+ +---------+ |
| 77 | // | xapp | | submgr | | e2term | |
| 78 | // +-------+ +---------+ +---------+ |
| 79 | // | | | |
| 80 | // | [E2 Conn. DOWN] | |
| 81 | // | | | |
| 82 | // | RESTSubReq | | |
| 83 | // |---------------->| | |
| 84 | // | RESTSubFail | | |
| 85 | // |<----------------| | |
| 86 | // | | | |
| 87 | // |
| 88 | //----------------------------------------------------------------------------- |
| 89 | |
| 90 | func TestRESTSubReqAfterE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 91 | |
| 92 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 93 | Counter{cRestSubReqFromXapp, 1}, |
| 94 | Counter{cRestReqRejDueE2Down, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 95 | Counter{cE2StateChangedToDown, 1}, |
| 96 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 97 | }) |
| 98 | |
| 99 | // E2 disconnect after E2term has received response |
| 100 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 101 | // Req |
| 102 | const subReqCount int = 1 |
| 103 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 104 | xappConn1.SendRESTSubsReq(t, params) |
| 105 | |
| 106 | // Restore E2 connection for following test cases |
| 107 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 108 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 109 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 110 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | //----------------------------------------------------------------------------- |
| 114 | // TestRESTSubReqE2ConnBreak |
| 115 | // |
| 116 | // stub stub |
| 117 | // +-------+ +---------+ +---------+ |
| 118 | // | xapp | | submgr | | e2term | |
| 119 | // +-------+ +---------+ +---------+ |
| 120 | // | | | |
| 121 | // | RESTSubReq | | |
| 122 | // |---------------->| | |
| 123 | // | RESTSubResp | | |
| 124 | // |<----------------| | |
| 125 | // | | SubReq | |
| 126 | // | |------------->| |
| 127 | // | | SubResp | |
| 128 | // | |<-------------| |
| 129 | // | | | |
| 130 | // | [E2 Conn. DOWN] | |
| 131 | // | [Int. SUBS DELETE] | |
| 132 | // | | | |
| 133 | // | RESTNotif(unsuccessful) | |
| 134 | // |<----------------| | |
| 135 | // | | | |
| 136 | // | | | |
| 137 | // |
| 138 | //----------------------------------------------------------------------------- |
| 139 | func TestRESTSubReqE2ConnBreak(t *testing.T) { |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 140 | |
| 141 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 142 | Counter{cRestSubReqFromXapp, 1}, |
| 143 | Counter{cRestSubRespToXapp, 1}, |
| 144 | Counter{cSubReqToE2, 1}, |
| 145 | Counter{cSubRespFromE2, 1}, |
| 146 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 147 | Counter{cE2StateChangedToDown, 1}, |
| 148 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 149 | }) |
| 150 | |
| 151 | // Req |
| 152 | const subReqCount int = 1 |
| 153 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 154 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 155 | |
| 156 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 157 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 158 | |
| 159 | // E2 disconnect after E2term has received response |
| 160 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 161 | |
| 162 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 163 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 164 | |
| 165 | <-time.After(time.Second * 1) |
| 166 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 167 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 168 | |
| 169 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 170 | if err != nil { |
| 171 | xapp.Logger.Error("%v", err) |
| 172 | } else { |
| 173 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 174 | assert.Equal(t, 0, len(register)) |
| 175 | } |
| 176 | |
| 177 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 178 | if err != nil { |
| 179 | xapp.Logger.Error("%v", err) |
| 180 | } else { |
| 181 | assert.Equal(t, 0, len(restSubscriptions)) |
| 182 | } |
| 183 | |
| 184 | // Restore E2 connection for following test cases |
| 185 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 186 | |
| 187 | // Wait that subs is cleaned |
| 188 | waitSubsCleanup(t, e2SubsId, 10) |
| 189 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 190 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | //----------------------------------------------------------------------------- |
| 194 | // TestRESTSubscriptionDeleteAfterE2ConnectionBreak |
| 195 | // |
| 196 | // stub stub |
| 197 | // +-------+ +---------+ +---------+ |
| 198 | // | xapp | | submgr | | e2term | |
| 199 | // +-------+ +---------+ +---------+ |
| 200 | // | | | |
| 201 | // | [SUBS CREATE] | |
| 202 | // | | | |
| 203 | // | [E2 Conn. DOWN] | |
| 204 | // | | | |
| 205 | // | RESTSubDelReq | | |
| 206 | // |---------------->| | |
| 207 | // | | | |
| 208 | // | RESTSubDelResp | | |
| 209 | // |<----------------| | |
| 210 | // | | | |
| 211 | // | [No valid subscription found] | |
| 212 | // | | | |
| 213 | // |
| 214 | //----------------------------------------------------------------------------- |
| 215 | func TestRESTSubscriptionDeleteAfterE2ConnectionBreak(t *testing.T) { |
| 216 | xapp.Logger.Debug("TEST: TestRESTSubscriptionDeleteAfterE2ConnectionBreak") |
| 217 | |
| 218 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 219 | Counter{cRestSubReqFromXapp, 1}, |
| 220 | Counter{cRestSubRespToXapp, 1}, |
| 221 | Counter{cSubReqToE2, 1}, |
| 222 | Counter{cSubRespFromE2, 1}, |
| 223 | Counter{cRestSubNotifToXapp, 1}, |
| 224 | Counter{cRestSubDelReqFromXapp, 1}, |
| 225 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 226 | Counter{cE2StateChangedToDown, 1}, |
| 227 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 228 | }) |
| 229 | |
| 230 | // Req |
| 231 | var params *teststube2ap.RESTSubsReqParams = nil |
| 232 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 233 | |
| 234 | // E2 disconnect after E2term has received response |
| 235 | mainCtrl.SetE2State(t, "RAN_NAME_1_DISCONNECTED") |
| 236 | |
| 237 | // Del |
| 238 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 239 | |
| 240 | <-time.After(time.Second * 1) |
| 241 | assert.Equal(t, 0, len(mainCtrl.c.registry.register)) |
| 242 | assert.Equal(t, 0, len(mainCtrl.c.registry.restSubscriptions)) |
| 243 | |
| 244 | subIds, register, err := mainCtrl.c.ReadAllSubscriptionsFromSdl() |
| 245 | if err != nil { |
| 246 | xapp.Logger.Error("%v", err) |
| 247 | } else { |
| 248 | assert.Equal(t, 65534, len(subIds)) // range 1-65535 , FFFF = 65535 |
| 249 | assert.Equal(t, 0, len(register)) |
| 250 | } |
| 251 | |
| 252 | restSubscriptions, err := mainCtrl.c.ReadAllRESTSubscriptionsFromSdl() |
| 253 | if err != nil { |
| 254 | xapp.Logger.Error("%v", err) |
| 255 | } else { |
| 256 | assert.Equal(t, 0, len(restSubscriptions)) |
| 257 | } |
| 258 | |
| 259 | // Restore E2 connection for following test cases |
| 260 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 261 | |
| 262 | // Wait that subs is cleaned |
| 263 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 264 | |
| 265 | xappConn1.TestMsgChanEmpty(t) |
| 266 | e2termConn1.TestMsgChanEmpty(t) |
| 267 | mainCtrl.wait_registry_empty(t, 10) |
| 268 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 269 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | //----------------------------------------------------------------------------- |
| 273 | // TestRESTOtherE2ConnectionChanges |
| 274 | // |
| 275 | |
| 276 | // stub stub |
| 277 | // +-------+ +---------+ +---------+ |
| 278 | // | xapp | | submgr | | e2term | |
| 279 | // +-------+ +---------+ +---------+ |
| 280 | // | | | |
| 281 | // | [SUBS CREATE] | |
| 282 | // | | | |
| 283 | // | [E2 CONNECTED_SETUP_FAILED] | |
| 284 | // | [E2 CONNECTING] | |
| 285 | // | [E2 SHUTTING_DOWN] | |
| 286 | // | [E2 SHUT_DOWN] | |
| 287 | // | | | |
| 288 | // | [SUBS DELETE] | |
| 289 | // | | | |
| 290 | // |
| 291 | //----------------------------------------------------------------------------- |
| 292 | func TestRESTOtherE2ConnectionChanges(t *testing.T) { |
| 293 | xapp.Logger.Debug("TEST: TestRESTOtherE2ConnectionChanges") |
| 294 | |
| 295 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 296 | Counter{cRestSubReqFromXapp, 1}, |
| 297 | Counter{cRestSubRespToXapp, 1}, |
| 298 | Counter{cSubReqToE2, 1}, |
| 299 | Counter{cSubRespFromE2, 1}, |
| 300 | Counter{cRestSubNotifToXapp, 1}, |
| 301 | Counter{cRestSubDelReqFromXapp, 1}, |
| 302 | Counter{cSubDelReqToE2, 1}, |
| 303 | Counter{cSubDelRespFromE2, 1}, |
| 304 | Counter{cRestSubDelRespToXapp, 1}, |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 305 | Counter{cE2StateChangedToUp, 1}, |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 306 | }) |
| 307 | |
| 308 | // Req |
| 309 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 310 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 311 | |
| 312 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 313 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 314 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 315 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 316 | |
Anssi Mannila | 4b1ff2c | 2021-12-17 12:45:25 +0200 | [diff] [blame] | 317 | // Submgr should not react to any other connection state changes than CONNECTED and DISCONNECTED |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 318 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED_SETUP_FAILED") |
| 319 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTING") |
| 320 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUTTING_DOWN") |
| 321 | mainCtrl.SetE2State(t, "RAN_NAME_1_SHUT_DOWN") |
| 322 | |
| 323 | // Del |
| 324 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 325 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 326 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 327 | |
| 328 | // Restore E2 connection for following test cases |
| 329 | mainCtrl.SetE2State(t, "RAN_NAME_1_CONNECTED") |
| 330 | |
| 331 | // Wait that subs is cleaned |
| 332 | waitSubsCleanup(t, e2SubsId, 10) |
| 333 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 334 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | c7da4ee | 2021-10-22 09:52:02 +0300 | [diff] [blame] | 335 | } |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 336 | |
| 337 | //----------------------------------------------------------------------------- |
| 338 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 339 | // |
| 340 | // stub stub stub |
| 341 | // +-------+ +---------+ +---------+ +---------+ |
| 342 | // | xapp | | submgr | | e2term | | rtmgr | |
| 343 | // +-------+ +---------+ +---------+ +---------+ |
| 344 | // | | | | |
| 345 | // | RESTSubReq | | | |
| 346 | // |---------------->| | | |
| 347 | // | | RouteCreate | | |
| 348 | // | |--------------------------->| // The order of these events may vary |
| 349 | // | | | | |
| 350 | // | RESTSubResp | | | // The order of these events may vary |
| 351 | // |<----------------| | | |
| 352 | // | | RouteResponse| | |
| 353 | // | |<---------------------------| // The order of these events may vary |
| 354 | // | | | | |
| 355 | // | | SubReq | | |
| 356 | // | |------------->| | // The order of these events may vary |
| 357 | // | | | | |
| 358 | // | | SubResp | | |
| 359 | // | |<-------------| | |
| 360 | // | RESTNotif1 | | | |
| 361 | // |<----------------| | | |
| 362 | // | | | | |
| 363 | // | RESTSubDelReq | | | |
| 364 | // |---------------->| | | |
| 365 | // | | SubDelReq | | |
| 366 | // | |------------->| | |
| 367 | // | | | | |
| 368 | // | RESTSubDelResp| | | |
| 369 | // |<----------------| | | |
| 370 | // | | | | |
| 371 | // | | SubDelResp | | |
| 372 | // | |<-------------| | |
| 373 | // | | | | |
| 374 | // | | | | |
| 375 | // |
| 376 | //----------------------------------------------------------------------------- |
| 377 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 378 | |
| 379 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 380 | |
| 381 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 382 | |
| 383 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 384 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 385 | } |
| 386 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 387 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 388 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 389 | // |
| 390 | // stub stub stub |
| 391 | // +-------+ +---------+ +---------+ +---------+ |
| 392 | // | xapp | | submgr | | e2term | | rtmgr | |
| 393 | // +-------+ +---------+ +---------+ +---------+ |
| 394 | // | | | | |
| 395 | // | RESTSubReq | | | |
| 396 | // |---------------->| | | |
| 397 | // | | RouteCreate | | |
| 398 | // | |--------------------------->| // The order of these events may vary |
| 399 | // | | | | |
| 400 | // | RESTSubResp | | | // The order of these events may vary |
| 401 | // |<----------------| | | |
| 402 | // | | RouteResponse| | |
| 403 | // | |<---------------------------| // The order of these events may vary |
| 404 | // | | | | |
| 405 | // | | SubReq | | |
| 406 | // | |------------->| | // The order of these events may vary |
| 407 | // | | | | |
| 408 | // | | SubResp | | |
| 409 | // | |<-------------| | |
| 410 | // | RESTNotif1 | | | |
| 411 | // |<----------------| | | |
| 412 | // | | | | |
| 413 | // | RESTSubDelReq | | | |
| 414 | // |---------------->| | | |
| 415 | // | | | | |
| 416 | // | RESTSubDelResp| | | |
| 417 | // |<----------------| | | |
| 418 | // | | | | |
| 419 | // | | | | |
| 420 | // |
| 421 | //----------------------------------------------------------------------------- |
| 422 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 423 | |
| 424 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 425 | |
| 426 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 427 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 428 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 429 | |
| 430 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 431 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | //----------------------------------------------------------------------------- |
| 435 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 436 | // |
| 437 | // stub stub stub |
| 438 | // +-------+ +---------+ +---------+ +---------+ |
| 439 | // | xapp | | submgr | | e2term | | rtmgr | |
| 440 | // +-------+ +---------+ +---------+ +---------+ |
| 441 | // | | | | |
| 442 | // | RESTSubReq | | | |
| 443 | // |---------------->| | | |
| 444 | // | | RouteCreate | | |
| 445 | // | |--------------------------->| // The order of these events may vary |
| 446 | // | | | | |
| 447 | // | RESTSubResp | | | // The order of these events may vary |
| 448 | // |<----------------| | | |
| 449 | // | | RouteResponse| | |
| 450 | // | |<---------------------------| // The order of these events may vary |
| 451 | // | | | | |
| 452 | // | | SubReq | | |
| 453 | // | |------------->| | // The order of these events may vary |
| 454 | // | | | | |
| 455 | // | | SubResp | | |
| 456 | // | |<-------------| | |
| 457 | // | RESTNotif1 | | | |
| 458 | // |<----------------| | | |
| 459 | // | | | | |
| 460 | // | RESTSubDelReq | | | |
| 461 | // |---------------->| | | |
| 462 | // | | SubDelReq | | |
| 463 | // | |------------->| | |
| 464 | // | | | | |
| 465 | // | RESTSubDelResp| | | |
| 466 | // |<----------------| | | // The order of these events may vary |
| 467 | // | | | | |
| 468 | // | | SubDelResp | | |
| 469 | // | |<-------------| | // 1.st NOK |
| 470 | // | | | | |
| 471 | // | | SubDelReq | | |
| 472 | // | |------------->| | |
| 473 | // | | | | |
| 474 | // | | SubDelResp | | |
| 475 | // | |<-------------| | // 2.nd NOK |
| 476 | // |
| 477 | //----------------------------------------------------------------------------- |
| 478 | |
| 479 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 480 | |
| 481 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 482 | |
| 483 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 484 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 485 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 486 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 487 | |
| 488 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 489 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 490 | |
| 491 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 492 | |
| 493 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 494 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 495 | } |
| 496 | |
| 497 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 498 | // TestSubReqAndRouteNok |
| 499 | // |
| 500 | // stub stub |
| 501 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 502 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 503 | // +-------+ +---------+ +---------+ |
| 504 | // | | | |
| 505 | // | SubReq | | |
| 506 | // |------------->| | |
| 507 | // | | | |
| 508 | // | | RouteCreate | |
| 509 | // | |------------->| |
| 510 | // | | | |
| 511 | // | | RouteCreate | |
| 512 | // | | status:400 | |
| 513 | // | |<-------------| |
| 514 | // | | | |
| 515 | // | [SUBS INT DELETE] | |
| 516 | // | | | |
| 517 | // |
| 518 | //----------------------------------------------------------------------------- |
| 519 | |
| 520 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 521 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 522 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 523 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 524 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 525 | Counter{cSubReqFromXapp, 1}, |
| 526 | Counter{cRouteCreateFail, 1}, |
| 527 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 528 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 529 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 530 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 531 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 532 | waiter.WaitResult(t) |
| 533 | |
| 534 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 535 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 536 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 537 | xappConn1.TestMsgChanEmpty(t) |
| 538 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 539 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 540 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 541 | |
| 542 | <-time.After(1 * time.Second) |
| 543 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 547 | // TestSubReqAndRouteUpdateNok |
| 548 | |
| 549 | // stub stub |
| 550 | // +-------+ +-------+ +---------+ +---------+ |
| 551 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 552 | // +-------+ +-------+ +---------+ +---------+ |
| 553 | // | | | | |
| 554 | // | [SUBS CREATE] | | |
| 555 | // | | | | |
| 556 | // | | | | |
| 557 | // | | | | |
| 558 | // | SubReq (mergeable) | | |
| 559 | // |--------------------------->| | | |
| 560 | // | | | | |
| 561 | // | | | RouteUpdate | |
| 562 | // | | |------------->| |
| 563 | // | | | | |
| 564 | // | | | RouteUpdate | |
| 565 | // | | | status:400 | |
| 566 | // | | |<-------------| |
| 567 | // | | | | |
| 568 | // | [SUBS INT DELETE] | | |
| 569 | // | | | | |
| 570 | // | | | | |
| 571 | // | [SUBS DELETE] | | |
| 572 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 573 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 574 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 575 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 576 | |
| 577 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 578 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 579 | Counter{cSubReqFromXapp, 2}, |
| 580 | Counter{cSubReqToE2, 1}, |
| 581 | Counter{cSubRespFromE2, 1}, |
| 582 | Counter{cSubRespToXapp, 1}, |
| 583 | Counter{cRouteCreateUpdateFail, 1}, |
| 584 | Counter{cSubDelReqFromXapp, 1}, |
| 585 | Counter{cSubDelReqToE2, 1}, |
| 586 | Counter{cSubDelRespFromE2, 1}, |
| 587 | Counter{cSubDelRespToXapp, 1}, |
| 588 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 589 | |
| 590 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 591 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 592 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 593 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 594 | |
| 595 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 596 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 597 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 598 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 599 | |
| 600 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 601 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 602 | xappConn2.SendSubsReq(t, nil, nil) |
| 603 | waiter.WaitResult(t) |
| 604 | |
| 605 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 606 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 607 | |
| 608 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 609 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 610 | |
| 611 | //Wait that subs is cleaned |
| 612 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 613 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 614 | |
| 615 | xappConn1.TestMsgChanEmpty(t) |
| 616 | xappConn2.TestMsgChanEmpty(t) |
| 617 | e2termConn1.TestMsgChanEmpty(t) |
| 618 | mainCtrl.wait_registry_empty(t, 10) |
| 619 | |
| 620 | mainCtrl.VerifyCounterValues(t) |
| 621 | } |
| 622 | |
| 623 | //----------------------------------------------------------------------------- |
| 624 | // TestSubDelReqAndRouteDeleteNok |
| 625 | // |
| 626 | // stub stub |
| 627 | // +-------+ +---------+ +---------+ +---------+ |
| 628 | // | xapp | | submgr | | e2term | | rtmgr | |
| 629 | // +-------+ +---------+ +---------+ +---------+ |
| 630 | // | | | | |
| 631 | // | [SUBS CREATE] | | |
| 632 | // | | | | |
| 633 | // | | | | |
| 634 | // | | | | |
| 635 | // | SubDelReq | | | |
| 636 | // |------------->| | | |
| 637 | // | | SubDelReq | | |
| 638 | // | |------------->| | |
| 639 | // | | SubDelRsp | | |
| 640 | // | |<-------------| | |
| 641 | // | SubDelRsp | | | |
| 642 | // |<-------------| | | |
| 643 | // | | RouteDelete | | |
| 644 | // | |---------------------------->| |
| 645 | // | | | | |
| 646 | // | | RouteDelete | | |
| 647 | // | | status:400 | | |
| 648 | // | |<----------------------------| |
| 649 | // | | | | |
| 650 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 651 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 652 | |
| 653 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 654 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 655 | Counter{cSubReqFromXapp, 1}, |
| 656 | Counter{cSubReqToE2, 1}, |
| 657 | Counter{cSubRespFromE2, 1}, |
| 658 | Counter{cSubRespToXapp, 1}, |
| 659 | Counter{cSubDelReqFromXapp, 1}, |
| 660 | Counter{cRouteDeleteFail, 1}, |
| 661 | Counter{cSubDelReqToE2, 1}, |
| 662 | Counter{cSubDelRespFromE2, 1}, |
| 663 | Counter{cSubDelRespToXapp, 1}, |
| 664 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 665 | |
| 666 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 667 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 668 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 669 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 670 | |
| 671 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 672 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 673 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 674 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 675 | |
| 676 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 677 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 678 | |
| 679 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 680 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 681 | waiter.WaitResult(t) |
| 682 | |
| 683 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 684 | |
| 685 | //Wait that subs is cleaned |
| 686 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 687 | |
| 688 | xappConn1.TestMsgChanEmpty(t) |
| 689 | xappConn2.TestMsgChanEmpty(t) |
| 690 | e2termConn1.TestMsgChanEmpty(t) |
| 691 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 692 | mainCtrl.VerifyCounterValues(t) |
| 693 | } |
| 694 | |
| 695 | //----------------------------------------------------------------------------- |
| 696 | // TestSubMergeDelAndRouteUpdateNok |
| 697 | // stub stub |
| 698 | // +-------+ +-------+ +---------+ +---------+ |
| 699 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 700 | // +-------+ +-------+ +---------+ +---------+ |
| 701 | // | | | | |
| 702 | // | | | | |
| 703 | // | | | | |
| 704 | // | | SubReq1 | | |
| 705 | // | |------------->| | |
| 706 | // | | | | |
| 707 | // | | | SubReq1 | |
| 708 | // | | |------------->| |
| 709 | // | | | SubResp1 | |
| 710 | // | | |<-------------| |
| 711 | // | | SubResp1 | | |
| 712 | // | |<-------------| | |
| 713 | // | | | | |
| 714 | // | SubReq2 | | |
| 715 | // |--------------------------->| | |
| 716 | // | | | | |
| 717 | // | SubResp2 | | |
| 718 | // |<---------------------------| | |
| 719 | // | | | | |
| 720 | // | | SubDelReq 1 | | |
| 721 | // | |------------->| | |
| 722 | // | | | RouteUpdate | |
| 723 | // | | |-----> rtmgr | |
| 724 | // | | | | |
| 725 | // | | | RouteUpdate | |
| 726 | // | | | status:400 | |
| 727 | // | | |<----- rtmgr | |
| 728 | // | | | | |
| 729 | // | | SubDelResp 1 | | |
| 730 | // | |<-------------| | |
| 731 | // | | | | |
| 732 | // | SubDelReq 2 | | |
| 733 | // |--------------------------->| | |
| 734 | // | | | | |
| 735 | // | | | SubDelReq 2 | |
| 736 | // | | |------------->| |
| 737 | // | | | | |
| 738 | // | | | SubDelReq 2 | |
| 739 | // | | |------------->| |
| 740 | // | | | | |
| 741 | // | SubDelResp 2 | | |
| 742 | // |<---------------------------| | |
| 743 | // |
| 744 | //----------------------------------------------------------------------------- |
| 745 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 746 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 747 | |
| 748 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 749 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 750 | Counter{cSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 751 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 752 | Counter{cSubReqToE2, 1}, |
| 753 | Counter{cSubRespFromE2, 1}, |
| 754 | Counter{cSubRespToXapp, 2}, |
| 755 | Counter{cSubDelReqFromXapp, 2}, |
| 756 | Counter{cRouteDeleteUpdateFail, 1}, |
| 757 | Counter{cSubDelReqToE2, 1}, |
| 758 | Counter{cSubDelRespFromE2, 1}, |
| 759 | Counter{cSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 760 | Counter{cUnmergedSubscriptions, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 761 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 762 | |
| 763 | //Req1 |
| 764 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 765 | rparams1.Init() |
| 766 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 767 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 768 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 769 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 770 | |
| 771 | //Req2 |
| 772 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 773 | rparams2.Init() |
| 774 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 775 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 776 | |
| 777 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 778 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 779 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 780 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 781 | |
| 782 | //Del1 |
| 783 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 784 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 785 | waiter.WaitResult(t) |
| 786 | |
| 787 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 788 | |
| 789 | //Del2 |
| 790 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 791 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 792 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 793 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 794 | //Wait that subs is cleaned |
| 795 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 796 | |
| 797 | xappConn1.TestMsgChanEmpty(t) |
| 798 | xappConn2.TestMsgChanEmpty(t) |
| 799 | e2termConn1.TestMsgChanEmpty(t) |
| 800 | mainCtrl.wait_registry_empty(t, 10) |
| 801 | |
| 802 | mainCtrl.VerifyCounterValues(t) |
| 803 | } |
| 804 | |
| 805 | //----------------------------------------------------------------------------- |
| 806 | |
| 807 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 808 | // TestSubReqAndSubDelOk |
| 809 | // |
| 810 | // stub stub |
| 811 | // +-------+ +---------+ +---------+ |
| 812 | // | xapp | | submgr | | e2term | |
| 813 | // +-------+ +---------+ +---------+ |
| 814 | // | | | |
| 815 | // | SubReq | | |
| 816 | // |------------->| | |
| 817 | // | | | |
| 818 | // | | SubReq | |
| 819 | // | |------------->| |
| 820 | // | | | |
| 821 | // | | SubResp | |
| 822 | // | |<-------------| |
| 823 | // | | | |
| 824 | // | SubResp | | |
| 825 | // |<-------------| | |
| 826 | // | | | |
| 827 | // | | | |
| 828 | // | SubDelReq | | |
| 829 | // |------------->| | |
| 830 | // | | | |
| 831 | // | | SubDelReq | |
| 832 | // | |------------->| |
| 833 | // | | | |
| 834 | // | | SubDelResp | |
| 835 | // | |<-------------| |
| 836 | // | | | |
| 837 | // | SubDelResp | | |
| 838 | // |<-------------| | |
| 839 | // |
| 840 | //----------------------------------------------------------------------------- |
| 841 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 842 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 843 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 844 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 845 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 846 | Counter{cSubReqFromXapp, 1}, |
| 847 | Counter{cSubReqToE2, 1}, |
| 848 | Counter{cSubRespFromE2, 1}, |
| 849 | Counter{cSubRespToXapp, 1}, |
| 850 | Counter{cSubDelReqFromXapp, 1}, |
| 851 | Counter{cSubDelReqToE2, 1}, |
| 852 | Counter{cSubDelRespFromE2, 1}, |
| 853 | Counter{cSubDelRespToXapp, 1}, |
| 854 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 855 | |
| 856 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 857 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 858 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 859 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 860 | |
| 861 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 862 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 863 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 864 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 865 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 866 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 867 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 868 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 869 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 870 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 871 | |
| 872 | //Wait that subs is cleaned |
| 873 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 874 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 875 | xappConn1.TestMsgChanEmpty(t) |
| 876 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 877 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 878 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 879 | |
| 880 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 881 | } |
| 882 | |
| 883 | //----------------------------------------------------------------------------- |
| 884 | // TestSubReqRetransmission |
| 885 | // |
| 886 | // stub stub |
| 887 | // +-------+ +---------+ +---------+ |
| 888 | // | xapp | | submgr | | e2term | |
| 889 | // +-------+ +---------+ +---------+ |
| 890 | // | | | |
| 891 | // | SubReq | | |
| 892 | // |------------->| | |
| 893 | // | | | |
| 894 | // | | SubReq | |
| 895 | // | |------------->| |
| 896 | // | | | |
| 897 | // | SubReq | | |
| 898 | // | (retrans) | | |
| 899 | // |------------->| | |
| 900 | // | | | |
| 901 | // | | SubResp | |
| 902 | // | |<-------------| |
| 903 | // | | | |
| 904 | // | SubResp | | |
| 905 | // |<-------------| | |
| 906 | // | | | |
| 907 | // | [SUBS DELETE] | |
| 908 | // | | | |
| 909 | // |
| 910 | //----------------------------------------------------------------------------- |
| 911 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 912 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 913 | |
| 914 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 915 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 916 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 917 | |
| 918 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 921 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 922 | // hack as there is no real way to see has message be handled. |
| 923 | // Previuos counter check just tells that is has been received by submgr |
| 924 | // --> artificial delay |
| 925 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 926 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 927 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 928 | |
| 929 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 930 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 931 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 932 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 933 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 934 | |
| 935 | //Wait that subs is cleaned |
| 936 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 937 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 938 | xappConn1.TestMsgChanEmpty(t) |
| 939 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 940 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 941 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | //----------------------------------------------------------------------------- |
| 945 | // TestSubDelReqRetransmission |
| 946 | // |
| 947 | // stub stub |
| 948 | // +-------+ +---------+ +---------+ |
| 949 | // | xapp | | submgr | | e2term | |
| 950 | // +-------+ +---------+ +---------+ |
| 951 | // | | | |
| 952 | // | [SUBS CREATE] | |
| 953 | // | | | |
| 954 | // | | | |
| 955 | // | SubDelReq | | |
| 956 | // |------------->| | |
| 957 | // | | | |
| 958 | // | | SubDelReq | |
| 959 | // | |------------->| |
| 960 | // | | | |
| 961 | // | SubDelReq | | |
| 962 | // | (same sub) | | |
| 963 | // | (same xid) | | |
| 964 | // |------------->| | |
| 965 | // | | | |
| 966 | // | | SubDelResp | |
| 967 | // | |<-------------| |
| 968 | // | | | |
| 969 | // | SubDelResp | | |
| 970 | // |<-------------| | |
| 971 | // |
| 972 | //----------------------------------------------------------------------------- |
| 973 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 974 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 975 | |
| 976 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 977 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 978 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 979 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 980 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 981 | |
| 982 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 983 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 984 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 985 | |
| 986 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 987 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 988 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 989 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 990 | // hack as there is no real way to see has message be handled. |
| 991 | // Previuos counter check just tells that is has been received by submgr |
| 992 | // --> artificial delay |
| 993 | <-time.After(1 * time.Second) |
| 994 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 995 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 996 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 997 | |
| 998 | //Wait that subs is cleaned |
| 999 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1000 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1001 | xappConn1.TestMsgChanEmpty(t) |
| 1002 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1003 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1004 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | //----------------------------------------------------------------------------- |
| 1008 | // TestSubDelReqCollision |
| 1009 | // |
| 1010 | // stub stub |
| 1011 | // +-------+ +---------+ +---------+ |
| 1012 | // | xapp | | submgr | | e2term | |
| 1013 | // +-------+ +---------+ +---------+ |
| 1014 | // | | | |
| 1015 | // | [SUBS CREATE] | |
| 1016 | // | | | |
| 1017 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1018 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1019 | // |------------->| | |
| 1020 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1021 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1022 | // | |------------->| |
| 1023 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1024 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1025 | // | (same sub) | | |
| 1026 | // | (diff xid) | | |
| 1027 | // |------------->| | |
| 1028 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1029 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1030 | // | |<-------------| |
| 1031 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1032 | // | SubDelResp 1 | | |
| 1033 | // |<-------------| | |
| 1034 | // | | | |
| 1035 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1036 | // |<-------------| | |
| 1037 | // |
| 1038 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1039 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1040 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1041 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1042 | |
| 1043 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1044 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1045 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1046 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1047 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1048 | |
| 1049 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1050 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1051 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1052 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1053 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1054 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1055 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1056 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1057 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 1058 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1059 | // hack as there is no real way to see has message be handled. |
| 1060 | // Previuos counter check just tells that is has been received by submgr |
| 1061 | // --> artificial delay |
| 1062 | <-time.After(1 * time.Second) |
| 1063 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1064 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1065 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1066 | |
| 1067 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1068 | xappConn1.RecvSubsDelResp(t, nil) |
| 1069 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1070 | |
| 1071 | //Wait that subs is cleaned |
| 1072 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1073 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1074 | xappConn1.TestMsgChanEmpty(t) |
| 1075 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1076 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1077 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1078 | } |
| 1079 | |
| 1080 | //----------------------------------------------------------------------------- |
| 1081 | // TestSubReqAndSubDelOkTwoParallel |
| 1082 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1083 | // stub stub stub |
| 1084 | // +-------+ +-------+ +---------+ +---------+ |
| 1085 | // | xapp | | xapp | | submgr | | e2term | |
| 1086 | // +-------+ +-------+ +---------+ +---------+ |
| 1087 | // | | | | |
| 1088 | // | | | | |
| 1089 | // | | | | |
| 1090 | // | | SubReq1 | | |
| 1091 | // | |------------->| | |
| 1092 | // | | | | |
| 1093 | // | | | SubReq1 | |
| 1094 | // | | |------------->| |
| 1095 | // | | | | |
| 1096 | // | SubReq2 | | |
| 1097 | // |------------------------>| | |
| 1098 | // | | | | |
| 1099 | // | | | SubReq2 | |
| 1100 | // | | |------------->| |
| 1101 | // | | | | |
| 1102 | // | | | SubResp1 | |
| 1103 | // | | |<-------------| |
| 1104 | // | | SubResp1 | | |
| 1105 | // | |<-------------| | |
| 1106 | // | | | | |
| 1107 | // | | | SubResp2 | |
| 1108 | // | | |<-------------| |
| 1109 | // | SubResp2 | | |
| 1110 | // |<------------------------| | |
| 1111 | // | | | | |
| 1112 | // | | [SUBS 1 DELETE] | |
| 1113 | // | | | | |
| 1114 | // | | [SUBS 2 DELETE] | |
| 1115 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1116 | // |
| 1117 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1118 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1119 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1120 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1121 | |
| 1122 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1124 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1125 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1126 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1127 | |
| 1128 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1129 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1130 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 1131 | |
| 1132 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 1133 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 1134 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 1135 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1137 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1138 | |
| 1139 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1140 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1141 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1142 | |
| 1143 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1144 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1145 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1148 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1149 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1150 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1151 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | //Wait that subs is cleaned |
| 1153 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1154 | |
| 1155 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1156 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1157 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1158 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1159 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1160 | //Wait that subs is cleaned |
| 1161 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1162 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1163 | xappConn1.TestMsgChanEmpty(t) |
| 1164 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1165 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1166 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1167 | } |
| 1168 | |
| 1169 | //----------------------------------------------------------------------------- |
| 1170 | // TestSameSubsDiffRan |
| 1171 | // Same subscription to different RANs |
| 1172 | // |
| 1173 | // stub stub |
| 1174 | // +-------+ +---------+ +---------+ |
| 1175 | // | xapp | | submgr | | e2term | |
| 1176 | // +-------+ +---------+ +---------+ |
| 1177 | // | | | |
| 1178 | // | | | |
| 1179 | // | | | |
| 1180 | // | SubReq(r1) | | |
| 1181 | // |------------->| | |
| 1182 | // | | | |
| 1183 | // | | SubReq(r1) | |
| 1184 | // | |------------->| |
| 1185 | // | | | |
| 1186 | // | | SubResp(r1) | |
| 1187 | // | |<-------------| |
| 1188 | // | | | |
| 1189 | // | SubResp(r1) | | |
| 1190 | // |<-------------| | |
| 1191 | // | | | |
| 1192 | // | SubReq(r2) | | |
| 1193 | // |------------->| | |
| 1194 | // | | | |
| 1195 | // | | SubReq(r2) | |
| 1196 | // | |------------->| |
| 1197 | // | | | |
| 1198 | // | | SubResp(r2) | |
| 1199 | // | |<-------------| |
| 1200 | // | | | |
| 1201 | // | SubResp(r2) | | |
| 1202 | // |<-------------| | |
| 1203 | // | | | |
| 1204 | // | [SUBS r1 DELETE] | |
| 1205 | // | | | |
| 1206 | // | [SUBS r2 DELETE] | |
| 1207 | // | | | |
| 1208 | // |
| 1209 | //----------------------------------------------------------------------------- |
| 1210 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1211 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1212 | |
| 1213 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1214 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1215 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1216 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1217 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1218 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1219 | |
| 1220 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1221 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1222 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1223 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1224 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1225 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1226 | |
| 1227 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1228 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1229 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1230 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1231 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1232 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1233 | //Wait that subs is cleaned |
| 1234 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1235 | |
| 1236 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1237 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 1238 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1239 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1240 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1241 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1242 | //Wait that subs is cleaned |
| 1243 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1244 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1245 | xappConn1.TestMsgChanEmpty(t) |
| 1246 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1247 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1248 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1249 | } |
| 1250 | |
| 1251 | //----------------------------------------------------------------------------- |
| 1252 | // TestSubReqRetryInSubmgr |
| 1253 | // |
| 1254 | // stub stub |
| 1255 | // +-------+ +---------+ +---------+ |
| 1256 | // | xapp | | submgr | | e2term | |
| 1257 | // +-------+ +---------+ +---------+ |
| 1258 | // | | | |
| 1259 | // | SubReq | | |
| 1260 | // |------------->| | |
| 1261 | // | | | |
| 1262 | // | | SubReq | |
| 1263 | // | |------------->| |
| 1264 | // | | | |
| 1265 | // | | | |
| 1266 | // | | SubReq | |
| 1267 | // | |------------->| |
| 1268 | // | | | |
| 1269 | // | | SubResp | |
| 1270 | // | |<-------------| |
| 1271 | // | | | |
| 1272 | // | SubResp | | |
| 1273 | // |<-------------| | |
| 1274 | // | | | |
| 1275 | // | [SUBS DELETE] | |
| 1276 | // | | | |
| 1277 | // |
| 1278 | //----------------------------------------------------------------------------- |
| 1279 | |
| 1280 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1281 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1282 | |
| 1283 | // Init counter check |
| 1284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1285 | Counter{cSubReqFromXapp, 1}, |
| 1286 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 1287 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1288 | Counter{cSubReReqToE2, 1}, |
| 1289 | Counter{cSubRespFromE2, 1}, |
| 1290 | Counter{cSubRespToXapp, 1}, |
| 1291 | Counter{cSubDelReqFromXapp, 1}, |
| 1292 | Counter{cSubDelReqToE2, 1}, |
| 1293 | Counter{cSubDelRespFromE2, 1}, |
| 1294 | Counter{cSubDelRespToXapp, 1}, |
| 1295 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1296 | |
| 1297 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1298 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1299 | |
| 1300 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1301 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1302 | |
| 1303 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1304 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1305 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1306 | |
| 1307 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1308 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1309 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1310 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1311 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1312 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1313 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1314 | |
| 1315 | // Wait that subs is cleaned |
| 1316 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1317 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1318 | xappConn1.TestMsgChanEmpty(t) |
| 1319 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1320 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1321 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1322 | |
| 1323 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1324 | } |
| 1325 | |
| 1326 | //----------------------------------------------------------------------------- |
| 1327 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1328 | // |
| 1329 | // stub stub |
| 1330 | // +-------+ +---------+ +---------+ |
| 1331 | // | xapp | | submgr | | e2term | |
| 1332 | // +-------+ +---------+ +---------+ |
| 1333 | // | | | |
| 1334 | // | SubReq | | |
| 1335 | // |------------->| | |
| 1336 | // | | | |
| 1337 | // | | SubReq | |
| 1338 | // | |------------->| |
| 1339 | // | | | |
| 1340 | // | | | |
| 1341 | // | | SubReq | |
| 1342 | // | |------------->| |
| 1343 | // | | | |
| 1344 | // | | SubDelReq | |
| 1345 | // | |------------->| |
| 1346 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1347 | // | | SubDelResp | |
| 1348 | // | |<-------------| |
| 1349 | // | | | |
| 1350 | // |
| 1351 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1352 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1353 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1354 | |
| 1355 | // Init counter check |
| 1356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1357 | Counter{cSubReqFromXapp, 1}, |
| 1358 | Counter{cSubReqToE2, 1}, |
| 1359 | Counter{cSubReReqToE2, 1}, |
| 1360 | Counter{cSubReqTimerExpiry, 2}, |
| 1361 | Counter{cSubDelReqToE2, 1}, |
| 1362 | Counter{cSubDelRespFromE2, 1}, |
| 1363 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1364 | |
| 1365 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1366 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1367 | |
| 1368 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1369 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1370 | |
| 1371 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1372 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1373 | |
| 1374 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1375 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1376 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1377 | |
| 1378 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1379 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1380 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1381 | xappConn1.TestMsgChanEmpty(t) |
| 1382 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1383 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1384 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1385 | |
| 1386 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | //----------------------------------------------------------------------------- |
| 1390 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1391 | // |
| 1392 | // stub stub |
| 1393 | // +-------+ +---------+ +---------+ |
| 1394 | // | xapp | | submgr | | e2term | |
| 1395 | // +-------+ +---------+ +---------+ |
| 1396 | // | | | |
| 1397 | // | SubReq | | |
| 1398 | // |------------->| | |
| 1399 | // | | | |
| 1400 | // | | SubReq | |
| 1401 | // | |------------->| |
| 1402 | // | | | |
| 1403 | // | | | |
| 1404 | // | | SubReq | |
| 1405 | // | |------------->| |
| 1406 | // | | | |
| 1407 | // | | SubDelReq | |
| 1408 | // | |------------->| |
| 1409 | // | | | |
| 1410 | // | | | |
| 1411 | // | | SubDelReq | |
| 1412 | // | |------------->| |
| 1413 | // | | | |
| 1414 | // | | | |
| 1415 | // |
| 1416 | //----------------------------------------------------------------------------- |
| 1417 | |
| 1418 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1419 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1420 | |
| 1421 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1422 | Counter{cSubReqFromXapp, 1}, |
| 1423 | Counter{cSubReqToE2, 1}, |
| 1424 | Counter{cSubReReqToE2, 1}, |
| 1425 | Counter{cSubReqTimerExpiry, 2}, |
| 1426 | Counter{cSubDelReqToE2, 1}, |
| 1427 | Counter{cSubDelReReqToE2, 1}, |
| 1428 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1429 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1430 | |
| 1431 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1432 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1433 | |
| 1434 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1435 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1436 | |
| 1437 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1438 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1439 | |
| 1440 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1441 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1442 | |
| 1443 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1444 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1445 | |
| 1446 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1447 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1448 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1449 | xappConn1.TestMsgChanEmpty(t) |
| 1450 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1451 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1452 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1453 | |
| 1454 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1455 | } |
| 1456 | |
| 1457 | //----------------------------------------------------------------------------- |
| 1458 | // TestSubReqSubFailRespInSubmgr |
| 1459 | // |
| 1460 | // stub stub |
| 1461 | // +-------+ +---------+ +---------+ |
| 1462 | // | xapp | | submgr | | e2term | |
| 1463 | // +-------+ +---------+ +---------+ |
| 1464 | // | | | |
| 1465 | // | SubReq | | |
| 1466 | // |------------->| | |
| 1467 | // | | | |
| 1468 | // | | SubReq | |
| 1469 | // | |------------->| |
| 1470 | // | | | |
| 1471 | // | | SubFail | |
| 1472 | // | |<-------------| |
| 1473 | // | | | |
| 1474 | // | SubFail | | |
| 1475 | // |<-------------| | |
| 1476 | // | | | |
| 1477 | // |
| 1478 | //----------------------------------------------------------------------------- |
| 1479 | |
| 1480 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1482 | |
| 1483 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1484 | Counter{cSubReqFromXapp, 1}, |
| 1485 | Counter{cSubReqToE2, 1}, |
| 1486 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1487 | Counter{cSubFailToXapp, 1}, |
| 1488 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1489 | |
| 1490 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1491 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1492 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1493 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1494 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1495 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1496 | fparams1.Set(crereq1) |
| 1497 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1498 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1499 | // Xapp: Receive SubsFail |
| 1500 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1501 | |
| 1502 | // Wait that subs is cleaned |
| 1503 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1504 | |
| 1505 | xappConn1.TestMsgChanEmpty(t) |
| 1506 | xappConn2.TestMsgChanEmpty(t) |
| 1507 | e2termConn1.TestMsgChanEmpty(t) |
| 1508 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1509 | |
| 1510 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1511 | } |
| 1512 | |
| 1513 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1514 | // TestSubDelReqRetryInSubmgr |
| 1515 | // |
| 1516 | // stub stub |
| 1517 | // +-------+ +---------+ +---------+ |
| 1518 | // | xapp | | submgr | | e2term | |
| 1519 | // +-------+ +---------+ +---------+ |
| 1520 | // | | | |
| 1521 | // | [SUBS CREATE] | |
| 1522 | // | | | |
| 1523 | // | | | |
| 1524 | // | SubDelReq | | |
| 1525 | // |------------->| | |
| 1526 | // | | | |
| 1527 | // | | SubDelReq | |
| 1528 | // | |------------->| |
| 1529 | // | | | |
| 1530 | // | | SubDelReq | |
| 1531 | // | |------------->| |
| 1532 | // | | | |
| 1533 | // | | SubDelResp | |
| 1534 | // | |<-------------| |
| 1535 | // | | | |
| 1536 | // | SubDelResp | | |
| 1537 | // |<-------------| | |
| 1538 | // |
| 1539 | //----------------------------------------------------------------------------- |
| 1540 | |
| 1541 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1542 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1543 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1544 | |
| 1545 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1546 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1547 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1548 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1549 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1550 | |
| 1551 | // Subs Delete |
| 1552 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1553 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1554 | |
| 1555 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1556 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1557 | |
| 1558 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1559 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1560 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1561 | |
| 1562 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1563 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1564 | |
| 1565 | // Wait that subs is cleaned |
| 1566 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1567 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1568 | xappConn1.TestMsgChanEmpty(t) |
| 1569 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1570 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1571 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1572 | } |
| 1573 | |
| 1574 | //----------------------------------------------------------------------------- |
| 1575 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1576 | // |
| 1577 | // stub stub |
| 1578 | // +-------+ +---------+ +---------+ |
| 1579 | // | xapp | | submgr | | e2term | |
| 1580 | // +-------+ +---------+ +---------+ |
| 1581 | // | | | |
| 1582 | // | [SUBS CREATE] | |
| 1583 | // | | | |
| 1584 | // | | | |
| 1585 | // | SubDelReq | | |
| 1586 | // |------------->| | |
| 1587 | // | | | |
| 1588 | // | | SubDelReq | |
| 1589 | // | |------------->| |
| 1590 | // | | | |
| 1591 | // | | SubDelReq | |
| 1592 | // | |------------->| |
| 1593 | // | | | |
| 1594 | // | | | |
| 1595 | // | SubDelResp | | |
| 1596 | // |<-------------| | |
| 1597 | // |
| 1598 | //----------------------------------------------------------------------------- |
| 1599 | |
| 1600 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1601 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1602 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1603 | |
| 1604 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1605 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1606 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1607 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1608 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1609 | |
| 1610 | // Subs Delete |
| 1611 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1612 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1613 | |
| 1614 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1615 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1616 | |
| 1617 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1618 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1619 | |
| 1620 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1621 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1622 | |
| 1623 | // Wait that subs is cleaned |
| 1624 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1625 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1626 | xappConn1.TestMsgChanEmpty(t) |
| 1627 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1628 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1629 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1630 | } |
| 1631 | |
| 1632 | //----------------------------------------------------------------------------- |
| 1633 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1634 | // |
| 1635 | // stub stub |
| 1636 | // +-------+ +---------+ +---------+ |
| 1637 | // | xapp | | submgr | | e2term | |
| 1638 | // +-------+ +---------+ +---------+ |
| 1639 | // | | | |
| 1640 | // | [SUBS CREATE] | |
| 1641 | // | | | |
| 1642 | // | | | |
| 1643 | // | SubDelReq | | |
| 1644 | // |------------->| | |
| 1645 | // | | | |
| 1646 | // | | SubDelReq | |
| 1647 | // | |------------->| |
| 1648 | // | | | |
| 1649 | // | | SubDelFail | |
| 1650 | // | |<-------------| |
| 1651 | // | | | |
| 1652 | // | SubDelResp | | |
| 1653 | // |<-------------| | |
| 1654 | // | | | |
| 1655 | // |
| 1656 | //----------------------------------------------------------------------------- |
| 1657 | |
| 1658 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1659 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1660 | |
| 1661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1662 | Counter{cSubReqFromXapp, 1}, |
| 1663 | Counter{cSubReqToE2, 1}, |
| 1664 | Counter{cSubRespFromE2, 1}, |
| 1665 | Counter{cSubRespToXapp, 1}, |
| 1666 | Counter{cSubDelReqFromXapp, 1}, |
| 1667 | Counter{cSubDelReqToE2, 1}, |
| 1668 | Counter{cSubDelFailFromE2, 1}, |
| 1669 | Counter{cSubDelRespToXapp, 1}, |
| 1670 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1671 | |
| 1672 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1673 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1674 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1675 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1676 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1677 | |
| 1678 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1679 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1680 | |
| 1681 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1682 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1683 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1684 | |
| 1685 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1686 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1687 | |
| 1688 | // Wait that subs is cleaned |
| 1689 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1690 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1691 | xappConn1.TestMsgChanEmpty(t) |
| 1692 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1693 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1694 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1695 | |
| 1696 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | //----------------------------------------------------------------------------- |
| 1700 | // TestSubReqAndSubDelOkSameAction |
| 1701 | // |
| 1702 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1703 | // +-------+ +-------+ +---------+ +---------+ |
| 1704 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1705 | // +-------+ +-------+ +---------+ +---------+ |
| 1706 | // | | | | |
| 1707 | // | | | | |
| 1708 | // | | | | |
| 1709 | // | | SubReq1 | | |
| 1710 | // | |------------->| | |
| 1711 | // | | | | |
| 1712 | // | | | SubReq1 | |
| 1713 | // | | |------------->| |
| 1714 | // | | | SubResp1 | |
| 1715 | // | | |<-------------| |
| 1716 | // | | SubResp1 | | |
| 1717 | // | |<-------------| | |
| 1718 | // | | | | |
| 1719 | // | SubReq2 | | |
| 1720 | // |--------------------------->| | |
| 1721 | // | | | | |
| 1722 | // | SubResp2 | | |
| 1723 | // |<---------------------------| | |
| 1724 | // | | | | |
| 1725 | // | | SubDelReq 1 | | |
| 1726 | // | |------------->| | |
| 1727 | // | | | | |
| 1728 | // | | SubDelResp 1 | | |
| 1729 | // | |<-------------| | |
| 1730 | // | | | | |
| 1731 | // | SubDelReq 2 | | |
| 1732 | // |--------------------------->| | |
| 1733 | // | | | | |
| 1734 | // | | | SubDelReq 2 | |
| 1735 | // | | |------------->| |
| 1736 | // | | | | |
| 1737 | // | | | SubDelReq 2 | |
| 1738 | // | | |------------->| |
| 1739 | // | | | | |
| 1740 | // | SubDelResp 2 | | |
| 1741 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1742 | // |
| 1743 | //----------------------------------------------------------------------------- |
| 1744 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1745 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1746 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1747 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1748 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1749 | Counter{cSubReqFromXapp, 2}, |
| 1750 | Counter{cSubReqToE2, 1}, |
| 1751 | Counter{cSubRespFromE2, 1}, |
| 1752 | Counter{cSubRespToXapp, 2}, |
| 1753 | Counter{cMergedSubscriptions, 1}, |
| 1754 | Counter{cUnmergedSubscriptions, 1}, |
| 1755 | Counter{cSubDelReqFromXapp, 2}, |
| 1756 | Counter{cSubDelReqToE2, 1}, |
| 1757 | Counter{cSubDelRespFromE2, 1}, |
| 1758 | Counter{cSubDelRespToXapp, 2}, |
| 1759 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1760 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1761 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1762 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1763 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1764 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1765 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1766 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1767 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1768 | |
| 1769 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1770 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1771 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1772 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1773 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1774 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1775 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1776 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1777 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1778 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1779 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1780 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1781 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1782 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1783 | |
| 1784 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1785 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1786 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1787 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1788 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1789 | //Wait that subs is cleaned |
| 1790 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1791 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1792 | xappConn1.TestMsgChanEmpty(t) |
| 1793 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1794 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1795 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1796 | |
| 1797 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1798 | } |
| 1799 | |
| 1800 | //----------------------------------------------------------------------------- |
| 1801 | // TestSubReqAndSubDelOkSameActionParallel |
| 1802 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1803 | // stub stub stub |
| 1804 | // +-------+ +-------+ +---------+ +---------+ |
| 1805 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1806 | // +-------+ +-------+ +---------+ +---------+ |
| 1807 | // | | | | |
| 1808 | // | | | | |
| 1809 | // | | | | |
| 1810 | // | | SubReq1 | | |
| 1811 | // | |------------->| | |
| 1812 | // | | | | |
| 1813 | // | | | SubReq1 | |
| 1814 | // | | |------------->| |
| 1815 | // | SubReq2 | | |
| 1816 | // |--------------------------->| | |
| 1817 | // | | | SubResp1 | |
| 1818 | // | | |<-------------| |
| 1819 | // | | SubResp1 | | |
| 1820 | // | |<-------------| | |
| 1821 | // | | | | |
| 1822 | // | SubResp2 | | |
| 1823 | // |<---------------------------| | |
| 1824 | // | | | | |
| 1825 | // | | SubDelReq 1 | | |
| 1826 | // | |------------->| | |
| 1827 | // | | | | |
| 1828 | // | | SubDelResp 1 | | |
| 1829 | // | |<-------------| | |
| 1830 | // | | | | |
| 1831 | // | SubDelReq 2 | | |
| 1832 | // |--------------------------->| | |
| 1833 | // | | | | |
| 1834 | // | | | SubDelReq 2 | |
| 1835 | // | | |------------->| |
| 1836 | // | | | | |
| 1837 | // | | | SubDelReq 2 | |
| 1838 | // | | |------------->| |
| 1839 | // | | | | |
| 1840 | // | SubDelResp 2 | | |
| 1841 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1842 | // |
| 1843 | //----------------------------------------------------------------------------- |
| 1844 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1845 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1846 | |
| 1847 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1848 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1849 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1850 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1851 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1852 | |
| 1853 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1854 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1855 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1856 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1857 | |
| 1858 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1859 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1860 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1861 | |
| 1862 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1863 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1864 | |
| 1865 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1866 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1867 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1868 | |
| 1869 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1870 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1871 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1872 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1873 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1874 | |
| 1875 | //Wait that subs is cleaned |
| 1876 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1877 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1878 | xappConn1.TestMsgChanEmpty(t) |
| 1879 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1880 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1881 | mainCtrl.wait_registry_empty(t, 10) |
| 1882 | } |
| 1883 | |
| 1884 | //----------------------------------------------------------------------------- |
| 1885 | // TestSubReqAndSubDelNokSameActionParallel |
| 1886 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1887 | // stub stub stub |
| 1888 | // +-------+ +-------+ +---------+ +---------+ |
| 1889 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1890 | // +-------+ +-------+ +---------+ +---------+ |
| 1891 | // | | | | |
| 1892 | // | | | | |
| 1893 | // | | | | |
| 1894 | // | | SubReq1 | | |
| 1895 | // | |------------->| | |
| 1896 | // | | | | |
| 1897 | // | | | SubReq1 | |
| 1898 | // | | |------------->| |
| 1899 | // | SubReq2 | | |
| 1900 | // |--------------------------->| | |
| 1901 | // | | | SubFail1 | |
| 1902 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1903 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1904 | // | | SubFail1 | | |
| 1905 | // | |<-------------| | |
| 1906 | // | | | | |
| 1907 | // | SubFail2 | | |
| 1908 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1909 | // |
| 1910 | //----------------------------------------------------------------------------- |
| 1911 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1912 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1913 | |
| 1914 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1915 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1916 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1917 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1918 | |
| 1919 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1920 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1921 | |
| 1922 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1923 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1924 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1925 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1926 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1927 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1928 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1929 | // E2t: send SubsFail (first) |
| 1930 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1931 | fparams1.Set(crereq1) |
| 1932 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1933 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1934 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1935 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1936 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1937 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1938 | |
| 1939 | //Wait that subs is cleaned |
| 1940 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1941 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1942 | xappConn1.TestMsgChanEmpty(t) |
| 1943 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1944 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1945 | mainCtrl.wait_registry_empty(t, 10) |
| 1946 | } |
| 1947 | |
| 1948 | //----------------------------------------------------------------------------- |
| 1949 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1950 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1951 | // stub stub stub |
| 1952 | // +-------+ +-------+ +---------+ +---------+ |
| 1953 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1954 | // +-------+ +-------+ +---------+ +---------+ |
| 1955 | // | | | | |
| 1956 | // | | | | |
| 1957 | // | | | | |
| 1958 | // | | SubReq1 | | |
| 1959 | // | |------------->| | |
| 1960 | // | | | | |
| 1961 | // | | | SubReq1 | |
| 1962 | // | | |------------->| |
| 1963 | // | | SubReq2 | | |
| 1964 | // |--------------------------->| | |
| 1965 | // | | | | |
| 1966 | // | | | SubReq1 | |
| 1967 | // | | |------------->| |
| 1968 | // | | | | |
| 1969 | // | | | | |
| 1970 | // | | | SubDelReq | |
| 1971 | // | | |------------->| |
| 1972 | // | | | | |
| 1973 | // | | | SubDelResp | |
| 1974 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1975 | // |
| 1976 | //----------------------------------------------------------------------------- |
| 1977 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1978 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1979 | |
| 1980 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1981 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1982 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1983 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1984 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1985 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1986 | |
| 1987 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1988 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1989 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1990 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1991 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1992 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1993 | |
| 1994 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1995 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1996 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1997 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1998 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1999 | |
| 2000 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2001 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2002 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 2003 | xappConn1.TestMsgChanEmpty(t) |
| 2004 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2005 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 2006 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 2007 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2008 | |
| 2009 | //----------------------------- Policy cases --------------------------------- |
| 2010 | //----------------------------------------------------------------------------- |
| 2011 | // TestSubReqPolicyAndSubDelOk |
| 2012 | // |
| 2013 | // stub stub |
| 2014 | // +-------+ +---------+ +---------+ |
| 2015 | // | xapp | | submgr | | e2term | |
| 2016 | // +-------+ +---------+ +---------+ |
| 2017 | // | | | |
| 2018 | // | SubReq | | |
| 2019 | // |------------->| | |
| 2020 | // | | | |
| 2021 | // | | SubReq | |
| 2022 | // | |------------->| |
| 2023 | // | | | |
| 2024 | // | | SubResp | |
| 2025 | // | |<-------------| |
| 2026 | // | | | |
| 2027 | // | SubResp | | |
| 2028 | // |<-------------| | |
| 2029 | // | | | |
| 2030 | // | | | |
| 2031 | // | SubDelReq | | |
| 2032 | // |------------->| | |
| 2033 | // | | | |
| 2034 | // | | SubDelReq | |
| 2035 | // | |------------->| |
| 2036 | // | | | |
| 2037 | // | | SubDelResp | |
| 2038 | // | |<-------------| |
| 2039 | // | | | |
| 2040 | // | SubDelResp | | |
| 2041 | // |<-------------| | |
| 2042 | // |
| 2043 | //----------------------------------------------------------------------------- |
| 2044 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 2045 | CaseBegin("TestSubReqAndSubDelOk") |
| 2046 | |
| 2047 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2048 | rparams1.Init() |
| 2049 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2050 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2051 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2052 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2053 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2054 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2055 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2056 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2057 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2059 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2060 | |
| 2061 | //Wait that subs is cleaned |
| 2062 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2063 | |
| 2064 | xappConn1.TestMsgChanEmpty(t) |
| 2065 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2066 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2067 | mainCtrl.wait_registry_empty(t, 10) |
| 2068 | } |
| 2069 | |
| 2070 | //----------------------------------------------------------------------------- |
| 2071 | // TestSubReqPolicyChangeAndSubDelOk |
| 2072 | // |
| 2073 | // stub stub |
| 2074 | // +-------+ +---------+ +---------+ |
| 2075 | // | xapp | | submgr | | e2term | |
| 2076 | // +-------+ +---------+ +---------+ |
| 2077 | // | | | |
| 2078 | // | SubReq | | |
| 2079 | // |------------->| | |
| 2080 | // | | | |
| 2081 | // | | SubReq | |
| 2082 | // | |------------->| |
| 2083 | // | | | |
| 2084 | // | | SubResp | |
| 2085 | // | |<-------------| |
| 2086 | // | | | |
| 2087 | // | SubResp | | |
| 2088 | // |<-------------| | |
| 2089 | // | | | |
| 2090 | // | SubReq | | |
| 2091 | // |------------->| | |
| 2092 | // | | | |
| 2093 | // | | SubReq | |
| 2094 | // | |------------->| |
| 2095 | // | | | |
| 2096 | // | | SubResp | |
| 2097 | // | |<-------------| |
| 2098 | // | | | |
| 2099 | // | SubResp | | |
| 2100 | // |<-------------| | |
| 2101 | // | | | |
| 2102 | // | SubDelReq | | |
| 2103 | // |------------->| | |
| 2104 | // | | | |
| 2105 | // | | SubDelReq | |
| 2106 | // | |------------->| |
| 2107 | // | | | |
| 2108 | // | | SubDelResp | |
| 2109 | // | |<-------------| |
| 2110 | // | | | |
| 2111 | // | SubDelResp | | |
| 2112 | // |<-------------| | |
| 2113 | // |
| 2114 | //----------------------------------------------------------------------------- |
| 2115 | |
| 2116 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 2117 | CaseBegin("TestSubReqAndSubDelOk") |
| 2118 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2119 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2120 | rparams1.Init() |
| 2121 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 2122 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2123 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2124 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2125 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2126 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2127 | |
| 2128 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 2129 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2130 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 2131 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 2132 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2133 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2134 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2135 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2136 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2138 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2139 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2140 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2141 | |
| 2142 | //Wait that subs is cleaned |
| 2143 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2144 | |
| 2145 | xappConn1.TestMsgChanEmpty(t) |
| 2146 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 2147 | e2termConn1.TestMsgChanEmpty(t) |
| 2148 | mainCtrl.wait_registry_empty(t, 10) |
| 2149 | } |
| 2150 | |
| 2151 | //----------------------------------------------------------------------------- |
| 2152 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 2153 | // |
| 2154 | // stub stub stub |
| 2155 | // +-------+ +---------+ +---------+ +---------+ |
| 2156 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 2157 | // +-------+ +---------+ +---------+ +---------+ |
| 2158 | // | | | | |
| 2159 | // | | | | |
| 2160 | // | | | | |
| 2161 | // | SubReq1 | | | |
| 2162 | // |------------->| | | |
| 2163 | // | | | | |
| 2164 | // | | SubReq1 | | |
| 2165 | // | |------------->| | |
| 2166 | // | | | | |
| 2167 | // | SubReq2 | | | |
| 2168 | // |------------->| | | |
| 2169 | // | | | | |
| 2170 | // | | SubReq2 | | |
| 2171 | // | |---------------------------->| |
| 2172 | // | | | | |
| 2173 | // | | SubResp1 | | |
| 2174 | // | |<-------------| | |
| 2175 | // | SubResp1 | | | |
| 2176 | // |<-------------| | | |
| 2177 | // | | SubResp2 | | |
| 2178 | // | |<----------------------------| |
| 2179 | // | SubResp2 | | | |
| 2180 | // |<-------------| | | |
| 2181 | // | | | | |
| 2182 | // | [SUBS 1 DELETE] | | |
| 2183 | // | | | | |
| 2184 | // | [SUBS 2 DELETE] | | |
| 2185 | // | | | | |
| 2186 | // |
| 2187 | //----------------------------------------------------------------------------- |
| 2188 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 2189 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 2190 | |
| 2191 | //Req1 |
| 2192 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 2193 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 2194 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2195 | |
| 2196 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 2197 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 2198 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 2199 | |
| 2200 | //Resp1 |
| 2201 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2202 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2203 | |
| 2204 | //Resp2 |
| 2205 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 2206 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 2207 | |
| 2208 | //Del1 |
| 2209 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2212 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2213 | //Wait that subs is cleaned |
| 2214 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2215 | |
| 2216 | //Del2 |
| 2217 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 2218 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 2219 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 2220 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 2221 | //Wait that subs is cleaned |
| 2222 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2223 | |
| 2224 | xappConn1.TestMsgChanEmpty(t) |
| 2225 | xappConn2.TestMsgChanEmpty(t) |
| 2226 | e2termConn1.TestMsgChanEmpty(t) |
| 2227 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 2228 | mainCtrl.wait_registry_empty(t, 10) |
| 2229 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 2230 | |
| 2231 | //----------------------------------------------------------------------------- |
| 2232 | // TestSubReqInsertAndSubDelOk |
| 2233 | // |
| 2234 | // stub stub |
| 2235 | // +-------+ +---------+ +---------+ |
| 2236 | // | xapp | | submgr | | e2term | |
| 2237 | // +-------+ +---------+ +---------+ |
| 2238 | // | | | |
| 2239 | // | SubReq | | |
| 2240 | // |------------->| | |
| 2241 | // | | | |
| 2242 | // | | SubReq | |
| 2243 | // | |------------->| |
| 2244 | // | | | |
| 2245 | // | | SubResp | |
| 2246 | // | |<-------------| |
| 2247 | // | | | |
| 2248 | // | SubResp | | |
| 2249 | // |<-------------| | |
| 2250 | // | | | |
| 2251 | // | | | |
| 2252 | // | SubDelReq | | |
| 2253 | // |------------->| | |
| 2254 | // | | | |
| 2255 | // | | SubDelReq | |
| 2256 | // | |------------->| |
| 2257 | // | | | |
| 2258 | // | | SubDelResp | |
| 2259 | // | |<-------------| |
| 2260 | // | | | |
| 2261 | // | SubDelResp | | |
| 2262 | // |<-------------| | |
| 2263 | // |
| 2264 | //----------------------------------------------------------------------------- |
| 2265 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 2266 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 2267 | |
| 2268 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2269 | rparams1.Init() |
| 2270 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2271 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2272 | |
| 2273 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2274 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2275 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2276 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2277 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2278 | |
| 2279 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2280 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2281 | |
| 2282 | //Wait that subs is cleaned |
| 2283 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2284 | |
| 2285 | xappConn1.TestMsgChanEmpty(t) |
| 2286 | xappConn2.TestMsgChanEmpty(t) |
| 2287 | e2termConn1.TestMsgChanEmpty(t) |
| 2288 | mainCtrl.wait_registry_empty(t, 10) |
| 2289 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2290 | |
| 2291 | //----------------------------------------------------------------------------- |
| 2292 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2293 | // |
| 2294 | // This case simulates case where xApp restarts and starts sending same |
| 2295 | // subscription requests which have already subscribed successfully |
| 2296 | |
| 2297 | // stub stub |
| 2298 | // +-------+ +---------+ +---------+ |
| 2299 | // | xapp | | submgr | | e2term | |
| 2300 | // +-------+ +---------+ +---------+ |
| 2301 | // | | | |
| 2302 | // | SubReq | | |
| 2303 | // |------------->| | |
| 2304 | // | | | |
| 2305 | // | | SubReq | |
| 2306 | // | |------------->| |
| 2307 | // | | | |
| 2308 | // | | SubResp | |
| 2309 | // | |<-------------| |
| 2310 | // | | | |
| 2311 | // | SubResp | | |
| 2312 | // |<-------------| | |
| 2313 | // | | | |
| 2314 | // | xApp restart | | |
| 2315 | // | | | |
| 2316 | // | SubReq | | |
| 2317 | // | (retrans with same xApp generated subid but diff xid) |
| 2318 | // |------------->| | |
| 2319 | // | | | |
| 2320 | // | SubResp | | |
| 2321 | // |<-------------| | |
| 2322 | // | | | |
| 2323 | // | [SUBS DELETE] | |
| 2324 | // | | | |
| 2325 | // |
| 2326 | //----------------------------------------------------------------------------- |
| 2327 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2328 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2329 | |
| 2330 | //Subs Create |
| 2331 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2332 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2333 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2334 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2335 | |
| 2336 | // xApp restart here |
| 2337 | // --> artificial delay |
| 2338 | <-time.After(1 * time.Second) |
| 2339 | |
| 2340 | //Subs Create |
| 2341 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2342 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2343 | |
| 2344 | //Subs Delete |
| 2345 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2346 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2347 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2348 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2349 | |
| 2350 | //Wait that subs is cleaned |
| 2351 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2352 | |
| 2353 | xappConn1.TestMsgChanEmpty(t) |
| 2354 | xappConn2.TestMsgChanEmpty(t) |
| 2355 | e2termConn1.TestMsgChanEmpty(t) |
| 2356 | mainCtrl.wait_registry_empty(t, 10) |
| 2357 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2358 | |
| 2359 | //----------------------------------------------------------------------------- |
| 2360 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2361 | // |
| 2362 | // stub stub |
| 2363 | // +-------+ +---------+ +---------+ |
| 2364 | // | xapp | | submgr | | e2term | |
| 2365 | // +-------+ +---------+ +---------+ |
| 2366 | // | | | |
| 2367 | // | SubReq | | |
| 2368 | // |------------->| | |
| 2369 | // | | | |
| 2370 | // | | SubReq | |
| 2371 | // | |------------->| |
| 2372 | // | | | |
| 2373 | // | | SubResp | |
| 2374 | // | <----| |
| 2375 | // | | |
| 2376 | // | Submgr restart | |
| 2377 | // | | |
| 2378 | // | | | |
| 2379 | // | | SubDelReq | |
| 2380 | // | |------------->| |
| 2381 | // | | | |
| 2382 | // | | SubDelResp | |
| 2383 | // | |<-------------| |
| 2384 | // | | | |
| 2385 | // |
| 2386 | //----------------------------------------------------------------------------- |
| 2387 | |
| 2388 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2389 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2390 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2391 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2392 | xappConn1.SendSubsReq(t, nil, nil) |
| 2393 | e2termConn1.RecvSubsReq(t) |
| 2394 | mainCtrl.SetResetTestFlag(t, false) |
| 2395 | |
| 2396 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2397 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2398 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2399 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2400 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2401 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2402 | mainCtrl.SimulateRestart(t) |
| 2403 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2404 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2405 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2406 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2407 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2408 | |
| 2409 | // Wait that subs is cleaned |
| 2410 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2411 | |
| 2412 | xappConn1.TestMsgChanEmpty(t) |
| 2413 | xappConn2.TestMsgChanEmpty(t) |
| 2414 | e2termConn1.TestMsgChanEmpty(t) |
| 2415 | mainCtrl.wait_registry_empty(t, 10) |
| 2416 | } |
| 2417 | |
| 2418 | //----------------------------------------------------------------------------- |
| 2419 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2420 | // |
| 2421 | // stub stub |
| 2422 | // +-------+ +---------+ +---------+ |
| 2423 | // | xapp | | submgr | | e2term | |
| 2424 | // +-------+ +---------+ +---------+ |
| 2425 | // | | | |
| 2426 | // | SubReq | | |
| 2427 | // |------------->| | |
| 2428 | // | | | |
| 2429 | // | | SubReq | |
| 2430 | // | |------------->| |
| 2431 | // | | | |
| 2432 | // | | SubResp | |
| 2433 | // | |<-------------| |
| 2434 | // | | | |
| 2435 | // | SubResp | | |
| 2436 | // |<-------------| | |
| 2437 | // | | | |
| 2438 | // | | |
| 2439 | // | Submgr restart | |
| 2440 | // | | |
| 2441 | // | SubDelReq | | |
| 2442 | // |------------->| | |
| 2443 | // | | | |
| 2444 | // | | SubDelReq | |
| 2445 | // | |------------->| |
| 2446 | // | | | |
| 2447 | // | | SubDelResp | |
| 2448 | // | |<-------------| |
| 2449 | // | | | |
| 2450 | // | SubDelResp | | |
| 2451 | // |<-------------| | |
| 2452 | // |
| 2453 | //----------------------------------------------------------------------------- |
| 2454 | |
| 2455 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2456 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2457 | |
| 2458 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2459 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2460 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2461 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2462 | |
| 2463 | // Check subscription |
| 2464 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2465 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2466 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2467 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2468 | |
| 2469 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2470 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2471 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2472 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2473 | // That needs to be completed before successful subscription query is possible |
| 2474 | <-time.After(time.Second * 1) |
| 2475 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2476 | // Check that subscription is restored correctly after restart |
| 2477 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2478 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2479 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2480 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2481 | |
| 2482 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2483 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2484 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2485 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2486 | |
| 2487 | //Wait that subs is cleaned |
| 2488 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2489 | |
| 2490 | xappConn1.TestMsgChanEmpty(t) |
| 2491 | xappConn2.TestMsgChanEmpty(t) |
| 2492 | e2termConn1.TestMsgChanEmpty(t) |
| 2493 | mainCtrl.wait_registry_empty(t, 10) |
| 2494 | } |
| 2495 | |
| 2496 | //----------------------------------------------------------------------------- |
| 2497 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2498 | // |
| 2499 | // stub stub |
| 2500 | // +-------+ +-------+ +---------+ +---------+ |
| 2501 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2502 | // +-------+ +-------+ +---------+ +---------+ |
| 2503 | // | | | | |
| 2504 | // | | | | |
| 2505 | // | | | | |
| 2506 | // | | SubReq1 | | |
| 2507 | // | |------------->| | |
| 2508 | // | | | | |
| 2509 | // | | | SubReq1 | |
| 2510 | // | | |------------->| |
| 2511 | // | | | SubResp1 | |
| 2512 | // | | |<-------------| |
| 2513 | // | | SubResp1 | | |
| 2514 | // | |<-------------| | |
| 2515 | // | | | | |
| 2516 | // | | |
| 2517 | // | submgr restart | |
| 2518 | // | | |
| 2519 | // | | | | |
| 2520 | // | | | | |
| 2521 | // | SubReq2 | | |
| 2522 | // |--------------------------->| | |
| 2523 | // | | | | |
| 2524 | // | SubResp2 | | |
| 2525 | // |<---------------------------| | |
| 2526 | // | | | | |
| 2527 | // | | SubDelReq 1 | | |
| 2528 | // | |------------->| | |
| 2529 | // | | | | |
| 2530 | // | | SubDelResp 1 | | |
| 2531 | // | |<-------------| | |
| 2532 | // | | | | |
| 2533 | // | | | | |
| 2534 | // | | |
| 2535 | // | submgr restart | |
| 2536 | // | | |
| 2537 | // | | | | |
| 2538 | // | SubDelReq 2 | | |
| 2539 | // |--------------------------->| | |
| 2540 | // | | | | |
| 2541 | // | | | SubDelReq 2 | |
| 2542 | // | | |------------->| |
| 2543 | // | | | | |
| 2544 | // | | | SubDelReq 2 | |
| 2545 | // | | |------------->| |
| 2546 | // | | | | |
| 2547 | // | SubDelResp 2 | | |
| 2548 | // |<---------------------------| | |
| 2549 | // |
| 2550 | //----------------------------------------------------------------------------- |
| 2551 | |
| 2552 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2553 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2554 | |
| 2555 | //Req1 |
| 2556 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2557 | rparams1.Init() |
| 2558 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2559 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2560 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2561 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2562 | |
| 2563 | //Req2 |
| 2564 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2565 | rparams2.Init() |
| 2566 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2567 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2568 | |
| 2569 | // Check subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2570 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2571 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2572 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2573 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2574 | |
| 2575 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2576 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2577 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2578 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2579 | // That needs to be completed before successful subscription query is possible |
| 2580 | <-time.After(time.Second * 1) |
| 2581 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2582 | // Check that subscription is restored correctly after restart |
| 2583 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2584 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2585 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2586 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2587 | |
| 2588 | //Del1 |
| 2589 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2590 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2591 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2592 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2593 | |
| 2594 | mainCtrl.SimulateRestart(t) |
| 2595 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2596 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 2597 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 2598 | // Submgr need be ready before successful subscription deletion is possible |
| 2599 | <-time.After(time.Second * 1) |
| 2600 | |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2601 | //Del2 |
| 2602 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2603 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2604 | |
| 2605 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2606 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2607 | |
| 2608 | //Wait that subs is cleaned |
| 2609 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2610 | |
| 2611 | xappConn1.TestMsgChanEmpty(t) |
| 2612 | xappConn2.TestMsgChanEmpty(t) |
| 2613 | e2termConn1.TestMsgChanEmpty(t) |
| 2614 | mainCtrl.wait_registry_empty(t, 10) |
| 2615 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2616 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2617 | //***************************************************************************** |
| 2618 | // REST interface test cases |
| 2619 | //***************************************************************************** |
| 2620 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2621 | //----------------------------------------------------------------------------- |
| 2622 | // Test debug GET and POST requests |
| 2623 | // |
| 2624 | // curl |
| 2625 | // +-------+ +---------+ |
| 2626 | // | user | | submgr | |
| 2627 | // +-------+ +---------+ |
| 2628 | // | | |
| 2629 | // | GET/POST Req | |
| 2630 | // |------------->| |
| 2631 | // | Resp | |
| 2632 | // |<-------------| |
| 2633 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2634 | func TestGetSubscriptions(t *testing.T) { |
| 2635 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 2636 | mainCtrl.SendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2637 | } |
| 2638 | |
| 2639 | func TestGetSymptomData(t *testing.T) { |
| 2640 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 2641 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2642 | } |
| 2643 | |
| 2644 | func TestPostdeleteSubId(t *testing.T) { |
| 2645 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 2646 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2647 | } |
| 2648 | |
| 2649 | func TestPostEmptyDb(t *testing.T) { |
| 2650 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 2651 | mainCtrl.SendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2652 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2653 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2654 | func TestGetRestSubscriptions(t *testing.T) { |
| 2655 | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 2656 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2657 | } |
| 2658 | |
| 2659 | //----------------------------------------------------------------------------- |
| 2660 | // TestDelAllE2nodeSubsViaDebugIf |
| 2661 | // |
| 2662 | // stub stub stub |
| 2663 | // +-------+ +---------+ +---------+ +---------+ |
| 2664 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2665 | // +-------+ +---------+ +---------+ +---------+ |
| 2666 | // | | | | |
| 2667 | // | RESTSubReq | | | |
| 2668 | // |---------------->| | | |
| 2669 | // | RESTSubResp | | | |
| 2670 | // |<----------------| | | |
| 2671 | // | | RouteCreate | | |
| 2672 | // | |--------------------------->| |
| 2673 | // | | RouteResponse| | |
| 2674 | // | |<---------------------------| |
| 2675 | // | | SubReq | | |
| 2676 | // | |------------->| | |
| 2677 | // | | SubResp | | |
| 2678 | // | |<-------------| | |
| 2679 | // | RESTNotif1 | | | |
| 2680 | // |<----------------| | | |
| 2681 | // | | | | |
| 2682 | // | REST get_all_e2nodes | | |
| 2683 | // |---------------->| | | |
| 2684 | // | OK 200 | | | |
| 2685 | // |<----------------| | | |
| 2686 | // | REST delete_all_e2node_subscriptions | ranName = RAN_NAME_1 |
| 2687 | // |---------------->| | | |
| 2688 | // | OK 200 | | | |
| 2689 | // |<----------------| | | |
| 2690 | // | | SubDelReq | | |
| 2691 | // | |------------->| | |
| 2692 | // | | SubDelResp | | |
| 2693 | // | |<-------------| | |
| 2694 | // | | | | |
| 2695 | // | | RouteDelete | | |
| 2696 | // | |--------------------------->| |
| 2697 | // | | RouteResponse| | |
| 2698 | // | |<---------------------------| |
| 2699 | // |
| 2700 | //----------------------------------------------------------------------------- |
| 2701 | |
| 2702 | func TestDelAllE2nodeSubsViaDebugIf(t *testing.T) { |
| 2703 | |
| 2704 | // Init counter check |
| 2705 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2706 | Counter{cRestSubReqFromXapp, 1}, |
| 2707 | Counter{cRestSubRespToXapp, 1}, |
| 2708 | Counter{cSubReqToE2, 1}, |
| 2709 | Counter{cSubRespFromE2, 1}, |
| 2710 | Counter{cRestSubNotifToXapp, 1}, |
| 2711 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2712 | Counter{cSubDelReqToE2, 1}, |
| 2713 | Counter{cSubDelRespFromE2, 1}, |
| 2714 | Counter{cRestSubDelRespToXapp, 1}, |
| 2715 | }) |
| 2716 | |
| 2717 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2718 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2719 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2720 | |
| 2721 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2722 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2723 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2724 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2725 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2726 | |
| 2727 | e2nodesJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_e2nodes") |
| 2728 | |
| 2729 | var e2nodesList []string |
| 2730 | err := json.Unmarshal(e2nodesJson, &e2nodesList) |
| 2731 | if err != nil { |
| 2732 | t.Errorf("Unmarshal error: %s", err) |
| 2733 | } |
| 2734 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("RAN_NAME_1", e2nodesList)) |
| 2735 | |
| 2736 | e2RestSubsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2node_rest_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2737 | var e2RestSubsMap map[string]RESTSubscription |
| 2738 | err = json.Unmarshal(e2RestSubsJson, &e2RestSubsMap) |
| 2739 | if err != nil { |
| 2740 | t.Errorf("Unmarshal error: %s", err) |
| 2741 | } |
| 2742 | |
| 2743 | if len(e2RestSubsMap) != 1 { |
| 2744 | t.Errorf("Incorrect e2RestSubsMap length %v", len(e2RestSubsMap)) |
| 2745 | } |
| 2746 | |
| 2747 | // Simulate deletion through REST test and debug interface |
| 2748 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_e2node_subscriptions/RAN_NAME_1") // RAN_NAME_1 = ranName |
| 2749 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2750 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2751 | |
| 2752 | // Wait that subs is cleaned |
| 2753 | waitSubsCleanup(t, e2SubsId, 10) |
| 2754 | mainCtrl.VerifyCounterValues(t) |
| 2755 | mainCtrl.VerifyAllClean(t) |
| 2756 | } |
| 2757 | |
| 2758 | //----------------------------------------------------------------------------- |
| 2759 | // TestDelAllxAppSubsViaDebugIf |
| 2760 | // |
| 2761 | // stub stub stub |
| 2762 | // +-------+ +---------+ +---------+ +---------+ |
| 2763 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2764 | // +-------+ +---------+ +---------+ +---------+ |
| 2765 | // | | | | |
| 2766 | // | RESTSubReq | | | |
| 2767 | // |---------------->| | | |
| 2768 | // | RESTSubResp | | | |
| 2769 | // |<----------------| | | |
| 2770 | // | | RouteCreate | | |
| 2771 | // | |--------------------------->| |
| 2772 | // | | RouteResponse| | |
| 2773 | // | |<---------------------------| |
| 2774 | // | | SubReq | | |
| 2775 | // | |------------->| | |
| 2776 | // | | SubResp | | |
| 2777 | // | |<-------------| | |
| 2778 | // | RESTNotif1 | | | |
| 2779 | // |<----------------| | | |
| 2780 | // | | | | |
| 2781 | // | REST get_all_xapps | | |
| 2782 | // |---------------->| | | |
| 2783 | // | OK 200 | | | |
| 2784 | // |<----------------| | | |
| 2785 | // | REST delete_all_xapp_subscriptions | xappServiceName = localhost |
| 2786 | // |---------------->| | | |
| 2787 | // | OK 200 | | | |
| 2788 | // |<----------------| | | |
| 2789 | // | | SubDelReq | | |
| 2790 | // | |------------->| | |
| 2791 | // | | SubDelResp | | |
| 2792 | // | |<-------------| | |
| 2793 | // | | | | |
| 2794 | // | | RouteDelete | | |
| 2795 | // | |--------------------------->| |
| 2796 | // | | RouteResponse| | |
| 2797 | // | |<---------------------------| |
| 2798 | // |
| 2799 | //----------------------------------------------------------------------------- |
| 2800 | |
| 2801 | func TestDelAllxAppSubsViaDebugIf(t *testing.T) { |
| 2802 | |
| 2803 | // Init counter check |
| 2804 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2805 | Counter{cRestSubReqFromXapp, 1}, |
| 2806 | Counter{cRestSubRespToXapp, 1}, |
| 2807 | Counter{cSubReqToE2, 1}, |
| 2808 | Counter{cSubRespFromE2, 1}, |
| 2809 | Counter{cRestSubNotifToXapp, 1}, |
| 2810 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2811 | Counter{cSubDelReqToE2, 1}, |
| 2812 | Counter{cSubDelRespFromE2, 1}, |
| 2813 | Counter{cRestSubDelRespToXapp, 1}, |
| 2814 | }) |
| 2815 | |
| 2816 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2817 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2818 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2819 | |
| 2820 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2821 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2822 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2823 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2824 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2825 | |
| 2826 | xappsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_all_xapps") |
| 2827 | |
| 2828 | var xappList []string |
| 2829 | err := json.Unmarshal(xappsJson, &xappList) |
| 2830 | if err != nil { |
| 2831 | t.Errorf("Unmarshal error: %s", err) |
| 2832 | } |
| 2833 | assert.Equal(t, true, mainCtrl.VerifyStringExistInSlice("localhost", xappList)) |
| 2834 | |
| 2835 | // Simulate deletion through REST test and debug interface |
| 2836 | mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/delete_all_xapp_subscriptions/localhost") // localhost = xappServiceName |
| 2837 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2838 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2839 | |
| 2840 | // Wait that subs is cleaned |
| 2841 | waitSubsCleanup(t, e2SubsId, 10) |
| 2842 | mainCtrl.VerifyCounterValues(t) |
| 2843 | mainCtrl.VerifyAllClean(t) |
| 2844 | } |
| 2845 | |
| 2846 | //----------------------------------------------------------------------------- |
| 2847 | // TestDelViaxAppSubsIf |
| 2848 | // |
| 2849 | // stub stub stub |
| 2850 | // +-------+ +---------+ +---------+ +---------+ |
| 2851 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2852 | // +-------+ +---------+ +---------+ +---------+ |
| 2853 | // | | | | |
| 2854 | // | RESTSubReq | | | |
| 2855 | // |---------------->| | | |
| 2856 | // | RESTSubResp | | | |
| 2857 | // |<----------------| | | |
| 2858 | // | | RouteCreate | | |
| 2859 | // | |--------------------------->| |
| 2860 | // | | RouteResponse| | |
| 2861 | // | |<---------------------------| |
| 2862 | // | | SubReq | | |
| 2863 | // | |------------->| | |
| 2864 | // | | SubResp | | |
| 2865 | // | |<-------------| | |
| 2866 | // | RESTNotif1 | | | |
| 2867 | // |<----------------| | | |
| 2868 | // | | | | |
| 2869 | // | REST get_xapp_rest_restsubscriptions | |
| 2870 | // |---------------->| | | |
| 2871 | // | OK 200 | | | |
| 2872 | // |<----------------| | | |
| 2873 | // | RESTSudDel | | | |
| 2874 | // |---------------->| | | Via user curl command (port 8088) |
| 2875 | // | RESTSudDel | | | |
| 2876 | // |<----------------| | | |
| 2877 | // | | SubDelReq | | |
| 2878 | // | |------------->| | |
| 2879 | // | | SubDelResp | | |
| 2880 | // | |<-------------| | |
| 2881 | // | | | | |
| 2882 | // | | RouteDelete | | |
| 2883 | // | |--------------------------->| |
| 2884 | // | | RouteResponse| | |
| 2885 | // | |<---------------------------| |
| 2886 | // |
| 2887 | //----------------------------------------------------------------------------- |
| 2888 | |
| 2889 | func TestDelViaxAppSubsIf(t *testing.T) { |
| 2890 | |
| 2891 | // Init counter check |
| 2892 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2893 | Counter{cRestSubReqFromXapp, 1}, |
| 2894 | Counter{cRestSubRespToXapp, 1}, |
| 2895 | Counter{cSubReqToE2, 1}, |
| 2896 | Counter{cSubRespFromE2, 1}, |
| 2897 | Counter{cRestSubNotifToXapp, 1}, |
| 2898 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2899 | Counter{cSubDelReqToE2, 1}, |
| 2900 | Counter{cSubDelRespFromE2, 1}, |
| 2901 | Counter{cRestSubDelRespToXapp, 1}, |
| 2902 | }) |
| 2903 | |
| 2904 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2905 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2906 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 2907 | |
| 2908 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2909 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2910 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2911 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2912 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 2913 | |
| 2914 | restSubsListJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_xapp_rest_restsubscriptions/localhost") // localhost = xappServiceName |
| 2915 | |
| 2916 | var restSubsMap map[string]RESTSubscription |
| 2917 | err := json.Unmarshal(restSubsListJson, &restSubsMap) |
| 2918 | if err != nil { |
| 2919 | t.Errorf("Unmarshal error: %s", err) |
| 2920 | } |
| 2921 | _, ok := restSubsMap[restSubId] |
| 2922 | if !ok { |
| 2923 | t.Errorf("REST subscription not found. restSubId=%s", restSubId) |
| 2924 | } |
| 2925 | |
| 2926 | var e2Subscriptions []Subscription |
| 2927 | e2SubscriptionsJson := mainCtrl.SendGetRequest(t, "localhost:8080", "/ric/v1/get_e2subscriptions/"+restSubId) |
| 2928 | err = json.Unmarshal(e2SubscriptionsJson, &e2Subscriptions) |
| 2929 | if err != nil { |
| 2930 | t.Errorf("Unmarshal error: %s", err) |
| 2931 | } |
| 2932 | if len(e2Subscriptions) != 1 { |
| 2933 | t.Errorf("Incorrect e2Subscriptions length %v", len(e2Subscriptions)) |
| 2934 | } |
| 2935 | |
| 2936 | // Simulate deletion through xapp REST test interface |
| 2937 | mainCtrl.SendDeleteRequest(t, "localhost:8088", "/ric/v1/subscriptions/"+restSubId) |
| 2938 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2939 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2940 | |
| 2941 | // Wait that subs is cleaned |
| 2942 | waitSubsCleanup(t, e2SubsId, 10) |
| 2943 | mainCtrl.VerifyCounterValues(t) |
| 2944 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2945 | } |
| 2946 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2947 | //----------------------------------------------------------------------------- |
| 2948 | // TestRESTSubReqAndRouteNok |
| 2949 | // |
| 2950 | // stub stub |
| 2951 | // +-------+ +---------+ +---------+ |
| 2952 | // | xapp | | submgr | | rtmgr | |
| 2953 | // +-------+ +---------+ +---------+ |
| 2954 | // | | | |
| 2955 | // | RESTSubReq | | |
| 2956 | // |---------------->| | |
| 2957 | // | | | |
| 2958 | // | RESTSubResp | | |
| 2959 | // |<----------------| | |
| 2960 | // | | RouteCreate | |
| 2961 | // | |------------->| |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2962 | // | | RouteCreate | |
| 2963 | // | | status:400 | |
| 2964 | // | |(Bad request) | |
| 2965 | // | |<-------------| |
| 2966 | // | RESTNotif | | |
| 2967 | // |<----------------| | |
| 2968 | // | | | |
| 2969 | // | [SUBS INT DELETE] | |
| 2970 | // | | | |
| 2971 | // | RESTSubDelReq | | |
| 2972 | // |---------------->| | |
| 2973 | // | RESTSubDelResp | | |
| 2974 | // |<----------------| | |
| 2975 | // |
| 2976 | //----------------------------------------------------------------------------- |
| 2977 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2978 | |
| 2979 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2980 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2981 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2982 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2983 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2984 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2985 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2986 | }) |
| 2987 | |
| 2988 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2989 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2990 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2991 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2992 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2993 | |
| 2994 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2995 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2996 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2997 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2998 | waiter.WaitResult(t) |
| 2999 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3000 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3001 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3002 | |
| 3003 | // Del |
| 3004 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3005 | |
| 3006 | // Wait that subs is cleaned |
| 3007 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3008 | waitSubsCleanup(t, e2SubsId, 10) |
| 3009 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3010 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3011 | } |
| 3012 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3013 | //----------------------------------------------------------------------------- |
| 3014 | // TestRESTSubReqAndRouteUpdateNok |
| 3015 | // |
| 3016 | // stub stub stub stub |
| 3017 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3018 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3019 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3020 | // | | | | | |
| 3021 | // | RESTSubReq1 | | | |
| 3022 | // |------------------------>| | | |
| 3023 | // | RESTSubResp2 | | | |
| 3024 | // |<------------------------| | | |
| 3025 | // | | | | | |
| 3026 | // | | | RouteCreate | | |
| 3027 | // | | |------------->| | |
| 3028 | // | | | CreateResp | | |
| 3029 | // | | |<-------------| | |
| 3030 | // | | | SubReq | | |
| 3031 | // | | |---------------------------->| |
| 3032 | // | | | SubResp | | |
| 3033 | // | | |<----------------------------| |
| 3034 | // | RESTNotif1 | | | |
| 3035 | // |<------------------------| | | |
| 3036 | // | | | | | |
| 3037 | // | | RESTSubReq2 | | | |
| 3038 | // | |------------>| | | |
| 3039 | // | | RESTSubResp2| | | |
| 3040 | // | |<------------| | | |
| 3041 | // | | | RouteUpdate | | |
| 3042 | // | | |------------->| | |
| 3043 | // | | | RouteUpdate | | |
| 3044 | // | | | status:400 | | |
| 3045 | // | | |(Bad request) | | |
| 3046 | // | | |<-------------| | |
| 3047 | // | | RESTNotif2(unsuccessful) | | |
| 3048 | // | |<------------| | | |
| 3049 | // | | | | | |
| 3050 | // | [SUBS INT DELETE] | | |
| 3051 | // | | | | | |
| 3052 | // | RESTSubDelReq1 | | | |
| 3053 | // |------------------------>| | | |
| 3054 | // | RESTSubDelResp1 | | | |
| 3055 | // |<------------------------| | | |
| 3056 | // | | | | | |
| 3057 | // | | | [SUBS DELETE] | |
| 3058 | // |
| 3059 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3060 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3061 | |
| 3062 | //Init counter check |
| 3063 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3064 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3065 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3066 | Counter{cSubReqToE2, 1}, |
| 3067 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3068 | Counter{cRestSubNotifToXapp, 1}, |
| 3069 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3070 | Counter{cRouteCreateUpdateFail, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3071 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3072 | Counter{cSubDelReqToE2, 1}, |
| 3073 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3074 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3075 | }) |
| 3076 | |
| 3077 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3078 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3079 | // Subs create for xapp1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3080 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3081 | |
| 3082 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3083 | |
| 3084 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 3085 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3086 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3087 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3088 | params.SetMeid("RAN_NAME_1") |
| 3089 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3090 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3091 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3092 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3093 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 3094 | |
| 3095 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3096 | |
| 3097 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3098 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3099 | |
| 3100 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 3101 | //Wait that subs is cleaned |
| 3102 | waitSubsCleanup(t, e2SubsId, 10) |
| 3103 | |
| 3104 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3105 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3106 | } |
| 3107 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3108 | //----------------------------------------------------------------------------- |
| 3109 | // TestRESTSubDelReqAndRouteDeleteNok |
| 3110 | // |
| 3111 | // stub stub stub |
| 3112 | // +-------+ +---------+ +---------+ +---------+ |
| 3113 | // | xapp | | submgr | | rtmgr | | e2term | |
| 3114 | // +-------+ +---------+ +---------+ +---------+ |
| 3115 | // | | | | |
| 3116 | // | RESTSubReq | | | |
| 3117 | // |---------------->| | | |
| 3118 | // | | | | |
| 3119 | // | RESTSubResp | | | |
| 3120 | // |<----------------| | | |
| 3121 | // | | SubReq | | |
| 3122 | // | |---------------------------->| |
| 3123 | // | | SubResp | | |
| 3124 | // | |<----------------------------| |
| 3125 | // | RESTNotif | | | |
| 3126 | // |<----------------| | | |
| 3127 | // | | | | |
| 3128 | // | | | | |
| 3129 | // | RESTSubDelReq | | | |
| 3130 | // |---------------->| | | |
| 3131 | // | RESTSubDelResp | | | |
| 3132 | // |<----------------| | | |
| 3133 | // | | SubSelReq | | |
| 3134 | // | |---------------------------->| |
| 3135 | // | | SubSelResp | | |
| 3136 | // | |<----------------------------| |
| 3137 | // | | RouteDelete | | |
| 3138 | // | |------------->| | |
| 3139 | // | | Routedelete | | |
| 3140 | // | | status:400 | | |
| 3141 | // | |(Bad request) | | |
| 3142 | // | |<-------------| | |
| 3143 | // |
| 3144 | //----------------------------------------------------------------------------- |
| 3145 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3146 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3147 | |
| 3148 | // Init counter check |
| 3149 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3150 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3151 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3152 | Counter{cSubReqToE2, 1}, |
| 3153 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3154 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3155 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3156 | Counter{cRouteDeleteFail, 1}, |
| 3157 | Counter{cSubDelReqToE2, 1}, |
| 3158 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3159 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3160 | }) |
| 3161 | |
| 3162 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3163 | |
| 3164 | //Subs Create |
| 3165 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3166 | |
| 3167 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3168 | |
| 3169 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3170 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3171 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3172 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3173 | waiter.WaitResult(t) |
| 3174 | |
| 3175 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3176 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3177 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3178 | } |
| 3179 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3180 | //----------------------------------------------------------------------------- |
| 3181 | // TestRESTSubMergeDelAndRouteUpdateNok |
| 3182 | // |
| 3183 | // stub stub stub stub |
| 3184 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3185 | // | xapp1 | | xapp2 | | submgr | | rtmgr | | e2term | |
| 3186 | // +-------+ +-------+ +---------+ +---------+ +---------+ |
| 3187 | // | | | | | |
| 3188 | // | RESTSubReq1 | | | |
| 3189 | // |------------------------>| | | |
| 3190 | // | RESTSubResp2 | | | |
| 3191 | // |<------------------------| | | |
| 3192 | // | | | | | |
| 3193 | // | | | RouteCreate | | |
| 3194 | // | | |------------->| | |
| 3195 | // | | | CreateResp | | |
| 3196 | // | | |<-------------| | |
| 3197 | // | | | SubReq | | |
| 3198 | // | | |---------------------------->| |
| 3199 | // | | | SubResp | | |
| 3200 | // | | |<----------------------------| |
| 3201 | // | RESTNotif1 | | | |
| 3202 | // |<------------------------| | | |
| 3203 | // | | | | | |
| 3204 | // | | RESTSubReq2 | | | |
| 3205 | // | |------------>| | | |
| 3206 | // | | RESTSubResp2| | | |
| 3207 | // | |<------------| | | |
| 3208 | // | | | RouteCreate | | |
| 3209 | // | | |------------->| | |
| 3210 | // | | | CreateResp | | |
| 3211 | // | | |<-------------| | |
| 3212 | // | | | SubReq | | |
| 3213 | // | | |---------------------------->| |
| 3214 | // | | | SubResp | | |
| 3215 | // | | |<----------------------------| |
| 3216 | // | | RESTNotif2 | | | |
| 3217 | // | |<------------| | | |
| 3218 | // | | | | | |
| 3219 | // | [SUBS INT DELETE] | | |
| 3220 | // | | | | | |
| 3221 | // | RESTSubDelReq1 | | | |
| 3222 | // |------------------------>| | | |
| 3223 | // | RESTSubDelResp1 | | | |
| 3224 | // |<------------------------| | | |
| 3225 | // | | | SubDelReq | | |
| 3226 | // | | |---------------------------->| |
| 3227 | // | | | SubDelResp | | |
| 3228 | // | | |<----------------------------| |
| 3229 | // | | | RouteUpdate | | |
| 3230 | // | | |------------->| | |
| 3231 | // | | | RouteUpdate | | |
| 3232 | // | | | status:400 | | |
| 3233 | // | | |(Bad request) | | |
| 3234 | // | | |<-------------| | |
| 3235 | // | | | | | |
| 3236 | // | | RESTSubDelReq2 | | |
| 3237 | // | |------------>| | | |
| 3238 | // | | RESTSubDelResp2 | | |
| 3239 | // | |<------------| | | |
| 3240 | // | | | SubDelReq | | |
| 3241 | // | | |---------------------------->| |
| 3242 | // | | | SubdelResp | | |
| 3243 | // | | |<----------------------------| |
| 3244 | // | | | RouteDelete | | |
| 3245 | // | | |------------->| | |
| 3246 | // | | | Deleteresp | | |
| 3247 | // | | |<-------------| | |
| 3248 | |
| 3249 | //----------------------------------------------------------------------------- |
| 3250 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3251 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3252 | |
| 3253 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3254 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3255 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3256 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3257 | Counter{cSubReqToE2, 1}, |
| 3258 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3259 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3260 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3261 | Counter{cRouteDeleteUpdateFail, 1}, |
| 3262 | Counter{cSubDelReqToE2, 1}, |
| 3263 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3264 | Counter{cRestSubDelRespToXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3265 | Counter{cUnmergedSubscriptions, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3266 | }) |
| 3267 | |
| 3268 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3269 | |
| 3270 | //Subs Create |
| 3271 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3272 | |
| 3273 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3274 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 3275 | |
| 3276 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3277 | |
| 3278 | //Del1, this shall fail on rtmgr side |
| 3279 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 3280 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3281 | waiter.WaitResult(t) |
| 3282 | |
| 3283 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 3284 | |
| 3285 | //Del2 |
| 3286 | deleteXapp2Subscription(t, &restSubId2) |
| 3287 | |
| 3288 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3289 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3290 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3291 | } |
| 3292 | |
| 3293 | //----------------------------------------------------------------------------- |
| 3294 | // TestRESTSubReqRetransmission |
| 3295 | // |
| 3296 | // stub stub |
| 3297 | // +-------+ +---------+ +---------+ |
| 3298 | // | xapp | | submgr | | e2term | |
| 3299 | // +-------+ +---------+ +---------+ |
| 3300 | // | | | |
| 3301 | // | RESTSubReq1 | | |
| 3302 | // |---------------->| | |
| 3303 | // | | | |
| 3304 | // | RESTSubResp | | |
| 3305 | // |<----------------| | |
| 3306 | // | | SubReq1 | |
| 3307 | // | |------------->| |
| 3308 | // | | | |
| 3309 | // | RESTSubReq2 | | |
| 3310 | // | (retrans) | | |
| 3311 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3312 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3313 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3314 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3315 | // | | SubResp1 | |
| 3316 | // | |<-------------| |
| 3317 | // | RESTNotif1 | | |
| 3318 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3319 | // | | | |
| 3320 | // | [SUBS DELETE] | |
| 3321 | // | | | |
| 3322 | // |
| 3323 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3324 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3325 | func TestRESTSubReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | |
| 3327 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3328 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3329 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 3330 | Counter{cSubReqToE2, 1}, |
| 3331 | Counter{cSubRespFromE2, 1}, |
| 3332 | Counter{cRestSubNotifToXapp, 1}, |
| 3333 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3334 | Counter{cSubDelReqToE2, 1}, |
| 3335 | Counter{cSubDelRespFromE2, 1}, |
| 3336 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3337 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3338 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3339 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 3340 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 3341 | |
| 3342 | // Subs Create |
| 3343 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3344 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3345 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3346 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3347 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3348 | xappConn1.SendRESTSubsReq(t, params) |
| 3349 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3350 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3351 | xappConn1.WaitListedRestNotifications(t, []string{restSubId}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3352 | |
| 3353 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3354 | // the order is not significant here. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3355 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3356 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3357 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3358 | e2SubsId := <-xappConn1.ListedRESTNotifications |
| 3359 | |
| 3360 | xapp.Logger.Debug("TEST: XAPP notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3361 | |
| 3362 | // Del1 |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3363 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3364 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3365 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3366 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3367 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsId.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3368 | |
| 3369 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3370 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3371 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3372 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3373 | //----------------------------------------------------------------------------- |
| 3374 | // stub stub stub |
| 3375 | // +-------+ +---------+ +---------+ +---------+ |
| 3376 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3377 | // +-------+ +---------+ +---------+ +---------+ |
| 3378 | // | | | | |
| 3379 | // | RESTSubReq | | | |
| 3380 | // |---------------->| | | |
| 3381 | // | RESTSubResp | | | |
| 3382 | // |<----------------| | | |
| 3383 | // | | RouteCreate | | |
| 3384 | // | |--------------------------->| |
| 3385 | // | | RouteResponse| | |
| 3386 | // | |<---------------------------| // The order of these events may vary |
| 3387 | // | | SubReq | | |
| 3388 | // | |------------->| | // The order of these events may vary |
| 3389 | // | | SubResp | | |
| 3390 | // | |<-------------| | |
| 3391 | // | RESTNotif1 | | | |
| 3392 | // |<----------------| | | |
| 3393 | // | RESTSubReq | | | |
| 3394 | // | [RETRANS1] | | | |
| 3395 | // |---------------->| | | |
| 3396 | // | RESTNotif1 | | | |
| 3397 | // |<----------------| | | |
| 3398 | // | RESTSubReq | | | |
| 3399 | // | [RETRANS2] | | | |
| 3400 | // |---------------->| | | |
| 3401 | // | RESTNotif1 | | | |
| 3402 | // |<----------------| | | |
| 3403 | // | RESTSubDelReq | | | |
| 3404 | // |---------------->| | | |
| 3405 | // | | SubDelReq | | |
| 3406 | // | |------------->| | |
| 3407 | // | RESTSubDelResp| | | |
| 3408 | // |<----------------| | | |
| 3409 | // | | SubDelResp | | |
| 3410 | // | |<-------------| | |
| 3411 | // | | | | |
| 3412 | // |
| 3413 | //----------------------------------------------------------------------------- |
| 3414 | |
| 3415 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3416 | |
| 3417 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3418 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3419 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3420 | Counter{cRestSubRespToXapp, 3}, |
| 3421 | Counter{cSubReqToE2, 1}, |
| 3422 | Counter{cSubRespFromE2, 1}, |
| 3423 | Counter{cRestSubNotifToXapp, 3}, |
| 3424 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3425 | Counter{cSubDelReqToE2, 1}, |
| 3426 | Counter{cSubDelRespFromE2, 1}, |
| 3427 | Counter{cRestSubDelRespToXapp, 1}, |
| 3428 | }) |
| 3429 | |
| 3430 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3431 | |
| 3432 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3433 | |
| 3434 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3435 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3436 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3437 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3438 | //1.st resend |
| 3439 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3440 | |
| 3441 | assert.Equal(t, restSubId_resend, restSubId) |
| 3442 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3443 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3444 | |
| 3445 | //2.nd resend |
| 3446 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3447 | |
| 3448 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3449 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3450 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3451 | |
| 3452 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3453 | |
| 3454 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3455 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3456 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | //----------------------------------------------------------------------------- |
| 3460 | // stub stub stub |
| 3461 | // +-------+ +---------+ +---------+ +---------+ |
| 3462 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3463 | // +-------+ +---------+ +---------+ +---------+ |
| 3464 | // | | | | |
| 3465 | // | RESTSubReq | | | |
| 3466 | // |---------------->| | | |
| 3467 | // | RESTSubResp | | | |
| 3468 | // |<----------------| | | |
| 3469 | // | | RouteCreate | | |
| 3470 | // | |--------------------------->| |
| 3471 | // | | RouteResponse| | |
| 3472 | // | |<---------------------------| // The order of these events may vary |
| 3473 | // | | SubReq | | |
| 3474 | // | |------------->| | // The order of these events may vary |
| 3475 | // | | SubResp | | |
| 3476 | // | |<-------------| | |
| 3477 | // | RESTNotif1 | | | |
| 3478 | // |<----------------| | | |
| 3479 | // | RESTSubReq | | | |
| 3480 | // | [RETRANS, with RESTsubsId] | | |
| 3481 | // |---------------->| | | |
| 3482 | // | RESTNotif1 | | | |
| 3483 | // |<----------------| | | |
| 3484 | // | RESTSubReq | | | |
| 3485 | // | [RETRANS, without RESTsubsId] | | |
| 3486 | // |---------------->| | | |
| 3487 | // | RESTNotif1 | | | |
| 3488 | // |<----------------| | | |
| 3489 | // | RESTSubDelReq | | | |
| 3490 | // |---------------->| | | |
| 3491 | // | | SubDelReq | | |
| 3492 | // | |------------->| | |
| 3493 | // | RESTSubDelResp| | | |
| 3494 | // |<----------------| | | |
| 3495 | // | | SubDelResp | | |
| 3496 | // | |<-------------| | |
| 3497 | // | | | | |
| 3498 | // |
| 3499 | //----------------------------------------------------------------------------- |
| 3500 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3501 | |
| 3502 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3503 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3504 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3505 | Counter{cRestSubRespToXapp, 3}, |
| 3506 | Counter{cSubReqToE2, 1}, |
| 3507 | Counter{cSubRespFromE2, 1}, |
| 3508 | Counter{cRestSubNotifToXapp, 3}, |
| 3509 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3510 | Counter{cSubDelReqToE2, 1}, |
| 3511 | Counter{cSubDelRespFromE2, 1}, |
| 3512 | Counter{cRestSubDelRespToXapp, 1}, |
| 3513 | }) |
| 3514 | |
| 3515 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3516 | |
| 3517 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3518 | |
| 3519 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3520 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3521 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3522 | |
| 3523 | //1.st resend with subscription ID |
| 3524 | params.SetSubscriptionID(&restSubId) |
| 3525 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 3526 | |
| 3527 | assert.Equal(t, restSubId_resend, restSubId) |
| 3528 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3529 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3530 | |
| 3531 | //2.nd resend without subscription ID (faking app restart) |
| 3532 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3533 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3534 | |
| 3535 | assert.Equal(t, restSubId_resend2, restSubId) |
| 3536 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3537 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3538 | |
| 3539 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3540 | |
| 3541 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3542 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3543 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3544 | } |
| 3545 | |
| 3546 | //----------------------------------------------------------------------------- |
| 3547 | // stub stub stub |
| 3548 | // +-------+ +---------+ +---------+ +---------+ |
| 3549 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3550 | // +-------+ +---------+ +---------+ +---------+ |
| 3551 | // | | | | |
| 3552 | // | RESTSubReq | | | |
| 3553 | // |---------------->| | | |
| 3554 | // | RESTSubResp | | | |
| 3555 | // |<----------------| | | |
| 3556 | // | | RouteCreate | | |
| 3557 | // | |--------------------------->| |
| 3558 | // | | RouteResponse| | |
| 3559 | // | |<---------------------------| |
| 3560 | // | | SubReq | | |
| 3561 | // | |------------->| | |
| 3562 | // | | SubResp | | |
| 3563 | // | |<-------------| | |
| 3564 | // | RESTNotif1 | | | |
| 3565 | // |<----------------| | | |
| 3566 | // | RESTSubReq | | | |
| 3567 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3568 | // |---------------->| | | |
| 3569 | // | RESTNotif1 | | | |
| 3570 | // | [for initial e2 subDetail] | | |
| 3571 | // |<----------------| | | |
| 3572 | // | | RouteCreate | | |
| 3573 | // | |--------------------------->| |
| 3574 | // | | RouteResponse| | |
| 3575 | // | |<---------------------------| |
| 3576 | // | | SubReq | | |
| 3577 | // | |------------->| | |
| 3578 | // | | SubResp | | |
| 3579 | // | |<-------------| | |
| 3580 | // | RESTNotif1 | | | |
| 3581 | // |<----------------| | | |
| 3582 | // | RESTSubReq | | | |
| 3583 | // | [with RESTsubsId initial request] | |
| 3584 | // |---------------->| | | |
| 3585 | // | RESTNotif1 | | | |
| 3586 | // |<----------------| | | |
| 3587 | // | RESTSubDelReq | | | |
| 3588 | // |---------------->| | | |
| 3589 | // | RESTSubDelResp| | | |
| 3590 | // |<----------------| | | |
| 3591 | // | | SubDelReq | | |
| 3592 | // | |------------->| | |
| 3593 | // | | SubDelResp | | |
| 3594 | // | |<-------------| | |
| 3595 | // | | SubDelReq | | |
| 3596 | // | |------------->| | |
| 3597 | // | | SubDelResp | | |
| 3598 | // | |<-------------| | |
| 3599 | // | | | | |
| 3600 | // |
| 3601 | //----------------------------------------------------------------------------- |
| 3602 | |
| 3603 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3604 | |
| 3605 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3606 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3607 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3608 | Counter{cRestSubRespToXapp, 3}, |
| 3609 | Counter{cSubReqToE2, 2}, |
| 3610 | Counter{cSubRespFromE2, 2}, |
| 3611 | Counter{cRestSubNotifToXapp, 4}, |
| 3612 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3613 | Counter{cSubDelReqToE2, 2}, |
| 3614 | Counter{cSubDelRespFromE2, 2}, |
| 3615 | Counter{cRestSubDelRespToXapp, 1}, |
| 3616 | }) |
| 3617 | |
| 3618 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3619 | |
| 3620 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3621 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3622 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3623 | |
| 3624 | // Send modified requst, this time with e2 subscriptions. |
| 3625 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3626 | params2.SetSubscriptionID(&restSubId) |
| 3627 | |
| 3628 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3629 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3630 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3631 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3632 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3633 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3634 | |
| 3635 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3636 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3637 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3638 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3639 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3640 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3641 | assert.NotEqual(t, e2SubsId2, 0) |
| 3642 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3643 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3644 | |
| 3645 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3646 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3647 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3648 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3649 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 3650 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3651 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3652 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3653 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3654 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3655 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3656 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3657 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3658 | // Delete both e2 subscriptions |
| 3659 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3660 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3661 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3662 | |
| 3663 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3664 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3665 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3666 | } |
| 3667 | |
| 3668 | //----------------------------------------------------------------------------- |
| 3669 | // stub stub stub |
| 3670 | // +-------+ +---------+ +---------+ +---------+ |
| 3671 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3672 | // +-------+ +---------+ +---------+ +---------+ |
| 3673 | // | | | | |
| 3674 | // | RESTSubReq | | | |
| 3675 | // |---------------->| | | |
| 3676 | // | RESTSubResp | | | |
| 3677 | // |<----------------| | | |
| 3678 | // | | RouteCreate | | |
| 3679 | // | |--------------------------->| |
| 3680 | // | | RouteResponse| | |
| 3681 | // | |<---------------------------| |
| 3682 | // | | SubReq | | |
| 3683 | // | |------------->| | |
| 3684 | // | | SubResp | | |
| 3685 | // | |<-------------| | |
| 3686 | // | RESTNotif1 | | | |
| 3687 | // |<----------------| | | |
| 3688 | // | RESTSubReq | | | |
| 3689 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3690 | // |---------------->| | | |
| 3691 | // | RESTNotif1 | | | |
| 3692 | // | [for initial e2 subDetail] | | |
| 3693 | // |<----------------| | | |
| 3694 | // | | RouteCreate | | |
| 3695 | // | |--------------------------->| |
| 3696 | // | | RouteResponse| | |
| 3697 | // | |<---------------------------| |
| 3698 | // | | SubReq | | |
| 3699 | // | |------------->| | |
| 3700 | // | | SubResp | | |
| 3701 | // | |<-------------| | |
| 3702 | // | RESTNotif1 | | | |
| 3703 | // |<----------------| | | |
| 3704 | // | RESTSubReq | | | |
| 3705 | // | [without RESTsubsId initial request] | |
| 3706 | // |---------------->| | | |
| 3707 | // | RESTNotif1 | | | |
| 3708 | // |<----------------| | | |
| 3709 | // | RESTSubDelReq | | | |
| 3710 | // |---------------->| | | |
| 3711 | // | RESTSubDelResp| | | |
| 3712 | // |<----------------| | | |
| 3713 | // | | SubDelReq | | |
| 3714 | // | |------------->| | |
| 3715 | // | | SubDelResp | | |
| 3716 | // | |<-------------| | |
| 3717 | // | | SubDelReq | | |
| 3718 | // | |------------->| | |
| 3719 | // | | SubDelResp | | |
| 3720 | // | |<-------------| | |
| 3721 | // | | | | |
| 3722 | // |
| 3723 | //----------------------------------------------------------------------------- |
| 3724 | |
| 3725 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3726 | |
| 3727 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3728 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3729 | Counter{cDuplicateE2SubReq, 2}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3730 | Counter{cRestSubRespToXapp, 3}, |
| 3731 | Counter{cSubReqToE2, 2}, |
| 3732 | Counter{cSubRespFromE2, 2}, |
| 3733 | Counter{cRestSubNotifToXapp, 4}, |
| 3734 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3735 | Counter{cSubDelReqToE2, 2}, |
| 3736 | Counter{cSubDelRespFromE2, 2}, |
| 3737 | Counter{cRestSubDelRespToXapp, 1}, |
| 3738 | }) |
| 3739 | |
| 3740 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3741 | |
| 3742 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3743 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3744 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3745 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 3746 | // Send modified request, this time with e2 subscriptions. |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3747 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3748 | params2.SetSubscriptionID(&restSubId) |
| 3749 | |
| 3750 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3751 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3752 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3753 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3754 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3755 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3756 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3757 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3758 | xappConn1.DecrementRequestCount() |
| 3759 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3760 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3761 | |
| 3762 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3763 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3764 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3765 | assert.NotEqual(t, e2SubsId2, 0) |
| 3766 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3767 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3768 | |
| 3769 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3770 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3771 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3772 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3773 | // md5sum shall find the original request |
| 3774 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3775 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3776 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3777 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3778 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3779 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3780 | mainCtrl.WaitOngoingRequestMapEmpty() |
| 3781 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3782 | // Delete both e2 subscriptions |
| 3783 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3784 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3785 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3786 | |
| 3787 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3788 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3789 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3790 | } |
| 3791 | |
| 3792 | //----------------------------------------------------------------------------- |
| 3793 | // stub stub stub |
| 3794 | // +-------+ +---------+ +---------+ +---------+ |
| 3795 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3796 | // +-------+ +---------+ +---------+ +---------+ |
| 3797 | // | | | | |
| 3798 | // | RESTSubReq | | | |
| 3799 | // |---------------->| | | |
| 3800 | // | RESTSubResp | | | |
| 3801 | // |<----------------| | | |
| 3802 | // | | RouteCreate | | |
| 3803 | // | |--------------------------->| |
| 3804 | // | | RouteResponse| | |
| 3805 | // | |<---------------------------| |
| 3806 | // | | SubReq | | |
| 3807 | // | |------------->| | |
| 3808 | // | | SubResp | | |
| 3809 | // | |<-------------| | |
| 3810 | // | RESTNotif1 | | | |
| 3811 | // |<----------------| | | |
| 3812 | // | RESTSubReq | | | |
| 3813 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3814 | // |---------------->| | | |
| 3815 | // | RESTNotif1 | | | |
| 3816 | // | [for initial e2 subDetail] | | |
| 3817 | // |<----------------| | | |
| 3818 | // | | RouteCreate | | |
| 3819 | // | |--------------------------->| |
| 3820 | // | | RouteResponse| | |
| 3821 | // | |<---------------------------| |
| 3822 | // | | SubReq | | |
| 3823 | // | |------------->| | |
| 3824 | // | | SubResp | | |
| 3825 | // | |<-------------| | |
| 3826 | // | RESTNotif1 | | | |
| 3827 | // |<----------------| | | |
| 3828 | // | RESTSubDelReq | | | |
| 3829 | // |---------------->| | | |
| 3830 | // | RESTSubDelResp| | | |
| 3831 | // |<----------------| | | |
| 3832 | // | | SubDelReq | | |
| 3833 | // | |------------->| | |
| 3834 | // | | SubDelResp | | |
| 3835 | // | |<-------------| | |
| 3836 | // | | SubDelReq | | |
| 3837 | // | |------------->| | |
| 3838 | // | | SubDelResp | | |
| 3839 | // | |<-------------| | |
| 3840 | // | RESTSubReq | | | |
| 3841 | // | [with RESTsubsId initial request] | |
| 3842 | // |---------------->| | | |
| 3843 | // | RESTSubResp | | | |
| 3844 | // |<----------------| | | |
| 3845 | // | | RouteCreate | | |
| 3846 | // | |--------------------------->| |
| 3847 | // | | RouteResponse| | |
| 3848 | // | |<---------------------------| |
| 3849 | // | | SubReq | | |
| 3850 | // | |------------->| | |
| 3851 | // | | SubResp | | |
| 3852 | // | |<-------------| | |
| 3853 | // | RESTNotif1 | | | |
| 3854 | // |<----------------| | | |
| 3855 | // | | | | |
| 3856 | // |
| 3857 | //----------------------------------------------------------------------------- |
| 3858 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3859 | |
| 3860 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3861 | Counter{cRestSubReqFromXapp, 3}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3862 | Counter{cDuplicateE2SubReq, 1}, |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3863 | Counter{cRestSubRespToXapp, 3}, |
| 3864 | Counter{cSubReqToE2, 3}, |
| 3865 | Counter{cSubRespFromE2, 3}, |
| 3866 | Counter{cRestSubNotifToXapp, 4}, |
| 3867 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3868 | Counter{cSubDelReqToE2, 3}, |
| 3869 | Counter{cSubDelRespFromE2, 3}, |
| 3870 | Counter{cRestSubDelRespToXapp, 2}, |
| 3871 | }) |
| 3872 | |
| 3873 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3874 | |
| 3875 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3876 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3877 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3878 | |
| 3879 | // Send modified requst, this time with e2 subscriptions. |
| 3880 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3881 | params2.SetSubscriptionID(&restSubId) |
| 3882 | |
| 3883 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3884 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3885 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3886 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3887 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3888 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3889 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3890 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3891 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3892 | |
| 3893 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3894 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3895 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3896 | assert.NotEqual(t, e2SubsId2, 0) |
| 3897 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3898 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3899 | |
| 3900 | // Delete both e2 subscriptions |
| 3901 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3902 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3903 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3904 | |
| 3905 | waitSubsCleanup(t, e2SubsId, 10) |
| 3906 | |
| 3907 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3908 | // but the restsubscription has been already removed. This shall trigger a |
| 3909 | // fresh create. |
| 3910 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3911 | |
Anssi Mannila | e5fdcd2 | 2021-12-13 14:18:24 +0200 | [diff] [blame] | 3912 | mainCtrl.WaitOngoingRequestMapEmpty() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3913 | |
| 3914 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3915 | |
| 3916 | waitSubsCleanup(t, e2SubsId, 10) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3917 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3918 | mainCtrl.VerifyAllClean(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3919 | } |
| 3920 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3921 | //----------------------------------------------------------------------------- |
| 3922 | // TestRESTSubDelReqRetransmission |
| 3923 | // |
| 3924 | // stub stub |
| 3925 | // +-------+ +---------+ +---------+ |
| 3926 | // | xapp | | submgr | | e2term | |
| 3927 | // +-------+ +---------+ +---------+ |
| 3928 | // | | | |
| 3929 | // | RESTSubReq | | |
| 3930 | // |---------------->| | |
| 3931 | // | | | |
| 3932 | // | RESTSubResp | | |
| 3933 | // |<----------------| | |
| 3934 | // | | SubReq | |
| 3935 | // | |------------->| |
| 3936 | // | | SubResp | |
| 3937 | // | |<-------------| |
| 3938 | // | RESTNotif1 | | |
| 3939 | // |<----------------| | |
| 3940 | // | | | |
| 3941 | // | RESTSubDelReq | | |
| 3942 | // |---------------->| | |
| 3943 | // | RESTSubDelResp | | |
| 3944 | // |<----------------| | |
| 3945 | // | | SubDelReq | |
| 3946 | // | |------------->| |
| 3947 | // | RESTSubDelReq | | |
| 3948 | // |---------------->| | |
| 3949 | // | RESTSubDelResp | | |
| 3950 | // |<----------------| | |
| 3951 | // | | SubDelResp | |
| 3952 | // | |<-------------| |
| 3953 | // | | | |
| 3954 | // |
| 3955 | //----------------------------------------------------------------------------- |
| 3956 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3957 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3958 | |
| 3959 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3960 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3961 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3962 | Counter{cSubReqToE2, 1}, |
| 3963 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3964 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3965 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3966 | Counter{cSubDelReqToE2, 1}, |
| 3967 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 3968 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3969 | }) |
| 3970 | |
| 3971 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3972 | |
| 3973 | //Subs Create |
| 3974 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3975 | |
| 3976 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3977 | |
| 3978 | //Subs Delete |
| 3979 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3980 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3981 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3982 | //Resend delete req |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3983 | seqBef := mainCtrl.get_msgcounter(t) |
| 3984 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3985 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3986 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 3987 | // Del resp |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3988 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3989 | |
| 3990 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3991 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 3992 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3993 | } |
| 3994 | |
| 3995 | //----------------------------------------------------------------------------- |
| 3996 | // TestRESTSubReqDelReq |
| 3997 | // |
| 3998 | // stub stub |
| 3999 | // +-------+ +---------+ +---------+ |
| 4000 | // | xapp | | submgr | | e2term | |
| 4001 | // +-------+ +---------+ +---------+ |
| 4002 | // | | | |
| 4003 | // | RESTSubReq | | |
| 4004 | // |---------------->| | |
| 4005 | // | | | |
| 4006 | // | RESTSubResp | | |
| 4007 | // |<----------------| | |
| 4008 | // | | SubReq | |
| 4009 | // | |------------->| |
| 4010 | // | RESTSubDelReq | | |
| 4011 | // |---------------->| | |
| 4012 | // | RESTSubDelResp | | |
| 4013 | // | unsuccess | | |
| 4014 | // |<----------------| | |
| 4015 | // | | SubResp | |
| 4016 | // | |<-------------| |
| 4017 | // | RESTNotif1 | | |
| 4018 | // |<----------------| | |
| 4019 | // | | | |
| 4020 | // | [SUBS DELETE] | |
| 4021 | // | | | |
| 4022 | // |
| 4023 | //----------------------------------------------------------------------------- |
| 4024 | func TestRESTSubReqDelReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4025 | |
| 4026 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4027 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4028 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4029 | Counter{cSubReqToE2, 1}, |
| 4030 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4031 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4032 | Counter{cRestSubDelReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4033 | Counter{cRestSubDelFailToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4034 | Counter{cSubDelReqToE2, 1}, |
| 4035 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4036 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4037 | }) |
| 4038 | |
| 4039 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4040 | |
| 4041 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4042 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4043 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4044 | |
| 4045 | // Del. This will fail as processing of the subscription |
| 4046 | // is still ongoing in submgr. Deletion is not allowed before |
| 4047 | // subscription creation has been completed. |
| 4048 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4049 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4050 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4051 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4052 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4053 | |
| 4054 | // Retry del |
| 4055 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4056 | |
| 4057 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4058 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4059 | |
| 4060 | // Wait that subs is cleaned |
| 4061 | waitSubsCleanup(t, e2SubsId, 10) |
| 4062 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4063 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | } |
| 4065 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4066 | //----------------------------------------------------------------------------- |
| 4067 | // TestRESTSubReqAndSubDelOkTwoParallel |
| 4068 | // |
| 4069 | // stub stub stub |
| 4070 | // +-------+ +-------+ +---------+ +---------+ |
| 4071 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4072 | // +-------+ +-------+ +---------+ +---------+ |
| 4073 | // | | | | |
| 4074 | // | | RESTSubReq1 | | |
| 4075 | // | |------------->| | |
| 4076 | // | | RESTSubResp1 | | |
| 4077 | // | |<-------------| | |
| 4078 | // | | | | |
| 4079 | // | | | SubReq1 | |
| 4080 | // | | |------------->| |
| 4081 | // | | | | |
| 4082 | // | RESTSubReq2 | | |
| 4083 | // |------------------------>| | |
| 4084 | // | RESTSubResp2 | | |
| 4085 | // |<------------------------| | |
| 4086 | // | | | | |
| 4087 | // | | | SubReq2 | |
| 4088 | // | | |------------->| |
| 4089 | // | | | | |
| 4090 | // | | | SubResp1 | |
| 4091 | // | | |<-------------| |
| 4092 | // | | RESTNotif1 | | |
| 4093 | // | |<-------------| | |
| 4094 | // | | | | |
| 4095 | // | | | SubResp2 | |
| 4096 | // | | |<-------------| |
| 4097 | // | RESTNotif2 | | |
| 4098 | // |<------------------------| | |
| 4099 | // | | | | |
| 4100 | // | | [SUBS 1 DELETE] | |
| 4101 | // | | | | |
| 4102 | // | | [SUBS 2 DELETE] | |
| 4103 | // | | | | |
| 4104 | // |
| 4105 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4106 | |
| 4107 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4108 | |
| 4109 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4110 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4111 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4112 | Counter{cSubReqToE2, 2}, |
| 4113 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4114 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4115 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4116 | Counter{cSubDelReqToE2, 2}, |
| 4117 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4118 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4119 | }) |
| 4120 | |
| 4121 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4122 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4123 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4124 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4125 | |
| 4126 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4127 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4128 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4129 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4130 | |
| 4131 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4132 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4133 | |
| 4134 | //XappConn1 receives both of the responses |
| 4135 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4136 | |
| 4137 | //Resp1 |
| 4138 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4139 | //Resp2 |
| 4140 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4141 | |
| 4142 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4143 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4144 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4145 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4146 | |
| 4147 | //Del1 |
| 4148 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4149 | //Del2 |
| 4150 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 4151 | |
| 4152 | //Wait that subs is cleaned |
| 4153 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 4154 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4155 | |
| 4156 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4157 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4158 | } |
| 4159 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4160 | //----------------------------------------------------------------------------- |
| 4161 | // TestRESTSameSubsDiffRan |
| 4162 | // Same subscription to different RANs |
| 4163 | // |
| 4164 | // stub stub |
| 4165 | // +-------+ +---------+ +---------+ |
| 4166 | // | xapp | | submgr | | e2term | |
| 4167 | // +-------+ +---------+ +---------+ |
| 4168 | // | | | |
| 4169 | // | RESTSubReq(r1) | | |
| 4170 | // |---------------->| | |
| 4171 | // | RESTSubResp(r1) | | |
| 4172 | // |<----------------| | |
| 4173 | // | | | |
| 4174 | // | | SubReq(r1) | |
| 4175 | // | |------------->| |
| 4176 | // | | | |
| 4177 | // | | SubResp(r1) | |
| 4178 | // | |<-------------| |
| 4179 | // | | | |
| 4180 | // | RESTNotif(r1) | | |
| 4181 | // |<----------------| | |
| 4182 | // | | | |
| 4183 | // | RESTSubReq(r2) | | |
| 4184 | // |---------------->| | |
| 4185 | // | | | |
| 4186 | // | RESTSubResp(r2) | | |
| 4187 | // |<----------------| | |
| 4188 | // | | SubReq(r2) | |
| 4189 | // | |------------->| |
| 4190 | // | | | |
| 4191 | // | | SubResp(r2) | |
| 4192 | // | |<-------------| |
| 4193 | // | | | |
| 4194 | // | RESTNotif(r2) | | |
| 4195 | // |<----------------| | |
| 4196 | // | | | |
| 4197 | // | [SUBS r1 DELETE] | |
| 4198 | // | | | |
| 4199 | // | [SUBS r2 DELETE] | |
| 4200 | // | | | |
| 4201 | // |
| 4202 | //----------------------------------------------------------------------------- |
| 4203 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4204 | func TestRESTSameSubsDiffRan(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4205 | |
| 4206 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4207 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4208 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4209 | Counter{cSubReqToE2, 2}, |
| 4210 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4211 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4212 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4213 | Counter{cSubDelReqToE2, 2}, |
| 4214 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4215 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4216 | }) |
| 4217 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4218 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4219 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4220 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4221 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4222 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4223 | params.SetMeid("RAN_NAME_2") |
| 4224 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4225 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4226 | |
| 4227 | //Del1 |
| 4228 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 4229 | //Del2 |
| 4230 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 4231 | |
| 4232 | //Wait that subs is cleaned |
| 4233 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4234 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4235 | |
| 4236 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4237 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4238 | } |
| 4239 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4240 | //----------------------------------------------------------------------------- |
| 4241 | // TestRESTSubReqRetryInSubmgr |
| 4242 | // |
| 4243 | // stub stub |
| 4244 | // +-------+ +---------+ +---------+ |
| 4245 | // | xapp | | submgr | | e2term | |
| 4246 | // +-------+ +---------+ +---------+ |
| 4247 | // | | | |
| 4248 | // | RESTSubReq | | |
| 4249 | // |---------------->| | |
| 4250 | // | RESTSubResp | | |
| 4251 | // |<----------------| | |
| 4252 | // | | SubReq | |
Anssi Mannila | 92c3855 | 2021-12-29 09:59:24 +0200 | [diff] [blame^] | 4253 | // | |------------->| |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4254 | // | | | |
| 4255 | // | | | |
| 4256 | // | | SubReq | |
| 4257 | // | |------------->| |
| 4258 | // | | SubResp | |
| 4259 | // | |<-------------| |
| 4260 | // | | | |
| 4261 | // | RESTNotif | | |
| 4262 | // |<----------------| | |
| 4263 | // | | | |
| 4264 | // | [SUBS DELETE] | |
| 4265 | // | | | |
| 4266 | // |
| 4267 | //----------------------------------------------------------------------------- |
| 4268 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4269 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4270 | |
| 4271 | // Init counter check |
| 4272 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4273 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4274 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4275 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4276 | Counter{cSubReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4277 | Counter{cSubReReqToE2, 1}, |
| 4278 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4279 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4280 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4281 | Counter{cSubDelReqToE2, 1}, |
| 4282 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4283 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4284 | }) |
| 4285 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4286 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4287 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4288 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4289 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4290 | |
| 4291 | // Catch the first message and ignore it |
| 4292 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4293 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4294 | |
| 4295 | // The second request is being handled normally |
| 4296 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 4297 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4298 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4299 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4300 | |
| 4301 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4302 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4303 | // Del |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4304 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4305 | |
| 4306 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 4307 | //Wait that subs is cleaned |
| 4308 | waitSubsCleanup(t, e2SubsId, 10) |
| 4309 | |
| 4310 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4311 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4312 | } |
| 4313 | |
| 4314 | //----------------------------------------------------------------------------- |
| 4315 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4316 | // |
| 4317 | // stub stub |
| 4318 | // +-------+ +---------+ +---------+ |
| 4319 | // | xapp | | submgr | | e2term | |
| 4320 | // +-------+ +---------+ +---------+ |
| 4321 | // | | | |
| 4322 | // | RESTSubReq | | |
| 4323 | // |---------------->| | |
| 4324 | // | | | |
| 4325 | // | RESTSubResp | | |
| 4326 | // |<----------------| | |
| 4327 | // | | SubReq | |
| 4328 | // | |------------->| |
| 4329 | // | | | |
| 4330 | // | | | |
| 4331 | // | | SubReq | |
| 4332 | // | |------------->| |
| 4333 | // | | | |
| 4334 | // | | SubDelReq | |
| 4335 | // | |------------->| |
| 4336 | // | | | |
| 4337 | // | | | |
| 4338 | // | | SubDelReq | |
| 4339 | // | |------------->| |
| 4340 | // | | | |
| 4341 | // | | | |
| 4342 | // | | SubDelResp | |
| 4343 | // | |<-------------| |
| 4344 | // | RESTNotif | | |
| 4345 | // | unsuccess | | |
| 4346 | // |<----------------| | |
| 4347 | // | | | |
| 4348 | // | [SUBS DELETE] | |
| 4349 | // | | | |
| 4350 | // |
| 4351 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4352 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4353 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4354 | |
| 4355 | // Init counter check |
| 4356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4357 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4358 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4359 | Counter{cSubReqToE2, 1}, |
| 4360 | Counter{cSubReReqToE2, 1}, |
| 4361 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4362 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4363 | Counter{cSubDelReqToE2, 1}, |
| 4364 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4365 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4366 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4367 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4368 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4369 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4370 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4371 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4372 | |
| 4373 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4374 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4375 | |
| 4376 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4377 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4378 | |
| 4379 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4380 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4381 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | xappConn1.WaitRESTNotification(t, restSubId) |
| 4383 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4384 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4385 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4386 | // Wait that subs is cleaned |
| 4387 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4388 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4389 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4390 | } |
| 4391 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4392 | //----------------------------------------------------------------------------- |
| 4393 | // TestREST2eTermNotRespondingToSubReq |
| 4394 | // |
| 4395 | // stub stub |
| 4396 | // +-------+ +---------+ +---------+ |
| 4397 | // | xapp | | submgr | | e2term | |
| 4398 | // +-------+ +---------+ +---------+ |
| 4399 | // | | | |
| 4400 | // | RESTSubReq | | |
| 4401 | // |---------------->| | |
| 4402 | // | RESTSubResp | | |
| 4403 | // |<----------------| | |
| 4404 | // | | SubReq | |
| 4405 | // | |------------->| |
| 4406 | // | | | |
| 4407 | // | | SubReq | |
| 4408 | // | |------------->| |
| 4409 | // | | | |
| 4410 | // | | SubDelReq | |
| 4411 | // | |------------->| |
| 4412 | // | | | |
| 4413 | // | | SubDelReq | |
| 4414 | // | |------------->| |
| 4415 | // | RESTNotif(Unsuccessful) | |
| 4416 | // |<----------------| | |
| 4417 | // | | | |
| 4418 | // | RESTSubDelReq | | |
| 4419 | // |---------------->| | |
| 4420 | // | RESTSubDelResp | | |
| 4421 | // |<----------------| | |
| 4422 | // | | | |
| 4423 | // |
| 4424 | //----------------------------------------------------------------------------- |
| 4425 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4426 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | |
| 4428 | // Init counter check |
| 4429 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4430 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4431 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4432 | Counter{cSubReqToE2, 1}, |
| 4433 | Counter{cSubReReqToE2, 1}, |
| 4434 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4435 | Counter{cSubDelReReqToE2, 1}, |
| 4436 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4437 | Counter{cSubDelReqToE2, 1}, |
| 4438 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4439 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4440 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4441 | }) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4442 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4443 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4444 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4445 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4446 | |
| 4447 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4448 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4449 | |
| 4450 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4451 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4452 | |
| 4453 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4454 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4455 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4456 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4457 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4458 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4459 | |
| 4460 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4461 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4462 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4463 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4464 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4465 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4466 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | } |
| 4468 | |
| 4469 | //----------------------------------------------------------------------------- |
| 4470 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 4471 | // |
| 4472 | // stub stub |
| 4473 | // +-------+ +---------+ +---------+ |
| 4474 | // | xapp | | submgr | | e2term | |
| 4475 | // +-------+ +---------+ +---------+ |
| 4476 | // | | | |
| 4477 | // | RESTSubReq | | |
| 4478 | // |---------------->| | |
| 4479 | // | | | |
| 4480 | // | RESTSubResp | | |
| 4481 | // |<----------------| | |
| 4482 | // | | SubReq | |
| 4483 | // | |------------->| |
| 4484 | // | | | |
| 4485 | // | | | |
| 4486 | // | | SubReq | |
| 4487 | // | |------------->| |
| 4488 | // | | | |
| 4489 | // | | SubDelReq | |
| 4490 | // | |------------->| |
| 4491 | // | | | |
| 4492 | // | | | |
| 4493 | // | | SubDelReq | |
| 4494 | // | |------------->| |
| 4495 | // | | | |
| 4496 | // | | | |
| 4497 | // | | SubDelResp | |
| 4498 | // | |<-------------| |
| 4499 | // | RESTNotif | | |
| 4500 | // | unsuccess | | |
| 4501 | // |<----------------| | |
| 4502 | // | | | |
| 4503 | // | [SUBS DELETE] | |
| 4504 | // | | | |
| 4505 | // |
| 4506 | //----------------------------------------------------------------------------- |
| 4507 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4508 | |
| 4509 | // Init counter check |
| 4510 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4511 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4512 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4513 | Counter{cSubReqToE2, 1}, |
| 4514 | Counter{cSubReReqToE2, 1}, |
| 4515 | Counter{cSubReqTimerExpiry, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4516 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4517 | Counter{cSubDelReqToE2, 1}, |
| 4518 | Counter{cSubDelReReqToE2, 1}, |
| 4519 | Counter{cSubDelReqTimerExpiry, 2}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4520 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4521 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4522 | }) |
| 4523 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4524 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4525 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4526 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4527 | |
| 4528 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4529 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4530 | |
| 4531 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4532 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4533 | |
| 4534 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4535 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 4537 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4538 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4539 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | |
| 4541 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4542 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4543 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4544 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4545 | waitSubsCleanup(t, e2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4546 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4547 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4548 | } |
| 4549 | |
| 4550 | //----------------------------------------------------------------------------- |
| 4551 | // TestRESTSubReqSubFailRespInSubmgr |
| 4552 | // |
| 4553 | // stub stub |
| 4554 | // +-------+ +---------+ +---------+ |
| 4555 | // | xapp | | submgr | | e2term | |
| 4556 | // +-------+ +---------+ +---------+ |
| 4557 | // | | | |
| 4558 | // | RESTSubReq | | |
| 4559 | // |---------------->| | |
| 4560 | // | | | |
| 4561 | // | RESTSubResp | | |
| 4562 | // |<----------------| | |
| 4563 | // | | SubReq | |
| 4564 | // | |------------->| |
| 4565 | // | | | |
| 4566 | // | | SubFail | |
| 4567 | // | |<-------------| |
| 4568 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4569 | // | RESTNotif | | |
| 4570 | // | unsuccess | | |
| 4571 | // |<----------------| | |
| 4572 | // | | | |
| 4573 | // | [SUBS DELETE] | |
| 4574 | // | | | |
| 4575 | // |
| 4576 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4577 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4578 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | |
| 4580 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4581 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4582 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4583 | Counter{cSubReqToE2, 1}, |
| 4584 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4585 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4586 | Counter{cRestSubDelReqFromXapp, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4587 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4588 | }) |
| 4589 | |
| 4590 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4591 | const e2Timeout int64 = 2 |
| 4592 | const e2RetryCount int64 = 1 |
| 4593 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4594 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4595 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame] | 4596 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4597 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4598 | |
| 4599 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4600 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4601 | fparams1.Set(crereq1) |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 4602 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4603 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4604 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4605 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4606 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4607 | |
| 4608 | // REST subscription sill there to be deleted |
| 4609 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4610 | |
| 4611 | // Wait that subs is cleaned |
| 4612 | waitSubsCleanup(t, e2SubsId, 10) |
| 4613 | |
| 4614 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4615 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4616 | } |
| 4617 | |
| 4618 | //----------------------------------------------------------------------------- |
| 4619 | // TestRESTSubDelReqRetryInSubmgr |
| 4620 | // |
| 4621 | // stub stub |
| 4622 | // +-------+ +---------+ +---------+ |
| 4623 | // | xapp | | submgr | | e2term | |
| 4624 | // +-------+ +---------+ +---------+ |
| 4625 | // | | | |
| 4626 | // | [SUBS CREATE] | |
| 4627 | // | | | |
| 4628 | // | | | |
| 4629 | // | RESTSubDelReq | | |
| 4630 | // |---------------->| | |
| 4631 | // | | | |
| 4632 | // | RESTSubDelResp | | |
| 4633 | // |<----------------| | |
| 4634 | // | | SubDelReq | |
| 4635 | // | |------------->| |
| 4636 | // | | | |
| 4637 | // | | SubDelReq | |
| 4638 | // | |------------->| |
| 4639 | // | | | |
| 4640 | // | | SubDelResp | |
| 4641 | // | |<-------------| |
| 4642 | // | | | |
| 4643 | // |
| 4644 | //----------------------------------------------------------------------------- |
| 4645 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4646 | |
| 4647 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4648 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4649 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4650 | Counter{cSubReqToE2, 1}, |
| 4651 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4652 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4653 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4654 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4655 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4656 | Counter{cSubDelReReqToE2, 1}, |
| 4657 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4658 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4659 | }) |
| 4660 | // Req |
| 4661 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4662 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4663 | |
| 4664 | // Del |
| 4665 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4666 | |
| 4667 | // E2t: Receive 1st SubsDelReq |
| 4668 | e2termConn1.RecvSubsDelReq(t) |
| 4669 | |
| 4670 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4671 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4672 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4673 | |
| 4674 | //Wait that subs is cleaned |
| 4675 | waitSubsCleanup(t, e2SubsId, 10) |
| 4676 | |
| 4677 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4678 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4679 | } |
| 4680 | |
| 4681 | //----------------------------------------------------------------------------- |
| 4682 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 4683 | // |
| 4684 | // stub stub |
| 4685 | // +-------+ +---------+ +---------+ |
| 4686 | // | xapp | | submgr | | e2term | |
| 4687 | // +-------+ +---------+ +---------+ |
| 4688 | // | | | |
| 4689 | // | [SUBS CREATE] | |
| 4690 | // | | | |
| 4691 | // | | | |
| 4692 | // | RESTSubDelReq | | |
| 4693 | // |---------------->| | |
| 4694 | // | | | |
| 4695 | // | RESTSubDelResp | | |
| 4696 | // |<----------------| | |
| 4697 | // | | SubDelReq | |
| 4698 | // | |------------->| |
| 4699 | // | | | |
| 4700 | // | | SubDelReq | |
| 4701 | // | |------------->| |
| 4702 | // | | | |
| 4703 | // | | | |
| 4704 | // |
| 4705 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4706 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4707 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4708 | |
| 4709 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4710 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4711 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4712 | Counter{cSubReqToE2, 1}, |
| 4713 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4714 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4715 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4716 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 4717 | Counter{cSubDelReqTimerExpiry, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4718 | Counter{cSubDelReReqToE2, 1}, |
| 4719 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4720 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4721 | }) |
| 4722 | |
| 4723 | // Req |
| 4724 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4725 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4726 | |
| 4727 | // Del |
| 4728 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4729 | |
| 4730 | // E2t: Receive 1st SubsDelReq |
| 4731 | e2termConn1.RecvSubsDelReq(t) |
| 4732 | |
| 4733 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 4734 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4735 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4736 | |
| 4737 | //Wait that subs is cleaned |
| 4738 | waitSubsCleanup(t, e2SubsId, 10) |
| 4739 | |
| 4740 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4741 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4742 | } |
| 4743 | |
| 4744 | //----------------------------------------------------------------------------- |
| 4745 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 4746 | // |
| 4747 | // stub stub |
| 4748 | // +-------+ +---------+ +---------+ |
| 4749 | // | xapp | | submgr | | e2term | |
| 4750 | // +-------+ +---------+ +---------+ |
| 4751 | // | | | |
| 4752 | // | [SUBS CREATE] | |
| 4753 | // | | | |
| 4754 | // | | | |
| 4755 | // | RESTSubDelReq | | |
| 4756 | // |---------------->| | |
| 4757 | // | | | |
| 4758 | // | RESTSubDelResp | | |
| 4759 | // |<----------------| | |
| 4760 | // | | SubDelReq | |
| 4761 | // | |------------->| |
| 4762 | // | | | |
| 4763 | // | | SubDelFail | |
| 4764 | // | |<-------------| |
| 4765 | // | | | |
| 4766 | // |
| 4767 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4768 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4769 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4770 | |
| 4771 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4772 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4773 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4774 | Counter{cSubReqToE2, 1}, |
| 4775 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4776 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4777 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4778 | Counter{cSubDelReqToE2, 1}, |
| 4779 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4780 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4781 | }) |
| 4782 | |
| 4783 | // Req |
| 4784 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4785 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4786 | |
| 4787 | // Del |
| 4788 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4789 | |
| 4790 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 4791 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4792 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 4793 | |
| 4794 | //Wait that subs is cleaned |
| 4795 | waitSubsCleanup(t, e2SubsId, 10) |
| 4796 | |
| 4797 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4798 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4799 | } |
| 4800 | |
| 4801 | //----------------------------------------------------------------------------- |
| 4802 | // TestRESTSubReqAndSubDelOkSameAction |
| 4803 | // |
| 4804 | // stub stub |
| 4805 | // +-------+ +-------+ +---------+ +---------+ |
| 4806 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4807 | // +-------+ +-------+ +---------+ +---------+ |
| 4808 | // | | | | |
| 4809 | // | | RESTSubReq1 | | |
| 4810 | // | |---------------->| | |
| 4811 | // | | | | |
| 4812 | // | | RESTSubResp1 | | |
| 4813 | // | |<----------------| | |
| 4814 | // | | | | |
| 4815 | // | | | SubReq1 | |
| 4816 | // | | |------------->| |
| 4817 | // | | | SubResp1 | |
| 4818 | // | | |<-------------| |
| 4819 | // | | RESTNotif1 | | |
| 4820 | // | |<----------------| | |
| 4821 | // | | | | |
| 4822 | // | RESTSubReq2 | | |
| 4823 | // |------------------------------>| | |
| 4824 | // | | | | |
| 4825 | // | RESTSubResp2 | | |
| 4826 | // |<------------------------------| | |
| 4827 | // | | | | |
| 4828 | // | | RESTNotif2 | | |
| 4829 | // |<------------------------------| | |
| 4830 | // | | | | |
| 4831 | // | | RESTSubDelReq1 | | |
| 4832 | // | |---------------->| | |
| 4833 | // | | | | |
| 4834 | // | | RESTSubDelResp1 | | |
| 4835 | // | |<----------------| | |
| 4836 | // | | | | |
| 4837 | // | RESTSubDelReq2 | | |
| 4838 | // |------------------------------>| | |
| 4839 | // | | | | |
| 4840 | // | RESTSubDelResp2 | | |
| 4841 | // |<------------------------------| | |
| 4842 | // | | | | |
| 4843 | // | | | SubDelReq2 | |
| 4844 | // | | |------------->| |
| 4845 | // | | | | |
| 4846 | // | | | SubDelResp2 | |
| 4847 | // | | |<-------------| |
| 4848 | // | | | | |
| 4849 | // |
| 4850 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 4851 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4852 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4853 | |
| 4854 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4855 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4856 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4857 | Counter{cSubReqToE2, 1}, |
| 4858 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4859 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4860 | Counter{cMergedSubscriptions, 1}, |
| 4861 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4862 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4863 | Counter{cSubDelReqToE2, 1}, |
| 4864 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4865 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4866 | }) |
| 4867 | |
| 4868 | // Req1 |
| 4869 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4870 | |
| 4871 | //Subs Create |
| 4872 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4873 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4874 | |
| 4875 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4876 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4877 | params.SetMeid("RAN_NAME_1") |
| 4878 | |
| 4879 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4880 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4881 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4882 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 4883 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4884 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4885 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4886 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4887 | |
| 4888 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4889 | |
| 4890 | // Del1 |
| 4891 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4892 | |
| 4893 | // Del2 |
| 4894 | deleteXapp2Subscription(t, &restSubId2) |
| 4895 | |
| 4896 | //Wait that subs is cleaned |
| 4897 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4898 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4899 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4900 | } |
| 4901 | |
| 4902 | //----------------------------------------------------------------------------- |
| 4903 | // TestSubReqAndSubDelOkSameActionParallel |
| 4904 | // |
| 4905 | // stub stub stub |
| 4906 | // +-------+ +-------+ +---------+ +---------+ |
| 4907 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4908 | // +-------+ +-------+ +---------+ +---------+ |
| 4909 | // | | | | |
| 4910 | // | | | | |
| 4911 | // | | | | |
| 4912 | // | | SubReq1 | | |
| 4913 | // | |------------->| | |
| 4914 | // | | | | |
| 4915 | // | | | SubReq1 | |
| 4916 | // | | |------------->| |
| 4917 | // | SubReq2 | | |
| 4918 | // |--------------------------->| | |
| 4919 | // | | | SubResp1 | |
| 4920 | // | | |<-------------| |
| 4921 | // | | SubResp1 | | |
| 4922 | // | |<-------------| | |
| 4923 | // | | | SubReq2 | |
| 4924 | // | | |------------->| |
| 4925 | // | | | | |
| 4926 | // | | | SubResp2 | |
| 4927 | // | | |<-------------| |
| 4928 | // | SubResp2 | | |
| 4929 | // |<---------------------------| | |
| 4930 | // | | | | |
| 4931 | // | | SubDelReq 1 | | |
| 4932 | // | |------------->| | |
| 4933 | // | | | | |
| 4934 | // | | SubDelResp 1 | | |
| 4935 | // | |<-------------| | |
| 4936 | // | | | | |
| 4937 | // | SubDelReq 2 | | |
| 4938 | // |--------------------------->| | |
| 4939 | // | | | | |
| 4940 | // | | | SubDelReq 2 | |
| 4941 | // | | |------------->| |
| 4942 | // | | | | |
| 4943 | // | | | SubDelReq 2 | |
| 4944 | // | | |------------->| |
| 4945 | // | | | | |
| 4946 | // | SubDelResp 2 | | |
| 4947 | // |<---------------------------| | |
| 4948 | // |
| 4949 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4950 | |
| 4951 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4952 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4953 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4954 | Counter{cSubReqToE2, 2}, |
| 4955 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4956 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4957 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4958 | Counter{cSubDelReqToE2, 2}, |
| 4959 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4960 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4961 | }) |
| 4962 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4963 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4964 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4965 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4966 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4967 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4968 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4969 | |
| 4970 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4971 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4972 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4973 | |
| 4974 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4975 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4976 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4977 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4978 | |
| 4979 | // Del1 |
| 4980 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4981 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4982 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4983 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4984 | |
| 4985 | // Del2 |
| 4986 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4987 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4988 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4989 | |
| 4990 | waitSubsCleanup(t, e2SubsId2, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4991 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 4992 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4993 | } |
| 4994 | |
| 4995 | //----------------------------------------------------------------------------- |
| 4996 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4997 | // |
| 4998 | // stub stub stub |
| 4999 | // +-------+ +-------+ +---------+ +---------+ |
| 5000 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5001 | // +-------+ +-------+ +---------+ +---------+ |
| 5002 | // | | | | |
| 5003 | // | | | | |
| 5004 | // | | | | |
| 5005 | // | | RESTSubReq1 | | |
| 5006 | // | |---------------->| | |
| 5007 | // | | | | |
| 5008 | // | | RESTSubResp1 | | |
| 5009 | // | |<----------------| | |
| 5010 | // | | | SubReq1 | |
| 5011 | // | | |------------->| |
| 5012 | // | RESTSubReq2 | | |
| 5013 | // |------------------------------>| | |
| 5014 | // | | | | |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5015 | // | RESTSubResp2 | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5016 | // |<------------------------------| | |
| 5017 | // | | | SubReq1 | |
| 5018 | // | | |------------->| |
| 5019 | // | | | | |
| 5020 | // | | | | |
| 5021 | // | | | SubDelReq | |
| 5022 | // | | |------------->| |
| 5023 | // | | | | |
| 5024 | // | | | SubDelResp | |
| 5025 | // | | |<-------------| |
| 5026 | // | | RESTNotif1 | | |
| 5027 | // | | unsuccess | | |
| 5028 | // | |<----------------| | |
| 5029 | // | RESTNotif2 | | |
| 5030 | // | | unsuccess | | |
| 5031 | // |<------------------------------| | |
| 5032 | // | | | | |
| 5033 | // | | RESTSubDelReq1 | | |
| 5034 | // | |---------------->| | |
| 5035 | // | | | | |
| 5036 | // | | RESTSubDelResp1 | | |
| 5037 | // | |<----------------| | |
| 5038 | // | | | | |
| 5039 | // | RESTSubDelReq2 | | |
| 5040 | // |------------------------------>| | |
| 5041 | // | | | | |
| 5042 | // | RESTSubDelResp2 | | |
| 5043 | // |<------------------------------| | |
| 5044 | // |
| 5045 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5046 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5047 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5048 | |
| 5049 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5050 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5051 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5052 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5053 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5054 | Counter{cSubReqTimerExpiry, 2}, |
| 5055 | Counter{cSubReReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5056 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5057 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5058 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5059 | Counter{cSubDelReqToE2, 1}, |
| 5060 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5061 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5062 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5063 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5064 | |
| 5065 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5066 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5067 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 5068 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 5069 | |
| 5070 | // Req2 |
| 5071 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5072 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5073 | params2.SetMeid("RAN_NAME_1") |
| 5074 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5075 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5076 | |
| 5077 | //Req1 (retransmitted) |
| 5078 | e2termConn1.RecvSubsReq(t) |
| 5079 | |
| 5080 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5081 | |
| 5082 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5083 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5084 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5085 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5086 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5087 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5088 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5089 | |
| 5090 | // Del1 |
| 5091 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5092 | |
| 5093 | // Del2 |
| 5094 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5095 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5096 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 5097 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5098 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5099 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5100 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5101 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5102 | } |
| 5103 | |
| 5104 | //----------------------------------------------------------------------------- |
| 5105 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 5106 | // |
| 5107 | // stub stub stub |
| 5108 | // +-------+ +-------+ +---------+ +---------+ |
| 5109 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5110 | // +-------+ +-------+ +---------+ +---------+ |
| 5111 | // | | | | |
| 5112 | // | | | | |
| 5113 | // | | | | |
| 5114 | // | | RESTSubReq1 | | |
| 5115 | // | |---------------->| | |
| 5116 | // | | | | |
| 5117 | // | | RESTSubResp1 | | |
| 5118 | // | |<----------------| | |
| 5119 | // | | | SubReq1 | |
| 5120 | // | | |------------->| |
| 5121 | // | RESTSubReq2 | | |
| 5122 | // |------------------------------>| | |
| 5123 | // | | | | |
| 5124 | // | RESTSubDelResp2 | | |
| 5125 | // |<------------------------------| | |
| 5126 | // | | | SubFail1 | |
| 5127 | // | | |<-------------| |
| 5128 | // | | | | |
| 5129 | // | | RESTNotif1 | | |
| 5130 | // | | unsuccess | | |
| 5131 | // | |<----------------| | |
| 5132 | // | RESTNotif2 | | |
| 5133 | // | | unsuccess | | |
| 5134 | // |<------------------------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5135 | // | | | | |
Anssi Mannila | 3e55f47 | 2021-11-05 09:58:04 +0200 | [diff] [blame] | 5136 | // | | 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] | 5137 | // | |---------------->| | |
| 5138 | // | | | | |
| 5139 | // | | RESTSubDelResp1 | | |
| 5140 | // | |<----------------| | |
| 5141 | // | | | | |
| 5142 | // | RESTSubDelReq2 | | |
| 5143 | // |------------------------------>| | |
| 5144 | // | | | | |
| 5145 | // | RESTSubDelResp2 | | |
| 5146 | // |<------------------------------| | |
| 5147 | // |
| 5148 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5149 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5150 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5151 | |
| 5152 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5153 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5154 | Counter{cMergedSubscriptions, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5155 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5156 | Counter{cSubReqToE2, 1}, |
| 5157 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5158 | Counter{cRestSubFailNotifToXapp, 2}, |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5159 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5160 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5161 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5162 | }) |
| 5163 | |
| 5164 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5165 | |
| 5166 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5167 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5168 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5169 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5170 | |
| 5171 | // Req2 |
| 5172 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5173 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5174 | params2.SetMeid("RAN_NAME_1") |
| 5175 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 5176 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 5177 | |
| 5178 | // E2t: send SubsFail (first) |
| 5179 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5180 | fparams1.Set(crereq1) |
| 5181 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5182 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5183 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5184 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5185 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5186 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5187 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5188 | |
| 5189 | // Del1 |
| 5190 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5191 | |
| 5192 | // Del2 |
| 5193 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 5194 | |
| 5195 | //Wait that subs is cleaned |
| 5196 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 5197 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5198 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5199 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5200 | } |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5201 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5202 | //----------------------------------------------------------------------------- |
| 5203 | // TestRESTSubReqPolicyAndSubDelOk |
| 5204 | // |
| 5205 | // stub stub |
| 5206 | // +-------+ +---------+ +---------+ |
| 5207 | // | xapp | | submgr | | e2term | |
| 5208 | // +-------+ +---------+ +---------+ |
| 5209 | // | | | |
| 5210 | // | RESTSubReq | | |
| 5211 | // |--------------->| | |
| 5212 | // | RESTSubResp | | |
| 5213 | // |<---------------| | |
| 5214 | // | | | |
| 5215 | // | | SubReq | |
| 5216 | // | |------------->| |
| 5217 | // | | | |
| 5218 | // | | SubResp | |
| 5219 | // | |<-------------| |
| 5220 | // | | | |
| 5221 | // | RESTNotif | | |
| 5222 | // |<---------------| | |
| 5223 | // | | | |
| 5224 | // | | | |
| 5225 | // | RESTSubDelReq | | |
| 5226 | // |--------------->| | |
| 5227 | // | RESTSubDelResp | | |
| 5228 | // |<---------------| | |
| 5229 | // | | | |
| 5230 | // | | SubDelReq | |
| 5231 | // | |------------->| |
| 5232 | // | | | |
| 5233 | // | | SubDelResp | |
| 5234 | // | |<-------------| |
| 5235 | // | | | |
| 5236 | // |
| 5237 | //----------------------------------------------------------------------------- |
| 5238 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5240 | |
| 5241 | // Init counter check |
| 5242 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5243 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5244 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5245 | Counter{cSubReqToE2, 1}, |
| 5246 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5247 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5248 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5249 | Counter{cSubDelReqToE2, 1}, |
| 5250 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5251 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5252 | }) |
| 5253 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5254 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5255 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5256 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5257 | |
| 5258 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5259 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5260 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5261 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5262 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5263 | |
| 5264 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5265 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5266 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5267 | |
| 5268 | // Wait that subs is cleaned |
| 5269 | waitSubsCleanup(t, e2SubsId, 10) |
| 5270 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5271 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5272 | } |
| 5273 | |
| 5274 | //----------------------------------------------------------------------------- |
| 5275 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 5276 | // |
| 5277 | // stub stub |
| 5278 | // +-------+ +---------+ +---------+ |
| 5279 | // | xapp | | submgr | | e2term | |
| 5280 | // +-------+ +---------+ +---------+ |
| 5281 | // | | | |
| 5282 | // | RESTSubReq | | |
| 5283 | // |---------------->| | |
| 5284 | // | | | |
| 5285 | // | RESTSubResp | | |
| 5286 | // |<----------------| | |
| 5287 | // | | SubReq | |
| 5288 | // | |------------->| |
| 5289 | // | | | |
| 5290 | // | | SubResp | |
| 5291 | // | |<-------------| |
| 5292 | // | | | |
| 5293 | // | RESTNotif | | |
| 5294 | // |<----------------| | |
| 5295 | // | | | |
| 5296 | // | RESTSubReq | | |
| 5297 | // |---------------->| | |
| 5298 | // | | | |
| 5299 | // | RESTSubResp | | |
| 5300 | // |<----------------| | |
| 5301 | // | | SubReq | |
| 5302 | // | |------------->| |
| 5303 | // | | | |
| 5304 | // | | SubResp | |
| 5305 | // | |<-------------| |
| 5306 | // | | | |
| 5307 | // | RESTNotif | | |
| 5308 | // |<----------------| | |
| 5309 | // | | | |
| 5310 | // | RESTSubDelReq | | |
| 5311 | // |---------------->| | |
| 5312 | // | | | |
| 5313 | // | | SubDelReq | |
| 5314 | // | |------------->| |
| 5315 | // | | | |
| 5316 | // | | SubDelResp | |
| 5317 | // | |<-------------| |
| 5318 | // | | | |
| 5319 | // | RESTSubDelResp | | |
| 5320 | // |<----------------| | |
| 5321 | // |
| 5322 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5323 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5324 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5325 | |
| 5326 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5327 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5328 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5329 | Counter{cSubReqToE2, 2}, |
| 5330 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5331 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5332 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5333 | Counter{cSubDelReqToE2, 1}, |
| 5334 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5335 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5336 | }) |
| 5337 | |
| 5338 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5339 | const e2Timeout int64 = 1 |
| 5340 | const e2RetryCount int64 = 0 |
| 5341 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5342 | |
| 5343 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5344 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5345 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5346 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5347 | |
| 5348 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5349 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5350 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5351 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5352 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5353 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5354 | params.SetTimeToWait("w200ms") |
| 5355 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 5356 | |
| 5357 | // Del |
| 5358 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5359 | |
| 5360 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5361 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5362 | |
| 5363 | // Wait that subs is cleaned |
| 5364 | waitSubsCleanup(t, e2SubsId, 10) |
| 5365 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5366 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5367 | } |
| 5368 | |
| 5369 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5370 | // TestRESTSubReqPolicyChangeNOk |
| 5371 | // |
| 5372 | // stub stub |
| 5373 | // +-------+ +---------+ +---------+ |
| 5374 | // | xapp | | submgr | | e2term | |
| 5375 | // +-------+ +---------+ +---------+ |
| 5376 | // | | | |
| 5377 | // | RESTSubReq | | |
| 5378 | // |---------------->| | |
| 5379 | // | | | |
| 5380 | // | RESTSubResp | | |
| 5381 | // |<----------------| | |
| 5382 | // | | SubReq | |
| 5383 | // | |------------->| |
| 5384 | // | | | |
| 5385 | // | | SubResp | |
| 5386 | // | |<-------------| |
| 5387 | // | | | |
| 5388 | // | RESTNotif | | |
| 5389 | // |<----------------| | |
| 5390 | // | | | |
| 5391 | // | RESTSubReq | | |
| 5392 | // |---------------->| | |
| 5393 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5394 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5395 | // | | | |
| 5396 | // | RESTSubDelReq | | |
| 5397 | // |---------------->| | |
| 5398 | // | | | |
| 5399 | // | | SubDelReq | |
| 5400 | // | |------------->| |
| 5401 | // | | | |
| 5402 | // | | SubDelResp | |
| 5403 | // | |<-------------| |
| 5404 | // | | | |
| 5405 | // | RESTSubDelResp | | |
| 5406 | // |<----------------| | |
| 5407 | // |
| 5408 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5409 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5410 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5411 | |
| 5412 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5413 | Counter{cRestSubReqFromXapp, 2}, |
| 5414 | Counter{cRestSubRespToXapp, 1}, |
| 5415 | Counter{cSubReqToE2, 1}, |
| 5416 | Counter{cSubRespFromE2, 1}, |
| 5417 | Counter{cRestSubNotifToXapp, 1}, |
| 5418 | Counter{cRestSubFailToXapp, 1}, |
| 5419 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5420 | Counter{cSubDelReqToE2, 1}, |
| 5421 | Counter{cSubDelRespFromE2, 1}, |
| 5422 | Counter{cRestSubDelRespToXapp, 1}, |
| 5423 | }) |
| 5424 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5425 | // Req |
| 5426 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5427 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5428 | |
| 5429 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5430 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 5431 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5432 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5433 | params.SetSubscriptionID(&restSubIdUpd) |
| 5434 | params.SetTimeToWait("w200ms") |
| 5435 | |
| 5436 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 5437 | assert.Equal(t, restSubId2, "") |
| 5438 | |
| 5439 | // Del |
| 5440 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5441 | |
| 5442 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5443 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5444 | |
| 5445 | // Wait that subs is cleaned |
| 5446 | waitSubsCleanup(t, e2SubsId, 10) |
| 5447 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5448 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 5449 | } |
| 5450 | |
| 5451 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5452 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 5453 | // |
| 5454 | // stub stub stub |
| 5455 | // +-------+ +---------+ +---------+ +---------+ |
| 5456 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 5457 | // +-------+ +---------+ +---------+ +---------+ |
| 5458 | // | | | | |
| 5459 | // | | | | |
| 5460 | // | | | | |
| 5461 | // | RESTSubReq1 | | | |
| 5462 | // |---------------->| | | |
| 5463 | // | | | | |
| 5464 | // | RESTSubResp1 | | | |
| 5465 | // |<----------------| | | |
| 5466 | // | | SubReq1 | | |
| 5467 | // | |------------->| | |
| 5468 | // | | | | |
| 5469 | // | RESTSubReq2 | | | |
| 5470 | // |---------------->| | | |
| 5471 | // | | | | |
| 5472 | // | RESTSubResp2 | | | |
| 5473 | // |<----------------| | | |
| 5474 | // | | SubReq2 | | |
| 5475 | // | |---------------------------->| |
| 5476 | // | | | | |
| 5477 | // | | SubResp1 | | |
| 5478 | // | |<-------------| | |
| 5479 | // | RESTNotif1 | | | |
| 5480 | // |<----------------| | | |
| 5481 | // | | SubResp2 | | |
| 5482 | // | |<----------------------------| |
| 5483 | // | RESTNotif2 | | | |
| 5484 | // |<----------------| | | |
| 5485 | // | | | | |
| 5486 | // | [SUBS 1 DELETE] | | |
| 5487 | // | | | | |
| 5488 | // | [SUBS 2 DELETE] | | |
| 5489 | // | | | | |
| 5490 | // |
| 5491 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5492 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5493 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5494 | |
| 5495 | // Init counter check |
| 5496 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5497 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5498 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5499 | Counter{cSubReqToE2, 2}, |
| 5500 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5501 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5502 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5503 | Counter{cSubDelReqToE2, 2}, |
| 5504 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5505 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5506 | }) |
| 5507 | |
| 5508 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5509 | |
| 5510 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5511 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5512 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 5513 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5514 | |
| 5515 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5516 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5517 | params.SetMeid("RAN_NAME_11") |
| 5518 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 5519 | // would not work as notification would not be received |
| 5520 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5521 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 5522 | |
| 5523 | // Resp1 |
| 5524 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 5525 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5526 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5527 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5528 | |
| 5529 | // Resp2 |
| 5530 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5531 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 5532 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5533 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5534 | |
| 5535 | // Delete1 |
| 5536 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 5537 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5538 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5539 | |
| 5540 | // Wait that subs is cleaned |
| 5541 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 5542 | |
| 5543 | // Delete2 |
| 5544 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 5545 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 5546 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 5547 | |
| 5548 | // Wait that subs is cleaned |
| 5549 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5550 | |
| 5551 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5552 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5553 | } |
| 5554 | |
| 5555 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5556 | // TestRESTSubReqInsertAndSubDelOk |
| 5557 | // |
| 5558 | // stub stub |
| 5559 | // +-------+ +---------+ +---------+ |
| 5560 | // | xapp | | submgr | | e2term | |
| 5561 | // +-------+ +---------+ +---------+ |
| 5562 | // | | | |
| 5563 | // | RestSubReq | | |
| 5564 | // |---------------->| | |
| 5565 | // | | | |
| 5566 | // | RESTSubResp | | |
| 5567 | // |<----------------| | |
| 5568 | // | | | |
| 5569 | // | | SubReq | |
| 5570 | // | |------------->| |
| 5571 | // | | | |
| 5572 | // | | SubResp | |
| 5573 | // | |<-------------| |
| 5574 | // | RESTNotif | | |
| 5575 | // |<----------------| | |
| 5576 | // | ... | ... | |
| 5577 | // | | | |
| 5578 | // | RESTSubDelReq | | |
| 5579 | // |---------------->| | |
| 5580 | // | | | |
| 5581 | // | | SubDelReq | |
| 5582 | // | |------------->| |
| 5583 | // | | | |
| 5584 | // | | SubDelResp | |
| 5585 | // | |<-------------| |
| 5586 | // | | | |
| 5587 | // | RESTSubDelResp| | |
| 5588 | // |<----------------| | |
| 5589 | // |
| 5590 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5591 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5592 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5593 | |
| 5594 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5595 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5596 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5597 | Counter{cSubReqToE2, 1}, |
| 5598 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5599 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5600 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5601 | Counter{cSubDelReqToE2, 1}, |
| 5602 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5603 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5604 | }) |
| 5605 | |
| 5606 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5607 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5608 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5609 | params.SetSubActionTypes("insert") |
| 5610 | |
| 5611 | // Req |
| 5612 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5613 | |
| 5614 | // Del |
| 5615 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5616 | |
| 5617 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5618 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5619 | |
| 5620 | // Wait that subs is cleaned |
| 5621 | waitSubsCleanup(t, e2SubsId, 10) |
| 5622 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5623 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5624 | } |
| 5625 | |
| 5626 | //----------------------------------------------------------------------------- |
| 5627 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 5628 | // |
| 5629 | // stub stub |
| 5630 | // +-------+ +---------+ +---------+ |
| 5631 | // | xapp | | submgr | | e2term | |
| 5632 | // +-------+ +---------+ +---------+ |
| 5633 | // | | | |
| 5634 | // | RESTSubReq | | |
| 5635 | // |------------->| | |
| 5636 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5637 | // | RESTSubResp | | |
| 5638 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5639 | // | | SubReq | |
| 5640 | // | |------------->| |
| 5641 | // | | | |
| 5642 | // | | SubResp | |
| 5643 | // | <----| |
| 5644 | // | | |
| 5645 | // | Submgr restart | |
| 5646 | // | | |
| 5647 | // | | | |
| 5648 | // | | SubDelReq | |
| 5649 | // | |------------->| |
| 5650 | // | | | |
| 5651 | // | | SubDelResp | |
| 5652 | // | |<-------------| |
| 5653 | // | | | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5654 | // | RESTNotif | | |
| 5655 | // | unsuccess | | |
| 5656 | // |<-------------| | |
| 5657 | // | | | |
| 5658 | // | RESTSubDelReq| | |
| 5659 | // |------------->| | |
| 5660 | // | | | |
| 5661 | // |RESTSubDelResp| | |
| 5662 | // |<-------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5663 | // |
| 5664 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5665 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5666 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5667 | |
| 5668 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5669 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5670 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5671 | Counter{cSubReqToE2, 1}, |
| 5672 | Counter{cSubDelReqFromXapp, 1}, |
| 5673 | Counter{cSubDelReqToE2, 1}, |
| 5674 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5675 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5676 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5677 | }) |
| 5678 | |
| 5679 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5680 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5681 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5682 | |
| 5683 | //Req |
| 5684 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 5685 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5686 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5687 | |
| 5688 | e2termConn1.RecvSubsReq(t) |
| 5689 | |
| 5690 | mainCtrl.SetResetTestFlag(t, false) |
| 5691 | |
| 5692 | mainCtrl.SimulateRestart(t) |
| 5693 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 5694 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5695 | // Deleletion of uncompleted subscription |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5696 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5697 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5698 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5699 | //Del |
| 5700 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5701 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5702 | xappConn1.TestMsgChanEmpty(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5703 | e2termConn1.TestMsgChanEmpty(t) |
| 5704 | mainCtrl.wait_registry_empty(t, 10) |
| 5705 | |
| 5706 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5707 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5708 | } |
| 5709 | |
| 5710 | //----------------------------------------------------------------------------- |
| 5711 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 5712 | // |
| 5713 | // stub stub |
| 5714 | // +-------+ +---------+ +---------+ |
| 5715 | // | xapp | | submgr | | e2term | |
| 5716 | // +-------+ +---------+ +---------+ |
| 5717 | // | | | |
| 5718 | // | RESTSubReq | | |
| 5719 | // |---------------->| | |
| 5720 | // | | | |
| 5721 | // | RESTSubResp | | |
| 5722 | // |<----------------| | |
| 5723 | // | | SubReq | |
| 5724 | // | |------------->| |
| 5725 | // | | | |
| 5726 | // | | SubResp | |
| 5727 | // | |<-------------| |
| 5728 | // | | | |
| 5729 | // | RESTNotif | | |
| 5730 | // |<----------------| | |
| 5731 | // | | | |
| 5732 | // | | |
| 5733 | // | Submgr restart | |
| 5734 | // | | | |
| 5735 | // | RESTSubDelReq | | |
| 5736 | // |---------------->| | |
| 5737 | // | | | |
| 5738 | // | | SubDelReq | |
| 5739 | // | |------------->| |
| 5740 | // | | | |
| 5741 | // | | SubDelResp | |
| 5742 | // | |<-------------| |
| 5743 | // | | | |
| 5744 | // | RESTSubDelResp | | |
| 5745 | // |<----------------| | |
| 5746 | // |
| 5747 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5748 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5749 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5750 | |
| 5751 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5752 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5753 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5754 | Counter{cSubReqToE2, 1}, |
| 5755 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5756 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5757 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5758 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 5759 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5760 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5761 | }) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5762 | |
| 5763 | // Create subscription |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5764 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5765 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5766 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5767 | |
| 5768 | // Check subscription |
| 5769 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5770 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5771 | mainCtrl.SimulateRestart(t) |
| 5772 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5773 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5774 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5775 | // That needs to be completed before successful subscription query is possible |
| 5776 | <-time.After(time.Second * 1) |
| 5777 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5778 | // Check subscription |
| 5779 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5780 | |
| 5781 | // Delete subscription |
| 5782 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 5783 | |
| 5784 | //Wait that subs is cleaned |
| 5785 | waitSubsCleanup(t, e2SubsId, 10) |
| 5786 | |
| 5787 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5788 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5789 | } |
| 5790 | |
| 5791 | //----------------------------------------------------------------------------- |
| 5792 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 5793 | // |
| 5794 | // stub stub |
| 5795 | // +-------+ +-------+ +---------+ +---------+ |
| 5796 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 5797 | // +-------+ +-------+ +---------+ +---------+ |
| 5798 | // | | | | |
| 5799 | // | | RESTSubReq1 | | |
| 5800 | // | |---------------->| | |
| 5801 | // | | | | |
| 5802 | // | | RESTSubResp1 | | |
| 5803 | // | |<----------------| | |
| 5804 | // | | | | |
| 5805 | // | | | SubReq1 | |
| 5806 | // | | |------------->| |
| 5807 | // | | | SubResp1 | |
| 5808 | // | | |<-------------| |
| 5809 | // | | RESTNotif1 | | |
| 5810 | // | |<----------------| | |
| 5811 | // | | | | |
| 5812 | // | RESTSubReq2 | | |
| 5813 | // |------------------------------>| | |
| 5814 | // | | | | |
| 5815 | // | RESTSubResp2 | | |
| 5816 | // |<------------------------------| | |
| 5817 | // | | | | |
| 5818 | // | | RESTNotif2 | | |
| 5819 | // |<------------------------------| | |
| 5820 | // | | | | |
| 5821 | // | | Submgr restart | |
| 5822 | // | | | | |
| 5823 | // | | RESTSubDelReq1 | | |
| 5824 | // | |---------------->| | |
| 5825 | // | | | | |
| 5826 | // | | RESTSubDelResp1 | | |
| 5827 | // | |<----------------| | |
| 5828 | // | | | | |
| 5829 | // | | Submgr restart | |
| 5830 | // | | | | |
| 5831 | // | RESTSubDelReq2 | | |
| 5832 | // |------------------------------>| | |
| 5833 | // | | | | |
| 5834 | // | RESTSubDelResp2 | | |
| 5835 | // |<------------------------------| | |
| 5836 | // | | | | |
| 5837 | // | | | SubDelReq2 | |
| 5838 | // | | |------------->| |
| 5839 | // | | | | |
| 5840 | // | | | SubDelResp2 | |
| 5841 | // | | |<-------------| |
| 5842 | // | | | | |
| 5843 | // |
| 5844 | //----------------------------------------------------------------------------- |
| 5845 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5846 | |
| 5847 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5848 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5849 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5850 | Counter{cSubReqToE2, 1}, |
| 5851 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5852 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5853 | Counter{cMergedSubscriptions, 1}, |
| 5854 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5855 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5856 | Counter{cSubDelReqToE2, 1}, |
| 5857 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5858 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5859 | }) |
| 5860 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5861 | // Create subscription 1 |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5862 | var params *teststube2ap.RESTSubsReqParams = nil |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5863 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5864 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5865 | |
| 5866 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5867 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5868 | params.SetMeid("RAN_NAME_1") |
| 5869 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5870 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5871 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5872 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 5873 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5874 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5875 | |
| 5876 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 5877 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5878 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5879 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 1") |
| 5880 | |
| 5881 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5882 | // That needs to be completed before successful subscription delete is possible |
| 5883 | <-time.After(time.Second * 1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5884 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5885 | // Delete subscription 1, and wait until it has removed the first endpoint |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5886 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Anssi Mannila | fc20a5c | 2021-12-14 10:28:20 +0200 | [diff] [blame] | 5887 | mainCtrl.WaitRESTSubscriptionDelete(restSubId1) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5888 | // 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] | 5889 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5890 | mainCtrl.SimulateRestart(t) |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 5891 | xapp.Logger.Debug("mainCtrl.SimulateRestart done 2") |
| 5892 | |
| 5893 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 5894 | // That needs to be completed before successful subscription query is possible |
| 5895 | <-time.After(time.Second * 1) |
| 5896 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5897 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 5898 | |
| 5899 | // Delete subscription 2 |
| 5900 | deleteXapp2Subscription(t, &restSubId2) |
| 5901 | |
| 5902 | //Wait that subs is cleaned |
| 5903 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5904 | |
| 5905 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 5906 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5907 | } |
| 5908 | |
| 5909 | //----------------------------------------------------------------------------- |
| 5910 | // TestRESTReportSubReqAndSubDelOk |
| 5911 | // |
| 5912 | // stub stub |
| 5913 | // +-------+ +---------+ +---------+ |
| 5914 | // | xapp | | submgr | | e2term | |
| 5915 | // +-------+ +---------+ +---------+ |
| 5916 | // | | | |
| 5917 | // | RestSubReq | | |
| 5918 | // |---------------->| | |
| 5919 | // | | | |
| 5920 | // | RESTSubResp | | |
| 5921 | // |<----------------| | |
| 5922 | // | | | |
| 5923 | // | | SubReq | |
| 5924 | // | |------------->| |
| 5925 | // | | | |
| 5926 | // | | SubResp | |
| 5927 | // | |<-------------| |
| 5928 | // | RESTNotif | | |
| 5929 | // |<----------------| | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 5930 | // | | SubReq | // Only one request sent in the teat case |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5931 | // | |------------->| |
| 5932 | // | | | |
| 5933 | // | | SubResp | |
| 5934 | // | |<-------------| |
| 5935 | // | RESTNotif | | |
| 5936 | // |<----------------| | |
| 5937 | // | ... | ... | |
| 5938 | // | | | |
| 5939 | // | | | |
| 5940 | // | RESTSubDelReq | | |
| 5941 | // |---------------->| | |
| 5942 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 5943 | // | RESTSubDelResp| | |
| 5944 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5945 | // | | SubDelReq | |
| 5946 | // | |------------->| |
| 5947 | // | | | |
| 5948 | // | | SubDelResp | |
| 5949 | // | |<-------------| |
| 5950 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5951 | // |
| 5952 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5953 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5954 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5955 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5956 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5957 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5958 | } |
| 5959 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5960 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5961 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5962 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 5963 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 5964 | Counter{cRestSubReqFromXapp, 1}, |
| 5965 | Counter{cRestSubRespToXapp, 1}, |
| 5966 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5967 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 5968 | Counter{cRestSubNotifToXapp, 1}, |
| 5969 | Counter{cRestSubDelReqFromXapp, 1}, |
| 5970 | Counter{cRestSubDelRespToXapp, 1}, |
| 5971 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5972 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 5973 | }) |
| 5974 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5975 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5976 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5977 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5978 | |
| 5979 | var e2SubsId []uint32 |
| 5980 | for i := 0; i < subReqCount; i++ { |
| 5981 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5982 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5983 | |
| 5984 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5985 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5986 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5987 | e2SubsId = append(e2SubsId, instanceId) |
| 5988 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5989 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5990 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5991 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5992 | |
| 5993 | } |
| 5994 | |
| 5995 | // Del |
| 5996 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5997 | |
| 5998 | for i := 0; i < subReqCount; i++ { |
| 5999 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6000 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6001 | } |
| 6002 | |
| 6003 | // Wait that subs is cleaned |
| 6004 | for i := 0; i < subReqCount; i++ { |
| 6005 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 6006 | } |
| 6007 | |
| 6008 | xappConn1.TestMsgChanEmpty(t) |
| 6009 | e2termConn1.TestMsgChanEmpty(t) |
| 6010 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6011 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 6012 | mainCtrl.VerifyCounterValues(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6013 | } |
| 6014 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6015 | //----------------------------------------------------------------------------- |
| 6016 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6017 | // |
| 6018 | // stub stub |
| 6019 | // +-------+ +---------+ +---------+ |
| 6020 | // | xapp | | submgr | | e2term | |
| 6021 | // +-------+ +---------+ +---------+ |
| 6022 | // | | | |
| 6023 | // | RestSubReq | | |
| 6024 | // |---------------->| | |
| 6025 | // | | | |
| 6026 | // | RESTSubResp | | |
| 6027 | // |<----------------| | |
| 6028 | // | | | |
| 6029 | // | | SubReq | |
| 6030 | // | |------------->| |
| 6031 | // | | | |
| 6032 | // | | SubResp | |
| 6033 | // | |<-------------| |
| 6034 | // | RESTNotif | | |
| 6035 | // |<----------------| | |
| 6036 | // | | SubReq | |
| 6037 | // | |------------->| |
| 6038 | // | | | |
| 6039 | // | | SubResp | |
| 6040 | // | |<-------------| |
| 6041 | // | RESTNotif | | |
| 6042 | // |<----------------| | |
| 6043 | // | | | |
| 6044 | // | RESTSubDelReq | | |
| 6045 | // |---------------->| | |
| 6046 | // | | | |
| 6047 | // | RESTSubDelResp| | |
| 6048 | // |<----------------| | |
| 6049 | // | | SubDelReq | |
| 6050 | // | |------------->| |
| 6051 | // | | | |
| 6052 | // | | SubDelResp | |
| 6053 | // | |<-------------| |
| 6054 | // | | | |
| 6055 | // | | SubDelReq | |
| 6056 | // | |------------->| |
| 6057 | // | | | |
| 6058 | // | | SubDelResp | |
| 6059 | // | |<-------------| |
| 6060 | // | | | |
| 6061 | // |
| 6062 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6063 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6064 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 6065 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6066 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6067 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6068 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6069 | Counter{cSubReqToE2, 2}, |
| 6070 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6071 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6072 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6073 | Counter{cSubDelReqToE2, 2}, |
| 6074 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6075 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6076 | }) |
| 6077 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6078 | const subReqCount int = 2 |
| 6079 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6080 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6081 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6082 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6083 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6084 | |
| 6085 | assert.Equal(t, len(e2SubsIds), 2) |
| 6086 | |
| 6087 | // Del |
| 6088 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6089 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6090 | |
| 6091 | xappConn1.TestMsgChanEmpty(t) |
| 6092 | e2termConn1.TestMsgChanEmpty(t) |
| 6093 | mainCtrl.wait_registry_empty(t, 10) |
| 6094 | |
| 6095 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6096 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6097 | } |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6098 | |
| 6099 | //----------------------------------------------------------------------------- |
| 6100 | // TestRESTPolicySubReqAndSubDelOk19E2Subs |
| 6101 | // |
| 6102 | // stub stub |
| 6103 | // +-------+ +---------+ +---------+ |
| 6104 | // | xapp | | submgr | | e2term | |
| 6105 | // +-------+ +---------+ +---------+ |
| 6106 | // | | | |
| 6107 | // | RestSubReq | | |
| 6108 | // |---------------->| | |
| 6109 | // | | | |
| 6110 | // | RESTSubResp | | |
| 6111 | // |<----------------| | |
| 6112 | // | | | ------ |
| 6113 | // | | SubReq | |
| 6114 | // | |------------->| |
| 6115 | // | | | E2 subscription x 19 |
| 6116 | // | | SubResp | |
| 6117 | // | |<-------------| |
| 6118 | // | RESTNotif | | |
| 6119 | // |<----------------| | |
| 6120 | // | | | ------ |
| 6121 | // | RESTSubDelReq | | |
| 6122 | // |---------------->| | |
| 6123 | // | | | |
| 6124 | // | RESTSubDelResp| | |
| 6125 | // |<----------------| | |
| 6126 | // | | SubDelReq | ------ |
| 6127 | // | |------------->| |
| 6128 | // | | | E2 subscription delete x 19 |
| 6129 | // | | SubDelResp | |
| 6130 | // | |<-------------| |
| 6131 | // | | | ------ |
| 6132 | // | | | |
| 6133 | // |
| 6134 | //----------------------------------------------------------------------------- |
| 6135 | |
| 6136 | func TestRESTPolicySubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6137 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6138 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6139 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6140 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6141 | Counter{cSubReqToE2, 19}, |
| 6142 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6143 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6144 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6145 | Counter{cSubDelReqToE2, 19}, |
| 6146 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6147 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6148 | }) |
| 6149 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6150 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6151 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6152 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6153 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6154 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6155 | |
| 6156 | assert.Equal(t, len(e2SubsIds), 19) |
| 6157 | |
| 6158 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6159 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6160 | |
| 6161 | xappConn1.TestMsgChanEmpty(t) |
| 6162 | e2termConn1.TestMsgChanEmpty(t) |
| 6163 | mainCtrl.wait_registry_empty(t, 10) |
| 6164 | |
| 6165 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6166 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6167 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6168 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6169 | //----------------------------------------------------------------------------- |
| 6170 | // TestRESTTwoPolicySubReqAndSubDelOk |
| 6171 | // |
| 6172 | // stub stub |
| 6173 | // +-------+ +---------+ +---------+ |
| 6174 | // | xapp | | submgr | | e2term | |
| 6175 | // +-------+ +---------+ +---------+ |
| 6176 | // | | | |
| 6177 | // | RestSubReq | | |
| 6178 | // |---------------->| | |
| 6179 | // | | | |
| 6180 | // | RESTSubResp | | |
| 6181 | // |<----------------| | |
| 6182 | // | | | |
| 6183 | // | | SubReq | |
| 6184 | // | |------------->| |
| 6185 | // | | | |
| 6186 | // | | SubResp | |
| 6187 | // | |<-------------| |
| 6188 | // | RESTNotif | | |
| 6189 | // |<----------------| | |
| 6190 | // | | SubReq | |
| 6191 | // | |------------->| |
| 6192 | // | | | |
| 6193 | // | | SubResp | |
| 6194 | // | |<-------------| |
| 6195 | // | RESTNotif | | |
| 6196 | // |<----------------| | |
| 6197 | // | | | |
| 6198 | // | RESTSubDelReq | | |
| 6199 | // |---------------->| | |
| 6200 | // | | | |
| 6201 | // | RESTSubDelResp| | |
| 6202 | // |<----------------| | |
| 6203 | // | | SubDelReq | |
| 6204 | // | |------------->| |
| 6205 | // | | | |
| 6206 | // | | SubDelResp | |
| 6207 | // | |<-------------| |
| 6208 | // | | | |
| 6209 | // | | SubDelReq | |
| 6210 | // | |------------->| |
| 6211 | // | | | |
| 6212 | // | | SubDelResp | |
| 6213 | // | |<-------------| |
| 6214 | // | | | |
| 6215 | // |
| 6216 | //----------------------------------------------------------------------------- |
| 6217 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6218 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 6219 | |
| 6220 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6221 | |
| 6222 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6223 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6224 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6225 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6226 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6227 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6228 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6229 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6230 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6231 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6232 | }) |
| 6233 | |
| 6234 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6235 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6236 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6237 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6238 | |
| 6239 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6240 | |
| 6241 | // Del |
| 6242 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6243 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6244 | |
| 6245 | xappConn1.TestMsgChanEmpty(t) |
| 6246 | e2termConn1.TestMsgChanEmpty(t) |
| 6247 | mainCtrl.wait_registry_empty(t, 10) |
| 6248 | |
| 6249 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6250 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6251 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 6252 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6253 | //----------------------------------------------------------------------------- |
| 6254 | // TestRESTTwoReportSubReqAndSubDelOkNoActParams |
| 6255 | // |
| 6256 | // stub stub |
| 6257 | // +-------+ +---------+ +---------+ |
| 6258 | // | xapp | | submgr | | e2term | |
| 6259 | // +-------+ +---------+ +---------+ |
| 6260 | // | | | |
| 6261 | // | RestSubReq | | |
| 6262 | // |---------------->| | |
| 6263 | // | | | |
| 6264 | // | RESTSubResp | | |
| 6265 | // |<----------------| | |
| 6266 | // | | | |
| 6267 | // | | SubReq | |
| 6268 | // | |------------->| |
| 6269 | // | | | |
| 6270 | // | | SubResp | |
| 6271 | // | |<-------------| |
| 6272 | // | RESTNotif | | |
| 6273 | // |<----------------| | |
| 6274 | // | | SubReq | |
| 6275 | // | |------------->| |
| 6276 | // | | | |
| 6277 | // | | SubResp | |
| 6278 | // | |<-------------| |
| 6279 | // | RESTNotif | | |
| 6280 | // |<----------------| | |
| 6281 | // | | | |
| 6282 | // | RESTSubDelReq | | |
| 6283 | // |---------------->| | |
| 6284 | // | | | |
| 6285 | // | RESTSubDelResp| | |
| 6286 | // |<----------------| | |
| 6287 | // | | SubDelReq | |
| 6288 | // | |------------->| |
| 6289 | // | | | |
| 6290 | // | | SubDelResp | |
| 6291 | // | |<-------------| |
| 6292 | // | | | |
| 6293 | // | | SubDelReq | |
| 6294 | // | |------------->| |
| 6295 | // | | | |
| 6296 | // | | SubDelResp | |
| 6297 | // | |<-------------| |
| 6298 | // | | | |
| 6299 | // |
| 6300 | //----------------------------------------------------------------------------- |
| 6301 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6302 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 6303 | |
| 6304 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6305 | |
| 6306 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6307 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6308 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6309 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6310 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6311 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6312 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6313 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6314 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6315 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6316 | }) |
| 6317 | |
| 6318 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6319 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6320 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6321 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6322 | |
| 6323 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6324 | |
| 6325 | // Del |
| 6326 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6327 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6328 | |
| 6329 | xappConn1.TestMsgChanEmpty(t) |
| 6330 | e2termConn1.TestMsgChanEmpty(t) |
| 6331 | mainCtrl.wait_registry_empty(t, 10) |
| 6332 | |
| 6333 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6334 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6335 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 6336 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6337 | //----------------------------------------------------------------------------- |
| 6338 | // TestRESTReportSubReqAndSubDelOk19E2Subs |
| 6339 | // |
| 6340 | // stub stub |
| 6341 | // +-------+ +---------+ +---------+ |
| 6342 | // | xapp | | submgr | | e2term | |
| 6343 | // +-------+ +---------+ +---------+ |
| 6344 | // | | | |
| 6345 | // | RestSubReq | | |
| 6346 | // |---------------->| | |
| 6347 | // | | | |
| 6348 | // | RESTSubResp | | |
| 6349 | // |<----------------| | |
| 6350 | // | | | ------ |
| 6351 | // | | SubReq | |
| 6352 | // | |------------->| |
| 6353 | // | | | E2 subscription x 19 |
| 6354 | // | | SubResp | |
| 6355 | // | |<-------------| |
| 6356 | // | RESTNotif | | |
| 6357 | // |<----------------| | |
| 6358 | // | | | ------ |
| 6359 | // | RESTSubDelReq | | |
| 6360 | // |---------------->| | |
| 6361 | // | | | |
| 6362 | // | RESTSubDelResp| | |
| 6363 | // |<----------------| | |
| 6364 | // | | SubDelReq | ------ |
| 6365 | // | |------------->| |
| 6366 | // | | | E2 subscription delete x 19 |
| 6367 | // | | SubDelResp | |
| 6368 | // | |<-------------| |
| 6369 | // | | | ------ |
| 6370 | // | | | |
| 6371 | // |
| 6372 | //----------------------------------------------------------------------------- |
| 6373 | |
| 6374 | func TestRESTReportSubReqAndSubDelOk19E2Subs(t *testing.T) { |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6375 | |
| 6376 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6377 | |
| 6378 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6379 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6380 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6381 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 6382 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6383 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6384 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6385 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 6386 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6387 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6388 | }) |
| 6389 | |
| 6390 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6391 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6392 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6393 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 6394 | |
| 6395 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 6396 | |
| 6397 | // Del |
| 6398 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6399 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 6400 | |
| 6401 | xappConn1.TestMsgChanEmpty(t) |
| 6402 | e2termConn1.TestMsgChanEmpty(t) |
| 6403 | mainCtrl.wait_registry_empty(t, 10) |
| 6404 | |
| 6405 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6406 | mainCtrl.VerifyAllClean(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6407 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6408 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6409 | //----------------------------------------------------------------------------- |
| 6410 | // TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen |
| 6411 | // |
| 6412 | // stub stub stub |
| 6413 | // +-------+ +-------+ +---------+ +---------+ |
| 6414 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6415 | // +-------+ +-------+ +---------+ +---------+ |
| 6416 | // | | | | |
| 6417 | // | | RESTSubReq1 | | |
| 6418 | // | |------------->| | |
| 6419 | // | | RESTSubResp1 | | |
| 6420 | // | |<-------------| | |
| 6421 | // | | | | |
| 6422 | // | | | SubReq1 | |
| 6423 | // | | |------------->| |
| 6424 | // | | | | |
| 6425 | // | RESTSubReq2 | | |
| 6426 | // |------------------------>| | |
| 6427 | // | RESTSubResp2 | | |
| 6428 | // |<------------------------| | |
| 6429 | // | | | | |
| 6430 | // | | | SubReq2 | |
| 6431 | // | | |------------->| |
| 6432 | // | | | | |
| 6433 | // | | | SubResp1 | |
| 6434 | // | | |<-------------| |
| 6435 | // | | RESTNotif1 | | |
| 6436 | // | |<-------------| | |
| 6437 | // | | | | |
| 6438 | // | | | SubResp2 | |
| 6439 | // | | |<-------------| |
| 6440 | // | RESTNotif2 | | |
| 6441 | // |<------------------------| | |
| 6442 | // | | | | |
| 6443 | // | | [SUBS 1 DELETE] | |
| 6444 | // | | | | |
| 6445 | // | | [SUBS 2 DELETE] | |
| 6446 | // | | | | |
| 6447 | // |
| 6448 | //----------------------------------------------------------------------------- |
| 6449 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6450 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6451 | |
| 6452 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6453 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6454 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6455 | Counter{cSubReqToE2, 2}, |
| 6456 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6457 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6458 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6459 | Counter{cSubDelReqToE2, 2}, |
| 6460 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6461 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6462 | }) |
| 6463 | |
| 6464 | // Req1 |
| 6465 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6466 | |
| 6467 | //Subs Create |
| 6468 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6469 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6470 | |
| 6471 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6472 | |
| 6473 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6474 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6475 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6476 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6477 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 6478 | |
| 6479 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6480 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6481 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6482 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6483 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6484 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6485 | |
| 6486 | deleteXapp1Subscription(t, &restSubId1) |
| 6487 | deleteXapp2Subscription(t, &restSubId2) |
| 6488 | |
| 6489 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6490 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6491 | |
| 6492 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6493 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6494 | } |
| 6495 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6496 | //----------------------------------------------------------------------------- |
| 6497 | // TestRESTSubReqReportSameActionDiffActionListLen |
| 6498 | // |
| 6499 | // stub stub stub |
| 6500 | // +-------+ +-------+ +---------+ +---------+ |
| 6501 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6502 | // +-------+ +-------+ +---------+ +---------+ |
| 6503 | // | | | | |
| 6504 | // | | RESTSubReq1 | | |
| 6505 | // | |------------->| | |
| 6506 | // | | RESTSubResp1 | | |
| 6507 | // | |<-------------| | |
| 6508 | // | | | | |
| 6509 | // | | | SubReq1 | |
| 6510 | // | | |------------->| |
| 6511 | // | | | | |
| 6512 | // | RESTSubReq2 | | |
| 6513 | // |------------------------>| | |
| 6514 | // | RESTSubResp2 | | |
| 6515 | // |<------------------------| | |
| 6516 | // | | | | |
| 6517 | // | | | SubReq2 | |
| 6518 | // | | |------------->| |
| 6519 | // | | | | |
| 6520 | // | | | SubResp1 | |
| 6521 | // | | |<-------------| |
| 6522 | // | | RESTNotif1 | | |
| 6523 | // | |<-------------| | |
| 6524 | // | | | | |
| 6525 | // | | | SubResp2 | |
| 6526 | // | | |<-------------| |
| 6527 | // | RESTNotif2 | | |
| 6528 | // |<------------------------| | |
| 6529 | // | | | | |
| 6530 | // | | [SUBS 1 DELETE] | |
| 6531 | // | | | | |
| 6532 | // | | [SUBS 2 DELETE] | |
| 6533 | // | | | | |
| 6534 | // |
| 6535 | //----------------------------------------------------------------------------- |
| 6536 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6537 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6538 | |
| 6539 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6540 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6541 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6542 | Counter{cSubReqToE2, 2}, |
| 6543 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6544 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6545 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6546 | Counter{cSubDelReqToE2, 2}, |
| 6547 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6548 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6549 | }) |
| 6550 | |
| 6551 | // Req1 |
| 6552 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6553 | |
| 6554 | //Subs Create |
| 6555 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6556 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6557 | |
| 6558 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6559 | |
| 6560 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6561 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6562 | params.SetMeid("RAN_NAME_1") |
| 6563 | |
| 6564 | actionId := int64(1) |
| 6565 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6566 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6567 | subsequestActionType := "continue" |
| 6568 | timeToWait := "w10ms" |
| 6569 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 6570 | |
| 6571 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6572 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6573 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6574 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6575 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6576 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6577 | |
| 6578 | deleteXapp1Subscription(t, &restSubId1) |
| 6579 | deleteXapp2Subscription(t, &restSubId2) |
| 6580 | |
| 6581 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6582 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6583 | |
| 6584 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6585 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6586 | } |
| 6587 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6588 | //----------------------------------------------------------------------------- |
| 6589 | // TestRESTSubReqReportSameActionDiffActionID |
| 6590 | // |
| 6591 | // stub stub stub |
| 6592 | // +-------+ +-------+ +---------+ +---------+ |
| 6593 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6594 | // +-------+ +-------+ +---------+ +---------+ |
| 6595 | // | | | | |
| 6596 | // | | RESTSubReq1 | | |
| 6597 | // | |------------->| | |
| 6598 | // | | RESTSubResp1 | | |
| 6599 | // | |<-------------| | |
| 6600 | // | | | | |
| 6601 | // | | | SubReq1 | |
| 6602 | // | | |------------->| |
| 6603 | // | | | | |
| 6604 | // | RESTSubReq2 | | |
| 6605 | // |------------------------>| | |
| 6606 | // | RESTSubResp2 | | |
| 6607 | // |<------------------------| | |
| 6608 | // | | | | |
| 6609 | // | | | SubReq2 | |
| 6610 | // | | |------------->| |
| 6611 | // | | | | |
| 6612 | // | | | SubResp1 | |
| 6613 | // | | |<-------------| |
| 6614 | // | | RESTNotif1 | | |
| 6615 | // | |<-------------| | |
| 6616 | // | | | | |
| 6617 | // | | | SubResp2 | |
| 6618 | // | | |<-------------| |
| 6619 | // | RESTNotif2 | | |
| 6620 | // |<------------------------| | |
| 6621 | // | | | | |
| 6622 | // | | [SUBS 1 DELETE] | |
| 6623 | // | | | | |
| 6624 | // | | [SUBS 2 DELETE] | |
| 6625 | // | | | | |
| 6626 | // |
| 6627 | //----------------------------------------------------------------------------- |
| 6628 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6629 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6630 | |
| 6631 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6632 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6633 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6634 | Counter{cSubReqToE2, 2}, |
| 6635 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6636 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6637 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6638 | Counter{cSubDelReqToE2, 2}, |
| 6639 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6640 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6641 | }) |
| 6642 | |
| 6643 | // Req1 |
| 6644 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6645 | |
| 6646 | //Subs Create |
| 6647 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6648 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6649 | |
| 6650 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6651 | |
| 6652 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6653 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6654 | params.SetMeid("RAN_NAME_1") |
| 6655 | params.SetSubActionIDs(int64(2)) |
| 6656 | |
| 6657 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6658 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6659 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6660 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6661 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6662 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6663 | |
| 6664 | deleteXapp1Subscription(t, &restSubId1) |
| 6665 | deleteXapp2Subscription(t, &restSubId2) |
| 6666 | |
| 6667 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6668 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6669 | |
| 6670 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6671 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6672 | } |
| 6673 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6674 | //----------------------------------------------------------------------------- |
| 6675 | // TestRESTSubReqDiffActionType |
| 6676 | // |
| 6677 | // stub stub stub |
| 6678 | // +-------+ +-------+ +---------+ +---------+ |
| 6679 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6680 | // +-------+ +-------+ +---------+ +---------+ |
| 6681 | // | | | | |
| 6682 | // | | RESTSubReq1 | | |
| 6683 | // | |------------->| | |
| 6684 | // | | RESTSubResp1 | | |
| 6685 | // | |<-------------| | |
| 6686 | // | | | | |
| 6687 | // | | | SubReq1 | |
| 6688 | // | | |------------->| |
| 6689 | // | | | | |
| 6690 | // | RESTSubReq2 | | |
| 6691 | // |------------------------>| | |
| 6692 | // | RESTSubResp2 | | |
| 6693 | // |<------------------------| | |
| 6694 | // | | | | |
| 6695 | // | | | SubReq2 | |
| 6696 | // | | |------------->| |
| 6697 | // | | | | |
| 6698 | // | | | SubResp1 | |
| 6699 | // | | |<-------------| |
| 6700 | // | | RESTNotif1 | | |
| 6701 | // | |<-------------| | |
| 6702 | // | | | | |
| 6703 | // | | | SubResp2 | |
| 6704 | // | | |<-------------| |
| 6705 | // | RESTNotif2 | | |
| 6706 | // |<------------------------| | |
| 6707 | // | | | | |
| 6708 | // | | [SUBS 1 DELETE] | |
| 6709 | // | | | | |
| 6710 | // | | [SUBS 2 DELETE] | |
| 6711 | // | | | | |
| 6712 | // |
| 6713 | //----------------------------------------------------------------------------- |
| 6714 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6715 | func TestRESTSubReqDiffActionType(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6716 | |
| 6717 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6718 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6719 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6720 | Counter{cSubReqToE2, 2}, |
| 6721 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6722 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6723 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6724 | Counter{cSubDelReqToE2, 2}, |
| 6725 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6726 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6727 | }) |
| 6728 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6729 | const e2Timeout int64 = 2 |
| 6730 | const e2RetryCount int64 = 2 |
| 6731 | const routingNeeded bool = true |
| 6732 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6733 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6734 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6735 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6736 | |
| 6737 | //Subs Create |
| 6738 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6739 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6740 | |
| 6741 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6742 | |
| 6743 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6744 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6745 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6746 | params.SetMeid("RAN_NAME_1") |
| 6747 | |
| 6748 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6749 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6750 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6751 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6752 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6753 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6754 | |
| 6755 | deleteXapp1Subscription(t, &restSubId1) |
| 6756 | deleteXapp2Subscription(t, &restSubId2) |
| 6757 | |
| 6758 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6759 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6760 | |
| 6761 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6762 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6763 | } |
| 6764 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6765 | //----------------------------------------------------------------------------- |
| 6766 | // TestRESTSubReqPolicyAndSubDelOkSameAction |
| 6767 | // |
| 6768 | // stub stub stub |
| 6769 | // +-------+ +-------+ +---------+ +---------+ |
| 6770 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6771 | // +-------+ +-------+ +---------+ +---------+ |
| 6772 | // | | | | |
| 6773 | // | | RESTSubReq1 | | |
| 6774 | // | |------------->| | |
| 6775 | // | | RESTSubResp1 | | |
| 6776 | // | |<-------------| | |
| 6777 | // | | | | |
| 6778 | // | | | SubReq1 | |
| 6779 | // | | |------------->| |
| 6780 | // | | | | |
| 6781 | // | RESTSubReq2 | | |
| 6782 | // |------------------------>| | |
| 6783 | // | RESTSubResp2 | | |
| 6784 | // |<------------------------| | |
| 6785 | // | | | | |
| 6786 | // | | | SubReq2 | |
| 6787 | // | | |------------->| |
| 6788 | // | | | | |
| 6789 | // | | | SubResp1 | |
| 6790 | // | | |<-------------| |
| 6791 | // | | RESTNotif1 | | |
| 6792 | // | |<-------------| | |
| 6793 | // | | | | |
| 6794 | // | | | SubResp2 | |
| 6795 | // | | |<-------------| |
| 6796 | // | RESTNotif2 | | |
| 6797 | // |<------------------------| | |
| 6798 | // | | | | |
| 6799 | // | | [SUBS 1 DELETE] | |
| 6800 | // | | | | |
| 6801 | // | | [SUBS 2 DELETE] | |
| 6802 | // | | | | |
| 6803 | // |
| 6804 | //----------------------------------------------------------------------------- |
| 6805 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6806 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6807 | |
| 6808 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6809 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6810 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6811 | Counter{cSubReqToE2, 2}, |
| 6812 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6813 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6814 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6815 | Counter{cSubDelReqToE2, 2}, |
| 6816 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6817 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6818 | }) |
| 6819 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6820 | const e2Timeout int64 = 2 |
| 6821 | const e2RetryCount int64 = 2 |
| 6822 | const routingNeeded bool = true |
| 6823 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6824 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6825 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6826 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6827 | |
| 6828 | //Subs Create |
| 6829 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6830 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6831 | |
| 6832 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6833 | |
| 6834 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6835 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6836 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6837 | params.SetMeid("RAN_NAME_1") |
| 6838 | |
| 6839 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6840 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6841 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6842 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6843 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6844 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6845 | |
| 6846 | deleteXapp1Subscription(t, &restSubId1) |
| 6847 | deleteXapp2Subscription(t, &restSubId2) |
| 6848 | |
| 6849 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6850 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6851 | |
| 6852 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6853 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6854 | } |
| 6855 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6856 | //----------------------------------------------------------------------------- |
| 6857 | // TestRESTSubReqReportSameActionDiffActionDefinitionLen |
| 6858 | // |
| 6859 | // stub stub stub |
| 6860 | // +-------+ +-------+ +---------+ +---------+ |
| 6861 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6862 | // +-------+ +-------+ +---------+ +---------+ |
| 6863 | // | | | | |
| 6864 | // | | RESTSubReq1 | | |
| 6865 | // | |------------->| | |
| 6866 | // | | RESTSubResp1 | | |
| 6867 | // | |<-------------| | |
| 6868 | // | | | | |
| 6869 | // | | | SubReq1 | |
| 6870 | // | | |------------->| |
| 6871 | // | | | | |
| 6872 | // | RESTSubReq2 | | |
| 6873 | // |------------------------>| | |
| 6874 | // | RESTSubResp2 | | |
| 6875 | // |<------------------------| | |
| 6876 | // | | | | |
| 6877 | // | | | SubReq2 | |
| 6878 | // | | |------------->| |
| 6879 | // | | | | |
| 6880 | // | | | SubResp1 | |
| 6881 | // | | |<-------------| |
| 6882 | // | | RESTNotif1 | | |
| 6883 | // | |<-------------| | |
| 6884 | // | | | | |
| 6885 | // | | | SubResp2 | |
| 6886 | // | | |<-------------| |
| 6887 | // | RESTNotif2 | | |
| 6888 | // |<------------------------| | |
| 6889 | // | | | | |
| 6890 | // | | [SUBS 1 DELETE] | |
| 6891 | // | | | | |
| 6892 | // | | [SUBS 2 DELETE] | |
| 6893 | // | | | | |
| 6894 | // |
| 6895 | //----------------------------------------------------------------------------- |
| 6896 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6897 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6898 | |
| 6899 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6900 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6901 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6902 | Counter{cSubReqToE2, 2}, |
| 6903 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6904 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6905 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6906 | Counter{cSubDelReqToE2, 2}, |
| 6907 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6908 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6909 | }) |
| 6910 | |
| 6911 | // Req1 |
| 6912 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6913 | |
| 6914 | //Subs Create |
| 6915 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6916 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6917 | |
| 6918 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6919 | |
| 6920 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6921 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6922 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 6923 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6924 | params.SetSubActionDefinition(actionDefinition) |
| 6925 | |
| 6926 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6927 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6928 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6929 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 6930 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 6931 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 6932 | |
| 6933 | deleteXapp1Subscription(t, &restSubId1) |
| 6934 | deleteXapp2Subscription(t, &restSubId2) |
| 6935 | |
| 6936 | waitSubsCleanup(t, e2SubsId1, 10) |
| 6937 | waitSubsCleanup(t, e2SubsId2, 10) |
| 6938 | |
| 6939 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 6940 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6941 | } |
| 6942 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 6943 | //----------------------------------------------------------------------------- |
| 6944 | // TestRESTSubReqReportSameActionDiffActionDefinitionContents |
| 6945 | // |
| 6946 | // stub stub stub |
| 6947 | // +-------+ +-------+ +---------+ +---------+ |
| 6948 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 6949 | // +-------+ +-------+ +---------+ +---------+ |
| 6950 | // | | | | |
| 6951 | // | | RESTSubReq1 | | |
| 6952 | // | |------------->| | |
| 6953 | // | | RESTSubResp1 | | |
| 6954 | // | |<-------------| | |
| 6955 | // | | | | |
| 6956 | // | | | SubReq1 | |
| 6957 | // | | |------------->| |
| 6958 | // | | | | |
| 6959 | // | RESTSubReq2 | | |
| 6960 | // |------------------------>| | |
| 6961 | // | RESTSubResp2 | | |
| 6962 | // |<------------------------| | |
| 6963 | // | | | | |
| 6964 | // | | | SubReq2 | |
| 6965 | // | | |------------->| |
| 6966 | // | | | | |
| 6967 | // | | | SubResp1 | |
| 6968 | // | | |<-------------| |
| 6969 | // | | RESTNotif1 | | |
| 6970 | // | |<-------------| | |
| 6971 | // | | | | |
| 6972 | // | | | SubResp2 | |
| 6973 | // | | |<-------------| |
| 6974 | // | RESTNotif2 | | |
| 6975 | // |<------------------------| | |
| 6976 | // | | | | |
| 6977 | // | | [SUBS 1 DELETE] | |
| 6978 | // | | | | |
| 6979 | // | | [SUBS 2 DELETE] | |
| 6980 | // | | | | |
| 6981 | // |
| 6982 | //----------------------------------------------------------------------------- |
| 6983 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6984 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6985 | |
| 6986 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6987 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6988 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6989 | Counter{cSubReqToE2, 2}, |
| 6990 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6991 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6992 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6993 | Counter{cSubDelReqToE2, 2}, |
| 6994 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6995 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 6996 | }) |
| 6997 | |
| 6998 | // Req1 |
| 6999 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7000 | |
| 7001 | //Subs Create |
| 7002 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7003 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7004 | |
| 7005 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7006 | |
| 7007 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7008 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7009 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 7010 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7011 | params.SetSubActionDefinition(actionDefinition) |
| 7012 | |
| 7013 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7014 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7015 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7016 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7017 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7018 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7019 | |
| 7020 | deleteXapp1Subscription(t, &restSubId1) |
| 7021 | deleteXapp2Subscription(t, &restSubId2) |
| 7022 | |
| 7023 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7024 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7025 | |
| 7026 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7027 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7028 | } |
| 7029 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7030 | //----------------------------------------------------------------------------- |
| 7031 | // TestRESTSubReqReportSameActionDiffSubsAction |
| 7032 | // |
| 7033 | // stub stub stub |
| 7034 | // +-------+ +-------+ +---------+ +---------+ |
| 7035 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 7036 | // +-------+ +-------+ +---------+ +---------+ |
| 7037 | // | | | | |
| 7038 | // | | RESTSubReq1 | | |
| 7039 | // | |------------->| | |
| 7040 | // | | RESTSubResp1 | | |
| 7041 | // | |<-------------| | |
| 7042 | // | | | | |
| 7043 | // | | | SubReq1 | |
| 7044 | // | | |------------->| |
| 7045 | // | | | | |
| 7046 | // | RESTSubReq2 | | |
| 7047 | // |------------------------>| | |
| 7048 | // | RESTSubResp2 | | |
| 7049 | // |<------------------------| | |
| 7050 | // | | | | |
| 7051 | // | | | SubReq2 | |
| 7052 | // | | |------------->| |
| 7053 | // | | | | |
| 7054 | // | | | SubResp1 | |
| 7055 | // | | |<-------------| |
| 7056 | // | | RESTNotif1 | | |
| 7057 | // | |<-------------| | |
| 7058 | // | | | | |
| 7059 | // | | | SubResp2 | |
| 7060 | // | | |<-------------| |
| 7061 | // | RESTNotif2 | | |
| 7062 | // |<------------------------| | |
| 7063 | // | | | | |
| 7064 | // | | [SUBS 1 DELETE] | |
| 7065 | // | | | | |
| 7066 | // | | [SUBS 2 DELETE] | |
| 7067 | // | | | | |
| 7068 | // |
| 7069 | //----------------------------------------------------------------------------- |
| 7070 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7071 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7072 | |
| 7073 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7074 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7075 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7076 | Counter{cSubReqToE2, 2}, |
| 7077 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 7078 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7079 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7080 | Counter{cSubDelReqToE2, 2}, |
| 7081 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 7082 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7083 | }) |
| 7084 | |
| 7085 | // Req1 |
| 7086 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7087 | |
| 7088 | //Subs Create |
| 7089 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7090 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7091 | |
| 7092 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 7093 | |
| 7094 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7095 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7096 | params.SetMeid("RAN_NAME_1") |
| 7097 | params.SetTimeToWait("w200ms") |
| 7098 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7099 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7100 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7101 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 7102 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7103 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 7104 | |
| 7105 | deleteXapp1Subscription(t, &restSubId1) |
| 7106 | deleteXapp2Subscription(t, &restSubId2) |
| 7107 | |
| 7108 | waitSubsCleanup(t, e2SubsId1, 10) |
| 7109 | waitSubsCleanup(t, e2SubsId2, 10) |
| 7110 | |
| 7111 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7112 | mainCtrl.VerifyAllClean(t) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 7113 | } |
| 7114 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7115 | //----------------------------------------------------------------------------- |
| 7116 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 7117 | // |
| 7118 | // stub stub |
| 7119 | // +-------+ +---------+ +---------+ |
| 7120 | // | xapp | | submgr | | e2term | |
| 7121 | // +-------+ +---------+ +---------+ |
| 7122 | // | | | |
| 7123 | // | RestSubReq | | |
| 7124 | // |---------------->| | |
| 7125 | // | | | |
| 7126 | // | RESTSubResp | | |
| 7127 | // |<----------------| | |
| 7128 | // | | | |
| 7129 | // | | SubReq | |
| 7130 | // | |------------->| |
| 7131 | // | | | |
| 7132 | // | | SubResp | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7133 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7134 | // | | | |
| 7135 | // | | SubReq | |
| 7136 | // | |------------->| |
| 7137 | // | | | |
| 7138 | // | | SubFail | Duplicated action |
| 7139 | // | |<-------------| |
| 7140 | // | RESTNotif (fail)| | |
| 7141 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7142 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7143 | // | [SUBS DELETE] | |
| 7144 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7145 | // |
| 7146 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7147 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7148 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7149 | |
| 7150 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7151 | Counter{cRestSubReqFromXapp, 1}, |
| 7152 | Counter{cRestSubRespToXapp, 1}, |
| 7153 | Counter{cSubReqToE2, 1}, |
| 7154 | Counter{cSubReqTimerExpiry, 1}, |
| 7155 | Counter{cSubReReqToE2, 1}, |
| 7156 | Counter{cSubRespFromE2, 1}, |
| 7157 | Counter{cSubFailFromE2, 1}, |
| 7158 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7159 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7160 | Counter{cRestSubDelRespToXapp, 1}, |
| 7161 | }) |
| 7162 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7163 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7164 | |
| 7165 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7166 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7167 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7168 | |
| 7169 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7170 | // Decode of this response fails which will result resending original request |
| 7171 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 7172 | |
| 7173 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7174 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7175 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7176 | |
| 7177 | // Subscription already created in E2 Node. |
| 7178 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7179 | fparams.Set(crereq) |
| 7180 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7181 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7182 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7183 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7184 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7185 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7186 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7187 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7188 | // Wait that subs is cleaned |
| 7189 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7190 | |
| 7191 | xappConn1.TestMsgChanEmpty(t) |
| 7192 | e2termConn1.TestMsgChanEmpty(t) |
| 7193 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7194 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7195 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7196 | } |
| 7197 | |
| 7198 | //----------------------------------------------------------------------------- |
| 7199 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7200 | // |
| 7201 | // stub stub |
| 7202 | // +-------+ +---------+ +---------+ |
| 7203 | // | xapp | | submgr | | e2term | |
| 7204 | // +-------+ +---------+ +---------+ |
| 7205 | // | | | |
| 7206 | // | RestSubReq | | |
| 7207 | // |---------------->| | |
| 7208 | // | | | |
| 7209 | // | RESTSubResp | | |
| 7210 | // |<----------------| | |
| 7211 | // | | | |
| 7212 | // | | SubReq | |
| 7213 | // | |------------->| |
| 7214 | // | | | |
| 7215 | // | | SubResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7216 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7217 | // | | | |
| 7218 | // | | SubReq | |
| 7219 | // | |------------->| |
| 7220 | // | | | |
| 7221 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7222 | // | |<-------------| No valid subscription found with subIds [0] |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7223 | // | RESTNotif (fail)| | |
| 7224 | // |<----------------| | |
| 7225 | // | | SubDelReq | |
| 7226 | // | |------------->| |
| 7227 | // | | | |
| 7228 | // | | SubDelResp | |
| 7229 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7230 | // | | | |
| 7231 | // | [SUBS DELETE] | |
| 7232 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7233 | // |
| 7234 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 7235 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7236 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7237 | |
| 7238 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7239 | Counter{cRestSubReqFromXapp, 1}, |
| 7240 | Counter{cRestSubRespToXapp, 1}, |
| 7241 | Counter{cSubReqToE2, 1}, |
| 7242 | Counter{cSubReqTimerExpiry, 2}, |
| 7243 | Counter{cSubReReqToE2, 1}, |
| 7244 | Counter{cSubRespFromE2, 1}, |
| 7245 | Counter{cSubFailFromE2, 1}, |
| 7246 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7247 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7248 | Counter{cRestSubDelRespToXapp, 1}, |
| 7249 | Counter{cSubDelReqToE2, 1}, |
| 7250 | Counter{cSubDelRespFromE2, 1}, |
| 7251 | }) |
| 7252 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7253 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7254 | |
| 7255 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7256 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7257 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7258 | |
| 7259 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7260 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7261 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7262 | orgInstanceId := crereq.RequestId.InstanceId |
| 7263 | crereq.RequestId.InstanceId = 0 |
| 7264 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7265 | |
| 7266 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7267 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7268 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7269 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7270 | // 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] | 7271 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7272 | fparams.Set(crereq) |
| 7273 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7274 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7275 | |
| 7276 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7277 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7278 | |
| 7279 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7280 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7281 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7282 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7283 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7284 | // Wait that subs is cleaned |
| 7285 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 7286 | |
| 7287 | xappConn1.TestMsgChanEmpty(t) |
| 7288 | e2termConn1.TestMsgChanEmpty(t) |
| 7289 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7290 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7291 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7292 | } |
| 7293 | |
| 7294 | //----------------------------------------------------------------------------- |
| 7295 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 7296 | // |
| 7297 | // stub stub |
| 7298 | // +-------+ +---------+ +---------+ |
| 7299 | // | xapp | | submgr | | e2term | |
| 7300 | // +-------+ +---------+ +---------+ |
| 7301 | // | | | |
| 7302 | // | RestSubReq | | |
| 7303 | // |---------------->| | |
| 7304 | // | | | |
| 7305 | // | RESTSubResp | | |
| 7306 | // |<----------------| | |
| 7307 | // | | | |
| 7308 | // | | SubReq | |
| 7309 | // | |------------->| |
| 7310 | // | | | |
| 7311 | // | | SubResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7312 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7313 | // | | | |
| 7314 | // | | SubReq | |
| 7315 | // | |------------->| |
| 7316 | // | | | |
| 7317 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7318 | // | |<-------------|Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7319 | // | RESTNotif (fail)| | |
| 7320 | // |<----------------| | |
| 7321 | // | | SubDelReq | |
| 7322 | // | |------------->| |
| 7323 | // | | | |
| 7324 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7325 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7326 | // | | | |
| 7327 | // | | SubDelReq | |
| 7328 | // | |------------->| |
| 7329 | // | | | |
| 7330 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7331 | // | |<-------------| Ongoing transaction not found. |
| 7332 | // | | | |
| 7333 | // | [SUBS DELETE] | |
| 7334 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7335 | // |
| 7336 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7337 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7338 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7339 | |
| 7340 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7341 | Counter{cRestSubReqFromXapp, 1}, |
| 7342 | Counter{cRestSubRespToXapp, 1}, |
| 7343 | Counter{cSubReqToE2, 1}, |
| 7344 | Counter{cSubReqTimerExpiry, 2}, |
| 7345 | Counter{cSubReReqToE2, 1}, |
| 7346 | Counter{cSubRespFromE2, 1}, |
| 7347 | Counter{cSubFailFromE2, 1}, |
| 7348 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7349 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7350 | Counter{cRestSubDelRespToXapp, 1}, |
| 7351 | Counter{cSubDelReqToE2, 1}, |
| 7352 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7353 | Counter{cSubDelReReqToE2, 1}, |
| 7354 | Counter{cSubDelRespFromE2, 2}, |
| 7355 | }) |
| 7356 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7357 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7358 | |
| 7359 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7360 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7361 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7362 | |
| 7363 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7364 | |
| 7365 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7366 | // No transaction exist for this response which will result resending original request |
| 7367 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 7368 | |
| 7369 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7370 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7371 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7372 | |
| 7373 | // Subscription already created in E2 Node. |
| 7374 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7375 | fparams.Set(crereq) |
| 7376 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7377 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7378 | |
| 7379 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7380 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7381 | |
| 7382 | // Resending happens because there no transaction |
| 7383 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7384 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7385 | |
| 7386 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7387 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7388 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7389 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7390 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7391 | // Wait that subs is cleaned |
| 7392 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7393 | |
| 7394 | xappConn1.TestMsgChanEmpty(t) |
| 7395 | e2termConn1.TestMsgChanEmpty(t) |
| 7396 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7397 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7398 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7399 | } |
| 7400 | |
| 7401 | //----------------------------------------------------------------------------- |
| 7402 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 7403 | // |
| 7404 | // stub stub |
| 7405 | // +-------+ +---------+ +---------+ |
| 7406 | // | xapp | | submgr | | e2term | |
| 7407 | // +-------+ +---------+ +---------+ |
| 7408 | // | | | |
| 7409 | // | RestSubReq | | |
| 7410 | // |---------------->| | |
| 7411 | // | | | |
| 7412 | // | RESTSubResp | | |
| 7413 | // |<----------------| | |
| 7414 | // | | | |
| 7415 | // | | SubReq | |
| 7416 | // | |------------->| |
| 7417 | // | | | |
| 7418 | // | | SubFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7419 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7420 | // | | | |
| 7421 | // | | SubReq | |
| 7422 | // | |------------->| |
| 7423 | // | | | |
| 7424 | // | | SubFail | Duplicated action |
| 7425 | // | |<-------------| |
| 7426 | // | RESTNotif (fail)| | |
| 7427 | // |<----------------| | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7428 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7429 | // | [SUBS DELETE] | |
| 7430 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7431 | // |
| 7432 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7433 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7434 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7435 | |
| 7436 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7437 | Counter{cRestSubReqFromXapp, 1}, |
| 7438 | Counter{cRestSubRespToXapp, 1}, |
| 7439 | Counter{cSubReqToE2, 1}, |
| 7440 | Counter{cSubReqTimerExpiry, 1}, |
| 7441 | Counter{cSubReReqToE2, 1}, |
| 7442 | Counter{cSubFailFromE2, 2}, |
| 7443 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7444 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7445 | Counter{cRestSubDelRespToXapp, 1}, |
| 7446 | }) |
| 7447 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7448 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7449 | |
| 7450 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7451 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7452 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7453 | |
| 7454 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7455 | |
| 7456 | // Decode of this response fails which will result resending original request |
| 7457 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 7458 | |
| 7459 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7460 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7461 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7462 | |
| 7463 | // Subscription already created in E2 Node. |
| 7464 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7465 | fparams.Set(crereq) |
| 7466 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7467 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7468 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7469 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7470 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7471 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7472 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7473 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7474 | // Wait that subs is cleaned |
| 7475 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7476 | |
| 7477 | xappConn1.TestMsgChanEmpty(t) |
| 7478 | e2termConn1.TestMsgChanEmpty(t) |
| 7479 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7480 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7481 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7482 | } |
| 7483 | |
| 7484 | //----------------------------------------------------------------------------- |
| 7485 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 7486 | // |
| 7487 | // stub stub |
| 7488 | // +-------+ +---------+ +---------+ |
| 7489 | // | xapp | | submgr | | e2term | |
| 7490 | // +-------+ +---------+ +---------+ |
| 7491 | // | | | |
| 7492 | // | RestSubReq | | |
| 7493 | // |---------------->| | |
| 7494 | // | | | |
| 7495 | // | RESTSubResp | | |
| 7496 | // |<----------------| | |
| 7497 | // | | | |
| 7498 | // | | SubReq | |
| 7499 | // | |------------->| |
| 7500 | // | | | |
| 7501 | // | | SubFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7502 | // | |<-------------| 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] | 7503 | // | | | |
| 7504 | // | | SubReq | |
| 7505 | // | |------------->| |
| 7506 | // | | | |
| 7507 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7508 | // | |<-------------|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] | 7509 | // | RESTNotif (fail)| | |
| 7510 | // |<----------------| | |
| 7511 | // | | SubDelReq | |
| 7512 | // | |------------->| |
| 7513 | // | | | |
| 7514 | // | | SubDelResp | |
| 7515 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7516 | // | | | |
| 7517 | // | [SUBS DELETE] | |
| 7518 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7519 | // |
| 7520 | //----------------------------------------------------------------------------- |
| 7521 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7522 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7523 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7524 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7525 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7526 | Counter{cRestSubReqFromXapp, 1}, |
| 7527 | Counter{cRestSubRespToXapp, 1}, |
| 7528 | Counter{cSubReqToE2, 1}, |
| 7529 | Counter{cSubReqTimerExpiry, 2}, |
| 7530 | Counter{cSubReReqToE2, 1}, |
| 7531 | Counter{cSubFailFromE2, 2}, |
| 7532 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7533 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7534 | Counter{cRestSubDelRespToXapp, 1}, |
| 7535 | Counter{cSubDelReqToE2, 1}, |
| 7536 | Counter{cSubDelRespFromE2, 1}, |
| 7537 | }) |
| 7538 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7539 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7540 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7541 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7542 | |
| 7543 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7544 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7545 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7546 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7547 | fparams.Set(crereq) |
| 7548 | fparams.Fail.RequestId.InstanceId = 0 |
| 7549 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7550 | |
| 7551 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7552 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7553 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7554 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7555 | // 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] | 7556 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7557 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7558 | |
| 7559 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7560 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7561 | |
| 7562 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7563 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7564 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7565 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7566 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7567 | // Wait that subs is cleaned |
| 7568 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7569 | |
| 7570 | xappConn1.TestMsgChanEmpty(t) |
| 7571 | e2termConn1.TestMsgChanEmpty(t) |
| 7572 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7573 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7574 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7575 | } |
| 7576 | |
| 7577 | //----------------------------------------------------------------------------- |
| 7578 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 7579 | // |
| 7580 | // stub stub |
| 7581 | // +-------+ +---------+ +---------+ |
| 7582 | // | xapp | | submgr | | e2term | |
| 7583 | // +-------+ +---------+ +---------+ |
| 7584 | // | | | |
| 7585 | // | RestSubReq | | |
| 7586 | // |---------------->| | |
| 7587 | // | | | |
| 7588 | // | RESTSubResp | | |
| 7589 | // |<----------------| | |
| 7590 | // | | | |
| 7591 | // | | SubReq | |
| 7592 | // | |------------->| |
| 7593 | // | | | |
| 7594 | // | | SubFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7595 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7596 | // | | | |
| 7597 | // | | SubReq | |
| 7598 | // | |------------->| |
| 7599 | // | | | |
| 7600 | // | | SubFail | Duplicated action |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7601 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and sending delete |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7602 | // | RESTNotif (fail)| | |
| 7603 | // |<----------------| | |
| 7604 | // | | SubDelReq | |
| 7605 | // | |------------->| |
| 7606 | // | | | |
| 7607 | // | | SubDelResp | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7608 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
| 7609 | // | | | |
| 7610 | // | | SubDelReq | |
| 7611 | // | |------------->| |
| 7612 | // | | | |
| 7613 | // | | SubDelResp | |
| 7614 | // | |<-------------| Ongoing transaction not found. |
| 7615 | // | | | |
| 7616 | // | [SUBS DELETE] | |
| 7617 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7618 | // |
| 7619 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7620 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7621 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7622 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7623 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7624 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7625 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7626 | Counter{cRestSubReqFromXapp, 1}, |
| 7627 | Counter{cRestSubRespToXapp, 1}, |
| 7628 | Counter{cSubReqToE2, 1}, |
| 7629 | Counter{cSubReqTimerExpiry, 2}, |
| 7630 | Counter{cSubReReqToE2, 1}, |
| 7631 | Counter{cSubFailFromE2, 2}, |
| 7632 | Counter{cRestSubFailNotifToXapp, 1}, |
| 7633 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7634 | Counter{cRestSubDelRespToXapp, 1}, |
| 7635 | Counter{cSubDelReqToE2, 1}, |
| 7636 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7637 | Counter{cSubDelReReqToE2, 1}, |
| 7638 | Counter{cSubDelRespFromE2, 2}, |
| 7639 | }) |
| 7640 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7641 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 7642 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7643 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 7644 | |
| 7645 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 7646 | |
| 7647 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 7648 | |
| 7649 | // No transaction exist for this response which will result resending original request |
| 7650 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 7651 | fparams.Set(crereq) |
| 7652 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7653 | |
| 7654 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 7655 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 7656 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7657 | |
| 7658 | // Subscription already created in E2 Node. |
| 7659 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 7660 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 7661 | |
| 7662 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7663 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7664 | |
| 7665 | // Resending happens because there no transaction |
| 7666 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7667 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7668 | |
| 7669 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 7670 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7671 | |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7672 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7673 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7674 | // Wait that subs is cleaned |
| 7675 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 7676 | |
| 7677 | xappConn1.TestMsgChanEmpty(t) |
| 7678 | e2termConn1.TestMsgChanEmpty(t) |
| 7679 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7680 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7681 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7682 | } |
| 7683 | |
| 7684 | //----------------------------------------------------------------------------- |
| 7685 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 7686 | // |
| 7687 | // stub stub |
| 7688 | // +-------+ +---------+ +---------+ |
| 7689 | // | xapp | | submgr | | e2term | |
| 7690 | // +-------+ +---------+ +---------+ |
| 7691 | // | | | |
| 7692 | // | [SUBS CREATE] | |
| 7693 | // | | | |
| 7694 | // | | | |
| 7695 | // | RESTSubDelReq | | |
| 7696 | // |---------------->| | |
| 7697 | // | | | |
| 7698 | // | RESTSubDelResp | | |
| 7699 | // |<----------------| | |
| 7700 | // | | | |
| 7701 | // | | SubDelReq | |
| 7702 | // | |------------->| |
| 7703 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7704 | // | | SubDelResp | ASN.1 decode fails. |
| 7705 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7706 | // | | | |
| 7707 | // | | SubDelReq | |
| 7708 | // | |------------->| |
| 7709 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7710 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7711 | // | |<-------------| |
| 7712 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7713 | // | [SUBS DELETE] | |
| 7714 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7715 | // |
| 7716 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7717 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7718 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7719 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7720 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7721 | Counter{cRestSubReqFromXapp, 1}, |
| 7722 | Counter{cRestSubRespToXapp, 1}, |
| 7723 | Counter{cSubReqToE2, 1}, |
| 7724 | Counter{cSubRespFromE2, 1}, |
| 7725 | Counter{cRestSubNotifToXapp, 1}, |
| 7726 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7727 | Counter{cRestSubDelRespToXapp, 1}, |
| 7728 | Counter{cSubDelReqToE2, 1}, |
| 7729 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7730 | Counter{cSubDelReReqToE2, 1}, |
| 7731 | Counter{cSubDelFailFromE2, 1}, |
| 7732 | Counter{cSubDelRespFromE2, 1}, |
| 7733 | }) |
| 7734 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7735 | // Req |
| 7736 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7737 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7738 | |
| 7739 | // Del |
| 7740 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7741 | |
| 7742 | // E2t: Receive 1st SubsDelReq |
| 7743 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7744 | |
| 7745 | // Decode of this response fails which will result resending original request |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7746 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_RESP) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7747 | |
| 7748 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7749 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7750 | |
| 7751 | // Subscription does not exist in in E2 Node. |
| 7752 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7753 | |
| 7754 | // Wait that subs is cleaned |
| 7755 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7756 | |
| 7757 | xappConn1.TestMsgChanEmpty(t) |
| 7758 | e2termConn1.TestMsgChanEmpty(t) |
| 7759 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7760 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7761 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7762 | } |
| 7763 | |
| 7764 | //----------------------------------------------------------------------------- |
| 7765 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 7766 | // |
| 7767 | // stub stub |
| 7768 | // +-------+ +---------+ +---------+ |
| 7769 | // | xapp | | submgr | | e2term | |
| 7770 | // +-------+ +---------+ +---------+ |
| 7771 | // | | | |
| 7772 | // | [SUBS CREATE] | |
| 7773 | // | | | |
| 7774 | // | | | |
| 7775 | // | RESTSubDelReq | | |
| 7776 | // |---------------->| | |
| 7777 | // | | | |
| 7778 | // | RESTSubDelResp | | |
| 7779 | // |<----------------| | |
| 7780 | // | | | |
| 7781 | // | | SubDelReq | |
| 7782 | // | |------------->| |
| 7783 | // | | | |
| 7784 | // | | SubDelResp | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7785 | // | |<-------------| No valid subscription found with subIds [0]. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7786 | // | | | |
| 7787 | // | | SubDelReq | |
| 7788 | // | |------------->| |
| 7789 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7790 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7791 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7792 | // | | | |
| 7793 | // | [SUBS DELETE] | |
| 7794 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7795 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7796 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7797 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7798 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7799 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7800 | Counter{cRestSubReqFromXapp, 1}, |
| 7801 | Counter{cRestSubRespToXapp, 1}, |
| 7802 | Counter{cSubReqToE2, 1}, |
| 7803 | Counter{cSubRespFromE2, 1}, |
| 7804 | Counter{cRestSubNotifToXapp, 1}, |
| 7805 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7806 | Counter{cRestSubDelRespToXapp, 1}, |
| 7807 | Counter{cSubDelReqToE2, 1}, |
| 7808 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7809 | Counter{cSubDelReReqToE2, 1}, |
| 7810 | Counter{cSubDelRespFromE2, 1}, |
| 7811 | Counter{cSubDelFailFromE2, 1}, |
| 7812 | }) |
| 7813 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7814 | // Req |
| 7815 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7816 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7817 | |
| 7818 | // Del |
| 7819 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7820 | |
| 7821 | // E2t: Receive 1st SubsDelReq |
| 7822 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7823 | |
| 7824 | // Unknown instanceId in this response which will result resending original request |
| 7825 | delreq.RequestId.InstanceId = 0 |
| 7826 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7827 | |
| 7828 | // E2t: Receive 2nd SubsDelReq |
| 7829 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7830 | |
| 7831 | // Subscription does not exist in in E2 Node. |
| 7832 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7833 | |
| 7834 | // Wait that subs is cleaned |
| 7835 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7836 | |
| 7837 | xappConn1.TestMsgChanEmpty(t) |
| 7838 | e2termConn1.TestMsgChanEmpty(t) |
| 7839 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7840 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7841 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7842 | } |
| 7843 | |
| 7844 | //----------------------------------------------------------------------------- |
| 7845 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 7846 | // |
| 7847 | // stub stub |
| 7848 | // +-------+ +---------+ +---------+ |
| 7849 | // | xapp | | submgr | | e2term | |
| 7850 | // +-------+ +---------+ +---------+ |
| 7851 | // | | | |
| 7852 | // | [SUBS CREATE] | |
| 7853 | // | | | |
| 7854 | // | | | |
| 7855 | // | RESTSubDelReq | | |
| 7856 | // |---------------->| | |
| 7857 | // | | | |
| 7858 | // | RESTSubDelResp | | |
| 7859 | // |<----------------| | |
| 7860 | // | | | |
| 7861 | // | | SubDelReq | |
| 7862 | // | |------------->| |
| 7863 | // | | | |
| 7864 | // | | SubDelResp | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7865 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7866 | // | | | |
| 7867 | // | | SubDelReq | |
| 7868 | // | |------------->| |
| 7869 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7870 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 7871 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 7872 | // | | | |
| 7873 | // | [SUBS DELETE] | |
| 7874 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7875 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7876 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7877 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7878 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7879 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7880 | Counter{cRestSubReqFromXapp, 1}, |
| 7881 | Counter{cRestSubRespToXapp, 1}, |
| 7882 | Counter{cSubReqToE2, 1}, |
| 7883 | Counter{cSubRespFromE2, 1}, |
| 7884 | Counter{cRestSubNotifToXapp, 1}, |
| 7885 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7886 | Counter{cRestSubDelRespToXapp, 1}, |
| 7887 | Counter{cSubDelReqToE2, 1}, |
| 7888 | Counter{cSubDelReqTimerExpiry, 2}, |
| 7889 | Counter{cSubDelReReqToE2, 1}, |
| 7890 | Counter{cSubDelRespFromE2, 1}, |
| 7891 | Counter{cSubDelFailFromE2, 1}, |
| 7892 | }) |
| 7893 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7894 | // Req |
| 7895 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7896 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7897 | |
| 7898 | // Del |
| 7899 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7900 | |
| 7901 | // E2t: Receive 1st SubsDelReq |
| 7902 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7903 | |
| 7904 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 7905 | |
| 7906 | // No transaction exist for this response which will result resending original request |
| 7907 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 7908 | |
| 7909 | // E2t: Receive 2nd SubsDelReq |
| 7910 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7911 | |
| 7912 | // Subscription does not exist in in E2 Node. |
| 7913 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7914 | |
| 7915 | // Wait that subs is cleaned |
| 7916 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7917 | |
| 7918 | xappConn1.TestMsgChanEmpty(t) |
| 7919 | e2termConn1.TestMsgChanEmpty(t) |
| 7920 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7921 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7922 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7923 | } |
| 7924 | |
| 7925 | //----------------------------------------------------------------------------- |
| 7926 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 7927 | // |
| 7928 | // stub stub |
| 7929 | // +-------+ +---------+ +---------+ |
| 7930 | // | xapp | | submgr | | e2term | |
| 7931 | // +-------+ +---------+ +---------+ |
| 7932 | // | | | |
| 7933 | // | [SUBS CREATE] | |
| 7934 | // | | | |
| 7935 | // | | | |
| 7936 | // | RESTSubDelReq | | |
| 7937 | // |---------------->| | |
| 7938 | // | | | |
| 7939 | // | RESTSubDelResp | | |
| 7940 | // |<----------------| | |
| 7941 | // | | | |
| 7942 | // | | SubDelReq | |
| 7943 | // | |------------->| |
| 7944 | // | | | |
| 7945 | // | | SubDelFail | ASN.1 decode fails |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7946 | // | |<-------------| Decode failed. More data needed. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7947 | // | | | |
| 7948 | // | | SubDelReq | |
| 7949 | // | |------------->| |
| 7950 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7951 | // | | SubDelFail | Subscription does exist any more in E2 node |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7952 | // | |<-------------| |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7953 | // | | | |
| 7954 | // | [SUBS DELETE] | |
| 7955 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7956 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 7957 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7958 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7959 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 7960 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 7961 | Counter{cRestSubReqFromXapp, 1}, |
| 7962 | Counter{cRestSubRespToXapp, 1}, |
| 7963 | Counter{cSubReqToE2, 1}, |
| 7964 | Counter{cSubRespFromE2, 1}, |
| 7965 | Counter{cRestSubNotifToXapp, 1}, |
| 7966 | Counter{cRestSubDelReqFromXapp, 1}, |
| 7967 | Counter{cRestSubDelRespToXapp, 1}, |
| 7968 | Counter{cSubDelReqToE2, 1}, |
| 7969 | Counter{cSubDelReqTimerExpiry, 1}, |
| 7970 | Counter{cSubDelReReqToE2, 1}, |
| 7971 | Counter{cSubDelFailFromE2, 2}, |
| 7972 | }) |
| 7973 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 7974 | // Req |
| 7975 | var params *teststube2ap.RESTSubsReqParams = nil |
| 7976 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 7977 | |
| 7978 | // Del |
| 7979 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 7980 | |
| 7981 | // E2t: Receive 1st SubsDelReq |
| 7982 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 7983 | |
| 7984 | // Decode of this response fails which will result resending original request |
| 7985 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 7986 | |
| 7987 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 7988 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 7989 | |
| 7990 | // Subscription does not exist in in E2 Node. |
| 7991 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 7992 | |
| 7993 | // Wait that subs is cleaned |
| 7994 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 7995 | |
| 7996 | xappConn1.TestMsgChanEmpty(t) |
| 7997 | e2termConn1.TestMsgChanEmpty(t) |
| 7998 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 7999 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8000 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8001 | } |
| 8002 | |
| 8003 | //----------------------------------------------------------------------------- |
| 8004 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 8005 | // |
| 8006 | // stub stub |
| 8007 | // +-------+ +---------+ +---------+ |
| 8008 | // | xapp | | submgr | | e2term | |
| 8009 | // +-------+ +---------+ +---------+ |
| 8010 | // | | | |
| 8011 | // | [SUBS CREATE] | |
| 8012 | // | | | |
| 8013 | // | | | |
| 8014 | // | RESTSubDelReq | | |
| 8015 | // |---------------->| | |
| 8016 | // | | | |
| 8017 | // | RESTSubDelResp | | |
| 8018 | // |<----------------| | |
| 8019 | // | | | |
| 8020 | // | | SubDelReq | |
| 8021 | // | |------------->| |
| 8022 | // | | | |
| 8023 | // | | SubDelFail | Unknown instanceId |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8024 | // | |<-------------| 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] | 8025 | // | | | |
| 8026 | // | | SubDelReq | |
| 8027 | // | |------------->| |
| 8028 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8029 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8030 | // | |<-------------| No valid subscription found with subIds [0]. |
| 8031 | // | | | |
| 8032 | // | [SUBS DELETE] | |
| 8033 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8034 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8035 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8036 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8037 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8038 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8039 | Counter{cRestSubReqFromXapp, 1}, |
| 8040 | Counter{cRestSubRespToXapp, 1}, |
| 8041 | Counter{cSubReqToE2, 1}, |
| 8042 | Counter{cSubRespFromE2, 1}, |
| 8043 | Counter{cRestSubNotifToXapp, 1}, |
| 8044 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8045 | Counter{cRestSubDelRespToXapp, 1}, |
| 8046 | Counter{cSubDelReqToE2, 1}, |
| 8047 | Counter{cSubDelReqTimerExpiry, 1}, |
| 8048 | Counter{cSubDelReReqToE2, 1}, |
| 8049 | Counter{cSubDelFailFromE2, 2}, |
| 8050 | }) |
| 8051 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8052 | // Req |
| 8053 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8054 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8055 | |
| 8056 | // Del |
| 8057 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8058 | |
| 8059 | // E2t: Receive 1st SubsDelReq |
| 8060 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8061 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8062 | // Unknown instanceId 0 in this response which will result resending original request |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8063 | delreq.RequestId.InstanceId = 0 |
| 8064 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8065 | |
| 8066 | // E2t: Receive 2nd SubsDelReq |
| 8067 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8068 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8069 | // 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] | 8070 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8071 | |
| 8072 | // Wait that subs is cleaned |
| 8073 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8074 | |
| 8075 | xappConn1.TestMsgChanEmpty(t) |
| 8076 | e2termConn1.TestMsgChanEmpty(t) |
| 8077 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8078 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8079 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8080 | } |
| 8081 | |
| 8082 | //----------------------------------------------------------------------------- |
| 8083 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 8084 | // |
| 8085 | // stub stub |
| 8086 | // +-------+ +---------+ +---------+ |
| 8087 | // | xapp | | submgr | | e2term | |
| 8088 | // +-------+ +---------+ +---------+ |
| 8089 | // | | | |
| 8090 | // | [SUBS CREATE] | |
| 8091 | // | | | |
| 8092 | // | | | |
| 8093 | // | RESTSubDelReq | | |
| 8094 | // |---------------->| | |
| 8095 | // | | | |
| 8096 | // | RESTSubDelResp | | |
| 8097 | // |<----------------| | |
| 8098 | // | | | |
| 8099 | // | | SubDelReq | |
| 8100 | // | |------------->| |
| 8101 | // | | | |
| 8102 | // | | SubDelFail | No transaction for the response |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8103 | // | |<-------------| Ongoing transaction not found. This will result timer expiry and resending |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8104 | // | | | |
| 8105 | // | | SubDelReq | |
| 8106 | // | |------------->| |
| 8107 | // | | | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8108 | // | | SubDelFail | Subscription does exist any more in E2 node |
| 8109 | // | |<-------------| Ongoing transaction not found. This will result timer expiry |
| 8110 | // | | | |
| 8111 | // | [SUBS DELETE] | |
| 8112 | // | | | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8113 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8114 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8115 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8116 | |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8117 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8118 | Counter{cRestSubReqFromXapp, 1}, |
| 8119 | Counter{cRestSubRespToXapp, 1}, |
| 8120 | Counter{cSubReqToE2, 1}, |
| 8121 | Counter{cSubRespFromE2, 1}, |
| 8122 | Counter{cRestSubNotifToXapp, 1}, |
| 8123 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8124 | Counter{cRestSubDelRespToXapp, 1}, |
| 8125 | Counter{cSubDelReqToE2, 1}, |
| 8126 | Counter{cSubDelReqTimerExpiry, 2}, |
| 8127 | Counter{cSubDelReReqToE2, 1}, |
| 8128 | Counter{cSubDelFailFromE2, 2}, |
| 8129 | }) |
| 8130 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8131 | // Req |
| 8132 | var params *teststube2ap.RESTSubsReqParams = nil |
| 8133 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 8134 | |
| 8135 | // Del |
| 8136 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8137 | |
| 8138 | // E2t: Receive 1st SubsDelReq |
| 8139 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8140 | |
| 8141 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 8142 | |
| 8143 | // No transaction exist for this response which will result resending original request |
| 8144 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8145 | |
| 8146 | // E2t: Receive 2nd SubsDelReq |
| 8147 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 8148 | |
| 8149 | // Subscription does not exist in in E2 Node. |
| 8150 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 8151 | |
| 8152 | // Wait that subs is cleaned |
| 8153 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 8154 | |
| 8155 | xappConn1.TestMsgChanEmpty(t) |
| 8156 | e2termConn1.TestMsgChanEmpty(t) |
| 8157 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8158 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8159 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 8160 | } |
| 8161 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8162 | //----------------------------------------------------------------------------- |
| 8163 | // TestRESTSubReqFailAsn1PackSubReqError |
| 8164 | // |
| 8165 | // stub stub |
| 8166 | // +-------+ +---------+ +---------+ |
| 8167 | // | xapp | | submgr | | e2term | |
| 8168 | // +-------+ +---------+ +---------+ |
| 8169 | // | | | |
| 8170 | // | RESTSubReq | | |
| 8171 | // |---------------->| | |
| 8172 | // | | | |
| 8173 | // | RESTSubResp | | |
| 8174 | // |<----------------| | |
| 8175 | // | | | |
| 8176 | // | ASN.1 encode fails | |
| 8177 | // | | | |
| 8178 | // | | SubDelReq | |
| 8179 | // | |------------->| |
| 8180 | // | | | |
| 8181 | // | | SubDelFail | |
| 8182 | // | |<-------------| |
| 8183 | // | | | |
| 8184 | // | RESTNotif | | |
| 8185 | // | unsuccess | | |
| 8186 | // |<----------------| | |
| 8187 | // | | | |
| 8188 | // | [SUBS DELETE] | |
| 8189 | // | | | |
| 8190 | // |
| 8191 | //----------------------------------------------------------------------------- |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8192 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8193 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 8194 | |
| 8195 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 8196 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8197 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 8198 | Counter{cRestSubFailNotifToXapp, 1}, |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8199 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8200 | Counter{cRestSubDelRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8201 | }) |
| 8202 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8203 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8204 | |
| 8205 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8206 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8207 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 8208 | |
| 8209 | // Req |
| 8210 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8211 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8212 | |
| 8213 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 8214 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8215 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8216 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8217 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8218 | |
| 8219 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8220 | |
| 8221 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8222 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8223 | // Wait that subs is cleaned |
| 8224 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8225 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8226 | mainCtrl.VerifyCounterValues(t) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 8227 | } |
| 8228 | |
Anssi Mannila | 2738517 | 2021-12-22 09:41:54 +0200 | [diff] [blame] | 8229 | //----------------------------------------------------------------------------- |
| 8230 | // TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction |
| 8231 | // |
| 8232 | // stub stub |
| 8233 | // +-------+ +---------+ +---------+ |
| 8234 | // | xapp | | submgr | | e2term | |
| 8235 | // +-------+ +---------+ +---------+ |
| 8236 | // | | | |
| 8237 | // | RESTSubReq | | |
| 8238 | // |---------------->| | |
| 8239 | // | | | |
| 8240 | // | RESTSubResp | | |
| 8241 | // |<----------------| | |
| 8242 | // | | SubReq | |
| 8243 | // | |------------->| |
| 8244 | // | | | |
| 8245 | // | | SubResp | |
| 8246 | // | |<-------------| |
| 8247 | // | | | |
| 8248 | // | RESTNotif | | |
| 8249 | // |<----------------| | |
| 8250 | // | | | |
| 8251 | // | RESTSubReq | | Policy modification |
| 8252 | // |---------------->| | |
| 8253 | // | | | |
| 8254 | // | RESTSubResp | | |
| 8255 | // |<----------------| | |
| 8256 | // | | SubReq | |
| 8257 | // | |------------->| |
| 8258 | // | | | |
| 8259 | // | | | |
| 8260 | // | RESTNotif(Unsuccessful) | E2 timeout |
| 8261 | // |<----------------| | |
| 8262 | // | | | |
| 8263 | // | RESTSubDelReq | | |
| 8264 | // |---------------->| | |
| 8265 | // | | | |
| 8266 | // | | SubDelReq | |
| 8267 | // | |------------->| |
| 8268 | // | | | |
| 8269 | // | | SubDelResp | |
| 8270 | // | |<-------------| |
| 8271 | // | | | |
| 8272 | // | RESTSubDelResp | | |
| 8273 | // |<----------------| | |
| 8274 | // |
| 8275 | //----------------------------------------------------------------------------- |
| 8276 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8277 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8278 | |
| 8279 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8280 | Counter{cRestSubReqFromXapp, 2}, |
| 8281 | Counter{cRestSubRespToXapp, 2}, |
| 8282 | Counter{cSubReqToE2, 2}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8283 | Counter{cSubReqTimerExpiry, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8284 | Counter{cSubRespFromE2, 1}, |
| 8285 | Counter{cRestSubNotifToXapp, 1}, |
| 8286 | Counter{cRestSubFailNotifToXapp, 1}, |
| 8287 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8288 | Counter{cSubDelReqToE2, 1}, |
| 8289 | Counter{cSubDelRespFromE2, 1}, |
| 8290 | Counter{cRestSubDelRespToXapp, 1}, |
| 8291 | }) |
| 8292 | |
| 8293 | const e2Timeout int64 = 1 |
| 8294 | const e2RetryCount int64 = 0 |
| 8295 | const routingNeeded bool = false |
| 8296 | |
| 8297 | // Req1 |
| 8298 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8299 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8300 | |
| 8301 | // Subs Create |
| 8302 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8303 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8304 | |
| 8305 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8306 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8307 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8308 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8309 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8310 | |
| 8311 | // Policy change |
| 8312 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8313 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8314 | params.SetSubscriptionID(&restSubId) |
| 8315 | params.SetTimeToWait("w200ms") |
| 8316 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8317 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8318 | |
| 8319 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8320 | xappConn1.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | 53dbe7e | 2021-10-06 14:21:48 +0300 | [diff] [blame] | 8321 | // SubsResp is missing, e2SubsId will be 0 |
| 8322 | zeroE2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8323 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", zeroE2SubsId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8324 | |
| 8325 | // Del |
| 8326 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8327 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8328 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8329 | |
| 8330 | waitSubsCleanup(t, e2SubsId, 10) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8331 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | 2178218 | 2021-12-10 10:56:02 +0200 | [diff] [blame] | 8332 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8333 | } |
| 8334 | |
| 8335 | //----------------------------------------------------------------------------- |
| 8336 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 8337 | // |
| 8338 | // stub stub |
| 8339 | // +-------+ +---------+ +---------+ |
| 8340 | // | xapp | | submgr | | e2term | |
| 8341 | // +-------+ +---------+ +---------+ |
| 8342 | // | | | |
| 8343 | // | RESTSubReq | | |
| 8344 | // |---------------->| | |
| 8345 | // | | | |
| 8346 | // | RESTSubResp | | |
| 8347 | // |<----------------| | |
| 8348 | // | | SubReq | |
| 8349 | // | |------------->| |
| 8350 | // | | | |
| 8351 | // | | SubResp | |
| 8352 | // | |<-------------| |
| 8353 | // | | | |
| 8354 | // | RESTNotif | | |
| 8355 | // |<----------------| | |
| 8356 | // | | | |
| 8357 | // | RESTSubReq | | |
| 8358 | // |---------------->| | |
| 8359 | // | | | |
| 8360 | // | RESTSubResp | | |
| 8361 | // |<----------------| | |
| 8362 | // | | SubReq | |
| 8363 | // | |------------->| |
| 8364 | // | | |
| 8365 | // | Submgr restart | |
| 8366 | // | | | |
| 8367 | // | RESTSubDelReq | | |
| 8368 | // |---------------->| | |
| 8369 | // | | | |
| 8370 | // | | SubDelReq | |
| 8371 | // | |------------->| |
| 8372 | // | | | |
| 8373 | // | | SubDelResp | |
| 8374 | // | |<-------------| |
| 8375 | // | | | |
| 8376 | // | RESTSubDelResp | | |
| 8377 | // |<----------------| | |
| 8378 | // |
| 8379 | //----------------------------------------------------------------------------- |
| 8380 | |
| 8381 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8382 | |
| 8383 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 8384 | Counter{cRestSubReqFromXapp, 2}, |
| 8385 | Counter{cRestSubRespToXapp, 2}, |
| 8386 | Counter{cSubReqToE2, 2}, |
| 8387 | Counter{cSubRespFromE2, 1}, |
| 8388 | Counter{cRestSubNotifToXapp, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8389 | Counter{cRestSubDelReqFromXapp, 1}, |
| 8390 | Counter{cSubDelReqToE2, 1}, |
Anssi Mannila | 3d80b72 | 2021-11-12 13:17:15 +0200 | [diff] [blame] | 8391 | Counter{cSubDelRespFromE2, 1}, |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8392 | Counter{cRestSubDelRespToXapp, 1}, |
| 8393 | }) |
| 8394 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8395 | const e2Timeout int64 = 1 |
| 8396 | const e2RetryCount int64 = 0 |
| 8397 | const routingNeeded bool = false |
| 8398 | |
| 8399 | // Req1 |
| 8400 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8401 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8402 | // Create subscription |
| 8403 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8404 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8405 | |
| 8406 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8407 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8408 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8409 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 8410 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 8411 | |
| 8412 | // Check subscription |
| 8413 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8414 | |
| 8415 | // Policy change |
| 8416 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 8417 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 8418 | params.SetSubscriptionID(&restSubId) |
| 8419 | params.SetTimeToWait("w200ms") |
| 8420 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 8421 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 8422 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 8423 | |
| 8424 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 8425 | mainCtrl.SetResetTestFlag(t, false) |
| 8426 | |
| 8427 | // SubsResp is missing due to submgr restart |
| 8428 | |
| 8429 | mainCtrl.SimulateRestart(t) |
| 8430 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 8431 | |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8432 | // ReadE2Subscriptions() for testing is running in own go routine (go mainCtrl.c.ReadE2Subscriptions()) |
| 8433 | // That needs to be completed before successful subscription query is possible |
| 8434 | <-time.After(time.Second * 1) |
| 8435 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8436 | // Check subscription |
| 8437 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 8438 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8439 | // Delete subscription |
| 8440 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 8441 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8442 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8443 | |
| 8444 | //Wait that subs is cleaned |
| 8445 | waitSubsCleanup(t, e2SubsId, 10) |
| 8446 | |
| 8447 | mainCtrl.VerifyCounterValues(t) |
Anssi Mannila | b43397e | 2021-11-16 12:06:16 +0200 | [diff] [blame] | 8448 | mainCtrl.VerifyAllClean(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8449 | } |
| 8450 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8451 | //////////////////////////////////////////////////////////////////////////////////// |
| 8452 | // Services for UT cases |
| 8453 | //////////////////////////////////////////////////////////////////////////////////// |
| 8454 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8455 | const host string = "localhost" |
| 8456 | |
| 8457 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 8458 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8459 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8460 | } |
| 8461 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8462 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8463 | |
| 8464 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 8465 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8466 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 8467 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8468 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8469 | |
| 8470 | return restSubId, e2SubsId |
| 8471 | } |
| 8472 | |
| 8473 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 8474 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8475 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8476 | if meid != "" { |
| 8477 | params.SetMeid(meid) |
| 8478 | } |
| 8479 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 8480 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 8481 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8482 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8483 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8484 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8485 | |
| 8486 | return restSubId, e2SubsId |
| 8487 | } |
| 8488 | |
| 8489 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8490 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8491 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8492 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8493 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8494 | |
| 8495 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8496 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8497 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 8498 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8499 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8500 | |
| 8501 | return restSubId, e2SubsId |
| 8502 | } |
| 8503 | |
| 8504 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 8505 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8506 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 8507 | |
| 8508 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 8509 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 8510 | fparams1.Set(crereq1) |
| 8511 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 8512 | |
| 8513 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 8514 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 8515 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 8516 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8517 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8518 | |
| 8519 | return restSubId, e2SubsId |
| 8520 | } |
| 8521 | |
| 8522 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 8523 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 8524 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8525 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8526 | } |
| 8527 | |
| 8528 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 8529 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 8530 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8531 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8532 | } |
| 8533 | |
| 8534 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 8535 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 8536 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 8537 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 8538 | } |
| 8539 | |
| 8540 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 8541 | resp, _ := xapp.Subscription.QuerySubscriptions() |
Anssi Mannila | 54838ed | 2021-11-19 11:25:01 +0200 | [diff] [blame] | 8542 | assert.Equal(t, e2SubsId, resp[0].SubscriptionID) |
| 8543 | assert.Equal(t, meid, resp[0].Meid) |
| 8544 | assert.Equal(t, endpoint, resp[0].ClientEndpoint) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8545 | } |
| 8546 | |
| 8547 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 8548 | //Wait that subs is cleaned |
| 8549 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 8550 | |
| 8551 | xappConn1.TestMsgChanEmpty(t) |
| 8552 | xappConn2.TestMsgChanEmpty(t) |
| 8553 | e2termConn1.TestMsgChanEmpty(t) |
| 8554 | mainCtrl.wait_registry_empty(t, timeout) |
| 8555 | } |
| 8556 | |
| 8557 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 8558 | |
| 8559 | var e2SubsId []uint32 |
| 8560 | |
| 8561 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8562 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8563 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 8564 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 8565 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 8566 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 8567 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8568 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 8569 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8570 | <-time.After(100 * time.Millisecond) |
| 8571 | } |
| 8572 | return e2SubsId |
| 8573 | } |
| 8574 | |
| 8575 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 8576 | |
| 8577 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8578 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8579 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 8580 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 8581 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 8582 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 8583 | <-time.After(100 * time.Millisecond) |
| 8584 | } |
| 8585 | |
| 8586 | // Wait that subs is cleaned |
| 8587 | for i := 0; i < len(e2SubsIds); i++ { |
| 8588 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 8589 | } |
| 8590 | |
| 8591 | } |