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}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2405 | Counter{cRouteCreateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2406 | Counter{cRestSubRespToXapp, 1}, |
| 2407 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2408 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2409 | }) |
| 2410 | |
| 2411 | const subReqCount int = 1 |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2412 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2413 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2414 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2415 | |
| 2416 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2417 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2418 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2419 | xappConn1.ExpectRESTNotification(t, restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2420 | waiter.WaitResult(t) |
| 2421 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2422 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2423 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2424 | |
| 2425 | // Del |
| 2426 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2427 | |
| 2428 | // Wait that subs is cleaned |
| 2429 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2430 | waitSubsCleanup(t, e2SubsId, 10) |
| 2431 | mainCtrl.VerifyCounterValues(t) |
| 2432 | } |
| 2433 | |
| 2434 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2435 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2436 | |
| 2437 | //Init counter check |
| 2438 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2439 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2440 | Counter{cSubReqToE2, 1}, |
| 2441 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2442 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2443 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2444 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2445 | Counter{cSubDelReqToE2, 1}, |
| 2446 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2447 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2448 | }) |
| 2449 | |
| 2450 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2451 | |
| 2452 | //Subs Create |
| 2453 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2454 | |
| 2455 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2456 | |
| 2457 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2458 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2459 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2460 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2461 | params.SetMeid("RAN_NAME_1") |
| 2462 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2463 | xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) |
| 2464 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 2465 | waiter.WaitResult(t) |
| 2466 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2467 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2468 | |
| 2469 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2470 | |
| 2471 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2472 | |
| 2473 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2474 | //Wait that subs is cleaned |
| 2475 | waitSubsCleanup(t, e2SubsId, 10) |
| 2476 | |
| 2477 | mainCtrl.VerifyCounterValues(t) |
| 2478 | } |
| 2479 | |
| 2480 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2481 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2482 | |
| 2483 | // Init counter check |
| 2484 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2485 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2486 | Counter{cSubReqToE2, 1}, |
| 2487 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2488 | Counter{cRestSubRespToXapp, 1}, |
| 2489 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2490 | Counter{cRouteDeleteFail, 1}, |
| 2491 | Counter{cSubDelReqToE2, 1}, |
| 2492 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2493 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2494 | }) |
| 2495 | |
| 2496 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2497 | |
| 2498 | //Subs Create |
| 2499 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2500 | |
| 2501 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2502 | |
| 2503 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2504 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2505 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2506 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2507 | waiter.WaitResult(t) |
| 2508 | |
| 2509 | waitSubsCleanup(t, e2SubsId, 10) |
| 2510 | |
| 2511 | mainCtrl.VerifyCounterValues(t) |
| 2512 | } |
| 2513 | |
| 2514 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2515 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2516 | |
| 2517 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2518 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2519 | Counter{cSubReqToE2, 1}, |
| 2520 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2521 | Counter{cRestSubRespToXapp, 2}, |
| 2522 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2523 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2524 | Counter{cSubDelReqToE2, 1}, |
| 2525 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2526 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2527 | }) |
| 2528 | |
| 2529 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2530 | |
| 2531 | //Subs Create |
| 2532 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2533 | |
| 2534 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2535 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2536 | |
| 2537 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2538 | |
| 2539 | //Del1, this shall fail on rtmgr side |
| 2540 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2541 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2542 | waiter.WaitResult(t) |
| 2543 | |
| 2544 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2545 | |
| 2546 | //Del2 |
| 2547 | deleteXapp2Subscription(t, &restSubId2) |
| 2548 | |
| 2549 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2550 | |
| 2551 | mainCtrl.VerifyCounterValues(t) |
| 2552 | } |
| 2553 | |
| 2554 | //----------------------------------------------------------------------------- |
| 2555 | // TestRESTSubReqRetransmission |
| 2556 | // |
| 2557 | // stub stub |
| 2558 | // +-------+ +---------+ +---------+ |
| 2559 | // | xapp | | submgr | | e2term | |
| 2560 | // +-------+ +---------+ +---------+ |
| 2561 | // | | | |
| 2562 | // | RESTSubReq1 | | |
| 2563 | // |---------------->| | |
| 2564 | // | | | |
| 2565 | // | RESTSubResp | | |
| 2566 | // |<----------------| | |
| 2567 | // | | SubReq1 | |
| 2568 | // | |------------->| |
| 2569 | // | | | |
| 2570 | // | RESTSubReq2 | | |
| 2571 | // | (retrans) | | |
| 2572 | // |---------------->| | |
| 2573 | // | | | |
| 2574 | // | | SubReq2 | |
| 2575 | // | |------------->| |
| 2576 | // | RESTSubResp2 | | |
| 2577 | // |<----------------| | |
| 2578 | // | | SubResp1 | |
| 2579 | // | |<-------------| |
| 2580 | // | RESTNotif1 | | |
| 2581 | // |<----------------| | |
| 2582 | // | | SubResp1 | |
| 2583 | // | |<-------------| |
| 2584 | // | RESTNotif2 | | |
| 2585 | // |<----------------| | |
| 2586 | // | | | |
| 2587 | // | [SUBS DELETE] | |
| 2588 | // | | | |
| 2589 | // |
| 2590 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2591 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2592 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2593 | CaseBegin("TestRESTSubReqRetransmission") |
| 2594 | |
| 2595 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2596 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2597 | Counter{cSubReqToE2, 2}, |
| 2598 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2599 | Counter{cRestSubRespToXapp, 2}, |
| 2600 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2601 | Counter{cSubDelReqToE2, 2}, |
| 2602 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2603 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2604 | }) |
| 2605 | // Retry/duplicate will get the same way as the first request. Submgr cannot detect duplicate RESTRequests |
| 2606 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2607 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2608 | |
| 2609 | // Subs Create |
| 2610 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2611 | |
| 2612 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2613 | // gets into execution before the rtmgrg responds for the first one. |
| 2614 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2615 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2616 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2617 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2618 | |
| 2619 | waiter.WaitResult(t) |
| 2620 | |
| 2621 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2622 | |
| 2623 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2624 | // the order is not significant he6re. |
| 2625 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2626 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2627 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2628 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2629 | |
| 2630 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2631 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2632 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2633 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2634 | |
| 2635 | // Del1 |
| 2636 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2637 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2638 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2639 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2640 | // Del2 |
| 2641 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 2642 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2643 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2644 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2645 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 2646 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2647 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2648 | |
| 2649 | mainCtrl.VerifyCounterValues(t) |
| 2650 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2651 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2652 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 2653 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 2654 | |
| 2655 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2656 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2657 | Counter{cSubReqToE2, 1}, |
| 2658 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2659 | Counter{cRestSubRespToXapp, 1}, |
| 2660 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2661 | Counter{cSubDelReqToE2, 1}, |
| 2662 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2663 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2664 | }) |
| 2665 | |
| 2666 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2667 | |
| 2668 | //Subs Create |
| 2669 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2670 | |
| 2671 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2672 | |
| 2673 | //Subs Delete |
| 2674 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2675 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2676 | |
| 2677 | seqBef := mainCtrl.get_msgcounter(t) |
| 2678 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2679 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 2680 | |
| 2681 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2682 | |
| 2683 | waitSubsCleanup(t, e2SubsId, 10) |
| 2684 | |
| 2685 | mainCtrl.VerifyCounterValues(t) |
| 2686 | } |
| 2687 | |
| 2688 | //----------------------------------------------------------------------------- |
| 2689 | // TestRESTSubReqDelReq |
| 2690 | // |
| 2691 | // stub stub |
| 2692 | // +-------+ +---------+ +---------+ |
| 2693 | // | xapp | | submgr | | e2term | |
| 2694 | // +-------+ +---------+ +---------+ |
| 2695 | // | | | |
| 2696 | // | RESTSubReq | | |
| 2697 | // |---------------->| | |
| 2698 | // | | | |
| 2699 | // | RESTSubResp | | |
| 2700 | // |<----------------| | |
| 2701 | // | | SubReq | |
| 2702 | // | |------------->| |
| 2703 | // | RESTSubDelReq | | |
| 2704 | // |---------------->| | |
| 2705 | // | RESTSubDelResp | | |
| 2706 | // | unsuccess | | |
| 2707 | // |<----------------| | |
| 2708 | // | | SubResp | |
| 2709 | // | |<-------------| |
| 2710 | // | RESTNotif1 | | |
| 2711 | // |<----------------| | |
| 2712 | // | | | |
| 2713 | // | [SUBS DELETE] | |
| 2714 | // | | | |
| 2715 | // |
| 2716 | //----------------------------------------------------------------------------- |
| 2717 | func TestRESTSubReqDelReq(t *testing.T) { |
| 2718 | CaseBegin("TestRESTSubReqDelReq") |
| 2719 | |
| 2720 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2721 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2722 | Counter{cSubReqToE2, 1}, |
| 2723 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2724 | Counter{cRestSubRespToXapp, 1}, |
| 2725 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2726 | Counter{cSubDelReqToE2, 1}, |
| 2727 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2728 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2729 | }) |
| 2730 | |
| 2731 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2732 | |
| 2733 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2734 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2735 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2736 | |
| 2737 | // Del. This will fail as processing of the subscription |
| 2738 | // is still ongoing in submgr. Deletion is not allowed before |
| 2739 | // subscription creation has been completed. |
| 2740 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2741 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2742 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2743 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2744 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2745 | |
| 2746 | // Retry del |
| 2747 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2748 | |
| 2749 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2750 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2751 | |
| 2752 | // Wait that subs is cleaned |
| 2753 | waitSubsCleanup(t, e2SubsId, 10) |
| 2754 | mainCtrl.VerifyCounterValues(t) |
| 2755 | |
| 2756 | } |
| 2757 | |
| 2758 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 2759 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 2760 | } |
| 2761 | |
| 2762 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 2763 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 2764 | |
| 2765 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2766 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2767 | Counter{cSubReqToE2, 2}, |
| 2768 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2769 | Counter{cRestSubRespToXapp, 2}, |
| 2770 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2771 | Counter{cSubDelReqToE2, 2}, |
| 2772 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2773 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2774 | }) |
| 2775 | |
| 2776 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2777 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2778 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2779 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2780 | |
| 2781 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2782 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2783 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2784 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2785 | |
| 2786 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2787 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2788 | |
| 2789 | //XappConn1 receives both of the responses |
| 2790 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2791 | |
| 2792 | //Resp1 |
| 2793 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2794 | //Resp2 |
| 2795 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2796 | |
| 2797 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2798 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2799 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2800 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2801 | |
| 2802 | //Del1 |
| 2803 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2804 | //Del2 |
| 2805 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 2806 | |
| 2807 | //Wait that subs is cleaned |
| 2808 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2809 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2810 | |
| 2811 | mainCtrl.VerifyCounterValues(t) |
| 2812 | |
| 2813 | } |
| 2814 | |
| 2815 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 2816 | CaseBegin("TestRESTSameSubsDiffRan") |
| 2817 | |
| 2818 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2819 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2820 | Counter{cSubReqToE2, 2}, |
| 2821 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2822 | Counter{cRestSubRespToXapp, 2}, |
| 2823 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2824 | Counter{cSubDelReqToE2, 2}, |
| 2825 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2826 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2827 | }) |
| 2828 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2829 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2830 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2831 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2832 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2833 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2834 | params.SetMeid("RAN_NAME_2") |
| 2835 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2836 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2837 | |
| 2838 | //Del1 |
| 2839 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2840 | //Del2 |
| 2841 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 2842 | |
| 2843 | //Wait that subs is cleaned |
| 2844 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2845 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2846 | |
| 2847 | mainCtrl.VerifyCounterValues(t) |
| 2848 | |
| 2849 | } |
| 2850 | |
| 2851 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 2852 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 2853 | |
| 2854 | // Init counter check |
| 2855 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2856 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2857 | Counter{cSubReqToE2, 1}, |
| 2858 | Counter{cSubReReqToE2, 1}, |
| 2859 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2860 | Counter{cRestSubRespToXapp, 1}, |
| 2861 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2862 | Counter{cSubDelReqToE2, 1}, |
| 2863 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2864 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2865 | }) |
| 2866 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2867 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2868 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2869 | |
| 2870 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2871 | |
| 2872 | // Catch the first message and ignore it |
| 2873 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2874 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 2875 | |
| 2876 | // The second request is being handled normally |
| 2877 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2878 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2879 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2880 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2881 | |
| 2882 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2883 | |
| 2884 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2885 | |
| 2886 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2887 | //Wait that subs is cleaned |
| 2888 | waitSubsCleanup(t, e2SubsId, 10) |
| 2889 | |
| 2890 | mainCtrl.VerifyCounterValues(t) |
| 2891 | |
| 2892 | } |
| 2893 | |
| 2894 | //----------------------------------------------------------------------------- |
| 2895 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2896 | // |
| 2897 | // stub stub |
| 2898 | // +-------+ +---------+ +---------+ |
| 2899 | // | xapp | | submgr | | e2term | |
| 2900 | // +-------+ +---------+ +---------+ |
| 2901 | // | | | |
| 2902 | // | RESTSubReq | | |
| 2903 | // |---------------->| | |
| 2904 | // | | | |
| 2905 | // | RESTSubResp | | |
| 2906 | // |<----------------| | |
| 2907 | // | | SubReq | |
| 2908 | // | |------------->| |
| 2909 | // | | | |
| 2910 | // | | | |
| 2911 | // | | SubReq | |
| 2912 | // | |------------->| |
| 2913 | // | | | |
| 2914 | // | | SubDelReq | |
| 2915 | // | |------------->| |
| 2916 | // | | | |
| 2917 | // | | | |
| 2918 | // | | SubDelReq | |
| 2919 | // | |------------->| |
| 2920 | // | | | |
| 2921 | // | | | |
| 2922 | // | | SubDelResp | |
| 2923 | // | |<-------------| |
| 2924 | // | RESTNotif | | |
| 2925 | // | unsuccess | | |
| 2926 | // |<----------------| | |
| 2927 | // | | | |
| 2928 | // | [SUBS DELETE] | |
| 2929 | // | | | |
| 2930 | // |
| 2931 | //----------------------------------------------------------------------------- |
| 2932 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 2933 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 2934 | |
| 2935 | // Init counter check |
| 2936 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2937 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2938 | Counter{cSubReqToE2, 1}, |
| 2939 | Counter{cSubReReqToE2, 1}, |
| 2940 | Counter{cSubReqTimerExpiry, 2}, |
| 2941 | Counter{cSubDelReqToE2, 1}, |
| 2942 | Counter{cSubDelRespFromE2, 1}, |
| 2943 | }) |
| 2944 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2945 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2946 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2947 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2948 | |
| 2949 | e2termConn1.RecvSubsReq(t) |
| 2950 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2951 | |
| 2952 | e2termConn1.RecvSubsReq(t) |
| 2953 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2954 | |
| 2955 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2956 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2957 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2958 | // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? |
| 2959 | xappConn1.WaitRESTNotification(t, restSubId) |
| 2960 | |
| 2961 | // Wait that subs is cleaned |
| 2962 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 2963 | |
| 2964 | mainCtrl.VerifyCounterValues(t) |
| 2965 | } |
| 2966 | |
| 2967 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 2968 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 2969 | |
| 2970 | // Init counter check |
| 2971 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 2972 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2973 | Counter{cSubReqToE2, 1}, |
| 2974 | Counter{cSubReReqToE2, 1}, |
| 2975 | Counter{cSubReqTimerExpiry, 2}, |
| 2976 | Counter{cSubDelReqToE2, 1}, |
| 2977 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2978 | }) |
| 2979 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2980 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2981 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2982 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2983 | |
| 2984 | e2termConn1.RecvSubsReq(t) |
| 2985 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2986 | |
| 2987 | e2termConn1.RecvSubsReq(t) |
| 2988 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2989 | |
| 2990 | e2termConn1.RecvSubsDelReq(t) |
| 2991 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 2992 | |
| 2993 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2994 | e2termConn1.RecvSubsDelReq(t) |
| 2995 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 2996 | |
| 2997 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2998 | |
| 2999 | waitSubsCleanup(t, e2SubsId, 10) |
| 3000 | |
| 3001 | mainCtrl.VerifyCounterValues(t) |
| 3002 | |
| 3003 | } |
| 3004 | |
| 3005 | //----------------------------------------------------------------------------- |
| 3006 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3007 | // |
| 3008 | // stub stub |
| 3009 | // +-------+ +---------+ +---------+ |
| 3010 | // | xapp | | submgr | | e2term | |
| 3011 | // +-------+ +---------+ +---------+ |
| 3012 | // | | | |
| 3013 | // | RESTSubReq | | |
| 3014 | // |---------------->| | |
| 3015 | // | | | |
| 3016 | // | RESTSubResp | | |
| 3017 | // |<----------------| | |
| 3018 | // | | SubReq | |
| 3019 | // | |------------->| |
| 3020 | // | | | |
| 3021 | // | | | |
| 3022 | // | | SubReq | |
| 3023 | // | |------------->| |
| 3024 | // | | | |
| 3025 | // | | SubDelReq | |
| 3026 | // | |------------->| |
| 3027 | // | | | |
| 3028 | // | | | |
| 3029 | // | | SubDelReq | |
| 3030 | // | |------------->| |
| 3031 | // | | | |
| 3032 | // | | | |
| 3033 | // | | SubDelResp | |
| 3034 | // | |<-------------| |
| 3035 | // | RESTNotif | | |
| 3036 | // | unsuccess | | |
| 3037 | // |<----------------| | |
| 3038 | // | | | |
| 3039 | // | [SUBS DELETE] | |
| 3040 | // | | | |
| 3041 | // |
| 3042 | //----------------------------------------------------------------------------- |
| 3043 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3044 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3045 | |
| 3046 | // Init counter check |
| 3047 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3048 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3049 | Counter{cSubReqToE2, 1}, |
| 3050 | Counter{cSubReReqToE2, 1}, |
| 3051 | Counter{cSubReqTimerExpiry, 2}, |
| 3052 | Counter{cSubDelReqToE2, 1}, |
| 3053 | Counter{cSubDelReReqToE2, 1}, |
| 3054 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3055 | }) |
| 3056 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3057 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3058 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3059 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3060 | |
| 3061 | e2termConn1.RecvSubsReq(t) |
| 3062 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3063 | |
| 3064 | e2termConn1.RecvSubsReq(t) |
| 3065 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3066 | |
| 3067 | e2termConn1.RecvSubsDelReq(t) |
| 3068 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3069 | |
| 3070 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3071 | e2termConn1.RecvSubsDelReq(t) |
| 3072 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3073 | |
| 3074 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3075 | |
| 3076 | waitSubsCleanup(t, e2SubsId, 10) |
| 3077 | |
| 3078 | mainCtrl.VerifyCounterValues(t) |
| 3079 | } |
| 3080 | |
| 3081 | //----------------------------------------------------------------------------- |
| 3082 | // TestRESTSubReqSubFailRespInSubmgr |
| 3083 | // |
| 3084 | // stub stub |
| 3085 | // +-------+ +---------+ +---------+ |
| 3086 | // | xapp | | submgr | | e2term | |
| 3087 | // +-------+ +---------+ +---------+ |
| 3088 | // | | | |
| 3089 | // | RESTSubReq | | |
| 3090 | // |---------------->| | |
| 3091 | // | | | |
| 3092 | // | RESTSubResp | | |
| 3093 | // |<----------------| | |
| 3094 | // | | SubReq | |
| 3095 | // | |------------->| |
| 3096 | // | | | |
| 3097 | // | | SubFail | |
| 3098 | // | |<-------------| |
| 3099 | // | | | |
| 3100 | // | | SubDelReq | |
| 3101 | // | |------------->| |
| 3102 | // | | | |
| 3103 | // | | SubDelResp | |
| 3104 | // | |<-------------| |
| 3105 | // | | | |
| 3106 | // | RESTNotif | | |
| 3107 | // | unsuccess | | |
| 3108 | // |<----------------| | |
| 3109 | // | | | |
| 3110 | // | [SUBS DELETE] | |
| 3111 | // | | | |
| 3112 | // |
| 3113 | //----------------------------------------------------------------------------- |
| 3114 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3115 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3116 | |
| 3117 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3118 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3119 | Counter{cSubReqToE2, 1}, |
| 3120 | Counter{cSubFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3121 | Counter{cRestSubRespToXapp, 1}, |
| 3122 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3123 | }) |
| 3124 | |
| 3125 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3126 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3127 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3128 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3129 | |
| 3130 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3131 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3132 | fparams1.Set(crereq1) |
| 3133 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3134 | |
| 3135 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3136 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3137 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3138 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3139 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 3140 | |
| 3141 | // REST subscription sill there to be deleted |
| 3142 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3143 | |
| 3144 | // Wait that subs is cleaned |
| 3145 | waitSubsCleanup(t, e2SubsId, 10) |
| 3146 | |
| 3147 | mainCtrl.VerifyCounterValues(t) |
| 3148 | |
| 3149 | } |
| 3150 | |
| 3151 | //----------------------------------------------------------------------------- |
| 3152 | // TestRESTSubDelReqRetryInSubmgr |
| 3153 | // |
| 3154 | // stub stub |
| 3155 | // +-------+ +---------+ +---------+ |
| 3156 | // | xapp | | submgr | | e2term | |
| 3157 | // +-------+ +---------+ +---------+ |
| 3158 | // | | | |
| 3159 | // | [SUBS CREATE] | |
| 3160 | // | | | |
| 3161 | // | | | |
| 3162 | // | RESTSubDelReq | | |
| 3163 | // |---------------->| | |
| 3164 | // | | | |
| 3165 | // | RESTSubDelResp | | |
| 3166 | // |<----------------| | |
| 3167 | // | | SubDelReq | |
| 3168 | // | |------------->| |
| 3169 | // | | | |
| 3170 | // | | SubDelReq | |
| 3171 | // | |------------->| |
| 3172 | // | | | |
| 3173 | // | | SubDelResp | |
| 3174 | // | |<-------------| |
| 3175 | // | | | |
| 3176 | // |
| 3177 | //----------------------------------------------------------------------------- |
| 3178 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3179 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3180 | |
| 3181 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3182 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3183 | Counter{cSubReqToE2, 1}, |
| 3184 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3185 | Counter{cRestSubRespToXapp, 1}, |
| 3186 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3187 | Counter{cSubDelReqToE2, 1}, |
| 3188 | Counter{cSubDelReReqToE2, 1}, |
| 3189 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3190 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3191 | }) |
| 3192 | // Req |
| 3193 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3194 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3195 | |
| 3196 | // Del |
| 3197 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3198 | |
| 3199 | // E2t: Receive 1st SubsDelReq |
| 3200 | e2termConn1.RecvSubsDelReq(t) |
| 3201 | |
| 3202 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3203 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3204 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3205 | |
| 3206 | //Wait that subs is cleaned |
| 3207 | waitSubsCleanup(t, e2SubsId, 10) |
| 3208 | |
| 3209 | mainCtrl.VerifyCounterValues(t) |
| 3210 | } |
| 3211 | |
| 3212 | //----------------------------------------------------------------------------- |
| 3213 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3214 | // |
| 3215 | // stub stub |
| 3216 | // +-------+ +---------+ +---------+ |
| 3217 | // | xapp | | submgr | | e2term | |
| 3218 | // +-------+ +---------+ +---------+ |
| 3219 | // | | | |
| 3220 | // | [SUBS CREATE] | |
| 3221 | // | | | |
| 3222 | // | | | |
| 3223 | // | RESTSubDelReq | | |
| 3224 | // |---------------->| | |
| 3225 | // | | | |
| 3226 | // | RESTSubDelResp | | |
| 3227 | // |<----------------| | |
| 3228 | // | | SubDelReq | |
| 3229 | // | |------------->| |
| 3230 | // | | | |
| 3231 | // | | SubDelReq | |
| 3232 | // | |------------->| |
| 3233 | // | | | |
| 3234 | // | | | |
| 3235 | // |
| 3236 | //----------------------------------------------------------------------------- |
| 3237 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3238 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3239 | |
| 3240 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3241 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3242 | Counter{cSubReqToE2, 1}, |
| 3243 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3244 | Counter{cRestSubRespToXapp, 1}, |
| 3245 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3246 | Counter{cSubDelReqToE2, 1}, |
| 3247 | Counter{cSubDelReReqToE2, 1}, |
| 3248 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3249 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3250 | }) |
| 3251 | |
| 3252 | // Req |
| 3253 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3254 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3255 | |
| 3256 | // Del |
| 3257 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3258 | |
| 3259 | // E2t: Receive 1st SubsDelReq |
| 3260 | e2termConn1.RecvSubsDelReq(t) |
| 3261 | |
| 3262 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3263 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3264 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3265 | |
| 3266 | //Wait that subs is cleaned |
| 3267 | waitSubsCleanup(t, e2SubsId, 10) |
| 3268 | |
| 3269 | mainCtrl.VerifyCounterValues(t) |
| 3270 | } |
| 3271 | |
| 3272 | //----------------------------------------------------------------------------- |
| 3273 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3274 | // |
| 3275 | // stub stub |
| 3276 | // +-------+ +---------+ +---------+ |
| 3277 | // | xapp | | submgr | | e2term | |
| 3278 | // +-------+ +---------+ +---------+ |
| 3279 | // | | | |
| 3280 | // | [SUBS CREATE] | |
| 3281 | // | | | |
| 3282 | // | | | |
| 3283 | // | RESTSubDelReq | | |
| 3284 | // |---------------->| | |
| 3285 | // | | | |
| 3286 | // | RESTSubDelResp | | |
| 3287 | // |<----------------| | |
| 3288 | // | | SubDelReq | |
| 3289 | // | |------------->| |
| 3290 | // | | | |
| 3291 | // | | SubDelFail | |
| 3292 | // | |<-------------| |
| 3293 | // | | | |
| 3294 | // |
| 3295 | //----------------------------------------------------------------------------- |
| 3296 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3297 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3298 | |
| 3299 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3300 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3301 | Counter{cSubReqToE2, 1}, |
| 3302 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3303 | Counter{cRestSubRespToXapp, 1}, |
| 3304 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3305 | Counter{cSubDelReqToE2, 1}, |
| 3306 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3307 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3308 | }) |
| 3309 | |
| 3310 | // Req |
| 3311 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3312 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3313 | |
| 3314 | // Del |
| 3315 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3316 | |
| 3317 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3318 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3319 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3320 | |
| 3321 | //Wait that subs is cleaned |
| 3322 | waitSubsCleanup(t, e2SubsId, 10) |
| 3323 | |
| 3324 | mainCtrl.VerifyCounterValues(t) |
| 3325 | } |
| 3326 | |
| 3327 | //----------------------------------------------------------------------------- |
| 3328 | // TestRESTSubReqAndSubDelOkSameAction |
| 3329 | // |
| 3330 | // stub stub |
| 3331 | // +-------+ +-------+ +---------+ +---------+ |
| 3332 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3333 | // +-------+ +-------+ +---------+ +---------+ |
| 3334 | // | | | | |
| 3335 | // | | RESTSubReq1 | | |
| 3336 | // | |---------------->| | |
| 3337 | // | | | | |
| 3338 | // | | RESTSubResp1 | | |
| 3339 | // | |<----------------| | |
| 3340 | // | | | | |
| 3341 | // | | | SubReq1 | |
| 3342 | // | | |------------->| |
| 3343 | // | | | SubResp1 | |
| 3344 | // | | |<-------------| |
| 3345 | // | | RESTNotif1 | | |
| 3346 | // | |<----------------| | |
| 3347 | // | | | | |
| 3348 | // | RESTSubReq2 | | |
| 3349 | // |------------------------------>| | |
| 3350 | // | | | | |
| 3351 | // | RESTSubResp2 | | |
| 3352 | // |<------------------------------| | |
| 3353 | // | | | | |
| 3354 | // | | RESTNotif2 | | |
| 3355 | // |<------------------------------| | |
| 3356 | // | | | | |
| 3357 | // | | RESTSubDelReq1 | | |
| 3358 | // | |---------------->| | |
| 3359 | // | | | | |
| 3360 | // | | RESTSubDelResp1 | | |
| 3361 | // | |<----------------| | |
| 3362 | // | | | | |
| 3363 | // | RESTSubDelReq2 | | |
| 3364 | // |------------------------------>| | |
| 3365 | // | | | | |
| 3366 | // | RESTSubDelResp2 | | |
| 3367 | // |<------------------------------| | |
| 3368 | // | | | | |
| 3369 | // | | | SubDelReq2 | |
| 3370 | // | | |------------->| |
| 3371 | // | | | | |
| 3372 | // | | | SubDelResp2 | |
| 3373 | // | | |<-------------| |
| 3374 | // | | | | |
| 3375 | // |
| 3376 | //----------------------------------------------------------------------------- |
| 3377 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3378 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3379 | |
| 3380 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3381 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3382 | Counter{cSubReqToE2, 1}, |
| 3383 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3384 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3385 | Counter{cMergedSubscriptions, 1}, |
| 3386 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3387 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3388 | Counter{cSubDelReqToE2, 1}, |
| 3389 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3390 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3391 | }) |
| 3392 | |
| 3393 | // Req1 |
| 3394 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3395 | |
| 3396 | //Subs Create |
| 3397 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3398 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3399 | |
| 3400 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3401 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3402 | params.SetMeid("RAN_NAME_1") |
| 3403 | |
| 3404 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 3405 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3406 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3407 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3408 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3409 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 3410 | e2SubsId2 := <-xappConn2.RESTNotification |
| 3411 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3412 | |
| 3413 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3414 | |
| 3415 | // Del1 |
| 3416 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3417 | |
| 3418 | // Del2 |
| 3419 | deleteXapp2Subscription(t, &restSubId2) |
| 3420 | |
| 3421 | //Wait that subs is cleaned |
| 3422 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3423 | |
| 3424 | mainCtrl.VerifyCounterValues(t) |
| 3425 | } |
| 3426 | |
| 3427 | //----------------------------------------------------------------------------- |
| 3428 | // TestSubReqAndSubDelOkSameActionParallel |
| 3429 | // |
| 3430 | // stub stub stub |
| 3431 | // +-------+ +-------+ +---------+ +---------+ |
| 3432 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3433 | // +-------+ +-------+ +---------+ +---------+ |
| 3434 | // | | | | |
| 3435 | // | | | | |
| 3436 | // | | | | |
| 3437 | // | | SubReq1 | | |
| 3438 | // | |------------->| | |
| 3439 | // | | | | |
| 3440 | // | | | SubReq1 | |
| 3441 | // | | |------------->| |
| 3442 | // | SubReq2 | | |
| 3443 | // |--------------------------->| | |
| 3444 | // | | | SubResp1 | |
| 3445 | // | | |<-------------| |
| 3446 | // | | SubResp1 | | |
| 3447 | // | |<-------------| | |
| 3448 | // | | | SubReq2 | |
| 3449 | // | | |------------->| |
| 3450 | // | | | | |
| 3451 | // | | | SubResp2 | |
| 3452 | // | | |<-------------| |
| 3453 | // | SubResp2 | | |
| 3454 | // |<---------------------------| | |
| 3455 | // | | | | |
| 3456 | // | | SubDelReq 1 | | |
| 3457 | // | |------------->| | |
| 3458 | // | | | | |
| 3459 | // | | SubDelResp 1 | | |
| 3460 | // | |<-------------| | |
| 3461 | // | | | | |
| 3462 | // | SubDelReq 2 | | |
| 3463 | // |--------------------------->| | |
| 3464 | // | | | | |
| 3465 | // | | | SubDelReq 2 | |
| 3466 | // | | |------------->| |
| 3467 | // | | | | |
| 3468 | // | | | SubDelReq 2 | |
| 3469 | // | | |------------->| |
| 3470 | // | | | | |
| 3471 | // | SubDelResp 2 | | |
| 3472 | // |<---------------------------| | |
| 3473 | // |
| 3474 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 3475 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 3476 | |
| 3477 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3478 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3479 | Counter{cSubReqToE2, 2}, |
| 3480 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3481 | Counter{cRestSubRespToXapp, 2}, |
| 3482 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3483 | Counter{cSubDelReqToE2, 2}, |
| 3484 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3485 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3486 | }) |
| 3487 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3488 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3489 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3490 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3491 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3492 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3493 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3494 | |
| 3495 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3496 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3497 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3498 | |
| 3499 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3500 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3501 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3502 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3503 | |
| 3504 | // Del1 |
| 3505 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3506 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3507 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3508 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3509 | |
| 3510 | // Del2 |
| 3511 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3512 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 3513 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 3514 | |
| 3515 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3516 | |
| 3517 | mainCtrl.VerifyCounterValues(t) |
| 3518 | } |
| 3519 | |
| 3520 | //----------------------------------------------------------------------------- |
| 3521 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 3522 | // |
| 3523 | // stub stub stub |
| 3524 | // +-------+ +-------+ +---------+ +---------+ |
| 3525 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3526 | // +-------+ +-------+ +---------+ +---------+ |
| 3527 | // | | | | |
| 3528 | // | | | | |
| 3529 | // | | | | |
| 3530 | // | | RESTSubReq1 | | |
| 3531 | // | |---------------->| | |
| 3532 | // | | | | |
| 3533 | // | | RESTSubResp1 | | |
| 3534 | // | |<----------------| | |
| 3535 | // | | | SubReq1 | |
| 3536 | // | | |------------->| |
| 3537 | // | RESTSubReq2 | | |
| 3538 | // |------------------------------>| | |
| 3539 | // | | | | |
| 3540 | // | RESTSubDelResp2 | | |
| 3541 | // |<------------------------------| | |
| 3542 | // | | | SubReq1 | |
| 3543 | // | | |------------->| |
| 3544 | // | | | | |
| 3545 | // | | | | |
| 3546 | // | | | SubDelReq | |
| 3547 | // | | |------------->| |
| 3548 | // | | | | |
| 3549 | // | | | SubDelResp | |
| 3550 | // | | |<-------------| |
| 3551 | // | | RESTNotif1 | | |
| 3552 | // | | unsuccess | | |
| 3553 | // | |<----------------| | |
| 3554 | // | RESTNotif2 | | |
| 3555 | // | | unsuccess | | |
| 3556 | // |<------------------------------| | |
| 3557 | // | | | | |
| 3558 | // | | RESTSubDelReq1 | | |
| 3559 | // | |---------------->| | |
| 3560 | // | | | | |
| 3561 | // | | RESTSubDelResp1 | | |
| 3562 | // | |<----------------| | |
| 3563 | // | | | | |
| 3564 | // | RESTSubDelReq2 | | |
| 3565 | // |------------------------------>| | |
| 3566 | // | | | | |
| 3567 | // | RESTSubDelResp2 | | |
| 3568 | // |<------------------------------| | |
| 3569 | // |
| 3570 | //----------------------------------------------------------------------------- |
| 3571 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 3572 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 3573 | |
| 3574 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3575 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3576 | Counter{cSubReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3577 | Counter{cRestSubRespToXapp, 2}, |
| 3578 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3579 | Counter{cSubDelReqToE2, 1}, |
| 3580 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3581 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3582 | }) |
| 3583 | |
| 3584 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3585 | |
| 3586 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3587 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3588 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 3589 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 3590 | |
| 3591 | // Req2 |
| 3592 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3593 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3594 | params2.SetMeid("RAN_NAME_1") |
| 3595 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3596 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3597 | |
| 3598 | //Req1 (retransmitted) |
| 3599 | e2termConn1.RecvSubsReq(t) |
| 3600 | |
| 3601 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3602 | |
| 3603 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3604 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3605 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3606 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3607 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3608 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3609 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3610 | |
| 3611 | // Del1 |
| 3612 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3613 | |
| 3614 | // Del2 |
| 3615 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3616 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3617 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 3618 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3619 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3620 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3621 | |
| 3622 | mainCtrl.VerifyCounterValues(t) |
| 3623 | } |
| 3624 | |
| 3625 | //----------------------------------------------------------------------------- |
| 3626 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 3627 | // |
| 3628 | // stub stub stub |
| 3629 | // +-------+ +-------+ +---------+ +---------+ |
| 3630 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3631 | // +-------+ +-------+ +---------+ +---------+ |
| 3632 | // | | | | |
| 3633 | // | | | | |
| 3634 | // | | | | |
| 3635 | // | | RESTSubReq1 | | |
| 3636 | // | |---------------->| | |
| 3637 | // | | | | |
| 3638 | // | | RESTSubResp1 | | |
| 3639 | // | |<----------------| | |
| 3640 | // | | | SubReq1 | |
| 3641 | // | | |------------->| |
| 3642 | // | RESTSubReq2 | | |
| 3643 | // |------------------------------>| | |
| 3644 | // | | | | |
| 3645 | // | RESTSubDelResp2 | | |
| 3646 | // |<------------------------------| | |
| 3647 | // | | | SubFail1 | |
| 3648 | // | | |<-------------| |
| 3649 | // | | | | |
| 3650 | // | | RESTNotif1 | | |
| 3651 | // | | unsuccess | | |
| 3652 | // | |<----------------| | |
| 3653 | // | RESTNotif2 | | |
| 3654 | // | | unsuccess | | |
| 3655 | // |<------------------------------| | |
| 3656 | // | | | SubDelReq | |
| 3657 | // | | |------------->| |
| 3658 | // | | | SubDelResp | |
| 3659 | // | | |<-------------| |
| 3660 | // | | | | |
| 3661 | // | | RESTSubDelReq1 | | |
| 3662 | // | |---------------->| | |
| 3663 | // | | | | |
| 3664 | // | | RESTSubDelResp1 | | |
| 3665 | // | |<----------------| | |
| 3666 | // | | | | |
| 3667 | // | RESTSubDelReq2 | | |
| 3668 | // |------------------------------>| | |
| 3669 | // | | | | |
| 3670 | // | RESTSubDelResp2 | | |
| 3671 | // |<------------------------------| | |
| 3672 | // |
| 3673 | //----------------------------------------------------------------------------- |
| 3674 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 3675 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 3676 | |
| 3677 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3678 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3679 | Counter{cSubReqToE2, 1}, |
| 3680 | Counter{cSubFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3681 | Counter{cRestSubRespToXapp, 2}, |
| 3682 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3683 | Counter{cSubDelReqToE2, 1}, |
| 3684 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3685 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3686 | }) |
| 3687 | |
| 3688 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3689 | |
| 3690 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3691 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3692 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3693 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3694 | |
| 3695 | // Req2 |
| 3696 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3697 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3698 | params2.SetMeid("RAN_NAME_1") |
| 3699 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3700 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3701 | |
| 3702 | // E2t: send SubsFail (first) |
| 3703 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3704 | fparams1.Set(crereq1) |
| 3705 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3706 | |
| 3707 | // E2t: internal delete |
| 3708 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3709 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3710 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3711 | |
| 3712 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3713 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3714 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3715 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 3716 | |
| 3717 | // Del1 |
| 3718 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3719 | |
| 3720 | // Del2 |
| 3721 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3722 | |
| 3723 | //Wait that subs is cleaned |
| 3724 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 3725 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3726 | |
| 3727 | mainCtrl.VerifyCounterValues(t) |
| 3728 | } |
| 3729 | |
| 3730 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 3731 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3732 | |
| 3733 | // Init counter check |
| 3734 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3735 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3736 | Counter{cSubReqToE2, 1}, |
| 3737 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3738 | Counter{cRestSubRespToXapp, 1}, |
| 3739 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3740 | Counter{cSubDelReqToE2, 1}, |
| 3741 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3742 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3743 | }) |
| 3744 | |
| 3745 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3746 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3747 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3748 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3749 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3750 | |
| 3751 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3752 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3753 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3754 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3755 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 3756 | |
| 3757 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3758 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3759 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3760 | |
| 3761 | // Wait that subs is cleaned |
| 3762 | waitSubsCleanup(t, e2SubsId, 10) |
| 3763 | mainCtrl.VerifyCounterValues(t) |
| 3764 | } |
| 3765 | |
| 3766 | //----------------------------------------------------------------------------- |
| 3767 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 3768 | // |
| 3769 | // stub stub |
| 3770 | // +-------+ +---------+ +---------+ |
| 3771 | // | xapp | | submgr | | e2term | |
| 3772 | // +-------+ +---------+ +---------+ |
| 3773 | // | | | |
| 3774 | // | RESTSubReq | | |
| 3775 | // |---------------->| | |
| 3776 | // | | | |
| 3777 | // | RESTSubResp | | |
| 3778 | // |<----------------| | |
| 3779 | // | | SubReq | |
| 3780 | // | |------------->| |
| 3781 | // | | | |
| 3782 | // | | SubResp | |
| 3783 | // | |<-------------| |
| 3784 | // | | | |
| 3785 | // | RESTNotif | | |
| 3786 | // |<----------------| | |
| 3787 | // | | | |
| 3788 | // | RESTSubReq | | |
| 3789 | // |---------------->| | |
| 3790 | // | | | |
| 3791 | // | RESTSubResp | | |
| 3792 | // |<----------------| | |
| 3793 | // | | SubReq | |
| 3794 | // | |------------->| |
| 3795 | // | | | |
| 3796 | // | | SubResp | |
| 3797 | // | |<-------------| |
| 3798 | // | | | |
| 3799 | // | RESTNotif | | |
| 3800 | // |<----------------| | |
| 3801 | // | | | |
| 3802 | // | RESTSubDelReq | | |
| 3803 | // |---------------->| | |
| 3804 | // | | | |
| 3805 | // | | SubDelReq | |
| 3806 | // | |------------->| |
| 3807 | // | | | |
| 3808 | // | | SubDelResp | |
| 3809 | // | |<-------------| |
| 3810 | // | | | |
| 3811 | // | RESTSubDelResp | | |
| 3812 | // |<----------------| | |
| 3813 | // |
| 3814 | //----------------------------------------------------------------------------- |
| 3815 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 3816 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3817 | |
| 3818 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3819 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3820 | Counter{cSubReqToE2, 2}, |
| 3821 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3822 | Counter{cRestSubRespToXapp, 2}, |
| 3823 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3824 | Counter{cSubDelReqToE2, 1}, |
| 3825 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3826 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3827 | }) |
| 3828 | |
| 3829 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3830 | |
| 3831 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3832 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3833 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3834 | |
| 3835 | // Policy change |
| 3836 | instanceId := int64(e2SubsId) |
| 3837 | // GetRESTSubsReqPolicyParams sets some coutners on tc side. |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3838 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3839 | params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId |
| 3840 | params.SetTimeToWait("w200ms") |
| 3841 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3842 | |
| 3843 | // Del |
| 3844 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3845 | |
| 3846 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3847 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3848 | |
| 3849 | // Wait that subs is cleaned |
| 3850 | waitSubsCleanup(t, e2SubsId, 10) |
| 3851 | mainCtrl.VerifyCounterValues(t) |
| 3852 | } |
| 3853 | |
| 3854 | //----------------------------------------------------------------------------- |
| 3855 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 3856 | // |
| 3857 | // stub stub stub |
| 3858 | // +-------+ +---------+ +---------+ +---------+ |
| 3859 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 3860 | // +-------+ +---------+ +---------+ +---------+ |
| 3861 | // | | | | |
| 3862 | // | | | | |
| 3863 | // | | | | |
| 3864 | // | RESTSubReq1 | | | |
| 3865 | // |---------------->| | | |
| 3866 | // | | | | |
| 3867 | // | RESTSubResp1 | | | |
| 3868 | // |<----------------| | | |
| 3869 | // | | SubReq1 | | |
| 3870 | // | |------------->| | |
| 3871 | // | | | | |
| 3872 | // | RESTSubReq2 | | | |
| 3873 | // |---------------->| | | |
| 3874 | // | | | | |
| 3875 | // | RESTSubResp2 | | | |
| 3876 | // |<----------------| | | |
| 3877 | // | | SubReq2 | | |
| 3878 | // | |---------------------------->| |
| 3879 | // | | | | |
| 3880 | // | | SubResp1 | | |
| 3881 | // | |<-------------| | |
| 3882 | // | RESTNotif1 | | | |
| 3883 | // |<----------------| | | |
| 3884 | // | | SubResp2 | | |
| 3885 | // | |<----------------------------| |
| 3886 | // | RESTNotif2 | | | |
| 3887 | // |<----------------| | | |
| 3888 | // | | | | |
| 3889 | // | [SUBS 1 DELETE] | | |
| 3890 | // | | | | |
| 3891 | // | [SUBS 2 DELETE] | | |
| 3892 | // | | | | |
| 3893 | // |
| 3894 | //----------------------------------------------------------------------------- |
| 3895 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 3896 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 3897 | |
| 3898 | // Init counter check |
| 3899 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3900 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3901 | Counter{cSubReqToE2, 2}, |
| 3902 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3903 | Counter{cRestSubRespToXapp, 2}, |
| 3904 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3905 | Counter{cSubDelReqToE2, 2}, |
| 3906 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 3907 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3908 | }) |
| 3909 | |
| 3910 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3911 | |
| 3912 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3913 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3914 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3915 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3916 | |
| 3917 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3918 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3919 | params.SetMeid("RAN_NAME_11") |
| 3920 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 3921 | // would not work as notification would not be received |
| 3922 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 3923 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 3924 | |
| 3925 | // Resp1 |
| 3926 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3927 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3928 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3929 | xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
| 3930 | |
| 3931 | // Resp2 |
| 3932 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3933 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 3934 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3935 | xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
| 3936 | |
| 3937 | // Delete1 |
| 3938 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3939 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3940 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3941 | |
| 3942 | // Wait that subs is cleaned |
| 3943 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3944 | |
| 3945 | // Delete2 |
| 3946 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 3947 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 3948 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 3949 | |
| 3950 | // Wait that subs is cleaned |
| 3951 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3952 | |
| 3953 | mainCtrl.VerifyCounterValues(t) |
| 3954 | } |
| 3955 | |
| 3956 | //----------------------------------------------------------------------------- |
| 3957 | // TestRESTSubReqAsn1EncodeFail |
| 3958 | // |
| 3959 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 3960 | // stub stub |
| 3961 | // +-------+ +---------+ +---------+ |
| 3962 | // | xapp | | submgr | | e2term | |
| 3963 | // +-------+ +---------+ +---------+ |
| 3964 | // | | | |
| 3965 | // | RESTSubReq | | |
| 3966 | // |---------------->| | |
| 3967 | // | | | |
| 3968 | // | RESTSubResp | | |
| 3969 | // |<----------------| | |
| 3970 | // | RESTSubDelReq | | |
| 3971 | // |---------------->| | |
| 3972 | // | RESTSubDelResp | | |
| 3973 | // | unsuccess | | |
| 3974 | // |<----------------| | |
| 3975 | // | | | |
| 3976 | // |
| 3977 | //----------------------------------------------------------------------------- |
| 3978 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 3979 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 3980 | |
| 3981 | xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") |
| 3982 | |
| 3983 | } |
| 3984 | |
| 3985 | //----------------------------------------------------------------------------- |
| 3986 | // TestRESTSubReqInsertAndSubDelOk |
| 3987 | // |
| 3988 | // stub stub |
| 3989 | // +-------+ +---------+ +---------+ |
| 3990 | // | xapp | | submgr | | e2term | |
| 3991 | // +-------+ +---------+ +---------+ |
| 3992 | // | | | |
| 3993 | // | RestSubReq | | |
| 3994 | // |---------------->| | |
| 3995 | // | | | |
| 3996 | // | RESTSubResp | | |
| 3997 | // |<----------------| | |
| 3998 | // | | | |
| 3999 | // | | SubReq | |
| 4000 | // | |------------->| |
| 4001 | // | | | |
| 4002 | // | | SubResp | |
| 4003 | // | |<-------------| |
| 4004 | // | RESTNotif | | |
| 4005 | // |<----------------| | |
| 4006 | // | ... | ... | |
| 4007 | // | | | |
| 4008 | // | RESTSubDelReq | | |
| 4009 | // |---------------->| | |
| 4010 | // | | | |
| 4011 | // | | SubDelReq | |
| 4012 | // | |------------->| |
| 4013 | // | | | |
| 4014 | // | | SubDelResp | |
| 4015 | // | |<-------------| |
| 4016 | // | | | |
| 4017 | // | RESTSubDelResp| | |
| 4018 | // |<----------------| | |
| 4019 | // |
| 4020 | //----------------------------------------------------------------------------- |
| 4021 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4022 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4023 | |
| 4024 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4025 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4026 | Counter{cSubReqToE2, 1}, |
| 4027 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4028 | Counter{cRestSubRespToXapp, 1}, |
| 4029 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4030 | Counter{cSubDelReqToE2, 1}, |
| 4031 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4032 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4033 | }) |
| 4034 | |
| 4035 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4036 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4037 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4038 | params.SetSubActionTypes("insert") |
| 4039 | |
| 4040 | // Req |
| 4041 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4042 | |
| 4043 | // Del |
| 4044 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4045 | |
| 4046 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4047 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4048 | |
| 4049 | // Wait that subs is cleaned |
| 4050 | waitSubsCleanup(t, e2SubsId, 10) |
| 4051 | mainCtrl.VerifyCounterValues(t) |
| 4052 | } |
| 4053 | |
| 4054 | //----------------------------------------------------------------------------- |
| 4055 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4056 | // |
| 4057 | // stub stub |
| 4058 | // +-------+ +---------+ +---------+ |
| 4059 | // | xapp | | submgr | | e2term | |
| 4060 | // +-------+ +---------+ +---------+ |
| 4061 | // | | | |
| 4062 | // | RESTSubReq | | |
| 4063 | // |------------->| | |
| 4064 | // | | | |
| 4065 | // | | SubReq | |
| 4066 | // | |------------->| |
| 4067 | // | | | |
| 4068 | // | | SubResp | |
| 4069 | // | <----| |
| 4070 | // | | |
| 4071 | // | Submgr restart | |
| 4072 | // | | |
| 4073 | // | | | |
| 4074 | // | | SubDelReq | |
| 4075 | // | |------------->| |
| 4076 | // | | | |
| 4077 | // | | SubDelResp | |
| 4078 | // | |<-------------| |
| 4079 | // | | | |
| 4080 | // |
| 4081 | //----------------------------------------------------------------------------- |
| 4082 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4083 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4084 | |
| 4085 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4086 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4087 | Counter{cSubReqToE2, 1}, |
| 4088 | Counter{cSubDelReqFromXapp, 1}, |
| 4089 | Counter{cSubDelReqToE2, 1}, |
| 4090 | Counter{cSubDelRespFromE2, 1}, |
| 4091 | }) |
| 4092 | |
| 4093 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4094 | |
| 4095 | // Remove possible existing subscription |
| 4096 | mainCtrl.removeExistingSubscriptions(t) |
| 4097 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4098 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4099 | |
| 4100 | //Req |
| 4101 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4102 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4103 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4104 | |
| 4105 | e2termConn1.RecvSubsReq(t) |
| 4106 | |
| 4107 | mainCtrl.SetResetTestFlag(t, false) |
| 4108 | |
| 4109 | mainCtrl.SimulateRestart(t) |
| 4110 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4111 | |
| 4112 | //Del |
| 4113 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4114 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4115 | |
| 4116 | xappConn1.TestMsgChanEmpty(t) |
| 4117 | xappConn2.TestMsgChanEmpty(t) |
| 4118 | e2termConn1.TestMsgChanEmpty(t) |
| 4119 | mainCtrl.wait_registry_empty(t, 10) |
| 4120 | |
| 4121 | mainCtrl.VerifyCounterValues(t) |
| 4122 | } |
| 4123 | |
| 4124 | //----------------------------------------------------------------------------- |
| 4125 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 4126 | // |
| 4127 | // stub stub |
| 4128 | // +-------+ +---------+ +---------+ |
| 4129 | // | xapp | | submgr | | e2term | |
| 4130 | // +-------+ +---------+ +---------+ |
| 4131 | // | | | |
| 4132 | // | RESTSubReq | | |
| 4133 | // |---------------->| | |
| 4134 | // | | | |
| 4135 | // | RESTSubResp | | |
| 4136 | // |<----------------| | |
| 4137 | // | | SubReq | |
| 4138 | // | |------------->| |
| 4139 | // | | | |
| 4140 | // | | SubResp | |
| 4141 | // | |<-------------| |
| 4142 | // | | | |
| 4143 | // | RESTNotif | | |
| 4144 | // |<----------------| | |
| 4145 | // | | | |
| 4146 | // | | |
| 4147 | // | Submgr restart | |
| 4148 | // | | | |
| 4149 | // | RESTSubDelReq | | |
| 4150 | // |---------------->| | |
| 4151 | // | | | |
| 4152 | // | | SubDelReq | |
| 4153 | // | |------------->| |
| 4154 | // | | | |
| 4155 | // | | SubDelResp | |
| 4156 | // | |<-------------| |
| 4157 | // | | | |
| 4158 | // | RESTSubDelResp | | |
| 4159 | // |<----------------| | |
| 4160 | // |
| 4161 | //----------------------------------------------------------------------------- |
| 4162 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4163 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4164 | |
| 4165 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4166 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4167 | Counter{cSubReqToE2, 1}, |
| 4168 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4169 | Counter{cRestSubRespToXapp, 1}, |
| 4170 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4171 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4172 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4173 | }) |
| 4174 | |
| 4175 | // Remove possible existing subscription |
| 4176 | mainCtrl.removeExistingSubscriptions(t) |
| 4177 | |
| 4178 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4179 | |
| 4180 | // Create subscription |
| 4181 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4182 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4183 | |
| 4184 | // Check subscription |
| 4185 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4186 | |
| 4187 | // When SDL support for the REST Interface is added |
| 4188 | // the submgr restart statement below should be removed |
| 4189 | // from the comment. |
| 4190 | |
| 4191 | // mainCtrl.SimulateRestart(t) |
| 4192 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4193 | |
| 4194 | // Check subscription |
| 4195 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4196 | |
| 4197 | // Delete subscription |
| 4198 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4199 | |
| 4200 | //Wait that subs is cleaned |
| 4201 | waitSubsCleanup(t, e2SubsId, 10) |
| 4202 | |
| 4203 | mainCtrl.VerifyCounterValues(t) |
| 4204 | } |
| 4205 | |
| 4206 | //----------------------------------------------------------------------------- |
| 4207 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4208 | // |
| 4209 | // stub stub |
| 4210 | // +-------+ +-------+ +---------+ +---------+ |
| 4211 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4212 | // +-------+ +-------+ +---------+ +---------+ |
| 4213 | // | | | | |
| 4214 | // | | RESTSubReq1 | | |
| 4215 | // | |---------------->| | |
| 4216 | // | | | | |
| 4217 | // | | RESTSubResp1 | | |
| 4218 | // | |<----------------| | |
| 4219 | // | | | | |
| 4220 | // | | | SubReq1 | |
| 4221 | // | | |------------->| |
| 4222 | // | | | SubResp1 | |
| 4223 | // | | |<-------------| |
| 4224 | // | | RESTNotif1 | | |
| 4225 | // | |<----------------| | |
| 4226 | // | | | | |
| 4227 | // | RESTSubReq2 | | |
| 4228 | // |------------------------------>| | |
| 4229 | // | | | | |
| 4230 | // | RESTSubResp2 | | |
| 4231 | // |<------------------------------| | |
| 4232 | // | | | | |
| 4233 | // | | RESTNotif2 | | |
| 4234 | // |<------------------------------| | |
| 4235 | // | | | | |
| 4236 | // | | Submgr restart | |
| 4237 | // | | | | |
| 4238 | // | | RESTSubDelReq1 | | |
| 4239 | // | |---------------->| | |
| 4240 | // | | | | |
| 4241 | // | | RESTSubDelResp1 | | |
| 4242 | // | |<----------------| | |
| 4243 | // | | | | |
| 4244 | // | | Submgr restart | |
| 4245 | // | | | | |
| 4246 | // | RESTSubDelReq2 | | |
| 4247 | // |------------------------------>| | |
| 4248 | // | | | | |
| 4249 | // | RESTSubDelResp2 | | |
| 4250 | // |<------------------------------| | |
| 4251 | // | | | | |
| 4252 | // | | | SubDelReq2 | |
| 4253 | // | | |------------->| |
| 4254 | // | | | | |
| 4255 | // | | | SubDelResp2 | |
| 4256 | // | | |<-------------| |
| 4257 | // | | | | |
| 4258 | // |
| 4259 | //----------------------------------------------------------------------------- |
| 4260 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4261 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4262 | |
| 4263 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4264 | Counter{cRestSubReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4265 | Counter{cSubReqToE2, 1}, |
| 4266 | Counter{cSubRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4267 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4268 | Counter{cMergedSubscriptions, 1}, |
| 4269 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4270 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4271 | Counter{cSubDelReqToE2, 1}, |
| 4272 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4273 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4274 | }) |
| 4275 | |
| 4276 | // Remove possible existing subscription |
| 4277 | mainCtrl.removeExistingSubscriptions(t) |
| 4278 | |
| 4279 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4280 | |
| 4281 | // Create subscription 1 |
| 4282 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4283 | xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
| 4284 | |
| 4285 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4286 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4287 | params.SetMeid("RAN_NAME_1") |
| 4288 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4289 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
| 4290 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4291 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4292 | e2SubsId2 := <-xappConn2.RESTNotification |
| 4293 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 4294 | |
| 4295 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4296 | |
| 4297 | // When SDL support for the REST Interface is added |
| 4298 | // the submgr restart statement below should be removed |
| 4299 | // from the comment. |
| 4300 | |
| 4301 | // mainCtrl.SimulateRestart(t) |
| 4302 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4303 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4304 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 4305 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4306 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4307 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4308 | |
| 4309 | // When SDL support for the REST Interface is added |
| 4310 | // the submgr restart statement below should be removed |
| 4311 | // from the comment. |
| 4312 | |
| 4313 | // mainCtrl.SimulateRestart(t) |
| 4314 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4315 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4316 | |
| 4317 | // Delete subscription 2 |
| 4318 | deleteXapp2Subscription(t, &restSubId2) |
| 4319 | |
| 4320 | //Wait that subs is cleaned |
| 4321 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4322 | |
| 4323 | mainCtrl.VerifyCounterValues(t) |
| 4324 | } |
| 4325 | |
| 4326 | //----------------------------------------------------------------------------- |
| 4327 | // TestRESTReportSubReqAndSubDelOk |
| 4328 | // |
| 4329 | // stub stub |
| 4330 | // +-------+ +---------+ +---------+ |
| 4331 | // | xapp | | submgr | | e2term | |
| 4332 | // +-------+ +---------+ +---------+ |
| 4333 | // | | | |
| 4334 | // | RestSubReq | | |
| 4335 | // |---------------->| | |
| 4336 | // | | | |
| 4337 | // | RESTSubResp | | |
| 4338 | // |<----------------| | |
| 4339 | // | | | |
| 4340 | // | | SubReq | |
| 4341 | // | |------------->| |
| 4342 | // | | | |
| 4343 | // | | SubResp | |
| 4344 | // | |<-------------| |
| 4345 | // | RESTNotif | | |
| 4346 | // |<----------------| | |
| 4347 | // | | SubReq | |
| 4348 | // | |------------->| |
| 4349 | // | | | |
| 4350 | // | | SubResp | |
| 4351 | // | |<-------------| |
| 4352 | // | RESTNotif | | |
| 4353 | // |<----------------| | |
| 4354 | // | ... | ... | |
| 4355 | // | | | |
| 4356 | // | | | |
| 4357 | // | RESTSubDelReq | | |
| 4358 | // |---------------->| | |
| 4359 | // | | | |
| 4360 | // | | SubDelReq | |
| 4361 | // | |------------->| |
| 4362 | // | | | |
| 4363 | // | | SubDelResp | |
| 4364 | // | |<-------------| |
| 4365 | // | | | |
| 4366 | // | RESTSubDelResp| | |
| 4367 | // |<----------------| | |
| 4368 | // |
| 4369 | //----------------------------------------------------------------------------- |
| 4370 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 4371 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
| 4372 | subReqCount := 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4373 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4374 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4375 | } |
| 4376 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4377 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4378 | xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4379 | |
| 4380 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4381 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4383 | |
| 4384 | var e2SubsId []uint32 |
| 4385 | for i := 0; i < subReqCount; i++ { |
| 4386 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4387 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4388 | |
| 4389 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4390 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4391 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4392 | e2SubsId = append(e2SubsId, instanceId) |
| 4393 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4394 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 4395 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 4396 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 4397 | |
| 4398 | } |
| 4399 | |
| 4400 | // Del |
| 4401 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4402 | |
| 4403 | for i := 0; i < subReqCount; i++ { |
| 4404 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4405 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4406 | } |
| 4407 | |
| 4408 | // Wait that subs is cleaned |
| 4409 | for i := 0; i < subReqCount; i++ { |
| 4410 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4411 | } |
| 4412 | |
| 4413 | xappConn1.TestMsgChanEmpty(t) |
| 4414 | e2termConn1.TestMsgChanEmpty(t) |
| 4415 | mainCtrl.wait_registry_empty(t, 10) |
| 4416 | } |
| 4417 | |
| 4418 | /* |
| 4419 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 4420 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 4421 | |
| 4422 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4423 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4424 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4425 | |
| 4426 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4427 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4428 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4429 | } |
| 4430 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4431 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4432 | xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4433 | |
| 4434 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4435 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4436 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4437 | //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4438 | //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) |
| 4439 | |
| 4440 | var e2SubsId []uint32 |
| 4441 | for i := 0; i < subReqCount; i++ { |
| 4442 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4443 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4444 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4445 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4446 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4447 | e2SubsId = append(e2SubsId, instanceId) |
| 4448 | } |
| 4449 | |
| 4450 | // Del |
| 4451 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4452 | |
| 4453 | for i := 0; i < subReqCount; i++ { |
| 4454 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4455 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4456 | } |
| 4457 | |
| 4458 | // Wait that subs is cleaned |
| 4459 | for i := 0; i < subReqCount; i++ { |
| 4460 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4461 | } |
| 4462 | xappConn1.TestMsgChanEmpty(t) |
| 4463 | e2termConn1.TestMsgChanEmpty(t) |
| 4464 | mainCtrl.wait_registry_empty(t, 10) |
| 4465 | } |
| 4466 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4467 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 4468 | |
| 4469 | subReqCount := 2 |
| 4470 | |
| 4471 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4472 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4473 | Counter{cSubReqToE2, 2}, |
| 4474 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4475 | Counter{cRestSubRespToXapp, 2}, |
| 4476 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4477 | Counter{cSubDelReqToE2, 2}, |
| 4478 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4479 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4480 | }) |
| 4481 | |
| 4482 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4483 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4484 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4485 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4486 | |
| 4487 | assert.Equal(t, len(e2SubsIds), 2) |
| 4488 | |
| 4489 | // Del |
| 4490 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4491 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4492 | |
| 4493 | xappConn1.TestMsgChanEmpty(t) |
| 4494 | e2termConn1.TestMsgChanEmpty(t) |
| 4495 | mainCtrl.wait_registry_empty(t, 10) |
| 4496 | |
| 4497 | mainCtrl.VerifyCounterValues(t) |
| 4498 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4499 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 4500 | |
| 4501 | subReqCount := 19 |
| 4502 | |
| 4503 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4504 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4505 | Counter{cSubReqToE2, 19}, |
| 4506 | Counter{cSubRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4507 | Counter{cRestSubRespToXapp, 19}, |
| 4508 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4509 | Counter{cSubDelReqToE2, 19}, |
| 4510 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4511 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4512 | }) |
| 4513 | |
| 4514 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4515 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4516 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4517 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4518 | |
| 4519 | assert.Equal(t, len(e2SubsIds), 19) |
| 4520 | |
| 4521 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4522 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4523 | |
| 4524 | xappConn1.TestMsgChanEmpty(t) |
| 4525 | e2termConn1.TestMsgChanEmpty(t) |
| 4526 | mainCtrl.wait_registry_empty(t, 10) |
| 4527 | |
| 4528 | mainCtrl.VerifyCounterValues(t) |
| 4529 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4530 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 4531 | |
| 4532 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4533 | |
| 4534 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4535 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4536 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4537 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4538 | Counter{cRestSubRespToXapp, uint64(subReqCount)}, |
| 4539 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4540 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4541 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
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.GetRESTSubsReqReportParams(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), subReqCount) |
| 4551 | |
| 4552 | // Del |
| 4553 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4554 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4555 | |
| 4556 | xappConn1.TestMsgChanEmpty(t) |
| 4557 | e2termConn1.TestMsgChanEmpty(t) |
| 4558 | mainCtrl.wait_registry_empty(t, 10) |
| 4559 | |
| 4560 | mainCtrl.VerifyCounterValues(t) |
| 4561 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4562 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4563 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 4564 | |
| 4565 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4566 | |
| 4567 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4568 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4569 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4570 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4571 | Counter{cRestSubRespToXapp, uint64(subReqCount)}, |
| 4572 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4573 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4574 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4575 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4576 | }) |
| 4577 | |
| 4578 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4579 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4580 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4581 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4582 | |
| 4583 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4584 | |
| 4585 | // Del |
| 4586 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4587 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4588 | |
| 4589 | xappConn1.TestMsgChanEmpty(t) |
| 4590 | e2termConn1.TestMsgChanEmpty(t) |
| 4591 | mainCtrl.wait_registry_empty(t, 10) |
| 4592 | |
| 4593 | mainCtrl.VerifyCounterValues(t) |
| 4594 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4595 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4596 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 4597 | |
| 4598 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4599 | |
| 4600 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4601 | Counter{cRestSubReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4602 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4603 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4604 | Counter{cRestSubRespToXapp, uint64(subReqCount)}, |
| 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 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4628 | |
| 4629 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 4630 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 4631 | |
| 4632 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4633 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4634 | Counter{cSubReqToE2, 2}, |
| 4635 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4636 | Counter{cRestSubRespToXapp, 2}, |
| 4637 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4638 | Counter{cSubDelReqToE2, 2}, |
| 4639 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4640 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4641 | }) |
| 4642 | |
| 4643 | // Req1 |
| 4644 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4645 | |
| 4646 | //Subs Create |
| 4647 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4648 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4649 | |
| 4650 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4651 | |
| 4652 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4653 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4654 | params.SetMeid("RAN_NAME_1") |
| 4655 | eventTriggerDefinition := "1234" |
| 4656 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 4657 | |
| 4658 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4659 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4660 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4661 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4662 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4663 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4664 | |
| 4665 | deleteXapp1Subscription(t, &restSubId1) |
| 4666 | deleteXapp2Subscription(t, &restSubId2) |
| 4667 | |
| 4668 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4669 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4670 | |
| 4671 | mainCtrl.VerifyCounterValues(t) |
| 4672 | |
| 4673 | } |
| 4674 | |
| 4675 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 4676 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 4677 | |
| 4678 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4679 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4680 | Counter{cSubReqToE2, 2}, |
| 4681 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4682 | Counter{cRestSubRespToXapp, 2}, |
| 4683 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4684 | Counter{cSubDelReqToE2, 2}, |
| 4685 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4686 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4687 | }) |
| 4688 | |
| 4689 | // Req1 |
| 4690 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4691 | |
| 4692 | //Subs Create |
| 4693 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4694 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4695 | |
| 4696 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4697 | |
| 4698 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4699 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4700 | params.SetMeid("RAN_NAME_1") |
| 4701 | |
| 4702 | actionId := int64(1) |
| 4703 | actionType := "report" |
| 4704 | actionDefinition := "56781" |
| 4705 | subsequestActionType := "continue" |
| 4706 | timeToWait := "w10ms" |
| 4707 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4708 | |
| 4709 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4710 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4711 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4712 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4713 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4714 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4715 | |
| 4716 | deleteXapp1Subscription(t, &restSubId1) |
| 4717 | deleteXapp2Subscription(t, &restSubId2) |
| 4718 | |
| 4719 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4720 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4721 | |
| 4722 | mainCtrl.VerifyCounterValues(t) |
| 4723 | |
| 4724 | } |
| 4725 | |
| 4726 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 4727 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 4728 | |
| 4729 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4730 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4731 | Counter{cSubReqToE2, 2}, |
| 4732 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4733 | Counter{cRestSubRespToXapp, 2}, |
| 4734 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4735 | Counter{cSubDelReqToE2, 2}, |
| 4736 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4737 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4738 | }) |
| 4739 | |
| 4740 | // Req1 |
| 4741 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4742 | |
| 4743 | //Subs Create |
| 4744 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4745 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4746 | |
| 4747 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4748 | |
| 4749 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4750 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4751 | params.SetMeid("RAN_NAME_1") |
| 4752 | params.SetSubActionIDs(int64(2)) |
| 4753 | |
| 4754 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4755 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4756 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4757 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4758 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4759 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4760 | |
| 4761 | deleteXapp1Subscription(t, &restSubId1) |
| 4762 | deleteXapp2Subscription(t, &restSubId2) |
| 4763 | |
| 4764 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4765 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4766 | |
| 4767 | mainCtrl.VerifyCounterValues(t) |
| 4768 | |
| 4769 | } |
| 4770 | |
| 4771 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 4772 | CaseBegin("TestRESTSubReqDiffActionType") |
| 4773 | |
| 4774 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4775 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4776 | Counter{cSubReqToE2, 2}, |
| 4777 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4778 | Counter{cRestSubRespToXapp, 2}, |
| 4779 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4780 | Counter{cSubDelReqToE2, 2}, |
| 4781 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4782 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4783 | }) |
| 4784 | |
| 4785 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4786 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4787 | |
| 4788 | //Subs Create |
| 4789 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4790 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4791 | |
| 4792 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4793 | |
| 4794 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4795 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4796 | params.SetMeid("RAN_NAME_1") |
| 4797 | |
| 4798 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4799 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4800 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4801 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4802 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4803 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4804 | |
| 4805 | deleteXapp1Subscription(t, &restSubId1) |
| 4806 | deleteXapp2Subscription(t, &restSubId2) |
| 4807 | |
| 4808 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4809 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4810 | |
| 4811 | mainCtrl.VerifyCounterValues(t) |
| 4812 | |
| 4813 | } |
| 4814 | |
| 4815 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 4816 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 4817 | |
| 4818 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4819 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4820 | Counter{cSubReqToE2, 2}, |
| 4821 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4822 | Counter{cRestSubRespToXapp, 2}, |
| 4823 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4824 | Counter{cSubDelReqToE2, 2}, |
| 4825 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4826 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4827 | }) |
| 4828 | |
| 4829 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4830 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4831 | |
| 4832 | //Subs Create |
| 4833 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4834 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4835 | |
| 4836 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4837 | |
| 4838 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4839 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4840 | params.SetMeid("RAN_NAME_1") |
| 4841 | |
| 4842 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4843 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4844 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4845 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4846 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4847 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4848 | |
| 4849 | deleteXapp1Subscription(t, &restSubId1) |
| 4850 | deleteXapp2Subscription(t, &restSubId2) |
| 4851 | |
| 4852 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4853 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4854 | |
| 4855 | mainCtrl.VerifyCounterValues(t) |
| 4856 | |
| 4857 | } |
| 4858 | |
| 4859 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 4860 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 4861 | |
| 4862 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4863 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4864 | Counter{cSubReqToE2, 2}, |
| 4865 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4866 | Counter{cRestSubRespToXapp, 2}, |
| 4867 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4868 | Counter{cSubDelReqToE2, 2}, |
| 4869 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4870 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4871 | }) |
| 4872 | |
| 4873 | // Req1 |
| 4874 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4875 | |
| 4876 | //Subs Create |
| 4877 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4878 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4879 | |
| 4880 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4881 | |
| 4882 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4883 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4884 | params.SetMeid("RAN_NAME_1") |
| 4885 | actionDefinition := "5678" |
| 4886 | params.SetSubActionDefinition(actionDefinition) |
| 4887 | |
| 4888 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4889 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4890 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4891 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4892 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4893 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4894 | |
| 4895 | deleteXapp1Subscription(t, &restSubId1) |
| 4896 | deleteXapp2Subscription(t, &restSubId2) |
| 4897 | |
| 4898 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4899 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4900 | |
| 4901 | mainCtrl.VerifyCounterValues(t) |
| 4902 | |
| 4903 | } |
| 4904 | |
| 4905 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 4906 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 4907 | |
| 4908 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4909 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4910 | Counter{cSubReqToE2, 2}, |
| 4911 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4912 | Counter{cRestSubRespToXapp, 2}, |
| 4913 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4914 | Counter{cSubDelReqToE2, 2}, |
| 4915 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4916 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4917 | }) |
| 4918 | |
| 4919 | // Req1 |
| 4920 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4921 | |
| 4922 | //Subs Create |
| 4923 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4924 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4925 | |
| 4926 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4927 | |
| 4928 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4929 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4930 | params.SetMeid("RAN_NAME_1") |
| 4931 | actionDefinition := "56782" |
| 4932 | params.SetSubActionDefinition(actionDefinition) |
| 4933 | |
| 4934 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4935 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4936 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4937 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4938 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4939 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4940 | |
| 4941 | deleteXapp1Subscription(t, &restSubId1) |
| 4942 | deleteXapp2Subscription(t, &restSubId2) |
| 4943 | |
| 4944 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4945 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4946 | |
| 4947 | mainCtrl.VerifyCounterValues(t) |
| 4948 | |
| 4949 | } |
| 4950 | |
| 4951 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 4952 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 4953 | |
| 4954 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4955 | Counter{cRestSubReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4956 | Counter{cSubReqToE2, 2}, |
| 4957 | Counter{cSubRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4958 | Counter{cRestSubRespToXapp, 2}, |
| 4959 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4960 | Counter{cSubDelReqToE2, 2}, |
| 4961 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 4962 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4963 | }) |
| 4964 | |
| 4965 | // Req1 |
| 4966 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4967 | |
| 4968 | //Subs Create |
| 4969 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4970 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4971 | |
| 4972 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4973 | |
| 4974 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4975 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4976 | params.SetMeid("RAN_NAME_1") |
| 4977 | params.SetTimeToWait("w200ms") |
| 4978 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4979 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4980 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4981 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4982 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4983 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4984 | |
| 4985 | deleteXapp1Subscription(t, &restSubId1) |
| 4986 | deleteXapp2Subscription(t, &restSubId2) |
| 4987 | |
| 4988 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4989 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4990 | |
| 4991 | mainCtrl.VerifyCounterValues(t) |
| 4992 | |
| 4993 | } |
| 4994 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 4995 | //----------------------------------------------------------------------------- |
| 4996 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 4997 | // |
| 4998 | // stub stub |
| 4999 | // +-------+ +---------+ +---------+ |
| 5000 | // | xapp | | submgr | | e2term | |
| 5001 | // +-------+ +---------+ +---------+ |
| 5002 | // | | | |
| 5003 | // | RestSubReq | | |
| 5004 | // |---------------->| | |
| 5005 | // | | | |
| 5006 | // | RESTSubResp | | |
| 5007 | // |<----------------| | |
| 5008 | // | | | |
| 5009 | // | | SubReq | |
| 5010 | // | |------------->| |
| 5011 | // | | | |
| 5012 | // | | SubResp | ASN.1 decode fails |
| 5013 | // | |<-------------| |
| 5014 | // | | | |
| 5015 | // | | SubReq | |
| 5016 | // | |------------->| |
| 5017 | // | | | |
| 5018 | // | | SubFail | Duplicated action |
| 5019 | // | |<-------------| |
| 5020 | // | RESTNotif (fail)| | |
| 5021 | // |<----------------| | |
| 5022 | // | | SubDelReq | |
| 5023 | // | |------------->| |
| 5024 | // | | | |
| 5025 | // | | SubDelResp | |
| 5026 | // | |<-------------| |
| 5027 | // |
| 5028 | //----------------------------------------------------------------------------- |
| 5029 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
| 5030 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5031 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5032 | |
| 5033 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5034 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5035 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5036 | |
| 5037 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5038 | // Decode of this response fails which will result resending original request |
| 5039 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5040 | |
| 5041 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5042 | |
| 5043 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5044 | |
| 5045 | // Subscription already created in E2 Node. |
| 5046 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5047 | fparams.Set(crereq) |
| 5048 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5049 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5050 | |
| 5051 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5052 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5053 | |
| 5054 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5055 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5056 | |
| 5057 | // Wait that subs is cleaned |
| 5058 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5059 | |
| 5060 | xappConn1.TestMsgChanEmpty(t) |
| 5061 | e2termConn1.TestMsgChanEmpty(t) |
| 5062 | mainCtrl.wait_registry_empty(t, 10) |
| 5063 | } |
| 5064 | |
| 5065 | //----------------------------------------------------------------------------- |
| 5066 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5067 | // |
| 5068 | // stub stub |
| 5069 | // +-------+ +---------+ +---------+ |
| 5070 | // | xapp | | submgr | | e2term | |
| 5071 | // +-------+ +---------+ +---------+ |
| 5072 | // | | | |
| 5073 | // | RestSubReq | | |
| 5074 | // |---------------->| | |
| 5075 | // | | | |
| 5076 | // | RESTSubResp | | |
| 5077 | // |<----------------| | |
| 5078 | // | | | |
| 5079 | // | | SubReq | |
| 5080 | // | |------------->| |
| 5081 | // | | | |
| 5082 | // | | SubResp | Unknown instanceId |
| 5083 | // | |<-------------| |
| 5084 | // | | | |
| 5085 | // | | SubReq | |
| 5086 | // | |------------->| |
| 5087 | // | | | |
| 5088 | // | | SubFail | Duplicated action |
| 5089 | // | |<-------------| |
| 5090 | // | RESTNotif (fail)| | |
| 5091 | // |<----------------| | |
| 5092 | // | | SubDelReq | |
| 5093 | // | |------------->| |
| 5094 | // | | | |
| 5095 | // | | SubDelResp | |
| 5096 | // | |<-------------| |
| 5097 | // |
| 5098 | //----------------------------------------------------------------------------- |
| 5099 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
| 5100 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5101 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5102 | |
| 5103 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5104 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5105 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5106 | |
| 5107 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5108 | |
| 5109 | // Unknown instanceId in this response which will result resending original request |
| 5110 | orgInstanceId := crereq.RequestId.InstanceId |
| 5111 | crereq.RequestId.InstanceId = 0 |
| 5112 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5113 | |
| 5114 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5115 | |
| 5116 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5117 | |
| 5118 | // Subscription already created in E2 Node. |
| 5119 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5120 | fparams.Set(crereq) |
| 5121 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5122 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5123 | |
| 5124 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5125 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5126 | |
| 5127 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5128 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5129 | |
| 5130 | // Wait that subs is cleaned |
| 5131 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 5132 | |
| 5133 | xappConn1.TestMsgChanEmpty(t) |
| 5134 | e2termConn1.TestMsgChanEmpty(t) |
| 5135 | mainCtrl.wait_registry_empty(t, 10) |
| 5136 | } |
| 5137 | |
| 5138 | //----------------------------------------------------------------------------- |
| 5139 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 5140 | // |
| 5141 | // stub stub |
| 5142 | // +-------+ +---------+ +---------+ |
| 5143 | // | xapp | | submgr | | e2term | |
| 5144 | // +-------+ +---------+ +---------+ |
| 5145 | // | | | |
| 5146 | // | RestSubReq | | |
| 5147 | // |---------------->| | |
| 5148 | // | | | |
| 5149 | // | RESTSubResp | | |
| 5150 | // |<----------------| | |
| 5151 | // | | | |
| 5152 | // | | SubReq | |
| 5153 | // | |------------->| |
| 5154 | // | | | |
| 5155 | // | | SubResp | No transaction for the response |
| 5156 | // | |<-------------| |
| 5157 | // | | | |
| 5158 | // | | SubReq | |
| 5159 | // | |------------->| |
| 5160 | // | | | |
| 5161 | // | | SubFail | Duplicated action |
| 5162 | // | |<-------------| |
| 5163 | // | RESTNotif (fail)| | |
| 5164 | // |<----------------| | |
| 5165 | // | | SubDelReq | |
| 5166 | // | |------------->| |
| 5167 | // | | | |
| 5168 | // | | SubDelResp | |
| 5169 | // | |<-------------| |
| 5170 | // | | | |
| 5171 | // | | SubDelReq | |
| 5172 | // | |------------->| |
| 5173 | // | | | |
| 5174 | // | | SubDelResp | |
| 5175 | // | |<-------------| |
| 5176 | // |
| 5177 | //----------------------------------------------------------------------------- |
| 5178 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
| 5179 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 5180 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5181 | |
| 5182 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5183 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5184 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5185 | |
| 5186 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5187 | |
| 5188 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5189 | // No transaction exist for this response which will result resending original request |
| 5190 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5191 | |
| 5192 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5193 | |
| 5194 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5195 | |
| 5196 | // Subscription already created in E2 Node. |
| 5197 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5198 | fparams.Set(crereq) |
| 5199 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5200 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5201 | |
| 5202 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5203 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5204 | |
| 5205 | // Resending happens because there no transaction |
| 5206 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5207 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5208 | |
| 5209 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5210 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5211 | |
| 5212 | // Wait that subs is cleaned |
| 5213 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5214 | |
| 5215 | xappConn1.TestMsgChanEmpty(t) |
| 5216 | e2termConn1.TestMsgChanEmpty(t) |
| 5217 | mainCtrl.wait_registry_empty(t, 10) |
| 5218 | |
| 5219 | } |
| 5220 | |
| 5221 | //----------------------------------------------------------------------------- |
| 5222 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 5223 | // |
| 5224 | // stub stub |
| 5225 | // +-------+ +---------+ +---------+ |
| 5226 | // | xapp | | submgr | | e2term | |
| 5227 | // +-------+ +---------+ +---------+ |
| 5228 | // | | | |
| 5229 | // | RestSubReq | | |
| 5230 | // |---------------->| | |
| 5231 | // | | | |
| 5232 | // | RESTSubResp | | |
| 5233 | // |<----------------| | |
| 5234 | // | | | |
| 5235 | // | | SubReq | |
| 5236 | // | |------------->| |
| 5237 | // | | | |
| 5238 | // | | SubFail | ASN.1 decode fails |
| 5239 | // | |<-------------| |
| 5240 | // | | | |
| 5241 | // | | SubReq | |
| 5242 | // | |------------->| |
| 5243 | // | | | |
| 5244 | // | | SubFail | Duplicated action |
| 5245 | // | |<-------------| |
| 5246 | // | RESTNotif (fail)| | |
| 5247 | // |<----------------| | |
| 5248 | // | | SubDelReq | |
| 5249 | // | |------------->| |
| 5250 | // | | | |
| 5251 | // | | SubDelResp | |
| 5252 | // | |<-------------| |
| 5253 | // |
| 5254 | //----------------------------------------------------------------------------- |
| 5255 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
| 5256 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 5257 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5258 | |
| 5259 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5260 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5261 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5262 | |
| 5263 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5264 | |
| 5265 | // Decode of this response fails which will result resending original request |
| 5266 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 5267 | |
| 5268 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5269 | |
| 5270 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5271 | |
| 5272 | // Subscription already created in E2 Node. |
| 5273 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5274 | fparams.Set(crereq) |
| 5275 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5276 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5277 | |
| 5278 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5279 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5280 | |
| 5281 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5282 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5283 | |
| 5284 | // Wait that subs is cleaned |
| 5285 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5286 | |
| 5287 | xappConn1.TestMsgChanEmpty(t) |
| 5288 | e2termConn1.TestMsgChanEmpty(t) |
| 5289 | mainCtrl.wait_registry_empty(t, 10) |
| 5290 | } |
| 5291 | |
| 5292 | //----------------------------------------------------------------------------- |
| 5293 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5294 | // |
| 5295 | // stub stub |
| 5296 | // +-------+ +---------+ +---------+ |
| 5297 | // | xapp | | submgr | | e2term | |
| 5298 | // +-------+ +---------+ +---------+ |
| 5299 | // | | | |
| 5300 | // | RestSubReq | | |
| 5301 | // |---------------->| | |
| 5302 | // | | | |
| 5303 | // | RESTSubResp | | |
| 5304 | // |<----------------| | |
| 5305 | // | | | |
| 5306 | // | | SubReq | |
| 5307 | // | |------------->| |
| 5308 | // | | | |
| 5309 | // | | SubFail | Unknown instanceId |
| 5310 | // | |<-------------| |
| 5311 | // | | | |
| 5312 | // | | SubReq | |
| 5313 | // | |------------->| |
| 5314 | // | | | |
| 5315 | // | | SubFail | Duplicated action |
| 5316 | // | |<-------------| |
| 5317 | // | RESTNotif (fail)| | |
| 5318 | // |<----------------| | |
| 5319 | // | | SubDelReq | |
| 5320 | // | |------------->| |
| 5321 | // | | | |
| 5322 | // | | SubDelResp | |
| 5323 | // | |<-------------| |
| 5324 | // |
| 5325 | //----------------------------------------------------------------------------- |
| 5326 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
| 5327 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 5328 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5329 | |
| 5330 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5331 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5332 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5333 | |
| 5334 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5335 | |
| 5336 | // Unknown instanceId in this response which will result resending original request |
| 5337 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5338 | fparams.Set(crereq) |
| 5339 | fparams.Fail.RequestId.InstanceId = 0 |
| 5340 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5341 | |
| 5342 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5343 | |
| 5344 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5345 | |
| 5346 | // Subscription already created in E2 Node. |
| 5347 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5348 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5349 | |
| 5350 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5351 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5352 | |
| 5353 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5354 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5355 | |
| 5356 | // Wait that subs is cleaned |
| 5357 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5358 | |
| 5359 | xappConn1.TestMsgChanEmpty(t) |
| 5360 | e2termConn1.TestMsgChanEmpty(t) |
| 5361 | mainCtrl.wait_registry_empty(t, 10) |
| 5362 | } |
| 5363 | |
| 5364 | //----------------------------------------------------------------------------- |
| 5365 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 5366 | // |
| 5367 | // stub stub |
| 5368 | // +-------+ +---------+ +---------+ |
| 5369 | // | xapp | | submgr | | e2term | |
| 5370 | // +-------+ +---------+ +---------+ |
| 5371 | // | | | |
| 5372 | // | RestSubReq | | |
| 5373 | // |---------------->| | |
| 5374 | // | | | |
| 5375 | // | RESTSubResp | | |
| 5376 | // |<----------------| | |
| 5377 | // | | | |
| 5378 | // | | SubReq | |
| 5379 | // | |------------->| |
| 5380 | // | | | |
| 5381 | // | | SubFail | No transaction for the response |
| 5382 | // | |<-------------| |
| 5383 | // | | | |
| 5384 | // | | SubReq | |
| 5385 | // | |------------->| |
| 5386 | // | | | |
| 5387 | // | | SubFail | Duplicated action |
| 5388 | // | |<-------------| |
| 5389 | // | RESTNotif (fail)| | |
| 5390 | // |<----------------| | |
| 5391 | // | | SubDelReq | |
| 5392 | // | |------------->| |
| 5393 | // | | | |
| 5394 | // | | SubDelResp | |
| 5395 | // | |<-------------| |
| 5396 | // |
| 5397 | //----------------------------------------------------------------------------- |
| 5398 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
| 5399 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 5400 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5401 | |
| 5402 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5403 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5404 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5405 | |
| 5406 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5407 | |
| 5408 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5409 | |
| 5410 | // No transaction exist for this response which will result resending original request |
| 5411 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5412 | fparams.Set(crereq) |
| 5413 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5414 | |
| 5415 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5416 | |
| 5417 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5418 | |
| 5419 | // Subscription already created in E2 Node. |
| 5420 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5421 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5422 | |
| 5423 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5424 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5425 | |
| 5426 | // Resending happens because there no transaction |
| 5427 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5428 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5429 | |
| 5430 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5431 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5432 | |
| 5433 | // Wait that subs is cleaned |
| 5434 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5435 | |
| 5436 | xappConn1.TestMsgChanEmpty(t) |
| 5437 | e2termConn1.TestMsgChanEmpty(t) |
| 5438 | mainCtrl.wait_registry_empty(t, 10) |
| 5439 | } |
| 5440 | |
| 5441 | //----------------------------------------------------------------------------- |
| 5442 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 5443 | // |
| 5444 | // stub stub |
| 5445 | // +-------+ +---------+ +---------+ |
| 5446 | // | xapp | | submgr | | e2term | |
| 5447 | // +-------+ +---------+ +---------+ |
| 5448 | // | | | |
| 5449 | // | [SUBS CREATE] | |
| 5450 | // | | | |
| 5451 | // | | | |
| 5452 | // | RESTSubDelReq | | |
| 5453 | // |---------------->| | |
| 5454 | // | | | |
| 5455 | // | RESTSubDelResp | | |
| 5456 | // |<----------------| | |
| 5457 | // | | | |
| 5458 | // | | SubDelReq | |
| 5459 | // | |------------->| |
| 5460 | // | | | |
| 5461 | // | | SubDelResp | ASN.1 decode fails |
| 5462 | // | |<-------------| |
| 5463 | // | | | |
| 5464 | // | | SubDelReq | |
| 5465 | // | |------------->| |
| 5466 | // | | | |
| 5467 | // | | SubDelFail | Subscription does exist any more |
| 5468 | // | |<-------------| |
| 5469 | // | | | |
| 5470 | // |
| 5471 | //----------------------------------------------------------------------------- |
| 5472 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
| 5473 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
| 5474 | |
| 5475 | // Req |
| 5476 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5477 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5478 | |
| 5479 | // Del |
| 5480 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5481 | |
| 5482 | // E2t: Receive 1st SubsDelReq |
| 5483 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5484 | |
| 5485 | // Decode of this response fails which will result resending original request |
| 5486 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 5487 | |
| 5488 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5489 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5490 | |
| 5491 | // Subscription does not exist in in E2 Node. |
| 5492 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5493 | |
| 5494 | // Wait that subs is cleaned |
| 5495 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5496 | |
| 5497 | xappConn1.TestMsgChanEmpty(t) |
| 5498 | e2termConn1.TestMsgChanEmpty(t) |
| 5499 | mainCtrl.wait_registry_empty(t, 10) |
| 5500 | } |
| 5501 | |
| 5502 | //----------------------------------------------------------------------------- |
| 5503 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 5504 | // |
| 5505 | // stub stub |
| 5506 | // +-------+ +---------+ +---------+ |
| 5507 | // | xapp | | submgr | | e2term | |
| 5508 | // +-------+ +---------+ +---------+ |
| 5509 | // | | | |
| 5510 | // | [SUBS CREATE] | |
| 5511 | // | | | |
| 5512 | // | | | |
| 5513 | // | RESTSubDelReq | | |
| 5514 | // |---------------->| | |
| 5515 | // | | | |
| 5516 | // | RESTSubDelResp | | |
| 5517 | // |<----------------| | |
| 5518 | // | | | |
| 5519 | // | | SubDelReq | |
| 5520 | // | |------------->| |
| 5521 | // | | | |
| 5522 | // | | SubDelResp | Unknown instanceId |
| 5523 | // | |<-------------| |
| 5524 | // | | | |
| 5525 | // | | SubDelReq | |
| 5526 | // | |------------->| |
| 5527 | // | | | |
| 5528 | // | | SubDelFail | Subscription does exist any more |
| 5529 | // | |<-------------| |
| 5530 | // |
| 5531 | //----------------------------------------------------------------------------- |
| 5532 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
| 5533 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
| 5534 | |
| 5535 | // Req |
| 5536 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5537 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5538 | |
| 5539 | // Del |
| 5540 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5541 | |
| 5542 | // E2t: Receive 1st SubsDelReq |
| 5543 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5544 | |
| 5545 | // Unknown instanceId in this response which will result resending original request |
| 5546 | delreq.RequestId.InstanceId = 0 |
| 5547 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5548 | |
| 5549 | // E2t: Receive 2nd SubsDelReq |
| 5550 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5551 | |
| 5552 | // Subscription does not exist in in E2 Node. |
| 5553 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5554 | |
| 5555 | // Wait that subs is cleaned |
| 5556 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5557 | |
| 5558 | xappConn1.TestMsgChanEmpty(t) |
| 5559 | e2termConn1.TestMsgChanEmpty(t) |
| 5560 | mainCtrl.wait_registry_empty(t, 10) |
| 5561 | } |
| 5562 | |
| 5563 | //----------------------------------------------------------------------------- |
| 5564 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 5565 | // |
| 5566 | // stub stub |
| 5567 | // +-------+ +---------+ +---------+ |
| 5568 | // | xapp | | submgr | | e2term | |
| 5569 | // +-------+ +---------+ +---------+ |
| 5570 | // | | | |
| 5571 | // | [SUBS CREATE] | |
| 5572 | // | | | |
| 5573 | // | | | |
| 5574 | // | RESTSubDelReq | | |
| 5575 | // |---------------->| | |
| 5576 | // | | | |
| 5577 | // | RESTSubDelResp | | |
| 5578 | // |<----------------| | |
| 5579 | // | | | |
| 5580 | // | | SubDelReq | |
| 5581 | // | |------------->| |
| 5582 | // | | | |
| 5583 | // | | SubDelResp | No transaction for the response |
| 5584 | // | |<-------------| |
| 5585 | // | | | |
| 5586 | // | | SubDelReq | |
| 5587 | // | |------------->| |
| 5588 | // | | | |
| 5589 | // | | SubDelFail | Subscription does exist any more |
| 5590 | // | |<-------------| |
| 5591 | // |
| 5592 | //----------------------------------------------------------------------------- |
| 5593 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
| 5594 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
| 5595 | |
| 5596 | // Req |
| 5597 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5598 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5599 | |
| 5600 | // Del |
| 5601 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5602 | |
| 5603 | // E2t: Receive 1st SubsDelReq |
| 5604 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5605 | |
| 5606 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5607 | |
| 5608 | // No transaction exist for this response which will result resending original request |
| 5609 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5610 | |
| 5611 | // E2t: Receive 2nd SubsDelReq |
| 5612 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5613 | |
| 5614 | // Subscription does not exist in in E2 Node. |
| 5615 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5616 | |
| 5617 | // Wait that subs is cleaned |
| 5618 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5619 | |
| 5620 | xappConn1.TestMsgChanEmpty(t) |
| 5621 | e2termConn1.TestMsgChanEmpty(t) |
| 5622 | mainCtrl.wait_registry_empty(t, 10) |
| 5623 | } |
| 5624 | |
| 5625 | //----------------------------------------------------------------------------- |
| 5626 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 5627 | // |
| 5628 | // stub stub |
| 5629 | // +-------+ +---------+ +---------+ |
| 5630 | // | xapp | | submgr | | e2term | |
| 5631 | // +-------+ +---------+ +---------+ |
| 5632 | // | | | |
| 5633 | // | [SUBS CREATE] | |
| 5634 | // | | | |
| 5635 | // | | | |
| 5636 | // | RESTSubDelReq | | |
| 5637 | // |---------------->| | |
| 5638 | // | | | |
| 5639 | // | RESTSubDelResp | | |
| 5640 | // |<----------------| | |
| 5641 | // | | | |
| 5642 | // | | SubDelReq | |
| 5643 | // | |------------->| |
| 5644 | // | | | |
| 5645 | // | | SubDelFail | ASN.1 decode fails |
| 5646 | // | |<-------------| |
| 5647 | // | | | |
| 5648 | // | | SubDelReq | |
| 5649 | // | |------------->| |
| 5650 | // | | | |
| 5651 | // | | SubDelFail | Subscription does exist any more |
| 5652 | // | |<-------------| |
| 5653 | // |
| 5654 | //----------------------------------------------------------------------------- |
| 5655 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
| 5656 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
| 5657 | |
| 5658 | // Req |
| 5659 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5660 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5661 | |
| 5662 | // Del |
| 5663 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5664 | |
| 5665 | // E2t: Receive 1st SubsDelReq |
| 5666 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5667 | |
| 5668 | // Decode of this response fails which will result resending original request |
| 5669 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 5670 | |
| 5671 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5672 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5673 | |
| 5674 | // Subscription does not exist in in E2 Node. |
| 5675 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5676 | |
| 5677 | // Wait that subs is cleaned |
| 5678 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5679 | |
| 5680 | xappConn1.TestMsgChanEmpty(t) |
| 5681 | e2termConn1.TestMsgChanEmpty(t) |
| 5682 | mainCtrl.wait_registry_empty(t, 10) |
| 5683 | } |
| 5684 | |
| 5685 | //----------------------------------------------------------------------------- |
| 5686 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 5687 | // |
| 5688 | // stub stub |
| 5689 | // +-------+ +---------+ +---------+ |
| 5690 | // | xapp | | submgr | | e2term | |
| 5691 | // +-------+ +---------+ +---------+ |
| 5692 | // | | | |
| 5693 | // | [SUBS CREATE] | |
| 5694 | // | | | |
| 5695 | // | | | |
| 5696 | // | RESTSubDelReq | | |
| 5697 | // |---------------->| | |
| 5698 | // | | | |
| 5699 | // | RESTSubDelResp | | |
| 5700 | // |<----------------| | |
| 5701 | // | | | |
| 5702 | // | | SubDelReq | |
| 5703 | // | |------------->| |
| 5704 | // | | | |
| 5705 | // | | SubDelFail | Unknown instanceId |
| 5706 | // | |<-------------| |
| 5707 | // | | | |
| 5708 | // | | SubDelReq | |
| 5709 | // | |------------->| |
| 5710 | // | | | |
| 5711 | // | | SubDelFail | Subscription does exist any more |
| 5712 | // | |<-------------| |
| 5713 | // |
| 5714 | //----------------------------------------------------------------------------- |
| 5715 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
| 5716 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
| 5717 | |
| 5718 | // Req |
| 5719 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5720 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5721 | |
| 5722 | // Del |
| 5723 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5724 | |
| 5725 | // E2t: Receive 1st SubsDelReq |
| 5726 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5727 | |
| 5728 | // Unknown instanceId in this response which will result resending original request |
| 5729 | delreq.RequestId.InstanceId = 0 |
| 5730 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5731 | |
| 5732 | // E2t: Receive 2nd SubsDelReq |
| 5733 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5734 | |
| 5735 | // Subscription does not exist in in E2 Node. |
| 5736 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5737 | |
| 5738 | // Wait that subs is cleaned |
| 5739 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5740 | |
| 5741 | xappConn1.TestMsgChanEmpty(t) |
| 5742 | e2termConn1.TestMsgChanEmpty(t) |
| 5743 | mainCtrl.wait_registry_empty(t, 10) |
| 5744 | } |
| 5745 | |
| 5746 | //----------------------------------------------------------------------------- |
| 5747 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 5748 | // |
| 5749 | // stub stub |
| 5750 | // +-------+ +---------+ +---------+ |
| 5751 | // | xapp | | submgr | | e2term | |
| 5752 | // +-------+ +---------+ +---------+ |
| 5753 | // | | | |
| 5754 | // | [SUBS CREATE] | |
| 5755 | // | | | |
| 5756 | // | | | |
| 5757 | // | RESTSubDelReq | | |
| 5758 | // |---------------->| | |
| 5759 | // | | | |
| 5760 | // | RESTSubDelResp | | |
| 5761 | // |<----------------| | |
| 5762 | // | | | |
| 5763 | // | | SubDelReq | |
| 5764 | // | |------------->| |
| 5765 | // | | | |
| 5766 | // | | SubDelFail | No transaction for the response |
| 5767 | // | |<-------------| |
| 5768 | // | | | |
| 5769 | // | | SubDelReq | |
| 5770 | // | |------------->| |
| 5771 | // | | | |
| 5772 | // | | SubDelFail | Subscription does exist any more |
| 5773 | // | |<-------------| |
| 5774 | // |
| 5775 | //----------------------------------------------------------------------------- |
| 5776 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
| 5777 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
| 5778 | |
| 5779 | // Req |
| 5780 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5781 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5782 | |
| 5783 | // Del |
| 5784 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5785 | |
| 5786 | // E2t: Receive 1st SubsDelReq |
| 5787 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5788 | |
| 5789 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5790 | |
| 5791 | // No transaction exist for this response which will result resending original request |
| 5792 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5793 | |
| 5794 | // E2t: Receive 2nd SubsDelReq |
| 5795 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5796 | |
| 5797 | // Subscription does not exist in in E2 Node. |
| 5798 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5799 | |
| 5800 | // Wait that subs is cleaned |
| 5801 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5802 | |
| 5803 | xappConn1.TestMsgChanEmpty(t) |
| 5804 | e2termConn1.TestMsgChanEmpty(t) |
| 5805 | mainCtrl.wait_registry_empty(t, 10) |
| 5806 | } |
| 5807 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5808 | //----------------------------------------------------------------------------- |
| 5809 | // TestRESTSubReqFailAsn1PackSubReqError |
| 5810 | // |
| 5811 | // stub stub |
| 5812 | // +-------+ +---------+ +---------+ |
| 5813 | // | xapp | | submgr | | e2term | |
| 5814 | // +-------+ +---------+ +---------+ |
| 5815 | // | | | |
| 5816 | // | RESTSubReq | | |
| 5817 | // |---------------->| | |
| 5818 | // | | | |
| 5819 | // | RESTSubResp | | |
| 5820 | // |<----------------| | |
| 5821 | // | | | |
| 5822 | // | ASN.1 encode fails | |
| 5823 | // | | | |
| 5824 | // | | SubDelReq | |
| 5825 | // | |------------->| |
| 5826 | // | | | |
| 5827 | // | | SubDelFail | |
| 5828 | // | |<-------------| |
| 5829 | // | | | |
| 5830 | // | RESTNotif | | |
| 5831 | // | unsuccess | | |
| 5832 | // |<----------------| | |
| 5833 | // | | | |
| 5834 | // | [SUBS DELETE] | |
| 5835 | // | | | |
| 5836 | // |
| 5837 | //----------------------------------------------------------------------------- |
| 5838 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 5839 | |
| 5840 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 5841 | Counter{cRestSubReqFromXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5842 | Counter{cSubDelReqToE2, 1}, |
| 5843 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame^] | 5844 | Counter{cRestSubRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5845 | }) |
| 5846 | |
| 5847 | subReqCount := 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5848 | |
| 5849 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5850 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5851 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 5852 | |
| 5853 | // Req |
| 5854 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5855 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5856 | |
| 5857 | // E2t: Receive SubsDelReq |
| 5858 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5859 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5860 | |
| 5861 | // Subscription does not exist in in E2 Node. |
| 5862 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5863 | |
| 5864 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5865 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 5866 | |
| 5867 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 5868 | // Wait that subs is cleaned |
| 5869 | waitSubsCleanup(t, e2SubsId, 10) |
| 5870 | mainCtrl.VerifyCounterValues(t) |
| 5871 | } |
| 5872 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5873 | //////////////////////////////////////////////////////////////////////////////////// |
| 5874 | // Services for UT cases |
| 5875 | //////////////////////////////////////////////////////////////////////////////////// |
| 5876 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5877 | const host string = "localhost" |
| 5878 | |
| 5879 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 5880 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5881 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5882 | } |
| 5883 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 5884 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5885 | |
| 5886 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 5887 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 5888 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 5889 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 5890 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5891 | |
| 5892 | return restSubId, e2SubsId |
| 5893 | } |
| 5894 | |
| 5895 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 5896 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5897 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5898 | if meid != "" { |
| 5899 | params.SetMeid(meid) |
| 5900 | } |
| 5901 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 5902 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 5903 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 5904 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5905 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 5906 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5907 | |
| 5908 | return restSubId, e2SubsId |
| 5909 | } |
| 5910 | |
| 5911 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5912 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5913 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5914 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 5915 | |
| 5916 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5917 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5918 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 5919 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5920 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 5921 | |
| 5922 | return restSubId, e2SubsId |
| 5923 | } |
| 5924 | |
| 5925 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5926 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5927 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5928 | |
| 5929 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 5930 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 5931 | fparams1.Set(crereq1) |
| 5932 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 5933 | |
| 5934 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 5935 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5936 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 5937 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5938 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 5939 | |
| 5940 | return restSubId, e2SubsId |
| 5941 | } |
| 5942 | |
| 5943 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 5944 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 5945 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 5946 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 5947 | } |
| 5948 | |
| 5949 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 5950 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 5951 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5952 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5953 | } |
| 5954 | |
| 5955 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 5956 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 5957 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5958 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5959 | } |
| 5960 | |
| 5961 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 5962 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5963 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 5964 | assert.Equal(t, resp[0].Meid, meid) |
| 5965 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 5966 | } |
| 5967 | |
| 5968 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 5969 | //Wait that subs is cleaned |
| 5970 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 5971 | |
| 5972 | xappConn1.TestMsgChanEmpty(t) |
| 5973 | xappConn2.TestMsgChanEmpty(t) |
| 5974 | e2termConn1.TestMsgChanEmpty(t) |
| 5975 | mainCtrl.wait_registry_empty(t, timeout) |
| 5976 | } |
| 5977 | |
| 5978 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 5979 | |
| 5980 | var e2SubsId []uint32 |
| 5981 | |
| 5982 | for i := 0; i < count; i++ { |
| 5983 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 5984 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 5985 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 5986 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 5987 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 5988 | e2SubsId = append(e2SubsId, instanceId) |
| 5989 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 5990 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 5991 | <-time.After(100 * time.Millisecond) |
| 5992 | } |
| 5993 | return e2SubsId |
| 5994 | } |
| 5995 | |
| 5996 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 5997 | |
| 5998 | for i := 0; i < len(e2SubsIds); i++ { |
| 5999 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 6000 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6001 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6002 | <-time.After(1 * time.Second) |
| 6003 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 6004 | <-time.After(100 * time.Millisecond) |
| 6005 | } |
| 6006 | |
| 6007 | // Wait that subs is cleaned |
| 6008 | for i := 0; i < len(e2SubsIds); i++ { |
| 6009 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 6010 | } |
| 6011 | |
| 6012 | } |