Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 23 | "testing" |
| 24 | "time" |
| 25 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 26 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 30 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 31 | ) |
| 32 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 33 | func TestSuiteSetup(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 34 | // The effect of this call shall endure thgough the UT suite! |
| 35 | // If this causes any issues, the previout interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 36 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 37 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 38 | |
| 39 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | //----------------------------------------------------------------------------- |
| 43 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 44 | // |
| 45 | // stub stub stub |
| 46 | // +-------+ +---------+ +---------+ +---------+ |
| 47 | // | xapp | | submgr | | e2term | | rtmgr | |
| 48 | // +-------+ +---------+ +---------+ +---------+ |
| 49 | // | | | | |
| 50 | // | RESTSubReq | | | |
| 51 | // |---------------->| | | |
| 52 | // | | RouteCreate | | |
| 53 | // | |--------------------------->| // The order of these events may vary |
| 54 | // | | | | |
| 55 | // | RESTSubResp | | | // The order of these events may vary |
| 56 | // |<----------------| | | |
| 57 | // | | RouteResponse| | |
| 58 | // | |<---------------------------| // The order of these events may vary |
| 59 | // | | | | |
| 60 | // | | SubReq | | |
| 61 | // | |------------->| | // The order of these events may vary |
| 62 | // | | | | |
| 63 | // | | SubResp | | |
| 64 | // | |<-------------| | |
| 65 | // | RESTNotif1 | | | |
| 66 | // |<----------------| | | |
| 67 | // | | | | |
| 68 | // | RESTSubDelReq | | | |
| 69 | // |---------------->| | | |
| 70 | // | | SubDelReq | | |
| 71 | // | |------------->| | |
| 72 | // | | | | |
| 73 | // | RESTSubDelResp| | | |
| 74 | // |<----------------| | | |
| 75 | // | | | | |
| 76 | // | | SubDelResp | | |
| 77 | // | |<-------------| | |
| 78 | // | | | | |
| 79 | // | | | | |
| 80 | // |
| 81 | //----------------------------------------------------------------------------- |
| 82 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 83 | |
| 84 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 85 | |
| 86 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 87 | |
| 88 | waitSubsCleanup(t, e2SubsId, 10) |
| 89 | } |
| 90 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 91 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 92 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 93 | // |
| 94 | // stub stub stub |
| 95 | // +-------+ +---------+ +---------+ +---------+ |
| 96 | // | xapp | | submgr | | e2term | | rtmgr | |
| 97 | // +-------+ +---------+ +---------+ +---------+ |
| 98 | // | | | | |
| 99 | // | RESTSubReq | | | |
| 100 | // |---------------->| | | |
| 101 | // | | RouteCreate | | |
| 102 | // | |--------------------------->| // The order of these events may vary |
| 103 | // | | | | |
| 104 | // | RESTSubResp | | | // The order of these events may vary |
| 105 | // |<----------------| | | |
| 106 | // | | RouteResponse| | |
| 107 | // | |<---------------------------| // The order of these events may vary |
| 108 | // | | | | |
| 109 | // | | SubReq | | |
| 110 | // | |------------->| | // The order of these events may vary |
| 111 | // | | | | |
| 112 | // | | SubResp | | |
| 113 | // | |<-------------| | |
| 114 | // | RESTNotif1 | | | |
| 115 | // |<----------------| | | |
| 116 | // | | | | |
| 117 | // | RESTSubDelReq | | | |
| 118 | // |---------------->| | | |
| 119 | // | | | | |
| 120 | // | RESTSubDelResp| | | |
| 121 | // |<----------------| | | |
| 122 | // | | | | |
| 123 | // | | | | |
| 124 | // |
| 125 | //----------------------------------------------------------------------------- |
| 126 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 127 | |
| 128 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 129 | |
| 130 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 131 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 132 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 133 | |
| 134 | waitSubsCleanup(t, e2SubsId, 10) |
| 135 | } |
| 136 | |
| 137 | //----------------------------------------------------------------------------- |
| 138 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 139 | // |
| 140 | // stub stub stub |
| 141 | // +-------+ +---------+ +---------+ +---------+ |
| 142 | // | xapp | | submgr | | e2term | | rtmgr | |
| 143 | // +-------+ +---------+ +---------+ +---------+ |
| 144 | // | | | | |
| 145 | // | RESTSubReq | | | |
| 146 | // |---------------->| | | |
| 147 | // | | RouteCreate | | |
| 148 | // | |--------------------------->| // The order of these events may vary |
| 149 | // | | | | |
| 150 | // | RESTSubResp | | | // The order of these events may vary |
| 151 | // |<----------------| | | |
| 152 | // | | RouteResponse| | |
| 153 | // | |<---------------------------| // The order of these events may vary |
| 154 | // | | | | |
| 155 | // | | SubReq | | |
| 156 | // | |------------->| | // The order of these events may vary |
| 157 | // | | | | |
| 158 | // | | SubResp | | |
| 159 | // | |<-------------| | |
| 160 | // | RESTNotif1 | | | |
| 161 | // |<----------------| | | |
| 162 | // | | | | |
| 163 | // | RESTSubDelReq | | | |
| 164 | // |---------------->| | | |
| 165 | // | | SubDelReq | | |
| 166 | // | |------------->| | |
| 167 | // | | | | |
| 168 | // | RESTSubDelResp| | | |
| 169 | // |<----------------| | | // The order of these events may vary |
| 170 | // | | | | |
| 171 | // | | SubDelResp | | |
| 172 | // | |<-------------| | // 1.st NOK |
| 173 | // | | | | |
| 174 | // | | SubDelReq | | |
| 175 | // | |------------->| | |
| 176 | // | | | | |
| 177 | // | | SubDelResp | | |
| 178 | // | |<-------------| | // 2.nd NOK |
| 179 | // |
| 180 | //----------------------------------------------------------------------------- |
| 181 | |
| 182 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 183 | |
| 184 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 185 | |
| 186 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 187 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 188 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 189 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 190 | |
| 191 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 192 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 193 | |
| 194 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 195 | |
| 196 | waitSubsCleanup(t, e2SubsId, 10) |
| 197 | } |
| 198 | |
| 199 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 200 | // TestSubReqAndRouteNok |
| 201 | // |
| 202 | // stub stub |
| 203 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 204 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 205 | // +-------+ +---------+ +---------+ |
| 206 | // | | | |
| 207 | // | SubReq | | |
| 208 | // |------------->| | |
| 209 | // | | | |
| 210 | // | | RouteCreate | |
| 211 | // | |------------->| |
| 212 | // | | | |
| 213 | // | | RouteCreate | |
| 214 | // | | status:400 | |
| 215 | // | |<-------------| |
| 216 | // | | | |
| 217 | // | [SUBS INT DELETE] | |
| 218 | // | | | |
| 219 | // |
| 220 | //----------------------------------------------------------------------------- |
| 221 | |
| 222 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 223 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 224 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 225 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 226 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 227 | Counter{cSubReqFromXapp, 1}, |
| 228 | Counter{cRouteCreateFail, 1}, |
| 229 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 230 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 231 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 232 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 233 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 234 | waiter.WaitResult(t) |
| 235 | |
| 236 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 237 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 238 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 239 | xappConn1.TestMsgChanEmpty(t) |
| 240 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 241 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 242 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 243 | |
| 244 | <-time.After(1 * time.Second) |
| 245 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 249 | // TestSubReqAndRouteUpdateNok |
| 250 | |
| 251 | // stub stub |
| 252 | // +-------+ +-------+ +---------+ +---------+ |
| 253 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 254 | // +-------+ +-------+ +---------+ +---------+ |
| 255 | // | | | | |
| 256 | // | [SUBS CREATE] | | |
| 257 | // | | | | |
| 258 | // | | | | |
| 259 | // | | | | |
| 260 | // | SubReq (mergeable) | | |
| 261 | // |--------------------------->| | | |
| 262 | // | | | | |
| 263 | // | | | RouteUpdate | |
| 264 | // | | |------------->| |
| 265 | // | | | | |
| 266 | // | | | RouteUpdate | |
| 267 | // | | | status:400 | |
| 268 | // | | |<-------------| |
| 269 | // | | | | |
| 270 | // | [SUBS INT DELETE] | | |
| 271 | // | | | | |
| 272 | // | | | | |
| 273 | // | [SUBS DELETE] | | |
| 274 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 275 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 276 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 277 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 278 | |
| 279 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 280 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 281 | Counter{cSubReqFromXapp, 2}, |
| 282 | Counter{cSubReqToE2, 1}, |
| 283 | Counter{cSubRespFromE2, 1}, |
| 284 | Counter{cSubRespToXapp, 1}, |
| 285 | Counter{cRouteCreateUpdateFail, 1}, |
| 286 | Counter{cSubDelReqFromXapp, 1}, |
| 287 | Counter{cSubDelReqToE2, 1}, |
| 288 | Counter{cSubDelRespFromE2, 1}, |
| 289 | Counter{cSubDelRespToXapp, 1}, |
| 290 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 291 | |
| 292 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 293 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 294 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 295 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 296 | |
| 297 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 298 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 299 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 300 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 301 | |
| 302 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 303 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 304 | xappConn2.SendSubsReq(t, nil, nil) |
| 305 | waiter.WaitResult(t) |
| 306 | |
| 307 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 308 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 309 | |
| 310 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 311 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 312 | |
| 313 | //Wait that subs is cleaned |
| 314 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 315 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 316 | |
| 317 | xappConn1.TestMsgChanEmpty(t) |
| 318 | xappConn2.TestMsgChanEmpty(t) |
| 319 | e2termConn1.TestMsgChanEmpty(t) |
| 320 | mainCtrl.wait_registry_empty(t, 10) |
| 321 | |
| 322 | mainCtrl.VerifyCounterValues(t) |
| 323 | } |
| 324 | |
| 325 | //----------------------------------------------------------------------------- |
| 326 | // TestSubDelReqAndRouteDeleteNok |
| 327 | // |
| 328 | // stub stub |
| 329 | // +-------+ +---------+ +---------+ +---------+ |
| 330 | // | xapp | | submgr | | e2term | | rtmgr | |
| 331 | // +-------+ +---------+ +---------+ +---------+ |
| 332 | // | | | | |
| 333 | // | [SUBS CREATE] | | |
| 334 | // | | | | |
| 335 | // | | | | |
| 336 | // | | | | |
| 337 | // | SubDelReq | | | |
| 338 | // |------------->| | | |
| 339 | // | | SubDelReq | | |
| 340 | // | |------------->| | |
| 341 | // | | SubDelRsp | | |
| 342 | // | |<-------------| | |
| 343 | // | SubDelRsp | | | |
| 344 | // |<-------------| | | |
| 345 | // | | RouteDelete | | |
| 346 | // | |---------------------------->| |
| 347 | // | | | | |
| 348 | // | | RouteDelete | | |
| 349 | // | | status:400 | | |
| 350 | // | |<----------------------------| |
| 351 | // | | | | |
| 352 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 353 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 354 | |
| 355 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 356 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 357 | Counter{cSubReqFromXapp, 1}, |
| 358 | Counter{cSubReqToE2, 1}, |
| 359 | Counter{cSubRespFromE2, 1}, |
| 360 | Counter{cSubRespToXapp, 1}, |
| 361 | Counter{cSubDelReqFromXapp, 1}, |
| 362 | Counter{cRouteDeleteFail, 1}, |
| 363 | Counter{cSubDelReqToE2, 1}, |
| 364 | Counter{cSubDelRespFromE2, 1}, |
| 365 | Counter{cSubDelRespToXapp, 1}, |
| 366 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 367 | |
| 368 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 369 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 370 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 371 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 372 | |
| 373 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 374 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 375 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 376 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 377 | |
| 378 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 379 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 380 | |
| 381 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 382 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 383 | waiter.WaitResult(t) |
| 384 | |
| 385 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 386 | |
| 387 | //Wait that subs is cleaned |
| 388 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 389 | |
| 390 | xappConn1.TestMsgChanEmpty(t) |
| 391 | xappConn2.TestMsgChanEmpty(t) |
| 392 | e2termConn1.TestMsgChanEmpty(t) |
| 393 | mainCtrl.wait_registry_empty(t, 10) |
| 394 | |
| 395 | mainCtrl.VerifyCounterValues(t) |
| 396 | } |
| 397 | |
| 398 | //----------------------------------------------------------------------------- |
| 399 | // TestSubMergeDelAndRouteUpdateNok |
| 400 | // stub stub |
| 401 | // +-------+ +-------+ +---------+ +---------+ |
| 402 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 403 | // +-------+ +-------+ +---------+ +---------+ |
| 404 | // | | | | |
| 405 | // | | | | |
| 406 | // | | | | |
| 407 | // | | SubReq1 | | |
| 408 | // | |------------->| | |
| 409 | // | | | | |
| 410 | // | | | SubReq1 | |
| 411 | // | | |------------->| |
| 412 | // | | | SubResp1 | |
| 413 | // | | |<-------------| |
| 414 | // | | SubResp1 | | |
| 415 | // | |<-------------| | |
| 416 | // | | | | |
| 417 | // | SubReq2 | | |
| 418 | // |--------------------------->| | |
| 419 | // | | | | |
| 420 | // | SubResp2 | | |
| 421 | // |<---------------------------| | |
| 422 | // | | | | |
| 423 | // | | SubDelReq 1 | | |
| 424 | // | |------------->| | |
| 425 | // | | | RouteUpdate | |
| 426 | // | | |-----> rtmgr | |
| 427 | // | | | | |
| 428 | // | | | RouteUpdate | |
| 429 | // | | | status:400 | |
| 430 | // | | |<----- rtmgr | |
| 431 | // | | | | |
| 432 | // | | SubDelResp 1 | | |
| 433 | // | |<-------------| | |
| 434 | // | | | | |
| 435 | // | SubDelReq 2 | | |
| 436 | // |--------------------------->| | |
| 437 | // | | | | |
| 438 | // | | | SubDelReq 2 | |
| 439 | // | | |------------->| |
| 440 | // | | | | |
| 441 | // | | | SubDelReq 2 | |
| 442 | // | | |------------->| |
| 443 | // | | | | |
| 444 | // | SubDelResp 2 | | |
| 445 | // |<---------------------------| | |
| 446 | // |
| 447 | //----------------------------------------------------------------------------- |
| 448 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 449 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 450 | |
| 451 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 452 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 453 | Counter{cSubReqFromXapp, 2}, |
| 454 | Counter{cSubReqToE2, 1}, |
| 455 | Counter{cSubRespFromE2, 1}, |
| 456 | Counter{cSubRespToXapp, 2}, |
| 457 | Counter{cSubDelReqFromXapp, 2}, |
| 458 | Counter{cRouteDeleteUpdateFail, 1}, |
| 459 | Counter{cSubDelReqToE2, 1}, |
| 460 | Counter{cSubDelRespFromE2, 1}, |
| 461 | Counter{cSubDelRespToXapp, 2}, |
| 462 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 463 | |
| 464 | //Req1 |
| 465 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 466 | rparams1.Init() |
| 467 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 468 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 469 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 470 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 471 | |
| 472 | //Req2 |
| 473 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 474 | rparams2.Init() |
| 475 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 476 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 477 | |
| 478 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 479 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 480 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 481 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 482 | |
| 483 | //Del1 |
| 484 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 485 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 486 | waiter.WaitResult(t) |
| 487 | |
| 488 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 489 | |
| 490 | //Del2 |
| 491 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 492 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 493 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 494 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 495 | //Wait that subs is cleaned |
| 496 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 497 | |
| 498 | xappConn1.TestMsgChanEmpty(t) |
| 499 | xappConn2.TestMsgChanEmpty(t) |
| 500 | e2termConn1.TestMsgChanEmpty(t) |
| 501 | mainCtrl.wait_registry_empty(t, 10) |
| 502 | |
| 503 | mainCtrl.VerifyCounterValues(t) |
| 504 | } |
| 505 | |
| 506 | //----------------------------------------------------------------------------- |
| 507 | |
| 508 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 509 | // TestSubReqAndSubDelOk |
| 510 | // |
| 511 | // stub stub |
| 512 | // +-------+ +---------+ +---------+ |
| 513 | // | xapp | | submgr | | e2term | |
| 514 | // +-------+ +---------+ +---------+ |
| 515 | // | | | |
| 516 | // | SubReq | | |
| 517 | // |------------->| | |
| 518 | // | | | |
| 519 | // | | SubReq | |
| 520 | // | |------------->| |
| 521 | // | | | |
| 522 | // | | SubResp | |
| 523 | // | |<-------------| |
| 524 | // | | | |
| 525 | // | SubResp | | |
| 526 | // |<-------------| | |
| 527 | // | | | |
| 528 | // | | | |
| 529 | // | SubDelReq | | |
| 530 | // |------------->| | |
| 531 | // | | | |
| 532 | // | | SubDelReq | |
| 533 | // | |------------->| |
| 534 | // | | | |
| 535 | // | | SubDelResp | |
| 536 | // | |<-------------| |
| 537 | // | | | |
| 538 | // | SubDelResp | | |
| 539 | // |<-------------| | |
| 540 | // |
| 541 | //----------------------------------------------------------------------------- |
| 542 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 543 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 544 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 545 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 546 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 547 | Counter{cSubReqFromXapp, 1}, |
| 548 | Counter{cSubReqToE2, 1}, |
| 549 | Counter{cSubRespFromE2, 1}, |
| 550 | Counter{cSubRespToXapp, 1}, |
| 551 | Counter{cSubDelReqFromXapp, 1}, |
| 552 | Counter{cSubDelReqToE2, 1}, |
| 553 | Counter{cSubDelRespFromE2, 1}, |
| 554 | Counter{cSubDelRespToXapp, 1}, |
| 555 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 556 | |
| 557 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 558 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 559 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 560 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 561 | |
| 562 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 563 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 564 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 565 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 566 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 567 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 568 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 569 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 570 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 571 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 572 | |
| 573 | //Wait that subs is cleaned |
| 574 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 575 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 576 | xappConn1.TestMsgChanEmpty(t) |
| 577 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 578 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 579 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 580 | |
| 581 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | //----------------------------------------------------------------------------- |
| 585 | // TestSubReqRetransmission |
| 586 | // |
| 587 | // stub stub |
| 588 | // +-------+ +---------+ +---------+ |
| 589 | // | xapp | | submgr | | e2term | |
| 590 | // +-------+ +---------+ +---------+ |
| 591 | // | | | |
| 592 | // | SubReq | | |
| 593 | // |------------->| | |
| 594 | // | | | |
| 595 | // | | SubReq | |
| 596 | // | |------------->| |
| 597 | // | | | |
| 598 | // | SubReq | | |
| 599 | // | (retrans) | | |
| 600 | // |------------->| | |
| 601 | // | | | |
| 602 | // | | SubResp | |
| 603 | // | |<-------------| |
| 604 | // | | | |
| 605 | // | SubResp | | |
| 606 | // |<-------------| | |
| 607 | // | | | |
| 608 | // | [SUBS DELETE] | |
| 609 | // | | | |
| 610 | // |
| 611 | //----------------------------------------------------------------------------- |
| 612 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 613 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 614 | |
| 615 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 616 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 617 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 618 | |
| 619 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 620 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 621 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 622 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 623 | // hack as there is no real way to see has message be handled. |
| 624 | // Previuos counter check just tells that is has been received by submgr |
| 625 | // --> artificial delay |
| 626 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 627 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 628 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 629 | |
| 630 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 631 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 632 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 633 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 634 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 635 | |
| 636 | //Wait that subs is cleaned |
| 637 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 638 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 639 | xappConn1.TestMsgChanEmpty(t) |
| 640 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 641 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 642 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 643 | } |
| 644 | |
| 645 | //----------------------------------------------------------------------------- |
| 646 | // TestSubDelReqRetransmission |
| 647 | // |
| 648 | // stub stub |
| 649 | // +-------+ +---------+ +---------+ |
| 650 | // | xapp | | submgr | | e2term | |
| 651 | // +-------+ +---------+ +---------+ |
| 652 | // | | | |
| 653 | // | [SUBS CREATE] | |
| 654 | // | | | |
| 655 | // | | | |
| 656 | // | SubDelReq | | |
| 657 | // |------------->| | |
| 658 | // | | | |
| 659 | // | | SubDelReq | |
| 660 | // | |------------->| |
| 661 | // | | | |
| 662 | // | SubDelReq | | |
| 663 | // | (same sub) | | |
| 664 | // | (same xid) | | |
| 665 | // |------------->| | |
| 666 | // | | | |
| 667 | // | | SubDelResp | |
| 668 | // | |<-------------| |
| 669 | // | | | |
| 670 | // | SubDelResp | | |
| 671 | // |<-------------| | |
| 672 | // |
| 673 | //----------------------------------------------------------------------------- |
| 674 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 675 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 676 | |
| 677 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 678 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 679 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 680 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 681 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 682 | |
| 683 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 684 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 685 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 686 | |
| 687 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 688 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 689 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 690 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 691 | // hack as there is no real way to see has message be handled. |
| 692 | // Previuos counter check just tells that is has been received by submgr |
| 693 | // --> artificial delay |
| 694 | <-time.After(1 * time.Second) |
| 695 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 696 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 697 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 698 | |
| 699 | //Wait that subs is cleaned |
| 700 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 701 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 702 | xappConn1.TestMsgChanEmpty(t) |
| 703 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 704 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 705 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 706 | } |
| 707 | |
| 708 | //----------------------------------------------------------------------------- |
| 709 | // TestSubDelReqCollision |
| 710 | // |
| 711 | // stub stub |
| 712 | // +-------+ +---------+ +---------+ |
| 713 | // | xapp | | submgr | | e2term | |
| 714 | // +-------+ +---------+ +---------+ |
| 715 | // | | | |
| 716 | // | [SUBS CREATE] | |
| 717 | // | | | |
| 718 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 719 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 720 | // |------------->| | |
| 721 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 722 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 723 | // | |------------->| |
| 724 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 725 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 726 | // | (same sub) | | |
| 727 | // | (diff xid) | | |
| 728 | // |------------->| | |
| 729 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 730 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 731 | // | |<-------------| |
| 732 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 733 | // | SubDelResp 1 | | |
| 734 | // |<-------------| | |
| 735 | // | | | |
| 736 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 737 | // |<-------------| | |
| 738 | // |
| 739 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 740 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 741 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 742 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 743 | |
| 744 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 745 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 746 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 747 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 748 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 749 | |
| 750 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 751 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 752 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 753 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 754 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 755 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 756 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 757 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 758 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 759 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 760 | // hack as there is no real way to see has message be handled. |
| 761 | // Previuos counter check just tells that is has been received by submgr |
| 762 | // --> artificial delay |
| 763 | <-time.After(1 * time.Second) |
| 764 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 765 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 766 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 767 | |
| 768 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 769 | xappConn1.RecvSubsDelResp(t, nil) |
| 770 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 771 | |
| 772 | //Wait that subs is cleaned |
| 773 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 774 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 775 | xappConn1.TestMsgChanEmpty(t) |
| 776 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 777 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 778 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | //----------------------------------------------------------------------------- |
| 782 | // TestSubReqAndSubDelOkTwoParallel |
| 783 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 784 | // stub stub stub |
| 785 | // +-------+ +-------+ +---------+ +---------+ |
| 786 | // | xapp | | xapp | | submgr | | e2term | |
| 787 | // +-------+ +-------+ +---------+ +---------+ |
| 788 | // | | | | |
| 789 | // | | | | |
| 790 | // | | | | |
| 791 | // | | SubReq1 | | |
| 792 | // | |------------->| | |
| 793 | // | | | | |
| 794 | // | | | SubReq1 | |
| 795 | // | | |------------->| |
| 796 | // | | | | |
| 797 | // | SubReq2 | | |
| 798 | // |------------------------>| | |
| 799 | // | | | | |
| 800 | // | | | SubReq2 | |
| 801 | // | | |------------->| |
| 802 | // | | | | |
| 803 | // | | | SubResp1 | |
| 804 | // | | |<-------------| |
| 805 | // | | SubResp1 | | |
| 806 | // | |<-------------| | |
| 807 | // | | | | |
| 808 | // | | | SubResp2 | |
| 809 | // | | |<-------------| |
| 810 | // | SubResp2 | | |
| 811 | // |<------------------------| | |
| 812 | // | | | | |
| 813 | // | | [SUBS 1 DELETE] | |
| 814 | // | | | | |
| 815 | // | | [SUBS 2 DELETE] | |
| 816 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 817 | // |
| 818 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 819 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 820 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 821 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 822 | |
| 823 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 824 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 825 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 826 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 827 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 828 | |
| 829 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 830 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 831 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 832 | |
| 833 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 834 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 835 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 836 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 837 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 838 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 839 | |
| 840 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 841 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 842 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 843 | |
| 844 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 845 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 847 | |
| 848 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 849 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 850 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 851 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 852 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 853 | //Wait that subs is cleaned |
| 854 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 855 | |
| 856 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 857 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 858 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 859 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 860 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 861 | //Wait that subs is cleaned |
| 862 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 863 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 864 | xappConn1.TestMsgChanEmpty(t) |
| 865 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 866 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 867 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | //----------------------------------------------------------------------------- |
| 871 | // TestSameSubsDiffRan |
| 872 | // Same subscription to different RANs |
| 873 | // |
| 874 | // stub stub |
| 875 | // +-------+ +---------+ +---------+ |
| 876 | // | xapp | | submgr | | e2term | |
| 877 | // +-------+ +---------+ +---------+ |
| 878 | // | | | |
| 879 | // | | | |
| 880 | // | | | |
| 881 | // | SubReq(r1) | | |
| 882 | // |------------->| | |
| 883 | // | | | |
| 884 | // | | SubReq(r1) | |
| 885 | // | |------------->| |
| 886 | // | | | |
| 887 | // | | SubResp(r1) | |
| 888 | // | |<-------------| |
| 889 | // | | | |
| 890 | // | SubResp(r1) | | |
| 891 | // |<-------------| | |
| 892 | // | | | |
| 893 | // | SubReq(r2) | | |
| 894 | // |------------->| | |
| 895 | // | | | |
| 896 | // | | SubReq(r2) | |
| 897 | // | |------------->| |
| 898 | // | | | |
| 899 | // | | SubResp(r2) | |
| 900 | // | |<-------------| |
| 901 | // | | | |
| 902 | // | SubResp(r2) | | |
| 903 | // |<-------------| | |
| 904 | // | | | |
| 905 | // | [SUBS r1 DELETE] | |
| 906 | // | | | |
| 907 | // | [SUBS r2 DELETE] | |
| 908 | // | | | |
| 909 | // |
| 910 | //----------------------------------------------------------------------------- |
| 911 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 912 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 913 | |
| 914 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 915 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 916 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 917 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 918 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | |
| 921 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 922 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 923 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 924 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 925 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 926 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 927 | |
| 928 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 929 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 930 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 931 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 932 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 933 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 934 | //Wait that subs is cleaned |
| 935 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 936 | |
| 937 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 938 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 939 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 940 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 941 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 942 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 943 | //Wait that subs is cleaned |
| 944 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 945 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 946 | xappConn1.TestMsgChanEmpty(t) |
| 947 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 948 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 949 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 950 | } |
| 951 | |
| 952 | //----------------------------------------------------------------------------- |
| 953 | // TestSubReqRetryInSubmgr |
| 954 | // |
| 955 | // stub stub |
| 956 | // +-------+ +---------+ +---------+ |
| 957 | // | xapp | | submgr | | e2term | |
| 958 | // +-------+ +---------+ +---------+ |
| 959 | // | | | |
| 960 | // | SubReq | | |
| 961 | // |------------->| | |
| 962 | // | | | |
| 963 | // | | SubReq | |
| 964 | // | |------------->| |
| 965 | // | | | |
| 966 | // | | | |
| 967 | // | | SubReq | |
| 968 | // | |------------->| |
| 969 | // | | | |
| 970 | // | | SubResp | |
| 971 | // | |<-------------| |
| 972 | // | | | |
| 973 | // | SubResp | | |
| 974 | // |<-------------| | |
| 975 | // | | | |
| 976 | // | [SUBS DELETE] | |
| 977 | // | | | |
| 978 | // |
| 979 | //----------------------------------------------------------------------------- |
| 980 | |
| 981 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 982 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 983 | |
| 984 | // Init counter check |
| 985 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 986 | Counter{cSubReqFromXapp, 1}, |
| 987 | Counter{cSubReqToE2, 1}, |
| 988 | Counter{cSubReReqToE2, 1}, |
| 989 | Counter{cSubRespFromE2, 1}, |
| 990 | Counter{cSubRespToXapp, 1}, |
| 991 | Counter{cSubDelReqFromXapp, 1}, |
| 992 | Counter{cSubDelReqToE2, 1}, |
| 993 | Counter{cSubDelRespFromE2, 1}, |
| 994 | Counter{cSubDelRespToXapp, 1}, |
| 995 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 996 | |
| 997 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 998 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 999 | |
| 1000 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1001 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1002 | |
| 1003 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1004 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1005 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | |
| 1007 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1008 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1009 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1010 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1011 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1012 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1013 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1014 | |
| 1015 | // Wait that subs is cleaned |
| 1016 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1017 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1018 | xappConn1.TestMsgChanEmpty(t) |
| 1019 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1020 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1021 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1022 | |
| 1023 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1024 | } |
| 1025 | |
| 1026 | //----------------------------------------------------------------------------- |
| 1027 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1028 | // |
| 1029 | // stub stub |
| 1030 | // +-------+ +---------+ +---------+ |
| 1031 | // | xapp | | submgr | | e2term | |
| 1032 | // +-------+ +---------+ +---------+ |
| 1033 | // | | | |
| 1034 | // | SubReq | | |
| 1035 | // |------------->| | |
| 1036 | // | | | |
| 1037 | // | | SubReq | |
| 1038 | // | |------------->| |
| 1039 | // | | | |
| 1040 | // | | | |
| 1041 | // | | SubReq | |
| 1042 | // | |------------->| |
| 1043 | // | | | |
| 1044 | // | | SubDelReq | |
| 1045 | // | |------------->| |
| 1046 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1047 | // | | SubDelResp | |
| 1048 | // | |<-------------| |
| 1049 | // | | | |
| 1050 | // |
| 1051 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1052 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1053 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1054 | |
| 1055 | // Init counter check |
| 1056 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1057 | Counter{cSubReqFromXapp, 1}, |
| 1058 | Counter{cSubReqToE2, 1}, |
| 1059 | Counter{cSubReReqToE2, 1}, |
| 1060 | Counter{cSubReqTimerExpiry, 2}, |
| 1061 | Counter{cSubDelReqToE2, 1}, |
| 1062 | Counter{cSubDelRespFromE2, 1}, |
| 1063 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1064 | |
| 1065 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1066 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1067 | |
| 1068 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1069 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1070 | |
| 1071 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1072 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1073 | |
| 1074 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1075 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1076 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1077 | |
| 1078 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1079 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1080 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1081 | xappConn1.TestMsgChanEmpty(t) |
| 1082 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1083 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1084 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1085 | |
| 1086 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1087 | } |
| 1088 | |
| 1089 | //----------------------------------------------------------------------------- |
| 1090 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1091 | // |
| 1092 | // stub stub |
| 1093 | // +-------+ +---------+ +---------+ |
| 1094 | // | xapp | | submgr | | e2term | |
| 1095 | // +-------+ +---------+ +---------+ |
| 1096 | // | | | |
| 1097 | // | SubReq | | |
| 1098 | // |------------->| | |
| 1099 | // | | | |
| 1100 | // | | SubReq | |
| 1101 | // | |------------->| |
| 1102 | // | | | |
| 1103 | // | | | |
| 1104 | // | | SubReq | |
| 1105 | // | |------------->| |
| 1106 | // | | | |
| 1107 | // | | SubDelReq | |
| 1108 | // | |------------->| |
| 1109 | // | | | |
| 1110 | // | | | |
| 1111 | // | | SubDelReq | |
| 1112 | // | |------------->| |
| 1113 | // | | | |
| 1114 | // | | | |
| 1115 | // |
| 1116 | //----------------------------------------------------------------------------- |
| 1117 | |
| 1118 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1119 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1120 | |
| 1121 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1122 | Counter{cSubReqFromXapp, 1}, |
| 1123 | Counter{cSubReqToE2, 1}, |
| 1124 | Counter{cSubReReqToE2, 1}, |
| 1125 | Counter{cSubReqTimerExpiry, 2}, |
| 1126 | Counter{cSubDelReqToE2, 1}, |
| 1127 | Counter{cSubDelReReqToE2, 1}, |
| 1128 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1129 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1130 | |
| 1131 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1132 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1133 | |
| 1134 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1135 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1136 | |
| 1137 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1138 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1139 | |
| 1140 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1141 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1142 | |
| 1143 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1144 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1145 | |
| 1146 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1147 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1148 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | xappConn1.TestMsgChanEmpty(t) |
| 1150 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1151 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1152 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1153 | |
| 1154 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1155 | } |
| 1156 | |
| 1157 | //----------------------------------------------------------------------------- |
| 1158 | // TestSubReqSubFailRespInSubmgr |
| 1159 | // |
| 1160 | // stub stub |
| 1161 | // +-------+ +---------+ +---------+ |
| 1162 | // | xapp | | submgr | | e2term | |
| 1163 | // +-------+ +---------+ +---------+ |
| 1164 | // | | | |
| 1165 | // | SubReq | | |
| 1166 | // |------------->| | |
| 1167 | // | | | |
| 1168 | // | | SubReq | |
| 1169 | // | |------------->| |
| 1170 | // | | | |
| 1171 | // | | SubFail | |
| 1172 | // | |<-------------| |
| 1173 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1174 | // | | SubDelReq | |
| 1175 | // | |------------->| |
| 1176 | // | | | |
| 1177 | // | | SubDelResp | |
| 1178 | // | |<-------------| |
| 1179 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1180 | // | SubFail | | |
| 1181 | // |<-------------| | |
| 1182 | // | | | |
| 1183 | // |
| 1184 | //----------------------------------------------------------------------------- |
| 1185 | |
| 1186 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1187 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1188 | |
| 1189 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1190 | Counter{cSubReqFromXapp, 1}, |
| 1191 | Counter{cSubReqToE2, 1}, |
| 1192 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1193 | Counter{cSubFailToXapp, 1}, |
| 1194 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1195 | |
| 1196 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1197 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1198 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1199 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1200 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1201 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1202 | fparams1.Set(crereq1) |
| 1203 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1204 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1205 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1206 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1207 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1208 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1209 | // Xapp: Receive SubsFail |
| 1210 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1211 | |
| 1212 | // Wait that subs is cleaned |
| 1213 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1214 | |
| 1215 | xappConn1.TestMsgChanEmpty(t) |
| 1216 | xappConn2.TestMsgChanEmpty(t) |
| 1217 | e2termConn1.TestMsgChanEmpty(t) |
| 1218 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1219 | |
| 1220 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1221 | } |
| 1222 | |
| 1223 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1224 | // TestSubDelReqRetryInSubmgr |
| 1225 | // |
| 1226 | // stub stub |
| 1227 | // +-------+ +---------+ +---------+ |
| 1228 | // | xapp | | submgr | | e2term | |
| 1229 | // +-------+ +---------+ +---------+ |
| 1230 | // | | | |
| 1231 | // | [SUBS CREATE] | |
| 1232 | // | | | |
| 1233 | // | | | |
| 1234 | // | SubDelReq | | |
| 1235 | // |------------->| | |
| 1236 | // | | | |
| 1237 | // | | SubDelReq | |
| 1238 | // | |------------->| |
| 1239 | // | | | |
| 1240 | // | | SubDelReq | |
| 1241 | // | |------------->| |
| 1242 | // | | | |
| 1243 | // | | SubDelResp | |
| 1244 | // | |<-------------| |
| 1245 | // | | | |
| 1246 | // | SubDelResp | | |
| 1247 | // |<-------------| | |
| 1248 | // |
| 1249 | //----------------------------------------------------------------------------- |
| 1250 | |
| 1251 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1252 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1253 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1254 | |
| 1255 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1256 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1257 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1258 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1259 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1260 | |
| 1261 | // Subs Delete |
| 1262 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1263 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1264 | |
| 1265 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1266 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1267 | |
| 1268 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1269 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1270 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1271 | |
| 1272 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1273 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1274 | |
| 1275 | // Wait that subs is cleaned |
| 1276 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1277 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1278 | xappConn1.TestMsgChanEmpty(t) |
| 1279 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1280 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1281 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1282 | } |
| 1283 | |
| 1284 | //----------------------------------------------------------------------------- |
| 1285 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1286 | // |
| 1287 | // stub stub |
| 1288 | // +-------+ +---------+ +---------+ |
| 1289 | // | xapp | | submgr | | e2term | |
| 1290 | // +-------+ +---------+ +---------+ |
| 1291 | // | | | |
| 1292 | // | [SUBS CREATE] | |
| 1293 | // | | | |
| 1294 | // | | | |
| 1295 | // | SubDelReq | | |
| 1296 | // |------------->| | |
| 1297 | // | | | |
| 1298 | // | | SubDelReq | |
| 1299 | // | |------------->| |
| 1300 | // | | | |
| 1301 | // | | SubDelReq | |
| 1302 | // | |------------->| |
| 1303 | // | | | |
| 1304 | // | | | |
| 1305 | // | SubDelResp | | |
| 1306 | // |<-------------| | |
| 1307 | // |
| 1308 | //----------------------------------------------------------------------------- |
| 1309 | |
| 1310 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1311 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1312 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1313 | |
| 1314 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1315 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1316 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1317 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1318 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1319 | |
| 1320 | // Subs Delete |
| 1321 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1322 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1323 | |
| 1324 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1325 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1326 | |
| 1327 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1328 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1329 | |
| 1330 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1331 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1332 | |
| 1333 | // Wait that subs is cleaned |
| 1334 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1335 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1336 | xappConn1.TestMsgChanEmpty(t) |
| 1337 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1338 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1339 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1340 | } |
| 1341 | |
| 1342 | //----------------------------------------------------------------------------- |
| 1343 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1344 | // |
| 1345 | // stub stub |
| 1346 | // +-------+ +---------+ +---------+ |
| 1347 | // | xapp | | submgr | | e2term | |
| 1348 | // +-------+ +---------+ +---------+ |
| 1349 | // | | | |
| 1350 | // | [SUBS CREATE] | |
| 1351 | // | | | |
| 1352 | // | | | |
| 1353 | // | SubDelReq | | |
| 1354 | // |------------->| | |
| 1355 | // | | | |
| 1356 | // | | SubDelReq | |
| 1357 | // | |------------->| |
| 1358 | // | | | |
| 1359 | // | | SubDelFail | |
| 1360 | // | |<-------------| |
| 1361 | // | | | |
| 1362 | // | SubDelResp | | |
| 1363 | // |<-------------| | |
| 1364 | // | | | |
| 1365 | // |
| 1366 | //----------------------------------------------------------------------------- |
| 1367 | |
| 1368 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1369 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1370 | |
| 1371 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1372 | Counter{cSubReqFromXapp, 1}, |
| 1373 | Counter{cSubReqToE2, 1}, |
| 1374 | Counter{cSubRespFromE2, 1}, |
| 1375 | Counter{cSubRespToXapp, 1}, |
| 1376 | Counter{cSubDelReqFromXapp, 1}, |
| 1377 | Counter{cSubDelReqToE2, 1}, |
| 1378 | Counter{cSubDelFailFromE2, 1}, |
| 1379 | Counter{cSubDelRespToXapp, 1}, |
| 1380 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1381 | |
| 1382 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1383 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1384 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1385 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1386 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1387 | |
| 1388 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1389 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1390 | |
| 1391 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1392 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1393 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1394 | |
| 1395 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1396 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1397 | |
| 1398 | // Wait that subs is cleaned |
| 1399 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1400 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1401 | xappConn1.TestMsgChanEmpty(t) |
| 1402 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1403 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1404 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1405 | |
| 1406 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1407 | } |
| 1408 | |
| 1409 | //----------------------------------------------------------------------------- |
| 1410 | // TestSubReqAndSubDelOkSameAction |
| 1411 | // |
| 1412 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1413 | // +-------+ +-------+ +---------+ +---------+ |
| 1414 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1415 | // +-------+ +-------+ +---------+ +---------+ |
| 1416 | // | | | | |
| 1417 | // | | | | |
| 1418 | // | | | | |
| 1419 | // | | SubReq1 | | |
| 1420 | // | |------------->| | |
| 1421 | // | | | | |
| 1422 | // | | | SubReq1 | |
| 1423 | // | | |------------->| |
| 1424 | // | | | SubResp1 | |
| 1425 | // | | |<-------------| |
| 1426 | // | | SubResp1 | | |
| 1427 | // | |<-------------| | |
| 1428 | // | | | | |
| 1429 | // | SubReq2 | | |
| 1430 | // |--------------------------->| | |
| 1431 | // | | | | |
| 1432 | // | SubResp2 | | |
| 1433 | // |<---------------------------| | |
| 1434 | // | | | | |
| 1435 | // | | SubDelReq 1 | | |
| 1436 | // | |------------->| | |
| 1437 | // | | | | |
| 1438 | // | | SubDelResp 1 | | |
| 1439 | // | |<-------------| | |
| 1440 | // | | | | |
| 1441 | // | SubDelReq 2 | | |
| 1442 | // |--------------------------->| | |
| 1443 | // | | | | |
| 1444 | // | | | SubDelReq 2 | |
| 1445 | // | | |------------->| |
| 1446 | // | | | | |
| 1447 | // | | | SubDelReq 2 | |
| 1448 | // | | |------------->| |
| 1449 | // | | | | |
| 1450 | // | SubDelResp 2 | | |
| 1451 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1452 | // |
| 1453 | //----------------------------------------------------------------------------- |
| 1454 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1455 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1456 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1457 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1458 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1459 | Counter{cSubReqFromXapp, 2}, |
| 1460 | Counter{cSubReqToE2, 1}, |
| 1461 | Counter{cSubRespFromE2, 1}, |
| 1462 | Counter{cSubRespToXapp, 2}, |
| 1463 | Counter{cMergedSubscriptions, 1}, |
| 1464 | Counter{cUnmergedSubscriptions, 1}, |
| 1465 | Counter{cSubDelReqFromXapp, 2}, |
| 1466 | Counter{cSubDelReqToE2, 1}, |
| 1467 | Counter{cSubDelRespFromE2, 1}, |
| 1468 | Counter{cSubDelRespToXapp, 2}, |
| 1469 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1470 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1471 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1472 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1473 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1474 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1475 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1476 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1477 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1478 | |
| 1479 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1480 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1481 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1482 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1483 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1484 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1485 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1486 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1487 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1488 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1489 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1490 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1491 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1492 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1493 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1494 | //e2termConn1.RecvSubsDelReq(t) |
| 1495 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1496 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1497 | //Wait that subs is cleaned |
| 1498 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1499 | |
| 1500 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1501 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1502 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1503 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1504 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1505 | //Wait that subs is cleaned |
| 1506 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1507 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1508 | xappConn1.TestMsgChanEmpty(t) |
| 1509 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1510 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1511 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1512 | |
| 1513 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1514 | } |
| 1515 | |
| 1516 | //----------------------------------------------------------------------------- |
| 1517 | // TestSubReqAndSubDelOkSameActionParallel |
| 1518 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1519 | // stub stub stub |
| 1520 | // +-------+ +-------+ +---------+ +---------+ |
| 1521 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1522 | // +-------+ +-------+ +---------+ +---------+ |
| 1523 | // | | | | |
| 1524 | // | | | | |
| 1525 | // | | | | |
| 1526 | // | | SubReq1 | | |
| 1527 | // | |------------->| | |
| 1528 | // | | | | |
| 1529 | // | | | SubReq1 | |
| 1530 | // | | |------------->| |
| 1531 | // | SubReq2 | | |
| 1532 | // |--------------------------->| | |
| 1533 | // | | | SubResp1 | |
| 1534 | // | | |<-------------| |
| 1535 | // | | SubResp1 | | |
| 1536 | // | |<-------------| | |
| 1537 | // | | | | |
| 1538 | // | SubResp2 | | |
| 1539 | // |<---------------------------| | |
| 1540 | // | | | | |
| 1541 | // | | SubDelReq 1 | | |
| 1542 | // | |------------->| | |
| 1543 | // | | | | |
| 1544 | // | | SubDelResp 1 | | |
| 1545 | // | |<-------------| | |
| 1546 | // | | | | |
| 1547 | // | SubDelReq 2 | | |
| 1548 | // |--------------------------->| | |
| 1549 | // | | | | |
| 1550 | // | | | SubDelReq 2 | |
| 1551 | // | | |------------->| |
| 1552 | // | | | | |
| 1553 | // | | | SubDelReq 2 | |
| 1554 | // | | |------------->| |
| 1555 | // | | | | |
| 1556 | // | SubDelResp 2 | | |
| 1557 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1558 | // |
| 1559 | //----------------------------------------------------------------------------- |
| 1560 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1561 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1562 | |
| 1563 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1564 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1565 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1566 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1567 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1568 | |
| 1569 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1570 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1571 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1572 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1573 | |
| 1574 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1575 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1576 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1577 | |
| 1578 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1579 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1580 | |
| 1581 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1582 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1583 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1584 | |
| 1585 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1586 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1587 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1588 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1589 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1590 | |
| 1591 | //Wait that subs is cleaned |
| 1592 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1593 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1594 | xappConn1.TestMsgChanEmpty(t) |
| 1595 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1596 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1597 | mainCtrl.wait_registry_empty(t, 10) |
| 1598 | } |
| 1599 | |
| 1600 | //----------------------------------------------------------------------------- |
| 1601 | // TestSubReqAndSubDelNokSameActionParallel |
| 1602 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1603 | // stub stub stub |
| 1604 | // +-------+ +-------+ +---------+ +---------+ |
| 1605 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1606 | // +-------+ +-------+ +---------+ +---------+ |
| 1607 | // | | | | |
| 1608 | // | | | | |
| 1609 | // | | | | |
| 1610 | // | | SubReq1 | | |
| 1611 | // | |------------->| | |
| 1612 | // | | | | |
| 1613 | // | | | SubReq1 | |
| 1614 | // | | |------------->| |
| 1615 | // | SubReq2 | | |
| 1616 | // |--------------------------->| | |
| 1617 | // | | | SubFail1 | |
| 1618 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1619 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1620 | // | | | SubDelReq | |
| 1621 | // | | |------------->| |
| 1622 | // | | | SubDelResp | |
| 1623 | // | | |<-------------| |
| 1624 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1625 | // | | SubFail1 | | |
| 1626 | // | |<-------------| | |
| 1627 | // | | | | |
| 1628 | // | SubFail2 | | |
| 1629 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1630 | // |
| 1631 | //----------------------------------------------------------------------------- |
| 1632 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1633 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1634 | |
| 1635 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1636 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1637 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1638 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1639 | |
| 1640 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1641 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1642 | |
| 1643 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1644 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1645 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1646 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1647 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1648 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1649 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1650 | // E2t: send SubsFail (first) |
| 1651 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1652 | fparams1.Set(crereq1) |
| 1653 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1654 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1655 | // E2t: internal delete |
| 1656 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1657 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1658 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1659 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1660 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1661 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1662 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1663 | |
| 1664 | //Wait that subs is cleaned |
| 1665 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1666 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1667 | xappConn1.TestMsgChanEmpty(t) |
| 1668 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1669 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1670 | mainCtrl.wait_registry_empty(t, 10) |
| 1671 | } |
| 1672 | |
| 1673 | //----------------------------------------------------------------------------- |
| 1674 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1675 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1676 | // stub stub stub |
| 1677 | // +-------+ +-------+ +---------+ +---------+ |
| 1678 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1679 | // +-------+ +-------+ +---------+ +---------+ |
| 1680 | // | | | | |
| 1681 | // | | | | |
| 1682 | // | | | | |
| 1683 | // | | SubReq1 | | |
| 1684 | // | |------------->| | |
| 1685 | // | | | | |
| 1686 | // | | | SubReq1 | |
| 1687 | // | | |------------->| |
| 1688 | // | | SubReq2 | | |
| 1689 | // |--------------------------->| | |
| 1690 | // | | | | |
| 1691 | // | | | SubReq1 | |
| 1692 | // | | |------------->| |
| 1693 | // | | | | |
| 1694 | // | | | | |
| 1695 | // | | | SubDelReq | |
| 1696 | // | | |------------->| |
| 1697 | // | | | | |
| 1698 | // | | | SubDelResp | |
| 1699 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1700 | // |
| 1701 | //----------------------------------------------------------------------------- |
| 1702 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1703 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1704 | |
| 1705 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1706 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1707 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1708 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1709 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1710 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1711 | |
| 1712 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1713 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1714 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1715 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1716 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1717 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1718 | |
| 1719 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1720 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1721 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1722 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1723 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1724 | |
| 1725 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1726 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1727 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1728 | xappConn1.TestMsgChanEmpty(t) |
| 1729 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1730 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1731 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1732 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1733 | |
| 1734 | //----------------------------- Policy cases --------------------------------- |
| 1735 | //----------------------------------------------------------------------------- |
| 1736 | // TestSubReqPolicyAndSubDelOk |
| 1737 | // |
| 1738 | // stub stub |
| 1739 | // +-------+ +---------+ +---------+ |
| 1740 | // | xapp | | submgr | | e2term | |
| 1741 | // +-------+ +---------+ +---------+ |
| 1742 | // | | | |
| 1743 | // | SubReq | | |
| 1744 | // |------------->| | |
| 1745 | // | | | |
| 1746 | // | | SubReq | |
| 1747 | // | |------------->| |
| 1748 | // | | | |
| 1749 | // | | SubResp | |
| 1750 | // | |<-------------| |
| 1751 | // | | | |
| 1752 | // | SubResp | | |
| 1753 | // |<-------------| | |
| 1754 | // | | | |
| 1755 | // | | | |
| 1756 | // | SubDelReq | | |
| 1757 | // |------------->| | |
| 1758 | // | | | |
| 1759 | // | | SubDelReq | |
| 1760 | // | |------------->| |
| 1761 | // | | | |
| 1762 | // | | SubDelResp | |
| 1763 | // | |<-------------| |
| 1764 | // | | | |
| 1765 | // | SubDelResp | | |
| 1766 | // |<-------------| | |
| 1767 | // |
| 1768 | //----------------------------------------------------------------------------- |
| 1769 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1770 | CaseBegin("TestSubReqAndSubDelOk") |
| 1771 | |
| 1772 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1773 | rparams1.Init() |
| 1774 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1775 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1776 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1777 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1778 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1779 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1780 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1781 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1782 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1783 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1784 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1785 | |
| 1786 | //Wait that subs is cleaned |
| 1787 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1788 | |
| 1789 | xappConn1.TestMsgChanEmpty(t) |
| 1790 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1791 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1792 | mainCtrl.wait_registry_empty(t, 10) |
| 1793 | } |
| 1794 | |
| 1795 | //----------------------------------------------------------------------------- |
| 1796 | // TestSubReqPolicyChangeAndSubDelOk |
| 1797 | // |
| 1798 | // stub stub |
| 1799 | // +-------+ +---------+ +---------+ |
| 1800 | // | xapp | | submgr | | e2term | |
| 1801 | // +-------+ +---------+ +---------+ |
| 1802 | // | | | |
| 1803 | // | SubReq | | |
| 1804 | // |------------->| | |
| 1805 | // | | | |
| 1806 | // | | SubReq | |
| 1807 | // | |------------->| |
| 1808 | // | | | |
| 1809 | // | | SubResp | |
| 1810 | // | |<-------------| |
| 1811 | // | | | |
| 1812 | // | SubResp | | |
| 1813 | // |<-------------| | |
| 1814 | // | | | |
| 1815 | // | SubReq | | |
| 1816 | // |------------->| | |
| 1817 | // | | | |
| 1818 | // | | SubReq | |
| 1819 | // | |------------->| |
| 1820 | // | | | |
| 1821 | // | | SubResp | |
| 1822 | // | |<-------------| |
| 1823 | // | | | |
| 1824 | // | SubResp | | |
| 1825 | // |<-------------| | |
| 1826 | // | | | |
| 1827 | // | SubDelReq | | |
| 1828 | // |------------->| | |
| 1829 | // | | | |
| 1830 | // | | SubDelReq | |
| 1831 | // | |------------->| |
| 1832 | // | | | |
| 1833 | // | | SubDelResp | |
| 1834 | // | |<-------------| |
| 1835 | // | | | |
| 1836 | // | SubDelResp | | |
| 1837 | // |<-------------| | |
| 1838 | // |
| 1839 | //----------------------------------------------------------------------------- |
| 1840 | |
| 1841 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1842 | CaseBegin("TestSubReqAndSubDelOk") |
| 1843 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1844 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1845 | rparams1.Init() |
| 1846 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1847 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1848 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1849 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1850 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1851 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1852 | |
| 1853 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1854 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1855 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1856 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1857 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1858 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1859 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1860 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1861 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1862 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1863 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1864 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1865 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1866 | |
| 1867 | //Wait that subs is cleaned |
| 1868 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1869 | |
| 1870 | xappConn1.TestMsgChanEmpty(t) |
| 1871 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1872 | e2termConn1.TestMsgChanEmpty(t) |
| 1873 | mainCtrl.wait_registry_empty(t, 10) |
| 1874 | } |
| 1875 | |
| 1876 | //----------------------------------------------------------------------------- |
| 1877 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1878 | // |
| 1879 | // stub stub stub |
| 1880 | // +-------+ +---------+ +---------+ +---------+ |
| 1881 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1882 | // +-------+ +---------+ +---------+ +---------+ |
| 1883 | // | | | | |
| 1884 | // | | | | |
| 1885 | // | | | | |
| 1886 | // | SubReq1 | | | |
| 1887 | // |------------->| | | |
| 1888 | // | | | | |
| 1889 | // | | SubReq1 | | |
| 1890 | // | |------------->| | |
| 1891 | // | | | | |
| 1892 | // | SubReq2 | | | |
| 1893 | // |------------->| | | |
| 1894 | // | | | | |
| 1895 | // | | SubReq2 | | |
| 1896 | // | |---------------------------->| |
| 1897 | // | | | | |
| 1898 | // | | SubResp1 | | |
| 1899 | // | |<-------------| | |
| 1900 | // | SubResp1 | | | |
| 1901 | // |<-------------| | | |
| 1902 | // | | SubResp2 | | |
| 1903 | // | |<----------------------------| |
| 1904 | // | SubResp2 | | | |
| 1905 | // |<-------------| | | |
| 1906 | // | | | | |
| 1907 | // | [SUBS 1 DELETE] | | |
| 1908 | // | | | | |
| 1909 | // | [SUBS 2 DELETE] | | |
| 1910 | // | | | | |
| 1911 | // |
| 1912 | //----------------------------------------------------------------------------- |
| 1913 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1914 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1915 | |
| 1916 | //Req1 |
| 1917 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1918 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1919 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1920 | |
| 1921 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1922 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1923 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1924 | |
| 1925 | //Resp1 |
| 1926 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1927 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1928 | |
| 1929 | //Resp2 |
| 1930 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1931 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1932 | |
| 1933 | //Del1 |
| 1934 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1935 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1936 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1937 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1938 | //Wait that subs is cleaned |
| 1939 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1940 | |
| 1941 | //Del2 |
| 1942 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1943 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1944 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1945 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1946 | //Wait that subs is cleaned |
| 1947 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1948 | |
| 1949 | xappConn1.TestMsgChanEmpty(t) |
| 1950 | xappConn2.TestMsgChanEmpty(t) |
| 1951 | e2termConn1.TestMsgChanEmpty(t) |
| 1952 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1953 | mainCtrl.wait_registry_empty(t, 10) |
| 1954 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1955 | |
| 1956 | //----------------------------------------------------------------------------- |
| 1957 | // TestSubReqInsertAndSubDelOk |
| 1958 | // |
| 1959 | // stub stub |
| 1960 | // +-------+ +---------+ +---------+ |
| 1961 | // | xapp | | submgr | | e2term | |
| 1962 | // +-------+ +---------+ +---------+ |
| 1963 | // | | | |
| 1964 | // | SubReq | | |
| 1965 | // |------------->| | |
| 1966 | // | | | |
| 1967 | // | | SubReq | |
| 1968 | // | |------------->| |
| 1969 | // | | | |
| 1970 | // | | SubResp | |
| 1971 | // | |<-------------| |
| 1972 | // | | | |
| 1973 | // | SubResp | | |
| 1974 | // |<-------------| | |
| 1975 | // | | | |
| 1976 | // | | | |
| 1977 | // | SubDelReq | | |
| 1978 | // |------------->| | |
| 1979 | // | | | |
| 1980 | // | | SubDelReq | |
| 1981 | // | |------------->| |
| 1982 | // | | | |
| 1983 | // | | SubDelResp | |
| 1984 | // | |<-------------| |
| 1985 | // | | | |
| 1986 | // | SubDelResp | | |
| 1987 | // |<-------------| | |
| 1988 | // |
| 1989 | //----------------------------------------------------------------------------- |
| 1990 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1991 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1992 | |
| 1993 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1994 | rparams1.Init() |
| 1995 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 1996 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1997 | |
| 1998 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1999 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2000 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2001 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2002 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2003 | |
| 2004 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2005 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2006 | |
| 2007 | //Wait that subs is cleaned |
| 2008 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2009 | |
| 2010 | xappConn1.TestMsgChanEmpty(t) |
| 2011 | xappConn2.TestMsgChanEmpty(t) |
| 2012 | e2termConn1.TestMsgChanEmpty(t) |
| 2013 | mainCtrl.wait_registry_empty(t, 10) |
| 2014 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2015 | |
| 2016 | //----------------------------------------------------------------------------- |
| 2017 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2018 | // |
| 2019 | // This case simulates case where xApp restarts and starts sending same |
| 2020 | // subscription requests which have already subscribed successfully |
| 2021 | |
| 2022 | // stub stub |
| 2023 | // +-------+ +---------+ +---------+ |
| 2024 | // | xapp | | submgr | | e2term | |
| 2025 | // +-------+ +---------+ +---------+ |
| 2026 | // | | | |
| 2027 | // | SubReq | | |
| 2028 | // |------------->| | |
| 2029 | // | | | |
| 2030 | // | | SubReq | |
| 2031 | // | |------------->| |
| 2032 | // | | | |
| 2033 | // | | SubResp | |
| 2034 | // | |<-------------| |
| 2035 | // | | | |
| 2036 | // | SubResp | | |
| 2037 | // |<-------------| | |
| 2038 | // | | | |
| 2039 | // | xApp restart | | |
| 2040 | // | | | |
| 2041 | // | SubReq | | |
| 2042 | // | (retrans with same xApp generated subid but diff xid) |
| 2043 | // |------------->| | |
| 2044 | // | | | |
| 2045 | // | SubResp | | |
| 2046 | // |<-------------| | |
| 2047 | // | | | |
| 2048 | // | [SUBS DELETE] | |
| 2049 | // | | | |
| 2050 | // |
| 2051 | //----------------------------------------------------------------------------- |
| 2052 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2053 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2054 | |
| 2055 | //Subs Create |
| 2056 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2057 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2058 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2059 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2060 | |
| 2061 | // xApp restart here |
| 2062 | // --> artificial delay |
| 2063 | <-time.After(1 * time.Second) |
| 2064 | |
| 2065 | //Subs Create |
| 2066 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2067 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2068 | |
| 2069 | //Subs Delete |
| 2070 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2071 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2072 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2073 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2074 | |
| 2075 | //Wait that subs is cleaned |
| 2076 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2077 | |
| 2078 | xappConn1.TestMsgChanEmpty(t) |
| 2079 | xappConn2.TestMsgChanEmpty(t) |
| 2080 | e2termConn1.TestMsgChanEmpty(t) |
| 2081 | mainCtrl.wait_registry_empty(t, 10) |
| 2082 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2083 | |
| 2084 | //----------------------------------------------------------------------------- |
| 2085 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2086 | // |
| 2087 | // stub stub |
| 2088 | // +-------+ +---------+ +---------+ |
| 2089 | // | xapp | | submgr | | e2term | |
| 2090 | // +-------+ +---------+ +---------+ |
| 2091 | // | | | |
| 2092 | // | SubReq | | |
| 2093 | // |------------->| | |
| 2094 | // | | | |
| 2095 | // | | SubReq | |
| 2096 | // | |------------->| |
| 2097 | // | | | |
| 2098 | // | | SubResp | |
| 2099 | // | <----| |
| 2100 | // | | |
| 2101 | // | Submgr restart | |
| 2102 | // | | |
| 2103 | // | | | |
| 2104 | // | | SubDelReq | |
| 2105 | // | |------------->| |
| 2106 | // | | | |
| 2107 | // | | SubDelResp | |
| 2108 | // | |<-------------| |
| 2109 | // | | | |
| 2110 | // |
| 2111 | //----------------------------------------------------------------------------- |
| 2112 | |
| 2113 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2114 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2115 | |
| 2116 | // Remove possible existing subscrition |
| 2117 | mainCtrl.removeExistingSubscriptions(t) |
| 2118 | |
| 2119 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2120 | xappConn1.SendSubsReq(t, nil, nil) |
| 2121 | e2termConn1.RecvSubsReq(t) |
| 2122 | mainCtrl.SetResetTestFlag(t, false) |
| 2123 | |
| 2124 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2125 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2126 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2127 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2128 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2129 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2130 | mainCtrl.SimulateRestart(t) |
| 2131 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2132 | |
| 2133 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2134 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2135 | |
| 2136 | // Wait that subs is cleaned |
| 2137 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2138 | |
| 2139 | xappConn1.TestMsgChanEmpty(t) |
| 2140 | xappConn2.TestMsgChanEmpty(t) |
| 2141 | e2termConn1.TestMsgChanEmpty(t) |
| 2142 | mainCtrl.wait_registry_empty(t, 10) |
| 2143 | } |
| 2144 | |
| 2145 | //----------------------------------------------------------------------------- |
| 2146 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2147 | // |
| 2148 | // stub stub |
| 2149 | // +-------+ +---------+ +---------+ |
| 2150 | // | xapp | | submgr | | e2term | |
| 2151 | // +-------+ +---------+ +---------+ |
| 2152 | // | | | |
| 2153 | // | SubReq | | |
| 2154 | // |------------->| | |
| 2155 | // | | | |
| 2156 | // | | SubReq | |
| 2157 | // | |------------->| |
| 2158 | // | | | |
| 2159 | // | | SubResp | |
| 2160 | // | |<-------------| |
| 2161 | // | | | |
| 2162 | // | SubResp | | |
| 2163 | // |<-------------| | |
| 2164 | // | | | |
| 2165 | // | | |
| 2166 | // | Submgr restart | |
| 2167 | // | | |
| 2168 | // | SubDelReq | | |
| 2169 | // |------------->| | |
| 2170 | // | | | |
| 2171 | // | | SubDelReq | |
| 2172 | // | |------------->| |
| 2173 | // | | | |
| 2174 | // | | SubDelResp | |
| 2175 | // | |<-------------| |
| 2176 | // | | | |
| 2177 | // | SubDelResp | | |
| 2178 | // |<-------------| | |
| 2179 | // |
| 2180 | //----------------------------------------------------------------------------- |
| 2181 | |
| 2182 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2183 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2184 | |
| 2185 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2186 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2187 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2188 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2189 | |
| 2190 | // Check subscription |
| 2191 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2192 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2193 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2194 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2195 | |
| 2196 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2197 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2198 | |
| 2199 | // Check that subscription is restored correctly after restart |
| 2200 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2201 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2202 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2203 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2204 | |
| 2205 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2206 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2207 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2208 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2209 | |
| 2210 | //Wait that subs is cleaned |
| 2211 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2212 | |
| 2213 | xappConn1.TestMsgChanEmpty(t) |
| 2214 | xappConn2.TestMsgChanEmpty(t) |
| 2215 | e2termConn1.TestMsgChanEmpty(t) |
| 2216 | mainCtrl.wait_registry_empty(t, 10) |
| 2217 | } |
| 2218 | |
| 2219 | //----------------------------------------------------------------------------- |
| 2220 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2221 | // |
| 2222 | // stub stub |
| 2223 | // +-------+ +-------+ +---------+ +---------+ |
| 2224 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2225 | // +-------+ +-------+ +---------+ +---------+ |
| 2226 | // | | | | |
| 2227 | // | | | | |
| 2228 | // | | | | |
| 2229 | // | | SubReq1 | | |
| 2230 | // | |------------->| | |
| 2231 | // | | | | |
| 2232 | // | | | SubReq1 | |
| 2233 | // | | |------------->| |
| 2234 | // | | | SubResp1 | |
| 2235 | // | | |<-------------| |
| 2236 | // | | SubResp1 | | |
| 2237 | // | |<-------------| | |
| 2238 | // | | | | |
| 2239 | // | | |
| 2240 | // | submgr restart | |
| 2241 | // | | |
| 2242 | // | | | | |
| 2243 | // | | | | |
| 2244 | // | SubReq2 | | |
| 2245 | // |--------------------------->| | |
| 2246 | // | | | | |
| 2247 | // | SubResp2 | | |
| 2248 | // |<---------------------------| | |
| 2249 | // | | | | |
| 2250 | // | | SubDelReq 1 | | |
| 2251 | // | |------------->| | |
| 2252 | // | | | | |
| 2253 | // | | SubDelResp 1 | | |
| 2254 | // | |<-------------| | |
| 2255 | // | | | | |
| 2256 | // | | | | |
| 2257 | // | | |
| 2258 | // | submgr restart | |
| 2259 | // | | |
| 2260 | // | | | | |
| 2261 | // | SubDelReq 2 | | |
| 2262 | // |--------------------------->| | |
| 2263 | // | | | | |
| 2264 | // | | | SubDelReq 2 | |
| 2265 | // | | |------------->| |
| 2266 | // | | | | |
| 2267 | // | | | SubDelReq 2 | |
| 2268 | // | | |------------->| |
| 2269 | // | | | | |
| 2270 | // | SubDelResp 2 | | |
| 2271 | // |<---------------------------| | |
| 2272 | // |
| 2273 | //----------------------------------------------------------------------------- |
| 2274 | |
| 2275 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2276 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2277 | |
| 2278 | //Req1 |
| 2279 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2280 | rparams1.Init() |
| 2281 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2282 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2283 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2284 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2285 | |
| 2286 | //Req2 |
| 2287 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2288 | rparams2.Init() |
| 2289 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2290 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2291 | |
| 2292 | // Check subscription |
| 2293 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2294 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2295 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2296 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2297 | |
| 2298 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2299 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2300 | |
| 2301 | // Check that subscription is restored correctly after restart |
| 2302 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2303 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2304 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2305 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2306 | |
| 2307 | //Del1 |
| 2308 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2309 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2310 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2311 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2312 | |
| 2313 | mainCtrl.SimulateRestart(t) |
| 2314 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2315 | |
| 2316 | //Del2 |
| 2317 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2318 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2319 | |
| 2320 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2321 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2322 | |
| 2323 | //Wait that subs is cleaned |
| 2324 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2325 | |
| 2326 | xappConn1.TestMsgChanEmpty(t) |
| 2327 | xappConn2.TestMsgChanEmpty(t) |
| 2328 | e2termConn1.TestMsgChanEmpty(t) |
| 2329 | mainCtrl.wait_registry_empty(t, 10) |
| 2330 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2331 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2332 | //***************************************************************************** |
| 2333 | // REST interface test cases |
| 2334 | //***************************************************************************** |
| 2335 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2336 | //----------------------------------------------------------------------------- |
| 2337 | // Test debug GET and POST requests |
| 2338 | // |
| 2339 | // curl |
| 2340 | // +-------+ +---------+ |
| 2341 | // | user | | submgr | |
| 2342 | // +-------+ +---------+ |
| 2343 | // | | |
| 2344 | // | GET/POST Req | |
| 2345 | // |------------->| |
| 2346 | // | Resp | |
| 2347 | // |<-------------| |
| 2348 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2349 | func TestGetSubscriptions(t *testing.T) { |
| 2350 | |
| 2351 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2352 | } |
| 2353 | |
| 2354 | func TestGetSymptomData(t *testing.T) { |
| 2355 | |
| 2356 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2357 | } |
| 2358 | |
| 2359 | func TestPostdeleteSubId(t *testing.T) { |
| 2360 | |
| 2361 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2362 | } |
| 2363 | |
| 2364 | func TestPostEmptyDb(t *testing.T) { |
| 2365 | |
| 2366 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2367 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2368 | |
| 2369 | //----------------------------------------------------------------------------- |
| 2370 | // TestRESTSubReqAndRouteNok |
| 2371 | // |
| 2372 | // stub stub |
| 2373 | // +-------+ +---------+ +---------+ |
| 2374 | // | xapp | | submgr | | rtmgr | |
| 2375 | // +-------+ +---------+ +---------+ |
| 2376 | // | | | |
| 2377 | // | RESTSubReq | | |
| 2378 | // |---------------->| | |
| 2379 | // | | | |
| 2380 | // | RESTSubResp | | |
| 2381 | // |<----------------| | |
| 2382 | // | | RouteCreate | |
| 2383 | // | |------------->| |
| 2384 | // | | | |
| 2385 | // | | RouteCreate | |
| 2386 | // | | status:400 | |
| 2387 | // | |(Bad request) | |
| 2388 | // | |<-------------| |
| 2389 | // | RESTNotif | | |
| 2390 | // |<----------------| | |
| 2391 | // | | | |
| 2392 | // | [SUBS INT DELETE] | |
| 2393 | // | | | |
| 2394 | // | RESTSubDelReq | | |
| 2395 | // |---------------->| | |
| 2396 | // | RESTSubDelResp | | |
| 2397 | // |<----------------| | |
| 2398 | // |
| 2399 | //----------------------------------------------------------------------------- |
| 2400 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2401 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2402 | |
| 2403 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2404 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2405 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2406 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2407 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2408 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2409 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2410 | }) |
| 2411 | |
| 2412 | const subReqCount int = 1 |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2413 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2414 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2415 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2416 | |
| 2417 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2418 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2419 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2420 | xappConn1.ExpectRESTNotification(t, restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2421 | waiter.WaitResult(t) |
| 2422 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2423 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2424 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2425 | |
| 2426 | // Del |
| 2427 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2428 | |
| 2429 | // Wait that subs is cleaned |
| 2430 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2431 | waitSubsCleanup(t, e2SubsId, 10) |
| 2432 | mainCtrl.VerifyCounterValues(t) |
| 2433 | } |
| 2434 | |
| 2435 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2436 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2437 | |
| 2438 | //Init counter check |
| 2439 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2440 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2441 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2442 | Counter{cSubReqToE2, 1}, |
| 2443 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2444 | Counter{cRestSubNotifToXapp, 1}, |
| 2445 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2446 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2447 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2448 | Counter{cSubDelReqToE2, 1}, |
| 2449 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2450 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2451 | }) |
| 2452 | |
| 2453 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2454 | |
| 2455 | //Subs Create |
| 2456 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2457 | |
| 2458 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2459 | |
| 2460 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2461 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2462 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2463 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2464 | params.SetMeid("RAN_NAME_1") |
| 2465 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2466 | xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) |
| 2467 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 2468 | waiter.WaitResult(t) |
| 2469 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2470 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2471 | |
| 2472 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2473 | |
| 2474 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2475 | |
| 2476 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2477 | //Wait that subs is cleaned |
| 2478 | waitSubsCleanup(t, e2SubsId, 10) |
| 2479 | |
| 2480 | mainCtrl.VerifyCounterValues(t) |
| 2481 | } |
| 2482 | |
| 2483 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2484 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2485 | |
| 2486 | // Init counter check |
| 2487 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2488 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2489 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2490 | Counter{cSubReqToE2, 1}, |
| 2491 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2492 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2493 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2494 | Counter{cRouteDeleteFail, 1}, |
| 2495 | Counter{cSubDelReqToE2, 1}, |
| 2496 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2497 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2498 | }) |
| 2499 | |
| 2500 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2501 | |
| 2502 | //Subs Create |
| 2503 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2504 | |
| 2505 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2506 | |
| 2507 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2508 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2509 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2510 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2511 | waiter.WaitResult(t) |
| 2512 | |
| 2513 | waitSubsCleanup(t, e2SubsId, 10) |
| 2514 | |
| 2515 | mainCtrl.VerifyCounterValues(t) |
| 2516 | } |
| 2517 | |
| 2518 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2519 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2520 | |
| 2521 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2522 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2523 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2524 | Counter{cSubReqToE2, 1}, |
| 2525 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2526 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2527 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2528 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2529 | Counter{cSubDelReqToE2, 1}, |
| 2530 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2531 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2532 | }) |
| 2533 | |
| 2534 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2535 | |
| 2536 | //Subs Create |
| 2537 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2538 | |
| 2539 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2540 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2541 | |
| 2542 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2543 | |
| 2544 | //Del1, this shall fail on rtmgr side |
| 2545 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2546 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2547 | waiter.WaitResult(t) |
| 2548 | |
| 2549 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2550 | |
| 2551 | //Del2 |
| 2552 | deleteXapp2Subscription(t, &restSubId2) |
| 2553 | |
| 2554 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2555 | |
| 2556 | mainCtrl.VerifyCounterValues(t) |
| 2557 | } |
| 2558 | |
| 2559 | //----------------------------------------------------------------------------- |
| 2560 | // TestRESTSubReqRetransmission |
| 2561 | // |
| 2562 | // stub stub |
| 2563 | // +-------+ +---------+ +---------+ |
| 2564 | // | xapp | | submgr | | e2term | |
| 2565 | // +-------+ +---------+ +---------+ |
| 2566 | // | | | |
| 2567 | // | RESTSubReq1 | | |
| 2568 | // |---------------->| | |
| 2569 | // | | | |
| 2570 | // | RESTSubResp | | |
| 2571 | // |<----------------| | |
| 2572 | // | | SubReq1 | |
| 2573 | // | |------------->| |
| 2574 | // | | | |
| 2575 | // | RESTSubReq2 | | |
| 2576 | // | (retrans) | | |
| 2577 | // |---------------->| | |
| 2578 | // | | | |
| 2579 | // | | SubReq2 | |
| 2580 | // | |------------->| |
| 2581 | // | RESTSubResp2 | | |
| 2582 | // |<----------------| | |
| 2583 | // | | SubResp1 | |
| 2584 | // | |<-------------| |
| 2585 | // | RESTNotif1 | | |
| 2586 | // |<----------------| | |
| 2587 | // | | SubResp1 | |
| 2588 | // | |<-------------| |
| 2589 | // | RESTNotif2 | | |
| 2590 | // |<----------------| | |
| 2591 | // | | | |
| 2592 | // | [SUBS DELETE] | |
| 2593 | // | | | |
| 2594 | // |
| 2595 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2596 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2597 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2598 | CaseBegin("TestRESTSubReqRetransmission") |
| 2599 | |
| 2600 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2601 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2602 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2603 | Counter{cSubReqToE2, 2}, |
| 2604 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2605 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2606 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2607 | Counter{cSubDelReqToE2, 2}, |
| 2608 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2609 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2610 | }) |
| 2611 | // Retry/duplicate will get the same way as the first request. Submgr cannot detect duplicate RESTRequests |
| 2612 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2613 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2614 | |
| 2615 | // Subs Create |
| 2616 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2617 | |
| 2618 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2619 | // gets into execution before the rtmgrg responds for the first one. |
| 2620 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2621 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2622 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2623 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2624 | |
| 2625 | waiter.WaitResult(t) |
| 2626 | |
| 2627 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2628 | |
| 2629 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2630 | // the order is not significant he6re. |
| 2631 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2632 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2633 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2634 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2635 | |
| 2636 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2637 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2638 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2639 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2640 | |
| 2641 | // Del1 |
| 2642 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2643 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2644 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2645 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2646 | // Del2 |
| 2647 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 2648 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2649 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2650 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2651 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 2652 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2653 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2654 | |
| 2655 | mainCtrl.VerifyCounterValues(t) |
| 2656 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2657 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2658 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 2659 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 2660 | |
| 2661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2662 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2663 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2664 | Counter{cSubReqToE2, 1}, |
| 2665 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2666 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2667 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2668 | Counter{cSubDelReqToE2, 1}, |
| 2669 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2670 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2671 | }) |
| 2672 | |
| 2673 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2674 | |
| 2675 | //Subs Create |
| 2676 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2677 | |
| 2678 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2679 | |
| 2680 | //Subs Delete |
| 2681 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2682 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2683 | |
| 2684 | seqBef := mainCtrl.get_msgcounter(t) |
| 2685 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2686 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 2687 | |
| 2688 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2689 | |
| 2690 | waitSubsCleanup(t, e2SubsId, 10) |
| 2691 | |
| 2692 | mainCtrl.VerifyCounterValues(t) |
| 2693 | } |
| 2694 | |
| 2695 | //----------------------------------------------------------------------------- |
| 2696 | // TestRESTSubReqDelReq |
| 2697 | // |
| 2698 | // stub stub |
| 2699 | // +-------+ +---------+ +---------+ |
| 2700 | // | xapp | | submgr | | e2term | |
| 2701 | // +-------+ +---------+ +---------+ |
| 2702 | // | | | |
| 2703 | // | RESTSubReq | | |
| 2704 | // |---------------->| | |
| 2705 | // | | | |
| 2706 | // | RESTSubResp | | |
| 2707 | // |<----------------| | |
| 2708 | // | | SubReq | |
| 2709 | // | |------------->| |
| 2710 | // | RESTSubDelReq | | |
| 2711 | // |---------------->| | |
| 2712 | // | RESTSubDelResp | | |
| 2713 | // | unsuccess | | |
| 2714 | // |<----------------| | |
| 2715 | // | | SubResp | |
| 2716 | // | |<-------------| |
| 2717 | // | RESTNotif1 | | |
| 2718 | // |<----------------| | |
| 2719 | // | | | |
| 2720 | // | [SUBS DELETE] | |
| 2721 | // | | | |
| 2722 | // |
| 2723 | //----------------------------------------------------------------------------- |
| 2724 | func TestRESTSubReqDelReq(t *testing.T) { |
| 2725 | CaseBegin("TestRESTSubReqDelReq") |
| 2726 | |
| 2727 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2728 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2729 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2730 | Counter{cSubReqToE2, 1}, |
| 2731 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2732 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2733 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2734 | Counter{cSubDelReqToE2, 1}, |
| 2735 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2736 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2737 | }) |
| 2738 | |
| 2739 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2740 | |
| 2741 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2742 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2743 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2744 | |
| 2745 | // Del. This will fail as processing of the subscription |
| 2746 | // is still ongoing in submgr. Deletion is not allowed before |
| 2747 | // subscription creation has been completed. |
| 2748 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2749 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2750 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2751 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2752 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2753 | |
| 2754 | // Retry del |
| 2755 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2756 | |
| 2757 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2758 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2759 | |
| 2760 | // Wait that subs is cleaned |
| 2761 | waitSubsCleanup(t, e2SubsId, 10) |
| 2762 | mainCtrl.VerifyCounterValues(t) |
| 2763 | |
| 2764 | } |
| 2765 | |
| 2766 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 2767 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 2768 | } |
| 2769 | |
| 2770 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 2771 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 2772 | |
| 2773 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2774 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2775 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2776 | Counter{cSubReqToE2, 2}, |
| 2777 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2778 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2779 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2780 | Counter{cSubDelReqToE2, 2}, |
| 2781 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2782 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2783 | }) |
| 2784 | |
| 2785 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2786 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2787 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2788 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2789 | |
| 2790 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2791 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2792 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2793 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2794 | |
| 2795 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2796 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2797 | |
| 2798 | //XappConn1 receives both of the responses |
| 2799 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2800 | |
| 2801 | //Resp1 |
| 2802 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2803 | //Resp2 |
| 2804 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2805 | |
| 2806 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2807 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2808 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2809 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2810 | |
| 2811 | //Del1 |
| 2812 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2813 | //Del2 |
| 2814 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 2815 | |
| 2816 | //Wait that subs is cleaned |
| 2817 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2818 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2819 | |
| 2820 | mainCtrl.VerifyCounterValues(t) |
| 2821 | |
| 2822 | } |
| 2823 | |
| 2824 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 2825 | CaseBegin("TestRESTSameSubsDiffRan") |
| 2826 | |
| 2827 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2828 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2829 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2830 | Counter{cSubReqToE2, 2}, |
| 2831 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2832 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2833 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2834 | Counter{cSubDelReqToE2, 2}, |
| 2835 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2836 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2837 | }) |
| 2838 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2839 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2840 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2841 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2842 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2843 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2844 | params.SetMeid("RAN_NAME_2") |
| 2845 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2846 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2847 | |
| 2848 | //Del1 |
| 2849 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2850 | //Del2 |
| 2851 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 2852 | |
| 2853 | //Wait that subs is cleaned |
| 2854 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2855 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2856 | |
| 2857 | mainCtrl.VerifyCounterValues(t) |
| 2858 | |
| 2859 | } |
| 2860 | |
| 2861 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 2862 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 2863 | |
| 2864 | // Init counter check |
| 2865 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2866 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2867 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2868 | Counter{cSubReqToE2, 1}, |
| 2869 | Counter{cSubReReqToE2, 1}, |
| 2870 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2871 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2872 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2873 | Counter{cSubDelReqToE2, 1}, |
| 2874 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2875 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2876 | }) |
| 2877 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2878 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2879 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2880 | |
| 2881 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2882 | |
| 2883 | // Catch the first message and ignore it |
| 2884 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2885 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 2886 | |
| 2887 | // The second request is being handled normally |
| 2888 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2889 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2890 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2891 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2892 | |
| 2893 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2894 | |
| 2895 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2896 | |
| 2897 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2898 | //Wait that subs is cleaned |
| 2899 | waitSubsCleanup(t, e2SubsId, 10) |
| 2900 | |
| 2901 | mainCtrl.VerifyCounterValues(t) |
| 2902 | |
| 2903 | } |
| 2904 | |
| 2905 | //----------------------------------------------------------------------------- |
| 2906 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2907 | // |
| 2908 | // stub stub |
| 2909 | // +-------+ +---------+ +---------+ |
| 2910 | // | xapp | | submgr | | e2term | |
| 2911 | // +-------+ +---------+ +---------+ |
| 2912 | // | | | |
| 2913 | // | RESTSubReq | | |
| 2914 | // |---------------->| | |
| 2915 | // | | | |
| 2916 | // | RESTSubResp | | |
| 2917 | // |<----------------| | |
| 2918 | // | | SubReq | |
| 2919 | // | |------------->| |
| 2920 | // | | | |
| 2921 | // | | | |
| 2922 | // | | SubReq | |
| 2923 | // | |------------->| |
| 2924 | // | | | |
| 2925 | // | | SubDelReq | |
| 2926 | // | |------------->| |
| 2927 | // | | | |
| 2928 | // | | | |
| 2929 | // | | SubDelReq | |
| 2930 | // | |------------->| |
| 2931 | // | | | |
| 2932 | // | | | |
| 2933 | // | | SubDelResp | |
| 2934 | // | |<-------------| |
| 2935 | // | RESTNotif | | |
| 2936 | // | unsuccess | | |
| 2937 | // |<----------------| | |
| 2938 | // | | | |
| 2939 | // | [SUBS DELETE] | |
| 2940 | // | | | |
| 2941 | // |
| 2942 | //----------------------------------------------------------------------------- |
| 2943 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 2944 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 2945 | |
| 2946 | // Init counter check |
| 2947 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2948 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2949 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2950 | Counter{cSubReqToE2, 1}, |
| 2951 | Counter{cSubReReqToE2, 1}, |
| 2952 | Counter{cSubReqTimerExpiry, 2}, |
| 2953 | Counter{cSubDelReqToE2, 1}, |
| 2954 | Counter{cSubDelRespFromE2, 1}, |
| 2955 | }) |
| 2956 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2957 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2958 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2959 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2960 | |
| 2961 | e2termConn1.RecvSubsReq(t) |
| 2962 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2963 | |
| 2964 | e2termConn1.RecvSubsReq(t) |
| 2965 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2966 | |
| 2967 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2968 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2969 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2970 | // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? |
| 2971 | xappConn1.WaitRESTNotification(t, restSubId) |
| 2972 | |
| 2973 | // Wait that subs is cleaned |
| 2974 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 2975 | |
| 2976 | mainCtrl.VerifyCounterValues(t) |
| 2977 | } |
| 2978 | |
| 2979 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 2980 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 2981 | |
| 2982 | // Init counter check |
| 2983 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2984 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 2985 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2986 | Counter{cSubReqToE2, 1}, |
| 2987 | Counter{cSubReReqToE2, 1}, |
| 2988 | Counter{cSubReqTimerExpiry, 2}, |
| 2989 | Counter{cSubDelReqToE2, 1}, |
| 2990 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2991 | }) |
| 2992 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2993 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2994 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2995 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2996 | |
| 2997 | e2termConn1.RecvSubsReq(t) |
| 2998 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2999 | |
| 3000 | e2termConn1.RecvSubsReq(t) |
| 3001 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3002 | |
| 3003 | e2termConn1.RecvSubsDelReq(t) |
| 3004 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3005 | |
| 3006 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3007 | e2termConn1.RecvSubsDelReq(t) |
| 3008 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3009 | |
| 3010 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3011 | |
| 3012 | waitSubsCleanup(t, e2SubsId, 10) |
| 3013 | |
| 3014 | mainCtrl.VerifyCounterValues(t) |
| 3015 | |
| 3016 | } |
| 3017 | |
| 3018 | //----------------------------------------------------------------------------- |
| 3019 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3020 | // |
| 3021 | // stub stub |
| 3022 | // +-------+ +---------+ +---------+ |
| 3023 | // | xapp | | submgr | | e2term | |
| 3024 | // +-------+ +---------+ +---------+ |
| 3025 | // | | | |
| 3026 | // | RESTSubReq | | |
| 3027 | // |---------------->| | |
| 3028 | // | | | |
| 3029 | // | RESTSubResp | | |
| 3030 | // |<----------------| | |
| 3031 | // | | SubReq | |
| 3032 | // | |------------->| |
| 3033 | // | | | |
| 3034 | // | | | |
| 3035 | // | | SubReq | |
| 3036 | // | |------------->| |
| 3037 | // | | | |
| 3038 | // | | SubDelReq | |
| 3039 | // | |------------->| |
| 3040 | // | | | |
| 3041 | // | | | |
| 3042 | // | | SubDelReq | |
| 3043 | // | |------------->| |
| 3044 | // | | | |
| 3045 | // | | | |
| 3046 | // | | SubDelResp | |
| 3047 | // | |<-------------| |
| 3048 | // | RESTNotif | | |
| 3049 | // | unsuccess | | |
| 3050 | // |<----------------| | |
| 3051 | // | | | |
| 3052 | // | [SUBS DELETE] | |
| 3053 | // | | | |
| 3054 | // |
| 3055 | //----------------------------------------------------------------------------- |
| 3056 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3057 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3058 | |
| 3059 | // Init counter check |
| 3060 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3061 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3062 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3063 | Counter{cSubReqToE2, 1}, |
| 3064 | Counter{cSubReReqToE2, 1}, |
| 3065 | Counter{cSubReqTimerExpiry, 2}, |
| 3066 | Counter{cSubDelReqToE2, 1}, |
| 3067 | Counter{cSubDelReReqToE2, 1}, |
| 3068 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3069 | }) |
| 3070 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3071 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3072 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3073 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3074 | |
| 3075 | e2termConn1.RecvSubsReq(t) |
| 3076 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3077 | |
| 3078 | e2termConn1.RecvSubsReq(t) |
| 3079 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3080 | |
| 3081 | e2termConn1.RecvSubsDelReq(t) |
| 3082 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3083 | |
| 3084 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3085 | e2termConn1.RecvSubsDelReq(t) |
| 3086 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3087 | |
| 3088 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3089 | |
| 3090 | waitSubsCleanup(t, e2SubsId, 10) |
| 3091 | |
| 3092 | mainCtrl.VerifyCounterValues(t) |
| 3093 | } |
| 3094 | |
| 3095 | //----------------------------------------------------------------------------- |
| 3096 | // TestRESTSubReqSubFailRespInSubmgr |
| 3097 | // |
| 3098 | // stub stub |
| 3099 | // +-------+ +---------+ +---------+ |
| 3100 | // | xapp | | submgr | | e2term | |
| 3101 | // +-------+ +---------+ +---------+ |
| 3102 | // | | | |
| 3103 | // | RESTSubReq | | |
| 3104 | // |---------------->| | |
| 3105 | // | | | |
| 3106 | // | RESTSubResp | | |
| 3107 | // |<----------------| | |
| 3108 | // | | SubReq | |
| 3109 | // | |------------->| |
| 3110 | // | | | |
| 3111 | // | | SubFail | |
| 3112 | // | |<-------------| |
| 3113 | // | | | |
| 3114 | // | | SubDelReq | |
| 3115 | // | |------------->| |
| 3116 | // | | | |
| 3117 | // | | SubDelResp | |
| 3118 | // | |<-------------| |
| 3119 | // | | | |
| 3120 | // | RESTNotif | | |
| 3121 | // | unsuccess | | |
| 3122 | // |<----------------| | |
| 3123 | // | | | |
| 3124 | // | [SUBS DELETE] | |
| 3125 | // | | | |
| 3126 | // |
| 3127 | //----------------------------------------------------------------------------- |
| 3128 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3129 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3130 | |
| 3131 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3132 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3133 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3134 | Counter{cSubReqToE2, 1}, |
| 3135 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3136 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3137 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3138 | }) |
| 3139 | |
| 3140 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3141 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3142 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3143 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3144 | |
| 3145 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3146 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3147 | fparams1.Set(crereq1) |
| 3148 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3149 | |
| 3150 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3151 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3152 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3153 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3154 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 3155 | |
| 3156 | // REST subscription sill there to be deleted |
| 3157 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3158 | |
| 3159 | // Wait that subs is cleaned |
| 3160 | waitSubsCleanup(t, e2SubsId, 10) |
| 3161 | |
| 3162 | mainCtrl.VerifyCounterValues(t) |
| 3163 | |
| 3164 | } |
| 3165 | |
| 3166 | //----------------------------------------------------------------------------- |
| 3167 | // TestRESTSubDelReqRetryInSubmgr |
| 3168 | // |
| 3169 | // stub stub |
| 3170 | // +-------+ +---------+ +---------+ |
| 3171 | // | xapp | | submgr | | e2term | |
| 3172 | // +-------+ +---------+ +---------+ |
| 3173 | // | | | |
| 3174 | // | [SUBS CREATE] | |
| 3175 | // | | | |
| 3176 | // | | | |
| 3177 | // | RESTSubDelReq | | |
| 3178 | // |---------------->| | |
| 3179 | // | | | |
| 3180 | // | RESTSubDelResp | | |
| 3181 | // |<----------------| | |
| 3182 | // | | SubDelReq | |
| 3183 | // | |------------->| |
| 3184 | // | | | |
| 3185 | // | | SubDelReq | |
| 3186 | // | |------------->| |
| 3187 | // | | | |
| 3188 | // | | SubDelResp | |
| 3189 | // | |<-------------| |
| 3190 | // | | | |
| 3191 | // |
| 3192 | //----------------------------------------------------------------------------- |
| 3193 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3194 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3195 | |
| 3196 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3197 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3198 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3199 | Counter{cSubReqToE2, 1}, |
| 3200 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3201 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3202 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3203 | Counter{cSubDelReqToE2, 1}, |
| 3204 | Counter{cSubDelReReqToE2, 1}, |
| 3205 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3206 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3207 | }) |
| 3208 | // Req |
| 3209 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3210 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3211 | |
| 3212 | // Del |
| 3213 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3214 | |
| 3215 | // E2t: Receive 1st SubsDelReq |
| 3216 | e2termConn1.RecvSubsDelReq(t) |
| 3217 | |
| 3218 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3219 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3220 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3221 | |
| 3222 | //Wait that subs is cleaned |
| 3223 | waitSubsCleanup(t, e2SubsId, 10) |
| 3224 | |
| 3225 | mainCtrl.VerifyCounterValues(t) |
| 3226 | } |
| 3227 | |
| 3228 | //----------------------------------------------------------------------------- |
| 3229 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3230 | // |
| 3231 | // stub stub |
| 3232 | // +-------+ +---------+ +---------+ |
| 3233 | // | xapp | | submgr | | e2term | |
| 3234 | // +-------+ +---------+ +---------+ |
| 3235 | // | | | |
| 3236 | // | [SUBS CREATE] | |
| 3237 | // | | | |
| 3238 | // | | | |
| 3239 | // | RESTSubDelReq | | |
| 3240 | // |---------------->| | |
| 3241 | // | | | |
| 3242 | // | RESTSubDelResp | | |
| 3243 | // |<----------------| | |
| 3244 | // | | SubDelReq | |
| 3245 | // | |------------->| |
| 3246 | // | | | |
| 3247 | // | | SubDelReq | |
| 3248 | // | |------------->| |
| 3249 | // | | | |
| 3250 | // | | | |
| 3251 | // |
| 3252 | //----------------------------------------------------------------------------- |
| 3253 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3254 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3255 | |
| 3256 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3257 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3258 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3259 | Counter{cSubReqToE2, 1}, |
| 3260 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3261 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3262 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3263 | Counter{cSubDelReqToE2, 1}, |
| 3264 | Counter{cSubDelReReqToE2, 1}, |
| 3265 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3266 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3267 | }) |
| 3268 | |
| 3269 | // Req |
| 3270 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3271 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3272 | |
| 3273 | // Del |
| 3274 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3275 | |
| 3276 | // E2t: Receive 1st SubsDelReq |
| 3277 | e2termConn1.RecvSubsDelReq(t) |
| 3278 | |
| 3279 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3280 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3281 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3282 | |
| 3283 | //Wait that subs is cleaned |
| 3284 | waitSubsCleanup(t, e2SubsId, 10) |
| 3285 | |
| 3286 | mainCtrl.VerifyCounterValues(t) |
| 3287 | } |
| 3288 | |
| 3289 | //----------------------------------------------------------------------------- |
| 3290 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3291 | // |
| 3292 | // stub stub |
| 3293 | // +-------+ +---------+ +---------+ |
| 3294 | // | xapp | | submgr | | e2term | |
| 3295 | // +-------+ +---------+ +---------+ |
| 3296 | // | | | |
| 3297 | // | [SUBS CREATE] | |
| 3298 | // | | | |
| 3299 | // | | | |
| 3300 | // | RESTSubDelReq | | |
| 3301 | // |---------------->| | |
| 3302 | // | | | |
| 3303 | // | RESTSubDelResp | | |
| 3304 | // |<----------------| | |
| 3305 | // | | SubDelReq | |
| 3306 | // | |------------->| |
| 3307 | // | | | |
| 3308 | // | | SubDelFail | |
| 3309 | // | |<-------------| |
| 3310 | // | | | |
| 3311 | // |
| 3312 | //----------------------------------------------------------------------------- |
| 3313 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3314 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3315 | |
| 3316 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3317 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3318 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3319 | Counter{cSubReqToE2, 1}, |
| 3320 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3321 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3322 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3323 | Counter{cSubDelReqToE2, 1}, |
| 3324 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3325 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | }) |
| 3327 | |
| 3328 | // Req |
| 3329 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3330 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3331 | |
| 3332 | // Del |
| 3333 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3334 | |
| 3335 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3336 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3337 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3338 | |
| 3339 | //Wait that subs is cleaned |
| 3340 | waitSubsCleanup(t, e2SubsId, 10) |
| 3341 | |
| 3342 | mainCtrl.VerifyCounterValues(t) |
| 3343 | } |
| 3344 | |
| 3345 | //----------------------------------------------------------------------------- |
| 3346 | // TestRESTSubReqAndSubDelOkSameAction |
| 3347 | // |
| 3348 | // stub stub |
| 3349 | // +-------+ +-------+ +---------+ +---------+ |
| 3350 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3351 | // +-------+ +-------+ +---------+ +---------+ |
| 3352 | // | | | | |
| 3353 | // | | RESTSubReq1 | | |
| 3354 | // | |---------------->| | |
| 3355 | // | | | | |
| 3356 | // | | RESTSubResp1 | | |
| 3357 | // | |<----------------| | |
| 3358 | // | | | | |
| 3359 | // | | | SubReq1 | |
| 3360 | // | | |------------->| |
| 3361 | // | | | SubResp1 | |
| 3362 | // | | |<-------------| |
| 3363 | // | | RESTNotif1 | | |
| 3364 | // | |<----------------| | |
| 3365 | // | | | | |
| 3366 | // | RESTSubReq2 | | |
| 3367 | // |------------------------------>| | |
| 3368 | // | | | | |
| 3369 | // | RESTSubResp2 | | |
| 3370 | // |<------------------------------| | |
| 3371 | // | | | | |
| 3372 | // | | RESTNotif2 | | |
| 3373 | // |<------------------------------| | |
| 3374 | // | | | | |
| 3375 | // | | RESTSubDelReq1 | | |
| 3376 | // | |---------------->| | |
| 3377 | // | | | | |
| 3378 | // | | RESTSubDelResp1 | | |
| 3379 | // | |<----------------| | |
| 3380 | // | | | | |
| 3381 | // | RESTSubDelReq2 | | |
| 3382 | // |------------------------------>| | |
| 3383 | // | | | | |
| 3384 | // | RESTSubDelResp2 | | |
| 3385 | // |<------------------------------| | |
| 3386 | // | | | | |
| 3387 | // | | | SubDelReq2 | |
| 3388 | // | | |------------->| |
| 3389 | // | | | | |
| 3390 | // | | | SubDelResp2 | |
| 3391 | // | | |<-------------| |
| 3392 | // | | | | |
| 3393 | // |
| 3394 | //----------------------------------------------------------------------------- |
| 3395 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3396 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3397 | |
| 3398 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3399 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3400 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3401 | Counter{cSubReqToE2, 1}, |
| 3402 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3403 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3404 | Counter{cMergedSubscriptions, 1}, |
| 3405 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3406 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3407 | Counter{cSubDelReqToE2, 1}, |
| 3408 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3409 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3410 | }) |
| 3411 | |
| 3412 | // Req1 |
| 3413 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3414 | |
| 3415 | //Subs Create |
| 3416 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3417 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3418 | |
| 3419 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3420 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3421 | params.SetMeid("RAN_NAME_1") |
| 3422 | |
| 3423 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 3424 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3425 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3426 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3427 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3428 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 3429 | e2SubsId2 := <-xappConn2.RESTNotification |
| 3430 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3431 | |
| 3432 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3433 | |
| 3434 | // Del1 |
| 3435 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3436 | |
| 3437 | // Del2 |
| 3438 | deleteXapp2Subscription(t, &restSubId2) |
| 3439 | |
| 3440 | //Wait that subs is cleaned |
| 3441 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3442 | |
| 3443 | mainCtrl.VerifyCounterValues(t) |
| 3444 | } |
| 3445 | |
| 3446 | //----------------------------------------------------------------------------- |
| 3447 | // TestSubReqAndSubDelOkSameActionParallel |
| 3448 | // |
| 3449 | // stub stub stub |
| 3450 | // +-------+ +-------+ +---------+ +---------+ |
| 3451 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3452 | // +-------+ +-------+ +---------+ +---------+ |
| 3453 | // | | | | |
| 3454 | // | | | | |
| 3455 | // | | | | |
| 3456 | // | | SubReq1 | | |
| 3457 | // | |------------->| | |
| 3458 | // | | | | |
| 3459 | // | | | SubReq1 | |
| 3460 | // | | |------------->| |
| 3461 | // | SubReq2 | | |
| 3462 | // |--------------------------->| | |
| 3463 | // | | | SubResp1 | |
| 3464 | // | | |<-------------| |
| 3465 | // | | SubResp1 | | |
| 3466 | // | |<-------------| | |
| 3467 | // | | | SubReq2 | |
| 3468 | // | | |------------->| |
| 3469 | // | | | | |
| 3470 | // | | | SubResp2 | |
| 3471 | // | | |<-------------| |
| 3472 | // | SubResp2 | | |
| 3473 | // |<---------------------------| | |
| 3474 | // | | | | |
| 3475 | // | | SubDelReq 1 | | |
| 3476 | // | |------------->| | |
| 3477 | // | | | | |
| 3478 | // | | SubDelResp 1 | | |
| 3479 | // | |<-------------| | |
| 3480 | // | | | | |
| 3481 | // | SubDelReq 2 | | |
| 3482 | // |--------------------------->| | |
| 3483 | // | | | | |
| 3484 | // | | | SubDelReq 2 | |
| 3485 | // | | |------------->| |
| 3486 | // | | | | |
| 3487 | // | | | SubDelReq 2 | |
| 3488 | // | | |------------->| |
| 3489 | // | | | | |
| 3490 | // | SubDelResp 2 | | |
| 3491 | // |<---------------------------| | |
| 3492 | // |
| 3493 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 3494 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 3495 | |
| 3496 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3497 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3498 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3499 | Counter{cSubReqToE2, 2}, |
| 3500 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3501 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3502 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3503 | Counter{cSubDelReqToE2, 2}, |
| 3504 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3505 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3506 | }) |
| 3507 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3508 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3509 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3510 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3511 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3512 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3513 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3514 | |
| 3515 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3516 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3517 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3518 | |
| 3519 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3520 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3521 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3522 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3523 | |
| 3524 | // Del1 |
| 3525 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3526 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3527 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3528 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3529 | |
| 3530 | // Del2 |
| 3531 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3532 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 3533 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 3534 | |
| 3535 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3536 | |
| 3537 | mainCtrl.VerifyCounterValues(t) |
| 3538 | } |
| 3539 | |
| 3540 | //----------------------------------------------------------------------------- |
| 3541 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 3542 | // |
| 3543 | // stub stub stub |
| 3544 | // +-------+ +-------+ +---------+ +---------+ |
| 3545 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3546 | // +-------+ +-------+ +---------+ +---------+ |
| 3547 | // | | | | |
| 3548 | // | | | | |
| 3549 | // | | | | |
| 3550 | // | | RESTSubReq1 | | |
| 3551 | // | |---------------->| | |
| 3552 | // | | | | |
| 3553 | // | | RESTSubResp1 | | |
| 3554 | // | |<----------------| | |
| 3555 | // | | | SubReq1 | |
| 3556 | // | | |------------->| |
| 3557 | // | RESTSubReq2 | | |
| 3558 | // |------------------------------>| | |
| 3559 | // | | | | |
| 3560 | // | RESTSubDelResp2 | | |
| 3561 | // |<------------------------------| | |
| 3562 | // | | | SubReq1 | |
| 3563 | // | | |------------->| |
| 3564 | // | | | | |
| 3565 | // | | | | |
| 3566 | // | | | SubDelReq | |
| 3567 | // | | |------------->| |
| 3568 | // | | | | |
| 3569 | // | | | SubDelResp | |
| 3570 | // | | |<-------------| |
| 3571 | // | | RESTNotif1 | | |
| 3572 | // | | unsuccess | | |
| 3573 | // | |<----------------| | |
| 3574 | // | RESTNotif2 | | |
| 3575 | // | | unsuccess | | |
| 3576 | // |<------------------------------| | |
| 3577 | // | | | | |
| 3578 | // | | RESTSubDelReq1 | | |
| 3579 | // | |---------------->| | |
| 3580 | // | | | | |
| 3581 | // | | RESTSubDelResp1 | | |
| 3582 | // | |<----------------| | |
| 3583 | // | | | | |
| 3584 | // | RESTSubDelReq2 | | |
| 3585 | // |------------------------------>| | |
| 3586 | // | | | | |
| 3587 | // | RESTSubDelResp2 | | |
| 3588 | // |<------------------------------| | |
| 3589 | // |
| 3590 | //----------------------------------------------------------------------------- |
| 3591 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 3592 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 3593 | |
| 3594 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3595 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3596 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3597 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3598 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3599 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3600 | Counter{cSubDelReqToE2, 1}, |
| 3601 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3602 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3603 | }) |
| 3604 | |
| 3605 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3606 | |
| 3607 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3608 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3609 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 3610 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 3611 | |
| 3612 | // Req2 |
| 3613 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3614 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3615 | params2.SetMeid("RAN_NAME_1") |
| 3616 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3617 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3618 | |
| 3619 | //Req1 (retransmitted) |
| 3620 | e2termConn1.RecvSubsReq(t) |
| 3621 | |
| 3622 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3623 | |
| 3624 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3625 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3626 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3627 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3628 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3629 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3630 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3631 | |
| 3632 | // Del1 |
| 3633 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3634 | |
| 3635 | // Del2 |
| 3636 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3637 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3638 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 3639 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3640 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3641 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3642 | |
| 3643 | mainCtrl.VerifyCounterValues(t) |
| 3644 | } |
| 3645 | |
| 3646 | //----------------------------------------------------------------------------- |
| 3647 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 3648 | // |
| 3649 | // stub stub stub |
| 3650 | // +-------+ +-------+ +---------+ +---------+ |
| 3651 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3652 | // +-------+ +-------+ +---------+ +---------+ |
| 3653 | // | | | | |
| 3654 | // | | | | |
| 3655 | // | | | | |
| 3656 | // | | RESTSubReq1 | | |
| 3657 | // | |---------------->| | |
| 3658 | // | | | | |
| 3659 | // | | RESTSubResp1 | | |
| 3660 | // | |<----------------| | |
| 3661 | // | | | SubReq1 | |
| 3662 | // | | |------------->| |
| 3663 | // | RESTSubReq2 | | |
| 3664 | // |------------------------------>| | |
| 3665 | // | | | | |
| 3666 | // | RESTSubDelResp2 | | |
| 3667 | // |<------------------------------| | |
| 3668 | // | | | SubFail1 | |
| 3669 | // | | |<-------------| |
| 3670 | // | | | | |
| 3671 | // | | RESTNotif1 | | |
| 3672 | // | | unsuccess | | |
| 3673 | // | |<----------------| | |
| 3674 | // | RESTNotif2 | | |
| 3675 | // | | unsuccess | | |
| 3676 | // |<------------------------------| | |
| 3677 | // | | | SubDelReq | |
| 3678 | // | | |------------->| |
| 3679 | // | | | SubDelResp | |
| 3680 | // | | |<-------------| |
| 3681 | // | | | | |
| 3682 | // | | RESTSubDelReq1 | | |
| 3683 | // | |---------------->| | |
| 3684 | // | | | | |
| 3685 | // | | RESTSubDelResp1 | | |
| 3686 | // | |<----------------| | |
| 3687 | // | | | | |
| 3688 | // | RESTSubDelReq2 | | |
| 3689 | // |------------------------------>| | |
| 3690 | // | | | | |
| 3691 | // | RESTSubDelResp2 | | |
| 3692 | // |<------------------------------| | |
| 3693 | // |
| 3694 | //----------------------------------------------------------------------------- |
| 3695 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 3696 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 3697 | |
| 3698 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3699 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3700 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3701 | Counter{cSubReqToE2, 1}, |
| 3702 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3703 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3704 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3705 | Counter{cSubDelReqToE2, 1}, |
| 3706 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3707 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3708 | }) |
| 3709 | |
| 3710 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3711 | |
| 3712 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3713 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3714 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3715 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3716 | |
| 3717 | // Req2 |
| 3718 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3719 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3720 | params2.SetMeid("RAN_NAME_1") |
| 3721 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3722 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3723 | |
| 3724 | // E2t: send SubsFail (first) |
| 3725 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3726 | fparams1.Set(crereq1) |
| 3727 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3728 | |
| 3729 | // E2t: internal delete |
| 3730 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3731 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3732 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3733 | |
| 3734 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3735 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3736 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3737 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 3738 | |
| 3739 | // Del1 |
| 3740 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3741 | |
| 3742 | // Del2 |
| 3743 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3744 | |
| 3745 | //Wait that subs is cleaned |
| 3746 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 3747 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3748 | |
| 3749 | mainCtrl.VerifyCounterValues(t) |
| 3750 | } |
| 3751 | |
| 3752 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 3753 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3754 | |
| 3755 | // Init counter check |
| 3756 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3757 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3758 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3759 | Counter{cSubReqToE2, 1}, |
| 3760 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3761 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3762 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3763 | Counter{cSubDelReqToE2, 1}, |
| 3764 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3765 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3766 | }) |
| 3767 | |
| 3768 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3769 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3770 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3771 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3772 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3773 | |
| 3774 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3775 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3776 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3777 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3778 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 3779 | |
| 3780 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3781 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3782 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3783 | |
| 3784 | // Wait that subs is cleaned |
| 3785 | waitSubsCleanup(t, e2SubsId, 10) |
| 3786 | mainCtrl.VerifyCounterValues(t) |
| 3787 | } |
| 3788 | |
| 3789 | //----------------------------------------------------------------------------- |
| 3790 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 3791 | // |
| 3792 | // stub stub |
| 3793 | // +-------+ +---------+ +---------+ |
| 3794 | // | xapp | | submgr | | e2term | |
| 3795 | // +-------+ +---------+ +---------+ |
| 3796 | // | | | |
| 3797 | // | RESTSubReq | | |
| 3798 | // |---------------->| | |
| 3799 | // | | | |
| 3800 | // | RESTSubResp | | |
| 3801 | // |<----------------| | |
| 3802 | // | | SubReq | |
| 3803 | // | |------------->| |
| 3804 | // | | | |
| 3805 | // | | SubResp | |
| 3806 | // | |<-------------| |
| 3807 | // | | | |
| 3808 | // | RESTNotif | | |
| 3809 | // |<----------------| | |
| 3810 | // | | | |
| 3811 | // | RESTSubReq | | |
| 3812 | // |---------------->| | |
| 3813 | // | | | |
| 3814 | // | RESTSubResp | | |
| 3815 | // |<----------------| | |
| 3816 | // | | SubReq | |
| 3817 | // | |------------->| |
| 3818 | // | | | |
| 3819 | // | | SubResp | |
| 3820 | // | |<-------------| |
| 3821 | // | | | |
| 3822 | // | RESTNotif | | |
| 3823 | // |<----------------| | |
| 3824 | // | | | |
| 3825 | // | RESTSubDelReq | | |
| 3826 | // |---------------->| | |
| 3827 | // | | | |
| 3828 | // | | SubDelReq | |
| 3829 | // | |------------->| |
| 3830 | // | | | |
| 3831 | // | | SubDelResp | |
| 3832 | // | |<-------------| |
| 3833 | // | | | |
| 3834 | // | RESTSubDelResp | | |
| 3835 | // |<----------------| | |
| 3836 | // |
| 3837 | //----------------------------------------------------------------------------- |
| 3838 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 3839 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3840 | |
| 3841 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3842 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3843 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3844 | Counter{cSubReqToE2, 2}, |
| 3845 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3846 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3847 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3848 | Counter{cSubDelReqToE2, 1}, |
| 3849 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3850 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3851 | }) |
| 3852 | |
| 3853 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3854 | |
| 3855 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3856 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3857 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3858 | |
| 3859 | // Policy change |
| 3860 | instanceId := int64(e2SubsId) |
| 3861 | // GetRESTSubsReqPolicyParams sets some coutners on tc side. |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3862 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3863 | params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId |
| 3864 | params.SetTimeToWait("w200ms") |
| 3865 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3866 | |
| 3867 | // Del |
| 3868 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3869 | |
| 3870 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3871 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3872 | |
| 3873 | // Wait that subs is cleaned |
| 3874 | waitSubsCleanup(t, e2SubsId, 10) |
| 3875 | mainCtrl.VerifyCounterValues(t) |
| 3876 | } |
| 3877 | |
| 3878 | //----------------------------------------------------------------------------- |
| 3879 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 3880 | // |
| 3881 | // stub stub stub |
| 3882 | // +-------+ +---------+ +---------+ +---------+ |
| 3883 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 3884 | // +-------+ +---------+ +---------+ +---------+ |
| 3885 | // | | | | |
| 3886 | // | | | | |
| 3887 | // | | | | |
| 3888 | // | RESTSubReq1 | | | |
| 3889 | // |---------------->| | | |
| 3890 | // | | | | |
| 3891 | // | RESTSubResp1 | | | |
| 3892 | // |<----------------| | | |
| 3893 | // | | SubReq1 | | |
| 3894 | // | |------------->| | |
| 3895 | // | | | | |
| 3896 | // | RESTSubReq2 | | | |
| 3897 | // |---------------->| | | |
| 3898 | // | | | | |
| 3899 | // | RESTSubResp2 | | | |
| 3900 | // |<----------------| | | |
| 3901 | // | | SubReq2 | | |
| 3902 | // | |---------------------------->| |
| 3903 | // | | | | |
| 3904 | // | | SubResp1 | | |
| 3905 | // | |<-------------| | |
| 3906 | // | RESTNotif1 | | | |
| 3907 | // |<----------------| | | |
| 3908 | // | | SubResp2 | | |
| 3909 | // | |<----------------------------| |
| 3910 | // | RESTNotif2 | | | |
| 3911 | // |<----------------| | | |
| 3912 | // | | | | |
| 3913 | // | [SUBS 1 DELETE] | | |
| 3914 | // | | | | |
| 3915 | // | [SUBS 2 DELETE] | | |
| 3916 | // | | | | |
| 3917 | // |
| 3918 | //----------------------------------------------------------------------------- |
| 3919 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 3920 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 3921 | |
| 3922 | // Init counter check |
| 3923 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3924 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3925 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3926 | Counter{cSubReqToE2, 2}, |
| 3927 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 3928 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3929 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3930 | Counter{cSubDelReqToE2, 2}, |
| 3931 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3932 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3933 | }) |
| 3934 | |
| 3935 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3936 | |
| 3937 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3938 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3939 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3940 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3941 | |
| 3942 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3943 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3944 | params.SetMeid("RAN_NAME_11") |
| 3945 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 3946 | // would not work as notification would not be received |
| 3947 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 3948 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 3949 | |
| 3950 | // Resp1 |
| 3951 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3952 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3953 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3954 | xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
| 3955 | |
| 3956 | // Resp2 |
| 3957 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3958 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 3959 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3960 | xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
| 3961 | |
| 3962 | // Delete1 |
| 3963 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3964 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3965 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3966 | |
| 3967 | // Wait that subs is cleaned |
| 3968 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3969 | |
| 3970 | // Delete2 |
| 3971 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 3972 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 3973 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 3974 | |
| 3975 | // Wait that subs is cleaned |
| 3976 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3977 | |
| 3978 | mainCtrl.VerifyCounterValues(t) |
| 3979 | } |
| 3980 | |
| 3981 | //----------------------------------------------------------------------------- |
| 3982 | // TestRESTSubReqAsn1EncodeFail |
| 3983 | // |
| 3984 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 3985 | // stub stub |
| 3986 | // +-------+ +---------+ +---------+ |
| 3987 | // | xapp | | submgr | | e2term | |
| 3988 | // +-------+ +---------+ +---------+ |
| 3989 | // | | | |
| 3990 | // | RESTSubReq | | |
| 3991 | // |---------------->| | |
| 3992 | // | | | |
| 3993 | // | RESTSubResp | | |
| 3994 | // |<----------------| | |
| 3995 | // | RESTSubDelReq | | |
| 3996 | // |---------------->| | |
| 3997 | // | RESTSubDelResp | | |
| 3998 | // | unsuccess | | |
| 3999 | // |<----------------| | |
| 4000 | // | | | |
| 4001 | // |
| 4002 | //----------------------------------------------------------------------------- |
| 4003 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4004 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4005 | |
| 4006 | xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") |
| 4007 | |
| 4008 | } |
| 4009 | |
| 4010 | //----------------------------------------------------------------------------- |
| 4011 | // TestRESTSubReqInsertAndSubDelOk |
| 4012 | // |
| 4013 | // stub stub |
| 4014 | // +-------+ +---------+ +---------+ |
| 4015 | // | xapp | | submgr | | e2term | |
| 4016 | // +-------+ +---------+ +---------+ |
| 4017 | // | | | |
| 4018 | // | RestSubReq | | |
| 4019 | // |---------------->| | |
| 4020 | // | | | |
| 4021 | // | RESTSubResp | | |
| 4022 | // |<----------------| | |
| 4023 | // | | | |
| 4024 | // | | SubReq | |
| 4025 | // | |------------->| |
| 4026 | // | | | |
| 4027 | // | | SubResp | |
| 4028 | // | |<-------------| |
| 4029 | // | RESTNotif | | |
| 4030 | // |<----------------| | |
| 4031 | // | ... | ... | |
| 4032 | // | | | |
| 4033 | // | RESTSubDelReq | | |
| 4034 | // |---------------->| | |
| 4035 | // | | | |
| 4036 | // | | SubDelReq | |
| 4037 | // | |------------->| |
| 4038 | // | | | |
| 4039 | // | | SubDelResp | |
| 4040 | // | |<-------------| |
| 4041 | // | | | |
| 4042 | // | RESTSubDelResp| | |
| 4043 | // |<----------------| | |
| 4044 | // |
| 4045 | //----------------------------------------------------------------------------- |
| 4046 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4047 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4048 | |
| 4049 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4050 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4051 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | Counter{cSubReqToE2, 1}, |
| 4053 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4054 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4055 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4056 | Counter{cSubDelReqToE2, 1}, |
| 4057 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4058 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4059 | }) |
| 4060 | |
| 4061 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4062 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4063 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4064 | params.SetSubActionTypes("insert") |
| 4065 | |
| 4066 | // Req |
| 4067 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4068 | |
| 4069 | // Del |
| 4070 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4071 | |
| 4072 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4073 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4074 | |
| 4075 | // Wait that subs is cleaned |
| 4076 | waitSubsCleanup(t, e2SubsId, 10) |
| 4077 | mainCtrl.VerifyCounterValues(t) |
| 4078 | } |
| 4079 | |
| 4080 | //----------------------------------------------------------------------------- |
| 4081 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4082 | // |
| 4083 | // stub stub |
| 4084 | // +-------+ +---------+ +---------+ |
| 4085 | // | xapp | | submgr | | e2term | |
| 4086 | // +-------+ +---------+ +---------+ |
| 4087 | // | | | |
| 4088 | // | RESTSubReq | | |
| 4089 | // |------------->| | |
| 4090 | // | | | |
| 4091 | // | | SubReq | |
| 4092 | // | |------------->| |
| 4093 | // | | | |
| 4094 | // | | SubResp | |
| 4095 | // | <----| |
| 4096 | // | | |
| 4097 | // | Submgr restart | |
| 4098 | // | | |
| 4099 | // | | | |
| 4100 | // | | SubDelReq | |
| 4101 | // | |------------->| |
| 4102 | // | | | |
| 4103 | // | | SubDelResp | |
| 4104 | // | |<-------------| |
| 4105 | // | | | |
| 4106 | // |
| 4107 | //----------------------------------------------------------------------------- |
| 4108 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4109 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4110 | |
| 4111 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4112 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4113 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4114 | Counter{cSubReqToE2, 1}, |
| 4115 | Counter{cSubDelReqFromXapp, 1}, |
| 4116 | Counter{cSubDelReqToE2, 1}, |
| 4117 | Counter{cSubDelRespFromE2, 1}, |
| 4118 | }) |
| 4119 | |
| 4120 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4121 | |
| 4122 | // Remove possible existing subscription |
| 4123 | mainCtrl.removeExistingSubscriptions(t) |
| 4124 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4125 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4126 | |
| 4127 | //Req |
| 4128 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4129 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4130 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4131 | |
| 4132 | e2termConn1.RecvSubsReq(t) |
| 4133 | |
| 4134 | mainCtrl.SetResetTestFlag(t, false) |
| 4135 | |
| 4136 | mainCtrl.SimulateRestart(t) |
| 4137 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4138 | |
| 4139 | //Del |
| 4140 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4141 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4142 | |
| 4143 | xappConn1.TestMsgChanEmpty(t) |
| 4144 | xappConn2.TestMsgChanEmpty(t) |
| 4145 | e2termConn1.TestMsgChanEmpty(t) |
| 4146 | mainCtrl.wait_registry_empty(t, 10) |
| 4147 | |
| 4148 | mainCtrl.VerifyCounterValues(t) |
| 4149 | } |
| 4150 | |
| 4151 | //----------------------------------------------------------------------------- |
| 4152 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 4153 | // |
| 4154 | // stub stub |
| 4155 | // +-------+ +---------+ +---------+ |
| 4156 | // | xapp | | submgr | | e2term | |
| 4157 | // +-------+ +---------+ +---------+ |
| 4158 | // | | | |
| 4159 | // | RESTSubReq | | |
| 4160 | // |---------------->| | |
| 4161 | // | | | |
| 4162 | // | RESTSubResp | | |
| 4163 | // |<----------------| | |
| 4164 | // | | SubReq | |
| 4165 | // | |------------->| |
| 4166 | // | | | |
| 4167 | // | | SubResp | |
| 4168 | // | |<-------------| |
| 4169 | // | | | |
| 4170 | // | RESTNotif | | |
| 4171 | // |<----------------| | |
| 4172 | // | | | |
| 4173 | // | | |
| 4174 | // | Submgr restart | |
| 4175 | // | | | |
| 4176 | // | RESTSubDelReq | | |
| 4177 | // |---------------->| | |
| 4178 | // | | | |
| 4179 | // | | SubDelReq | |
| 4180 | // | |------------->| |
| 4181 | // | | | |
| 4182 | // | | SubDelResp | |
| 4183 | // | |<-------------| |
| 4184 | // | | | |
| 4185 | // | RESTSubDelResp | | |
| 4186 | // |<----------------| | |
| 4187 | // |
| 4188 | //----------------------------------------------------------------------------- |
| 4189 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4190 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4191 | |
| 4192 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4193 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4194 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4195 | Counter{cSubReqToE2, 1}, |
| 4196 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4197 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4198 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4199 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4200 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4201 | }) |
| 4202 | |
| 4203 | // Remove possible existing subscription |
| 4204 | mainCtrl.removeExistingSubscriptions(t) |
| 4205 | |
| 4206 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4207 | |
| 4208 | // Create subscription |
| 4209 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4210 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4211 | |
| 4212 | // Check subscription |
| 4213 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4214 | |
| 4215 | // When SDL support for the REST Interface is added |
| 4216 | // the submgr restart statement below should be removed |
| 4217 | // from the comment. |
| 4218 | |
| 4219 | // mainCtrl.SimulateRestart(t) |
| 4220 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4221 | |
| 4222 | // Check subscription |
| 4223 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4224 | |
| 4225 | // Delete subscription |
| 4226 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4227 | |
| 4228 | //Wait that subs is cleaned |
| 4229 | waitSubsCleanup(t, e2SubsId, 10) |
| 4230 | |
| 4231 | mainCtrl.VerifyCounterValues(t) |
| 4232 | } |
| 4233 | |
| 4234 | //----------------------------------------------------------------------------- |
| 4235 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4236 | // |
| 4237 | // stub stub |
| 4238 | // +-------+ +-------+ +---------+ +---------+ |
| 4239 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4240 | // +-------+ +-------+ +---------+ +---------+ |
| 4241 | // | | | | |
| 4242 | // | | RESTSubReq1 | | |
| 4243 | // | |---------------->| | |
| 4244 | // | | | | |
| 4245 | // | | RESTSubResp1 | | |
| 4246 | // | |<----------------| | |
| 4247 | // | | | | |
| 4248 | // | | | SubReq1 | |
| 4249 | // | | |------------->| |
| 4250 | // | | | SubResp1 | |
| 4251 | // | | |<-------------| |
| 4252 | // | | RESTNotif1 | | |
| 4253 | // | |<----------------| | |
| 4254 | // | | | | |
| 4255 | // | RESTSubReq2 | | |
| 4256 | // |------------------------------>| | |
| 4257 | // | | | | |
| 4258 | // | RESTSubResp2 | | |
| 4259 | // |<------------------------------| | |
| 4260 | // | | | | |
| 4261 | // | | RESTNotif2 | | |
| 4262 | // |<------------------------------| | |
| 4263 | // | | | | |
| 4264 | // | | Submgr restart | |
| 4265 | // | | | | |
| 4266 | // | | RESTSubDelReq1 | | |
| 4267 | // | |---------------->| | |
| 4268 | // | | | | |
| 4269 | // | | RESTSubDelResp1 | | |
| 4270 | // | |<----------------| | |
| 4271 | // | | | | |
| 4272 | // | | Submgr restart | |
| 4273 | // | | | | |
| 4274 | // | RESTSubDelReq2 | | |
| 4275 | // |------------------------------>| | |
| 4276 | // | | | | |
| 4277 | // | RESTSubDelResp2 | | |
| 4278 | // |<------------------------------| | |
| 4279 | // | | | | |
| 4280 | // | | | SubDelReq2 | |
| 4281 | // | | |------------->| |
| 4282 | // | | | | |
| 4283 | // | | | SubDelResp2 | |
| 4284 | // | | |<-------------| |
| 4285 | // | | | | |
| 4286 | // |
| 4287 | //----------------------------------------------------------------------------- |
| 4288 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4289 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4290 | |
| 4291 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4292 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4293 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4294 | Counter{cSubReqToE2, 1}, |
| 4295 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4296 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4297 | Counter{cMergedSubscriptions, 1}, |
| 4298 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4299 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4300 | Counter{cSubDelReqToE2, 1}, |
| 4301 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4302 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4303 | }) |
| 4304 | |
| 4305 | // Remove possible existing subscription |
| 4306 | mainCtrl.removeExistingSubscriptions(t) |
| 4307 | |
| 4308 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4309 | |
| 4310 | // Create subscription 1 |
| 4311 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4312 | xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
| 4313 | |
| 4314 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4315 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4316 | params.SetMeid("RAN_NAME_1") |
| 4317 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4318 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
| 4319 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4320 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4321 | e2SubsId2 := <-xappConn2.RESTNotification |
| 4322 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 4323 | |
| 4324 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4325 | |
| 4326 | // When SDL support for the REST Interface is added |
| 4327 | // the submgr restart statement below should be removed |
| 4328 | // from the comment. |
| 4329 | |
| 4330 | // mainCtrl.SimulateRestart(t) |
| 4331 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4332 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4333 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 4334 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4335 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4336 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4337 | |
| 4338 | // When SDL support for the REST Interface is added |
| 4339 | // the submgr restart statement below should be removed |
| 4340 | // from the comment. |
| 4341 | |
| 4342 | // mainCtrl.SimulateRestart(t) |
| 4343 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4344 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4345 | |
| 4346 | // Delete subscription 2 |
| 4347 | deleteXapp2Subscription(t, &restSubId2) |
| 4348 | |
| 4349 | //Wait that subs is cleaned |
| 4350 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4351 | |
| 4352 | mainCtrl.VerifyCounterValues(t) |
| 4353 | } |
| 4354 | |
| 4355 | //----------------------------------------------------------------------------- |
| 4356 | // TestRESTReportSubReqAndSubDelOk |
| 4357 | // |
| 4358 | // stub stub |
| 4359 | // +-------+ +---------+ +---------+ |
| 4360 | // | xapp | | submgr | | e2term | |
| 4361 | // +-------+ +---------+ +---------+ |
| 4362 | // | | | |
| 4363 | // | RestSubReq | | |
| 4364 | // |---------------->| | |
| 4365 | // | | | |
| 4366 | // | RESTSubResp | | |
| 4367 | // |<----------------| | |
| 4368 | // | | | |
| 4369 | // | | SubReq | |
| 4370 | // | |------------->| |
| 4371 | // | | | |
| 4372 | // | | SubResp | |
| 4373 | // | |<-------------| |
| 4374 | // | RESTNotif | | |
| 4375 | // |<----------------| | |
| 4376 | // | | SubReq | |
| 4377 | // | |------------->| |
| 4378 | // | | | |
| 4379 | // | | SubResp | |
| 4380 | // | |<-------------| |
| 4381 | // | RESTNotif | | |
| 4382 | // |<----------------| | |
| 4383 | // | ... | ... | |
| 4384 | // | | | |
| 4385 | // | | | |
| 4386 | // | RESTSubDelReq | | |
| 4387 | // |---------------->| | |
| 4388 | // | | | |
| 4389 | // | | SubDelReq | |
| 4390 | // | |------------->| |
| 4391 | // | | | |
| 4392 | // | | SubDelResp | |
| 4393 | // | |<-------------| |
| 4394 | // | | | |
| 4395 | // | RESTSubDelResp| | |
| 4396 | // |<----------------| | |
| 4397 | // |
| 4398 | //----------------------------------------------------------------------------- |
| 4399 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 4400 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
| 4401 | subReqCount := 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4402 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4403 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4404 | } |
| 4405 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4406 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4407 | xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4408 | |
| 4409 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4410 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4411 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4412 | |
| 4413 | var e2SubsId []uint32 |
| 4414 | for i := 0; i < subReqCount; i++ { |
| 4415 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4416 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4417 | |
| 4418 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4419 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4420 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4421 | e2SubsId = append(e2SubsId, instanceId) |
| 4422 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4423 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 4424 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 4425 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 4426 | |
| 4427 | } |
| 4428 | |
| 4429 | // Del |
| 4430 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4431 | |
| 4432 | for i := 0; i < subReqCount; i++ { |
| 4433 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4434 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4435 | } |
| 4436 | |
| 4437 | // Wait that subs is cleaned |
| 4438 | for i := 0; i < subReqCount; i++ { |
| 4439 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4440 | } |
| 4441 | |
| 4442 | xappConn1.TestMsgChanEmpty(t) |
| 4443 | e2termConn1.TestMsgChanEmpty(t) |
| 4444 | mainCtrl.wait_registry_empty(t, 10) |
| 4445 | } |
| 4446 | |
| 4447 | /* |
| 4448 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 4449 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 4450 | |
| 4451 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4452 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4453 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4454 | |
| 4455 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4456 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4457 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4458 | } |
| 4459 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4460 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4461 | xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4462 | |
| 4463 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4464 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4465 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4466 | //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) |
| 4468 | |
| 4469 | var e2SubsId []uint32 |
| 4470 | for i := 0; i < subReqCount; i++ { |
| 4471 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4472 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4473 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4474 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4475 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4476 | e2SubsId = append(e2SubsId, instanceId) |
| 4477 | } |
| 4478 | |
| 4479 | // Del |
| 4480 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4481 | |
| 4482 | for i := 0; i < subReqCount; i++ { |
| 4483 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4484 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4485 | } |
| 4486 | |
| 4487 | // Wait that subs is cleaned |
| 4488 | for i := 0; i < subReqCount; i++ { |
| 4489 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4490 | } |
| 4491 | xappConn1.TestMsgChanEmpty(t) |
| 4492 | e2termConn1.TestMsgChanEmpty(t) |
| 4493 | mainCtrl.wait_registry_empty(t, 10) |
| 4494 | } |
| 4495 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4496 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 4497 | |
| 4498 | subReqCount := 2 |
| 4499 | |
| 4500 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4501 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4502 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4503 | Counter{cSubReqToE2, 2}, |
| 4504 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4505 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4506 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4507 | Counter{cSubDelReqToE2, 2}, |
| 4508 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4509 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4510 | }) |
| 4511 | |
| 4512 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4513 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4514 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4515 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4516 | |
| 4517 | assert.Equal(t, len(e2SubsIds), 2) |
| 4518 | |
| 4519 | // Del |
| 4520 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4521 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4522 | |
| 4523 | xappConn1.TestMsgChanEmpty(t) |
| 4524 | e2termConn1.TestMsgChanEmpty(t) |
| 4525 | mainCtrl.wait_registry_empty(t, 10) |
| 4526 | |
| 4527 | mainCtrl.VerifyCounterValues(t) |
| 4528 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4529 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 4530 | |
| 4531 | subReqCount := 19 |
| 4532 | |
| 4533 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4534 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4535 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | Counter{cSubReqToE2, 19}, |
| 4537 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4538 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4539 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | Counter{cSubDelReqToE2, 19}, |
| 4541 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4542 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | }) |
| 4544 | |
| 4545 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4546 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4547 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4548 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4549 | |
| 4550 | assert.Equal(t, len(e2SubsIds), 19) |
| 4551 | |
| 4552 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4553 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4554 | |
| 4555 | xappConn1.TestMsgChanEmpty(t) |
| 4556 | e2termConn1.TestMsgChanEmpty(t) |
| 4557 | mainCtrl.wait_registry_empty(t, 10) |
| 4558 | |
| 4559 | mainCtrl.VerifyCounterValues(t) |
| 4560 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4561 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 4562 | |
| 4563 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4564 | |
| 4565 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4566 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4567 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4568 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4569 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4570 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4571 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4572 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4573 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4574 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4575 | }) |
| 4576 | |
| 4577 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4578 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4579 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4580 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4581 | |
| 4582 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4583 | |
| 4584 | // Del |
| 4585 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4586 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4587 | |
| 4588 | xappConn1.TestMsgChanEmpty(t) |
| 4589 | e2termConn1.TestMsgChanEmpty(t) |
| 4590 | mainCtrl.wait_registry_empty(t, 10) |
| 4591 | |
| 4592 | mainCtrl.VerifyCounterValues(t) |
| 4593 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4594 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4595 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 4596 | |
| 4597 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4598 | |
| 4599 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4600 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4601 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4603 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4604 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4605 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4606 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4607 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4608 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4609 | }) |
| 4610 | |
| 4611 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4612 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4613 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4614 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4615 | |
| 4616 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4617 | |
| 4618 | // Del |
| 4619 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4620 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4621 | |
| 4622 | xappConn1.TestMsgChanEmpty(t) |
| 4623 | e2termConn1.TestMsgChanEmpty(t) |
| 4624 | mainCtrl.wait_registry_empty(t, 10) |
| 4625 | |
| 4626 | mainCtrl.VerifyCounterValues(t) |
| 4627 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4628 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4629 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 4630 | |
| 4631 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4632 | |
| 4633 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4634 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4635 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4636 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4637 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4638 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4639 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4640 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4641 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4642 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4643 | }) |
| 4644 | |
| 4645 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4646 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4647 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4648 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4649 | |
| 4650 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4651 | |
| 4652 | // Del |
| 4653 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4654 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4655 | |
| 4656 | xappConn1.TestMsgChanEmpty(t) |
| 4657 | e2termConn1.TestMsgChanEmpty(t) |
| 4658 | mainCtrl.wait_registry_empty(t, 10) |
| 4659 | |
| 4660 | mainCtrl.VerifyCounterValues(t) |
| 4661 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4662 | |
| 4663 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 4664 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 4665 | |
| 4666 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4667 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4668 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4669 | Counter{cSubReqToE2, 2}, |
| 4670 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4671 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4672 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4673 | Counter{cSubDelReqToE2, 2}, |
| 4674 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4675 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4676 | }) |
| 4677 | |
| 4678 | // Req1 |
| 4679 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4680 | |
| 4681 | //Subs Create |
| 4682 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4683 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4684 | |
| 4685 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4686 | |
| 4687 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4688 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4689 | params.SetMeid("RAN_NAME_1") |
| 4690 | eventTriggerDefinition := "1234" |
| 4691 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 4692 | |
| 4693 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4694 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4695 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4696 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4697 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4698 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4699 | |
| 4700 | deleteXapp1Subscription(t, &restSubId1) |
| 4701 | deleteXapp2Subscription(t, &restSubId2) |
| 4702 | |
| 4703 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4704 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4705 | |
| 4706 | mainCtrl.VerifyCounterValues(t) |
| 4707 | |
| 4708 | } |
| 4709 | |
| 4710 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 4711 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 4712 | |
| 4713 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4714 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4715 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4716 | Counter{cSubReqToE2, 2}, |
| 4717 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4718 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4719 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4720 | Counter{cSubDelReqToE2, 2}, |
| 4721 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4722 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4723 | }) |
| 4724 | |
| 4725 | // Req1 |
| 4726 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4727 | |
| 4728 | //Subs Create |
| 4729 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4730 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4731 | |
| 4732 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4733 | |
| 4734 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4735 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4736 | params.SetMeid("RAN_NAME_1") |
| 4737 | |
| 4738 | actionId := int64(1) |
| 4739 | actionType := "report" |
| 4740 | actionDefinition := "56781" |
| 4741 | subsequestActionType := "continue" |
| 4742 | timeToWait := "w10ms" |
| 4743 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4744 | |
| 4745 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4746 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4747 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4748 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4749 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4750 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4751 | |
| 4752 | deleteXapp1Subscription(t, &restSubId1) |
| 4753 | deleteXapp2Subscription(t, &restSubId2) |
| 4754 | |
| 4755 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4756 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4757 | |
| 4758 | mainCtrl.VerifyCounterValues(t) |
| 4759 | |
| 4760 | } |
| 4761 | |
| 4762 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 4763 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 4764 | |
| 4765 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4766 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4767 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4768 | Counter{cSubReqToE2, 2}, |
| 4769 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4770 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4771 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4772 | Counter{cSubDelReqToE2, 2}, |
| 4773 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4774 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4775 | }) |
| 4776 | |
| 4777 | // Req1 |
| 4778 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4779 | |
| 4780 | //Subs Create |
| 4781 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4782 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4783 | |
| 4784 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4785 | |
| 4786 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4787 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4788 | params.SetMeid("RAN_NAME_1") |
| 4789 | params.SetSubActionIDs(int64(2)) |
| 4790 | |
| 4791 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4792 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4793 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4794 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4795 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4796 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4797 | |
| 4798 | deleteXapp1Subscription(t, &restSubId1) |
| 4799 | deleteXapp2Subscription(t, &restSubId2) |
| 4800 | |
| 4801 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4802 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4803 | |
| 4804 | mainCtrl.VerifyCounterValues(t) |
| 4805 | |
| 4806 | } |
| 4807 | |
| 4808 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 4809 | CaseBegin("TestRESTSubReqDiffActionType") |
| 4810 | |
| 4811 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4812 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4813 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4814 | Counter{cSubReqToE2, 2}, |
| 4815 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4816 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4817 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4818 | Counter{cSubDelReqToE2, 2}, |
| 4819 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4820 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4821 | }) |
| 4822 | |
| 4823 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4824 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4825 | |
| 4826 | //Subs Create |
| 4827 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4828 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4829 | |
| 4830 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4831 | |
| 4832 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4833 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4834 | params.SetMeid("RAN_NAME_1") |
| 4835 | |
| 4836 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4837 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4838 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4839 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4840 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4841 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4842 | |
| 4843 | deleteXapp1Subscription(t, &restSubId1) |
| 4844 | deleteXapp2Subscription(t, &restSubId2) |
| 4845 | |
| 4846 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4847 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4848 | |
| 4849 | mainCtrl.VerifyCounterValues(t) |
| 4850 | |
| 4851 | } |
| 4852 | |
| 4853 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 4854 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 4855 | |
| 4856 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4857 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4858 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4859 | Counter{cSubReqToE2, 2}, |
| 4860 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4861 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4862 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4863 | Counter{cSubDelReqToE2, 2}, |
| 4864 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4865 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4866 | }) |
| 4867 | |
| 4868 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4869 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4870 | |
| 4871 | //Subs Create |
| 4872 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4873 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4874 | |
| 4875 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4876 | |
| 4877 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4878 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4879 | params.SetMeid("RAN_NAME_1") |
| 4880 | |
| 4881 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4882 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4883 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4884 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4885 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4886 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4887 | |
| 4888 | deleteXapp1Subscription(t, &restSubId1) |
| 4889 | deleteXapp2Subscription(t, &restSubId2) |
| 4890 | |
| 4891 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4892 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4893 | |
| 4894 | mainCtrl.VerifyCounterValues(t) |
| 4895 | |
| 4896 | } |
| 4897 | |
| 4898 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 4899 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 4900 | |
| 4901 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4902 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4903 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4904 | Counter{cSubReqToE2, 2}, |
| 4905 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4906 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4907 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4908 | Counter{cSubDelReqToE2, 2}, |
| 4909 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4910 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4911 | }) |
| 4912 | |
| 4913 | // Req1 |
| 4914 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4915 | |
| 4916 | //Subs Create |
| 4917 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4918 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4919 | |
| 4920 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4921 | |
| 4922 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4923 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4924 | params.SetMeid("RAN_NAME_1") |
| 4925 | actionDefinition := "5678" |
| 4926 | params.SetSubActionDefinition(actionDefinition) |
| 4927 | |
| 4928 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4929 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4930 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4931 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4932 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4933 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4934 | |
| 4935 | deleteXapp1Subscription(t, &restSubId1) |
| 4936 | deleteXapp2Subscription(t, &restSubId2) |
| 4937 | |
| 4938 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4939 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4940 | |
| 4941 | mainCtrl.VerifyCounterValues(t) |
| 4942 | |
| 4943 | } |
| 4944 | |
| 4945 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 4946 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 4947 | |
| 4948 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4949 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4950 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4951 | Counter{cSubReqToE2, 2}, |
| 4952 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4953 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4954 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4955 | Counter{cSubDelReqToE2, 2}, |
| 4956 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4957 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4958 | }) |
| 4959 | |
| 4960 | // Req1 |
| 4961 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4962 | |
| 4963 | //Subs Create |
| 4964 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4965 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4966 | |
| 4967 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4968 | |
| 4969 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4970 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4971 | params.SetMeid("RAN_NAME_1") |
| 4972 | actionDefinition := "56782" |
| 4973 | params.SetSubActionDefinition(actionDefinition) |
| 4974 | |
| 4975 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4976 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4977 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4978 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4979 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4980 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4981 | |
| 4982 | deleteXapp1Subscription(t, &restSubId1) |
| 4983 | deleteXapp2Subscription(t, &restSubId2) |
| 4984 | |
| 4985 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4986 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4987 | |
| 4988 | mainCtrl.VerifyCounterValues(t) |
| 4989 | |
| 4990 | } |
| 4991 | |
| 4992 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 4993 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 4994 | |
| 4995 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4996 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 4997 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4998 | Counter{cSubReqToE2, 2}, |
| 4999 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 5000 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5001 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5002 | Counter{cSubDelReqToE2, 2}, |
| 5003 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5004 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5005 | }) |
| 5006 | |
| 5007 | // Req1 |
| 5008 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5009 | |
| 5010 | //Subs Create |
| 5011 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5012 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5013 | |
| 5014 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5015 | |
| 5016 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5017 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5018 | params.SetMeid("RAN_NAME_1") |
| 5019 | params.SetTimeToWait("w200ms") |
| 5020 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5021 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5022 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5023 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5024 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5025 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5026 | |
| 5027 | deleteXapp1Subscription(t, &restSubId1) |
| 5028 | deleteXapp2Subscription(t, &restSubId2) |
| 5029 | |
| 5030 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5031 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5032 | |
| 5033 | mainCtrl.VerifyCounterValues(t) |
| 5034 | |
| 5035 | } |
| 5036 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5037 | //----------------------------------------------------------------------------- |
| 5038 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5039 | // |
| 5040 | // stub stub |
| 5041 | // +-------+ +---------+ +---------+ |
| 5042 | // | xapp | | submgr | | e2term | |
| 5043 | // +-------+ +---------+ +---------+ |
| 5044 | // | | | |
| 5045 | // | RestSubReq | | |
| 5046 | // |---------------->| | |
| 5047 | // | | | |
| 5048 | // | RESTSubResp | | |
| 5049 | // |<----------------| | |
| 5050 | // | | | |
| 5051 | // | | SubReq | |
| 5052 | // | |------------->| |
| 5053 | // | | | |
| 5054 | // | | SubResp | ASN.1 decode fails |
| 5055 | // | |<-------------| |
| 5056 | // | | | |
| 5057 | // | | SubReq | |
| 5058 | // | |------------->| |
| 5059 | // | | | |
| 5060 | // | | SubFail | Duplicated action |
| 5061 | // | |<-------------| |
| 5062 | // | RESTNotif (fail)| | |
| 5063 | // |<----------------| | |
| 5064 | // | | SubDelReq | |
| 5065 | // | |------------->| |
| 5066 | // | | | |
| 5067 | // | | SubDelResp | |
| 5068 | // | |<-------------| |
| 5069 | // |
| 5070 | //----------------------------------------------------------------------------- |
| 5071 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
| 5072 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5073 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5074 | |
| 5075 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5076 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5077 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5078 | |
| 5079 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5080 | // Decode of this response fails which will result resending original request |
| 5081 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5082 | |
| 5083 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5084 | |
| 5085 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5086 | |
| 5087 | // Subscription already created in E2 Node. |
| 5088 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5089 | fparams.Set(crereq) |
| 5090 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5091 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5092 | |
| 5093 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5094 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5095 | |
| 5096 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5097 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5098 | |
| 5099 | // Wait that subs is cleaned |
| 5100 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5101 | |
| 5102 | xappConn1.TestMsgChanEmpty(t) |
| 5103 | e2termConn1.TestMsgChanEmpty(t) |
| 5104 | mainCtrl.wait_registry_empty(t, 10) |
| 5105 | } |
| 5106 | |
| 5107 | //----------------------------------------------------------------------------- |
| 5108 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5109 | // |
| 5110 | // stub stub |
| 5111 | // +-------+ +---------+ +---------+ |
| 5112 | // | xapp | | submgr | | e2term | |
| 5113 | // +-------+ +---------+ +---------+ |
| 5114 | // | | | |
| 5115 | // | RestSubReq | | |
| 5116 | // |---------------->| | |
| 5117 | // | | | |
| 5118 | // | RESTSubResp | | |
| 5119 | // |<----------------| | |
| 5120 | // | | | |
| 5121 | // | | SubReq | |
| 5122 | // | |------------->| |
| 5123 | // | | | |
| 5124 | // | | SubResp | Unknown instanceId |
| 5125 | // | |<-------------| |
| 5126 | // | | | |
| 5127 | // | | SubReq | |
| 5128 | // | |------------->| |
| 5129 | // | | | |
| 5130 | // | | SubFail | Duplicated action |
| 5131 | // | |<-------------| |
| 5132 | // | RESTNotif (fail)| | |
| 5133 | // |<----------------| | |
| 5134 | // | | SubDelReq | |
| 5135 | // | |------------->| |
| 5136 | // | | | |
| 5137 | // | | SubDelResp | |
| 5138 | // | |<-------------| |
| 5139 | // |
| 5140 | //----------------------------------------------------------------------------- |
| 5141 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
| 5142 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5143 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5144 | |
| 5145 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5146 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5147 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5148 | |
| 5149 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5150 | |
| 5151 | // Unknown instanceId in this response which will result resending original request |
| 5152 | orgInstanceId := crereq.RequestId.InstanceId |
| 5153 | crereq.RequestId.InstanceId = 0 |
| 5154 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5155 | |
| 5156 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5157 | |
| 5158 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5159 | |
| 5160 | // Subscription already created in E2 Node. |
| 5161 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5162 | fparams.Set(crereq) |
| 5163 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5164 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5165 | |
| 5166 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5167 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5168 | |
| 5169 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5170 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5171 | |
| 5172 | // Wait that subs is cleaned |
| 5173 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 5174 | |
| 5175 | xappConn1.TestMsgChanEmpty(t) |
| 5176 | e2termConn1.TestMsgChanEmpty(t) |
| 5177 | mainCtrl.wait_registry_empty(t, 10) |
| 5178 | } |
| 5179 | |
| 5180 | //----------------------------------------------------------------------------- |
| 5181 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 5182 | // |
| 5183 | // stub stub |
| 5184 | // +-------+ +---------+ +---------+ |
| 5185 | // | xapp | | submgr | | e2term | |
| 5186 | // +-------+ +---------+ +---------+ |
| 5187 | // | | | |
| 5188 | // | RestSubReq | | |
| 5189 | // |---------------->| | |
| 5190 | // | | | |
| 5191 | // | RESTSubResp | | |
| 5192 | // |<----------------| | |
| 5193 | // | | | |
| 5194 | // | | SubReq | |
| 5195 | // | |------------->| |
| 5196 | // | | | |
| 5197 | // | | SubResp | No transaction for the response |
| 5198 | // | |<-------------| |
| 5199 | // | | | |
| 5200 | // | | SubReq | |
| 5201 | // | |------------->| |
| 5202 | // | | | |
| 5203 | // | | SubFail | Duplicated action |
| 5204 | // | |<-------------| |
| 5205 | // | RESTNotif (fail)| | |
| 5206 | // |<----------------| | |
| 5207 | // | | SubDelReq | |
| 5208 | // | |------------->| |
| 5209 | // | | | |
| 5210 | // | | SubDelResp | |
| 5211 | // | |<-------------| |
| 5212 | // | | | |
| 5213 | // | | SubDelReq | |
| 5214 | // | |------------->| |
| 5215 | // | | | |
| 5216 | // | | SubDelResp | |
| 5217 | // | |<-------------| |
| 5218 | // |
| 5219 | //----------------------------------------------------------------------------- |
| 5220 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
| 5221 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 5222 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5223 | |
| 5224 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5225 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5226 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5227 | |
| 5228 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5229 | |
| 5230 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5231 | // No transaction exist for this response which will result resending original request |
| 5232 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5233 | |
| 5234 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5235 | |
| 5236 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5237 | |
| 5238 | // Subscription already created in E2 Node. |
| 5239 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5240 | fparams.Set(crereq) |
| 5241 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5242 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5243 | |
| 5244 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5245 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5246 | |
| 5247 | // Resending happens because there no transaction |
| 5248 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5249 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5250 | |
| 5251 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5252 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5253 | |
| 5254 | // Wait that subs is cleaned |
| 5255 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5256 | |
| 5257 | xappConn1.TestMsgChanEmpty(t) |
| 5258 | e2termConn1.TestMsgChanEmpty(t) |
| 5259 | mainCtrl.wait_registry_empty(t, 10) |
| 5260 | |
| 5261 | } |
| 5262 | |
| 5263 | //----------------------------------------------------------------------------- |
| 5264 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 5265 | // |
| 5266 | // stub stub |
| 5267 | // +-------+ +---------+ +---------+ |
| 5268 | // | xapp | | submgr | | e2term | |
| 5269 | // +-------+ +---------+ +---------+ |
| 5270 | // | | | |
| 5271 | // | RestSubReq | | |
| 5272 | // |---------------->| | |
| 5273 | // | | | |
| 5274 | // | RESTSubResp | | |
| 5275 | // |<----------------| | |
| 5276 | // | | | |
| 5277 | // | | SubReq | |
| 5278 | // | |------------->| |
| 5279 | // | | | |
| 5280 | // | | SubFail | ASN.1 decode fails |
| 5281 | // | |<-------------| |
| 5282 | // | | | |
| 5283 | // | | SubReq | |
| 5284 | // | |------------->| |
| 5285 | // | | | |
| 5286 | // | | SubFail | Duplicated action |
| 5287 | // | |<-------------| |
| 5288 | // | RESTNotif (fail)| | |
| 5289 | // |<----------------| | |
| 5290 | // | | SubDelReq | |
| 5291 | // | |------------->| |
| 5292 | // | | | |
| 5293 | // | | SubDelResp | |
| 5294 | // | |<-------------| |
| 5295 | // |
| 5296 | //----------------------------------------------------------------------------- |
| 5297 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
| 5298 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 5299 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5300 | |
| 5301 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5302 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5303 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5304 | |
| 5305 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5306 | |
| 5307 | // Decode of this response fails which will result resending original request |
| 5308 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 5309 | |
| 5310 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5311 | |
| 5312 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5313 | |
| 5314 | // Subscription already created in E2 Node. |
| 5315 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5316 | fparams.Set(crereq) |
| 5317 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5318 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5319 | |
| 5320 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5321 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5322 | |
| 5323 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5324 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5325 | |
| 5326 | // Wait that subs is cleaned |
| 5327 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5328 | |
| 5329 | xappConn1.TestMsgChanEmpty(t) |
| 5330 | e2termConn1.TestMsgChanEmpty(t) |
| 5331 | mainCtrl.wait_registry_empty(t, 10) |
| 5332 | } |
| 5333 | |
| 5334 | //----------------------------------------------------------------------------- |
| 5335 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5336 | // |
| 5337 | // stub stub |
| 5338 | // +-------+ +---------+ +---------+ |
| 5339 | // | xapp | | submgr | | e2term | |
| 5340 | // +-------+ +---------+ +---------+ |
| 5341 | // | | | |
| 5342 | // | RestSubReq | | |
| 5343 | // |---------------->| | |
| 5344 | // | | | |
| 5345 | // | RESTSubResp | | |
| 5346 | // |<----------------| | |
| 5347 | // | | | |
| 5348 | // | | SubReq | |
| 5349 | // | |------------->| |
| 5350 | // | | | |
| 5351 | // | | SubFail | Unknown instanceId |
| 5352 | // | |<-------------| |
| 5353 | // | | | |
| 5354 | // | | SubReq | |
| 5355 | // | |------------->| |
| 5356 | // | | | |
| 5357 | // | | SubFail | Duplicated action |
| 5358 | // | |<-------------| |
| 5359 | // | RESTNotif (fail)| | |
| 5360 | // |<----------------| | |
| 5361 | // | | SubDelReq | |
| 5362 | // | |------------->| |
| 5363 | // | | | |
| 5364 | // | | SubDelResp | |
| 5365 | // | |<-------------| |
| 5366 | // |
| 5367 | //----------------------------------------------------------------------------- |
| 5368 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
| 5369 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 5370 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5371 | |
| 5372 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5373 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5374 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5375 | |
| 5376 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5377 | |
| 5378 | // Unknown instanceId in this response which will result resending original request |
| 5379 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5380 | fparams.Set(crereq) |
| 5381 | fparams.Fail.RequestId.InstanceId = 0 |
| 5382 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5383 | |
| 5384 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5385 | |
| 5386 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5387 | |
| 5388 | // Subscription already created in E2 Node. |
| 5389 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5390 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5391 | |
| 5392 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5393 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5394 | |
| 5395 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5396 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5397 | |
| 5398 | // Wait that subs is cleaned |
| 5399 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5400 | |
| 5401 | xappConn1.TestMsgChanEmpty(t) |
| 5402 | e2termConn1.TestMsgChanEmpty(t) |
| 5403 | mainCtrl.wait_registry_empty(t, 10) |
| 5404 | } |
| 5405 | |
| 5406 | //----------------------------------------------------------------------------- |
| 5407 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 5408 | // |
| 5409 | // stub stub |
| 5410 | // +-------+ +---------+ +---------+ |
| 5411 | // | xapp | | submgr | | e2term | |
| 5412 | // +-------+ +---------+ +---------+ |
| 5413 | // | | | |
| 5414 | // | RestSubReq | | |
| 5415 | // |---------------->| | |
| 5416 | // | | | |
| 5417 | // | RESTSubResp | | |
| 5418 | // |<----------------| | |
| 5419 | // | | | |
| 5420 | // | | SubReq | |
| 5421 | // | |------------->| |
| 5422 | // | | | |
| 5423 | // | | SubFail | No transaction for the response |
| 5424 | // | |<-------------| |
| 5425 | // | | | |
| 5426 | // | | SubReq | |
| 5427 | // | |------------->| |
| 5428 | // | | | |
| 5429 | // | | SubFail | Duplicated action |
| 5430 | // | |<-------------| |
| 5431 | // | RESTNotif (fail)| | |
| 5432 | // |<----------------| | |
| 5433 | // | | SubDelReq | |
| 5434 | // | |------------->| |
| 5435 | // | | | |
| 5436 | // | | SubDelResp | |
| 5437 | // | |<-------------| |
| 5438 | // |
| 5439 | //----------------------------------------------------------------------------- |
| 5440 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
| 5441 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 5442 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5443 | |
| 5444 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5445 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5446 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5447 | |
| 5448 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5449 | |
| 5450 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5451 | |
| 5452 | // No transaction exist for this response which will result resending original request |
| 5453 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5454 | fparams.Set(crereq) |
| 5455 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5456 | |
| 5457 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5458 | |
| 5459 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5460 | |
| 5461 | // Subscription already created in E2 Node. |
| 5462 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5463 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5464 | |
| 5465 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5466 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5467 | |
| 5468 | // Resending happens because there no transaction |
| 5469 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5470 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5471 | |
| 5472 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5473 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5474 | |
| 5475 | // Wait that subs is cleaned |
| 5476 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5477 | |
| 5478 | xappConn1.TestMsgChanEmpty(t) |
| 5479 | e2termConn1.TestMsgChanEmpty(t) |
| 5480 | mainCtrl.wait_registry_empty(t, 10) |
| 5481 | } |
| 5482 | |
| 5483 | //----------------------------------------------------------------------------- |
| 5484 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 5485 | // |
| 5486 | // stub stub |
| 5487 | // +-------+ +---------+ +---------+ |
| 5488 | // | xapp | | submgr | | e2term | |
| 5489 | // +-------+ +---------+ +---------+ |
| 5490 | // | | | |
| 5491 | // | [SUBS CREATE] | |
| 5492 | // | | | |
| 5493 | // | | | |
| 5494 | // | RESTSubDelReq | | |
| 5495 | // |---------------->| | |
| 5496 | // | | | |
| 5497 | // | RESTSubDelResp | | |
| 5498 | // |<----------------| | |
| 5499 | // | | | |
| 5500 | // | | SubDelReq | |
| 5501 | // | |------------->| |
| 5502 | // | | | |
| 5503 | // | | SubDelResp | ASN.1 decode fails |
| 5504 | // | |<-------------| |
| 5505 | // | | | |
| 5506 | // | | SubDelReq | |
| 5507 | // | |------------->| |
| 5508 | // | | | |
| 5509 | // | | SubDelFail | Subscription does exist any more |
| 5510 | // | |<-------------| |
| 5511 | // | | | |
| 5512 | // |
| 5513 | //----------------------------------------------------------------------------- |
| 5514 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
| 5515 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
| 5516 | |
| 5517 | // Req |
| 5518 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5519 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5520 | |
| 5521 | // Del |
| 5522 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5523 | |
| 5524 | // E2t: Receive 1st SubsDelReq |
| 5525 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5526 | |
| 5527 | // Decode of this response fails which will result resending original request |
| 5528 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 5529 | |
| 5530 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5531 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5532 | |
| 5533 | // Subscription does not exist in in E2 Node. |
| 5534 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5535 | |
| 5536 | // Wait that subs is cleaned |
| 5537 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5538 | |
| 5539 | xappConn1.TestMsgChanEmpty(t) |
| 5540 | e2termConn1.TestMsgChanEmpty(t) |
| 5541 | mainCtrl.wait_registry_empty(t, 10) |
| 5542 | } |
| 5543 | |
| 5544 | //----------------------------------------------------------------------------- |
| 5545 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 5546 | // |
| 5547 | // stub stub |
| 5548 | // +-------+ +---------+ +---------+ |
| 5549 | // | xapp | | submgr | | e2term | |
| 5550 | // +-------+ +---------+ +---------+ |
| 5551 | // | | | |
| 5552 | // | [SUBS CREATE] | |
| 5553 | // | | | |
| 5554 | // | | | |
| 5555 | // | RESTSubDelReq | | |
| 5556 | // |---------------->| | |
| 5557 | // | | | |
| 5558 | // | RESTSubDelResp | | |
| 5559 | // |<----------------| | |
| 5560 | // | | | |
| 5561 | // | | SubDelReq | |
| 5562 | // | |------------->| |
| 5563 | // | | | |
| 5564 | // | | SubDelResp | Unknown instanceId |
| 5565 | // | |<-------------| |
| 5566 | // | | | |
| 5567 | // | | SubDelReq | |
| 5568 | // | |------------->| |
| 5569 | // | | | |
| 5570 | // | | SubDelFail | Subscription does exist any more |
| 5571 | // | |<-------------| |
| 5572 | // |
| 5573 | //----------------------------------------------------------------------------- |
| 5574 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
| 5575 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
| 5576 | |
| 5577 | // Req |
| 5578 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5579 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5580 | |
| 5581 | // Del |
| 5582 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5583 | |
| 5584 | // E2t: Receive 1st SubsDelReq |
| 5585 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5586 | |
| 5587 | // Unknown instanceId in this response which will result resending original request |
| 5588 | delreq.RequestId.InstanceId = 0 |
| 5589 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5590 | |
| 5591 | // E2t: Receive 2nd SubsDelReq |
| 5592 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5593 | |
| 5594 | // Subscription does not exist in in E2 Node. |
| 5595 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5596 | |
| 5597 | // Wait that subs is cleaned |
| 5598 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5599 | |
| 5600 | xappConn1.TestMsgChanEmpty(t) |
| 5601 | e2termConn1.TestMsgChanEmpty(t) |
| 5602 | mainCtrl.wait_registry_empty(t, 10) |
| 5603 | } |
| 5604 | |
| 5605 | //----------------------------------------------------------------------------- |
| 5606 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 5607 | // |
| 5608 | // stub stub |
| 5609 | // +-------+ +---------+ +---------+ |
| 5610 | // | xapp | | submgr | | e2term | |
| 5611 | // +-------+ +---------+ +---------+ |
| 5612 | // | | | |
| 5613 | // | [SUBS CREATE] | |
| 5614 | // | | | |
| 5615 | // | | | |
| 5616 | // | RESTSubDelReq | | |
| 5617 | // |---------------->| | |
| 5618 | // | | | |
| 5619 | // | RESTSubDelResp | | |
| 5620 | // |<----------------| | |
| 5621 | // | | | |
| 5622 | // | | SubDelReq | |
| 5623 | // | |------------->| |
| 5624 | // | | | |
| 5625 | // | | SubDelResp | No transaction for the response |
| 5626 | // | |<-------------| |
| 5627 | // | | | |
| 5628 | // | | SubDelReq | |
| 5629 | // | |------------->| |
| 5630 | // | | | |
| 5631 | // | | SubDelFail | Subscription does exist any more |
| 5632 | // | |<-------------| |
| 5633 | // |
| 5634 | //----------------------------------------------------------------------------- |
| 5635 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
| 5636 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
| 5637 | |
| 5638 | // Req |
| 5639 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5640 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5641 | |
| 5642 | // Del |
| 5643 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5644 | |
| 5645 | // E2t: Receive 1st SubsDelReq |
| 5646 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5647 | |
| 5648 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5649 | |
| 5650 | // No transaction exist for this response which will result resending original request |
| 5651 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5652 | |
| 5653 | // E2t: Receive 2nd SubsDelReq |
| 5654 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5655 | |
| 5656 | // Subscription does not exist in in E2 Node. |
| 5657 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5658 | |
| 5659 | // Wait that subs is cleaned |
| 5660 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5661 | |
| 5662 | xappConn1.TestMsgChanEmpty(t) |
| 5663 | e2termConn1.TestMsgChanEmpty(t) |
| 5664 | mainCtrl.wait_registry_empty(t, 10) |
| 5665 | } |
| 5666 | |
| 5667 | //----------------------------------------------------------------------------- |
| 5668 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 5669 | // |
| 5670 | // stub stub |
| 5671 | // +-------+ +---------+ +---------+ |
| 5672 | // | xapp | | submgr | | e2term | |
| 5673 | // +-------+ +---------+ +---------+ |
| 5674 | // | | | |
| 5675 | // | [SUBS CREATE] | |
| 5676 | // | | | |
| 5677 | // | | | |
| 5678 | // | RESTSubDelReq | | |
| 5679 | // |---------------->| | |
| 5680 | // | | | |
| 5681 | // | RESTSubDelResp | | |
| 5682 | // |<----------------| | |
| 5683 | // | | | |
| 5684 | // | | SubDelReq | |
| 5685 | // | |------------->| |
| 5686 | // | | | |
| 5687 | // | | SubDelFail | ASN.1 decode fails |
| 5688 | // | |<-------------| |
| 5689 | // | | | |
| 5690 | // | | SubDelReq | |
| 5691 | // | |------------->| |
| 5692 | // | | | |
| 5693 | // | | SubDelFail | Subscription does exist any more |
| 5694 | // | |<-------------| |
| 5695 | // |
| 5696 | //----------------------------------------------------------------------------- |
| 5697 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
| 5698 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
| 5699 | |
| 5700 | // Req |
| 5701 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5702 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5703 | |
| 5704 | // Del |
| 5705 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5706 | |
| 5707 | // E2t: Receive 1st SubsDelReq |
| 5708 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5709 | |
| 5710 | // Decode of this response fails which will result resending original request |
| 5711 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 5712 | |
| 5713 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5714 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5715 | |
| 5716 | // Subscription does not exist in in E2 Node. |
| 5717 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5718 | |
| 5719 | // Wait that subs is cleaned |
| 5720 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5721 | |
| 5722 | xappConn1.TestMsgChanEmpty(t) |
| 5723 | e2termConn1.TestMsgChanEmpty(t) |
| 5724 | mainCtrl.wait_registry_empty(t, 10) |
| 5725 | } |
| 5726 | |
| 5727 | //----------------------------------------------------------------------------- |
| 5728 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 5729 | // |
| 5730 | // stub stub |
| 5731 | // +-------+ +---------+ +---------+ |
| 5732 | // | xapp | | submgr | | e2term | |
| 5733 | // +-------+ +---------+ +---------+ |
| 5734 | // | | | |
| 5735 | // | [SUBS CREATE] | |
| 5736 | // | | | |
| 5737 | // | | | |
| 5738 | // | RESTSubDelReq | | |
| 5739 | // |---------------->| | |
| 5740 | // | | | |
| 5741 | // | RESTSubDelResp | | |
| 5742 | // |<----------------| | |
| 5743 | // | | | |
| 5744 | // | | SubDelReq | |
| 5745 | // | |------------->| |
| 5746 | // | | | |
| 5747 | // | | SubDelFail | Unknown instanceId |
| 5748 | // | |<-------------| |
| 5749 | // | | | |
| 5750 | // | | SubDelReq | |
| 5751 | // | |------------->| |
| 5752 | // | | | |
| 5753 | // | | SubDelFail | Subscription does exist any more |
| 5754 | // | |<-------------| |
| 5755 | // |
| 5756 | //----------------------------------------------------------------------------- |
| 5757 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
| 5758 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
| 5759 | |
| 5760 | // Req |
| 5761 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5762 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5763 | |
| 5764 | // Del |
| 5765 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5766 | |
| 5767 | // E2t: Receive 1st SubsDelReq |
| 5768 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5769 | |
| 5770 | // Unknown instanceId in this response which will result resending original request |
| 5771 | delreq.RequestId.InstanceId = 0 |
| 5772 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5773 | |
| 5774 | // E2t: Receive 2nd SubsDelReq |
| 5775 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5776 | |
| 5777 | // Subscription does not exist in in E2 Node. |
| 5778 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5779 | |
| 5780 | // Wait that subs is cleaned |
| 5781 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5782 | |
| 5783 | xappConn1.TestMsgChanEmpty(t) |
| 5784 | e2termConn1.TestMsgChanEmpty(t) |
| 5785 | mainCtrl.wait_registry_empty(t, 10) |
| 5786 | } |
| 5787 | |
| 5788 | //----------------------------------------------------------------------------- |
| 5789 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 5790 | // |
| 5791 | // stub stub |
| 5792 | // +-------+ +---------+ +---------+ |
| 5793 | // | xapp | | submgr | | e2term | |
| 5794 | // +-------+ +---------+ +---------+ |
| 5795 | // | | | |
| 5796 | // | [SUBS CREATE] | |
| 5797 | // | | | |
| 5798 | // | | | |
| 5799 | // | RESTSubDelReq | | |
| 5800 | // |---------------->| | |
| 5801 | // | | | |
| 5802 | // | RESTSubDelResp | | |
| 5803 | // |<----------------| | |
| 5804 | // | | | |
| 5805 | // | | SubDelReq | |
| 5806 | // | |------------->| |
| 5807 | // | | | |
| 5808 | // | | SubDelFail | No transaction for the response |
| 5809 | // | |<-------------| |
| 5810 | // | | | |
| 5811 | // | | SubDelReq | |
| 5812 | // | |------------->| |
| 5813 | // | | | |
| 5814 | // | | SubDelFail | Subscription does exist any more |
| 5815 | // | |<-------------| |
| 5816 | // |
| 5817 | //----------------------------------------------------------------------------- |
| 5818 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
| 5819 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
| 5820 | |
| 5821 | // Req |
| 5822 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5823 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5824 | |
| 5825 | // Del |
| 5826 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5827 | |
| 5828 | // E2t: Receive 1st SubsDelReq |
| 5829 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5830 | |
| 5831 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5832 | |
| 5833 | // No transaction exist for this response which will result resending original request |
| 5834 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5835 | |
| 5836 | // E2t: Receive 2nd SubsDelReq |
| 5837 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5838 | |
| 5839 | // Subscription does not exist in in E2 Node. |
| 5840 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5841 | |
| 5842 | // Wait that subs is cleaned |
| 5843 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5844 | |
| 5845 | xappConn1.TestMsgChanEmpty(t) |
| 5846 | e2termConn1.TestMsgChanEmpty(t) |
| 5847 | mainCtrl.wait_registry_empty(t, 10) |
| 5848 | } |
| 5849 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5850 | //----------------------------------------------------------------------------- |
| 5851 | // TestRESTSubReqFailAsn1PackSubReqError |
| 5852 | // |
| 5853 | // stub stub |
| 5854 | // +-------+ +---------+ +---------+ |
| 5855 | // | xapp | | submgr | | e2term | |
| 5856 | // +-------+ +---------+ +---------+ |
| 5857 | // | | | |
| 5858 | // | RESTSubReq | | |
| 5859 | // |---------------->| | |
| 5860 | // | | | |
| 5861 | // | RESTSubResp | | |
| 5862 | // |<----------------| | |
| 5863 | // | | | |
| 5864 | // | ASN.1 encode fails | |
| 5865 | // | | | |
| 5866 | // | | SubDelReq | |
| 5867 | // | |------------->| |
| 5868 | // | | | |
| 5869 | // | | SubDelFail | |
| 5870 | // | |<-------------| |
| 5871 | // | | | |
| 5872 | // | RESTNotif | | |
| 5873 | // | unsuccess | | |
| 5874 | // |<----------------| | |
| 5875 | // | | | |
| 5876 | // | [SUBS DELETE] | |
| 5877 | // | | | |
| 5878 | // |
| 5879 | //----------------------------------------------------------------------------- |
| 5880 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 5881 | |
| 5882 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5883 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 5884 | Counter{cRestSubRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5885 | Counter{cSubDelReqToE2, 1}, |
| 5886 | Counter{cSubDelFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame^] | 5887 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5888 | }) |
| 5889 | |
| 5890 | subReqCount := 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5891 | |
| 5892 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5893 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5894 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 5895 | |
| 5896 | // Req |
| 5897 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5898 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5899 | |
| 5900 | // E2t: Receive SubsDelReq |
| 5901 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5902 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5903 | |
| 5904 | // Subscription does not exist in in E2 Node. |
| 5905 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5906 | |
| 5907 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5908 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 5909 | |
| 5910 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 5911 | // Wait that subs is cleaned |
| 5912 | waitSubsCleanup(t, e2SubsId, 10) |
| 5913 | mainCtrl.VerifyCounterValues(t) |
| 5914 | } |
| 5915 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5916 | //////////////////////////////////////////////////////////////////////////////////// |
| 5917 | // Services for UT cases |
| 5918 | //////////////////////////////////////////////////////////////////////////////////// |
| 5919 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5920 | const host string = "localhost" |
| 5921 | |
| 5922 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 5923 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5924 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5925 | } |
| 5926 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 5927 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5928 | |
| 5929 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 5930 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 5931 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 5932 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 5933 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5934 | |
| 5935 | return restSubId, e2SubsId |
| 5936 | } |
| 5937 | |
| 5938 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 5939 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5940 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5941 | if meid != "" { |
| 5942 | params.SetMeid(meid) |
| 5943 | } |
| 5944 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 5945 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 5946 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 5947 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5948 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 5949 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5950 | |
| 5951 | return restSubId, e2SubsId |
| 5952 | } |
| 5953 | |
| 5954 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5955 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5956 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5957 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 5958 | |
| 5959 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5960 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5961 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5962 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5963 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5964 | |
| 5965 | return restSubId, e2SubsId |
| 5966 | } |
| 5967 | |
| 5968 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5969 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5970 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5971 | |
| 5972 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5973 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5974 | fparams1.Set(crereq1) |
| 5975 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5976 | |
| 5977 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5978 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5979 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5980 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5981 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 5982 | |
| 5983 | return restSubId, e2SubsId |
| 5984 | } |
| 5985 | |
| 5986 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 5987 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 5988 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 5989 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 5990 | } |
| 5991 | |
| 5992 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 5993 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 5994 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5995 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5996 | } |
| 5997 | |
| 5998 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 5999 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 6000 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6001 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6002 | } |
| 6003 | |
| 6004 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 6005 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6006 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 6007 | assert.Equal(t, resp[0].Meid, meid) |
| 6008 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 6009 | } |
| 6010 | |
| 6011 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 6012 | //Wait that subs is cleaned |
| 6013 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 6014 | |
| 6015 | xappConn1.TestMsgChanEmpty(t) |
| 6016 | xappConn2.TestMsgChanEmpty(t) |
| 6017 | e2termConn1.TestMsgChanEmpty(t) |
| 6018 | mainCtrl.wait_registry_empty(t, timeout) |
| 6019 | } |
| 6020 | |
| 6021 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 6022 | |
| 6023 | var e2SubsId []uint32 |
| 6024 | |
| 6025 | for i := 0; i < count; i++ { |
| 6026 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 6027 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 6028 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6029 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 6030 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6031 | e2SubsId = append(e2SubsId, instanceId) |
| 6032 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 6033 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 6034 | <-time.After(100 * time.Millisecond) |
| 6035 | } |
| 6036 | return e2SubsId |
| 6037 | } |
| 6038 | |
| 6039 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 6040 | |
| 6041 | for i := 0; i < len(e2SubsIds); i++ { |
| 6042 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 6043 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6044 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6045 | <-time.After(1 * time.Second) |
| 6046 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 6047 | <-time.After(100 * time.Millisecond) |
| 6048 | } |
| 6049 | |
| 6050 | // Wait that subs is cleaned |
| 6051 | for i := 0; i < len(e2SubsIds); i++ { |
| 6052 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 6053 | } |
| 6054 | |
| 6055 | } |