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 ( |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 23 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 24 | "testing" |
| 25 | "time" |
| 26 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 31 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 32 | ) |
| 33 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 34 | func TestSuiteSetup(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 35 | // The effect of this call shall endure thgough the UT suite! |
| 36 | // If this causes any issues, the previout interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 37 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 38 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 39 | |
| 40 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 41 | |
| 42 | restDuplicateCtrl.Init() |
| 43 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | //----------------------------------------------------------------------------- |
| 47 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 48 | // |
| 49 | // stub stub stub |
| 50 | // +-------+ +---------+ +---------+ +---------+ |
| 51 | // | xapp | | submgr | | e2term | | rtmgr | |
| 52 | // +-------+ +---------+ +---------+ +---------+ |
| 53 | // | | | | |
| 54 | // | RESTSubReq | | | |
| 55 | // |---------------->| | | |
| 56 | // | | RouteCreate | | |
| 57 | // | |--------------------------->| // The order of these events may vary |
| 58 | // | | | | |
| 59 | // | RESTSubResp | | | // The order of these events may vary |
| 60 | // |<----------------| | | |
| 61 | // | | RouteResponse| | |
| 62 | // | |<---------------------------| // The order of these events may vary |
| 63 | // | | | | |
| 64 | // | | SubReq | | |
| 65 | // | |------------->| | // The order of these events may vary |
| 66 | // | | | | |
| 67 | // | | SubResp | | |
| 68 | // | |<-------------| | |
| 69 | // | RESTNotif1 | | | |
| 70 | // |<----------------| | | |
| 71 | // | | | | |
| 72 | // | RESTSubDelReq | | | |
| 73 | // |---------------->| | | |
| 74 | // | | SubDelReq | | |
| 75 | // | |------------->| | |
| 76 | // | | | | |
| 77 | // | RESTSubDelResp| | | |
| 78 | // |<----------------| | | |
| 79 | // | | | | |
| 80 | // | | SubDelResp | | |
| 81 | // | |<-------------| | |
| 82 | // | | | | |
| 83 | // | | | | |
| 84 | // |
| 85 | //----------------------------------------------------------------------------- |
| 86 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 87 | |
| 88 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 89 | |
| 90 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 91 | |
| 92 | waitSubsCleanup(t, e2SubsId, 10) |
| 93 | } |
| 94 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 95 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 96 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 97 | // |
| 98 | // stub stub stub |
| 99 | // +-------+ +---------+ +---------+ +---------+ |
| 100 | // | xapp | | submgr | | e2term | | rtmgr | |
| 101 | // +-------+ +---------+ +---------+ +---------+ |
| 102 | // | | | | |
| 103 | // | RESTSubReq | | | |
| 104 | // |---------------->| | | |
| 105 | // | | RouteCreate | | |
| 106 | // | |--------------------------->| // The order of these events may vary |
| 107 | // | | | | |
| 108 | // | RESTSubResp | | | // The order of these events may vary |
| 109 | // |<----------------| | | |
| 110 | // | | RouteResponse| | |
| 111 | // | |<---------------------------| // The order of these events may vary |
| 112 | // | | | | |
| 113 | // | | SubReq | | |
| 114 | // | |------------->| | // The order of these events may vary |
| 115 | // | | | | |
| 116 | // | | SubResp | | |
| 117 | // | |<-------------| | |
| 118 | // | RESTNotif1 | | | |
| 119 | // |<----------------| | | |
| 120 | // | | | | |
| 121 | // | RESTSubDelReq | | | |
| 122 | // |---------------->| | | |
| 123 | // | | | | |
| 124 | // | RESTSubDelResp| | | |
| 125 | // |<----------------| | | |
| 126 | // | | | | |
| 127 | // | | | | |
| 128 | // |
| 129 | //----------------------------------------------------------------------------- |
| 130 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 131 | |
| 132 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 133 | |
| 134 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 135 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 136 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 137 | |
| 138 | waitSubsCleanup(t, e2SubsId, 10) |
| 139 | } |
| 140 | |
| 141 | //----------------------------------------------------------------------------- |
| 142 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 143 | // |
| 144 | // stub stub stub |
| 145 | // +-------+ +---------+ +---------+ +---------+ |
| 146 | // | xapp | | submgr | | e2term | | rtmgr | |
| 147 | // +-------+ +---------+ +---------+ +---------+ |
| 148 | // | | | | |
| 149 | // | RESTSubReq | | | |
| 150 | // |---------------->| | | |
| 151 | // | | RouteCreate | | |
| 152 | // | |--------------------------->| // The order of these events may vary |
| 153 | // | | | | |
| 154 | // | RESTSubResp | | | // The order of these events may vary |
| 155 | // |<----------------| | | |
| 156 | // | | RouteResponse| | |
| 157 | // | |<---------------------------| // The order of these events may vary |
| 158 | // | | | | |
| 159 | // | | SubReq | | |
| 160 | // | |------------->| | // The order of these events may vary |
| 161 | // | | | | |
| 162 | // | | SubResp | | |
| 163 | // | |<-------------| | |
| 164 | // | RESTNotif1 | | | |
| 165 | // |<----------------| | | |
| 166 | // | | | | |
| 167 | // | RESTSubDelReq | | | |
| 168 | // |---------------->| | | |
| 169 | // | | SubDelReq | | |
| 170 | // | |------------->| | |
| 171 | // | | | | |
| 172 | // | RESTSubDelResp| | | |
| 173 | // |<----------------| | | // The order of these events may vary |
| 174 | // | | | | |
| 175 | // | | SubDelResp | | |
| 176 | // | |<-------------| | // 1.st NOK |
| 177 | // | | | | |
| 178 | // | | SubDelReq | | |
| 179 | // | |------------->| | |
| 180 | // | | | | |
| 181 | // | | SubDelResp | | |
| 182 | // | |<-------------| | // 2.nd NOK |
| 183 | // |
| 184 | //----------------------------------------------------------------------------- |
| 185 | |
| 186 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 187 | |
| 188 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 189 | |
| 190 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 191 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 192 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 193 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 194 | |
| 195 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 196 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 197 | |
| 198 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 199 | |
| 200 | waitSubsCleanup(t, e2SubsId, 10) |
| 201 | } |
| 202 | |
| 203 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 204 | // TestSubReqAndRouteNok |
| 205 | // |
| 206 | // stub stub |
| 207 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 208 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 209 | // +-------+ +---------+ +---------+ |
| 210 | // | | | |
| 211 | // | SubReq | | |
| 212 | // |------------->| | |
| 213 | // | | | |
| 214 | // | | RouteCreate | |
| 215 | // | |------------->| |
| 216 | // | | | |
| 217 | // | | RouteCreate | |
| 218 | // | | status:400 | |
| 219 | // | |<-------------| |
| 220 | // | | | |
| 221 | // | [SUBS INT DELETE] | |
| 222 | // | | | |
| 223 | // |
| 224 | //----------------------------------------------------------------------------- |
| 225 | |
| 226 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 227 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 228 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 229 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 230 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 231 | Counter{cSubReqFromXapp, 1}, |
| 232 | Counter{cRouteCreateFail, 1}, |
| 233 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 234 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 235 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 236 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 237 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 238 | waiter.WaitResult(t) |
| 239 | |
| 240 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 241 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 242 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 243 | xappConn1.TestMsgChanEmpty(t) |
| 244 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 245 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 246 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 247 | |
| 248 | <-time.After(1 * time.Second) |
| 249 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 253 | // TestSubReqAndRouteUpdateNok |
| 254 | |
| 255 | // stub stub |
| 256 | // +-------+ +-------+ +---------+ +---------+ |
| 257 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 258 | // +-------+ +-------+ +---------+ +---------+ |
| 259 | // | | | | |
| 260 | // | [SUBS CREATE] | | |
| 261 | // | | | | |
| 262 | // | | | | |
| 263 | // | | | | |
| 264 | // | SubReq (mergeable) | | |
| 265 | // |--------------------------->| | | |
| 266 | // | | | | |
| 267 | // | | | RouteUpdate | |
| 268 | // | | |------------->| |
| 269 | // | | | | |
| 270 | // | | | RouteUpdate | |
| 271 | // | | | status:400 | |
| 272 | // | | |<-------------| |
| 273 | // | | | | |
| 274 | // | [SUBS INT DELETE] | | |
| 275 | // | | | | |
| 276 | // | | | | |
| 277 | // | [SUBS DELETE] | | |
| 278 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 279 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 280 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 281 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 282 | |
| 283 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 285 | Counter{cSubReqFromXapp, 2}, |
| 286 | Counter{cSubReqToE2, 1}, |
| 287 | Counter{cSubRespFromE2, 1}, |
| 288 | Counter{cSubRespToXapp, 1}, |
| 289 | Counter{cRouteCreateUpdateFail, 1}, |
| 290 | Counter{cSubDelReqFromXapp, 1}, |
| 291 | Counter{cSubDelReqToE2, 1}, |
| 292 | Counter{cSubDelRespFromE2, 1}, |
| 293 | Counter{cSubDelRespToXapp, 1}, |
| 294 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 295 | |
| 296 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 297 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 298 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 299 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 300 | |
| 301 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 302 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 303 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 304 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 305 | |
| 306 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 307 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 308 | xappConn2.SendSubsReq(t, nil, nil) |
| 309 | waiter.WaitResult(t) |
| 310 | |
| 311 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 312 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 313 | |
| 314 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 315 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 316 | |
| 317 | //Wait that subs is cleaned |
| 318 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 319 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 320 | |
| 321 | xappConn1.TestMsgChanEmpty(t) |
| 322 | xappConn2.TestMsgChanEmpty(t) |
| 323 | e2termConn1.TestMsgChanEmpty(t) |
| 324 | mainCtrl.wait_registry_empty(t, 10) |
| 325 | |
| 326 | mainCtrl.VerifyCounterValues(t) |
| 327 | } |
| 328 | |
| 329 | //----------------------------------------------------------------------------- |
| 330 | // TestSubDelReqAndRouteDeleteNok |
| 331 | // |
| 332 | // stub stub |
| 333 | // +-------+ +---------+ +---------+ +---------+ |
| 334 | // | xapp | | submgr | | e2term | | rtmgr | |
| 335 | // +-------+ +---------+ +---------+ +---------+ |
| 336 | // | | | | |
| 337 | // | [SUBS CREATE] | | |
| 338 | // | | | | |
| 339 | // | | | | |
| 340 | // | | | | |
| 341 | // | SubDelReq | | | |
| 342 | // |------------->| | | |
| 343 | // | | SubDelReq | | |
| 344 | // | |------------->| | |
| 345 | // | | SubDelRsp | | |
| 346 | // | |<-------------| | |
| 347 | // | SubDelRsp | | | |
| 348 | // |<-------------| | | |
| 349 | // | | RouteDelete | | |
| 350 | // | |---------------------------->| |
| 351 | // | | | | |
| 352 | // | | RouteDelete | | |
| 353 | // | | status:400 | | |
| 354 | // | |<----------------------------| |
| 355 | // | | | | |
| 356 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 357 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 358 | |
| 359 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 360 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 361 | Counter{cSubReqFromXapp, 1}, |
| 362 | Counter{cSubReqToE2, 1}, |
| 363 | Counter{cSubRespFromE2, 1}, |
| 364 | Counter{cSubRespToXapp, 1}, |
| 365 | Counter{cSubDelReqFromXapp, 1}, |
| 366 | Counter{cRouteDeleteFail, 1}, |
| 367 | Counter{cSubDelReqToE2, 1}, |
| 368 | Counter{cSubDelRespFromE2, 1}, |
| 369 | Counter{cSubDelRespToXapp, 1}, |
| 370 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 371 | |
| 372 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 373 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 374 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 375 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 376 | |
| 377 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 378 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 379 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 380 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 381 | |
| 382 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 383 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 384 | |
| 385 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 386 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 387 | waiter.WaitResult(t) |
| 388 | |
| 389 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 390 | |
| 391 | //Wait that subs is cleaned |
| 392 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 393 | |
| 394 | xappConn1.TestMsgChanEmpty(t) |
| 395 | xappConn2.TestMsgChanEmpty(t) |
| 396 | e2termConn1.TestMsgChanEmpty(t) |
| 397 | mainCtrl.wait_registry_empty(t, 10) |
| 398 | |
| 399 | mainCtrl.VerifyCounterValues(t) |
| 400 | } |
| 401 | |
| 402 | //----------------------------------------------------------------------------- |
| 403 | // TestSubMergeDelAndRouteUpdateNok |
| 404 | // stub stub |
| 405 | // +-------+ +-------+ +---------+ +---------+ |
| 406 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 407 | // +-------+ +-------+ +---------+ +---------+ |
| 408 | // | | | | |
| 409 | // | | | | |
| 410 | // | | | | |
| 411 | // | | SubReq1 | | |
| 412 | // | |------------->| | |
| 413 | // | | | | |
| 414 | // | | | SubReq1 | |
| 415 | // | | |------------->| |
| 416 | // | | | SubResp1 | |
| 417 | // | | |<-------------| |
| 418 | // | | SubResp1 | | |
| 419 | // | |<-------------| | |
| 420 | // | | | | |
| 421 | // | SubReq2 | | |
| 422 | // |--------------------------->| | |
| 423 | // | | | | |
| 424 | // | SubResp2 | | |
| 425 | // |<---------------------------| | |
| 426 | // | | | | |
| 427 | // | | SubDelReq 1 | | |
| 428 | // | |------------->| | |
| 429 | // | | | RouteUpdate | |
| 430 | // | | |-----> rtmgr | |
| 431 | // | | | | |
| 432 | // | | | RouteUpdate | |
| 433 | // | | | status:400 | |
| 434 | // | | |<----- rtmgr | |
| 435 | // | | | | |
| 436 | // | | SubDelResp 1 | | |
| 437 | // | |<-------------| | |
| 438 | // | | | | |
| 439 | // | SubDelReq 2 | | |
| 440 | // |--------------------------->| | |
| 441 | // | | | | |
| 442 | // | | | SubDelReq 2 | |
| 443 | // | | |------------->| |
| 444 | // | | | | |
| 445 | // | | | SubDelReq 2 | |
| 446 | // | | |------------->| |
| 447 | // | | | | |
| 448 | // | SubDelResp 2 | | |
| 449 | // |<---------------------------| | |
| 450 | // |
| 451 | //----------------------------------------------------------------------------- |
| 452 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 453 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 454 | |
| 455 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 456 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 457 | Counter{cSubReqFromXapp, 2}, |
| 458 | Counter{cSubReqToE2, 1}, |
| 459 | Counter{cSubRespFromE2, 1}, |
| 460 | Counter{cSubRespToXapp, 2}, |
| 461 | Counter{cSubDelReqFromXapp, 2}, |
| 462 | Counter{cRouteDeleteUpdateFail, 1}, |
| 463 | Counter{cSubDelReqToE2, 1}, |
| 464 | Counter{cSubDelRespFromE2, 1}, |
| 465 | Counter{cSubDelRespToXapp, 2}, |
| 466 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 467 | |
| 468 | //Req1 |
| 469 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 470 | rparams1.Init() |
| 471 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 472 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 473 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 474 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 475 | |
| 476 | //Req2 |
| 477 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 478 | rparams2.Init() |
| 479 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 480 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 481 | |
| 482 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 483 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 484 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 485 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 486 | |
| 487 | //Del1 |
| 488 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 489 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 490 | waiter.WaitResult(t) |
| 491 | |
| 492 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 493 | |
| 494 | //Del2 |
| 495 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 496 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 497 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 498 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 499 | //Wait that subs is cleaned |
| 500 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 501 | |
| 502 | xappConn1.TestMsgChanEmpty(t) |
| 503 | xappConn2.TestMsgChanEmpty(t) |
| 504 | e2termConn1.TestMsgChanEmpty(t) |
| 505 | mainCtrl.wait_registry_empty(t, 10) |
| 506 | |
| 507 | mainCtrl.VerifyCounterValues(t) |
| 508 | } |
| 509 | |
| 510 | //----------------------------------------------------------------------------- |
| 511 | |
| 512 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 513 | // TestSubReqAndSubDelOk |
| 514 | // |
| 515 | // stub stub |
| 516 | // +-------+ +---------+ +---------+ |
| 517 | // | xapp | | submgr | | e2term | |
| 518 | // +-------+ +---------+ +---------+ |
| 519 | // | | | |
| 520 | // | SubReq | | |
| 521 | // |------------->| | |
| 522 | // | | | |
| 523 | // | | SubReq | |
| 524 | // | |------------->| |
| 525 | // | | | |
| 526 | // | | SubResp | |
| 527 | // | |<-------------| |
| 528 | // | | | |
| 529 | // | SubResp | | |
| 530 | // |<-------------| | |
| 531 | // | | | |
| 532 | // | | | |
| 533 | // | SubDelReq | | |
| 534 | // |------------->| | |
| 535 | // | | | |
| 536 | // | | SubDelReq | |
| 537 | // | |------------->| |
| 538 | // | | | |
| 539 | // | | SubDelResp | |
| 540 | // | |<-------------| |
| 541 | // | | | |
| 542 | // | SubDelResp | | |
| 543 | // |<-------------| | |
| 544 | // |
| 545 | //----------------------------------------------------------------------------- |
| 546 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 547 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 548 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 549 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 550 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 551 | Counter{cSubReqFromXapp, 1}, |
| 552 | Counter{cSubReqToE2, 1}, |
| 553 | Counter{cSubRespFromE2, 1}, |
| 554 | Counter{cSubRespToXapp, 1}, |
| 555 | Counter{cSubDelReqFromXapp, 1}, |
| 556 | Counter{cSubDelReqToE2, 1}, |
| 557 | Counter{cSubDelRespFromE2, 1}, |
| 558 | Counter{cSubDelRespToXapp, 1}, |
| 559 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 560 | |
| 561 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 562 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 563 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 564 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 565 | |
| 566 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 567 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 568 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 569 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 570 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 571 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 572 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 573 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 574 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 575 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 576 | |
| 577 | //Wait that subs is cleaned |
| 578 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 579 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 580 | xappConn1.TestMsgChanEmpty(t) |
| 581 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 582 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 583 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 584 | |
| 585 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | //----------------------------------------------------------------------------- |
| 589 | // TestSubReqRetransmission |
| 590 | // |
| 591 | // stub stub |
| 592 | // +-------+ +---------+ +---------+ |
| 593 | // | xapp | | submgr | | e2term | |
| 594 | // +-------+ +---------+ +---------+ |
| 595 | // | | | |
| 596 | // | SubReq | | |
| 597 | // |------------->| | |
| 598 | // | | | |
| 599 | // | | SubReq | |
| 600 | // | |------------->| |
| 601 | // | | | |
| 602 | // | SubReq | | |
| 603 | // | (retrans) | | |
| 604 | // |------------->| | |
| 605 | // | | | |
| 606 | // | | SubResp | |
| 607 | // | |<-------------| |
| 608 | // | | | |
| 609 | // | SubResp | | |
| 610 | // |<-------------| | |
| 611 | // | | | |
| 612 | // | [SUBS DELETE] | |
| 613 | // | | | |
| 614 | // |
| 615 | //----------------------------------------------------------------------------- |
| 616 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 617 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 618 | |
| 619 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 620 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 621 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 622 | |
| 623 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 624 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 625 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 626 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 627 | // hack as there is no real way to see has message be handled. |
| 628 | // Previuos counter check just tells that is has been received by submgr |
| 629 | // --> artificial delay |
| 630 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 631 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 632 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 633 | |
| 634 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 635 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 636 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 637 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 638 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 639 | |
| 640 | //Wait that subs is cleaned |
| 641 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 642 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 643 | xappConn1.TestMsgChanEmpty(t) |
| 644 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 645 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 646 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | //----------------------------------------------------------------------------- |
| 650 | // TestSubDelReqRetransmission |
| 651 | // |
| 652 | // stub stub |
| 653 | // +-------+ +---------+ +---------+ |
| 654 | // | xapp | | submgr | | e2term | |
| 655 | // +-------+ +---------+ +---------+ |
| 656 | // | | | |
| 657 | // | [SUBS CREATE] | |
| 658 | // | | | |
| 659 | // | | | |
| 660 | // | SubDelReq | | |
| 661 | // |------------->| | |
| 662 | // | | | |
| 663 | // | | SubDelReq | |
| 664 | // | |------------->| |
| 665 | // | | | |
| 666 | // | SubDelReq | | |
| 667 | // | (same sub) | | |
| 668 | // | (same xid) | | |
| 669 | // |------------->| | |
| 670 | // | | | |
| 671 | // | | SubDelResp | |
| 672 | // | |<-------------| |
| 673 | // | | | |
| 674 | // | SubDelResp | | |
| 675 | // |<-------------| | |
| 676 | // |
| 677 | //----------------------------------------------------------------------------- |
| 678 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 679 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 680 | |
| 681 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 682 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 683 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 684 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 685 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 686 | |
| 687 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 688 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 689 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 690 | |
| 691 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 692 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 693 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 694 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 695 | // hack as there is no real way to see has message be handled. |
| 696 | // Previuos counter check just tells that is has been received by submgr |
| 697 | // --> artificial delay |
| 698 | <-time.After(1 * time.Second) |
| 699 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 700 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 701 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 702 | |
| 703 | //Wait that subs is cleaned |
| 704 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 705 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 706 | xappConn1.TestMsgChanEmpty(t) |
| 707 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 708 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 709 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | //----------------------------------------------------------------------------- |
| 713 | // TestSubDelReqCollision |
| 714 | // |
| 715 | // stub stub |
| 716 | // +-------+ +---------+ +---------+ |
| 717 | // | xapp | | submgr | | e2term | |
| 718 | // +-------+ +---------+ +---------+ |
| 719 | // | | | |
| 720 | // | [SUBS CREATE] | |
| 721 | // | | | |
| 722 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 723 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 724 | // |------------->| | |
| 725 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 726 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 727 | // | |------------->| |
| 728 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 729 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 730 | // | (same sub) | | |
| 731 | // | (diff xid) | | |
| 732 | // |------------->| | |
| 733 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 734 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 735 | // | |<-------------| |
| 736 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 737 | // | SubDelResp 1 | | |
| 738 | // |<-------------| | |
| 739 | // | | | |
| 740 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 741 | // |<-------------| | |
| 742 | // |
| 743 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 744 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 745 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 746 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 747 | |
| 748 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 749 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 750 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 751 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 752 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 753 | |
| 754 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 755 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 756 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 757 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 758 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 759 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 760 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 761 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 762 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 763 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 764 | // hack as there is no real way to see has message be handled. |
| 765 | // Previuos counter check just tells that is has been received by submgr |
| 766 | // --> artificial delay |
| 767 | <-time.After(1 * time.Second) |
| 768 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 769 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 770 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 771 | |
| 772 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 773 | xappConn1.RecvSubsDelResp(t, nil) |
| 774 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 775 | |
| 776 | //Wait that subs is cleaned |
| 777 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 778 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 779 | xappConn1.TestMsgChanEmpty(t) |
| 780 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 781 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 782 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | //----------------------------------------------------------------------------- |
| 786 | // TestSubReqAndSubDelOkTwoParallel |
| 787 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 788 | // stub stub stub |
| 789 | // +-------+ +-------+ +---------+ +---------+ |
| 790 | // | xapp | | xapp | | submgr | | e2term | |
| 791 | // +-------+ +-------+ +---------+ +---------+ |
| 792 | // | | | | |
| 793 | // | | | | |
| 794 | // | | | | |
| 795 | // | | SubReq1 | | |
| 796 | // | |------------->| | |
| 797 | // | | | | |
| 798 | // | | | SubReq1 | |
| 799 | // | | |------------->| |
| 800 | // | | | | |
| 801 | // | SubReq2 | | |
| 802 | // |------------------------>| | |
| 803 | // | | | | |
| 804 | // | | | SubReq2 | |
| 805 | // | | |------------->| |
| 806 | // | | | | |
| 807 | // | | | SubResp1 | |
| 808 | // | | |<-------------| |
| 809 | // | | SubResp1 | | |
| 810 | // | |<-------------| | |
| 811 | // | | | | |
| 812 | // | | | SubResp2 | |
| 813 | // | | |<-------------| |
| 814 | // | SubResp2 | | |
| 815 | // |<------------------------| | |
| 816 | // | | | | |
| 817 | // | | [SUBS 1 DELETE] | |
| 818 | // | | | | |
| 819 | // | | [SUBS 2 DELETE] | |
| 820 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 821 | // |
| 822 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 823 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 824 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 825 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 826 | |
| 827 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 828 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 829 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 830 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 831 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 832 | |
| 833 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 834 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 835 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 836 | |
| 837 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 838 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 839 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 840 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 841 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 842 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 843 | |
| 844 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 845 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 847 | |
| 848 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 849 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 850 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 851 | |
| 852 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 853 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 854 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 855 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 856 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 857 | //Wait that subs is cleaned |
| 858 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 859 | |
| 860 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 861 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 862 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 863 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 864 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 865 | //Wait that subs is cleaned |
| 866 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 867 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 868 | xappConn1.TestMsgChanEmpty(t) |
| 869 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 870 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 871 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | //----------------------------------------------------------------------------- |
| 875 | // TestSameSubsDiffRan |
| 876 | // Same subscription to different RANs |
| 877 | // |
| 878 | // stub stub |
| 879 | // +-------+ +---------+ +---------+ |
| 880 | // | xapp | | submgr | | e2term | |
| 881 | // +-------+ +---------+ +---------+ |
| 882 | // | | | |
| 883 | // | | | |
| 884 | // | | | |
| 885 | // | SubReq(r1) | | |
| 886 | // |------------->| | |
| 887 | // | | | |
| 888 | // | | SubReq(r1) | |
| 889 | // | |------------->| |
| 890 | // | | | |
| 891 | // | | SubResp(r1) | |
| 892 | // | |<-------------| |
| 893 | // | | | |
| 894 | // | SubResp(r1) | | |
| 895 | // |<-------------| | |
| 896 | // | | | |
| 897 | // | SubReq(r2) | | |
| 898 | // |------------->| | |
| 899 | // | | | |
| 900 | // | | SubReq(r2) | |
| 901 | // | |------------->| |
| 902 | // | | | |
| 903 | // | | SubResp(r2) | |
| 904 | // | |<-------------| |
| 905 | // | | | |
| 906 | // | SubResp(r2) | | |
| 907 | // |<-------------| | |
| 908 | // | | | |
| 909 | // | [SUBS r1 DELETE] | |
| 910 | // | | | |
| 911 | // | [SUBS r2 DELETE] | |
| 912 | // | | | |
| 913 | // |
| 914 | //----------------------------------------------------------------------------- |
| 915 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 916 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 917 | |
| 918 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 920 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 921 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 922 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 923 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 924 | |
| 925 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 926 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 927 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 928 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 929 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 930 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 931 | |
| 932 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 933 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 934 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 935 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 936 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 937 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 938 | //Wait that subs is cleaned |
| 939 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 940 | |
| 941 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 942 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 943 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 944 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 945 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 946 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 947 | //Wait that subs is cleaned |
| 948 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 949 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 950 | xappConn1.TestMsgChanEmpty(t) |
| 951 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 952 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 953 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | //----------------------------------------------------------------------------- |
| 957 | // TestSubReqRetryInSubmgr |
| 958 | // |
| 959 | // stub stub |
| 960 | // +-------+ +---------+ +---------+ |
| 961 | // | xapp | | submgr | | e2term | |
| 962 | // +-------+ +---------+ +---------+ |
| 963 | // | | | |
| 964 | // | SubReq | | |
| 965 | // |------------->| | |
| 966 | // | | | |
| 967 | // | | SubReq | |
| 968 | // | |------------->| |
| 969 | // | | | |
| 970 | // | | | |
| 971 | // | | SubReq | |
| 972 | // | |------------->| |
| 973 | // | | | |
| 974 | // | | SubResp | |
| 975 | // | |<-------------| |
| 976 | // | | | |
| 977 | // | SubResp | | |
| 978 | // |<-------------| | |
| 979 | // | | | |
| 980 | // | [SUBS DELETE] | |
| 981 | // | | | |
| 982 | // |
| 983 | //----------------------------------------------------------------------------- |
| 984 | |
| 985 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 986 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 987 | |
| 988 | // Init counter check |
| 989 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 990 | Counter{cSubReqFromXapp, 1}, |
| 991 | Counter{cSubReqToE2, 1}, |
| 992 | Counter{cSubReReqToE2, 1}, |
| 993 | Counter{cSubRespFromE2, 1}, |
| 994 | Counter{cSubRespToXapp, 1}, |
| 995 | Counter{cSubDelReqFromXapp, 1}, |
| 996 | Counter{cSubDelReqToE2, 1}, |
| 997 | Counter{cSubDelRespFromE2, 1}, |
| 998 | Counter{cSubDelRespToXapp, 1}, |
| 999 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1000 | |
| 1001 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1002 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1003 | |
| 1004 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1005 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | |
| 1007 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1008 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1009 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1010 | |
| 1011 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1012 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1013 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1014 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1015 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1016 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1017 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1018 | |
| 1019 | // Wait that subs is cleaned |
| 1020 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1021 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1022 | xappConn1.TestMsgChanEmpty(t) |
| 1023 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1024 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1025 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1026 | |
| 1027 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | //----------------------------------------------------------------------------- |
| 1031 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1032 | // |
| 1033 | // stub stub |
| 1034 | // +-------+ +---------+ +---------+ |
| 1035 | // | xapp | | submgr | | e2term | |
| 1036 | // +-------+ +---------+ +---------+ |
| 1037 | // | | | |
| 1038 | // | SubReq | | |
| 1039 | // |------------->| | |
| 1040 | // | | | |
| 1041 | // | | SubReq | |
| 1042 | // | |------------->| |
| 1043 | // | | | |
| 1044 | // | | | |
| 1045 | // | | SubReq | |
| 1046 | // | |------------->| |
| 1047 | // | | | |
| 1048 | // | | SubDelReq | |
| 1049 | // | |------------->| |
| 1050 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1051 | // | | SubDelResp | |
| 1052 | // | |<-------------| |
| 1053 | // | | | |
| 1054 | // |
| 1055 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1056 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1057 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1058 | |
| 1059 | // Init counter check |
| 1060 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1061 | Counter{cSubReqFromXapp, 1}, |
| 1062 | Counter{cSubReqToE2, 1}, |
| 1063 | Counter{cSubReReqToE2, 1}, |
| 1064 | Counter{cSubReqTimerExpiry, 2}, |
| 1065 | Counter{cSubDelReqToE2, 1}, |
| 1066 | Counter{cSubDelRespFromE2, 1}, |
| 1067 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1068 | |
| 1069 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1070 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1071 | |
| 1072 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1073 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1074 | |
| 1075 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1076 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1077 | |
| 1078 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1079 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1080 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1081 | |
| 1082 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1083 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1084 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1085 | xappConn1.TestMsgChanEmpty(t) |
| 1086 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1087 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1088 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1089 | |
| 1090 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1091 | } |
| 1092 | |
| 1093 | //----------------------------------------------------------------------------- |
| 1094 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1095 | // |
| 1096 | // stub stub |
| 1097 | // +-------+ +---------+ +---------+ |
| 1098 | // | xapp | | submgr | | e2term | |
| 1099 | // +-------+ +---------+ +---------+ |
| 1100 | // | | | |
| 1101 | // | SubReq | | |
| 1102 | // |------------->| | |
| 1103 | // | | | |
| 1104 | // | | SubReq | |
| 1105 | // | |------------->| |
| 1106 | // | | | |
| 1107 | // | | | |
| 1108 | // | | SubReq | |
| 1109 | // | |------------->| |
| 1110 | // | | | |
| 1111 | // | | SubDelReq | |
| 1112 | // | |------------->| |
| 1113 | // | | | |
| 1114 | // | | | |
| 1115 | // | | SubDelReq | |
| 1116 | // | |------------->| |
| 1117 | // | | | |
| 1118 | // | | | |
| 1119 | // |
| 1120 | //----------------------------------------------------------------------------- |
| 1121 | |
| 1122 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1124 | |
| 1125 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1126 | Counter{cSubReqFromXapp, 1}, |
| 1127 | Counter{cSubReqToE2, 1}, |
| 1128 | Counter{cSubReReqToE2, 1}, |
| 1129 | Counter{cSubReqTimerExpiry, 2}, |
| 1130 | Counter{cSubDelReqToE2, 1}, |
| 1131 | Counter{cSubDelReReqToE2, 1}, |
| 1132 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1133 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1134 | |
| 1135 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1137 | |
| 1138 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1139 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1140 | |
| 1141 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1142 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | |
| 1144 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1148 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1149 | |
| 1150 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1151 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1153 | xappConn1.TestMsgChanEmpty(t) |
| 1154 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1155 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1156 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1157 | |
| 1158 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | //----------------------------------------------------------------------------- |
| 1162 | // TestSubReqSubFailRespInSubmgr |
| 1163 | // |
| 1164 | // stub stub |
| 1165 | // +-------+ +---------+ +---------+ |
| 1166 | // | xapp | | submgr | | e2term | |
| 1167 | // +-------+ +---------+ +---------+ |
| 1168 | // | | | |
| 1169 | // | SubReq | | |
| 1170 | // |------------->| | |
| 1171 | // | | | |
| 1172 | // | | SubReq | |
| 1173 | // | |------------->| |
| 1174 | // | | | |
| 1175 | // | | SubFail | |
| 1176 | // | |<-------------| |
| 1177 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1178 | // | | SubDelReq | |
| 1179 | // | |------------->| |
| 1180 | // | | | |
| 1181 | // | | SubDelResp | |
| 1182 | // | |<-------------| |
| 1183 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1184 | // | SubFail | | |
| 1185 | // |<-------------| | |
| 1186 | // | | | |
| 1187 | // |
| 1188 | //----------------------------------------------------------------------------- |
| 1189 | |
| 1190 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1191 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1192 | |
| 1193 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1194 | Counter{cSubReqFromXapp, 1}, |
| 1195 | Counter{cSubReqToE2, 1}, |
| 1196 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1197 | Counter{cSubFailToXapp, 1}, |
| 1198 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1199 | |
| 1200 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1201 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1202 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1203 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1204 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1205 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1206 | fparams1.Set(crereq1) |
| 1207 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1208 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1209 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1212 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1213 | // Xapp: Receive SubsFail |
| 1214 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1215 | |
| 1216 | // Wait that subs is cleaned |
| 1217 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1218 | |
| 1219 | xappConn1.TestMsgChanEmpty(t) |
| 1220 | xappConn2.TestMsgChanEmpty(t) |
| 1221 | e2termConn1.TestMsgChanEmpty(t) |
| 1222 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1223 | |
| 1224 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1228 | // TestSubDelReqRetryInSubmgr |
| 1229 | // |
| 1230 | // stub stub |
| 1231 | // +-------+ +---------+ +---------+ |
| 1232 | // | xapp | | submgr | | e2term | |
| 1233 | // +-------+ +---------+ +---------+ |
| 1234 | // | | | |
| 1235 | // | [SUBS CREATE] | |
| 1236 | // | | | |
| 1237 | // | | | |
| 1238 | // | SubDelReq | | |
| 1239 | // |------------->| | |
| 1240 | // | | | |
| 1241 | // | | SubDelReq | |
| 1242 | // | |------------->| |
| 1243 | // | | | |
| 1244 | // | | SubDelReq | |
| 1245 | // | |------------->| |
| 1246 | // | | | |
| 1247 | // | | SubDelResp | |
| 1248 | // | |<-------------| |
| 1249 | // | | | |
| 1250 | // | SubDelResp | | |
| 1251 | // |<-------------| | |
| 1252 | // |
| 1253 | //----------------------------------------------------------------------------- |
| 1254 | |
| 1255 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1256 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1257 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1258 | |
| 1259 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1260 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1261 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1262 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1263 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1264 | |
| 1265 | // Subs Delete |
| 1266 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1267 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1268 | |
| 1269 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1270 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1271 | |
| 1272 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1273 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1274 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1275 | |
| 1276 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1277 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1278 | |
| 1279 | // Wait that subs is cleaned |
| 1280 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1281 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1282 | xappConn1.TestMsgChanEmpty(t) |
| 1283 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1284 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1285 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1286 | } |
| 1287 | |
| 1288 | //----------------------------------------------------------------------------- |
| 1289 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1290 | // |
| 1291 | // stub stub |
| 1292 | // +-------+ +---------+ +---------+ |
| 1293 | // | xapp | | submgr | | e2term | |
| 1294 | // +-------+ +---------+ +---------+ |
| 1295 | // | | | |
| 1296 | // | [SUBS CREATE] | |
| 1297 | // | | | |
| 1298 | // | | | |
| 1299 | // | SubDelReq | | |
| 1300 | // |------------->| | |
| 1301 | // | | | |
| 1302 | // | | SubDelReq | |
| 1303 | // | |------------->| |
| 1304 | // | | | |
| 1305 | // | | SubDelReq | |
| 1306 | // | |------------->| |
| 1307 | // | | | |
| 1308 | // | | | |
| 1309 | // | SubDelResp | | |
| 1310 | // |<-------------| | |
| 1311 | // |
| 1312 | //----------------------------------------------------------------------------- |
| 1313 | |
| 1314 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1315 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1316 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1317 | |
| 1318 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1320 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1321 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1322 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1323 | |
| 1324 | // Subs Delete |
| 1325 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1326 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | |
| 1328 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1329 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1330 | |
| 1331 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1332 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1333 | |
| 1334 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1335 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1336 | |
| 1337 | // Wait that subs is cleaned |
| 1338 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1339 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1340 | xappConn1.TestMsgChanEmpty(t) |
| 1341 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1342 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1343 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1344 | } |
| 1345 | |
| 1346 | //----------------------------------------------------------------------------- |
| 1347 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1348 | // |
| 1349 | // stub stub |
| 1350 | // +-------+ +---------+ +---------+ |
| 1351 | // | xapp | | submgr | | e2term | |
| 1352 | // +-------+ +---------+ +---------+ |
| 1353 | // | | | |
| 1354 | // | [SUBS CREATE] | |
| 1355 | // | | | |
| 1356 | // | | | |
| 1357 | // | SubDelReq | | |
| 1358 | // |------------->| | |
| 1359 | // | | | |
| 1360 | // | | SubDelReq | |
| 1361 | // | |------------->| |
| 1362 | // | | | |
| 1363 | // | | SubDelFail | |
| 1364 | // | |<-------------| |
| 1365 | // | | | |
| 1366 | // | SubDelResp | | |
| 1367 | // |<-------------| | |
| 1368 | // | | | |
| 1369 | // |
| 1370 | //----------------------------------------------------------------------------- |
| 1371 | |
| 1372 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1373 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1374 | |
| 1375 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1376 | Counter{cSubReqFromXapp, 1}, |
| 1377 | Counter{cSubReqToE2, 1}, |
| 1378 | Counter{cSubRespFromE2, 1}, |
| 1379 | Counter{cSubRespToXapp, 1}, |
| 1380 | Counter{cSubDelReqFromXapp, 1}, |
| 1381 | Counter{cSubDelReqToE2, 1}, |
| 1382 | Counter{cSubDelFailFromE2, 1}, |
| 1383 | Counter{cSubDelRespToXapp, 1}, |
| 1384 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1385 | |
| 1386 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1387 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1388 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1389 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1390 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1391 | |
| 1392 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1393 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1394 | |
| 1395 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1396 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1397 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1398 | |
| 1399 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1400 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1401 | |
| 1402 | // Wait that subs is cleaned |
| 1403 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1404 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1405 | xappConn1.TestMsgChanEmpty(t) |
| 1406 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1407 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1408 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1409 | |
| 1410 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | //----------------------------------------------------------------------------- |
| 1414 | // TestSubReqAndSubDelOkSameAction |
| 1415 | // |
| 1416 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1417 | // +-------+ +-------+ +---------+ +---------+ |
| 1418 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1419 | // +-------+ +-------+ +---------+ +---------+ |
| 1420 | // | | | | |
| 1421 | // | | | | |
| 1422 | // | | | | |
| 1423 | // | | SubReq1 | | |
| 1424 | // | |------------->| | |
| 1425 | // | | | | |
| 1426 | // | | | SubReq1 | |
| 1427 | // | | |------------->| |
| 1428 | // | | | SubResp1 | |
| 1429 | // | | |<-------------| |
| 1430 | // | | SubResp1 | | |
| 1431 | // | |<-------------| | |
| 1432 | // | | | | |
| 1433 | // | SubReq2 | | |
| 1434 | // |--------------------------->| | |
| 1435 | // | | | | |
| 1436 | // | SubResp2 | | |
| 1437 | // |<---------------------------| | |
| 1438 | // | | | | |
| 1439 | // | | SubDelReq 1 | | |
| 1440 | // | |------------->| | |
| 1441 | // | | | | |
| 1442 | // | | SubDelResp 1 | | |
| 1443 | // | |<-------------| | |
| 1444 | // | | | | |
| 1445 | // | SubDelReq 2 | | |
| 1446 | // |--------------------------->| | |
| 1447 | // | | | | |
| 1448 | // | | | SubDelReq 2 | |
| 1449 | // | | |------------->| |
| 1450 | // | | | | |
| 1451 | // | | | SubDelReq 2 | |
| 1452 | // | | |------------->| |
| 1453 | // | | | | |
| 1454 | // | SubDelResp 2 | | |
| 1455 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1456 | // |
| 1457 | //----------------------------------------------------------------------------- |
| 1458 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1459 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1460 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1461 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1462 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1463 | Counter{cSubReqFromXapp, 2}, |
| 1464 | Counter{cSubReqToE2, 1}, |
| 1465 | Counter{cSubRespFromE2, 1}, |
| 1466 | Counter{cSubRespToXapp, 2}, |
| 1467 | Counter{cMergedSubscriptions, 1}, |
| 1468 | Counter{cUnmergedSubscriptions, 1}, |
| 1469 | Counter{cSubDelReqFromXapp, 2}, |
| 1470 | Counter{cSubDelReqToE2, 1}, |
| 1471 | Counter{cSubDelRespFromE2, 1}, |
| 1472 | Counter{cSubDelRespToXapp, 2}, |
| 1473 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1474 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1475 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1476 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1477 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1478 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1479 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1480 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1482 | |
| 1483 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1484 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1485 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1486 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1487 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1488 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1489 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1490 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1491 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1492 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1493 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1494 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1495 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1496 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1497 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1498 | //e2termConn1.RecvSubsDelReq(t) |
| 1499 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1500 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1501 | //Wait that subs is cleaned |
| 1502 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1503 | |
| 1504 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1505 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1506 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1507 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1508 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1509 | //Wait that subs is cleaned |
| 1510 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1511 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1512 | xappConn1.TestMsgChanEmpty(t) |
| 1513 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1514 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1515 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1516 | |
| 1517 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1518 | } |
| 1519 | |
| 1520 | //----------------------------------------------------------------------------- |
| 1521 | // TestSubReqAndSubDelOkSameActionParallel |
| 1522 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1523 | // stub stub stub |
| 1524 | // +-------+ +-------+ +---------+ +---------+ |
| 1525 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1526 | // +-------+ +-------+ +---------+ +---------+ |
| 1527 | // | | | | |
| 1528 | // | | | | |
| 1529 | // | | | | |
| 1530 | // | | SubReq1 | | |
| 1531 | // | |------------->| | |
| 1532 | // | | | | |
| 1533 | // | | | SubReq1 | |
| 1534 | // | | |------------->| |
| 1535 | // | SubReq2 | | |
| 1536 | // |--------------------------->| | |
| 1537 | // | | | SubResp1 | |
| 1538 | // | | |<-------------| |
| 1539 | // | | SubResp1 | | |
| 1540 | // | |<-------------| | |
| 1541 | // | | | | |
| 1542 | // | SubResp2 | | |
| 1543 | // |<---------------------------| | |
| 1544 | // | | | | |
| 1545 | // | | SubDelReq 1 | | |
| 1546 | // | |------------->| | |
| 1547 | // | | | | |
| 1548 | // | | SubDelResp 1 | | |
| 1549 | // | |<-------------| | |
| 1550 | // | | | | |
| 1551 | // | SubDelReq 2 | | |
| 1552 | // |--------------------------->| | |
| 1553 | // | | | | |
| 1554 | // | | | SubDelReq 2 | |
| 1555 | // | | |------------->| |
| 1556 | // | | | | |
| 1557 | // | | | SubDelReq 2 | |
| 1558 | // | | |------------->| |
| 1559 | // | | | | |
| 1560 | // | SubDelResp 2 | | |
| 1561 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1562 | // |
| 1563 | //----------------------------------------------------------------------------- |
| 1564 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1565 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1566 | |
| 1567 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1568 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1569 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1570 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1571 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1572 | |
| 1573 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1574 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1575 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1576 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1577 | |
| 1578 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1579 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1580 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1581 | |
| 1582 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1583 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1584 | |
| 1585 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1586 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1587 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1588 | |
| 1589 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1590 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1591 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1592 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1593 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1594 | |
| 1595 | //Wait that subs is cleaned |
| 1596 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1597 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1598 | xappConn1.TestMsgChanEmpty(t) |
| 1599 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1600 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1601 | mainCtrl.wait_registry_empty(t, 10) |
| 1602 | } |
| 1603 | |
| 1604 | //----------------------------------------------------------------------------- |
| 1605 | // TestSubReqAndSubDelNokSameActionParallel |
| 1606 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1607 | // stub stub stub |
| 1608 | // +-------+ +-------+ +---------+ +---------+ |
| 1609 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1610 | // +-------+ +-------+ +---------+ +---------+ |
| 1611 | // | | | | |
| 1612 | // | | | | |
| 1613 | // | | | | |
| 1614 | // | | SubReq1 | | |
| 1615 | // | |------------->| | |
| 1616 | // | | | | |
| 1617 | // | | | SubReq1 | |
| 1618 | // | | |------------->| |
| 1619 | // | SubReq2 | | |
| 1620 | // |--------------------------->| | |
| 1621 | // | | | SubFail1 | |
| 1622 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1623 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1624 | // | | | SubDelReq | |
| 1625 | // | | |------------->| |
| 1626 | // | | | SubDelResp | |
| 1627 | // | | |<-------------| |
| 1628 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1629 | // | | SubFail1 | | |
| 1630 | // | |<-------------| | |
| 1631 | // | | | | |
| 1632 | // | SubFail2 | | |
| 1633 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1634 | // |
| 1635 | //----------------------------------------------------------------------------- |
| 1636 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1637 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1638 | |
| 1639 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1640 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1641 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1642 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1643 | |
| 1644 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1645 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1646 | |
| 1647 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1648 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1649 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1650 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1651 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1652 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1653 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1654 | // E2t: send SubsFail (first) |
| 1655 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1656 | fparams1.Set(crereq1) |
| 1657 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1658 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1659 | // E2t: internal delete |
| 1660 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1661 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1662 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1663 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1664 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1665 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1666 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1667 | |
| 1668 | //Wait that subs is cleaned |
| 1669 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1670 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1671 | xappConn1.TestMsgChanEmpty(t) |
| 1672 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1673 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1674 | mainCtrl.wait_registry_empty(t, 10) |
| 1675 | } |
| 1676 | |
| 1677 | //----------------------------------------------------------------------------- |
| 1678 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1679 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1680 | // stub stub stub |
| 1681 | // +-------+ +-------+ +---------+ +---------+ |
| 1682 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1683 | // +-------+ +-------+ +---------+ +---------+ |
| 1684 | // | | | | |
| 1685 | // | | | | |
| 1686 | // | | | | |
| 1687 | // | | SubReq1 | | |
| 1688 | // | |------------->| | |
| 1689 | // | | | | |
| 1690 | // | | | SubReq1 | |
| 1691 | // | | |------------->| |
| 1692 | // | | SubReq2 | | |
| 1693 | // |--------------------------->| | |
| 1694 | // | | | | |
| 1695 | // | | | SubReq1 | |
| 1696 | // | | |------------->| |
| 1697 | // | | | | |
| 1698 | // | | | | |
| 1699 | // | | | SubDelReq | |
| 1700 | // | | |------------->| |
| 1701 | // | | | | |
| 1702 | // | | | SubDelResp | |
| 1703 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1704 | // |
| 1705 | //----------------------------------------------------------------------------- |
| 1706 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1707 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1708 | |
| 1709 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1710 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1711 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1712 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1713 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1714 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1715 | |
| 1716 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1717 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1718 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1719 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1720 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1721 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1722 | |
| 1723 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1724 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1725 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1726 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1727 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1728 | |
| 1729 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1730 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1731 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1732 | xappConn1.TestMsgChanEmpty(t) |
| 1733 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1734 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1735 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1736 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1737 | |
| 1738 | //----------------------------- Policy cases --------------------------------- |
| 1739 | //----------------------------------------------------------------------------- |
| 1740 | // TestSubReqPolicyAndSubDelOk |
| 1741 | // |
| 1742 | // stub stub |
| 1743 | // +-------+ +---------+ +---------+ |
| 1744 | // | xapp | | submgr | | e2term | |
| 1745 | // +-------+ +---------+ +---------+ |
| 1746 | // | | | |
| 1747 | // | SubReq | | |
| 1748 | // |------------->| | |
| 1749 | // | | | |
| 1750 | // | | SubReq | |
| 1751 | // | |------------->| |
| 1752 | // | | | |
| 1753 | // | | SubResp | |
| 1754 | // | |<-------------| |
| 1755 | // | | | |
| 1756 | // | SubResp | | |
| 1757 | // |<-------------| | |
| 1758 | // | | | |
| 1759 | // | | | |
| 1760 | // | SubDelReq | | |
| 1761 | // |------------->| | |
| 1762 | // | | | |
| 1763 | // | | SubDelReq | |
| 1764 | // | |------------->| |
| 1765 | // | | | |
| 1766 | // | | SubDelResp | |
| 1767 | // | |<-------------| |
| 1768 | // | | | |
| 1769 | // | SubDelResp | | |
| 1770 | // |<-------------| | |
| 1771 | // |
| 1772 | //----------------------------------------------------------------------------- |
| 1773 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1774 | CaseBegin("TestSubReqAndSubDelOk") |
| 1775 | |
| 1776 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1777 | rparams1.Init() |
| 1778 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1779 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1780 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1781 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1782 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1783 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1784 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1785 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1786 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1787 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1788 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1789 | |
| 1790 | //Wait that subs is cleaned |
| 1791 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1792 | |
| 1793 | xappConn1.TestMsgChanEmpty(t) |
| 1794 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1795 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1796 | mainCtrl.wait_registry_empty(t, 10) |
| 1797 | } |
| 1798 | |
| 1799 | //----------------------------------------------------------------------------- |
| 1800 | // TestSubReqPolicyChangeAndSubDelOk |
| 1801 | // |
| 1802 | // stub stub |
| 1803 | // +-------+ +---------+ +---------+ |
| 1804 | // | xapp | | submgr | | e2term | |
| 1805 | // +-------+ +---------+ +---------+ |
| 1806 | // | | | |
| 1807 | // | SubReq | | |
| 1808 | // |------------->| | |
| 1809 | // | | | |
| 1810 | // | | SubReq | |
| 1811 | // | |------------->| |
| 1812 | // | | | |
| 1813 | // | | SubResp | |
| 1814 | // | |<-------------| |
| 1815 | // | | | |
| 1816 | // | SubResp | | |
| 1817 | // |<-------------| | |
| 1818 | // | | | |
| 1819 | // | SubReq | | |
| 1820 | // |------------->| | |
| 1821 | // | | | |
| 1822 | // | | SubReq | |
| 1823 | // | |------------->| |
| 1824 | // | | | |
| 1825 | // | | SubResp | |
| 1826 | // | |<-------------| |
| 1827 | // | | | |
| 1828 | // | SubResp | | |
| 1829 | // |<-------------| | |
| 1830 | // | | | |
| 1831 | // | SubDelReq | | |
| 1832 | // |------------->| | |
| 1833 | // | | | |
| 1834 | // | | SubDelReq | |
| 1835 | // | |------------->| |
| 1836 | // | | | |
| 1837 | // | | SubDelResp | |
| 1838 | // | |<-------------| |
| 1839 | // | | | |
| 1840 | // | SubDelResp | | |
| 1841 | // |<-------------| | |
| 1842 | // |
| 1843 | //----------------------------------------------------------------------------- |
| 1844 | |
| 1845 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1846 | CaseBegin("TestSubReqAndSubDelOk") |
| 1847 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1848 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1849 | rparams1.Init() |
| 1850 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1851 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1852 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1853 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1854 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1855 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1856 | |
| 1857 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1858 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1859 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1860 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1861 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1862 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1863 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1864 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1865 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1866 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1867 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1868 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1869 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1870 | |
| 1871 | //Wait that subs is cleaned |
| 1872 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1873 | |
| 1874 | xappConn1.TestMsgChanEmpty(t) |
| 1875 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1876 | e2termConn1.TestMsgChanEmpty(t) |
| 1877 | mainCtrl.wait_registry_empty(t, 10) |
| 1878 | } |
| 1879 | |
| 1880 | //----------------------------------------------------------------------------- |
| 1881 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1882 | // |
| 1883 | // stub stub stub |
| 1884 | // +-------+ +---------+ +---------+ +---------+ |
| 1885 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1886 | // +-------+ +---------+ +---------+ +---------+ |
| 1887 | // | | | | |
| 1888 | // | | | | |
| 1889 | // | | | | |
| 1890 | // | SubReq1 | | | |
| 1891 | // |------------->| | | |
| 1892 | // | | | | |
| 1893 | // | | SubReq1 | | |
| 1894 | // | |------------->| | |
| 1895 | // | | | | |
| 1896 | // | SubReq2 | | | |
| 1897 | // |------------->| | | |
| 1898 | // | | | | |
| 1899 | // | | SubReq2 | | |
| 1900 | // | |---------------------------->| |
| 1901 | // | | | | |
| 1902 | // | | SubResp1 | | |
| 1903 | // | |<-------------| | |
| 1904 | // | SubResp1 | | | |
| 1905 | // |<-------------| | | |
| 1906 | // | | SubResp2 | | |
| 1907 | // | |<----------------------------| |
| 1908 | // | SubResp2 | | | |
| 1909 | // |<-------------| | | |
| 1910 | // | | | | |
| 1911 | // | [SUBS 1 DELETE] | | |
| 1912 | // | | | | |
| 1913 | // | [SUBS 2 DELETE] | | |
| 1914 | // | | | | |
| 1915 | // |
| 1916 | //----------------------------------------------------------------------------- |
| 1917 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1918 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1919 | |
| 1920 | //Req1 |
| 1921 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1922 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1923 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1924 | |
| 1925 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1926 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1927 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1928 | |
| 1929 | //Resp1 |
| 1930 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1931 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1932 | |
| 1933 | //Resp2 |
| 1934 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1935 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1936 | |
| 1937 | //Del1 |
| 1938 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1939 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1940 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1941 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1942 | //Wait that subs is cleaned |
| 1943 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1944 | |
| 1945 | //Del2 |
| 1946 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1947 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1948 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1949 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1950 | //Wait that subs is cleaned |
| 1951 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1952 | |
| 1953 | xappConn1.TestMsgChanEmpty(t) |
| 1954 | xappConn2.TestMsgChanEmpty(t) |
| 1955 | e2termConn1.TestMsgChanEmpty(t) |
| 1956 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1957 | mainCtrl.wait_registry_empty(t, 10) |
| 1958 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1959 | |
| 1960 | //----------------------------------------------------------------------------- |
| 1961 | // TestSubReqInsertAndSubDelOk |
| 1962 | // |
| 1963 | // stub stub |
| 1964 | // +-------+ +---------+ +---------+ |
| 1965 | // | xapp | | submgr | | e2term | |
| 1966 | // +-------+ +---------+ +---------+ |
| 1967 | // | | | |
| 1968 | // | SubReq | | |
| 1969 | // |------------->| | |
| 1970 | // | | | |
| 1971 | // | | SubReq | |
| 1972 | // | |------------->| |
| 1973 | // | | | |
| 1974 | // | | SubResp | |
| 1975 | // | |<-------------| |
| 1976 | // | | | |
| 1977 | // | SubResp | | |
| 1978 | // |<-------------| | |
| 1979 | // | | | |
| 1980 | // | | | |
| 1981 | // | SubDelReq | | |
| 1982 | // |------------->| | |
| 1983 | // | | | |
| 1984 | // | | SubDelReq | |
| 1985 | // | |------------->| |
| 1986 | // | | | |
| 1987 | // | | SubDelResp | |
| 1988 | // | |<-------------| |
| 1989 | // | | | |
| 1990 | // | SubDelResp | | |
| 1991 | // |<-------------| | |
| 1992 | // |
| 1993 | //----------------------------------------------------------------------------- |
| 1994 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1995 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1996 | |
| 1997 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1998 | rparams1.Init() |
| 1999 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2000 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2001 | |
| 2002 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2003 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2004 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2005 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2006 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2007 | |
| 2008 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2009 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2010 | |
| 2011 | //Wait that subs is cleaned |
| 2012 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2013 | |
| 2014 | xappConn1.TestMsgChanEmpty(t) |
| 2015 | xappConn2.TestMsgChanEmpty(t) |
| 2016 | e2termConn1.TestMsgChanEmpty(t) |
| 2017 | mainCtrl.wait_registry_empty(t, 10) |
| 2018 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2019 | |
| 2020 | //----------------------------------------------------------------------------- |
| 2021 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2022 | // |
| 2023 | // This case simulates case where xApp restarts and starts sending same |
| 2024 | // subscription requests which have already subscribed successfully |
| 2025 | |
| 2026 | // stub stub |
| 2027 | // +-------+ +---------+ +---------+ |
| 2028 | // | xapp | | submgr | | e2term | |
| 2029 | // +-------+ +---------+ +---------+ |
| 2030 | // | | | |
| 2031 | // | SubReq | | |
| 2032 | // |------------->| | |
| 2033 | // | | | |
| 2034 | // | | SubReq | |
| 2035 | // | |------------->| |
| 2036 | // | | | |
| 2037 | // | | SubResp | |
| 2038 | // | |<-------------| |
| 2039 | // | | | |
| 2040 | // | SubResp | | |
| 2041 | // |<-------------| | |
| 2042 | // | | | |
| 2043 | // | xApp restart | | |
| 2044 | // | | | |
| 2045 | // | SubReq | | |
| 2046 | // | (retrans with same xApp generated subid but diff xid) |
| 2047 | // |------------->| | |
| 2048 | // | | | |
| 2049 | // | SubResp | | |
| 2050 | // |<-------------| | |
| 2051 | // | | | |
| 2052 | // | [SUBS DELETE] | |
| 2053 | // | | | |
| 2054 | // |
| 2055 | //----------------------------------------------------------------------------- |
| 2056 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2057 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2058 | |
| 2059 | //Subs Create |
| 2060 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2061 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2062 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2063 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2064 | |
| 2065 | // xApp restart here |
| 2066 | // --> artificial delay |
| 2067 | <-time.After(1 * time.Second) |
| 2068 | |
| 2069 | //Subs Create |
| 2070 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2071 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2072 | |
| 2073 | //Subs Delete |
| 2074 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2075 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2076 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2077 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2078 | |
| 2079 | //Wait that subs is cleaned |
| 2080 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2081 | |
| 2082 | xappConn1.TestMsgChanEmpty(t) |
| 2083 | xappConn2.TestMsgChanEmpty(t) |
| 2084 | e2termConn1.TestMsgChanEmpty(t) |
| 2085 | mainCtrl.wait_registry_empty(t, 10) |
| 2086 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2087 | |
| 2088 | //----------------------------------------------------------------------------- |
| 2089 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2090 | // |
| 2091 | // stub stub |
| 2092 | // +-------+ +---------+ +---------+ |
| 2093 | // | xapp | | submgr | | e2term | |
| 2094 | // +-------+ +---------+ +---------+ |
| 2095 | // | | | |
| 2096 | // | SubReq | | |
| 2097 | // |------------->| | |
| 2098 | // | | | |
| 2099 | // | | SubReq | |
| 2100 | // | |------------->| |
| 2101 | // | | | |
| 2102 | // | | SubResp | |
| 2103 | // | <----| |
| 2104 | // | | |
| 2105 | // | Submgr restart | |
| 2106 | // | | |
| 2107 | // | | | |
| 2108 | // | | SubDelReq | |
| 2109 | // | |------------->| |
| 2110 | // | | | |
| 2111 | // | | SubDelResp | |
| 2112 | // | |<-------------| |
| 2113 | // | | | |
| 2114 | // |
| 2115 | //----------------------------------------------------------------------------- |
| 2116 | |
| 2117 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2118 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2119 | |
| 2120 | // Remove possible existing subscrition |
| 2121 | mainCtrl.removeExistingSubscriptions(t) |
| 2122 | |
| 2123 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2124 | xappConn1.SendSubsReq(t, nil, nil) |
| 2125 | e2termConn1.RecvSubsReq(t) |
| 2126 | mainCtrl.SetResetTestFlag(t, false) |
| 2127 | |
| 2128 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2129 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2130 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2131 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2132 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2133 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2134 | mainCtrl.SimulateRestart(t) |
| 2135 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2136 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2137 | // Submgr send delete for uncompleted subscription |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2138 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2139 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2140 | |
| 2141 | // Wait that subs is cleaned |
| 2142 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2143 | |
| 2144 | xappConn1.TestMsgChanEmpty(t) |
| 2145 | xappConn2.TestMsgChanEmpty(t) |
| 2146 | e2termConn1.TestMsgChanEmpty(t) |
| 2147 | mainCtrl.wait_registry_empty(t, 10) |
| 2148 | } |
| 2149 | |
| 2150 | //----------------------------------------------------------------------------- |
| 2151 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2152 | // |
| 2153 | // stub stub |
| 2154 | // +-------+ +---------+ +---------+ |
| 2155 | // | xapp | | submgr | | e2term | |
| 2156 | // +-------+ +---------+ +---------+ |
| 2157 | // | | | |
| 2158 | // | SubReq | | |
| 2159 | // |------------->| | |
| 2160 | // | | | |
| 2161 | // | | SubReq | |
| 2162 | // | |------------->| |
| 2163 | // | | | |
| 2164 | // | | SubResp | |
| 2165 | // | |<-------------| |
| 2166 | // | | | |
| 2167 | // | SubResp | | |
| 2168 | // |<-------------| | |
| 2169 | // | | | |
| 2170 | // | | |
| 2171 | // | Submgr restart | |
| 2172 | // | | |
| 2173 | // | SubDelReq | | |
| 2174 | // |------------->| | |
| 2175 | // | | | |
| 2176 | // | | SubDelReq | |
| 2177 | // | |------------->| |
| 2178 | // | | | |
| 2179 | // | | SubDelResp | |
| 2180 | // | |<-------------| |
| 2181 | // | | | |
| 2182 | // | SubDelResp | | |
| 2183 | // |<-------------| | |
| 2184 | // |
| 2185 | //----------------------------------------------------------------------------- |
| 2186 | |
| 2187 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2188 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2189 | |
| 2190 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2191 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2192 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2193 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2194 | |
| 2195 | // Check subscription |
| 2196 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2197 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2198 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2199 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2200 | |
| 2201 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2202 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2203 | |
| 2204 | // Check that subscription is restored correctly after restart |
| 2205 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2206 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2207 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2208 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2209 | |
| 2210 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2211 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2212 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2213 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2214 | |
| 2215 | //Wait that subs is cleaned |
| 2216 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2217 | |
| 2218 | xappConn1.TestMsgChanEmpty(t) |
| 2219 | xappConn2.TestMsgChanEmpty(t) |
| 2220 | e2termConn1.TestMsgChanEmpty(t) |
| 2221 | mainCtrl.wait_registry_empty(t, 10) |
| 2222 | } |
| 2223 | |
| 2224 | //----------------------------------------------------------------------------- |
| 2225 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2226 | // |
| 2227 | // stub stub |
| 2228 | // +-------+ +-------+ +---------+ +---------+ |
| 2229 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2230 | // +-------+ +-------+ +---------+ +---------+ |
| 2231 | // | | | | |
| 2232 | // | | | | |
| 2233 | // | | | | |
| 2234 | // | | SubReq1 | | |
| 2235 | // | |------------->| | |
| 2236 | // | | | | |
| 2237 | // | | | SubReq1 | |
| 2238 | // | | |------------->| |
| 2239 | // | | | SubResp1 | |
| 2240 | // | | |<-------------| |
| 2241 | // | | SubResp1 | | |
| 2242 | // | |<-------------| | |
| 2243 | // | | | | |
| 2244 | // | | |
| 2245 | // | submgr restart | |
| 2246 | // | | |
| 2247 | // | | | | |
| 2248 | // | | | | |
| 2249 | // | SubReq2 | | |
| 2250 | // |--------------------------->| | |
| 2251 | // | | | | |
| 2252 | // | SubResp2 | | |
| 2253 | // |<---------------------------| | |
| 2254 | // | | | | |
| 2255 | // | | SubDelReq 1 | | |
| 2256 | // | |------------->| | |
| 2257 | // | | | | |
| 2258 | // | | SubDelResp 1 | | |
| 2259 | // | |<-------------| | |
| 2260 | // | | | | |
| 2261 | // | | | | |
| 2262 | // | | |
| 2263 | // | submgr restart | |
| 2264 | // | | |
| 2265 | // | | | | |
| 2266 | // | SubDelReq 2 | | |
| 2267 | // |--------------------------->| | |
| 2268 | // | | | | |
| 2269 | // | | | SubDelReq 2 | |
| 2270 | // | | |------------->| |
| 2271 | // | | | | |
| 2272 | // | | | SubDelReq 2 | |
| 2273 | // | | |------------->| |
| 2274 | // | | | | |
| 2275 | // | SubDelResp 2 | | |
| 2276 | // |<---------------------------| | |
| 2277 | // |
| 2278 | //----------------------------------------------------------------------------- |
| 2279 | |
| 2280 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2281 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2282 | |
| 2283 | //Req1 |
| 2284 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2285 | rparams1.Init() |
| 2286 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2287 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2288 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2289 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2290 | |
| 2291 | //Req2 |
| 2292 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2293 | rparams2.Init() |
| 2294 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2295 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2296 | |
| 2297 | // Check subscription |
| 2298 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2299 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2300 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2301 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2302 | |
| 2303 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2304 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2305 | |
| 2306 | // Check that subscription is restored correctly after restart |
| 2307 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2308 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2309 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2310 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2311 | |
| 2312 | //Del1 |
| 2313 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2314 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2315 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2316 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2317 | |
| 2318 | mainCtrl.SimulateRestart(t) |
| 2319 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2320 | |
| 2321 | //Del2 |
| 2322 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2323 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2324 | |
| 2325 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2326 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2327 | |
| 2328 | //Wait that subs is cleaned |
| 2329 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2330 | |
| 2331 | xappConn1.TestMsgChanEmpty(t) |
| 2332 | xappConn2.TestMsgChanEmpty(t) |
| 2333 | e2termConn1.TestMsgChanEmpty(t) |
| 2334 | mainCtrl.wait_registry_empty(t, 10) |
| 2335 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2336 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2337 | //***************************************************************************** |
| 2338 | // REST interface test cases |
| 2339 | //***************************************************************************** |
| 2340 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2341 | //----------------------------------------------------------------------------- |
| 2342 | // Test debug GET and POST requests |
| 2343 | // |
| 2344 | // curl |
| 2345 | // +-------+ +---------+ |
| 2346 | // | user | | submgr | |
| 2347 | // +-------+ +---------+ |
| 2348 | // | | |
| 2349 | // | GET/POST Req | |
| 2350 | // |------------->| |
| 2351 | // | Resp | |
| 2352 | // |<-------------| |
| 2353 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2354 | func TestGetSubscriptions(t *testing.T) { |
| 2355 | |
| 2356 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2357 | } |
| 2358 | |
| 2359 | func TestGetSymptomData(t *testing.T) { |
| 2360 | |
| 2361 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2362 | } |
| 2363 | |
| 2364 | func TestPostdeleteSubId(t *testing.T) { |
| 2365 | |
| 2366 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2367 | } |
| 2368 | |
| 2369 | func TestPostEmptyDb(t *testing.T) { |
| 2370 | |
| 2371 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2372 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2373 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2374 | func TestGetRestSubscriptions(t *testing.T) { |
| 2375 | |
| 2376 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2377 | } |
| 2378 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2379 | //----------------------------------------------------------------------------- |
| 2380 | // TestRESTSubReqAndRouteNok |
| 2381 | // |
| 2382 | // stub stub |
| 2383 | // +-------+ +---------+ +---------+ |
| 2384 | // | xapp | | submgr | | rtmgr | |
| 2385 | // +-------+ +---------+ +---------+ |
| 2386 | // | | | |
| 2387 | // | RESTSubReq | | |
| 2388 | // |---------------->| | |
| 2389 | // | | | |
| 2390 | // | RESTSubResp | | |
| 2391 | // |<----------------| | |
| 2392 | // | | RouteCreate | |
| 2393 | // | |------------->| |
| 2394 | // | | | |
| 2395 | // | | RouteCreate | |
| 2396 | // | | status:400 | |
| 2397 | // | |(Bad request) | |
| 2398 | // | |<-------------| |
| 2399 | // | RESTNotif | | |
| 2400 | // |<----------------| | |
| 2401 | // | | | |
| 2402 | // | [SUBS INT DELETE] | |
| 2403 | // | | | |
| 2404 | // | RESTSubDelReq | | |
| 2405 | // |---------------->| | |
| 2406 | // | RESTSubDelResp | | |
| 2407 | // |<----------------| | |
| 2408 | // |
| 2409 | //----------------------------------------------------------------------------- |
| 2410 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2411 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2412 | |
| 2413 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2414 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2415 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2416 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2417 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2418 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2419 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2420 | }) |
| 2421 | |
| 2422 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2423 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2424 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2425 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2426 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2427 | |
| 2428 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2429 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2430 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2431 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2432 | waiter.WaitResult(t) |
| 2433 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2434 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2435 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2436 | |
| 2437 | // Del |
| 2438 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2439 | |
| 2440 | // Wait that subs is cleaned |
| 2441 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2442 | waitSubsCleanup(t, e2SubsId, 10) |
| 2443 | mainCtrl.VerifyCounterValues(t) |
| 2444 | } |
| 2445 | |
| 2446 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2447 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2448 | |
| 2449 | //Init counter check |
| 2450 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2451 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2452 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2453 | Counter{cSubReqToE2, 1}, |
| 2454 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2455 | Counter{cRestSubNotifToXapp, 1}, |
| 2456 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2457 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2458 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2459 | Counter{cSubDelReqToE2, 1}, |
| 2460 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2461 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2462 | }) |
| 2463 | |
| 2464 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2465 | |
| 2466 | //Subs Create |
| 2467 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2468 | |
| 2469 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2470 | |
| 2471 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2472 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2473 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2474 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2475 | params.SetMeid("RAN_NAME_1") |
| 2476 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2477 | xapp.Logger.Debug("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2478 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2479 | waiter.WaitResult(t) |
| 2480 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2481 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2482 | |
| 2483 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2484 | |
| 2485 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2486 | |
| 2487 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2488 | //Wait that subs is cleaned |
| 2489 | waitSubsCleanup(t, e2SubsId, 10) |
| 2490 | |
| 2491 | mainCtrl.VerifyCounterValues(t) |
| 2492 | } |
| 2493 | |
| 2494 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2495 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2496 | |
| 2497 | // Init counter check |
| 2498 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2499 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2500 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2501 | Counter{cSubReqToE2, 1}, |
| 2502 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2503 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2504 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2505 | Counter{cRouteDeleteFail, 1}, |
| 2506 | Counter{cSubDelReqToE2, 1}, |
| 2507 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2508 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2509 | }) |
| 2510 | |
| 2511 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2512 | |
| 2513 | //Subs Create |
| 2514 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2515 | |
| 2516 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2517 | |
| 2518 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2519 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2520 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2521 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2522 | waiter.WaitResult(t) |
| 2523 | |
| 2524 | waitSubsCleanup(t, e2SubsId, 10) |
| 2525 | |
| 2526 | mainCtrl.VerifyCounterValues(t) |
| 2527 | } |
| 2528 | |
| 2529 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2530 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2531 | |
| 2532 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2533 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2534 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2535 | Counter{cSubReqToE2, 1}, |
| 2536 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2537 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2538 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2539 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2540 | Counter{cSubDelReqToE2, 1}, |
| 2541 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2542 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2543 | }) |
| 2544 | |
| 2545 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2546 | |
| 2547 | //Subs Create |
| 2548 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2549 | |
| 2550 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2551 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2552 | |
| 2553 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2554 | |
| 2555 | //Del1, this shall fail on rtmgr side |
| 2556 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2557 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2558 | waiter.WaitResult(t) |
| 2559 | |
| 2560 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2561 | |
| 2562 | //Del2 |
| 2563 | deleteXapp2Subscription(t, &restSubId2) |
| 2564 | |
| 2565 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2566 | |
| 2567 | mainCtrl.VerifyCounterValues(t) |
| 2568 | } |
| 2569 | |
| 2570 | //----------------------------------------------------------------------------- |
| 2571 | // TestRESTSubReqRetransmission |
| 2572 | // |
| 2573 | // stub stub |
| 2574 | // +-------+ +---------+ +---------+ |
| 2575 | // | xapp | | submgr | | e2term | |
| 2576 | // +-------+ +---------+ +---------+ |
| 2577 | // | | | |
| 2578 | // | RESTSubReq1 | | |
| 2579 | // |---------------->| | |
| 2580 | // | | | |
| 2581 | // | RESTSubResp | | |
| 2582 | // |<----------------| | |
| 2583 | // | | SubReq1 | |
| 2584 | // | |------------->| |
| 2585 | // | | | |
| 2586 | // | RESTSubReq2 | | |
| 2587 | // | (retrans) | | |
| 2588 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2589 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2590 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2591 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2592 | // | | SubResp1 | |
| 2593 | // | |<-------------| |
| 2594 | // | RESTNotif1 | | |
| 2595 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2596 | // | | | |
| 2597 | // | [SUBS DELETE] | |
| 2598 | // | | | |
| 2599 | // |
| 2600 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2601 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2602 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2603 | CaseBegin("TestRESTSubReqRetransmission") |
| 2604 | |
| 2605 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2606 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2607 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2608 | Counter{cSubReqToE2, 1}, |
| 2609 | Counter{cSubRespFromE2, 1}, |
| 2610 | Counter{cRestSubNotifToXapp, 1}, |
| 2611 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2612 | Counter{cSubDelReqToE2, 1}, |
| 2613 | Counter{cSubDelRespFromE2, 1}, |
| 2614 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2615 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2616 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2617 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2618 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2619 | |
| 2620 | // Subs Create |
| 2621 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2622 | |
| 2623 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2624 | // gets into execution before the rtmgrg responds for the first one. |
| 2625 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2626 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2627 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2628 | xappConn2.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2629 | |
| 2630 | waiter.WaitResult(t) |
| 2631 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2632 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2633 | |
| 2634 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2635 | // the order is not significant he6re. |
| 2636 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2637 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2638 | |
| 2639 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 2640 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2641 | |
| 2642 | // Del1 |
| 2643 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2644 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2645 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2646 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2647 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2648 | |
| 2649 | mainCtrl.VerifyCounterValues(t) |
| 2650 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2651 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2652 | //----------------------------------------------------------------------------- |
| 2653 | // stub stub stub |
| 2654 | // +-------+ +---------+ +---------+ +---------+ |
| 2655 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2656 | // +-------+ +---------+ +---------+ +---------+ |
| 2657 | // | | | | |
| 2658 | // | RESTSubReq | | | |
| 2659 | // |---------------->| | | |
| 2660 | // | RESTSubResp | | | |
| 2661 | // |<----------------| | | |
| 2662 | // | | RouteCreate | | |
| 2663 | // | |--------------------------->| |
| 2664 | // | | RouteResponse| | |
| 2665 | // | |<---------------------------| // The order of these events may vary |
| 2666 | // | | SubReq | | |
| 2667 | // | |------------->| | // The order of these events may vary |
| 2668 | // | | SubResp | | |
| 2669 | // | |<-------------| | |
| 2670 | // | RESTNotif1 | | | |
| 2671 | // |<----------------| | | |
| 2672 | // | RESTSubReq | | | |
| 2673 | // | [RETRANS1] | | | |
| 2674 | // |---------------->| | | |
| 2675 | // | RESTNotif1 | | | |
| 2676 | // |<----------------| | | |
| 2677 | // | RESTSubReq | | | |
| 2678 | // | [RETRANS2] | | | |
| 2679 | // |---------------->| | | |
| 2680 | // | RESTNotif1 | | | |
| 2681 | // |<----------------| | | |
| 2682 | // | RESTSubDelReq | | | |
| 2683 | // |---------------->| | | |
| 2684 | // | | SubDelReq | | |
| 2685 | // | |------------->| | |
| 2686 | // | RESTSubDelResp| | | |
| 2687 | // |<----------------| | | |
| 2688 | // | | SubDelResp | | |
| 2689 | // | |<-------------| | |
| 2690 | // | | | | |
| 2691 | // |
| 2692 | //----------------------------------------------------------------------------- |
| 2693 | |
| 2694 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2695 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2696 | |
| 2697 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2698 | Counter{cRestSubReqFromXapp, 3}, |
| 2699 | Counter{cRestSubRespToXapp, 3}, |
| 2700 | Counter{cSubReqToE2, 1}, |
| 2701 | Counter{cSubRespFromE2, 1}, |
| 2702 | Counter{cRestSubNotifToXapp, 3}, |
| 2703 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2704 | Counter{cSubDelReqToE2, 1}, |
| 2705 | Counter{cSubDelRespFromE2, 1}, |
| 2706 | Counter{cRestSubDelRespToXapp, 1}, |
| 2707 | }) |
| 2708 | |
| 2709 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2710 | |
| 2711 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2712 | |
| 2713 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2714 | |
| 2715 | //1.st resend |
| 2716 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2717 | |
| 2718 | assert.Equal(t, restSubId_resend, restSubId) |
| 2719 | |
| 2720 | <-time.After(100 * time.Millisecond) |
| 2721 | |
| 2722 | //2.nd resend |
| 2723 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2724 | |
| 2725 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2726 | |
| 2727 | <-time.After(100 * time.Millisecond) |
| 2728 | |
| 2729 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2730 | |
| 2731 | waitSubsCleanup(t, e2SubsId, 10) |
| 2732 | |
| 2733 | //Wait that subs is cleaned |
| 2734 | mainCtrl.VerifyCounterValues(t) |
| 2735 | } |
| 2736 | |
| 2737 | //----------------------------------------------------------------------------- |
| 2738 | // stub stub stub |
| 2739 | // +-------+ +---------+ +---------+ +---------+ |
| 2740 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2741 | // +-------+ +---------+ +---------+ +---------+ |
| 2742 | // | | | | |
| 2743 | // | RESTSubReq | | | |
| 2744 | // |---------------->| | | |
| 2745 | // | RESTSubResp | | | |
| 2746 | // |<----------------| | | |
| 2747 | // | | RouteCreate | | |
| 2748 | // | |--------------------------->| |
| 2749 | // | | RouteResponse| | |
| 2750 | // | |<---------------------------| // The order of these events may vary |
| 2751 | // | | SubReq | | |
| 2752 | // | |------------->| | // The order of these events may vary |
| 2753 | // | | SubResp | | |
| 2754 | // | |<-------------| | |
| 2755 | // | RESTNotif1 | | | |
| 2756 | // |<----------------| | | |
| 2757 | // | RESTSubReq | | | |
| 2758 | // | [RETRANS, with RESTsubsId] | | |
| 2759 | // |---------------->| | | |
| 2760 | // | RESTNotif1 | | | |
| 2761 | // |<----------------| | | |
| 2762 | // | RESTSubReq | | | |
| 2763 | // | [RETRANS, without RESTsubsId] | | |
| 2764 | // |---------------->| | | |
| 2765 | // | RESTNotif1 | | | |
| 2766 | // |<----------------| | | |
| 2767 | // | RESTSubDelReq | | | |
| 2768 | // |---------------->| | | |
| 2769 | // | | SubDelReq | | |
| 2770 | // | |------------->| | |
| 2771 | // | RESTSubDelResp| | | |
| 2772 | // |<----------------| | | |
| 2773 | // | | SubDelResp | | |
| 2774 | // | |<-------------| | |
| 2775 | // | | | | |
| 2776 | // |
| 2777 | //----------------------------------------------------------------------------- |
| 2778 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 2779 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 2780 | |
| 2781 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2782 | Counter{cRestSubReqFromXapp, 3}, |
| 2783 | Counter{cRestSubRespToXapp, 3}, |
| 2784 | Counter{cSubReqToE2, 1}, |
| 2785 | Counter{cSubRespFromE2, 1}, |
| 2786 | Counter{cRestSubNotifToXapp, 3}, |
| 2787 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2788 | Counter{cSubDelReqToE2, 1}, |
| 2789 | Counter{cSubDelRespFromE2, 1}, |
| 2790 | Counter{cRestSubDelRespToXapp, 1}, |
| 2791 | }) |
| 2792 | |
| 2793 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2794 | |
| 2795 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2796 | |
| 2797 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2798 | |
| 2799 | <-time.After(100 * time.Millisecond) |
| 2800 | |
| 2801 | //1.st resend with subscription ID |
| 2802 | params.SetSubscriptionID(&restSubId) |
| 2803 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2804 | |
| 2805 | assert.Equal(t, restSubId_resend, restSubId) |
| 2806 | |
| 2807 | <-time.After(100 * time.Millisecond) |
| 2808 | |
| 2809 | //2.nd resend without subscription ID (faking app restart) |
| 2810 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2811 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2812 | |
| 2813 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2814 | |
| 2815 | <-time.After(100 * time.Millisecond) |
| 2816 | |
| 2817 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2818 | |
| 2819 | waitSubsCleanup(t, e2SubsId, 10) |
| 2820 | |
| 2821 | //Wait that subs is cleaned |
| 2822 | mainCtrl.VerifyCounterValues(t) |
| 2823 | } |
| 2824 | |
| 2825 | //----------------------------------------------------------------------------- |
| 2826 | // stub stub stub |
| 2827 | // +-------+ +---------+ +---------+ +---------+ |
| 2828 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2829 | // +-------+ +---------+ +---------+ +---------+ |
| 2830 | // | | | | |
| 2831 | // | RESTSubReq | | | |
| 2832 | // |---------------->| | | |
| 2833 | // | RESTSubResp | | | |
| 2834 | // |<----------------| | | |
| 2835 | // | | RouteCreate | | |
| 2836 | // | |--------------------------->| |
| 2837 | // | | RouteResponse| | |
| 2838 | // | |<---------------------------| |
| 2839 | // | | SubReq | | |
| 2840 | // | |------------->| | |
| 2841 | // | | SubResp | | |
| 2842 | // | |<-------------| | |
| 2843 | // | RESTNotif1 | | | |
| 2844 | // |<----------------| | | |
| 2845 | // | RESTSubReq | | | |
| 2846 | // | [with RestSUbsId + one additional e2 subDetail] |
| 2847 | // |---------------->| | | |
| 2848 | // | RESTNotif1 | | | |
| 2849 | // | [for initial e2 subDetail] | | |
| 2850 | // |<----------------| | | |
| 2851 | // | | RouteCreate | | |
| 2852 | // | |--------------------------->| |
| 2853 | // | | RouteResponse| | |
| 2854 | // | |<---------------------------| |
| 2855 | // | | SubReq | | |
| 2856 | // | |------------->| | |
| 2857 | // | | SubResp | | |
| 2858 | // | |<-------------| | |
| 2859 | // | RESTNotif1 | | | |
| 2860 | // |<----------------| | | |
| 2861 | // | RESTSubReq | | | |
| 2862 | // | [with RESTsubsId initial request] | |
| 2863 | // |---------------->| | | |
| 2864 | // | RESTNotif1 | | | |
| 2865 | // |<----------------| | | |
| 2866 | // | RESTSubDelReq | | | |
| 2867 | // |---------------->| | | |
| 2868 | // | RESTSubDelResp| | | |
| 2869 | // |<----------------| | | |
| 2870 | // | | SubDelReq | | |
| 2871 | // | |------------->| | |
| 2872 | // | | SubDelResp | | |
| 2873 | // | |<-------------| | |
| 2874 | // | | SubDelReq | | |
| 2875 | // | |------------->| | |
| 2876 | // | | SubDelResp | | |
| 2877 | // | |<-------------| | |
| 2878 | // | | | | |
| 2879 | // |
| 2880 | //----------------------------------------------------------------------------- |
| 2881 | |
| 2882 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 2883 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 2884 | |
| 2885 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2886 | Counter{cRestSubReqFromXapp, 3}, |
| 2887 | Counter{cRestSubRespToXapp, 3}, |
| 2888 | Counter{cSubReqToE2, 2}, |
| 2889 | Counter{cSubRespFromE2, 2}, |
| 2890 | Counter{cRestSubNotifToXapp, 4}, |
| 2891 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2892 | Counter{cSubDelReqToE2, 2}, |
| 2893 | Counter{cSubDelRespFromE2, 2}, |
| 2894 | Counter{cRestSubDelRespToXapp, 1}, |
| 2895 | }) |
| 2896 | |
| 2897 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2898 | |
| 2899 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2900 | |
| 2901 | <-time.After(100 * time.Millisecond) |
| 2902 | |
| 2903 | // Send modified requst, this time with e2 subscriptions. |
| 2904 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 2905 | params2.SetSubscriptionID(&restSubId) |
| 2906 | |
| 2907 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2908 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2909 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 2910 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2911 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 2912 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2913 | |
| 2914 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2915 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2916 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2917 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 2918 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2919 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 2920 | assert.NotEqual(t, e2SubsId2, 0) |
| 2921 | |
| 2922 | <-time.After(100 * time.Millisecond) |
| 2923 | |
| 2924 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 2925 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2926 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2927 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2928 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 2929 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2930 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 2931 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2932 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 2933 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 2934 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2935 | // Delete both e2 subscriptions |
| 2936 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2937 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 2938 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 2939 | |
| 2940 | waitSubsCleanup(t, e2SubsId, 10) |
| 2941 | |
| 2942 | //Wait that subs is cleaned |
| 2943 | mainCtrl.VerifyCounterValues(t) |
| 2944 | } |
| 2945 | |
| 2946 | //----------------------------------------------------------------------------- |
| 2947 | // stub stub stub |
| 2948 | // +-------+ +---------+ +---------+ +---------+ |
| 2949 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2950 | // +-------+ +---------+ +---------+ +---------+ |
| 2951 | // | | | | |
| 2952 | // | RESTSubReq | | | |
| 2953 | // |---------------->| | | |
| 2954 | // | RESTSubResp | | | |
| 2955 | // |<----------------| | | |
| 2956 | // | | RouteCreate | | |
| 2957 | // | |--------------------------->| |
| 2958 | // | | RouteResponse| | |
| 2959 | // | |<---------------------------| |
| 2960 | // | | SubReq | | |
| 2961 | // | |------------->| | |
| 2962 | // | | SubResp | | |
| 2963 | // | |<-------------| | |
| 2964 | // | RESTNotif1 | | | |
| 2965 | // |<----------------| | | |
| 2966 | // | RESTSubReq | | | |
| 2967 | // | [with RestSUbsId + one additional e2 subDetail] |
| 2968 | // |---------------->| | | |
| 2969 | // | RESTNotif1 | | | |
| 2970 | // | [for initial e2 subDetail] | | |
| 2971 | // |<----------------| | | |
| 2972 | // | | RouteCreate | | |
| 2973 | // | |--------------------------->| |
| 2974 | // | | RouteResponse| | |
| 2975 | // | |<---------------------------| |
| 2976 | // | | SubReq | | |
| 2977 | // | |------------->| | |
| 2978 | // | | SubResp | | |
| 2979 | // | |<-------------| | |
| 2980 | // | RESTNotif1 | | | |
| 2981 | // |<----------------| | | |
| 2982 | // | RESTSubReq | | | |
| 2983 | // | [without RESTsubsId initial request] | |
| 2984 | // |---------------->| | | |
| 2985 | // | RESTNotif1 | | | |
| 2986 | // |<----------------| | | |
| 2987 | // | RESTSubDelReq | | | |
| 2988 | // |---------------->| | | |
| 2989 | // | RESTSubDelResp| | | |
| 2990 | // |<----------------| | | |
| 2991 | // | | SubDelReq | | |
| 2992 | // | |------------->| | |
| 2993 | // | | SubDelResp | | |
| 2994 | // | |<-------------| | |
| 2995 | // | | SubDelReq | | |
| 2996 | // | |------------->| | |
| 2997 | // | | SubDelResp | | |
| 2998 | // | |<-------------| | |
| 2999 | // | | | | |
| 3000 | // |
| 3001 | //----------------------------------------------------------------------------- |
| 3002 | |
| 3003 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3004 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3005 | |
| 3006 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3007 | Counter{cRestSubReqFromXapp, 3}, |
| 3008 | Counter{cRestSubRespToXapp, 3}, |
| 3009 | Counter{cSubReqToE2, 2}, |
| 3010 | Counter{cSubRespFromE2, 2}, |
| 3011 | Counter{cRestSubNotifToXapp, 4}, |
| 3012 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3013 | Counter{cSubDelReqToE2, 2}, |
| 3014 | Counter{cSubDelRespFromE2, 2}, |
| 3015 | Counter{cRestSubDelRespToXapp, 1}, |
| 3016 | }) |
| 3017 | |
| 3018 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3019 | |
| 3020 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3021 | |
| 3022 | <-time.After(100 * time.Millisecond) |
| 3023 | |
| 3024 | // Send modified requst, this time with e2 subscriptions. |
| 3025 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3026 | params2.SetSubscriptionID(&restSubId) |
| 3027 | |
| 3028 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3029 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3030 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3031 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3032 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3033 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3034 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3035 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3036 | xappConn1.DecrementRequestCount() |
| 3037 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3038 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3039 | |
| 3040 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3041 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3042 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3043 | assert.NotEqual(t, e2SubsId2, 0) |
| 3044 | |
| 3045 | <-time.After(100 * time.Millisecond) |
| 3046 | |
| 3047 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3048 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3049 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3050 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3051 | // md5sum shall find the original request |
| 3052 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3053 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3054 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3055 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3056 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3057 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3058 | // Delete both e2 subscriptions |
| 3059 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3060 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3061 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3062 | |
| 3063 | waitSubsCleanup(t, e2SubsId, 10) |
| 3064 | |
| 3065 | //Wait that subs is cleaned |
| 3066 | mainCtrl.VerifyCounterValues(t) |
| 3067 | } |
| 3068 | |
| 3069 | //----------------------------------------------------------------------------- |
| 3070 | // stub stub stub |
| 3071 | // +-------+ +---------+ +---------+ +---------+ |
| 3072 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3073 | // +-------+ +---------+ +---------+ +---------+ |
| 3074 | // | | | | |
| 3075 | // | RESTSubReq | | | |
| 3076 | // |---------------->| | | |
| 3077 | // | RESTSubResp | | | |
| 3078 | // |<----------------| | | |
| 3079 | // | | RouteCreate | | |
| 3080 | // | |--------------------------->| |
| 3081 | // | | RouteResponse| | |
| 3082 | // | |<---------------------------| |
| 3083 | // | | SubReq | | |
| 3084 | // | |------------->| | |
| 3085 | // | | SubResp | | |
| 3086 | // | |<-------------| | |
| 3087 | // | RESTNotif1 | | | |
| 3088 | // |<----------------| | | |
| 3089 | // | RESTSubReq | | | |
| 3090 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3091 | // |---------------->| | | |
| 3092 | // | RESTNotif1 | | | |
| 3093 | // | [for initial e2 subDetail] | | |
| 3094 | // |<----------------| | | |
| 3095 | // | | RouteCreate | | |
| 3096 | // | |--------------------------->| |
| 3097 | // | | RouteResponse| | |
| 3098 | // | |<---------------------------| |
| 3099 | // | | SubReq | | |
| 3100 | // | |------------->| | |
| 3101 | // | | SubResp | | |
| 3102 | // | |<-------------| | |
| 3103 | // | RESTNotif1 | | | |
| 3104 | // |<----------------| | | |
| 3105 | // | RESTSubDelReq | | | |
| 3106 | // |---------------->| | | |
| 3107 | // | RESTSubDelResp| | | |
| 3108 | // |<----------------| | | |
| 3109 | // | | SubDelReq | | |
| 3110 | // | |------------->| | |
| 3111 | // | | SubDelResp | | |
| 3112 | // | |<-------------| | |
| 3113 | // | | SubDelReq | | |
| 3114 | // | |------------->| | |
| 3115 | // | | SubDelResp | | |
| 3116 | // | |<-------------| | |
| 3117 | // | RESTSubReq | | | |
| 3118 | // | [with RESTsubsId initial request] | |
| 3119 | // |---------------->| | | |
| 3120 | // | RESTSubResp | | | |
| 3121 | // |<----------------| | | |
| 3122 | // | | RouteCreate | | |
| 3123 | // | |--------------------------->| |
| 3124 | // | | RouteResponse| | |
| 3125 | // | |<---------------------------| |
| 3126 | // | | SubReq | | |
| 3127 | // | |------------->| | |
| 3128 | // | | SubResp | | |
| 3129 | // | |<-------------| | |
| 3130 | // | RESTNotif1 | | | |
| 3131 | // |<----------------| | | |
| 3132 | // | | | | |
| 3133 | // |
| 3134 | //----------------------------------------------------------------------------- |
| 3135 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3136 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3137 | |
| 3138 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3139 | Counter{cRestSubReqFromXapp, 3}, |
| 3140 | Counter{cRestSubRespToXapp, 3}, |
| 3141 | Counter{cSubReqToE2, 3}, |
| 3142 | Counter{cSubRespFromE2, 3}, |
| 3143 | Counter{cRestSubNotifToXapp, 4}, |
| 3144 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3145 | Counter{cSubDelReqToE2, 3}, |
| 3146 | Counter{cSubDelRespFromE2, 3}, |
| 3147 | Counter{cRestSubDelRespToXapp, 2}, |
| 3148 | }) |
| 3149 | |
| 3150 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3151 | |
| 3152 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3153 | |
| 3154 | <-time.After(100 * time.Millisecond) |
| 3155 | |
| 3156 | // Send modified requst, this time with e2 subscriptions. |
| 3157 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3158 | params2.SetSubscriptionID(&restSubId) |
| 3159 | |
| 3160 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3161 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3162 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3163 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3164 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3165 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3166 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3167 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3168 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3169 | |
| 3170 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3171 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3172 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3173 | assert.NotEqual(t, e2SubsId2, 0) |
| 3174 | |
| 3175 | <-time.After(100 * time.Millisecond) |
| 3176 | |
| 3177 | // Delete both e2 subscriptions |
| 3178 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3179 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3180 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3181 | |
| 3182 | waitSubsCleanup(t, e2SubsId, 10) |
| 3183 | |
| 3184 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3185 | // but the restsubscription has been already removed. This shall trigger a |
| 3186 | // fresh create. |
| 3187 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3188 | |
| 3189 | <-time.After(100 * time.Millisecond) |
| 3190 | |
| 3191 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3192 | |
| 3193 | waitSubsCleanup(t, e2SubsId, 10) |
| 3194 | |
| 3195 | //Wait that subs is cleaned |
| 3196 | mainCtrl.VerifyCounterValues(t) |
| 3197 | } |
| 3198 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3199 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3200 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3201 | |
| 3202 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3203 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3204 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3205 | Counter{cSubReqToE2, 1}, |
| 3206 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3207 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3208 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3209 | Counter{cSubDelReqToE2, 1}, |
| 3210 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3211 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3212 | }) |
| 3213 | |
| 3214 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3215 | |
| 3216 | //Subs Create |
| 3217 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3218 | |
| 3219 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3220 | |
| 3221 | //Subs Delete |
| 3222 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3223 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3224 | |
| 3225 | seqBef := mainCtrl.get_msgcounter(t) |
| 3226 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3227 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3228 | |
| 3229 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3230 | |
| 3231 | waitSubsCleanup(t, e2SubsId, 10) |
| 3232 | |
| 3233 | mainCtrl.VerifyCounterValues(t) |
| 3234 | } |
| 3235 | |
| 3236 | //----------------------------------------------------------------------------- |
| 3237 | // TestRESTSubReqDelReq |
| 3238 | // |
| 3239 | // stub stub |
| 3240 | // +-------+ +---------+ +---------+ |
| 3241 | // | xapp | | submgr | | e2term | |
| 3242 | // +-------+ +---------+ +---------+ |
| 3243 | // | | | |
| 3244 | // | RESTSubReq | | |
| 3245 | // |---------------->| | |
| 3246 | // | | | |
| 3247 | // | RESTSubResp | | |
| 3248 | // |<----------------| | |
| 3249 | // | | SubReq | |
| 3250 | // | |------------->| |
| 3251 | // | RESTSubDelReq | | |
| 3252 | // |---------------->| | |
| 3253 | // | RESTSubDelResp | | |
| 3254 | // | unsuccess | | |
| 3255 | // |<----------------| | |
| 3256 | // | | SubResp | |
| 3257 | // | |<-------------| |
| 3258 | // | RESTNotif1 | | |
| 3259 | // |<----------------| | |
| 3260 | // | | | |
| 3261 | // | [SUBS DELETE] | |
| 3262 | // | | | |
| 3263 | // |
| 3264 | //----------------------------------------------------------------------------- |
| 3265 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3266 | CaseBegin("TestRESTSubReqDelReq") |
| 3267 | |
| 3268 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3269 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3270 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3271 | Counter{cSubReqToE2, 1}, |
| 3272 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3273 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3274 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3275 | Counter{cSubDelReqToE2, 1}, |
| 3276 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3277 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3278 | }) |
| 3279 | |
| 3280 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3281 | |
| 3282 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3283 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3284 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3285 | |
| 3286 | // Del. This will fail as processing of the subscription |
| 3287 | // is still ongoing in submgr. Deletion is not allowed before |
| 3288 | // subscription creation has been completed. |
| 3289 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3290 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3291 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3292 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3293 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3294 | |
| 3295 | // Retry del |
| 3296 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3297 | |
| 3298 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3299 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3300 | |
| 3301 | // Wait that subs is cleaned |
| 3302 | waitSubsCleanup(t, e2SubsId, 10) |
| 3303 | mainCtrl.VerifyCounterValues(t) |
| 3304 | |
| 3305 | } |
| 3306 | |
| 3307 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3308 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3309 | } |
| 3310 | |
| 3311 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3312 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3313 | |
| 3314 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3315 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3316 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3317 | Counter{cSubReqToE2, 2}, |
| 3318 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3319 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3320 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3321 | Counter{cSubDelReqToE2, 2}, |
| 3322 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3323 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3324 | }) |
| 3325 | |
| 3326 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3327 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3328 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3329 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3330 | |
| 3331 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3332 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3333 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3334 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3335 | |
| 3336 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3337 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3338 | |
| 3339 | //XappConn1 receives both of the responses |
| 3340 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3341 | |
| 3342 | //Resp1 |
| 3343 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3344 | //Resp2 |
| 3345 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3346 | |
| 3347 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3348 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3349 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3350 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3351 | |
| 3352 | //Del1 |
| 3353 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3354 | //Del2 |
| 3355 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3356 | |
| 3357 | //Wait that subs is cleaned |
| 3358 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3359 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3360 | |
| 3361 | mainCtrl.VerifyCounterValues(t) |
| 3362 | |
| 3363 | } |
| 3364 | |
| 3365 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3366 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3367 | |
| 3368 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3369 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3370 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3371 | Counter{cSubReqToE2, 2}, |
| 3372 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3373 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3374 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3375 | Counter{cSubDelReqToE2, 2}, |
| 3376 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3377 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3378 | }) |
| 3379 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3380 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3381 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3382 | xapp.Logger.Debug("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3383 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3384 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3385 | params.SetMeid("RAN_NAME_2") |
| 3386 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3387 | xapp.Logger.Debug("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3388 | |
| 3389 | //Del1 |
| 3390 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3391 | //Del2 |
| 3392 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3393 | |
| 3394 | //Wait that subs is cleaned |
| 3395 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3396 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3397 | |
| 3398 | mainCtrl.VerifyCounterValues(t) |
| 3399 | |
| 3400 | } |
| 3401 | |
| 3402 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3403 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3404 | |
| 3405 | // Init counter check |
| 3406 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3407 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3408 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3409 | Counter{cSubReqToE2, 1}, |
| 3410 | Counter{cSubReReqToE2, 1}, |
| 3411 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3412 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3413 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3414 | Counter{cSubDelReqToE2, 1}, |
| 3415 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3416 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3417 | }) |
| 3418 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3419 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3420 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3421 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3422 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3423 | |
| 3424 | // Catch the first message and ignore it |
| 3425 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3426 | xapp.Logger.Debug("Ignore REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3427 | |
| 3428 | // The second request is being handled normally |
| 3429 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3430 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3431 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3432 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3433 | |
| 3434 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3435 | |
| 3436 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3437 | |
| 3438 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3439 | //Wait that subs is cleaned |
| 3440 | waitSubsCleanup(t, e2SubsId, 10) |
| 3441 | |
| 3442 | mainCtrl.VerifyCounterValues(t) |
| 3443 | |
| 3444 | } |
| 3445 | |
| 3446 | //----------------------------------------------------------------------------- |
| 3447 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3448 | // |
| 3449 | // stub stub |
| 3450 | // +-------+ +---------+ +---------+ |
| 3451 | // | xapp | | submgr | | e2term | |
| 3452 | // +-------+ +---------+ +---------+ |
| 3453 | // | | | |
| 3454 | // | RESTSubReq | | |
| 3455 | // |---------------->| | |
| 3456 | // | | | |
| 3457 | // | RESTSubResp | | |
| 3458 | // |<----------------| | |
| 3459 | // | | SubReq | |
| 3460 | // | |------------->| |
| 3461 | // | | | |
| 3462 | // | | | |
| 3463 | // | | SubReq | |
| 3464 | // | |------------->| |
| 3465 | // | | | |
| 3466 | // | | SubDelReq | |
| 3467 | // | |------------->| |
| 3468 | // | | | |
| 3469 | // | | | |
| 3470 | // | | SubDelReq | |
| 3471 | // | |------------->| |
| 3472 | // | | | |
| 3473 | // | | | |
| 3474 | // | | SubDelResp | |
| 3475 | // | |<-------------| |
| 3476 | // | RESTNotif | | |
| 3477 | // | unsuccess | | |
| 3478 | // |<----------------| | |
| 3479 | // | | | |
| 3480 | // | [SUBS DELETE] | |
| 3481 | // | | | |
| 3482 | // |
| 3483 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3484 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3485 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3486 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3487 | |
| 3488 | // Init counter check |
| 3489 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3490 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3491 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3492 | Counter{cSubReqToE2, 1}, |
| 3493 | Counter{cSubReReqToE2, 1}, |
| 3494 | Counter{cSubReqTimerExpiry, 2}, |
| 3495 | Counter{cSubDelReqToE2, 1}, |
| 3496 | Counter{cSubDelRespFromE2, 1}, |
| 3497 | }) |
| 3498 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3499 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3500 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3501 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3502 | |
| 3503 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3504 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3505 | |
| 3506 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3507 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3508 | |
| 3509 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3510 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3511 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3512 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3513 | |
| 3514 | // Wait that subs is cleaned |
| 3515 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 3516 | |
| 3517 | mainCtrl.VerifyCounterValues(t) |
| 3518 | } |
| 3519 | |
| 3520 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3521 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3522 | |
| 3523 | // Init counter check |
| 3524 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3525 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3526 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3527 | Counter{cSubReqToE2, 1}, |
| 3528 | Counter{cSubReReqToE2, 1}, |
| 3529 | Counter{cSubReqTimerExpiry, 2}, |
| 3530 | Counter{cSubDelReqToE2, 1}, |
| 3531 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3532 | }) |
| 3533 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3534 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3535 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3536 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3537 | |
| 3538 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3539 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3540 | |
| 3541 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3542 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3543 | |
| 3544 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3545 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3546 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3547 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3548 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3549 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3550 | |
| 3551 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3552 | |
| 3553 | waitSubsCleanup(t, e2SubsId, 10) |
| 3554 | |
| 3555 | mainCtrl.VerifyCounterValues(t) |
| 3556 | |
| 3557 | } |
| 3558 | |
| 3559 | //----------------------------------------------------------------------------- |
| 3560 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3561 | // |
| 3562 | // stub stub |
| 3563 | // +-------+ +---------+ +---------+ |
| 3564 | // | xapp | | submgr | | e2term | |
| 3565 | // +-------+ +---------+ +---------+ |
| 3566 | // | | | |
| 3567 | // | RESTSubReq | | |
| 3568 | // |---------------->| | |
| 3569 | // | | | |
| 3570 | // | RESTSubResp | | |
| 3571 | // |<----------------| | |
| 3572 | // | | SubReq | |
| 3573 | // | |------------->| |
| 3574 | // | | | |
| 3575 | // | | | |
| 3576 | // | | SubReq | |
| 3577 | // | |------------->| |
| 3578 | // | | | |
| 3579 | // | | SubDelReq | |
| 3580 | // | |------------->| |
| 3581 | // | | | |
| 3582 | // | | | |
| 3583 | // | | SubDelReq | |
| 3584 | // | |------------->| |
| 3585 | // | | | |
| 3586 | // | | | |
| 3587 | // | | SubDelResp | |
| 3588 | // | |<-------------| |
| 3589 | // | RESTNotif | | |
| 3590 | // | unsuccess | | |
| 3591 | // |<----------------| | |
| 3592 | // | | | |
| 3593 | // | [SUBS DELETE] | |
| 3594 | // | | | |
| 3595 | // |
| 3596 | //----------------------------------------------------------------------------- |
| 3597 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3598 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3599 | |
| 3600 | // Init counter check |
| 3601 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3602 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3603 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3604 | Counter{cSubReqToE2, 1}, |
| 3605 | Counter{cSubReReqToE2, 1}, |
| 3606 | Counter{cSubReqTimerExpiry, 2}, |
| 3607 | Counter{cSubDelReqToE2, 1}, |
| 3608 | Counter{cSubDelReReqToE2, 1}, |
| 3609 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3610 | }) |
| 3611 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3612 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3613 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3614 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3615 | |
| 3616 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3617 | xapp.Logger.Debug("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3618 | |
| 3619 | e2termConn1.RecvSubsReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3620 | xapp.Logger.Debug("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3621 | |
| 3622 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3623 | xapp.Logger.Debug("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3624 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3625 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3626 | e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3627 | xapp.Logger.Debug("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3628 | |
| 3629 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3630 | |
| 3631 | waitSubsCleanup(t, e2SubsId, 10) |
| 3632 | |
| 3633 | mainCtrl.VerifyCounterValues(t) |
| 3634 | } |
| 3635 | |
| 3636 | //----------------------------------------------------------------------------- |
| 3637 | // TestRESTSubReqSubFailRespInSubmgr |
| 3638 | // |
| 3639 | // stub stub |
| 3640 | // +-------+ +---------+ +---------+ |
| 3641 | // | xapp | | submgr | | e2term | |
| 3642 | // +-------+ +---------+ +---------+ |
| 3643 | // | | | |
| 3644 | // | RESTSubReq | | |
| 3645 | // |---------------->| | |
| 3646 | // | | | |
| 3647 | // | RESTSubResp | | |
| 3648 | // |<----------------| | |
| 3649 | // | | SubReq | |
| 3650 | // | |------------->| |
| 3651 | // | | | |
| 3652 | // | | SubFail | |
| 3653 | // | |<-------------| |
| 3654 | // | | | |
| 3655 | // | | SubDelReq | |
| 3656 | // | |------------->| |
| 3657 | // | | | |
| 3658 | // | | SubDelResp | |
| 3659 | // | |<-------------| |
| 3660 | // | | | |
| 3661 | // | RESTNotif | | |
| 3662 | // | unsuccess | | |
| 3663 | // |<----------------| | |
| 3664 | // | | | |
| 3665 | // | [SUBS DELETE] | |
| 3666 | // | | | |
| 3667 | // |
| 3668 | //----------------------------------------------------------------------------- |
| 3669 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3670 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3671 | |
| 3672 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3673 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3674 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3675 | Counter{cSubReqToE2, 1}, |
| 3676 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3677 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3678 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3679 | }) |
| 3680 | |
| 3681 | const subReqCount int = 1 |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame^] | 3682 | const e2Timeout int64 = 2 |
| 3683 | const e2RetryCount int64 = 1 |
| 3684 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3685 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3686 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | cb7dd49 | 2021-10-01 11:10:26 +0300 | [diff] [blame^] | 3687 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3688 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3689 | |
| 3690 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3691 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3692 | fparams1.Set(crereq1) |
| 3693 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3694 | |
| 3695 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3696 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3697 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3698 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3699 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3700 | |
| 3701 | // REST subscription sill there to be deleted |
| 3702 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3703 | |
| 3704 | // Wait that subs is cleaned |
| 3705 | waitSubsCleanup(t, e2SubsId, 10) |
| 3706 | |
| 3707 | mainCtrl.VerifyCounterValues(t) |
| 3708 | |
| 3709 | } |
| 3710 | |
| 3711 | //----------------------------------------------------------------------------- |
| 3712 | // TestRESTSubDelReqRetryInSubmgr |
| 3713 | // |
| 3714 | // stub stub |
| 3715 | // +-------+ +---------+ +---------+ |
| 3716 | // | xapp | | submgr | | e2term | |
| 3717 | // +-------+ +---------+ +---------+ |
| 3718 | // | | | |
| 3719 | // | [SUBS CREATE] | |
| 3720 | // | | | |
| 3721 | // | | | |
| 3722 | // | RESTSubDelReq | | |
| 3723 | // |---------------->| | |
| 3724 | // | | | |
| 3725 | // | RESTSubDelResp | | |
| 3726 | // |<----------------| | |
| 3727 | // | | SubDelReq | |
| 3728 | // | |------------->| |
| 3729 | // | | | |
| 3730 | // | | SubDelReq | |
| 3731 | // | |------------->| |
| 3732 | // | | | |
| 3733 | // | | SubDelResp | |
| 3734 | // | |<-------------| |
| 3735 | // | | | |
| 3736 | // |
| 3737 | //----------------------------------------------------------------------------- |
| 3738 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3739 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3740 | |
| 3741 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3742 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3743 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3744 | Counter{cSubReqToE2, 1}, |
| 3745 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3746 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3747 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3748 | Counter{cSubDelReqToE2, 1}, |
| 3749 | Counter{cSubDelReReqToE2, 1}, |
| 3750 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3751 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3752 | }) |
| 3753 | // Req |
| 3754 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3755 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3756 | |
| 3757 | // Del |
| 3758 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3759 | |
| 3760 | // E2t: Receive 1st SubsDelReq |
| 3761 | e2termConn1.RecvSubsDelReq(t) |
| 3762 | |
| 3763 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3764 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3765 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3766 | |
| 3767 | //Wait that subs is cleaned |
| 3768 | waitSubsCleanup(t, e2SubsId, 10) |
| 3769 | |
| 3770 | mainCtrl.VerifyCounterValues(t) |
| 3771 | } |
| 3772 | |
| 3773 | //----------------------------------------------------------------------------- |
| 3774 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3775 | // |
| 3776 | // stub stub |
| 3777 | // +-------+ +---------+ +---------+ |
| 3778 | // | xapp | | submgr | | e2term | |
| 3779 | // +-------+ +---------+ +---------+ |
| 3780 | // | | | |
| 3781 | // | [SUBS CREATE] | |
| 3782 | // | | | |
| 3783 | // | | | |
| 3784 | // | RESTSubDelReq | | |
| 3785 | // |---------------->| | |
| 3786 | // | | | |
| 3787 | // | RESTSubDelResp | | |
| 3788 | // |<----------------| | |
| 3789 | // | | SubDelReq | |
| 3790 | // | |------------->| |
| 3791 | // | | | |
| 3792 | // | | SubDelReq | |
| 3793 | // | |------------->| |
| 3794 | // | | | |
| 3795 | // | | | |
| 3796 | // |
| 3797 | //----------------------------------------------------------------------------- |
| 3798 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3799 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3800 | |
| 3801 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3802 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3803 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3804 | Counter{cSubReqToE2, 1}, |
| 3805 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3806 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3807 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3808 | Counter{cSubDelReqToE2, 1}, |
| 3809 | Counter{cSubDelReReqToE2, 1}, |
| 3810 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3811 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3812 | }) |
| 3813 | |
| 3814 | // Req |
| 3815 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3816 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3817 | |
| 3818 | // Del |
| 3819 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3820 | |
| 3821 | // E2t: Receive 1st SubsDelReq |
| 3822 | e2termConn1.RecvSubsDelReq(t) |
| 3823 | |
| 3824 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3825 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3826 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3827 | |
| 3828 | //Wait that subs is cleaned |
| 3829 | waitSubsCleanup(t, e2SubsId, 10) |
| 3830 | |
| 3831 | mainCtrl.VerifyCounterValues(t) |
| 3832 | } |
| 3833 | |
| 3834 | //----------------------------------------------------------------------------- |
| 3835 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3836 | // |
| 3837 | // stub stub |
| 3838 | // +-------+ +---------+ +---------+ |
| 3839 | // | xapp | | submgr | | e2term | |
| 3840 | // +-------+ +---------+ +---------+ |
| 3841 | // | | | |
| 3842 | // | [SUBS CREATE] | |
| 3843 | // | | | |
| 3844 | // | | | |
| 3845 | // | RESTSubDelReq | | |
| 3846 | // |---------------->| | |
| 3847 | // | | | |
| 3848 | // | RESTSubDelResp | | |
| 3849 | // |<----------------| | |
| 3850 | // | | SubDelReq | |
| 3851 | // | |------------->| |
| 3852 | // | | | |
| 3853 | // | | SubDelFail | |
| 3854 | // | |<-------------| |
| 3855 | // | | | |
| 3856 | // |
| 3857 | //----------------------------------------------------------------------------- |
| 3858 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3859 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3860 | |
| 3861 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3862 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3863 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3864 | Counter{cSubReqToE2, 1}, |
| 3865 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3866 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3867 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3868 | Counter{cSubDelReqToE2, 1}, |
| 3869 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3870 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3871 | }) |
| 3872 | |
| 3873 | // Req |
| 3874 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3875 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3876 | |
| 3877 | // Del |
| 3878 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3879 | |
| 3880 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3881 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3882 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3883 | |
| 3884 | //Wait that subs is cleaned |
| 3885 | waitSubsCleanup(t, e2SubsId, 10) |
| 3886 | |
| 3887 | mainCtrl.VerifyCounterValues(t) |
| 3888 | } |
| 3889 | |
| 3890 | //----------------------------------------------------------------------------- |
| 3891 | // TestRESTSubReqAndSubDelOkSameAction |
| 3892 | // |
| 3893 | // stub stub |
| 3894 | // +-------+ +-------+ +---------+ +---------+ |
| 3895 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3896 | // +-------+ +-------+ +---------+ +---------+ |
| 3897 | // | | | | |
| 3898 | // | | RESTSubReq1 | | |
| 3899 | // | |---------------->| | |
| 3900 | // | | | | |
| 3901 | // | | RESTSubResp1 | | |
| 3902 | // | |<----------------| | |
| 3903 | // | | | | |
| 3904 | // | | | SubReq1 | |
| 3905 | // | | |------------->| |
| 3906 | // | | | SubResp1 | |
| 3907 | // | | |<-------------| |
| 3908 | // | | RESTNotif1 | | |
| 3909 | // | |<----------------| | |
| 3910 | // | | | | |
| 3911 | // | RESTSubReq2 | | |
| 3912 | // |------------------------------>| | |
| 3913 | // | | | | |
| 3914 | // | RESTSubResp2 | | |
| 3915 | // |<------------------------------| | |
| 3916 | // | | | | |
| 3917 | // | | RESTNotif2 | | |
| 3918 | // |<------------------------------| | |
| 3919 | // | | | | |
| 3920 | // | | RESTSubDelReq1 | | |
| 3921 | // | |---------------->| | |
| 3922 | // | | | | |
| 3923 | // | | RESTSubDelResp1 | | |
| 3924 | // | |<----------------| | |
| 3925 | // | | | | |
| 3926 | // | RESTSubDelReq2 | | |
| 3927 | // |------------------------------>| | |
| 3928 | // | | | | |
| 3929 | // | RESTSubDelResp2 | | |
| 3930 | // |<------------------------------| | |
| 3931 | // | | | | |
| 3932 | // | | | SubDelReq2 | |
| 3933 | // | | |------------->| |
| 3934 | // | | | | |
| 3935 | // | | | SubDelResp2 | |
| 3936 | // | | |<-------------| |
| 3937 | // | | | | |
| 3938 | // |
| 3939 | //----------------------------------------------------------------------------- |
| 3940 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3941 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3942 | |
| 3943 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3944 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3945 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3946 | Counter{cSubReqToE2, 1}, |
| 3947 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3948 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3949 | Counter{cMergedSubscriptions, 1}, |
| 3950 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3951 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3952 | Counter{cSubDelReqToE2, 1}, |
| 3953 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3954 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3955 | }) |
| 3956 | |
| 3957 | // Req1 |
| 3958 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3959 | |
| 3960 | //Subs Create |
| 3961 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3962 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3963 | |
| 3964 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3965 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3966 | params.SetMeid("RAN_NAME_1") |
| 3967 | |
| 3968 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3969 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3970 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3971 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3972 | waiter.WaitResult(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3973 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3974 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 3975 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3976 | |
| 3977 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3978 | |
| 3979 | // Del1 |
| 3980 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3981 | |
| 3982 | // Del2 |
| 3983 | deleteXapp2Subscription(t, &restSubId2) |
| 3984 | |
| 3985 | //Wait that subs is cleaned |
| 3986 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3987 | |
| 3988 | mainCtrl.VerifyCounterValues(t) |
| 3989 | } |
| 3990 | |
| 3991 | //----------------------------------------------------------------------------- |
| 3992 | // TestSubReqAndSubDelOkSameActionParallel |
| 3993 | // |
| 3994 | // stub stub stub |
| 3995 | // +-------+ +-------+ +---------+ +---------+ |
| 3996 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3997 | // +-------+ +-------+ +---------+ +---------+ |
| 3998 | // | | | | |
| 3999 | // | | | | |
| 4000 | // | | | | |
| 4001 | // | | SubReq1 | | |
| 4002 | // | |------------->| | |
| 4003 | // | | | | |
| 4004 | // | | | SubReq1 | |
| 4005 | // | | |------------->| |
| 4006 | // | SubReq2 | | |
| 4007 | // |--------------------------->| | |
| 4008 | // | | | SubResp1 | |
| 4009 | // | | |<-------------| |
| 4010 | // | | SubResp1 | | |
| 4011 | // | |<-------------| | |
| 4012 | // | | | SubReq2 | |
| 4013 | // | | |------------->| |
| 4014 | // | | | | |
| 4015 | // | | | SubResp2 | |
| 4016 | // | | |<-------------| |
| 4017 | // | SubResp2 | | |
| 4018 | // |<---------------------------| | |
| 4019 | // | | | | |
| 4020 | // | | SubDelReq 1 | | |
| 4021 | // | |------------->| | |
| 4022 | // | | | | |
| 4023 | // | | SubDelResp 1 | | |
| 4024 | // | |<-------------| | |
| 4025 | // | | | | |
| 4026 | // | SubDelReq 2 | | |
| 4027 | // |--------------------------->| | |
| 4028 | // | | | | |
| 4029 | // | | | SubDelReq 2 | |
| 4030 | // | | |------------->| |
| 4031 | // | | | | |
| 4032 | // | | | SubDelReq 2 | |
| 4033 | // | | |------------->| |
| 4034 | // | | | | |
| 4035 | // | SubDelResp 2 | | |
| 4036 | // |<---------------------------| | |
| 4037 | // |
| 4038 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4039 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4040 | |
| 4041 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4042 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4043 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4044 | Counter{cSubReqToE2, 2}, |
| 4045 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4046 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4047 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4048 | Counter{cSubDelReqToE2, 2}, |
| 4049 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4050 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4051 | }) |
| 4052 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4053 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4054 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4055 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4056 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4057 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4058 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4059 | |
| 4060 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4061 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4062 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4063 | |
| 4064 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4065 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4066 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4067 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4068 | |
| 4069 | // Del1 |
| 4070 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4071 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4072 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4073 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4074 | |
| 4075 | // Del2 |
| 4076 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4077 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4078 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4079 | |
| 4080 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4081 | |
| 4082 | mainCtrl.VerifyCounterValues(t) |
| 4083 | } |
| 4084 | |
| 4085 | //----------------------------------------------------------------------------- |
| 4086 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4087 | // |
| 4088 | // stub stub stub |
| 4089 | // +-------+ +-------+ +---------+ +---------+ |
| 4090 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4091 | // +-------+ +-------+ +---------+ +---------+ |
| 4092 | // | | | | |
| 4093 | // | | | | |
| 4094 | // | | | | |
| 4095 | // | | RESTSubReq1 | | |
| 4096 | // | |---------------->| | |
| 4097 | // | | | | |
| 4098 | // | | RESTSubResp1 | | |
| 4099 | // | |<----------------| | |
| 4100 | // | | | SubReq1 | |
| 4101 | // | | |------------->| |
| 4102 | // | RESTSubReq2 | | |
| 4103 | // |------------------------------>| | |
| 4104 | // | | | | |
| 4105 | // | RESTSubDelResp2 | | |
| 4106 | // |<------------------------------| | |
| 4107 | // | | | SubReq1 | |
| 4108 | // | | |------------->| |
| 4109 | // | | | | |
| 4110 | // | | | | |
| 4111 | // | | | SubDelReq | |
| 4112 | // | | |------------->| |
| 4113 | // | | | | |
| 4114 | // | | | SubDelResp | |
| 4115 | // | | |<-------------| |
| 4116 | // | | RESTNotif1 | | |
| 4117 | // | | unsuccess | | |
| 4118 | // | |<----------------| | |
| 4119 | // | RESTNotif2 | | |
| 4120 | // | | unsuccess | | |
| 4121 | // |<------------------------------| | |
| 4122 | // | | | | |
| 4123 | // | | RESTSubDelReq1 | | |
| 4124 | // | |---------------->| | |
| 4125 | // | | | | |
| 4126 | // | | RESTSubDelResp1 | | |
| 4127 | // | |<----------------| | |
| 4128 | // | | | | |
| 4129 | // | RESTSubDelReq2 | | |
| 4130 | // |------------------------------>| | |
| 4131 | // | | | | |
| 4132 | // | RESTSubDelResp2 | | |
| 4133 | // |<------------------------------| | |
| 4134 | // |
| 4135 | //----------------------------------------------------------------------------- |
| 4136 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4137 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4138 | |
| 4139 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4140 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4141 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4142 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4143 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4144 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4145 | Counter{cSubDelReqToE2, 1}, |
| 4146 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4147 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4148 | }) |
| 4149 | |
| 4150 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4151 | |
| 4152 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4153 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4154 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4155 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4156 | |
| 4157 | // Req2 |
| 4158 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4159 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4160 | params2.SetMeid("RAN_NAME_1") |
| 4161 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4162 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4163 | |
| 4164 | //Req1 (retransmitted) |
| 4165 | e2termConn1.RecvSubsReq(t) |
| 4166 | |
| 4167 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4168 | |
| 4169 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4170 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4171 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4172 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4173 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4174 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4175 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4176 | |
| 4177 | // Del1 |
| 4178 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4179 | |
| 4180 | // Del2 |
| 4181 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4182 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4183 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4184 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4185 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4186 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4187 | |
| 4188 | mainCtrl.VerifyCounterValues(t) |
| 4189 | } |
| 4190 | |
| 4191 | //----------------------------------------------------------------------------- |
| 4192 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4193 | // |
| 4194 | // stub stub stub |
| 4195 | // +-------+ +-------+ +---------+ +---------+ |
| 4196 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4197 | // +-------+ +-------+ +---------+ +---------+ |
| 4198 | // | | | | |
| 4199 | // | | | | |
| 4200 | // | | | | |
| 4201 | // | | RESTSubReq1 | | |
| 4202 | // | |---------------->| | |
| 4203 | // | | | | |
| 4204 | // | | RESTSubResp1 | | |
| 4205 | // | |<----------------| | |
| 4206 | // | | | SubReq1 | |
| 4207 | // | | |------------->| |
| 4208 | // | RESTSubReq2 | | |
| 4209 | // |------------------------------>| | |
| 4210 | // | | | | |
| 4211 | // | RESTSubDelResp2 | | |
| 4212 | // |<------------------------------| | |
| 4213 | // | | | SubFail1 | |
| 4214 | // | | |<-------------| |
| 4215 | // | | | | |
| 4216 | // | | RESTNotif1 | | |
| 4217 | // | | unsuccess | | |
| 4218 | // | |<----------------| | |
| 4219 | // | RESTNotif2 | | |
| 4220 | // | | unsuccess | | |
| 4221 | // |<------------------------------| | |
| 4222 | // | | | SubDelReq | |
| 4223 | // | | |------------->| |
| 4224 | // | | | SubDelResp | |
| 4225 | // | | |<-------------| |
| 4226 | // | | | | |
| 4227 | // | | RESTSubDelReq1 | | |
| 4228 | // | |---------------->| | |
| 4229 | // | | | | |
| 4230 | // | | RESTSubDelResp1 | | |
| 4231 | // | |<----------------| | |
| 4232 | // | | | | |
| 4233 | // | RESTSubDelReq2 | | |
| 4234 | // |------------------------------>| | |
| 4235 | // | | | | |
| 4236 | // | RESTSubDelResp2 | | |
| 4237 | // |<------------------------------| | |
| 4238 | // |
| 4239 | //----------------------------------------------------------------------------- |
| 4240 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4241 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4242 | |
| 4243 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4244 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4245 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4246 | Counter{cSubReqToE2, 1}, |
| 4247 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4248 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4249 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4250 | Counter{cSubDelReqToE2, 1}, |
| 4251 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4252 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4253 | }) |
| 4254 | |
| 4255 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4256 | |
| 4257 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4258 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4259 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4260 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4261 | |
| 4262 | // Req2 |
| 4263 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4264 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4265 | params2.SetMeid("RAN_NAME_1") |
| 4266 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4267 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4268 | |
| 4269 | // E2t: send SubsFail (first) |
| 4270 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4271 | fparams1.Set(crereq1) |
| 4272 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4273 | |
| 4274 | // E2t: internal delete |
| 4275 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4276 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4277 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4278 | |
| 4279 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4280 | xapp.Logger.Debug("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4281 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4282 | xapp.Logger.Debug("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4283 | |
| 4284 | // Del1 |
| 4285 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4286 | |
| 4287 | // Del2 |
| 4288 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4289 | |
| 4290 | //Wait that subs is cleaned |
| 4291 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4292 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4293 | |
| 4294 | mainCtrl.VerifyCounterValues(t) |
| 4295 | } |
| 4296 | |
| 4297 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4298 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4299 | |
| 4300 | // Init counter check |
| 4301 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4302 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4303 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4304 | Counter{cSubReqToE2, 1}, |
| 4305 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4306 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4307 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4308 | Counter{cSubDelReqToE2, 1}, |
| 4309 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4310 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4311 | }) |
| 4312 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4313 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4314 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4315 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4316 | |
| 4317 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4318 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4319 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4320 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4321 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4322 | |
| 4323 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4324 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4325 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4326 | |
| 4327 | // Wait that subs is cleaned |
| 4328 | waitSubsCleanup(t, e2SubsId, 10) |
| 4329 | mainCtrl.VerifyCounterValues(t) |
| 4330 | } |
| 4331 | |
| 4332 | //----------------------------------------------------------------------------- |
| 4333 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4334 | // |
| 4335 | // stub stub |
| 4336 | // +-------+ +---------+ +---------+ |
| 4337 | // | xapp | | submgr | | e2term | |
| 4338 | // +-------+ +---------+ +---------+ |
| 4339 | // | | | |
| 4340 | // | RESTSubReq | | |
| 4341 | // |---------------->| | |
| 4342 | // | | | |
| 4343 | // | RESTSubResp | | |
| 4344 | // |<----------------| | |
| 4345 | // | | SubReq | |
| 4346 | // | |------------->| |
| 4347 | // | | | |
| 4348 | // | | SubResp | |
| 4349 | // | |<-------------| |
| 4350 | // | | | |
| 4351 | // | RESTNotif | | |
| 4352 | // |<----------------| | |
| 4353 | // | | | |
| 4354 | // | RESTSubReq | | |
| 4355 | // |---------------->| | |
| 4356 | // | | | |
| 4357 | // | RESTSubResp | | |
| 4358 | // |<----------------| | |
| 4359 | // | | SubReq | |
| 4360 | // | |------------->| |
| 4361 | // | | | |
| 4362 | // | | SubResp | |
| 4363 | // | |<-------------| |
| 4364 | // | | | |
| 4365 | // | RESTNotif | | |
| 4366 | // |<----------------| | |
| 4367 | // | | | |
| 4368 | // | RESTSubDelReq | | |
| 4369 | // |---------------->| | |
| 4370 | // | | | |
| 4371 | // | | SubDelReq | |
| 4372 | // | |------------->| |
| 4373 | // | | | |
| 4374 | // | | SubDelResp | |
| 4375 | // | |<-------------| |
| 4376 | // | | | |
| 4377 | // | RESTSubDelResp | | |
| 4378 | // |<----------------| | |
| 4379 | // |
| 4380 | //----------------------------------------------------------------------------- |
| 4381 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4382 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4383 | |
| 4384 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4385 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4386 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4387 | Counter{cSubReqToE2, 2}, |
| 4388 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4389 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4390 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4391 | Counter{cSubDelReqToE2, 1}, |
| 4392 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4393 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4394 | }) |
| 4395 | |
| 4396 | const subReqCount int = 1 |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4397 | const e2Timeout int64 = 1 |
| 4398 | const e2RetryCount int64 = 0 |
| 4399 | const routingNeeded bool = true |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4400 | |
| 4401 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4402 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4403 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4404 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4405 | |
| 4406 | // Policy change |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4407 | // GetRESTSubsReqPolicyParams sets some counters on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4408 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4409 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4410 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4411 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4412 | params.SetTimeToWait("w200ms") |
| 4413 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4414 | |
| 4415 | // Del |
| 4416 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4417 | |
| 4418 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4419 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4420 | |
| 4421 | // Wait that subs is cleaned |
| 4422 | waitSubsCleanup(t, e2SubsId, 10) |
| 4423 | mainCtrl.VerifyCounterValues(t) |
| 4424 | } |
| 4425 | |
| 4426 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4427 | // TestRESTSubReqPolicyChangeNOk |
| 4428 | // |
| 4429 | // stub stub |
| 4430 | // +-------+ +---------+ +---------+ |
| 4431 | // | xapp | | submgr | | e2term | |
| 4432 | // +-------+ +---------+ +---------+ |
| 4433 | // | | | |
| 4434 | // | RESTSubReq | | |
| 4435 | // |---------------->| | |
| 4436 | // | | | |
| 4437 | // | RESTSubResp | | |
| 4438 | // |<----------------| | |
| 4439 | // | | SubReq | |
| 4440 | // | |------------->| |
| 4441 | // | | | |
| 4442 | // | | SubResp | |
| 4443 | // | |<-------------| |
| 4444 | // | | | |
| 4445 | // | RESTNotif | | |
| 4446 | // |<----------------| | |
| 4447 | // | | | |
| 4448 | // | RESTSubReq | | |
| 4449 | // |---------------->| | |
| 4450 | // | | | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4451 | // | RESTSubUpdateFail(400 Bad request) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4452 | // | | | |
| 4453 | // | RESTSubDelReq | | |
| 4454 | // |---------------->| | |
| 4455 | // | | | |
| 4456 | // | | SubDelReq | |
| 4457 | // | |------------->| |
| 4458 | // | | | |
| 4459 | // | | SubDelResp | |
| 4460 | // | |<-------------| |
| 4461 | // | | | |
| 4462 | // | RESTSubDelResp | | |
| 4463 | // |<----------------| | |
| 4464 | // |
| 4465 | //----------------------------------------------------------------------------- |
| 4466 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4467 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4468 | |
| 4469 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4470 | Counter{cRestSubReqFromXapp, 2}, |
| 4471 | Counter{cRestSubRespToXapp, 1}, |
| 4472 | Counter{cSubReqToE2, 1}, |
| 4473 | Counter{cSubRespFromE2, 1}, |
| 4474 | Counter{cRestSubNotifToXapp, 1}, |
| 4475 | Counter{cRestSubFailToXapp, 1}, |
| 4476 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4477 | Counter{cSubDelReqToE2, 1}, |
| 4478 | Counter{cSubDelRespFromE2, 1}, |
| 4479 | Counter{cRestSubDelRespToXapp, 1}, |
| 4480 | }) |
| 4481 | |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4482 | // Req |
| 4483 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4484 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4485 | |
| 4486 | // Policy change |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4487 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4488 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4489 | restSubIdUpd := strings.ToUpper(restSubId) // This makes RESTSubReq to fail |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4490 | params.SetSubscriptionID(&restSubIdUpd) |
| 4491 | params.SetTimeToWait("w200ms") |
| 4492 | |
| 4493 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4494 | assert.Equal(t, restSubId2, "") |
| 4495 | |
| 4496 | // Del |
| 4497 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4498 | |
| 4499 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4500 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4501 | |
| 4502 | // Wait that subs is cleaned |
| 4503 | waitSubsCleanup(t, e2SubsId, 10) |
| 4504 | mainCtrl.VerifyCounterValues(t) |
| 4505 | } |
| 4506 | |
| 4507 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4508 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4509 | // |
| 4510 | // stub stub stub |
| 4511 | // +-------+ +---------+ +---------+ +---------+ |
| 4512 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4513 | // +-------+ +---------+ +---------+ +---------+ |
| 4514 | // | | | | |
| 4515 | // | | | | |
| 4516 | // | | | | |
| 4517 | // | RESTSubReq1 | | | |
| 4518 | // |---------------->| | | |
| 4519 | // | | | | |
| 4520 | // | RESTSubResp1 | | | |
| 4521 | // |<----------------| | | |
| 4522 | // | | SubReq1 | | |
| 4523 | // | |------------->| | |
| 4524 | // | | | | |
| 4525 | // | RESTSubReq2 | | | |
| 4526 | // |---------------->| | | |
| 4527 | // | | | | |
| 4528 | // | RESTSubResp2 | | | |
| 4529 | // |<----------------| | | |
| 4530 | // | | SubReq2 | | |
| 4531 | // | |---------------------------->| |
| 4532 | // | | | | |
| 4533 | // | | SubResp1 | | |
| 4534 | // | |<-------------| | |
| 4535 | // | RESTNotif1 | | | |
| 4536 | // |<----------------| | | |
| 4537 | // | | SubResp2 | | |
| 4538 | // | |<----------------------------| |
| 4539 | // | RESTNotif2 | | | |
| 4540 | // |<----------------| | | |
| 4541 | // | | | | |
| 4542 | // | [SUBS 1 DELETE] | | |
| 4543 | // | | | | |
| 4544 | // | [SUBS 2 DELETE] | | |
| 4545 | // | | | | |
| 4546 | // |
| 4547 | //----------------------------------------------------------------------------- |
| 4548 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4549 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4550 | |
| 4551 | // Init counter check |
| 4552 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4553 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4554 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4555 | Counter{cSubReqToE2, 2}, |
| 4556 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4557 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4558 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | Counter{cSubDelReqToE2, 2}, |
| 4560 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4561 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | }) |
| 4563 | |
| 4564 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4565 | |
| 4566 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4567 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4568 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4569 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4570 | |
| 4571 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4572 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4573 | params.SetMeid("RAN_NAME_11") |
| 4574 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4575 | // would not work as notification would not be received |
| 4576 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4577 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4578 | |
| 4579 | // Resp1 |
| 4580 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4581 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4582 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4583 | xapp.Logger.Debug("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4584 | |
| 4585 | // Resp2 |
| 4586 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4587 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4588 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4589 | xapp.Logger.Debug("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4590 | |
| 4591 | // Delete1 |
| 4592 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4593 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4594 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4595 | |
| 4596 | // Wait that subs is cleaned |
| 4597 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4598 | |
| 4599 | // Delete2 |
| 4600 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4601 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4602 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4603 | |
| 4604 | // Wait that subs is cleaned |
| 4605 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4606 | |
| 4607 | mainCtrl.VerifyCounterValues(t) |
| 4608 | } |
| 4609 | |
| 4610 | //----------------------------------------------------------------------------- |
| 4611 | // TestRESTSubReqAsn1EncodeFail |
| 4612 | // |
| 4613 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4614 | // stub stub |
| 4615 | // +-------+ +---------+ +---------+ |
| 4616 | // | xapp | | submgr | | e2term | |
| 4617 | // +-------+ +---------+ +---------+ |
| 4618 | // | | | |
| 4619 | // | RESTSubReq | | |
| 4620 | // |---------------->| | |
| 4621 | // | | | |
| 4622 | // | RESTSubResp | | |
| 4623 | // |<----------------| | |
| 4624 | // | RESTSubDelReq | | |
| 4625 | // |---------------->| | |
| 4626 | // | RESTSubDelResp | | |
| 4627 | // | unsuccess | | |
| 4628 | // |<----------------| | |
| 4629 | // | | | |
| 4630 | // |
| 4631 | //----------------------------------------------------------------------------- |
| 4632 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4633 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4634 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4635 | xapp.Logger.Debug("Xapp-frame, v0.8.1 sufficient REST API validation") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4636 | |
| 4637 | } |
| 4638 | |
| 4639 | //----------------------------------------------------------------------------- |
| 4640 | // TestRESTSubReqInsertAndSubDelOk |
| 4641 | // |
| 4642 | // stub stub |
| 4643 | // +-------+ +---------+ +---------+ |
| 4644 | // | xapp | | submgr | | e2term | |
| 4645 | // +-------+ +---------+ +---------+ |
| 4646 | // | | | |
| 4647 | // | RestSubReq | | |
| 4648 | // |---------------->| | |
| 4649 | // | | | |
| 4650 | // | RESTSubResp | | |
| 4651 | // |<----------------| | |
| 4652 | // | | | |
| 4653 | // | | SubReq | |
| 4654 | // | |------------->| |
| 4655 | // | | | |
| 4656 | // | | SubResp | |
| 4657 | // | |<-------------| |
| 4658 | // | RESTNotif | | |
| 4659 | // |<----------------| | |
| 4660 | // | ... | ... | |
| 4661 | // | | | |
| 4662 | // | RESTSubDelReq | | |
| 4663 | // |---------------->| | |
| 4664 | // | | | |
| 4665 | // | | SubDelReq | |
| 4666 | // | |------------->| |
| 4667 | // | | | |
| 4668 | // | | SubDelResp | |
| 4669 | // | |<-------------| |
| 4670 | // | | | |
| 4671 | // | RESTSubDelResp| | |
| 4672 | // |<----------------| | |
| 4673 | // |
| 4674 | //----------------------------------------------------------------------------- |
| 4675 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4676 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4677 | |
| 4678 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4679 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4680 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4681 | Counter{cSubReqToE2, 1}, |
| 4682 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4683 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4684 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4685 | Counter{cSubDelReqToE2, 1}, |
| 4686 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4687 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4688 | }) |
| 4689 | |
| 4690 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4691 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4692 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4693 | params.SetSubActionTypes("insert") |
| 4694 | |
| 4695 | // Req |
| 4696 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4697 | |
| 4698 | // Del |
| 4699 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4700 | |
| 4701 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4702 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4703 | |
| 4704 | // Wait that subs is cleaned |
| 4705 | waitSubsCleanup(t, e2SubsId, 10) |
| 4706 | mainCtrl.VerifyCounterValues(t) |
| 4707 | } |
| 4708 | |
| 4709 | //----------------------------------------------------------------------------- |
| 4710 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4711 | // |
| 4712 | // stub stub |
| 4713 | // +-------+ +---------+ +---------+ |
| 4714 | // | xapp | | submgr | | e2term | |
| 4715 | // +-------+ +---------+ +---------+ |
| 4716 | // | | | |
| 4717 | // | RESTSubReq | | |
| 4718 | // |------------->| | |
| 4719 | // | | | |
| 4720 | // | | SubReq | |
| 4721 | // | |------------->| |
| 4722 | // | | | |
| 4723 | // | | SubResp | |
| 4724 | // | <----| |
| 4725 | // | | |
| 4726 | // | Submgr restart | |
| 4727 | // | | |
| 4728 | // | | | |
| 4729 | // | | SubDelReq | |
| 4730 | // | |------------->| |
| 4731 | // | | | |
| 4732 | // | | SubDelResp | |
| 4733 | // | |<-------------| |
| 4734 | // | | | |
| 4735 | // |
| 4736 | //----------------------------------------------------------------------------- |
| 4737 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4738 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4739 | |
| 4740 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4741 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4742 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4743 | Counter{cSubReqToE2, 1}, |
| 4744 | Counter{cSubDelReqFromXapp, 1}, |
| 4745 | Counter{cSubDelReqToE2, 1}, |
| 4746 | Counter{cSubDelRespFromE2, 1}, |
| 4747 | }) |
| 4748 | |
| 4749 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4750 | |
| 4751 | // Remove possible existing subscription |
| 4752 | mainCtrl.removeExistingSubscriptions(t) |
| 4753 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4754 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4755 | |
| 4756 | //Req |
| 4757 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4758 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4759 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4760 | |
| 4761 | e2termConn1.RecvSubsReq(t) |
| 4762 | |
| 4763 | mainCtrl.SetResetTestFlag(t, false) |
| 4764 | |
| 4765 | mainCtrl.SimulateRestart(t) |
| 4766 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4767 | |
| 4768 | //Del |
| 4769 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4770 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4771 | |
| 4772 | xappConn1.TestMsgChanEmpty(t) |
| 4773 | xappConn2.TestMsgChanEmpty(t) |
| 4774 | e2termConn1.TestMsgChanEmpty(t) |
| 4775 | mainCtrl.wait_registry_empty(t, 10) |
| 4776 | |
| 4777 | mainCtrl.VerifyCounterValues(t) |
| 4778 | } |
| 4779 | |
| 4780 | //----------------------------------------------------------------------------- |
| 4781 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 4782 | // |
| 4783 | // stub stub |
| 4784 | // +-------+ +---------+ +---------+ |
| 4785 | // | xapp | | submgr | | e2term | |
| 4786 | // +-------+ +---------+ +---------+ |
| 4787 | // | | | |
| 4788 | // | RESTSubReq | | |
| 4789 | // |---------------->| | |
| 4790 | // | | | |
| 4791 | // | RESTSubResp | | |
| 4792 | // |<----------------| | |
| 4793 | // | | SubReq | |
| 4794 | // | |------------->| |
| 4795 | // | | | |
| 4796 | // | | SubResp | |
| 4797 | // | |<-------------| |
| 4798 | // | | | |
| 4799 | // | RESTNotif | | |
| 4800 | // |<----------------| | |
| 4801 | // | | | |
| 4802 | // | | |
| 4803 | // | Submgr restart | |
| 4804 | // | | | |
| 4805 | // | RESTSubDelReq | | |
| 4806 | // |---------------->| | |
| 4807 | // | | | |
| 4808 | // | | SubDelReq | |
| 4809 | // | |------------->| |
| 4810 | // | | | |
| 4811 | // | | SubDelResp | |
| 4812 | // | |<-------------| |
| 4813 | // | | | |
| 4814 | // | RESTSubDelResp | | |
| 4815 | // |<----------------| | |
| 4816 | // |
| 4817 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 4818 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4819 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4820 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4821 | |
| 4822 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4823 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4824 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4825 | Counter{cSubReqToE2, 1}, |
| 4826 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4827 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4828 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4829 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4830 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4831 | }) |
| 4832 | |
| 4833 | // Remove possible existing subscription |
| 4834 | mainCtrl.removeExistingSubscriptions(t) |
| 4835 | |
| 4836 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4837 | |
| 4838 | // Create subscription |
| 4839 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4840 | xapp.Logger.Debug("Send REST subscriber request for subscriber : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4841 | |
| 4842 | // Check subscription |
| 4843 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4844 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4845 | mainCtrl.SimulateRestart(t) |
| 4846 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4847 | |
| 4848 | // Check subscription |
| 4849 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4850 | |
| 4851 | // Delete subscription |
| 4852 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4853 | |
| 4854 | //Wait that subs is cleaned |
| 4855 | waitSubsCleanup(t, e2SubsId, 10) |
| 4856 | |
| 4857 | mainCtrl.VerifyCounterValues(t) |
| 4858 | } |
| 4859 | |
| 4860 | //----------------------------------------------------------------------------- |
| 4861 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4862 | // |
| 4863 | // stub stub |
| 4864 | // +-------+ +-------+ +---------+ +---------+ |
| 4865 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4866 | // +-------+ +-------+ +---------+ +---------+ |
| 4867 | // | | | | |
| 4868 | // | | RESTSubReq1 | | |
| 4869 | // | |---------------->| | |
| 4870 | // | | | | |
| 4871 | // | | RESTSubResp1 | | |
| 4872 | // | |<----------------| | |
| 4873 | // | | | | |
| 4874 | // | | | SubReq1 | |
| 4875 | // | | |------------->| |
| 4876 | // | | | SubResp1 | |
| 4877 | // | | |<-------------| |
| 4878 | // | | RESTNotif1 | | |
| 4879 | // | |<----------------| | |
| 4880 | // | | | | |
| 4881 | // | RESTSubReq2 | | |
| 4882 | // |------------------------------>| | |
| 4883 | // | | | | |
| 4884 | // | RESTSubResp2 | | |
| 4885 | // |<------------------------------| | |
| 4886 | // | | | | |
| 4887 | // | | RESTNotif2 | | |
| 4888 | // |<------------------------------| | |
| 4889 | // | | | | |
| 4890 | // | | Submgr restart | |
| 4891 | // | | | | |
| 4892 | // | | RESTSubDelReq1 | | |
| 4893 | // | |---------------->| | |
| 4894 | // | | | | |
| 4895 | // | | RESTSubDelResp1 | | |
| 4896 | // | |<----------------| | |
| 4897 | // | | | | |
| 4898 | // | | Submgr restart | |
| 4899 | // | | | | |
| 4900 | // | RESTSubDelReq2 | | |
| 4901 | // |------------------------------>| | |
| 4902 | // | | | | |
| 4903 | // | RESTSubDelResp2 | | |
| 4904 | // |<------------------------------| | |
| 4905 | // | | | | |
| 4906 | // | | | SubDelReq2 | |
| 4907 | // | | |------------->| |
| 4908 | // | | | | |
| 4909 | // | | | SubDelResp2 | |
| 4910 | // | | |<-------------| |
| 4911 | // | | | | |
| 4912 | // |
| 4913 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 4914 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4915 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4916 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4917 | |
| 4918 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4919 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4920 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4921 | Counter{cSubReqToE2, 1}, |
| 4922 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4923 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4924 | Counter{cMergedSubscriptions, 1}, |
| 4925 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4926 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4927 | Counter{cSubDelReqToE2, 1}, |
| 4928 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4929 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4930 | }) |
| 4931 | |
| 4932 | // Remove possible existing subscription |
| 4933 | mainCtrl.removeExistingSubscriptions(t) |
| 4934 | |
| 4935 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4936 | |
| 4937 | // Create subscription 1 |
| 4938 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4939 | xapp.Logger.Debug("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4940 | |
| 4941 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4942 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4943 | params.SetMeid("RAN_NAME_1") |
| 4944 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4945 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4946 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4947 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4948 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4949 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId2) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4950 | |
| 4951 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4952 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4953 | mainCtrl.SimulateRestart(t) |
| 4954 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4955 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4956 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 4957 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4958 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4959 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4960 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 4961 | mainCtrl.SimulateRestart(t) |
| 4962 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4963 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4964 | |
| 4965 | // Delete subscription 2 |
| 4966 | deleteXapp2Subscription(t, &restSubId2) |
| 4967 | |
| 4968 | //Wait that subs is cleaned |
| 4969 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4970 | |
| 4971 | mainCtrl.VerifyCounterValues(t) |
| 4972 | } |
| 4973 | |
| 4974 | //----------------------------------------------------------------------------- |
| 4975 | // TestRESTReportSubReqAndSubDelOk |
| 4976 | // |
| 4977 | // stub stub |
| 4978 | // +-------+ +---------+ +---------+ |
| 4979 | // | xapp | | submgr | | e2term | |
| 4980 | // +-------+ +---------+ +---------+ |
| 4981 | // | | | |
| 4982 | // | RestSubReq | | |
| 4983 | // |---------------->| | |
| 4984 | // | | | |
| 4985 | // | RESTSubResp | | |
| 4986 | // |<----------------| | |
| 4987 | // | | | |
| 4988 | // | | SubReq | |
| 4989 | // | |------------->| |
| 4990 | // | | | |
| 4991 | // | | SubResp | |
| 4992 | // | |<-------------| |
| 4993 | // | RESTNotif | | |
| 4994 | // |<----------------| | |
| 4995 | // | | SubReq | |
| 4996 | // | |------------->| |
| 4997 | // | | | |
| 4998 | // | | SubResp | |
| 4999 | // | |<-------------| |
| 5000 | // | RESTNotif | | |
| 5001 | // |<----------------| | |
| 5002 | // | ... | ... | |
| 5003 | // | | | |
| 5004 | // | | | |
| 5005 | // | RESTSubDelReq | | |
| 5006 | // |---------------->| | |
| 5007 | // | | | |
| 5008 | // | | SubDelReq | |
| 5009 | // | |------------->| |
| 5010 | // | | | |
| 5011 | // | | SubDelResp | |
| 5012 | // | |<-------------| |
| 5013 | // | | | |
| 5014 | // | RESTSubDelResp| | |
| 5015 | // |<----------------| | |
| 5016 | // |
| 5017 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5018 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5019 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5020 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5021 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5022 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5023 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5024 | } |
| 5025 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5026 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5027 | xapp.Logger.Debug("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5028 | |
| 5029 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5030 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5031 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5032 | |
| 5033 | var e2SubsId []uint32 |
| 5034 | for i := 0; i < subReqCount; i++ { |
| 5035 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5036 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5037 | |
| 5038 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5039 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5040 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5041 | e2SubsId = append(e2SubsId, instanceId) |
| 5042 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5043 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5044 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5045 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5046 | |
| 5047 | } |
| 5048 | |
| 5049 | // Del |
| 5050 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5051 | |
| 5052 | for i := 0; i < subReqCount; i++ { |
| 5053 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5054 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5055 | } |
| 5056 | |
| 5057 | // Wait that subs is cleaned |
| 5058 | for i := 0; i < subReqCount; i++ { |
| 5059 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5060 | } |
| 5061 | |
| 5062 | xappConn1.TestMsgChanEmpty(t) |
| 5063 | e2termConn1.TestMsgChanEmpty(t) |
| 5064 | mainCtrl.wait_registry_empty(t, 10) |
| 5065 | } |
| 5066 | |
| 5067 | /* |
| 5068 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 5069 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5070 | |
| 5071 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5072 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5073 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5074 | |
| 5075 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5076 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5077 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5078 | } |
| 5079 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5080 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5081 | xapp.Logger.Debug("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5082 | |
| 5083 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5084 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5085 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5086 | |
| 5087 | var e2SubsId []uint32 |
| 5088 | for i := 0; i < subReqCount; i++ { |
| 5089 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5090 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5091 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5092 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5093 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5094 | e2SubsId = append(e2SubsId, instanceId) |
| 5095 | } |
| 5096 | |
| 5097 | // Del |
| 5098 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5099 | |
| 5100 | for i := 0; i < subReqCount; i++ { |
| 5101 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5102 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5103 | } |
| 5104 | |
| 5105 | // Wait that subs is cleaned |
| 5106 | for i := 0; i < subReqCount; i++ { |
| 5107 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5108 | } |
| 5109 | xappConn1.TestMsgChanEmpty(t) |
| 5110 | e2termConn1.TestMsgChanEmpty(t) |
| 5111 | mainCtrl.wait_registry_empty(t, 10) |
| 5112 | } |
| 5113 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5114 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5115 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5116 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5117 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5118 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5119 | Counter{cSubReqToE2, 2}, |
| 5120 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5121 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5122 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5123 | Counter{cSubDelReqToE2, 2}, |
| 5124 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5125 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5126 | }) |
| 5127 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5128 | const subReqCount int = 2 |
| 5129 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5130 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5131 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5132 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5133 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5134 | |
| 5135 | assert.Equal(t, len(e2SubsIds), 2) |
| 5136 | |
| 5137 | // Del |
| 5138 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5139 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5140 | |
| 5141 | xappConn1.TestMsgChanEmpty(t) |
| 5142 | e2termConn1.TestMsgChanEmpty(t) |
| 5143 | mainCtrl.wait_registry_empty(t, 10) |
| 5144 | |
| 5145 | mainCtrl.VerifyCounterValues(t) |
| 5146 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5147 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5148 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5149 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5150 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5151 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5152 | Counter{cSubReqToE2, 19}, |
| 5153 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5154 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5155 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5156 | Counter{cSubDelReqToE2, 19}, |
| 5157 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5158 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5159 | }) |
| 5160 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5161 | const subReqCount int = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5162 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5163 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5164 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5165 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5166 | |
| 5167 | assert.Equal(t, len(e2SubsIds), 19) |
| 5168 | |
| 5169 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5170 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5171 | |
| 5172 | xappConn1.TestMsgChanEmpty(t) |
| 5173 | e2termConn1.TestMsgChanEmpty(t) |
| 5174 | mainCtrl.wait_registry_empty(t, 10) |
| 5175 | |
| 5176 | mainCtrl.VerifyCounterValues(t) |
| 5177 | } |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5178 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5179 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5180 | |
| 5181 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5182 | |
| 5183 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5184 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5185 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5186 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5187 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5188 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5189 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5190 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5191 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5192 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5193 | }) |
| 5194 | |
| 5195 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5196 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5197 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5198 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5199 | |
| 5200 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5201 | |
| 5202 | // Del |
| 5203 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5204 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5205 | |
| 5206 | xappConn1.TestMsgChanEmpty(t) |
| 5207 | e2termConn1.TestMsgChanEmpty(t) |
| 5208 | mainCtrl.wait_registry_empty(t, 10) |
| 5209 | |
| 5210 | mainCtrl.VerifyCounterValues(t) |
| 5211 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5212 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5213 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5214 | |
| 5215 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5216 | |
| 5217 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5218 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5219 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5220 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5221 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5222 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5223 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5224 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5225 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5226 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5227 | }) |
| 5228 | |
| 5229 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5230 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5231 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5232 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5233 | |
| 5234 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5235 | |
| 5236 | // Del |
| 5237 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5238 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5239 | |
| 5240 | xappConn1.TestMsgChanEmpty(t) |
| 5241 | e2termConn1.TestMsgChanEmpty(t) |
| 5242 | mainCtrl.wait_registry_empty(t, 10) |
| 5243 | |
| 5244 | mainCtrl.VerifyCounterValues(t) |
| 5245 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5246 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5247 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5248 | |
| 5249 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5250 | |
| 5251 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5252 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5253 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5254 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5255 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5256 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5257 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5258 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5259 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5260 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5261 | }) |
| 5262 | |
| 5263 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5264 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5265 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5266 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5267 | |
| 5268 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5269 | |
| 5270 | // Del |
| 5271 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5272 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5273 | |
| 5274 | xappConn1.TestMsgChanEmpty(t) |
| 5275 | e2termConn1.TestMsgChanEmpty(t) |
| 5276 | mainCtrl.wait_registry_empty(t, 10) |
| 5277 | |
| 5278 | mainCtrl.VerifyCounterValues(t) |
| 5279 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5280 | |
| 5281 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5282 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5283 | |
| 5284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5285 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5286 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5287 | Counter{cSubReqToE2, 2}, |
| 5288 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5289 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5290 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5291 | Counter{cSubDelReqToE2, 2}, |
| 5292 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5293 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5294 | }) |
| 5295 | |
| 5296 | // Req1 |
| 5297 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5298 | |
| 5299 | //Subs Create |
| 5300 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5301 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5302 | |
| 5303 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5304 | |
| 5305 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5306 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5307 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5308 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5309 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5310 | |
| 5311 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5312 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5313 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5314 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5315 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5316 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5317 | |
| 5318 | deleteXapp1Subscription(t, &restSubId1) |
| 5319 | deleteXapp2Subscription(t, &restSubId2) |
| 5320 | |
| 5321 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5322 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5323 | |
| 5324 | mainCtrl.VerifyCounterValues(t) |
| 5325 | |
| 5326 | } |
| 5327 | |
| 5328 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5329 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5330 | |
| 5331 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5332 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5333 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5334 | Counter{cSubReqToE2, 2}, |
| 5335 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5336 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5337 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5338 | Counter{cSubDelReqToE2, 2}, |
| 5339 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5340 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5341 | }) |
| 5342 | |
| 5343 | // Req1 |
| 5344 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5345 | |
| 5346 | //Subs Create |
| 5347 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5348 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5349 | |
| 5350 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5351 | |
| 5352 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5353 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5354 | params.SetMeid("RAN_NAME_1") |
| 5355 | |
| 5356 | actionId := int64(1) |
| 5357 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5358 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5359 | subsequestActionType := "continue" |
| 5360 | timeToWait := "w10ms" |
| 5361 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5362 | |
| 5363 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5364 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5365 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5366 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5367 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5368 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5369 | |
| 5370 | deleteXapp1Subscription(t, &restSubId1) |
| 5371 | deleteXapp2Subscription(t, &restSubId2) |
| 5372 | |
| 5373 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5374 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5375 | |
| 5376 | mainCtrl.VerifyCounterValues(t) |
| 5377 | |
| 5378 | } |
| 5379 | |
| 5380 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5381 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5382 | |
| 5383 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5384 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5385 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5386 | Counter{cSubReqToE2, 2}, |
| 5387 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5388 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5389 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5390 | Counter{cSubDelReqToE2, 2}, |
| 5391 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5392 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5393 | }) |
| 5394 | |
| 5395 | // Req1 |
| 5396 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5397 | |
| 5398 | //Subs Create |
| 5399 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5400 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5401 | |
| 5402 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5403 | |
| 5404 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5405 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5406 | params.SetMeid("RAN_NAME_1") |
| 5407 | params.SetSubActionIDs(int64(2)) |
| 5408 | |
| 5409 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5410 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5411 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5412 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5413 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5414 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5415 | |
| 5416 | deleteXapp1Subscription(t, &restSubId1) |
| 5417 | deleteXapp2Subscription(t, &restSubId2) |
| 5418 | |
| 5419 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5420 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5421 | |
| 5422 | mainCtrl.VerifyCounterValues(t) |
| 5423 | |
| 5424 | } |
| 5425 | |
| 5426 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5427 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5428 | |
| 5429 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5430 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5431 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5432 | Counter{cSubReqToE2, 2}, |
| 5433 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5434 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5435 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5436 | Counter{cSubDelReqToE2, 2}, |
| 5437 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5438 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5439 | }) |
| 5440 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5441 | const e2Timeout int64 = 2 |
| 5442 | const e2RetryCount int64 = 2 |
| 5443 | const routingNeeded bool = true |
| 5444 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5445 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5446 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5447 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5448 | |
| 5449 | //Subs Create |
| 5450 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5451 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5452 | |
| 5453 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5454 | |
| 5455 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5456 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5457 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5458 | params.SetMeid("RAN_NAME_1") |
| 5459 | |
| 5460 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5461 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5462 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5463 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5464 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5465 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5466 | |
| 5467 | deleteXapp1Subscription(t, &restSubId1) |
| 5468 | deleteXapp2Subscription(t, &restSubId2) |
| 5469 | |
| 5470 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5471 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5472 | |
| 5473 | mainCtrl.VerifyCounterValues(t) |
| 5474 | |
| 5475 | } |
| 5476 | |
| 5477 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5478 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5479 | |
| 5480 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5481 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5482 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5483 | Counter{cSubReqToE2, 2}, |
| 5484 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5485 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5486 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5487 | Counter{cSubDelReqToE2, 2}, |
| 5488 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5489 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5490 | }) |
| 5491 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5492 | const e2Timeout int64 = 2 |
| 5493 | const e2RetryCount int64 = 2 |
| 5494 | const routingNeeded bool = true |
| 5495 | |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5496 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5497 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5498 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5499 | |
| 5500 | //Subs Create |
| 5501 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5502 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5503 | |
| 5504 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5505 | |
| 5506 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5507 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5508 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5509 | params.SetMeid("RAN_NAME_1") |
| 5510 | |
| 5511 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5512 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5513 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5514 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5515 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5516 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5517 | |
| 5518 | deleteXapp1Subscription(t, &restSubId1) |
| 5519 | deleteXapp2Subscription(t, &restSubId2) |
| 5520 | |
| 5521 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5522 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5523 | |
| 5524 | mainCtrl.VerifyCounterValues(t) |
| 5525 | |
| 5526 | } |
| 5527 | |
| 5528 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5529 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5530 | |
| 5531 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5532 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5533 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5534 | Counter{cSubReqToE2, 2}, |
| 5535 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5536 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5537 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5538 | Counter{cSubDelReqToE2, 2}, |
| 5539 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5540 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5541 | }) |
| 5542 | |
| 5543 | // Req1 |
| 5544 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5545 | |
| 5546 | //Subs Create |
| 5547 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5548 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5549 | |
| 5550 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5551 | |
| 5552 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5553 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5554 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5555 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5556 | params.SetSubActionDefinition(actionDefinition) |
| 5557 | |
| 5558 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5559 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5560 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5561 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5562 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5563 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5564 | |
| 5565 | deleteXapp1Subscription(t, &restSubId1) |
| 5566 | deleteXapp2Subscription(t, &restSubId2) |
| 5567 | |
| 5568 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5569 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5570 | |
| 5571 | mainCtrl.VerifyCounterValues(t) |
| 5572 | |
| 5573 | } |
| 5574 | |
| 5575 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5576 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5577 | |
| 5578 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5579 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5580 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5581 | Counter{cSubReqToE2, 2}, |
| 5582 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5583 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5584 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5585 | Counter{cSubDelReqToE2, 2}, |
| 5586 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5587 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5588 | }) |
| 5589 | |
| 5590 | // Req1 |
| 5591 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5592 | |
| 5593 | //Subs Create |
| 5594 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5595 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5596 | |
| 5597 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5598 | |
| 5599 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5600 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5601 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5602 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5603 | params.SetSubActionDefinition(actionDefinition) |
| 5604 | |
| 5605 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5606 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5607 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5608 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5609 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5610 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5611 | |
| 5612 | deleteXapp1Subscription(t, &restSubId1) |
| 5613 | deleteXapp2Subscription(t, &restSubId2) |
| 5614 | |
| 5615 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5616 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5617 | |
| 5618 | mainCtrl.VerifyCounterValues(t) |
| 5619 | |
| 5620 | } |
| 5621 | |
| 5622 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5623 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5624 | |
| 5625 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5626 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5627 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5628 | Counter{cSubReqToE2, 2}, |
| 5629 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5630 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5631 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5632 | Counter{cSubDelReqToE2, 2}, |
| 5633 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5634 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5635 | }) |
| 5636 | |
| 5637 | // Req1 |
| 5638 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5639 | |
| 5640 | //Subs Create |
| 5641 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5642 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId1) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5643 | |
| 5644 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5645 | |
| 5646 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5647 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5648 | params.SetMeid("RAN_NAME_1") |
| 5649 | params.SetTimeToWait("w200ms") |
| 5650 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5651 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId2) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5652 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5653 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5654 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5655 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5656 | |
| 5657 | deleteXapp1Subscription(t, &restSubId1) |
| 5658 | deleteXapp2Subscription(t, &restSubId2) |
| 5659 | |
| 5660 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5661 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5662 | |
| 5663 | mainCtrl.VerifyCounterValues(t) |
| 5664 | |
| 5665 | } |
| 5666 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5667 | //----------------------------------------------------------------------------- |
| 5668 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5669 | // |
| 5670 | // stub stub |
| 5671 | // +-------+ +---------+ +---------+ |
| 5672 | // | xapp | | submgr | | e2term | |
| 5673 | // +-------+ +---------+ +---------+ |
| 5674 | // | | | |
| 5675 | // | RestSubReq | | |
| 5676 | // |---------------->| | |
| 5677 | // | | | |
| 5678 | // | RESTSubResp | | |
| 5679 | // |<----------------| | |
| 5680 | // | | | |
| 5681 | // | | SubReq | |
| 5682 | // | |------------->| |
| 5683 | // | | | |
| 5684 | // | | SubResp | ASN.1 decode fails |
| 5685 | // | |<-------------| |
| 5686 | // | | | |
| 5687 | // | | SubReq | |
| 5688 | // | |------------->| |
| 5689 | // | | | |
| 5690 | // | | SubFail | Duplicated action |
| 5691 | // | |<-------------| |
| 5692 | // | RESTNotif (fail)| | |
| 5693 | // |<----------------| | |
| 5694 | // | | SubDelReq | |
| 5695 | // | |------------->| |
| 5696 | // | | | |
| 5697 | // | | SubDelResp | |
| 5698 | // | |<-------------| |
| 5699 | // |
| 5700 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5701 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5702 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5703 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5704 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5705 | |
| 5706 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5707 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5708 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5709 | |
| 5710 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5711 | // Decode of this response fails which will result resending original request |
| 5712 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5713 | |
| 5714 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5715 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5716 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5717 | |
| 5718 | // Subscription already created in E2 Node. |
| 5719 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5720 | fparams.Set(crereq) |
| 5721 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5722 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5723 | |
| 5724 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5725 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5726 | |
| 5727 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5728 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5729 | |
| 5730 | // Wait that subs is cleaned |
| 5731 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5732 | |
| 5733 | xappConn1.TestMsgChanEmpty(t) |
| 5734 | e2termConn1.TestMsgChanEmpty(t) |
| 5735 | mainCtrl.wait_registry_empty(t, 10) |
| 5736 | } |
| 5737 | |
| 5738 | //----------------------------------------------------------------------------- |
| 5739 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5740 | // |
| 5741 | // stub stub |
| 5742 | // +-------+ +---------+ +---------+ |
| 5743 | // | xapp | | submgr | | e2term | |
| 5744 | // +-------+ +---------+ +---------+ |
| 5745 | // | | | |
| 5746 | // | RestSubReq | | |
| 5747 | // |---------------->| | |
| 5748 | // | | | |
| 5749 | // | RESTSubResp | | |
| 5750 | // |<----------------| | |
| 5751 | // | | | |
| 5752 | // | | SubReq | |
| 5753 | // | |------------->| |
| 5754 | // | | | |
| 5755 | // | | SubResp | Unknown instanceId |
| 5756 | // | |<-------------| |
| 5757 | // | | | |
| 5758 | // | | SubReq | |
| 5759 | // | |------------->| |
| 5760 | // | | | |
| 5761 | // | | SubFail | Duplicated action |
| 5762 | // | |<-------------| |
| 5763 | // | RESTNotif (fail)| | |
| 5764 | // |<----------------| | |
| 5765 | // | | SubDelReq | |
| 5766 | // | |------------->| |
| 5767 | // | | | |
| 5768 | // | | SubDelResp | |
| 5769 | // | |<-------------| |
| 5770 | // |
| 5771 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5772 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5773 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5774 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5775 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5776 | |
| 5777 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5778 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5779 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5780 | |
| 5781 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5782 | |
| 5783 | // Unknown instanceId in this response which will result resending original request |
| 5784 | orgInstanceId := crereq.RequestId.InstanceId |
| 5785 | crereq.RequestId.InstanceId = 0 |
| 5786 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5787 | |
| 5788 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5789 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5790 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5791 | |
| 5792 | // Subscription already created in E2 Node. |
| 5793 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5794 | fparams.Set(crereq) |
| 5795 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5796 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5797 | |
| 5798 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5799 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5800 | |
| 5801 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5802 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5803 | |
| 5804 | // Wait that subs is cleaned |
| 5805 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 5806 | |
| 5807 | xappConn1.TestMsgChanEmpty(t) |
| 5808 | e2termConn1.TestMsgChanEmpty(t) |
| 5809 | mainCtrl.wait_registry_empty(t, 10) |
| 5810 | } |
| 5811 | |
| 5812 | //----------------------------------------------------------------------------- |
| 5813 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 5814 | // |
| 5815 | // stub stub |
| 5816 | // +-------+ +---------+ +---------+ |
| 5817 | // | xapp | | submgr | | e2term | |
| 5818 | // +-------+ +---------+ +---------+ |
| 5819 | // | | | |
| 5820 | // | RestSubReq | | |
| 5821 | // |---------------->| | |
| 5822 | // | | | |
| 5823 | // | RESTSubResp | | |
| 5824 | // |<----------------| | |
| 5825 | // | | | |
| 5826 | // | | SubReq | |
| 5827 | // | |------------->| |
| 5828 | // | | | |
| 5829 | // | | SubResp | No transaction for the response |
| 5830 | // | |<-------------| |
| 5831 | // | | | |
| 5832 | // | | SubReq | |
| 5833 | // | |------------->| |
| 5834 | // | | | |
| 5835 | // | | SubFail | Duplicated action |
| 5836 | // | |<-------------| |
| 5837 | // | RESTNotif (fail)| | |
| 5838 | // |<----------------| | |
| 5839 | // | | SubDelReq | |
| 5840 | // | |------------->| |
| 5841 | // | | | |
| 5842 | // | | SubDelResp | |
| 5843 | // | |<-------------| |
| 5844 | // | | | |
| 5845 | // | | SubDelReq | |
| 5846 | // | |------------->| |
| 5847 | // | | | |
| 5848 | // | | SubDelResp | |
| 5849 | // | |<-------------| |
| 5850 | // |
| 5851 | //----------------------------------------------------------------------------- |
| 5852 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5853 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 5854 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5855 | |
| 5856 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5857 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5858 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5859 | |
| 5860 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5861 | |
| 5862 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5863 | // No transaction exist for this response which will result resending original request |
| 5864 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5865 | |
| 5866 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5867 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5868 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5869 | |
| 5870 | // Subscription already created in E2 Node. |
| 5871 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5872 | fparams.Set(crereq) |
| 5873 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5874 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5875 | |
| 5876 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5877 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5878 | |
| 5879 | // Resending happens because there no transaction |
| 5880 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5881 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5882 | |
| 5883 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5884 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5885 | |
| 5886 | // Wait that subs is cleaned |
| 5887 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5888 | |
| 5889 | xappConn1.TestMsgChanEmpty(t) |
| 5890 | e2termConn1.TestMsgChanEmpty(t) |
| 5891 | mainCtrl.wait_registry_empty(t, 10) |
| 5892 | |
| 5893 | } |
| 5894 | |
| 5895 | //----------------------------------------------------------------------------- |
| 5896 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 5897 | // |
| 5898 | // stub stub |
| 5899 | // +-------+ +---------+ +---------+ |
| 5900 | // | xapp | | submgr | | e2term | |
| 5901 | // +-------+ +---------+ +---------+ |
| 5902 | // | | | |
| 5903 | // | RestSubReq | | |
| 5904 | // |---------------->| | |
| 5905 | // | | | |
| 5906 | // | RESTSubResp | | |
| 5907 | // |<----------------| | |
| 5908 | // | | | |
| 5909 | // | | SubReq | |
| 5910 | // | |------------->| |
| 5911 | // | | | |
| 5912 | // | | SubFail | ASN.1 decode fails |
| 5913 | // | |<-------------| |
| 5914 | // | | | |
| 5915 | // | | SubReq | |
| 5916 | // | |------------->| |
| 5917 | // | | | |
| 5918 | // | | SubFail | Duplicated action |
| 5919 | // | |<-------------| |
| 5920 | // | RESTNotif (fail)| | |
| 5921 | // |<----------------| | |
| 5922 | // | | SubDelReq | |
| 5923 | // | |------------->| |
| 5924 | // | | | |
| 5925 | // | | SubDelResp | |
| 5926 | // | |<-------------| |
| 5927 | // |
| 5928 | //----------------------------------------------------------------------------- |
| 5929 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5930 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 5931 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5932 | |
| 5933 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5934 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5935 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5936 | |
| 5937 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5938 | |
| 5939 | // Decode of this response fails which will result resending original request |
| 5940 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 5941 | |
| 5942 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5943 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5944 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5945 | |
| 5946 | // Subscription already created in E2 Node. |
| 5947 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5948 | fparams.Set(crereq) |
| 5949 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5950 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5951 | |
| 5952 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5953 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5954 | |
| 5955 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 5956 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5957 | |
| 5958 | // Wait that subs is cleaned |
| 5959 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5960 | |
| 5961 | xappConn1.TestMsgChanEmpty(t) |
| 5962 | e2termConn1.TestMsgChanEmpty(t) |
| 5963 | mainCtrl.wait_registry_empty(t, 10) |
| 5964 | } |
| 5965 | |
| 5966 | //----------------------------------------------------------------------------- |
| 5967 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5968 | // |
| 5969 | // stub stub |
| 5970 | // +-------+ +---------+ +---------+ |
| 5971 | // | xapp | | submgr | | e2term | |
| 5972 | // +-------+ +---------+ +---------+ |
| 5973 | // | | | |
| 5974 | // | RestSubReq | | |
| 5975 | // |---------------->| | |
| 5976 | // | | | |
| 5977 | // | RESTSubResp | | |
| 5978 | // |<----------------| | |
| 5979 | // | | | |
| 5980 | // | | SubReq | |
| 5981 | // | |------------->| |
| 5982 | // | | | |
| 5983 | // | | SubFail | Unknown instanceId |
| 5984 | // | |<-------------| |
| 5985 | // | | | |
| 5986 | // | | SubReq | |
| 5987 | // | |------------->| |
| 5988 | // | | | |
| 5989 | // | | SubFail | Duplicated action |
| 5990 | // | |<-------------| |
| 5991 | // | RESTNotif (fail)| | |
| 5992 | // |<----------------| | |
| 5993 | // | | SubDelReq | |
| 5994 | // | |------------->| |
| 5995 | // | | | |
| 5996 | // | | SubDelResp | |
| 5997 | // | |<-------------| |
| 5998 | // |
| 5999 | //----------------------------------------------------------------------------- |
| 6000 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6001 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 6002 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6003 | |
| 6004 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6005 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6006 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6007 | |
| 6008 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6009 | |
| 6010 | // Unknown instanceId in this response which will result resending original request |
| 6011 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6012 | fparams.Set(crereq) |
| 6013 | fparams.Fail.RequestId.InstanceId = 0 |
| 6014 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6015 | |
| 6016 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6017 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6018 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6019 | |
| 6020 | // Subscription already created in E2 Node. |
| 6021 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6022 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6023 | |
| 6024 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6025 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6026 | |
| 6027 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6028 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6029 | |
| 6030 | // Wait that subs is cleaned |
| 6031 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6032 | |
| 6033 | xappConn1.TestMsgChanEmpty(t) |
| 6034 | e2termConn1.TestMsgChanEmpty(t) |
| 6035 | mainCtrl.wait_registry_empty(t, 10) |
| 6036 | } |
| 6037 | |
| 6038 | //----------------------------------------------------------------------------- |
| 6039 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6040 | // |
| 6041 | // stub stub |
| 6042 | // +-------+ +---------+ +---------+ |
| 6043 | // | xapp | | submgr | | e2term | |
| 6044 | // +-------+ +---------+ +---------+ |
| 6045 | // | | | |
| 6046 | // | RestSubReq | | |
| 6047 | // |---------------->| | |
| 6048 | // | | | |
| 6049 | // | RESTSubResp | | |
| 6050 | // |<----------------| | |
| 6051 | // | | | |
| 6052 | // | | SubReq | |
| 6053 | // | |------------->| |
| 6054 | // | | | |
| 6055 | // | | SubFail | No transaction for the response |
| 6056 | // | |<-------------| |
| 6057 | // | | | |
| 6058 | // | | SubReq | |
| 6059 | // | |------------->| |
| 6060 | // | | | |
| 6061 | // | | SubFail | Duplicated action |
| 6062 | // | |<-------------| |
| 6063 | // | RESTNotif (fail)| | |
| 6064 | // |<----------------| | |
| 6065 | // | | SubDelReq | |
| 6066 | // | |------------->| |
| 6067 | // | | | |
| 6068 | // | | SubDelResp | |
| 6069 | // | |<-------------| |
| 6070 | // |
| 6071 | //----------------------------------------------------------------------------- |
| 6072 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6073 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6074 | const subReqCount int = 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6075 | |
| 6076 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6077 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6078 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6079 | |
| 6080 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6081 | |
| 6082 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6083 | |
| 6084 | // No transaction exist for this response which will result resending original request |
| 6085 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6086 | fparams.Set(crereq) |
| 6087 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6088 | |
| 6089 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6090 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6091 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6092 | |
| 6093 | // Subscription already created in E2 Node. |
| 6094 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6095 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6096 | |
| 6097 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6098 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6099 | |
| 6100 | // Resending happens because there no transaction |
| 6101 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6102 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6103 | |
| 6104 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6105 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", instanceId) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6106 | |
| 6107 | // Wait that subs is cleaned |
| 6108 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6109 | |
| 6110 | xappConn1.TestMsgChanEmpty(t) |
| 6111 | e2termConn1.TestMsgChanEmpty(t) |
| 6112 | mainCtrl.wait_registry_empty(t, 10) |
| 6113 | } |
| 6114 | |
| 6115 | //----------------------------------------------------------------------------- |
| 6116 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6117 | // |
| 6118 | // stub stub |
| 6119 | // +-------+ +---------+ +---------+ |
| 6120 | // | xapp | | submgr | | e2term | |
| 6121 | // +-------+ +---------+ +---------+ |
| 6122 | // | | | |
| 6123 | // | [SUBS CREATE] | |
| 6124 | // | | | |
| 6125 | // | | | |
| 6126 | // | RESTSubDelReq | | |
| 6127 | // |---------------->| | |
| 6128 | // | | | |
| 6129 | // | RESTSubDelResp | | |
| 6130 | // |<----------------| | |
| 6131 | // | | | |
| 6132 | // | | SubDelReq | |
| 6133 | // | |------------->| |
| 6134 | // | | | |
| 6135 | // | | SubDelResp | ASN.1 decode fails |
| 6136 | // | |<-------------| |
| 6137 | // | | | |
| 6138 | // | | SubDelReq | |
| 6139 | // | |------------->| |
| 6140 | // | | | |
| 6141 | // | | SubDelFail | Subscription does exist any more |
| 6142 | // | |<-------------| |
| 6143 | // | | | |
| 6144 | // |
| 6145 | //----------------------------------------------------------------------------- |
| 6146 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6147 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6148 | |
| 6149 | // Req |
| 6150 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6151 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6152 | |
| 6153 | // Del |
| 6154 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6155 | |
| 6156 | // E2t: Receive 1st SubsDelReq |
| 6157 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6158 | |
| 6159 | // Decode of this response fails which will result resending original request |
| 6160 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6161 | |
| 6162 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6163 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6164 | |
| 6165 | // Subscription does not exist in in E2 Node. |
| 6166 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6167 | |
| 6168 | // Wait that subs is cleaned |
| 6169 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6170 | |
| 6171 | xappConn1.TestMsgChanEmpty(t) |
| 6172 | e2termConn1.TestMsgChanEmpty(t) |
| 6173 | mainCtrl.wait_registry_empty(t, 10) |
| 6174 | } |
| 6175 | |
| 6176 | //----------------------------------------------------------------------------- |
| 6177 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6178 | // |
| 6179 | // stub stub |
| 6180 | // +-------+ +---------+ +---------+ |
| 6181 | // | xapp | | submgr | | e2term | |
| 6182 | // +-------+ +---------+ +---------+ |
| 6183 | // | | | |
| 6184 | // | [SUBS CREATE] | |
| 6185 | // | | | |
| 6186 | // | | | |
| 6187 | // | RESTSubDelReq | | |
| 6188 | // |---------------->| | |
| 6189 | // | | | |
| 6190 | // | RESTSubDelResp | | |
| 6191 | // |<----------------| | |
| 6192 | // | | | |
| 6193 | // | | SubDelReq | |
| 6194 | // | |------------->| |
| 6195 | // | | | |
| 6196 | // | | SubDelResp | Unknown instanceId |
| 6197 | // | |<-------------| |
| 6198 | // | | | |
| 6199 | // | | SubDelReq | |
| 6200 | // | |------------->| |
| 6201 | // | | | |
| 6202 | // | | SubDelFail | Subscription does exist any more |
| 6203 | // | |<-------------| |
| 6204 | // |
| 6205 | //----------------------------------------------------------------------------- |
| 6206 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6207 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6208 | |
| 6209 | // Req |
| 6210 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6211 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6212 | |
| 6213 | // Del |
| 6214 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6215 | |
| 6216 | // E2t: Receive 1st SubsDelReq |
| 6217 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6218 | |
| 6219 | // Unknown instanceId in this response which will result resending original request |
| 6220 | delreq.RequestId.InstanceId = 0 |
| 6221 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6222 | |
| 6223 | // E2t: Receive 2nd SubsDelReq |
| 6224 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6225 | |
| 6226 | // Subscription does not exist in in E2 Node. |
| 6227 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6228 | |
| 6229 | // Wait that subs is cleaned |
| 6230 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6231 | |
| 6232 | xappConn1.TestMsgChanEmpty(t) |
| 6233 | e2termConn1.TestMsgChanEmpty(t) |
| 6234 | mainCtrl.wait_registry_empty(t, 10) |
| 6235 | } |
| 6236 | |
| 6237 | //----------------------------------------------------------------------------- |
| 6238 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6239 | // |
| 6240 | // stub stub |
| 6241 | // +-------+ +---------+ +---------+ |
| 6242 | // | xapp | | submgr | | e2term | |
| 6243 | // +-------+ +---------+ +---------+ |
| 6244 | // | | | |
| 6245 | // | [SUBS CREATE] | |
| 6246 | // | | | |
| 6247 | // | | | |
| 6248 | // | RESTSubDelReq | | |
| 6249 | // |---------------->| | |
| 6250 | // | | | |
| 6251 | // | RESTSubDelResp | | |
| 6252 | // |<----------------| | |
| 6253 | // | | | |
| 6254 | // | | SubDelReq | |
| 6255 | // | |------------->| |
| 6256 | // | | | |
| 6257 | // | | SubDelResp | No transaction for the response |
| 6258 | // | |<-------------| |
| 6259 | // | | | |
| 6260 | // | | SubDelReq | |
| 6261 | // | |------------->| |
| 6262 | // | | | |
| 6263 | // | | SubDelFail | Subscription does exist any more |
| 6264 | // | |<-------------| |
| 6265 | // |
| 6266 | //----------------------------------------------------------------------------- |
| 6267 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6268 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6269 | |
| 6270 | // Req |
| 6271 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6272 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6273 | |
| 6274 | // Del |
| 6275 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6276 | |
| 6277 | // E2t: Receive 1st SubsDelReq |
| 6278 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6279 | |
| 6280 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6281 | |
| 6282 | // No transaction exist for this response which will result resending original request |
| 6283 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6284 | |
| 6285 | // E2t: Receive 2nd SubsDelReq |
| 6286 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6287 | |
| 6288 | // Subscription does not exist in in E2 Node. |
| 6289 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6290 | |
| 6291 | // Wait that subs is cleaned |
| 6292 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6293 | |
| 6294 | xappConn1.TestMsgChanEmpty(t) |
| 6295 | e2termConn1.TestMsgChanEmpty(t) |
| 6296 | mainCtrl.wait_registry_empty(t, 10) |
| 6297 | } |
| 6298 | |
| 6299 | //----------------------------------------------------------------------------- |
| 6300 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6301 | // |
| 6302 | // stub stub |
| 6303 | // +-------+ +---------+ +---------+ |
| 6304 | // | xapp | | submgr | | e2term | |
| 6305 | // +-------+ +---------+ +---------+ |
| 6306 | // | | | |
| 6307 | // | [SUBS CREATE] | |
| 6308 | // | | | |
| 6309 | // | | | |
| 6310 | // | RESTSubDelReq | | |
| 6311 | // |---------------->| | |
| 6312 | // | | | |
| 6313 | // | RESTSubDelResp | | |
| 6314 | // |<----------------| | |
| 6315 | // | | | |
| 6316 | // | | SubDelReq | |
| 6317 | // | |------------->| |
| 6318 | // | | | |
| 6319 | // | | SubDelFail | ASN.1 decode fails |
| 6320 | // | |<-------------| |
| 6321 | // | | | |
| 6322 | // | | SubDelReq | |
| 6323 | // | |------------->| |
| 6324 | // | | | |
| 6325 | // | | SubDelFail | Subscription does exist any more |
| 6326 | // | |<-------------| |
| 6327 | // |
| 6328 | //----------------------------------------------------------------------------- |
| 6329 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6330 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6331 | |
| 6332 | // Req |
| 6333 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6334 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6335 | |
| 6336 | // Del |
| 6337 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6338 | |
| 6339 | // E2t: Receive 1st SubsDelReq |
| 6340 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6341 | |
| 6342 | // Decode of this response fails which will result resending original request |
| 6343 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6344 | |
| 6345 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6346 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6347 | |
| 6348 | // Subscription does not exist in in E2 Node. |
| 6349 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6350 | |
| 6351 | // Wait that subs is cleaned |
| 6352 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6353 | |
| 6354 | xappConn1.TestMsgChanEmpty(t) |
| 6355 | e2termConn1.TestMsgChanEmpty(t) |
| 6356 | mainCtrl.wait_registry_empty(t, 10) |
| 6357 | } |
| 6358 | |
| 6359 | //----------------------------------------------------------------------------- |
| 6360 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6361 | // |
| 6362 | // stub stub |
| 6363 | // +-------+ +---------+ +---------+ |
| 6364 | // | xapp | | submgr | | e2term | |
| 6365 | // +-------+ +---------+ +---------+ |
| 6366 | // | | | |
| 6367 | // | [SUBS CREATE] | |
| 6368 | // | | | |
| 6369 | // | | | |
| 6370 | // | RESTSubDelReq | | |
| 6371 | // |---------------->| | |
| 6372 | // | | | |
| 6373 | // | RESTSubDelResp | | |
| 6374 | // |<----------------| | |
| 6375 | // | | | |
| 6376 | // | | SubDelReq | |
| 6377 | // | |------------->| |
| 6378 | // | | | |
| 6379 | // | | SubDelFail | Unknown instanceId |
| 6380 | // | |<-------------| |
| 6381 | // | | | |
| 6382 | // | | SubDelReq | |
| 6383 | // | |------------->| |
| 6384 | // | | | |
| 6385 | // | | SubDelFail | Subscription does exist any more |
| 6386 | // | |<-------------| |
| 6387 | // |
| 6388 | //----------------------------------------------------------------------------- |
| 6389 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6390 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6391 | |
| 6392 | // Req |
| 6393 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6394 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6395 | |
| 6396 | // Del |
| 6397 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6398 | |
| 6399 | // E2t: Receive 1st SubsDelReq |
| 6400 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6401 | |
| 6402 | // Unknown instanceId in this response which will result resending original request |
| 6403 | delreq.RequestId.InstanceId = 0 |
| 6404 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6405 | |
| 6406 | // E2t: Receive 2nd SubsDelReq |
| 6407 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6408 | |
| 6409 | // Subscription does not exist in in E2 Node. |
| 6410 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6411 | |
| 6412 | // Wait that subs is cleaned |
| 6413 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6414 | |
| 6415 | xappConn1.TestMsgChanEmpty(t) |
| 6416 | e2termConn1.TestMsgChanEmpty(t) |
| 6417 | mainCtrl.wait_registry_empty(t, 10) |
| 6418 | } |
| 6419 | |
| 6420 | //----------------------------------------------------------------------------- |
| 6421 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6422 | // |
| 6423 | // stub stub |
| 6424 | // +-------+ +---------+ +---------+ |
| 6425 | // | xapp | | submgr | | e2term | |
| 6426 | // +-------+ +---------+ +---------+ |
| 6427 | // | | | |
| 6428 | // | [SUBS CREATE] | |
| 6429 | // | | | |
| 6430 | // | | | |
| 6431 | // | RESTSubDelReq | | |
| 6432 | // |---------------->| | |
| 6433 | // | | | |
| 6434 | // | RESTSubDelResp | | |
| 6435 | // |<----------------| | |
| 6436 | // | | | |
| 6437 | // | | SubDelReq | |
| 6438 | // | |------------->| |
| 6439 | // | | | |
| 6440 | // | | SubDelFail | No transaction for the response |
| 6441 | // | |<-------------| |
| 6442 | // | | | |
| 6443 | // | | SubDelReq | |
| 6444 | // | |------------->| |
| 6445 | // | | | |
| 6446 | // | | SubDelFail | Subscription does exist any more |
| 6447 | // | |<-------------| |
| 6448 | // |
| 6449 | //----------------------------------------------------------------------------- |
| 6450 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6451 | xapp.Logger.Debug("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6452 | |
| 6453 | // Req |
| 6454 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6455 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6456 | |
| 6457 | // Del |
| 6458 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6459 | |
| 6460 | // E2t: Receive 1st SubsDelReq |
| 6461 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6462 | |
| 6463 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6464 | |
| 6465 | // No transaction exist for this response which will result resending original request |
| 6466 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6467 | |
| 6468 | // E2t: Receive 2nd SubsDelReq |
| 6469 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6470 | |
| 6471 | // Subscription does not exist in in E2 Node. |
| 6472 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6473 | |
| 6474 | // Wait that subs is cleaned |
| 6475 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6476 | |
| 6477 | xappConn1.TestMsgChanEmpty(t) |
| 6478 | e2termConn1.TestMsgChanEmpty(t) |
| 6479 | mainCtrl.wait_registry_empty(t, 10) |
| 6480 | } |
| 6481 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6482 | //----------------------------------------------------------------------------- |
| 6483 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6484 | // |
| 6485 | // stub stub |
| 6486 | // +-------+ +---------+ +---------+ |
| 6487 | // | xapp | | submgr | | e2term | |
| 6488 | // +-------+ +---------+ +---------+ |
| 6489 | // | | | |
| 6490 | // | RESTSubReq | | |
| 6491 | // |---------------->| | |
| 6492 | // | | | |
| 6493 | // | RESTSubResp | | |
| 6494 | // |<----------------| | |
| 6495 | // | | | |
| 6496 | // | ASN.1 encode fails | |
| 6497 | // | | | |
| 6498 | // | | SubDelReq | |
| 6499 | // | |------------->| |
| 6500 | // | | | |
| 6501 | // | | SubDelFail | |
| 6502 | // | |<-------------| |
| 6503 | // | | | |
| 6504 | // | RESTNotif | | |
| 6505 | // | unsuccess | | |
| 6506 | // |<----------------| | |
| 6507 | // | | | |
| 6508 | // | [SUBS DELETE] | |
| 6509 | // | | | |
| 6510 | // |
| 6511 | //----------------------------------------------------------------------------- |
| 6512 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6513 | |
| 6514 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6515 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6516 | Counter{cRestSubRespToXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6517 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6518 | }) |
| 6519 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6520 | const subReqCount int = 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6521 | |
| 6522 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6523 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6524 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6525 | |
| 6526 | // Req |
| 6527 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6528 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6529 | |
| 6530 | // E2t: Receive SubsDelReq |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6531 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6532 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6533 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6534 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6535 | |
| 6536 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 6537 | // Wait that subs is cleaned |
| 6538 | waitSubsCleanup(t, e2SubsId, 10) |
| 6539 | mainCtrl.VerifyCounterValues(t) |
| 6540 | } |
| 6541 | |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6542 | func TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction(t *testing.T) { |
| 6543 | CaseBegin("TestRESTSubReqPolicyUpdateTimeoutAndSubDelOkSameAction") |
| 6544 | |
| 6545 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6546 | Counter{cRestSubReqFromXapp, 2}, |
| 6547 | Counter{cRestSubRespToXapp, 2}, |
| 6548 | Counter{cSubReqToE2, 2}, |
| 6549 | Counter{cSubRespFromE2, 1}, |
| 6550 | Counter{cRestSubNotifToXapp, 1}, |
| 6551 | Counter{cRestSubFailNotifToXapp, 1}, |
| 6552 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6553 | Counter{cSubDelReqToE2, 1}, |
| 6554 | Counter{cSubDelRespFromE2, 1}, |
| 6555 | Counter{cRestSubDelRespToXapp, 1}, |
| 6556 | }) |
| 6557 | |
| 6558 | const e2Timeout int64 = 1 |
| 6559 | const e2RetryCount int64 = 0 |
| 6560 | const routingNeeded bool = false |
| 6561 | |
| 6562 | // Req1 |
| 6563 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6564 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6565 | |
| 6566 | // Subs Create |
| 6567 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6568 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6569 | |
| 6570 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6571 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6572 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6573 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6574 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6575 | |
| 6576 | // Policy change |
| 6577 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6578 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6579 | params.SetSubscriptionID(&restSubId) |
| 6580 | params.SetTimeToWait("w200ms") |
| 6581 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6582 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6583 | |
| 6584 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6585 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6586 | // SubsResp is missing |
| 6587 | e2SubsId = xappConn1.WaitRESTNotification(t, restSubId) |
| 6588 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 6589 | |
| 6590 | // Del |
| 6591 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6592 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6593 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6594 | |
| 6595 | waitSubsCleanup(t, e2SubsId, 10) |
| 6596 | |
| 6597 | mainCtrl.VerifyCounterValues(t) |
| 6598 | } |
| 6599 | |
| 6600 | //----------------------------------------------------------------------------- |
| 6601 | // TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle |
| 6602 | // |
| 6603 | // stub stub |
| 6604 | // +-------+ +---------+ +---------+ |
| 6605 | // | xapp | | submgr | | e2term | |
| 6606 | // +-------+ +---------+ +---------+ |
| 6607 | // | | | |
| 6608 | // | RESTSubReq | | |
| 6609 | // |---------------->| | |
| 6610 | // | | | |
| 6611 | // | RESTSubResp | | |
| 6612 | // |<----------------| | |
| 6613 | // | | SubReq | |
| 6614 | // | |------------->| |
| 6615 | // | | | |
| 6616 | // | | SubResp | |
| 6617 | // | |<-------------| |
| 6618 | // | | | |
| 6619 | // | RESTNotif | | |
| 6620 | // |<----------------| | |
| 6621 | // | | | |
| 6622 | // | RESTSubReq | | |
| 6623 | // |---------------->| | |
| 6624 | // | | | |
| 6625 | // | RESTSubResp | | |
| 6626 | // |<----------------| | |
| 6627 | // | | SubReq | |
| 6628 | // | |------------->| |
| 6629 | // | | |
| 6630 | // | Submgr restart | |
| 6631 | // | | | |
| 6632 | // | RESTSubDelReq | | |
| 6633 | // |---------------->| | |
| 6634 | // | | | |
| 6635 | // | | SubDelReq | |
| 6636 | // | |------------->| |
| 6637 | // | | | |
| 6638 | // | | SubDelResp | |
| 6639 | // | |<-------------| |
| 6640 | // | | | |
| 6641 | // | RESTSubDelResp | | |
| 6642 | // |<----------------| | |
| 6643 | // |
| 6644 | //----------------------------------------------------------------------------- |
| 6645 | |
| 6646 | func TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 6647 | CaseBegin("TestPolicyUpdateRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 6648 | |
| 6649 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 6650 | Counter{cRestSubReqFromXapp, 2}, |
| 6651 | Counter{cRestSubRespToXapp, 2}, |
| 6652 | Counter{cSubReqToE2, 2}, |
| 6653 | Counter{cSubRespFromE2, 1}, |
| 6654 | Counter{cRestSubNotifToXapp, 1}, |
| 6655 | Counter{cRestSubNotifToXapp, 1}, |
| 6656 | Counter{cRestSubDelReqFromXapp, 1}, |
| 6657 | Counter{cSubDelReqToE2, 1}, |
| 6658 | Counter{cRestSubDelRespToXapp, 1}, |
| 6659 | }) |
| 6660 | |
| 6661 | // Remove possible existing subscription |
| 6662 | mainCtrl.removeExistingSubscriptions(t) |
| 6663 | |
| 6664 | const e2Timeout int64 = 1 |
| 6665 | const e2RetryCount int64 = 0 |
| 6666 | const routingNeeded bool = false |
| 6667 | |
| 6668 | // Req1 |
| 6669 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6670 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6671 | // Create subscription |
| 6672 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6673 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6674 | |
| 6675 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6676 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6677 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6678 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6679 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
| 6680 | |
| 6681 | // Check subscription |
| 6682 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6683 | |
| 6684 | // Policy change |
| 6685 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 6686 | params.SetSubscriptionDirectives(e2Timeout, e2RetryCount, routingNeeded) |
| 6687 | params.SetSubscriptionID(&restSubId) |
| 6688 | params.SetTimeToWait("w200ms") |
| 6689 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 6690 | restSubId = xappConn1.SendRESTSubsReq(t, params) |
| 6691 | xapp.Logger.Debug("Send REST subscribe request for subscriberId : %v", restSubId) |
| 6692 | |
| 6693 | crereq1, cremsg1 = e2termConn1.RecvSubsReq(t) |
| 6694 | mainCtrl.SetResetTestFlag(t, false) |
| 6695 | |
| 6696 | // SubsResp is missing due to submgr restart |
| 6697 | |
| 6698 | mainCtrl.SimulateRestart(t) |
| 6699 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 6700 | |
| 6701 | // Check subscription |
| 6702 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 6703 | |
| 6704 | xapp.Logger.Debug("Here 1") |
| 6705 | //<-time.After(3 * time.Second) |
| 6706 | xapp.Logger.Debug("Here 2") |
| 6707 | |
| 6708 | // Delete subscription |
| 6709 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6710 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6711 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6712 | |
| 6713 | //Wait that subs is cleaned |
| 6714 | waitSubsCleanup(t, e2SubsId, 10) |
| 6715 | |
| 6716 | mainCtrl.VerifyCounterValues(t) |
| 6717 | } |
| 6718 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6719 | //////////////////////////////////////////////////////////////////////////////////// |
| 6720 | // Services for UT cases |
| 6721 | //////////////////////////////////////////////////////////////////////////////////// |
| 6722 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6723 | const host string = "localhost" |
| 6724 | |
| 6725 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6726 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6727 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6728 | } |
| 6729 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6730 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6731 | |
| 6732 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 6733 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6734 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 6735 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6736 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6737 | |
| 6738 | return restSubId, e2SubsId |
| 6739 | } |
| 6740 | |
| 6741 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 6742 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6743 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6744 | if meid != "" { |
| 6745 | params.SetMeid(meid) |
| 6746 | } |
| 6747 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 6748 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 6749 | xappConn2.ExpectRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6750 | xapp.Logger.Debug("Send REST subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6751 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6752 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6753 | |
| 6754 | return restSubId, e2SubsId |
| 6755 | } |
| 6756 | |
| 6757 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6758 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6759 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6760 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6761 | xapp.Logger.Debug("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6762 | |
| 6763 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6764 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6765 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6766 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6767 | xapp.Logger.Debug("REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6768 | |
| 6769 | return restSubId, e2SubsId |
| 6770 | } |
| 6771 | |
| 6772 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6773 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6774 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6775 | |
| 6776 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6777 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 6778 | fparams1.Set(crereq1) |
| 6779 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 6780 | |
| 6781 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 6782 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6783 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 6784 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6785 | xapp.Logger.Debug("TEST: REST notification received e2SubsId=%v", e2SubsId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6786 | |
| 6787 | return restSubId, e2SubsId |
| 6788 | } |
| 6789 | |
| 6790 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 6791 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 6792 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6793 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6794 | } |
| 6795 | |
| 6796 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 6797 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 6798 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6799 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6800 | } |
| 6801 | |
| 6802 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 6803 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 6804 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6805 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6806 | } |
| 6807 | |
| 6808 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 6809 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6810 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 6811 | assert.Equal(t, resp[0].Meid, meid) |
| 6812 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 6813 | } |
| 6814 | |
| 6815 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 6816 | //Wait that subs is cleaned |
| 6817 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 6818 | |
| 6819 | xappConn1.TestMsgChanEmpty(t) |
| 6820 | xappConn2.TestMsgChanEmpty(t) |
| 6821 | e2termConn1.TestMsgChanEmpty(t) |
| 6822 | mainCtrl.wait_registry_empty(t, timeout) |
| 6823 | } |
| 6824 | |
| 6825 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 6826 | |
| 6827 | var e2SubsId []uint32 |
| 6828 | |
| 6829 | for i := 0; i < count; i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6830 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6831 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 6832 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6833 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 6834 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6835 | e2SubsId = append(e2SubsId, instanceId) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6836 | xapp.Logger.Debug("TEST: %v", e2SubsId) |
| 6837 | xapp.Logger.Debug("TEST: %d ===================================== END CRE ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6838 | <-time.After(100 * time.Millisecond) |
| 6839 | } |
| 6840 | return e2SubsId |
| 6841 | } |
| 6842 | |
| 6843 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 6844 | |
| 6845 | for i := 0; i < len(e2SubsIds); i++ { |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6846 | xapp.Logger.Debug("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6847 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6848 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6849 | <-time.After(1 * time.Second) |
Anssi Mannila | f682ace | 2021-09-28 13:11:25 +0300 | [diff] [blame] | 6850 | xapp.Logger.Debug("TEST: %d ===================================== END DEL ============================================", i+1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6851 | <-time.After(100 * time.Millisecond) |
| 6852 | } |
| 6853 | |
| 6854 | // Wait that subs is cleaned |
| 6855 | for i := 0; i < len(e2SubsIds); i++ { |
| 6856 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 6857 | } |
| 6858 | |
| 6859 | } |