Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 23 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 24 | "testing" |
| 25 | "time" |
| 26 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 31 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 32 | ) |
| 33 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 34 | func TestSuiteSetup(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 35 | // The effect of this call shall endure thgough the UT suite! |
| 36 | // If this causes any issues, the previout interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 37 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 38 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 39 | |
| 40 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | //----------------------------------------------------------------------------- |
| 44 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 45 | // |
| 46 | // stub stub stub |
| 47 | // +-------+ +---------+ +---------+ +---------+ |
| 48 | // | xapp | | submgr | | e2term | | rtmgr | |
| 49 | // +-------+ +---------+ +---------+ +---------+ |
| 50 | // | | | | |
| 51 | // | RESTSubReq | | | |
| 52 | // |---------------->| | | |
| 53 | // | | RouteCreate | | |
| 54 | // | |--------------------------->| // The order of these events may vary |
| 55 | // | | | | |
| 56 | // | RESTSubResp | | | // The order of these events may vary |
| 57 | // |<----------------| | | |
| 58 | // | | RouteResponse| | |
| 59 | // | |<---------------------------| // The order of these events may vary |
| 60 | // | | | | |
| 61 | // | | SubReq | | |
| 62 | // | |------------->| | // The order of these events may vary |
| 63 | // | | | | |
| 64 | // | | SubResp | | |
| 65 | // | |<-------------| | |
| 66 | // | RESTNotif1 | | | |
| 67 | // |<----------------| | | |
| 68 | // | | | | |
| 69 | // | RESTSubDelReq | | | |
| 70 | // |---------------->| | | |
| 71 | // | | SubDelReq | | |
| 72 | // | |------------->| | |
| 73 | // | | | | |
| 74 | // | RESTSubDelResp| | | |
| 75 | // |<----------------| | | |
| 76 | // | | | | |
| 77 | // | | SubDelResp | | |
| 78 | // | |<-------------| | |
| 79 | // | | | | |
| 80 | // | | | | |
| 81 | // |
| 82 | //----------------------------------------------------------------------------- |
| 83 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 84 | |
| 85 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 86 | |
| 87 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 88 | |
| 89 | waitSubsCleanup(t, e2SubsId, 10) |
| 90 | } |
| 91 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 92 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 93 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 94 | // |
| 95 | // stub stub stub |
| 96 | // +-------+ +---------+ +---------+ +---------+ |
| 97 | // | xapp | | submgr | | e2term | | rtmgr | |
| 98 | // +-------+ +---------+ +---------+ +---------+ |
| 99 | // | | | | |
| 100 | // | RESTSubReq | | | |
| 101 | // |---------------->| | | |
| 102 | // | | RouteCreate | | |
| 103 | // | |--------------------------->| // The order of these events may vary |
| 104 | // | | | | |
| 105 | // | RESTSubResp | | | // The order of these events may vary |
| 106 | // |<----------------| | | |
| 107 | // | | RouteResponse| | |
| 108 | // | |<---------------------------| // The order of these events may vary |
| 109 | // | | | | |
| 110 | // | | SubReq | | |
| 111 | // | |------------->| | // The order of these events may vary |
| 112 | // | | | | |
| 113 | // | | SubResp | | |
| 114 | // | |<-------------| | |
| 115 | // | RESTNotif1 | | | |
| 116 | // |<----------------| | | |
| 117 | // | | | | |
| 118 | // | RESTSubDelReq | | | |
| 119 | // |---------------->| | | |
| 120 | // | | | | |
| 121 | // | RESTSubDelResp| | | |
| 122 | // |<----------------| | | |
| 123 | // | | | | |
| 124 | // | | | | |
| 125 | // |
| 126 | //----------------------------------------------------------------------------- |
| 127 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 128 | |
| 129 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 130 | |
| 131 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 132 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 133 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 134 | |
| 135 | waitSubsCleanup(t, e2SubsId, 10) |
| 136 | } |
| 137 | |
| 138 | //----------------------------------------------------------------------------- |
| 139 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 140 | // |
| 141 | // stub stub stub |
| 142 | // +-------+ +---------+ +---------+ +---------+ |
| 143 | // | xapp | | submgr | | e2term | | rtmgr | |
| 144 | // +-------+ +---------+ +---------+ +---------+ |
| 145 | // | | | | |
| 146 | // | RESTSubReq | | | |
| 147 | // |---------------->| | | |
| 148 | // | | RouteCreate | | |
| 149 | // | |--------------------------->| // The order of these events may vary |
| 150 | // | | | | |
| 151 | // | RESTSubResp | | | // The order of these events may vary |
| 152 | // |<----------------| | | |
| 153 | // | | RouteResponse| | |
| 154 | // | |<---------------------------| // The order of these events may vary |
| 155 | // | | | | |
| 156 | // | | SubReq | | |
| 157 | // | |------------->| | // The order of these events may vary |
| 158 | // | | | | |
| 159 | // | | SubResp | | |
| 160 | // | |<-------------| | |
| 161 | // | RESTNotif1 | | | |
| 162 | // |<----------------| | | |
| 163 | // | | | | |
| 164 | // | RESTSubDelReq | | | |
| 165 | // |---------------->| | | |
| 166 | // | | SubDelReq | | |
| 167 | // | |------------->| | |
| 168 | // | | | | |
| 169 | // | RESTSubDelResp| | | |
| 170 | // |<----------------| | | // The order of these events may vary |
| 171 | // | | | | |
| 172 | // | | SubDelResp | | |
| 173 | // | |<-------------| | // 1.st NOK |
| 174 | // | | | | |
| 175 | // | | SubDelReq | | |
| 176 | // | |------------->| | |
| 177 | // | | | | |
| 178 | // | | SubDelResp | | |
| 179 | // | |<-------------| | // 2.nd NOK |
| 180 | // |
| 181 | //----------------------------------------------------------------------------- |
| 182 | |
| 183 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 184 | |
| 185 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 186 | |
| 187 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 188 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 189 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 190 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 191 | |
| 192 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 193 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 194 | |
| 195 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 196 | |
| 197 | waitSubsCleanup(t, e2SubsId, 10) |
| 198 | } |
| 199 | |
| 200 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 201 | // TestSubReqAndRouteNok |
| 202 | // |
| 203 | // stub stub |
| 204 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 205 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 206 | // +-------+ +---------+ +---------+ |
| 207 | // | | | |
| 208 | // | SubReq | | |
| 209 | // |------------->| | |
| 210 | // | | | |
| 211 | // | | RouteCreate | |
| 212 | // | |------------->| |
| 213 | // | | | |
| 214 | // | | RouteCreate | |
| 215 | // | | status:400 | |
| 216 | // | |<-------------| |
| 217 | // | | | |
| 218 | // | [SUBS INT DELETE] | |
| 219 | // | | | |
| 220 | // |
| 221 | //----------------------------------------------------------------------------- |
| 222 | |
| 223 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 224 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 225 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 226 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 227 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 228 | Counter{cSubReqFromXapp, 1}, |
| 229 | Counter{cRouteCreateFail, 1}, |
| 230 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 231 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 232 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 233 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 234 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 235 | waiter.WaitResult(t) |
| 236 | |
| 237 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 238 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 239 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 240 | xappConn1.TestMsgChanEmpty(t) |
| 241 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 242 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 243 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 244 | |
| 245 | <-time.After(1 * time.Second) |
| 246 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 250 | // TestSubReqAndRouteUpdateNok |
| 251 | |
| 252 | // stub stub |
| 253 | // +-------+ +-------+ +---------+ +---------+ |
| 254 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 255 | // +-------+ +-------+ +---------+ +---------+ |
| 256 | // | | | | |
| 257 | // | [SUBS CREATE] | | |
| 258 | // | | | | |
| 259 | // | | | | |
| 260 | // | | | | |
| 261 | // | SubReq (mergeable) | | |
| 262 | // |--------------------------->| | | |
| 263 | // | | | | |
| 264 | // | | | RouteUpdate | |
| 265 | // | | |------------->| |
| 266 | // | | | | |
| 267 | // | | | RouteUpdate | |
| 268 | // | | | status:400 | |
| 269 | // | | |<-------------| |
| 270 | // | | | | |
| 271 | // | [SUBS INT DELETE] | | |
| 272 | // | | | | |
| 273 | // | | | | |
| 274 | // | [SUBS DELETE] | | |
| 275 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 276 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 277 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 278 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 279 | |
| 280 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 281 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 282 | Counter{cSubReqFromXapp, 2}, |
| 283 | Counter{cSubReqToE2, 1}, |
| 284 | Counter{cSubRespFromE2, 1}, |
| 285 | Counter{cSubRespToXapp, 1}, |
| 286 | Counter{cRouteCreateUpdateFail, 1}, |
| 287 | Counter{cSubDelReqFromXapp, 1}, |
| 288 | Counter{cSubDelReqToE2, 1}, |
| 289 | Counter{cSubDelRespFromE2, 1}, |
| 290 | Counter{cSubDelRespToXapp, 1}, |
| 291 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 292 | |
| 293 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 294 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 295 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 296 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 297 | |
| 298 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 299 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 300 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 301 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 302 | |
| 303 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 304 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 305 | xappConn2.SendSubsReq(t, nil, nil) |
| 306 | waiter.WaitResult(t) |
| 307 | |
| 308 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 309 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 310 | |
| 311 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 312 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 313 | |
| 314 | //Wait that subs is cleaned |
| 315 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 316 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 317 | |
| 318 | xappConn1.TestMsgChanEmpty(t) |
| 319 | xappConn2.TestMsgChanEmpty(t) |
| 320 | e2termConn1.TestMsgChanEmpty(t) |
| 321 | mainCtrl.wait_registry_empty(t, 10) |
| 322 | |
| 323 | mainCtrl.VerifyCounterValues(t) |
| 324 | } |
| 325 | |
| 326 | //----------------------------------------------------------------------------- |
| 327 | // TestSubDelReqAndRouteDeleteNok |
| 328 | // |
| 329 | // stub stub |
| 330 | // +-------+ +---------+ +---------+ +---------+ |
| 331 | // | xapp | | submgr | | e2term | | rtmgr | |
| 332 | // +-------+ +---------+ +---------+ +---------+ |
| 333 | // | | | | |
| 334 | // | [SUBS CREATE] | | |
| 335 | // | | | | |
| 336 | // | | | | |
| 337 | // | | | | |
| 338 | // | SubDelReq | | | |
| 339 | // |------------->| | | |
| 340 | // | | SubDelReq | | |
| 341 | // | |------------->| | |
| 342 | // | | SubDelRsp | | |
| 343 | // | |<-------------| | |
| 344 | // | SubDelRsp | | | |
| 345 | // |<-------------| | | |
| 346 | // | | RouteDelete | | |
| 347 | // | |---------------------------->| |
| 348 | // | | | | |
| 349 | // | | RouteDelete | | |
| 350 | // | | status:400 | | |
| 351 | // | |<----------------------------| |
| 352 | // | | | | |
| 353 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 354 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 355 | |
| 356 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 357 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 358 | Counter{cSubReqFromXapp, 1}, |
| 359 | Counter{cSubReqToE2, 1}, |
| 360 | Counter{cSubRespFromE2, 1}, |
| 361 | Counter{cSubRespToXapp, 1}, |
| 362 | Counter{cSubDelReqFromXapp, 1}, |
| 363 | Counter{cRouteDeleteFail, 1}, |
| 364 | Counter{cSubDelReqToE2, 1}, |
| 365 | Counter{cSubDelRespFromE2, 1}, |
| 366 | Counter{cSubDelRespToXapp, 1}, |
| 367 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 368 | |
| 369 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 370 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 371 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 372 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 373 | |
| 374 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 375 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 376 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 377 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 378 | |
| 379 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 380 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 381 | |
| 382 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 383 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 384 | waiter.WaitResult(t) |
| 385 | |
| 386 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 387 | |
| 388 | //Wait that subs is cleaned |
| 389 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 390 | |
| 391 | xappConn1.TestMsgChanEmpty(t) |
| 392 | xappConn2.TestMsgChanEmpty(t) |
| 393 | e2termConn1.TestMsgChanEmpty(t) |
| 394 | mainCtrl.wait_registry_empty(t, 10) |
| 395 | |
| 396 | mainCtrl.VerifyCounterValues(t) |
| 397 | } |
| 398 | |
| 399 | //----------------------------------------------------------------------------- |
| 400 | // TestSubMergeDelAndRouteUpdateNok |
| 401 | // stub stub |
| 402 | // +-------+ +-------+ +---------+ +---------+ |
| 403 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 404 | // +-------+ +-------+ +---------+ +---------+ |
| 405 | // | | | | |
| 406 | // | | | | |
| 407 | // | | | | |
| 408 | // | | SubReq1 | | |
| 409 | // | |------------->| | |
| 410 | // | | | | |
| 411 | // | | | SubReq1 | |
| 412 | // | | |------------->| |
| 413 | // | | | SubResp1 | |
| 414 | // | | |<-------------| |
| 415 | // | | SubResp1 | | |
| 416 | // | |<-------------| | |
| 417 | // | | | | |
| 418 | // | SubReq2 | | |
| 419 | // |--------------------------->| | |
| 420 | // | | | | |
| 421 | // | SubResp2 | | |
| 422 | // |<---------------------------| | |
| 423 | // | | | | |
| 424 | // | | SubDelReq 1 | | |
| 425 | // | |------------->| | |
| 426 | // | | | RouteUpdate | |
| 427 | // | | |-----> rtmgr | |
| 428 | // | | | | |
| 429 | // | | | RouteUpdate | |
| 430 | // | | | status:400 | |
| 431 | // | | |<----- rtmgr | |
| 432 | // | | | | |
| 433 | // | | SubDelResp 1 | | |
| 434 | // | |<-------------| | |
| 435 | // | | | | |
| 436 | // | SubDelReq 2 | | |
| 437 | // |--------------------------->| | |
| 438 | // | | | | |
| 439 | // | | | SubDelReq 2 | |
| 440 | // | | |------------->| |
| 441 | // | | | | |
| 442 | // | | | SubDelReq 2 | |
| 443 | // | | |------------->| |
| 444 | // | | | | |
| 445 | // | SubDelResp 2 | | |
| 446 | // |<---------------------------| | |
| 447 | // |
| 448 | //----------------------------------------------------------------------------- |
| 449 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 450 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 451 | |
| 452 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 453 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 454 | Counter{cSubReqFromXapp, 2}, |
| 455 | Counter{cSubReqToE2, 1}, |
| 456 | Counter{cSubRespFromE2, 1}, |
| 457 | Counter{cSubRespToXapp, 2}, |
| 458 | Counter{cSubDelReqFromXapp, 2}, |
| 459 | Counter{cRouteDeleteUpdateFail, 1}, |
| 460 | Counter{cSubDelReqToE2, 1}, |
| 461 | Counter{cSubDelRespFromE2, 1}, |
| 462 | Counter{cSubDelRespToXapp, 2}, |
| 463 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 464 | |
| 465 | //Req1 |
| 466 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 467 | rparams1.Init() |
| 468 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 469 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 470 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 471 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 472 | |
| 473 | //Req2 |
| 474 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 475 | rparams2.Init() |
| 476 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 477 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 478 | |
| 479 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 480 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 481 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 482 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 483 | |
| 484 | //Del1 |
| 485 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 486 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 487 | waiter.WaitResult(t) |
| 488 | |
| 489 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 490 | |
| 491 | //Del2 |
| 492 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 493 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 494 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 495 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 496 | //Wait that subs is cleaned |
| 497 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 498 | |
| 499 | xappConn1.TestMsgChanEmpty(t) |
| 500 | xappConn2.TestMsgChanEmpty(t) |
| 501 | e2termConn1.TestMsgChanEmpty(t) |
| 502 | mainCtrl.wait_registry_empty(t, 10) |
| 503 | |
| 504 | mainCtrl.VerifyCounterValues(t) |
| 505 | } |
| 506 | |
| 507 | //----------------------------------------------------------------------------- |
| 508 | |
| 509 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 510 | // TestSubReqAndSubDelOk |
| 511 | // |
| 512 | // stub stub |
| 513 | // +-------+ +---------+ +---------+ |
| 514 | // | xapp | | submgr | | e2term | |
| 515 | // +-------+ +---------+ +---------+ |
| 516 | // | | | |
| 517 | // | SubReq | | |
| 518 | // |------------->| | |
| 519 | // | | | |
| 520 | // | | SubReq | |
| 521 | // | |------------->| |
| 522 | // | | | |
| 523 | // | | SubResp | |
| 524 | // | |<-------------| |
| 525 | // | | | |
| 526 | // | SubResp | | |
| 527 | // |<-------------| | |
| 528 | // | | | |
| 529 | // | | | |
| 530 | // | SubDelReq | | |
| 531 | // |------------->| | |
| 532 | // | | | |
| 533 | // | | SubDelReq | |
| 534 | // | |------------->| |
| 535 | // | | | |
| 536 | // | | SubDelResp | |
| 537 | // | |<-------------| |
| 538 | // | | | |
| 539 | // | SubDelResp | | |
| 540 | // |<-------------| | |
| 541 | // |
| 542 | //----------------------------------------------------------------------------- |
| 543 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 544 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 545 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 546 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 547 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 548 | Counter{cSubReqFromXapp, 1}, |
| 549 | Counter{cSubReqToE2, 1}, |
| 550 | Counter{cSubRespFromE2, 1}, |
| 551 | Counter{cSubRespToXapp, 1}, |
| 552 | Counter{cSubDelReqFromXapp, 1}, |
| 553 | Counter{cSubDelReqToE2, 1}, |
| 554 | Counter{cSubDelRespFromE2, 1}, |
| 555 | Counter{cSubDelRespToXapp, 1}, |
| 556 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 557 | |
| 558 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 559 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 560 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 561 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 562 | |
| 563 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 564 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 565 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 566 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 567 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 568 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 569 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 570 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 571 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 572 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 573 | |
| 574 | //Wait that subs is cleaned |
| 575 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 576 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 577 | xappConn1.TestMsgChanEmpty(t) |
| 578 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 579 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 580 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 581 | |
| 582 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | //----------------------------------------------------------------------------- |
| 586 | // TestSubReqRetransmission |
| 587 | // |
| 588 | // stub stub |
| 589 | // +-------+ +---------+ +---------+ |
| 590 | // | xapp | | submgr | | e2term | |
| 591 | // +-------+ +---------+ +---------+ |
| 592 | // | | | |
| 593 | // | SubReq | | |
| 594 | // |------------->| | |
| 595 | // | | | |
| 596 | // | | SubReq | |
| 597 | // | |------------->| |
| 598 | // | | | |
| 599 | // | SubReq | | |
| 600 | // | (retrans) | | |
| 601 | // |------------->| | |
| 602 | // | | | |
| 603 | // | | SubResp | |
| 604 | // | |<-------------| |
| 605 | // | | | |
| 606 | // | SubResp | | |
| 607 | // |<-------------| | |
| 608 | // | | | |
| 609 | // | [SUBS DELETE] | |
| 610 | // | | | |
| 611 | // |
| 612 | //----------------------------------------------------------------------------- |
| 613 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 614 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 615 | |
| 616 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 617 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 618 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 619 | |
| 620 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 621 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 622 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 623 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 624 | // hack as there is no real way to see has message be handled. |
| 625 | // Previuos counter check just tells that is has been received by submgr |
| 626 | // --> artificial delay |
| 627 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 628 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 629 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 630 | |
| 631 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 632 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 633 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 634 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 635 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 636 | |
| 637 | //Wait that subs is cleaned |
| 638 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 639 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 640 | xappConn1.TestMsgChanEmpty(t) |
| 641 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 642 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 643 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 644 | } |
| 645 | |
| 646 | //----------------------------------------------------------------------------- |
| 647 | // TestSubDelReqRetransmission |
| 648 | // |
| 649 | // stub stub |
| 650 | // +-------+ +---------+ +---------+ |
| 651 | // | xapp | | submgr | | e2term | |
| 652 | // +-------+ +---------+ +---------+ |
| 653 | // | | | |
| 654 | // | [SUBS CREATE] | |
| 655 | // | | | |
| 656 | // | | | |
| 657 | // | SubDelReq | | |
| 658 | // |------------->| | |
| 659 | // | | | |
| 660 | // | | SubDelReq | |
| 661 | // | |------------->| |
| 662 | // | | | |
| 663 | // | SubDelReq | | |
| 664 | // | (same sub) | | |
| 665 | // | (same xid) | | |
| 666 | // |------------->| | |
| 667 | // | | | |
| 668 | // | | SubDelResp | |
| 669 | // | |<-------------| |
| 670 | // | | | |
| 671 | // | SubDelResp | | |
| 672 | // |<-------------| | |
| 673 | // |
| 674 | //----------------------------------------------------------------------------- |
| 675 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 676 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 677 | |
| 678 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 679 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 680 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 681 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 682 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 683 | |
| 684 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 685 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 686 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 687 | |
| 688 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 689 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 690 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 691 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 692 | // hack as there is no real way to see has message be handled. |
| 693 | // Previuos counter check just tells that is has been received by submgr |
| 694 | // --> artificial delay |
| 695 | <-time.After(1 * time.Second) |
| 696 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 697 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 698 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 699 | |
| 700 | //Wait that subs is cleaned |
| 701 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 702 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 703 | xappConn1.TestMsgChanEmpty(t) |
| 704 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 705 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 706 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | //----------------------------------------------------------------------------- |
| 710 | // TestSubDelReqCollision |
| 711 | // |
| 712 | // stub stub |
| 713 | // +-------+ +---------+ +---------+ |
| 714 | // | xapp | | submgr | | e2term | |
| 715 | // +-------+ +---------+ +---------+ |
| 716 | // | | | |
| 717 | // | [SUBS CREATE] | |
| 718 | // | | | |
| 719 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 720 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 721 | // |------------->| | |
| 722 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 723 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 724 | // | |------------->| |
| 725 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 726 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 727 | // | (same sub) | | |
| 728 | // | (diff xid) | | |
| 729 | // |------------->| | |
| 730 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 731 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 732 | // | |<-------------| |
| 733 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 734 | // | SubDelResp 1 | | |
| 735 | // |<-------------| | |
| 736 | // | | | |
| 737 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 738 | // |<-------------| | |
| 739 | // |
| 740 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 741 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 742 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 743 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 744 | |
| 745 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 746 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 747 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 748 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 749 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 750 | |
| 751 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 752 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 753 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 754 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 755 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 756 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 757 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 758 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 759 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 760 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 761 | // hack as there is no real way to see has message be handled. |
| 762 | // Previuos counter check just tells that is has been received by submgr |
| 763 | // --> artificial delay |
| 764 | <-time.After(1 * time.Second) |
| 765 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 766 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 767 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 768 | |
| 769 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 770 | xappConn1.RecvSubsDelResp(t, nil) |
| 771 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 772 | |
| 773 | //Wait that subs is cleaned |
| 774 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 775 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 776 | xappConn1.TestMsgChanEmpty(t) |
| 777 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 778 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 779 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 780 | } |
| 781 | |
| 782 | //----------------------------------------------------------------------------- |
| 783 | // TestSubReqAndSubDelOkTwoParallel |
| 784 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 785 | // stub stub stub |
| 786 | // +-------+ +-------+ +---------+ +---------+ |
| 787 | // | xapp | | xapp | | submgr | | e2term | |
| 788 | // +-------+ +-------+ +---------+ +---------+ |
| 789 | // | | | | |
| 790 | // | | | | |
| 791 | // | | | | |
| 792 | // | | SubReq1 | | |
| 793 | // | |------------->| | |
| 794 | // | | | | |
| 795 | // | | | SubReq1 | |
| 796 | // | | |------------->| |
| 797 | // | | | | |
| 798 | // | SubReq2 | | |
| 799 | // |------------------------>| | |
| 800 | // | | | | |
| 801 | // | | | SubReq2 | |
| 802 | // | | |------------->| |
| 803 | // | | | | |
| 804 | // | | | SubResp1 | |
| 805 | // | | |<-------------| |
| 806 | // | | SubResp1 | | |
| 807 | // | |<-------------| | |
| 808 | // | | | | |
| 809 | // | | | SubResp2 | |
| 810 | // | | |<-------------| |
| 811 | // | SubResp2 | | |
| 812 | // |<------------------------| | |
| 813 | // | | | | |
| 814 | // | | [SUBS 1 DELETE] | |
| 815 | // | | | | |
| 816 | // | | [SUBS 2 DELETE] | |
| 817 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 818 | // |
| 819 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 820 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 821 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 822 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 823 | |
| 824 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 825 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 826 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 827 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 828 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 829 | |
| 830 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 831 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 832 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 833 | |
| 834 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 835 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 836 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 837 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 838 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 839 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 840 | |
| 841 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 842 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 843 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 844 | |
| 845 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 846 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 847 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 848 | |
| 849 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 850 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 851 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 852 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 853 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 854 | //Wait that subs is cleaned |
| 855 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 856 | |
| 857 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 858 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 859 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 860 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 861 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 862 | //Wait that subs is cleaned |
| 863 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 864 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 865 | xappConn1.TestMsgChanEmpty(t) |
| 866 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 867 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 868 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 869 | } |
| 870 | |
| 871 | //----------------------------------------------------------------------------- |
| 872 | // TestSameSubsDiffRan |
| 873 | // Same subscription to different RANs |
| 874 | // |
| 875 | // stub stub |
| 876 | // +-------+ +---------+ +---------+ |
| 877 | // | xapp | | submgr | | e2term | |
| 878 | // +-------+ +---------+ +---------+ |
| 879 | // | | | |
| 880 | // | | | |
| 881 | // | | | |
| 882 | // | SubReq(r1) | | |
| 883 | // |------------->| | |
| 884 | // | | | |
| 885 | // | | SubReq(r1) | |
| 886 | // | |------------->| |
| 887 | // | | | |
| 888 | // | | SubResp(r1) | |
| 889 | // | |<-------------| |
| 890 | // | | | |
| 891 | // | SubResp(r1) | | |
| 892 | // |<-------------| | |
| 893 | // | | | |
| 894 | // | SubReq(r2) | | |
| 895 | // |------------->| | |
| 896 | // | | | |
| 897 | // | | SubReq(r2) | |
| 898 | // | |------------->| |
| 899 | // | | | |
| 900 | // | | SubResp(r2) | |
| 901 | // | |<-------------| |
| 902 | // | | | |
| 903 | // | SubResp(r2) | | |
| 904 | // |<-------------| | |
| 905 | // | | | |
| 906 | // | [SUBS r1 DELETE] | |
| 907 | // | | | |
| 908 | // | [SUBS r2 DELETE] | |
| 909 | // | | | |
| 910 | // |
| 911 | //----------------------------------------------------------------------------- |
| 912 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 913 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 914 | |
| 915 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 916 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 917 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 918 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 919 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 920 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 921 | |
| 922 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 923 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 924 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 925 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 926 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 927 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 928 | |
| 929 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 930 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 931 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 932 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 933 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 934 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 935 | //Wait that subs is cleaned |
| 936 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 937 | |
| 938 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 939 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 940 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 941 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 942 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 943 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 944 | //Wait that subs is cleaned |
| 945 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 946 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 947 | xappConn1.TestMsgChanEmpty(t) |
| 948 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 949 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 950 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | //----------------------------------------------------------------------------- |
| 954 | // TestSubReqRetryInSubmgr |
| 955 | // |
| 956 | // stub stub |
| 957 | // +-------+ +---------+ +---------+ |
| 958 | // | xapp | | submgr | | e2term | |
| 959 | // +-------+ +---------+ +---------+ |
| 960 | // | | | |
| 961 | // | SubReq | | |
| 962 | // |------------->| | |
| 963 | // | | | |
| 964 | // | | SubReq | |
| 965 | // | |------------->| |
| 966 | // | | | |
| 967 | // | | | |
| 968 | // | | SubReq | |
| 969 | // | |------------->| |
| 970 | // | | | |
| 971 | // | | SubResp | |
| 972 | // | |<-------------| |
| 973 | // | | | |
| 974 | // | SubResp | | |
| 975 | // |<-------------| | |
| 976 | // | | | |
| 977 | // | [SUBS DELETE] | |
| 978 | // | | | |
| 979 | // |
| 980 | //----------------------------------------------------------------------------- |
| 981 | |
| 982 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 983 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 984 | |
| 985 | // Init counter check |
| 986 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 987 | Counter{cSubReqFromXapp, 1}, |
| 988 | Counter{cSubReqToE2, 1}, |
| 989 | Counter{cSubReReqToE2, 1}, |
| 990 | Counter{cSubRespFromE2, 1}, |
| 991 | Counter{cSubRespToXapp, 1}, |
| 992 | Counter{cSubDelReqFromXapp, 1}, |
| 993 | Counter{cSubDelReqToE2, 1}, |
| 994 | Counter{cSubDelRespFromE2, 1}, |
| 995 | Counter{cSubDelRespToXapp, 1}, |
| 996 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 997 | |
| 998 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 999 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1000 | |
| 1001 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1002 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1003 | |
| 1004 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1005 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1006 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1007 | |
| 1008 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1009 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1010 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1011 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1012 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1013 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1014 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1015 | |
| 1016 | // Wait that subs is cleaned |
| 1017 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1018 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1019 | xappConn1.TestMsgChanEmpty(t) |
| 1020 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1021 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1022 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1023 | |
| 1024 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1025 | } |
| 1026 | |
| 1027 | //----------------------------------------------------------------------------- |
| 1028 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1029 | // |
| 1030 | // stub stub |
| 1031 | // +-------+ +---------+ +---------+ |
| 1032 | // | xapp | | submgr | | e2term | |
| 1033 | // +-------+ +---------+ +---------+ |
| 1034 | // | | | |
| 1035 | // | SubReq | | |
| 1036 | // |------------->| | |
| 1037 | // | | | |
| 1038 | // | | SubReq | |
| 1039 | // | |------------->| |
| 1040 | // | | | |
| 1041 | // | | | |
| 1042 | // | | SubReq | |
| 1043 | // | |------------->| |
| 1044 | // | | | |
| 1045 | // | | SubDelReq | |
| 1046 | // | |------------->| |
| 1047 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1048 | // | | SubDelResp | |
| 1049 | // | |<-------------| |
| 1050 | // | | | |
| 1051 | // |
| 1052 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1053 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1054 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1055 | |
| 1056 | // Init counter check |
| 1057 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1058 | Counter{cSubReqFromXapp, 1}, |
| 1059 | Counter{cSubReqToE2, 1}, |
| 1060 | Counter{cSubReReqToE2, 1}, |
| 1061 | Counter{cSubReqTimerExpiry, 2}, |
| 1062 | Counter{cSubDelReqToE2, 1}, |
| 1063 | Counter{cSubDelRespFromE2, 1}, |
| 1064 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1065 | |
| 1066 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1067 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1068 | |
| 1069 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1070 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1071 | |
| 1072 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1073 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1074 | |
| 1075 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1076 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1077 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1078 | |
| 1079 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1080 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1081 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1082 | xappConn1.TestMsgChanEmpty(t) |
| 1083 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1084 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1085 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1086 | |
| 1087 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1088 | } |
| 1089 | |
| 1090 | //----------------------------------------------------------------------------- |
| 1091 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1092 | // |
| 1093 | // stub stub |
| 1094 | // +-------+ +---------+ +---------+ |
| 1095 | // | xapp | | submgr | | e2term | |
| 1096 | // +-------+ +---------+ +---------+ |
| 1097 | // | | | |
| 1098 | // | SubReq | | |
| 1099 | // |------------->| | |
| 1100 | // | | | |
| 1101 | // | | SubReq | |
| 1102 | // | |------------->| |
| 1103 | // | | | |
| 1104 | // | | | |
| 1105 | // | | SubReq | |
| 1106 | // | |------------->| |
| 1107 | // | | | |
| 1108 | // | | SubDelReq | |
| 1109 | // | |------------->| |
| 1110 | // | | | |
| 1111 | // | | | |
| 1112 | // | | SubDelReq | |
| 1113 | // | |------------->| |
| 1114 | // | | | |
| 1115 | // | | | |
| 1116 | // |
| 1117 | //----------------------------------------------------------------------------- |
| 1118 | |
| 1119 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1120 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1121 | |
| 1122 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1123 | Counter{cSubReqFromXapp, 1}, |
| 1124 | Counter{cSubReqToE2, 1}, |
| 1125 | Counter{cSubReReqToE2, 1}, |
| 1126 | Counter{cSubReqTimerExpiry, 2}, |
| 1127 | Counter{cSubDelReqToE2, 1}, |
| 1128 | Counter{cSubDelReReqToE2, 1}, |
| 1129 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1130 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1131 | |
| 1132 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1133 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1134 | |
| 1135 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1136 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1137 | |
| 1138 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1139 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1140 | |
| 1141 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1142 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | |
| 1144 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1148 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1149 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1150 | xappConn1.TestMsgChanEmpty(t) |
| 1151 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1152 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1153 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1154 | |
| 1155 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | //----------------------------------------------------------------------------- |
| 1159 | // TestSubReqSubFailRespInSubmgr |
| 1160 | // |
| 1161 | // stub stub |
| 1162 | // +-------+ +---------+ +---------+ |
| 1163 | // | xapp | | submgr | | e2term | |
| 1164 | // +-------+ +---------+ +---------+ |
| 1165 | // | | | |
| 1166 | // | SubReq | | |
| 1167 | // |------------->| | |
| 1168 | // | | | |
| 1169 | // | | SubReq | |
| 1170 | // | |------------->| |
| 1171 | // | | | |
| 1172 | // | | SubFail | |
| 1173 | // | |<-------------| |
| 1174 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1175 | // | | SubDelReq | |
| 1176 | // | |------------->| |
| 1177 | // | | | |
| 1178 | // | | SubDelResp | |
| 1179 | // | |<-------------| |
| 1180 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1181 | // | SubFail | | |
| 1182 | // |<-------------| | |
| 1183 | // | | | |
| 1184 | // |
| 1185 | //----------------------------------------------------------------------------- |
| 1186 | |
| 1187 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1188 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1189 | |
| 1190 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1191 | Counter{cSubReqFromXapp, 1}, |
| 1192 | Counter{cSubReqToE2, 1}, |
| 1193 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1194 | Counter{cSubFailToXapp, 1}, |
| 1195 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1196 | |
| 1197 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1198 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1199 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1200 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1201 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1202 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1203 | fparams1.Set(crereq1) |
| 1204 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1205 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1206 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1207 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1208 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1209 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1210 | // Xapp: Receive SubsFail |
| 1211 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1212 | |
| 1213 | // Wait that subs is cleaned |
| 1214 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1215 | |
| 1216 | xappConn1.TestMsgChanEmpty(t) |
| 1217 | xappConn2.TestMsgChanEmpty(t) |
| 1218 | e2termConn1.TestMsgChanEmpty(t) |
| 1219 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1220 | |
| 1221 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1222 | } |
| 1223 | |
| 1224 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1225 | // TestSubDelReqRetryInSubmgr |
| 1226 | // |
| 1227 | // stub stub |
| 1228 | // +-------+ +---------+ +---------+ |
| 1229 | // | xapp | | submgr | | e2term | |
| 1230 | // +-------+ +---------+ +---------+ |
| 1231 | // | | | |
| 1232 | // | [SUBS CREATE] | |
| 1233 | // | | | |
| 1234 | // | | | |
| 1235 | // | SubDelReq | | |
| 1236 | // |------------->| | |
| 1237 | // | | | |
| 1238 | // | | SubDelReq | |
| 1239 | // | |------------->| |
| 1240 | // | | | |
| 1241 | // | | SubDelReq | |
| 1242 | // | |------------->| |
| 1243 | // | | | |
| 1244 | // | | SubDelResp | |
| 1245 | // | |<-------------| |
| 1246 | // | | | |
| 1247 | // | SubDelResp | | |
| 1248 | // |<-------------| | |
| 1249 | // |
| 1250 | //----------------------------------------------------------------------------- |
| 1251 | |
| 1252 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1253 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1254 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1255 | |
| 1256 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1257 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1258 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1259 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1260 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1261 | |
| 1262 | // Subs Delete |
| 1263 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1264 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1265 | |
| 1266 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1267 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1268 | |
| 1269 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1270 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1271 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1272 | |
| 1273 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1274 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1275 | |
| 1276 | // Wait that subs is cleaned |
| 1277 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1278 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1279 | xappConn1.TestMsgChanEmpty(t) |
| 1280 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1281 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1282 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | //----------------------------------------------------------------------------- |
| 1286 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1287 | // |
| 1288 | // stub stub |
| 1289 | // +-------+ +---------+ +---------+ |
| 1290 | // | xapp | | submgr | | e2term | |
| 1291 | // +-------+ +---------+ +---------+ |
| 1292 | // | | | |
| 1293 | // | [SUBS CREATE] | |
| 1294 | // | | | |
| 1295 | // | | | |
| 1296 | // | SubDelReq | | |
| 1297 | // |------------->| | |
| 1298 | // | | | |
| 1299 | // | | SubDelReq | |
| 1300 | // | |------------->| |
| 1301 | // | | | |
| 1302 | // | | SubDelReq | |
| 1303 | // | |------------->| |
| 1304 | // | | | |
| 1305 | // | | | |
| 1306 | // | SubDelResp | | |
| 1307 | // |<-------------| | |
| 1308 | // |
| 1309 | //----------------------------------------------------------------------------- |
| 1310 | |
| 1311 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1312 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1313 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1314 | |
| 1315 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1316 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1317 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1318 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1320 | |
| 1321 | // Subs Delete |
| 1322 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1323 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1324 | |
| 1325 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1326 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | |
| 1328 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1329 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1330 | |
| 1331 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1332 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1333 | |
| 1334 | // Wait that subs is cleaned |
| 1335 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1336 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1337 | xappConn1.TestMsgChanEmpty(t) |
| 1338 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1339 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1340 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1341 | } |
| 1342 | |
| 1343 | //----------------------------------------------------------------------------- |
| 1344 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1345 | // |
| 1346 | // stub stub |
| 1347 | // +-------+ +---------+ +---------+ |
| 1348 | // | xapp | | submgr | | e2term | |
| 1349 | // +-------+ +---------+ +---------+ |
| 1350 | // | | | |
| 1351 | // | [SUBS CREATE] | |
| 1352 | // | | | |
| 1353 | // | | | |
| 1354 | // | SubDelReq | | |
| 1355 | // |------------->| | |
| 1356 | // | | | |
| 1357 | // | | SubDelReq | |
| 1358 | // | |------------->| |
| 1359 | // | | | |
| 1360 | // | | SubDelFail | |
| 1361 | // | |<-------------| |
| 1362 | // | | | |
| 1363 | // | SubDelResp | | |
| 1364 | // |<-------------| | |
| 1365 | // | | | |
| 1366 | // |
| 1367 | //----------------------------------------------------------------------------- |
| 1368 | |
| 1369 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1370 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1371 | |
| 1372 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1373 | Counter{cSubReqFromXapp, 1}, |
| 1374 | Counter{cSubReqToE2, 1}, |
| 1375 | Counter{cSubRespFromE2, 1}, |
| 1376 | Counter{cSubRespToXapp, 1}, |
| 1377 | Counter{cSubDelReqFromXapp, 1}, |
| 1378 | Counter{cSubDelReqToE2, 1}, |
| 1379 | Counter{cSubDelFailFromE2, 1}, |
| 1380 | Counter{cSubDelRespToXapp, 1}, |
| 1381 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1382 | |
| 1383 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1384 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1385 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1386 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1387 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1388 | |
| 1389 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1390 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1391 | |
| 1392 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1393 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1394 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1395 | |
| 1396 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1397 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1398 | |
| 1399 | // Wait that subs is cleaned |
| 1400 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1401 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1402 | xappConn1.TestMsgChanEmpty(t) |
| 1403 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1404 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1405 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1406 | |
| 1407 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | //----------------------------------------------------------------------------- |
| 1411 | // TestSubReqAndSubDelOkSameAction |
| 1412 | // |
| 1413 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1414 | // +-------+ +-------+ +---------+ +---------+ |
| 1415 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1416 | // +-------+ +-------+ +---------+ +---------+ |
| 1417 | // | | | | |
| 1418 | // | | | | |
| 1419 | // | | | | |
| 1420 | // | | SubReq1 | | |
| 1421 | // | |------------->| | |
| 1422 | // | | | | |
| 1423 | // | | | SubReq1 | |
| 1424 | // | | |------------->| |
| 1425 | // | | | SubResp1 | |
| 1426 | // | | |<-------------| |
| 1427 | // | | SubResp1 | | |
| 1428 | // | |<-------------| | |
| 1429 | // | | | | |
| 1430 | // | SubReq2 | | |
| 1431 | // |--------------------------->| | |
| 1432 | // | | | | |
| 1433 | // | SubResp2 | | |
| 1434 | // |<---------------------------| | |
| 1435 | // | | | | |
| 1436 | // | | SubDelReq 1 | | |
| 1437 | // | |------------->| | |
| 1438 | // | | | | |
| 1439 | // | | SubDelResp 1 | | |
| 1440 | // | |<-------------| | |
| 1441 | // | | | | |
| 1442 | // | SubDelReq 2 | | |
| 1443 | // |--------------------------->| | |
| 1444 | // | | | | |
| 1445 | // | | | SubDelReq 2 | |
| 1446 | // | | |------------->| |
| 1447 | // | | | | |
| 1448 | // | | | SubDelReq 2 | |
| 1449 | // | | |------------->| |
| 1450 | // | | | | |
| 1451 | // | SubDelResp 2 | | |
| 1452 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1453 | // |
| 1454 | //----------------------------------------------------------------------------- |
| 1455 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1456 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1457 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1458 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1459 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1460 | Counter{cSubReqFromXapp, 2}, |
| 1461 | Counter{cSubReqToE2, 1}, |
| 1462 | Counter{cSubRespFromE2, 1}, |
| 1463 | Counter{cSubRespToXapp, 2}, |
| 1464 | Counter{cMergedSubscriptions, 1}, |
| 1465 | Counter{cUnmergedSubscriptions, 1}, |
| 1466 | Counter{cSubDelReqFromXapp, 2}, |
| 1467 | Counter{cSubDelReqToE2, 1}, |
| 1468 | Counter{cSubDelRespFromE2, 1}, |
| 1469 | Counter{cSubDelRespToXapp, 2}, |
| 1470 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1471 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1472 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1473 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1474 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1475 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1476 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1477 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1478 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1479 | |
| 1480 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1482 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1483 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1484 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1485 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1486 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1487 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1488 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1489 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1490 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1491 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1492 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1493 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1494 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1495 | //e2termConn1.RecvSubsDelReq(t) |
| 1496 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1497 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1498 | //Wait that subs is cleaned |
| 1499 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1500 | |
| 1501 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1502 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1503 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1504 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1505 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1506 | //Wait that subs is cleaned |
| 1507 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1508 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1509 | xappConn1.TestMsgChanEmpty(t) |
| 1510 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1511 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1512 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1513 | |
| 1514 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1515 | } |
| 1516 | |
| 1517 | //----------------------------------------------------------------------------- |
| 1518 | // TestSubReqAndSubDelOkSameActionParallel |
| 1519 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1520 | // stub stub stub |
| 1521 | // +-------+ +-------+ +---------+ +---------+ |
| 1522 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1523 | // +-------+ +-------+ +---------+ +---------+ |
| 1524 | // | | | | |
| 1525 | // | | | | |
| 1526 | // | | | | |
| 1527 | // | | SubReq1 | | |
| 1528 | // | |------------->| | |
| 1529 | // | | | | |
| 1530 | // | | | SubReq1 | |
| 1531 | // | | |------------->| |
| 1532 | // | SubReq2 | | |
| 1533 | // |--------------------------->| | |
| 1534 | // | | | SubResp1 | |
| 1535 | // | | |<-------------| |
| 1536 | // | | SubResp1 | | |
| 1537 | // | |<-------------| | |
| 1538 | // | | | | |
| 1539 | // | SubResp2 | | |
| 1540 | // |<---------------------------| | |
| 1541 | // | | | | |
| 1542 | // | | SubDelReq 1 | | |
| 1543 | // | |------------->| | |
| 1544 | // | | | | |
| 1545 | // | | SubDelResp 1 | | |
| 1546 | // | |<-------------| | |
| 1547 | // | | | | |
| 1548 | // | SubDelReq 2 | | |
| 1549 | // |--------------------------->| | |
| 1550 | // | | | | |
| 1551 | // | | | SubDelReq 2 | |
| 1552 | // | | |------------->| |
| 1553 | // | | | | |
| 1554 | // | | | SubDelReq 2 | |
| 1555 | // | | |------------->| |
| 1556 | // | | | | |
| 1557 | // | SubDelResp 2 | | |
| 1558 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1559 | // |
| 1560 | //----------------------------------------------------------------------------- |
| 1561 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1562 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1563 | |
| 1564 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1565 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1566 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1567 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1568 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1569 | |
| 1570 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1571 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1572 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1573 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1574 | |
| 1575 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1576 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1577 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1578 | |
| 1579 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1580 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1581 | |
| 1582 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1583 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1584 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1585 | |
| 1586 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1587 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1588 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1589 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1590 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1591 | |
| 1592 | //Wait that subs is cleaned |
| 1593 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1594 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1595 | xappConn1.TestMsgChanEmpty(t) |
| 1596 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1597 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1598 | mainCtrl.wait_registry_empty(t, 10) |
| 1599 | } |
| 1600 | |
| 1601 | //----------------------------------------------------------------------------- |
| 1602 | // TestSubReqAndSubDelNokSameActionParallel |
| 1603 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1604 | // stub stub stub |
| 1605 | // +-------+ +-------+ +---------+ +---------+ |
| 1606 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1607 | // +-------+ +-------+ +---------+ +---------+ |
| 1608 | // | | | | |
| 1609 | // | | | | |
| 1610 | // | | | | |
| 1611 | // | | SubReq1 | | |
| 1612 | // | |------------->| | |
| 1613 | // | | | | |
| 1614 | // | | | SubReq1 | |
| 1615 | // | | |------------->| |
| 1616 | // | SubReq2 | | |
| 1617 | // |--------------------------->| | |
| 1618 | // | | | SubFail1 | |
| 1619 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1620 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1621 | // | | | SubDelReq | |
| 1622 | // | | |------------->| |
| 1623 | // | | | SubDelResp | |
| 1624 | // | | |<-------------| |
| 1625 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1626 | // | | SubFail1 | | |
| 1627 | // | |<-------------| | |
| 1628 | // | | | | |
| 1629 | // | SubFail2 | | |
| 1630 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1631 | // |
| 1632 | //----------------------------------------------------------------------------- |
| 1633 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1634 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1635 | |
| 1636 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1637 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1638 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1639 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1640 | |
| 1641 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1642 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1643 | |
| 1644 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1645 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1646 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1647 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1648 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1649 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1650 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1651 | // E2t: send SubsFail (first) |
| 1652 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1653 | fparams1.Set(crereq1) |
| 1654 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1655 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1656 | // E2t: internal delete |
| 1657 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1658 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1659 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1660 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1661 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1662 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1663 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1664 | |
| 1665 | //Wait that subs is cleaned |
| 1666 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1667 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1668 | xappConn1.TestMsgChanEmpty(t) |
| 1669 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1670 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1671 | mainCtrl.wait_registry_empty(t, 10) |
| 1672 | } |
| 1673 | |
| 1674 | //----------------------------------------------------------------------------- |
| 1675 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1676 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1677 | // stub stub stub |
| 1678 | // +-------+ +-------+ +---------+ +---------+ |
| 1679 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1680 | // +-------+ +-------+ +---------+ +---------+ |
| 1681 | // | | | | |
| 1682 | // | | | | |
| 1683 | // | | | | |
| 1684 | // | | SubReq1 | | |
| 1685 | // | |------------->| | |
| 1686 | // | | | | |
| 1687 | // | | | SubReq1 | |
| 1688 | // | | |------------->| |
| 1689 | // | | SubReq2 | | |
| 1690 | // |--------------------------->| | |
| 1691 | // | | | | |
| 1692 | // | | | SubReq1 | |
| 1693 | // | | |------------->| |
| 1694 | // | | | | |
| 1695 | // | | | | |
| 1696 | // | | | SubDelReq | |
| 1697 | // | | |------------->| |
| 1698 | // | | | | |
| 1699 | // | | | SubDelResp | |
| 1700 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1701 | // |
| 1702 | //----------------------------------------------------------------------------- |
| 1703 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1704 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1705 | |
| 1706 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1707 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1708 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1709 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1710 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1711 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1712 | |
| 1713 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1714 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1715 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1716 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1717 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1718 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1719 | |
| 1720 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1721 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1722 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1723 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1724 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1725 | |
| 1726 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1727 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1728 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1729 | xappConn1.TestMsgChanEmpty(t) |
| 1730 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1731 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1732 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1733 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1734 | |
| 1735 | //----------------------------- Policy cases --------------------------------- |
| 1736 | //----------------------------------------------------------------------------- |
| 1737 | // TestSubReqPolicyAndSubDelOk |
| 1738 | // |
| 1739 | // stub stub |
| 1740 | // +-------+ +---------+ +---------+ |
| 1741 | // | xapp | | submgr | | e2term | |
| 1742 | // +-------+ +---------+ +---------+ |
| 1743 | // | | | |
| 1744 | // | SubReq | | |
| 1745 | // |------------->| | |
| 1746 | // | | | |
| 1747 | // | | SubReq | |
| 1748 | // | |------------->| |
| 1749 | // | | | |
| 1750 | // | | SubResp | |
| 1751 | // | |<-------------| |
| 1752 | // | | | |
| 1753 | // | SubResp | | |
| 1754 | // |<-------------| | |
| 1755 | // | | | |
| 1756 | // | | | |
| 1757 | // | SubDelReq | | |
| 1758 | // |------------->| | |
| 1759 | // | | | |
| 1760 | // | | SubDelReq | |
| 1761 | // | |------------->| |
| 1762 | // | | | |
| 1763 | // | | SubDelResp | |
| 1764 | // | |<-------------| |
| 1765 | // | | | |
| 1766 | // | SubDelResp | | |
| 1767 | // |<-------------| | |
| 1768 | // |
| 1769 | //----------------------------------------------------------------------------- |
| 1770 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1771 | CaseBegin("TestSubReqAndSubDelOk") |
| 1772 | |
| 1773 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1774 | rparams1.Init() |
| 1775 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1776 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1777 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1778 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1779 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1780 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1781 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1782 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1783 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1784 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1785 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1786 | |
| 1787 | //Wait that subs is cleaned |
| 1788 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1789 | |
| 1790 | xappConn1.TestMsgChanEmpty(t) |
| 1791 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1792 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1793 | mainCtrl.wait_registry_empty(t, 10) |
| 1794 | } |
| 1795 | |
| 1796 | //----------------------------------------------------------------------------- |
| 1797 | // TestSubReqPolicyChangeAndSubDelOk |
| 1798 | // |
| 1799 | // stub stub |
| 1800 | // +-------+ +---------+ +---------+ |
| 1801 | // | xapp | | submgr | | e2term | |
| 1802 | // +-------+ +---------+ +---------+ |
| 1803 | // | | | |
| 1804 | // | SubReq | | |
| 1805 | // |------------->| | |
| 1806 | // | | | |
| 1807 | // | | SubReq | |
| 1808 | // | |------------->| |
| 1809 | // | | | |
| 1810 | // | | SubResp | |
| 1811 | // | |<-------------| |
| 1812 | // | | | |
| 1813 | // | SubResp | | |
| 1814 | // |<-------------| | |
| 1815 | // | | | |
| 1816 | // | SubReq | | |
| 1817 | // |------------->| | |
| 1818 | // | | | |
| 1819 | // | | SubReq | |
| 1820 | // | |------------->| |
| 1821 | // | | | |
| 1822 | // | | SubResp | |
| 1823 | // | |<-------------| |
| 1824 | // | | | |
| 1825 | // | SubResp | | |
| 1826 | // |<-------------| | |
| 1827 | // | | | |
| 1828 | // | SubDelReq | | |
| 1829 | // |------------->| | |
| 1830 | // | | | |
| 1831 | // | | SubDelReq | |
| 1832 | // | |------------->| |
| 1833 | // | | | |
| 1834 | // | | SubDelResp | |
| 1835 | // | |<-------------| |
| 1836 | // | | | |
| 1837 | // | SubDelResp | | |
| 1838 | // |<-------------| | |
| 1839 | // |
| 1840 | //----------------------------------------------------------------------------- |
| 1841 | |
| 1842 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1843 | CaseBegin("TestSubReqAndSubDelOk") |
| 1844 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1845 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1846 | rparams1.Init() |
| 1847 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1848 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1849 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1850 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1851 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1852 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1853 | |
| 1854 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1855 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1856 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1857 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1858 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1859 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1860 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1861 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1862 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1863 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1864 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1865 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1866 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1867 | |
| 1868 | //Wait that subs is cleaned |
| 1869 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1870 | |
| 1871 | xappConn1.TestMsgChanEmpty(t) |
| 1872 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1873 | e2termConn1.TestMsgChanEmpty(t) |
| 1874 | mainCtrl.wait_registry_empty(t, 10) |
| 1875 | } |
| 1876 | |
| 1877 | //----------------------------------------------------------------------------- |
| 1878 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1879 | // |
| 1880 | // stub stub stub |
| 1881 | // +-------+ +---------+ +---------+ +---------+ |
| 1882 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1883 | // +-------+ +---------+ +---------+ +---------+ |
| 1884 | // | | | | |
| 1885 | // | | | | |
| 1886 | // | | | | |
| 1887 | // | SubReq1 | | | |
| 1888 | // |------------->| | | |
| 1889 | // | | | | |
| 1890 | // | | SubReq1 | | |
| 1891 | // | |------------->| | |
| 1892 | // | | | | |
| 1893 | // | SubReq2 | | | |
| 1894 | // |------------->| | | |
| 1895 | // | | | | |
| 1896 | // | | SubReq2 | | |
| 1897 | // | |---------------------------->| |
| 1898 | // | | | | |
| 1899 | // | | SubResp1 | | |
| 1900 | // | |<-------------| | |
| 1901 | // | SubResp1 | | | |
| 1902 | // |<-------------| | | |
| 1903 | // | | SubResp2 | | |
| 1904 | // | |<----------------------------| |
| 1905 | // | SubResp2 | | | |
| 1906 | // |<-------------| | | |
| 1907 | // | | | | |
| 1908 | // | [SUBS 1 DELETE] | | |
| 1909 | // | | | | |
| 1910 | // | [SUBS 2 DELETE] | | |
| 1911 | // | | | | |
| 1912 | // |
| 1913 | //----------------------------------------------------------------------------- |
| 1914 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1915 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1916 | |
| 1917 | //Req1 |
| 1918 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1919 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1920 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1921 | |
| 1922 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1923 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1924 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1925 | |
| 1926 | //Resp1 |
| 1927 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1928 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1929 | |
| 1930 | //Resp2 |
| 1931 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1932 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1933 | |
| 1934 | //Del1 |
| 1935 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1936 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1937 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1938 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1939 | //Wait that subs is cleaned |
| 1940 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1941 | |
| 1942 | //Del2 |
| 1943 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1944 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1945 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1946 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1947 | //Wait that subs is cleaned |
| 1948 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1949 | |
| 1950 | xappConn1.TestMsgChanEmpty(t) |
| 1951 | xappConn2.TestMsgChanEmpty(t) |
| 1952 | e2termConn1.TestMsgChanEmpty(t) |
| 1953 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1954 | mainCtrl.wait_registry_empty(t, 10) |
| 1955 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1956 | |
| 1957 | //----------------------------------------------------------------------------- |
| 1958 | // TestSubReqInsertAndSubDelOk |
| 1959 | // |
| 1960 | // stub stub |
| 1961 | // +-------+ +---------+ +---------+ |
| 1962 | // | xapp | | submgr | | e2term | |
| 1963 | // +-------+ +---------+ +---------+ |
| 1964 | // | | | |
| 1965 | // | SubReq | | |
| 1966 | // |------------->| | |
| 1967 | // | | | |
| 1968 | // | | SubReq | |
| 1969 | // | |------------->| |
| 1970 | // | | | |
| 1971 | // | | SubResp | |
| 1972 | // | |<-------------| |
| 1973 | // | | | |
| 1974 | // | SubResp | | |
| 1975 | // |<-------------| | |
| 1976 | // | | | |
| 1977 | // | | | |
| 1978 | // | SubDelReq | | |
| 1979 | // |------------->| | |
| 1980 | // | | | |
| 1981 | // | | SubDelReq | |
| 1982 | // | |------------->| |
| 1983 | // | | | |
| 1984 | // | | SubDelResp | |
| 1985 | // | |<-------------| |
| 1986 | // | | | |
| 1987 | // | SubDelResp | | |
| 1988 | // |<-------------| | |
| 1989 | // |
| 1990 | //----------------------------------------------------------------------------- |
| 1991 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1992 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1993 | |
| 1994 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1995 | rparams1.Init() |
| 1996 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 1997 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1998 | |
| 1999 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2000 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2001 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2002 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2003 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2004 | |
| 2005 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2006 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2007 | |
| 2008 | //Wait that subs is cleaned |
| 2009 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2010 | |
| 2011 | xappConn1.TestMsgChanEmpty(t) |
| 2012 | xappConn2.TestMsgChanEmpty(t) |
| 2013 | e2termConn1.TestMsgChanEmpty(t) |
| 2014 | mainCtrl.wait_registry_empty(t, 10) |
| 2015 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2016 | |
| 2017 | //----------------------------------------------------------------------------- |
| 2018 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2019 | // |
| 2020 | // This case simulates case where xApp restarts and starts sending same |
| 2021 | // subscription requests which have already subscribed successfully |
| 2022 | |
| 2023 | // stub stub |
| 2024 | // +-------+ +---------+ +---------+ |
| 2025 | // | xapp | | submgr | | e2term | |
| 2026 | // +-------+ +---------+ +---------+ |
| 2027 | // | | | |
| 2028 | // | SubReq | | |
| 2029 | // |------------->| | |
| 2030 | // | | | |
| 2031 | // | | SubReq | |
| 2032 | // | |------------->| |
| 2033 | // | | | |
| 2034 | // | | SubResp | |
| 2035 | // | |<-------------| |
| 2036 | // | | | |
| 2037 | // | SubResp | | |
| 2038 | // |<-------------| | |
| 2039 | // | | | |
| 2040 | // | xApp restart | | |
| 2041 | // | | | |
| 2042 | // | SubReq | | |
| 2043 | // | (retrans with same xApp generated subid but diff xid) |
| 2044 | // |------------->| | |
| 2045 | // | | | |
| 2046 | // | SubResp | | |
| 2047 | // |<-------------| | |
| 2048 | // | | | |
| 2049 | // | [SUBS DELETE] | |
| 2050 | // | | | |
| 2051 | // |
| 2052 | //----------------------------------------------------------------------------- |
| 2053 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2054 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2055 | |
| 2056 | //Subs Create |
| 2057 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2058 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2059 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2060 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2061 | |
| 2062 | // xApp restart here |
| 2063 | // --> artificial delay |
| 2064 | <-time.After(1 * time.Second) |
| 2065 | |
| 2066 | //Subs Create |
| 2067 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2068 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2069 | |
| 2070 | //Subs Delete |
| 2071 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2072 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2073 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2074 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2075 | |
| 2076 | //Wait that subs is cleaned |
| 2077 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2078 | |
| 2079 | xappConn1.TestMsgChanEmpty(t) |
| 2080 | xappConn2.TestMsgChanEmpty(t) |
| 2081 | e2termConn1.TestMsgChanEmpty(t) |
| 2082 | mainCtrl.wait_registry_empty(t, 10) |
| 2083 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2084 | |
| 2085 | //----------------------------------------------------------------------------- |
| 2086 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2087 | // |
| 2088 | // stub stub |
| 2089 | // +-------+ +---------+ +---------+ |
| 2090 | // | xapp | | submgr | | e2term | |
| 2091 | // +-------+ +---------+ +---------+ |
| 2092 | // | | | |
| 2093 | // | SubReq | | |
| 2094 | // |------------->| | |
| 2095 | // | | | |
| 2096 | // | | SubReq | |
| 2097 | // | |------------->| |
| 2098 | // | | | |
| 2099 | // | | SubResp | |
| 2100 | // | <----| |
| 2101 | // | | |
| 2102 | // | Submgr restart | |
| 2103 | // | | |
| 2104 | // | | | |
| 2105 | // | | SubDelReq | |
| 2106 | // | |------------->| |
| 2107 | // | | | |
| 2108 | // | | SubDelResp | |
| 2109 | // | |<-------------| |
| 2110 | // | | | |
| 2111 | // |
| 2112 | //----------------------------------------------------------------------------- |
| 2113 | |
| 2114 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2115 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2116 | |
| 2117 | // Remove possible existing subscrition |
| 2118 | mainCtrl.removeExistingSubscriptions(t) |
| 2119 | |
| 2120 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2121 | xappConn1.SendSubsReq(t, nil, nil) |
| 2122 | e2termConn1.RecvSubsReq(t) |
| 2123 | mainCtrl.SetResetTestFlag(t, false) |
| 2124 | |
| 2125 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2126 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2127 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2128 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2129 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2130 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2131 | mainCtrl.SimulateRestart(t) |
| 2132 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2133 | |
| 2134 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2135 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2136 | |
| 2137 | // Wait that subs is cleaned |
| 2138 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2139 | |
| 2140 | xappConn1.TestMsgChanEmpty(t) |
| 2141 | xappConn2.TestMsgChanEmpty(t) |
| 2142 | e2termConn1.TestMsgChanEmpty(t) |
| 2143 | mainCtrl.wait_registry_empty(t, 10) |
| 2144 | } |
| 2145 | |
| 2146 | //----------------------------------------------------------------------------- |
| 2147 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2148 | // |
| 2149 | // stub stub |
| 2150 | // +-------+ +---------+ +---------+ |
| 2151 | // | xapp | | submgr | | e2term | |
| 2152 | // +-------+ +---------+ +---------+ |
| 2153 | // | | | |
| 2154 | // | SubReq | | |
| 2155 | // |------------->| | |
| 2156 | // | | | |
| 2157 | // | | SubReq | |
| 2158 | // | |------------->| |
| 2159 | // | | | |
| 2160 | // | | SubResp | |
| 2161 | // | |<-------------| |
| 2162 | // | | | |
| 2163 | // | SubResp | | |
| 2164 | // |<-------------| | |
| 2165 | // | | | |
| 2166 | // | | |
| 2167 | // | Submgr restart | |
| 2168 | // | | |
| 2169 | // | SubDelReq | | |
| 2170 | // |------------->| | |
| 2171 | // | | | |
| 2172 | // | | SubDelReq | |
| 2173 | // | |------------->| |
| 2174 | // | | | |
| 2175 | // | | SubDelResp | |
| 2176 | // | |<-------------| |
| 2177 | // | | | |
| 2178 | // | SubDelResp | | |
| 2179 | // |<-------------| | |
| 2180 | // |
| 2181 | //----------------------------------------------------------------------------- |
| 2182 | |
| 2183 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2184 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2185 | |
| 2186 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2187 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2188 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2189 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2190 | |
| 2191 | // Check subscription |
| 2192 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2193 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2194 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2195 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2196 | |
| 2197 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2198 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2199 | |
| 2200 | // Check that subscription is restored correctly after restart |
| 2201 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2202 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2203 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2204 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2205 | |
| 2206 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2207 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2208 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2209 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2210 | |
| 2211 | //Wait that subs is cleaned |
| 2212 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2213 | |
| 2214 | xappConn1.TestMsgChanEmpty(t) |
| 2215 | xappConn2.TestMsgChanEmpty(t) |
| 2216 | e2termConn1.TestMsgChanEmpty(t) |
| 2217 | mainCtrl.wait_registry_empty(t, 10) |
| 2218 | } |
| 2219 | |
| 2220 | //----------------------------------------------------------------------------- |
| 2221 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2222 | // |
| 2223 | // stub stub |
| 2224 | // +-------+ +-------+ +---------+ +---------+ |
| 2225 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2226 | // +-------+ +-------+ +---------+ +---------+ |
| 2227 | // | | | | |
| 2228 | // | | | | |
| 2229 | // | | | | |
| 2230 | // | | SubReq1 | | |
| 2231 | // | |------------->| | |
| 2232 | // | | | | |
| 2233 | // | | | SubReq1 | |
| 2234 | // | | |------------->| |
| 2235 | // | | | SubResp1 | |
| 2236 | // | | |<-------------| |
| 2237 | // | | SubResp1 | | |
| 2238 | // | |<-------------| | |
| 2239 | // | | | | |
| 2240 | // | | |
| 2241 | // | submgr restart | |
| 2242 | // | | |
| 2243 | // | | | | |
| 2244 | // | | | | |
| 2245 | // | SubReq2 | | |
| 2246 | // |--------------------------->| | |
| 2247 | // | | | | |
| 2248 | // | SubResp2 | | |
| 2249 | // |<---------------------------| | |
| 2250 | // | | | | |
| 2251 | // | | SubDelReq 1 | | |
| 2252 | // | |------------->| | |
| 2253 | // | | | | |
| 2254 | // | | SubDelResp 1 | | |
| 2255 | // | |<-------------| | |
| 2256 | // | | | | |
| 2257 | // | | | | |
| 2258 | // | | |
| 2259 | // | submgr restart | |
| 2260 | // | | |
| 2261 | // | | | | |
| 2262 | // | SubDelReq 2 | | |
| 2263 | // |--------------------------->| | |
| 2264 | // | | | | |
| 2265 | // | | | SubDelReq 2 | |
| 2266 | // | | |------------->| |
| 2267 | // | | | | |
| 2268 | // | | | SubDelReq 2 | |
| 2269 | // | | |------------->| |
| 2270 | // | | | | |
| 2271 | // | SubDelResp 2 | | |
| 2272 | // |<---------------------------| | |
| 2273 | // |
| 2274 | //----------------------------------------------------------------------------- |
| 2275 | |
| 2276 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2277 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2278 | |
| 2279 | //Req1 |
| 2280 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2281 | rparams1.Init() |
| 2282 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2283 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2284 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2285 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2286 | |
| 2287 | //Req2 |
| 2288 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2289 | rparams2.Init() |
| 2290 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2291 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2292 | |
| 2293 | // Check subscription |
| 2294 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2295 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2296 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2297 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2298 | |
| 2299 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2300 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2301 | |
| 2302 | // Check that subscription is restored correctly after restart |
| 2303 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2304 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2305 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2306 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2307 | |
| 2308 | //Del1 |
| 2309 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2310 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2311 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2312 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2313 | |
| 2314 | mainCtrl.SimulateRestart(t) |
| 2315 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2316 | |
| 2317 | //Del2 |
| 2318 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2319 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2320 | |
| 2321 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2322 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2323 | |
| 2324 | //Wait that subs is cleaned |
| 2325 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2326 | |
| 2327 | xappConn1.TestMsgChanEmpty(t) |
| 2328 | xappConn2.TestMsgChanEmpty(t) |
| 2329 | e2termConn1.TestMsgChanEmpty(t) |
| 2330 | mainCtrl.wait_registry_empty(t, 10) |
| 2331 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2332 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2333 | //***************************************************************************** |
| 2334 | // REST interface test cases |
| 2335 | //***************************************************************************** |
| 2336 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2337 | //----------------------------------------------------------------------------- |
| 2338 | // Test debug GET and POST requests |
| 2339 | // |
| 2340 | // curl |
| 2341 | // +-------+ +---------+ |
| 2342 | // | user | | submgr | |
| 2343 | // +-------+ +---------+ |
| 2344 | // | | |
| 2345 | // | GET/POST Req | |
| 2346 | // |------------->| |
| 2347 | // | Resp | |
| 2348 | // |<-------------| |
| 2349 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2350 | func TestGetSubscriptions(t *testing.T) { |
| 2351 | |
| 2352 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2353 | } |
| 2354 | |
| 2355 | func TestGetSymptomData(t *testing.T) { |
| 2356 | |
| 2357 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2358 | } |
| 2359 | |
| 2360 | func TestPostdeleteSubId(t *testing.T) { |
| 2361 | |
| 2362 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2363 | } |
| 2364 | |
| 2365 | func TestPostEmptyDb(t *testing.T) { |
| 2366 | |
| 2367 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2368 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2369 | |
| 2370 | //----------------------------------------------------------------------------- |
| 2371 | // TestRESTSubReqAndRouteNok |
| 2372 | // |
| 2373 | // stub stub |
| 2374 | // +-------+ +---------+ +---------+ |
| 2375 | // | xapp | | submgr | | rtmgr | |
| 2376 | // +-------+ +---------+ +---------+ |
| 2377 | // | | | |
| 2378 | // | RESTSubReq | | |
| 2379 | // |---------------->| | |
| 2380 | // | | | |
| 2381 | // | RESTSubResp | | |
| 2382 | // |<----------------| | |
| 2383 | // | | RouteCreate | |
| 2384 | // | |------------->| |
| 2385 | // | | | |
| 2386 | // | | RouteCreate | |
| 2387 | // | | status:400 | |
| 2388 | // | |(Bad request) | |
| 2389 | // | |<-------------| |
| 2390 | // | RESTNotif | | |
| 2391 | // |<----------------| | |
| 2392 | // | | | |
| 2393 | // | [SUBS INT DELETE] | |
| 2394 | // | | | |
| 2395 | // | RESTSubDelReq | | |
| 2396 | // |---------------->| | |
| 2397 | // | RESTSubDelResp | | |
| 2398 | // |<----------------| | |
| 2399 | // |
| 2400 | //----------------------------------------------------------------------------- |
| 2401 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2402 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2403 | |
| 2404 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2405 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2406 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2407 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2408 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2409 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2410 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2411 | }) |
| 2412 | |
| 2413 | const subReqCount int = 1 |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2414 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2415 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2416 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2417 | |
| 2418 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2419 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2420 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2421 | xappConn1.ExpectRESTNotification(t, restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2422 | waiter.WaitResult(t) |
| 2423 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2424 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2425 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2426 | |
| 2427 | // Del |
| 2428 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2429 | |
| 2430 | // Wait that subs is cleaned |
| 2431 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2432 | waitSubsCleanup(t, e2SubsId, 10) |
| 2433 | mainCtrl.VerifyCounterValues(t) |
| 2434 | } |
| 2435 | |
| 2436 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2437 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2438 | |
| 2439 | //Init counter check |
| 2440 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2441 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2442 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2443 | Counter{cSubReqToE2, 1}, |
| 2444 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2445 | Counter{cRestSubNotifToXapp, 1}, |
| 2446 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2447 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2448 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2449 | Counter{cSubDelReqToE2, 1}, |
| 2450 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2451 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2452 | }) |
| 2453 | |
| 2454 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2455 | |
| 2456 | //Subs Create |
| 2457 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2458 | |
| 2459 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2460 | |
| 2461 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2462 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2463 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2464 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2465 | params.SetMeid("RAN_NAME_1") |
| 2466 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2467 | xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) |
| 2468 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 2469 | waiter.WaitResult(t) |
| 2470 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2471 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2472 | |
| 2473 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2474 | |
| 2475 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2476 | |
| 2477 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2478 | //Wait that subs is cleaned |
| 2479 | waitSubsCleanup(t, e2SubsId, 10) |
| 2480 | |
| 2481 | mainCtrl.VerifyCounterValues(t) |
| 2482 | } |
| 2483 | |
| 2484 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2485 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2486 | |
| 2487 | // Init counter check |
| 2488 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2489 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2490 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2491 | Counter{cSubReqToE2, 1}, |
| 2492 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2493 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2494 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2495 | Counter{cRouteDeleteFail, 1}, |
| 2496 | Counter{cSubDelReqToE2, 1}, |
| 2497 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2498 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2499 | }) |
| 2500 | |
| 2501 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2502 | |
| 2503 | //Subs Create |
| 2504 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2505 | |
| 2506 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2507 | |
| 2508 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2509 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2510 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2511 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2512 | waiter.WaitResult(t) |
| 2513 | |
| 2514 | waitSubsCleanup(t, e2SubsId, 10) |
| 2515 | |
| 2516 | mainCtrl.VerifyCounterValues(t) |
| 2517 | } |
| 2518 | |
| 2519 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2520 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2521 | |
| 2522 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2523 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2524 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2525 | Counter{cSubReqToE2, 1}, |
| 2526 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2527 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2528 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2529 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2530 | Counter{cSubDelReqToE2, 1}, |
| 2531 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2532 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2533 | }) |
| 2534 | |
| 2535 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2536 | |
| 2537 | //Subs Create |
| 2538 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2539 | |
| 2540 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2541 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2542 | |
| 2543 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2544 | |
| 2545 | //Del1, this shall fail on rtmgr side |
| 2546 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2547 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2548 | waiter.WaitResult(t) |
| 2549 | |
| 2550 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2551 | |
| 2552 | //Del2 |
| 2553 | deleteXapp2Subscription(t, &restSubId2) |
| 2554 | |
| 2555 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2556 | |
| 2557 | mainCtrl.VerifyCounterValues(t) |
| 2558 | } |
| 2559 | |
| 2560 | //----------------------------------------------------------------------------- |
| 2561 | // TestRESTSubReqRetransmission |
| 2562 | // |
| 2563 | // stub stub |
| 2564 | // +-------+ +---------+ +---------+ |
| 2565 | // | xapp | | submgr | | e2term | |
| 2566 | // +-------+ +---------+ +---------+ |
| 2567 | // | | | |
| 2568 | // | RESTSubReq1 | | |
| 2569 | // |---------------->| | |
| 2570 | // | | | |
| 2571 | // | RESTSubResp | | |
| 2572 | // |<----------------| | |
| 2573 | // | | SubReq1 | |
| 2574 | // | |------------->| |
| 2575 | // | | | |
| 2576 | // | RESTSubReq2 | | |
| 2577 | // | (retrans) | | |
| 2578 | // |---------------->| | |
| 2579 | // | | | |
| 2580 | // | | SubReq2 | |
| 2581 | // | |------------->| |
| 2582 | // | RESTSubResp2 | | |
| 2583 | // |<----------------| | |
| 2584 | // | | SubResp1 | |
| 2585 | // | |<-------------| |
| 2586 | // | RESTNotif1 | | |
| 2587 | // |<----------------| | |
| 2588 | // | | SubResp1 | |
| 2589 | // | |<-------------| |
| 2590 | // | RESTNotif2 | | |
| 2591 | // |<----------------| | |
| 2592 | // | | | |
| 2593 | // | [SUBS DELETE] | |
| 2594 | // | | | |
| 2595 | // |
| 2596 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2597 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2598 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2599 | CaseBegin("TestRESTSubReqRetransmission") |
| 2600 | |
| 2601 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2602 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2603 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2604 | Counter{cSubReqToE2, 2}, |
| 2605 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2606 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2607 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2608 | Counter{cSubDelReqToE2, 2}, |
| 2609 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2610 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2611 | }) |
| 2612 | // Retry/duplicate will get the same way as the first request. Submgr cannot detect duplicate RESTRequests |
| 2613 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2614 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2615 | |
| 2616 | // Subs Create |
| 2617 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2618 | |
| 2619 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2620 | // gets into execution before the rtmgrg responds for the first one. |
| 2621 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2622 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2623 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2624 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2625 | |
| 2626 | waiter.WaitResult(t) |
| 2627 | |
| 2628 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2629 | |
| 2630 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2631 | // the order is not significant he6re. |
| 2632 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2633 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2634 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2635 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2636 | |
| 2637 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2638 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2639 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2640 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2641 | |
| 2642 | // Del1 |
| 2643 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2644 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2645 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2646 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2647 | // Del2 |
| 2648 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 2649 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2650 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2651 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2652 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 2653 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2654 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2655 | |
| 2656 | mainCtrl.VerifyCounterValues(t) |
| 2657 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2658 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2659 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 2660 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 2661 | |
| 2662 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2663 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2664 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2665 | Counter{cSubReqToE2, 1}, |
| 2666 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2667 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2668 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2669 | Counter{cSubDelReqToE2, 1}, |
| 2670 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2671 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2672 | }) |
| 2673 | |
| 2674 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2675 | |
| 2676 | //Subs Create |
| 2677 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2678 | |
| 2679 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2680 | |
| 2681 | //Subs Delete |
| 2682 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2683 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2684 | |
| 2685 | seqBef := mainCtrl.get_msgcounter(t) |
| 2686 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2687 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 2688 | |
| 2689 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2690 | |
| 2691 | waitSubsCleanup(t, e2SubsId, 10) |
| 2692 | |
| 2693 | mainCtrl.VerifyCounterValues(t) |
| 2694 | } |
| 2695 | |
| 2696 | //----------------------------------------------------------------------------- |
| 2697 | // TestRESTSubReqDelReq |
| 2698 | // |
| 2699 | // stub stub |
| 2700 | // +-------+ +---------+ +---------+ |
| 2701 | // | xapp | | submgr | | e2term | |
| 2702 | // +-------+ +---------+ +---------+ |
| 2703 | // | | | |
| 2704 | // | RESTSubReq | | |
| 2705 | // |---------------->| | |
| 2706 | // | | | |
| 2707 | // | RESTSubResp | | |
| 2708 | // |<----------------| | |
| 2709 | // | | SubReq | |
| 2710 | // | |------------->| |
| 2711 | // | RESTSubDelReq | | |
| 2712 | // |---------------->| | |
| 2713 | // | RESTSubDelResp | | |
| 2714 | // | unsuccess | | |
| 2715 | // |<----------------| | |
| 2716 | // | | SubResp | |
| 2717 | // | |<-------------| |
| 2718 | // | RESTNotif1 | | |
| 2719 | // |<----------------| | |
| 2720 | // | | | |
| 2721 | // | [SUBS DELETE] | |
| 2722 | // | | | |
| 2723 | // |
| 2724 | //----------------------------------------------------------------------------- |
| 2725 | func TestRESTSubReqDelReq(t *testing.T) { |
| 2726 | CaseBegin("TestRESTSubReqDelReq") |
| 2727 | |
| 2728 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2729 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2730 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2731 | Counter{cSubReqToE2, 1}, |
| 2732 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2733 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2734 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2735 | Counter{cSubDelReqToE2, 1}, |
| 2736 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2737 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2738 | }) |
| 2739 | |
| 2740 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2741 | |
| 2742 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2743 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2744 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2745 | |
| 2746 | // Del. This will fail as processing of the subscription |
| 2747 | // is still ongoing in submgr. Deletion is not allowed before |
| 2748 | // subscription creation has been completed. |
| 2749 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2750 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2751 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2752 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2753 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2754 | |
| 2755 | // Retry del |
| 2756 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2757 | |
| 2758 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2759 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2760 | |
| 2761 | // Wait that subs is cleaned |
| 2762 | waitSubsCleanup(t, e2SubsId, 10) |
| 2763 | mainCtrl.VerifyCounterValues(t) |
| 2764 | |
| 2765 | } |
| 2766 | |
| 2767 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 2768 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 2769 | } |
| 2770 | |
| 2771 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 2772 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 2773 | |
| 2774 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2775 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2776 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2777 | Counter{cSubReqToE2, 2}, |
| 2778 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2779 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2780 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2781 | Counter{cSubDelReqToE2, 2}, |
| 2782 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2783 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2784 | }) |
| 2785 | |
| 2786 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2787 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2788 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2789 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2790 | |
| 2791 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2792 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2793 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2794 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2795 | |
| 2796 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2797 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2798 | |
| 2799 | //XappConn1 receives both of the responses |
| 2800 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2801 | |
| 2802 | //Resp1 |
| 2803 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2804 | //Resp2 |
| 2805 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2806 | |
| 2807 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2808 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2809 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2810 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2811 | |
| 2812 | //Del1 |
| 2813 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2814 | //Del2 |
| 2815 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 2816 | |
| 2817 | //Wait that subs is cleaned |
| 2818 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2819 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2820 | |
| 2821 | mainCtrl.VerifyCounterValues(t) |
| 2822 | |
| 2823 | } |
| 2824 | |
| 2825 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 2826 | CaseBegin("TestRESTSameSubsDiffRan") |
| 2827 | |
| 2828 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2829 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2830 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2831 | Counter{cSubReqToE2, 2}, |
| 2832 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2833 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2834 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2835 | Counter{cSubDelReqToE2, 2}, |
| 2836 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2837 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2838 | }) |
| 2839 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2840 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2841 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2842 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2843 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2844 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2845 | params.SetMeid("RAN_NAME_2") |
| 2846 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2847 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2848 | |
| 2849 | //Del1 |
| 2850 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2851 | //Del2 |
| 2852 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 2853 | |
| 2854 | //Wait that subs is cleaned |
| 2855 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2856 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2857 | |
| 2858 | mainCtrl.VerifyCounterValues(t) |
| 2859 | |
| 2860 | } |
| 2861 | |
| 2862 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 2863 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 2864 | |
| 2865 | // Init counter check |
| 2866 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2867 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2868 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2869 | Counter{cSubReqToE2, 1}, |
| 2870 | Counter{cSubReReqToE2, 1}, |
| 2871 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2872 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2873 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2874 | Counter{cSubDelReqToE2, 1}, |
| 2875 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2876 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2877 | }) |
| 2878 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2879 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2880 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2881 | |
| 2882 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2883 | |
| 2884 | // Catch the first message and ignore it |
| 2885 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2886 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 2887 | |
| 2888 | // The second request is being handled normally |
| 2889 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2890 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2891 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2892 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2893 | |
| 2894 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2895 | |
| 2896 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2897 | |
| 2898 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2899 | //Wait that subs is cleaned |
| 2900 | waitSubsCleanup(t, e2SubsId, 10) |
| 2901 | |
| 2902 | mainCtrl.VerifyCounterValues(t) |
| 2903 | |
| 2904 | } |
| 2905 | |
| 2906 | //----------------------------------------------------------------------------- |
| 2907 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2908 | // |
| 2909 | // stub stub |
| 2910 | // +-------+ +---------+ +---------+ |
| 2911 | // | xapp | | submgr | | e2term | |
| 2912 | // +-------+ +---------+ +---------+ |
| 2913 | // | | | |
| 2914 | // | RESTSubReq | | |
| 2915 | // |---------------->| | |
| 2916 | // | | | |
| 2917 | // | RESTSubResp | | |
| 2918 | // |<----------------| | |
| 2919 | // | | SubReq | |
| 2920 | // | |------------->| |
| 2921 | // | | | |
| 2922 | // | | | |
| 2923 | // | | SubReq | |
| 2924 | // | |------------->| |
| 2925 | // | | | |
| 2926 | // | | SubDelReq | |
| 2927 | // | |------------->| |
| 2928 | // | | | |
| 2929 | // | | | |
| 2930 | // | | SubDelReq | |
| 2931 | // | |------------->| |
| 2932 | // | | | |
| 2933 | // | | | |
| 2934 | // | | SubDelResp | |
| 2935 | // | |<-------------| |
| 2936 | // | RESTNotif | | |
| 2937 | // | unsuccess | | |
| 2938 | // |<----------------| | |
| 2939 | // | | | |
| 2940 | // | [SUBS DELETE] | |
| 2941 | // | | | |
| 2942 | // |
| 2943 | //----------------------------------------------------------------------------- |
| 2944 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 2945 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 2946 | |
| 2947 | // Init counter check |
| 2948 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2949 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2950 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2951 | Counter{cSubReqToE2, 1}, |
| 2952 | Counter{cSubReReqToE2, 1}, |
| 2953 | Counter{cSubReqTimerExpiry, 2}, |
| 2954 | Counter{cSubDelReqToE2, 1}, |
| 2955 | Counter{cSubDelRespFromE2, 1}, |
| 2956 | }) |
| 2957 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2958 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2959 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2960 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2961 | |
| 2962 | e2termConn1.RecvSubsReq(t) |
| 2963 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2964 | |
| 2965 | e2termConn1.RecvSubsReq(t) |
| 2966 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2967 | |
| 2968 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2969 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2970 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2971 | // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? |
| 2972 | xappConn1.WaitRESTNotification(t, restSubId) |
| 2973 | |
| 2974 | // Wait that subs is cleaned |
| 2975 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 2976 | |
| 2977 | mainCtrl.VerifyCounterValues(t) |
| 2978 | } |
| 2979 | |
| 2980 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 2981 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 2982 | |
| 2983 | // Init counter check |
| 2984 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2985 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2986 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2987 | Counter{cSubReqToE2, 1}, |
| 2988 | Counter{cSubReReqToE2, 1}, |
| 2989 | Counter{cSubReqTimerExpiry, 2}, |
| 2990 | Counter{cSubDelReqToE2, 1}, |
| 2991 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2992 | }) |
| 2993 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2994 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2995 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2996 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2997 | |
| 2998 | e2termConn1.RecvSubsReq(t) |
| 2999 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3000 | |
| 3001 | e2termConn1.RecvSubsReq(t) |
| 3002 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3003 | |
| 3004 | e2termConn1.RecvSubsDelReq(t) |
| 3005 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3006 | |
| 3007 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3008 | e2termConn1.RecvSubsDelReq(t) |
| 3009 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3010 | |
| 3011 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3012 | |
| 3013 | waitSubsCleanup(t, e2SubsId, 10) |
| 3014 | |
| 3015 | mainCtrl.VerifyCounterValues(t) |
| 3016 | |
| 3017 | } |
| 3018 | |
| 3019 | //----------------------------------------------------------------------------- |
| 3020 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3021 | // |
| 3022 | // stub stub |
| 3023 | // +-------+ +---------+ +---------+ |
| 3024 | // | xapp | | submgr | | e2term | |
| 3025 | // +-------+ +---------+ +---------+ |
| 3026 | // | | | |
| 3027 | // | RESTSubReq | | |
| 3028 | // |---------------->| | |
| 3029 | // | | | |
| 3030 | // | RESTSubResp | | |
| 3031 | // |<----------------| | |
| 3032 | // | | SubReq | |
| 3033 | // | |------------->| |
| 3034 | // | | | |
| 3035 | // | | | |
| 3036 | // | | SubReq | |
| 3037 | // | |------------->| |
| 3038 | // | | | |
| 3039 | // | | SubDelReq | |
| 3040 | // | |------------->| |
| 3041 | // | | | |
| 3042 | // | | | |
| 3043 | // | | SubDelReq | |
| 3044 | // | |------------->| |
| 3045 | // | | | |
| 3046 | // | | | |
| 3047 | // | | SubDelResp | |
| 3048 | // | |<-------------| |
| 3049 | // | RESTNotif | | |
| 3050 | // | unsuccess | | |
| 3051 | // |<----------------| | |
| 3052 | // | | | |
| 3053 | // | [SUBS DELETE] | |
| 3054 | // | | | |
| 3055 | // |
| 3056 | //----------------------------------------------------------------------------- |
| 3057 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3058 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3059 | |
| 3060 | // Init counter check |
| 3061 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3062 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3063 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3064 | Counter{cSubReqToE2, 1}, |
| 3065 | Counter{cSubReReqToE2, 1}, |
| 3066 | Counter{cSubReqTimerExpiry, 2}, |
| 3067 | Counter{cSubDelReqToE2, 1}, |
| 3068 | Counter{cSubDelReReqToE2, 1}, |
| 3069 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3070 | }) |
| 3071 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3072 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3073 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3074 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3075 | |
| 3076 | e2termConn1.RecvSubsReq(t) |
| 3077 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3078 | |
| 3079 | e2termConn1.RecvSubsReq(t) |
| 3080 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3081 | |
| 3082 | e2termConn1.RecvSubsDelReq(t) |
| 3083 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3084 | |
| 3085 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3086 | e2termConn1.RecvSubsDelReq(t) |
| 3087 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3088 | |
| 3089 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3090 | |
| 3091 | waitSubsCleanup(t, e2SubsId, 10) |
| 3092 | |
| 3093 | mainCtrl.VerifyCounterValues(t) |
| 3094 | } |
| 3095 | |
| 3096 | //----------------------------------------------------------------------------- |
| 3097 | // TestRESTSubReqSubFailRespInSubmgr |
| 3098 | // |
| 3099 | // stub stub |
| 3100 | // +-------+ +---------+ +---------+ |
| 3101 | // | xapp | | submgr | | e2term | |
| 3102 | // +-------+ +---------+ +---------+ |
| 3103 | // | | | |
| 3104 | // | RESTSubReq | | |
| 3105 | // |---------------->| | |
| 3106 | // | | | |
| 3107 | // | RESTSubResp | | |
| 3108 | // |<----------------| | |
| 3109 | // | | SubReq | |
| 3110 | // | |------------->| |
| 3111 | // | | | |
| 3112 | // | | SubFail | |
| 3113 | // | |<-------------| |
| 3114 | // | | | |
| 3115 | // | | SubDelReq | |
| 3116 | // | |------------->| |
| 3117 | // | | | |
| 3118 | // | | SubDelResp | |
| 3119 | // | |<-------------| |
| 3120 | // | | | |
| 3121 | // | RESTNotif | | |
| 3122 | // | unsuccess | | |
| 3123 | // |<----------------| | |
| 3124 | // | | | |
| 3125 | // | [SUBS DELETE] | |
| 3126 | // | | | |
| 3127 | // |
| 3128 | //----------------------------------------------------------------------------- |
| 3129 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3130 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3131 | |
| 3132 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3133 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3134 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3135 | Counter{cSubReqToE2, 1}, |
| 3136 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3137 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3138 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3139 | }) |
| 3140 | |
| 3141 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3142 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3143 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3144 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3145 | |
| 3146 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3147 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3148 | fparams1.Set(crereq1) |
| 3149 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3150 | |
| 3151 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3152 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3153 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3154 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3155 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 3156 | |
| 3157 | // REST subscription sill there to be deleted |
| 3158 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3159 | |
| 3160 | // Wait that subs is cleaned |
| 3161 | waitSubsCleanup(t, e2SubsId, 10) |
| 3162 | |
| 3163 | mainCtrl.VerifyCounterValues(t) |
| 3164 | |
| 3165 | } |
| 3166 | |
| 3167 | //----------------------------------------------------------------------------- |
| 3168 | // TestRESTSubDelReqRetryInSubmgr |
| 3169 | // |
| 3170 | // stub stub |
| 3171 | // +-------+ +---------+ +---------+ |
| 3172 | // | xapp | | submgr | | e2term | |
| 3173 | // +-------+ +---------+ +---------+ |
| 3174 | // | | | |
| 3175 | // | [SUBS CREATE] | |
| 3176 | // | | | |
| 3177 | // | | | |
| 3178 | // | RESTSubDelReq | | |
| 3179 | // |---------------->| | |
| 3180 | // | | | |
| 3181 | // | RESTSubDelResp | | |
| 3182 | // |<----------------| | |
| 3183 | // | | SubDelReq | |
| 3184 | // | |------------->| |
| 3185 | // | | | |
| 3186 | // | | SubDelReq | |
| 3187 | // | |------------->| |
| 3188 | // | | | |
| 3189 | // | | SubDelResp | |
| 3190 | // | |<-------------| |
| 3191 | // | | | |
| 3192 | // |
| 3193 | //----------------------------------------------------------------------------- |
| 3194 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3195 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3196 | |
| 3197 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3198 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3199 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3200 | Counter{cSubReqToE2, 1}, |
| 3201 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3202 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3203 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3204 | Counter{cSubDelReqToE2, 1}, |
| 3205 | Counter{cSubDelReReqToE2, 1}, |
| 3206 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3207 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3208 | }) |
| 3209 | // Req |
| 3210 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3211 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3212 | |
| 3213 | // Del |
| 3214 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3215 | |
| 3216 | // E2t: Receive 1st SubsDelReq |
| 3217 | e2termConn1.RecvSubsDelReq(t) |
| 3218 | |
| 3219 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3220 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3221 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3222 | |
| 3223 | //Wait that subs is cleaned |
| 3224 | waitSubsCleanup(t, e2SubsId, 10) |
| 3225 | |
| 3226 | mainCtrl.VerifyCounterValues(t) |
| 3227 | } |
| 3228 | |
| 3229 | //----------------------------------------------------------------------------- |
| 3230 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3231 | // |
| 3232 | // stub stub |
| 3233 | // +-------+ +---------+ +---------+ |
| 3234 | // | xapp | | submgr | | e2term | |
| 3235 | // +-------+ +---------+ +---------+ |
| 3236 | // | | | |
| 3237 | // | [SUBS CREATE] | |
| 3238 | // | | | |
| 3239 | // | | | |
| 3240 | // | RESTSubDelReq | | |
| 3241 | // |---------------->| | |
| 3242 | // | | | |
| 3243 | // | RESTSubDelResp | | |
| 3244 | // |<----------------| | |
| 3245 | // | | SubDelReq | |
| 3246 | // | |------------->| |
| 3247 | // | | | |
| 3248 | // | | SubDelReq | |
| 3249 | // | |------------->| |
| 3250 | // | | | |
| 3251 | // | | | |
| 3252 | // |
| 3253 | //----------------------------------------------------------------------------- |
| 3254 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3255 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3256 | |
| 3257 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3258 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3259 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3260 | Counter{cSubReqToE2, 1}, |
| 3261 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3262 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3263 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3264 | Counter{cSubDelReqToE2, 1}, |
| 3265 | Counter{cSubDelReReqToE2, 1}, |
| 3266 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3267 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3268 | }) |
| 3269 | |
| 3270 | // Req |
| 3271 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3272 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3273 | |
| 3274 | // Del |
| 3275 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3276 | |
| 3277 | // E2t: Receive 1st SubsDelReq |
| 3278 | e2termConn1.RecvSubsDelReq(t) |
| 3279 | |
| 3280 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3281 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3282 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3283 | |
| 3284 | //Wait that subs is cleaned |
| 3285 | waitSubsCleanup(t, e2SubsId, 10) |
| 3286 | |
| 3287 | mainCtrl.VerifyCounterValues(t) |
| 3288 | } |
| 3289 | |
| 3290 | //----------------------------------------------------------------------------- |
| 3291 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3292 | // |
| 3293 | // stub stub |
| 3294 | // +-------+ +---------+ +---------+ |
| 3295 | // | xapp | | submgr | | e2term | |
| 3296 | // +-------+ +---------+ +---------+ |
| 3297 | // | | | |
| 3298 | // | [SUBS CREATE] | |
| 3299 | // | | | |
| 3300 | // | | | |
| 3301 | // | RESTSubDelReq | | |
| 3302 | // |---------------->| | |
| 3303 | // | | | |
| 3304 | // | RESTSubDelResp | | |
| 3305 | // |<----------------| | |
| 3306 | // | | SubDelReq | |
| 3307 | // | |------------->| |
| 3308 | // | | | |
| 3309 | // | | SubDelFail | |
| 3310 | // | |<-------------| |
| 3311 | // | | | |
| 3312 | // |
| 3313 | //----------------------------------------------------------------------------- |
| 3314 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3315 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3316 | |
| 3317 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3318 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3319 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3320 | Counter{cSubReqToE2, 1}, |
| 3321 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3322 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3323 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3324 | Counter{cSubDelReqToE2, 1}, |
| 3325 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3326 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3327 | }) |
| 3328 | |
| 3329 | // Req |
| 3330 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3331 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3332 | |
| 3333 | // Del |
| 3334 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3335 | |
| 3336 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3337 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3338 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3339 | |
| 3340 | //Wait that subs is cleaned |
| 3341 | waitSubsCleanup(t, e2SubsId, 10) |
| 3342 | |
| 3343 | mainCtrl.VerifyCounterValues(t) |
| 3344 | } |
| 3345 | |
| 3346 | //----------------------------------------------------------------------------- |
| 3347 | // TestRESTSubReqAndSubDelOkSameAction |
| 3348 | // |
| 3349 | // stub stub |
| 3350 | // +-------+ +-------+ +---------+ +---------+ |
| 3351 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3352 | // +-------+ +-------+ +---------+ +---------+ |
| 3353 | // | | | | |
| 3354 | // | | RESTSubReq1 | | |
| 3355 | // | |---------------->| | |
| 3356 | // | | | | |
| 3357 | // | | RESTSubResp1 | | |
| 3358 | // | |<----------------| | |
| 3359 | // | | | | |
| 3360 | // | | | SubReq1 | |
| 3361 | // | | |------------->| |
| 3362 | // | | | SubResp1 | |
| 3363 | // | | |<-------------| |
| 3364 | // | | RESTNotif1 | | |
| 3365 | // | |<----------------| | |
| 3366 | // | | | | |
| 3367 | // | RESTSubReq2 | | |
| 3368 | // |------------------------------>| | |
| 3369 | // | | | | |
| 3370 | // | RESTSubResp2 | | |
| 3371 | // |<------------------------------| | |
| 3372 | // | | | | |
| 3373 | // | | RESTNotif2 | | |
| 3374 | // |<------------------------------| | |
| 3375 | // | | | | |
| 3376 | // | | RESTSubDelReq1 | | |
| 3377 | // | |---------------->| | |
| 3378 | // | | | | |
| 3379 | // | | RESTSubDelResp1 | | |
| 3380 | // | |<----------------| | |
| 3381 | // | | | | |
| 3382 | // | RESTSubDelReq2 | | |
| 3383 | // |------------------------------>| | |
| 3384 | // | | | | |
| 3385 | // | RESTSubDelResp2 | | |
| 3386 | // |<------------------------------| | |
| 3387 | // | | | | |
| 3388 | // | | | SubDelReq2 | |
| 3389 | // | | |------------->| |
| 3390 | // | | | | |
| 3391 | // | | | SubDelResp2 | |
| 3392 | // | | |<-------------| |
| 3393 | // | | | | |
| 3394 | // |
| 3395 | //----------------------------------------------------------------------------- |
| 3396 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3397 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3398 | |
| 3399 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3400 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3401 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3402 | Counter{cSubReqToE2, 1}, |
| 3403 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3404 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3405 | Counter{cMergedSubscriptions, 1}, |
| 3406 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3407 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3408 | Counter{cSubDelReqToE2, 1}, |
| 3409 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3410 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3411 | }) |
| 3412 | |
| 3413 | // Req1 |
| 3414 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3415 | |
| 3416 | //Subs Create |
| 3417 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3418 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3419 | |
| 3420 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3421 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3422 | params.SetMeid("RAN_NAME_1") |
| 3423 | |
| 3424 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 3425 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3426 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3427 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3428 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3429 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 3430 | e2SubsId2 := <-xappConn2.RESTNotification |
| 3431 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3432 | |
| 3433 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3434 | |
| 3435 | // Del1 |
| 3436 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3437 | |
| 3438 | // Del2 |
| 3439 | deleteXapp2Subscription(t, &restSubId2) |
| 3440 | |
| 3441 | //Wait that subs is cleaned |
| 3442 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3443 | |
| 3444 | mainCtrl.VerifyCounterValues(t) |
| 3445 | } |
| 3446 | |
| 3447 | //----------------------------------------------------------------------------- |
| 3448 | // TestSubReqAndSubDelOkSameActionParallel |
| 3449 | // |
| 3450 | // stub stub stub |
| 3451 | // +-------+ +-------+ +---------+ +---------+ |
| 3452 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3453 | // +-------+ +-------+ +---------+ +---------+ |
| 3454 | // | | | | |
| 3455 | // | | | | |
| 3456 | // | | | | |
| 3457 | // | | SubReq1 | | |
| 3458 | // | |------------->| | |
| 3459 | // | | | | |
| 3460 | // | | | SubReq1 | |
| 3461 | // | | |------------->| |
| 3462 | // | SubReq2 | | |
| 3463 | // |--------------------------->| | |
| 3464 | // | | | SubResp1 | |
| 3465 | // | | |<-------------| |
| 3466 | // | | SubResp1 | | |
| 3467 | // | |<-------------| | |
| 3468 | // | | | SubReq2 | |
| 3469 | // | | |------------->| |
| 3470 | // | | | | |
| 3471 | // | | | SubResp2 | |
| 3472 | // | | |<-------------| |
| 3473 | // | SubResp2 | | |
| 3474 | // |<---------------------------| | |
| 3475 | // | | | | |
| 3476 | // | | SubDelReq 1 | | |
| 3477 | // | |------------->| | |
| 3478 | // | | | | |
| 3479 | // | | SubDelResp 1 | | |
| 3480 | // | |<-------------| | |
| 3481 | // | | | | |
| 3482 | // | SubDelReq 2 | | |
| 3483 | // |--------------------------->| | |
| 3484 | // | | | | |
| 3485 | // | | | SubDelReq 2 | |
| 3486 | // | | |------------->| |
| 3487 | // | | | | |
| 3488 | // | | | SubDelReq 2 | |
| 3489 | // | | |------------->| |
| 3490 | // | | | | |
| 3491 | // | SubDelResp 2 | | |
| 3492 | // |<---------------------------| | |
| 3493 | // |
| 3494 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 3495 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 3496 | |
| 3497 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3498 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3499 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3500 | Counter{cSubReqToE2, 2}, |
| 3501 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3502 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3503 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3504 | Counter{cSubDelReqToE2, 2}, |
| 3505 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3506 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3507 | }) |
| 3508 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3509 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3510 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3511 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3512 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3513 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3514 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3515 | |
| 3516 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3517 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3518 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3519 | |
| 3520 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3521 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3522 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3523 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3524 | |
| 3525 | // Del1 |
| 3526 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3527 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3528 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3529 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3530 | |
| 3531 | // Del2 |
| 3532 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3533 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 3534 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 3535 | |
| 3536 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3537 | |
| 3538 | mainCtrl.VerifyCounterValues(t) |
| 3539 | } |
| 3540 | |
| 3541 | //----------------------------------------------------------------------------- |
| 3542 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 3543 | // |
| 3544 | // stub stub stub |
| 3545 | // +-------+ +-------+ +---------+ +---------+ |
| 3546 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3547 | // +-------+ +-------+ +---------+ +---------+ |
| 3548 | // | | | | |
| 3549 | // | | | | |
| 3550 | // | | | | |
| 3551 | // | | RESTSubReq1 | | |
| 3552 | // | |---------------->| | |
| 3553 | // | | | | |
| 3554 | // | | RESTSubResp1 | | |
| 3555 | // | |<----------------| | |
| 3556 | // | | | SubReq1 | |
| 3557 | // | | |------------->| |
| 3558 | // | RESTSubReq2 | | |
| 3559 | // |------------------------------>| | |
| 3560 | // | | | | |
| 3561 | // | RESTSubDelResp2 | | |
| 3562 | // |<------------------------------| | |
| 3563 | // | | | SubReq1 | |
| 3564 | // | | |------------->| |
| 3565 | // | | | | |
| 3566 | // | | | | |
| 3567 | // | | | SubDelReq | |
| 3568 | // | | |------------->| |
| 3569 | // | | | | |
| 3570 | // | | | SubDelResp | |
| 3571 | // | | |<-------------| |
| 3572 | // | | RESTNotif1 | | |
| 3573 | // | | unsuccess | | |
| 3574 | // | |<----------------| | |
| 3575 | // | RESTNotif2 | | |
| 3576 | // | | unsuccess | | |
| 3577 | // |<------------------------------| | |
| 3578 | // | | | | |
| 3579 | // | | RESTSubDelReq1 | | |
| 3580 | // | |---------------->| | |
| 3581 | // | | | | |
| 3582 | // | | RESTSubDelResp1 | | |
| 3583 | // | |<----------------| | |
| 3584 | // | | | | |
| 3585 | // | RESTSubDelReq2 | | |
| 3586 | // |------------------------------>| | |
| 3587 | // | | | | |
| 3588 | // | RESTSubDelResp2 | | |
| 3589 | // |<------------------------------| | |
| 3590 | // |
| 3591 | //----------------------------------------------------------------------------- |
| 3592 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 3593 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 3594 | |
| 3595 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3596 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3597 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3598 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3599 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3600 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3601 | Counter{cSubDelReqToE2, 1}, |
| 3602 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3603 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3604 | }) |
| 3605 | |
| 3606 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3607 | |
| 3608 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3609 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3610 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 3611 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 3612 | |
| 3613 | // Req2 |
| 3614 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3615 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3616 | params2.SetMeid("RAN_NAME_1") |
| 3617 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3618 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3619 | |
| 3620 | //Req1 (retransmitted) |
| 3621 | e2termConn1.RecvSubsReq(t) |
| 3622 | |
| 3623 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3624 | |
| 3625 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3626 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3627 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3628 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3629 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3630 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3631 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3632 | |
| 3633 | // Del1 |
| 3634 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3635 | |
| 3636 | // Del2 |
| 3637 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3638 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3639 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 3640 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3641 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 3642 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3643 | |
| 3644 | mainCtrl.VerifyCounterValues(t) |
| 3645 | } |
| 3646 | |
| 3647 | //----------------------------------------------------------------------------- |
| 3648 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 3649 | // |
| 3650 | // stub stub stub |
| 3651 | // +-------+ +-------+ +---------+ +---------+ |
| 3652 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3653 | // +-------+ +-------+ +---------+ +---------+ |
| 3654 | // | | | | |
| 3655 | // | | | | |
| 3656 | // | | | | |
| 3657 | // | | RESTSubReq1 | | |
| 3658 | // | |---------------->| | |
| 3659 | // | | | | |
| 3660 | // | | RESTSubResp1 | | |
| 3661 | // | |<----------------| | |
| 3662 | // | | | SubReq1 | |
| 3663 | // | | |------------->| |
| 3664 | // | RESTSubReq2 | | |
| 3665 | // |------------------------------>| | |
| 3666 | // | | | | |
| 3667 | // | RESTSubDelResp2 | | |
| 3668 | // |<------------------------------| | |
| 3669 | // | | | SubFail1 | |
| 3670 | // | | |<-------------| |
| 3671 | // | | | | |
| 3672 | // | | RESTNotif1 | | |
| 3673 | // | | unsuccess | | |
| 3674 | // | |<----------------| | |
| 3675 | // | RESTNotif2 | | |
| 3676 | // | | unsuccess | | |
| 3677 | // |<------------------------------| | |
| 3678 | // | | | SubDelReq | |
| 3679 | // | | |------------->| |
| 3680 | // | | | SubDelResp | |
| 3681 | // | | |<-------------| |
| 3682 | // | | | | |
| 3683 | // | | RESTSubDelReq1 | | |
| 3684 | // | |---------------->| | |
| 3685 | // | | | | |
| 3686 | // | | RESTSubDelResp1 | | |
| 3687 | // | |<----------------| | |
| 3688 | // | | | | |
| 3689 | // | RESTSubDelReq2 | | |
| 3690 | // |------------------------------>| | |
| 3691 | // | | | | |
| 3692 | // | RESTSubDelResp2 | | |
| 3693 | // |<------------------------------| | |
| 3694 | // |
| 3695 | //----------------------------------------------------------------------------- |
| 3696 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 3697 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 3698 | |
| 3699 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3700 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3701 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3702 | Counter{cSubReqToE2, 1}, |
| 3703 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3704 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3705 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3706 | Counter{cSubDelReqToE2, 1}, |
| 3707 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3708 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3709 | }) |
| 3710 | |
| 3711 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3712 | |
| 3713 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3714 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3715 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3716 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3717 | |
| 3718 | // Req2 |
| 3719 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3720 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3721 | params2.SetMeid("RAN_NAME_1") |
| 3722 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3723 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3724 | |
| 3725 | // E2t: send SubsFail (first) |
| 3726 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3727 | fparams1.Set(crereq1) |
| 3728 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3729 | |
| 3730 | // E2t: internal delete |
| 3731 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3732 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3733 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3734 | |
| 3735 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3736 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3737 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3738 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 3739 | |
| 3740 | // Del1 |
| 3741 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3742 | |
| 3743 | // Del2 |
| 3744 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3745 | |
| 3746 | //Wait that subs is cleaned |
| 3747 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 3748 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3749 | |
| 3750 | mainCtrl.VerifyCounterValues(t) |
| 3751 | } |
| 3752 | |
| 3753 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 3754 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3755 | |
| 3756 | // Init counter check |
| 3757 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3758 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3759 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3760 | Counter{cSubReqToE2, 1}, |
| 3761 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3762 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3763 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3764 | Counter{cSubDelReqToE2, 1}, |
| 3765 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3766 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3767 | }) |
| 3768 | |
| 3769 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3770 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3771 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3772 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3773 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3774 | |
| 3775 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3776 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3777 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3778 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3779 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 3780 | |
| 3781 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3782 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3783 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3784 | |
| 3785 | // Wait that subs is cleaned |
| 3786 | waitSubsCleanup(t, e2SubsId, 10) |
| 3787 | mainCtrl.VerifyCounterValues(t) |
| 3788 | } |
| 3789 | |
| 3790 | //----------------------------------------------------------------------------- |
| 3791 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 3792 | // |
| 3793 | // stub stub |
| 3794 | // +-------+ +---------+ +---------+ |
| 3795 | // | xapp | | submgr | | e2term | |
| 3796 | // +-------+ +---------+ +---------+ |
| 3797 | // | | | |
| 3798 | // | RESTSubReq | | |
| 3799 | // |---------------->| | |
| 3800 | // | | | |
| 3801 | // | RESTSubResp | | |
| 3802 | // |<----------------| | |
| 3803 | // | | SubReq | |
| 3804 | // | |------------->| |
| 3805 | // | | | |
| 3806 | // | | SubResp | |
| 3807 | // | |<-------------| |
| 3808 | // | | | |
| 3809 | // | RESTNotif | | |
| 3810 | // |<----------------| | |
| 3811 | // | | | |
| 3812 | // | RESTSubReq | | |
| 3813 | // |---------------->| | |
| 3814 | // | | | |
| 3815 | // | RESTSubResp | | |
| 3816 | // |<----------------| | |
| 3817 | // | | SubReq | |
| 3818 | // | |------------->| |
| 3819 | // | | | |
| 3820 | // | | SubResp | |
| 3821 | // | |<-------------| |
| 3822 | // | | | |
| 3823 | // | RESTNotif | | |
| 3824 | // |<----------------| | |
| 3825 | // | | | |
| 3826 | // | RESTSubDelReq | | |
| 3827 | // |---------------->| | |
| 3828 | // | | | |
| 3829 | // | | SubDelReq | |
| 3830 | // | |------------->| |
| 3831 | // | | | |
| 3832 | // | | SubDelResp | |
| 3833 | // | |<-------------| |
| 3834 | // | | | |
| 3835 | // | RESTSubDelResp | | |
| 3836 | // |<----------------| | |
| 3837 | // |
| 3838 | //----------------------------------------------------------------------------- |
| 3839 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 3840 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3841 | |
| 3842 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3843 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3844 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3845 | Counter{cSubReqToE2, 2}, |
| 3846 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3847 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3848 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3849 | Counter{cSubDelReqToE2, 1}, |
| 3850 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3851 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3852 | }) |
| 3853 | |
| 3854 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3855 | |
| 3856 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3857 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3858 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3859 | |
| 3860 | // Policy change |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3861 | // GetRESTSubsReqPolicyParams sets some coutners on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 3862 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3863 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 3864 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3865 | params.SetTimeToWait("w200ms") |
| 3866 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3867 | |
| 3868 | // Del |
| 3869 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3870 | |
| 3871 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3872 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3873 | |
| 3874 | // Wait that subs is cleaned |
| 3875 | waitSubsCleanup(t, e2SubsId, 10) |
| 3876 | mainCtrl.VerifyCounterValues(t) |
| 3877 | } |
| 3878 | |
| 3879 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 3880 | // TestRESTSubReqPolicyChangeNOk |
| 3881 | // |
| 3882 | // stub stub |
| 3883 | // +-------+ +---------+ +---------+ |
| 3884 | // | xapp | | submgr | | e2term | |
| 3885 | // +-------+ +---------+ +---------+ |
| 3886 | // | | | |
| 3887 | // | RESTSubReq | | |
| 3888 | // |---------------->| | |
| 3889 | // | | | |
| 3890 | // | RESTSubResp | | |
| 3891 | // |<----------------| | |
| 3892 | // | | SubReq | |
| 3893 | // | |------------->| |
| 3894 | // | | | |
| 3895 | // | | SubResp | |
| 3896 | // | |<-------------| |
| 3897 | // | | | |
| 3898 | // | RESTNotif | | |
| 3899 | // |<----------------| | |
| 3900 | // | | | |
| 3901 | // | RESTSubReq | | |
| 3902 | // |---------------->| | |
| 3903 | // | | | |
| 3904 | // | RESTSubUpdateFail | |
| 3905 | // | | | |
| 3906 | // | RESTSubDelReq | | |
| 3907 | // |---------------->| | |
| 3908 | // | | | |
| 3909 | // | | SubDelReq | |
| 3910 | // | |------------->| |
| 3911 | // | | | |
| 3912 | // | | SubDelResp | |
| 3913 | // | |<-------------| |
| 3914 | // | | | |
| 3915 | // | RESTSubDelResp | | |
| 3916 | // |<----------------| | |
| 3917 | // |
| 3918 | //----------------------------------------------------------------------------- |
| 3919 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 3920 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 3921 | |
| 3922 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3923 | Counter{cRestSubReqFromXapp, 2}, |
| 3924 | Counter{cRestSubRespToXapp, 1}, |
| 3925 | Counter{cSubReqToE2, 1}, |
| 3926 | Counter{cSubRespFromE2, 1}, |
| 3927 | Counter{cRestSubNotifToXapp, 1}, |
| 3928 | Counter{cRestSubFailToXapp, 1}, |
| 3929 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3930 | Counter{cSubDelReqToE2, 1}, |
| 3931 | Counter{cSubDelRespFromE2, 1}, |
| 3932 | Counter{cRestSubDelRespToXapp, 1}, |
| 3933 | }) |
| 3934 | |
| 3935 | const subReqCount int = 1 |
| 3936 | |
| 3937 | // Req |
| 3938 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 3939 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3940 | |
| 3941 | // Policy change |
| 3942 | |
| 3943 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 3944 | |
| 3945 | restSubIdUpd := strings.ToUpper(restSubId) |
| 3946 | params.SetSubscriptionID(&restSubIdUpd) |
| 3947 | params.SetTimeToWait("w200ms") |
| 3948 | |
| 3949 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 3950 | assert.Equal(t, restSubId2, "") |
| 3951 | |
| 3952 | // Del |
| 3953 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3954 | |
| 3955 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3956 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3957 | |
| 3958 | // Wait that subs is cleaned |
| 3959 | waitSubsCleanup(t, e2SubsId, 10) |
| 3960 | mainCtrl.VerifyCounterValues(t) |
| 3961 | } |
| 3962 | |
| 3963 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3964 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 3965 | // |
| 3966 | // stub stub stub |
| 3967 | // +-------+ +---------+ +---------+ +---------+ |
| 3968 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 3969 | // +-------+ +---------+ +---------+ +---------+ |
| 3970 | // | | | | |
| 3971 | // | | | | |
| 3972 | // | | | | |
| 3973 | // | RESTSubReq1 | | | |
| 3974 | // |---------------->| | | |
| 3975 | // | | | | |
| 3976 | // | RESTSubResp1 | | | |
| 3977 | // |<----------------| | | |
| 3978 | // | | SubReq1 | | |
| 3979 | // | |------------->| | |
| 3980 | // | | | | |
| 3981 | // | RESTSubReq2 | | | |
| 3982 | // |---------------->| | | |
| 3983 | // | | | | |
| 3984 | // | RESTSubResp2 | | | |
| 3985 | // |<----------------| | | |
| 3986 | // | | SubReq2 | | |
| 3987 | // | |---------------------------->| |
| 3988 | // | | | | |
| 3989 | // | | SubResp1 | | |
| 3990 | // | |<-------------| | |
| 3991 | // | RESTNotif1 | | | |
| 3992 | // |<----------------| | | |
| 3993 | // | | SubResp2 | | |
| 3994 | // | |<----------------------------| |
| 3995 | // | RESTNotif2 | | | |
| 3996 | // |<----------------| | | |
| 3997 | // | | | | |
| 3998 | // | [SUBS 1 DELETE] | | |
| 3999 | // | | | | |
| 4000 | // | [SUBS 2 DELETE] | | |
| 4001 | // | | | | |
| 4002 | // |
| 4003 | //----------------------------------------------------------------------------- |
| 4004 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4005 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4006 | |
| 4007 | // Init counter check |
| 4008 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4009 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4010 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4011 | Counter{cSubReqToE2, 2}, |
| 4012 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4013 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4014 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4015 | Counter{cSubDelReqToE2, 2}, |
| 4016 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4017 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4018 | }) |
| 4019 | |
| 4020 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4021 | |
| 4022 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4023 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4024 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4025 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4026 | |
| 4027 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4028 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4029 | params.SetMeid("RAN_NAME_11") |
| 4030 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4031 | // would not work as notification would not be received |
| 4032 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4033 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4034 | |
| 4035 | // Resp1 |
| 4036 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4037 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4038 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4039 | xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
| 4040 | |
| 4041 | // Resp2 |
| 4042 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4043 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4044 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4045 | xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
| 4046 | |
| 4047 | // Delete1 |
| 4048 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4049 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4050 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4051 | |
| 4052 | // Wait that subs is cleaned |
| 4053 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4054 | |
| 4055 | // Delete2 |
| 4056 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4057 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4058 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4059 | |
| 4060 | // Wait that subs is cleaned |
| 4061 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4062 | |
| 4063 | mainCtrl.VerifyCounterValues(t) |
| 4064 | } |
| 4065 | |
| 4066 | //----------------------------------------------------------------------------- |
| 4067 | // TestRESTSubReqAsn1EncodeFail |
| 4068 | // |
| 4069 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4070 | // stub stub |
| 4071 | // +-------+ +---------+ +---------+ |
| 4072 | // | xapp | | submgr | | e2term | |
| 4073 | // +-------+ +---------+ +---------+ |
| 4074 | // | | | |
| 4075 | // | RESTSubReq | | |
| 4076 | // |---------------->| | |
| 4077 | // | | | |
| 4078 | // | RESTSubResp | | |
| 4079 | // |<----------------| | |
| 4080 | // | RESTSubDelReq | | |
| 4081 | // |---------------->| | |
| 4082 | // | RESTSubDelResp | | |
| 4083 | // | unsuccess | | |
| 4084 | // |<----------------| | |
| 4085 | // | | | |
| 4086 | // |
| 4087 | //----------------------------------------------------------------------------- |
| 4088 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4089 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4090 | |
| 4091 | xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") |
| 4092 | |
| 4093 | } |
| 4094 | |
| 4095 | //----------------------------------------------------------------------------- |
| 4096 | // TestRESTSubReqInsertAndSubDelOk |
| 4097 | // |
| 4098 | // stub stub |
| 4099 | // +-------+ +---------+ +---------+ |
| 4100 | // | xapp | | submgr | | e2term | |
| 4101 | // +-------+ +---------+ +---------+ |
| 4102 | // | | | |
| 4103 | // | RestSubReq | | |
| 4104 | // |---------------->| | |
| 4105 | // | | | |
| 4106 | // | RESTSubResp | | |
| 4107 | // |<----------------| | |
| 4108 | // | | | |
| 4109 | // | | SubReq | |
| 4110 | // | |------------->| |
| 4111 | // | | | |
| 4112 | // | | SubResp | |
| 4113 | // | |<-------------| |
| 4114 | // | RESTNotif | | |
| 4115 | // |<----------------| | |
| 4116 | // | ... | ... | |
| 4117 | // | | | |
| 4118 | // | RESTSubDelReq | | |
| 4119 | // |---------------->| | |
| 4120 | // | | | |
| 4121 | // | | SubDelReq | |
| 4122 | // | |------------->| |
| 4123 | // | | | |
| 4124 | // | | SubDelResp | |
| 4125 | // | |<-------------| |
| 4126 | // | | | |
| 4127 | // | RESTSubDelResp| | |
| 4128 | // |<----------------| | |
| 4129 | // |
| 4130 | //----------------------------------------------------------------------------- |
| 4131 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4132 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4133 | |
| 4134 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4135 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4136 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4137 | Counter{cSubReqToE2, 1}, |
| 4138 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4139 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4140 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4141 | Counter{cSubDelReqToE2, 1}, |
| 4142 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4143 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4144 | }) |
| 4145 | |
| 4146 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4147 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4148 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4149 | params.SetSubActionTypes("insert") |
| 4150 | |
| 4151 | // Req |
| 4152 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4153 | |
| 4154 | // Del |
| 4155 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4156 | |
| 4157 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4158 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4159 | |
| 4160 | // Wait that subs is cleaned |
| 4161 | waitSubsCleanup(t, e2SubsId, 10) |
| 4162 | mainCtrl.VerifyCounterValues(t) |
| 4163 | } |
| 4164 | |
| 4165 | //----------------------------------------------------------------------------- |
| 4166 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4167 | // |
| 4168 | // stub stub |
| 4169 | // +-------+ +---------+ +---------+ |
| 4170 | // | xapp | | submgr | | e2term | |
| 4171 | // +-------+ +---------+ +---------+ |
| 4172 | // | | | |
| 4173 | // | RESTSubReq | | |
| 4174 | // |------------->| | |
| 4175 | // | | | |
| 4176 | // | | SubReq | |
| 4177 | // | |------------->| |
| 4178 | // | | | |
| 4179 | // | | SubResp | |
| 4180 | // | <----| |
| 4181 | // | | |
| 4182 | // | Submgr restart | |
| 4183 | // | | |
| 4184 | // | | | |
| 4185 | // | | SubDelReq | |
| 4186 | // | |------------->| |
| 4187 | // | | | |
| 4188 | // | | SubDelResp | |
| 4189 | // | |<-------------| |
| 4190 | // | | | |
| 4191 | // |
| 4192 | //----------------------------------------------------------------------------- |
| 4193 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4194 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4195 | |
| 4196 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4197 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4198 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4199 | Counter{cSubReqToE2, 1}, |
| 4200 | Counter{cSubDelReqFromXapp, 1}, |
| 4201 | Counter{cSubDelReqToE2, 1}, |
| 4202 | Counter{cSubDelRespFromE2, 1}, |
| 4203 | }) |
| 4204 | |
| 4205 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4206 | |
| 4207 | // Remove possible existing subscription |
| 4208 | mainCtrl.removeExistingSubscriptions(t) |
| 4209 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4210 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4211 | |
| 4212 | //Req |
| 4213 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4214 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4215 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4216 | |
| 4217 | e2termConn1.RecvSubsReq(t) |
| 4218 | |
| 4219 | mainCtrl.SetResetTestFlag(t, false) |
| 4220 | |
| 4221 | mainCtrl.SimulateRestart(t) |
| 4222 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4223 | |
| 4224 | //Del |
| 4225 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4226 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4227 | |
| 4228 | xappConn1.TestMsgChanEmpty(t) |
| 4229 | xappConn2.TestMsgChanEmpty(t) |
| 4230 | e2termConn1.TestMsgChanEmpty(t) |
| 4231 | mainCtrl.wait_registry_empty(t, 10) |
| 4232 | |
| 4233 | mainCtrl.VerifyCounterValues(t) |
| 4234 | } |
| 4235 | |
| 4236 | //----------------------------------------------------------------------------- |
| 4237 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 4238 | // |
| 4239 | // stub stub |
| 4240 | // +-------+ +---------+ +---------+ |
| 4241 | // | xapp | | submgr | | e2term | |
| 4242 | // +-------+ +---------+ +---------+ |
| 4243 | // | | | |
| 4244 | // | RESTSubReq | | |
| 4245 | // |---------------->| | |
| 4246 | // | | | |
| 4247 | // | RESTSubResp | | |
| 4248 | // |<----------------| | |
| 4249 | // | | SubReq | |
| 4250 | // | |------------->| |
| 4251 | // | | | |
| 4252 | // | | SubResp | |
| 4253 | // | |<-------------| |
| 4254 | // | | | |
| 4255 | // | RESTNotif | | |
| 4256 | // |<----------------| | |
| 4257 | // | | | |
| 4258 | // | | |
| 4259 | // | Submgr restart | |
| 4260 | // | | | |
| 4261 | // | RESTSubDelReq | | |
| 4262 | // |---------------->| | |
| 4263 | // | | | |
| 4264 | // | | SubDelReq | |
| 4265 | // | |------------->| |
| 4266 | // | | | |
| 4267 | // | | SubDelResp | |
| 4268 | // | |<-------------| |
| 4269 | // | | | |
| 4270 | // | RESTSubDelResp | | |
| 4271 | // |<----------------| | |
| 4272 | // |
| 4273 | //----------------------------------------------------------------------------- |
| 4274 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4275 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4276 | |
| 4277 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4278 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4279 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4280 | Counter{cSubReqToE2, 1}, |
| 4281 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4282 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4283 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4284 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4285 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4286 | }) |
| 4287 | |
| 4288 | // Remove possible existing subscription |
| 4289 | mainCtrl.removeExistingSubscriptions(t) |
| 4290 | |
| 4291 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4292 | |
| 4293 | // Create subscription |
| 4294 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4295 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4296 | |
| 4297 | // Check subscription |
| 4298 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4299 | |
| 4300 | // When SDL support for the REST Interface is added |
| 4301 | // the submgr restart statement below should be removed |
| 4302 | // from the comment. |
| 4303 | |
| 4304 | // mainCtrl.SimulateRestart(t) |
| 4305 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4306 | |
| 4307 | // Check subscription |
| 4308 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4309 | |
| 4310 | // Delete subscription |
| 4311 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4312 | |
| 4313 | //Wait that subs is cleaned |
| 4314 | waitSubsCleanup(t, e2SubsId, 10) |
| 4315 | |
| 4316 | mainCtrl.VerifyCounterValues(t) |
| 4317 | } |
| 4318 | |
| 4319 | //----------------------------------------------------------------------------- |
| 4320 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4321 | // |
| 4322 | // stub stub |
| 4323 | // +-------+ +-------+ +---------+ +---------+ |
| 4324 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4325 | // +-------+ +-------+ +---------+ +---------+ |
| 4326 | // | | | | |
| 4327 | // | | RESTSubReq1 | | |
| 4328 | // | |---------------->| | |
| 4329 | // | | | | |
| 4330 | // | | RESTSubResp1 | | |
| 4331 | // | |<----------------| | |
| 4332 | // | | | | |
| 4333 | // | | | SubReq1 | |
| 4334 | // | | |------------->| |
| 4335 | // | | | SubResp1 | |
| 4336 | // | | |<-------------| |
| 4337 | // | | RESTNotif1 | | |
| 4338 | // | |<----------------| | |
| 4339 | // | | | | |
| 4340 | // | RESTSubReq2 | | |
| 4341 | // |------------------------------>| | |
| 4342 | // | | | | |
| 4343 | // | RESTSubResp2 | | |
| 4344 | // |<------------------------------| | |
| 4345 | // | | | | |
| 4346 | // | | RESTNotif2 | | |
| 4347 | // |<------------------------------| | |
| 4348 | // | | | | |
| 4349 | // | | Submgr restart | |
| 4350 | // | | | | |
| 4351 | // | | RESTSubDelReq1 | | |
| 4352 | // | |---------------->| | |
| 4353 | // | | | | |
| 4354 | // | | RESTSubDelResp1 | | |
| 4355 | // | |<----------------| | |
| 4356 | // | | | | |
| 4357 | // | | Submgr restart | |
| 4358 | // | | | | |
| 4359 | // | RESTSubDelReq2 | | |
| 4360 | // |------------------------------>| | |
| 4361 | // | | | | |
| 4362 | // | RESTSubDelResp2 | | |
| 4363 | // |<------------------------------| | |
| 4364 | // | | | | |
| 4365 | // | | | SubDelReq2 | |
| 4366 | // | | |------------->| |
| 4367 | // | | | | |
| 4368 | // | | | SubDelResp2 | |
| 4369 | // | | |<-------------| |
| 4370 | // | | | | |
| 4371 | // |
| 4372 | //----------------------------------------------------------------------------- |
| 4373 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4374 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4375 | |
| 4376 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4377 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4378 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4379 | Counter{cSubReqToE2, 1}, |
| 4380 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4381 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4382 | Counter{cMergedSubscriptions, 1}, |
| 4383 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4384 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4385 | Counter{cSubDelReqToE2, 1}, |
| 4386 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4387 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4388 | }) |
| 4389 | |
| 4390 | // Remove possible existing subscription |
| 4391 | mainCtrl.removeExistingSubscriptions(t) |
| 4392 | |
| 4393 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4394 | |
| 4395 | // Create subscription 1 |
| 4396 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4397 | xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
| 4398 | |
| 4399 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4400 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4401 | params.SetMeid("RAN_NAME_1") |
| 4402 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4403 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
| 4404 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4405 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4406 | e2SubsId2 := <-xappConn2.RESTNotification |
| 4407 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 4408 | |
| 4409 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4410 | |
| 4411 | // When SDL support for the REST Interface is added |
| 4412 | // the submgr restart statement below should be removed |
| 4413 | // from the comment. |
| 4414 | |
| 4415 | // mainCtrl.SimulateRestart(t) |
| 4416 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4417 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4418 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 4419 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4420 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4421 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4422 | |
| 4423 | // When SDL support for the REST Interface is added |
| 4424 | // the submgr restart statement below should be removed |
| 4425 | // from the comment. |
| 4426 | |
| 4427 | // mainCtrl.SimulateRestart(t) |
| 4428 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4429 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4430 | |
| 4431 | // Delete subscription 2 |
| 4432 | deleteXapp2Subscription(t, &restSubId2) |
| 4433 | |
| 4434 | //Wait that subs is cleaned |
| 4435 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4436 | |
| 4437 | mainCtrl.VerifyCounterValues(t) |
| 4438 | } |
| 4439 | |
| 4440 | //----------------------------------------------------------------------------- |
| 4441 | // TestRESTReportSubReqAndSubDelOk |
| 4442 | // |
| 4443 | // stub stub |
| 4444 | // +-------+ +---------+ +---------+ |
| 4445 | // | xapp | | submgr | | e2term | |
| 4446 | // +-------+ +---------+ +---------+ |
| 4447 | // | | | |
| 4448 | // | RestSubReq | | |
| 4449 | // |---------------->| | |
| 4450 | // | | | |
| 4451 | // | RESTSubResp | | |
| 4452 | // |<----------------| | |
| 4453 | // | | | |
| 4454 | // | | SubReq | |
| 4455 | // | |------------->| |
| 4456 | // | | | |
| 4457 | // | | SubResp | |
| 4458 | // | |<-------------| |
| 4459 | // | RESTNotif | | |
| 4460 | // |<----------------| | |
| 4461 | // | | SubReq | |
| 4462 | // | |------------->| |
| 4463 | // | | | |
| 4464 | // | | SubResp | |
| 4465 | // | |<-------------| |
| 4466 | // | RESTNotif | | |
| 4467 | // |<----------------| | |
| 4468 | // | ... | ... | |
| 4469 | // | | | |
| 4470 | // | | | |
| 4471 | // | RESTSubDelReq | | |
| 4472 | // |---------------->| | |
| 4473 | // | | | |
| 4474 | // | | SubDelReq | |
| 4475 | // | |------------->| |
| 4476 | // | | | |
| 4477 | // | | SubDelResp | |
| 4478 | // | |<-------------| |
| 4479 | // | | | |
| 4480 | // | RESTSubDelResp| | |
| 4481 | // |<----------------| | |
| 4482 | // |
| 4483 | //----------------------------------------------------------------------------- |
| 4484 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 4485 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
| 4486 | subReqCount := 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4487 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4488 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4489 | } |
| 4490 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4491 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4492 | xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4493 | |
| 4494 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4495 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4496 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4497 | |
| 4498 | var e2SubsId []uint32 |
| 4499 | for i := 0; i < subReqCount; i++ { |
| 4500 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4501 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4502 | |
| 4503 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4504 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4505 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4506 | e2SubsId = append(e2SubsId, instanceId) |
| 4507 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4508 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 4509 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 4510 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 4511 | |
| 4512 | } |
| 4513 | |
| 4514 | // Del |
| 4515 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4516 | |
| 4517 | for i := 0; i < subReqCount; i++ { |
| 4518 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4519 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4520 | } |
| 4521 | |
| 4522 | // Wait that subs is cleaned |
| 4523 | for i := 0; i < subReqCount; i++ { |
| 4524 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4525 | } |
| 4526 | |
| 4527 | xappConn1.TestMsgChanEmpty(t) |
| 4528 | e2termConn1.TestMsgChanEmpty(t) |
| 4529 | mainCtrl.wait_registry_empty(t, 10) |
| 4530 | } |
| 4531 | |
| 4532 | /* |
| 4533 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 4534 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 4535 | |
| 4536 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4537 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4538 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4539 | |
| 4540 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4541 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4542 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4543 | } |
| 4544 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4545 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 4546 | xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4547 | |
| 4548 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4549 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4550 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4551 | //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4552 | //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) |
| 4553 | |
| 4554 | var e2SubsId []uint32 |
| 4555 | for i := 0; i < subReqCount; i++ { |
| 4556 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4557 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4558 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4559 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4560 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4561 | e2SubsId = append(e2SubsId, instanceId) |
| 4562 | } |
| 4563 | |
| 4564 | // Del |
| 4565 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4566 | |
| 4567 | for i := 0; i < subReqCount; i++ { |
| 4568 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4569 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4570 | } |
| 4571 | |
| 4572 | // Wait that subs is cleaned |
| 4573 | for i := 0; i < subReqCount; i++ { |
| 4574 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4575 | } |
| 4576 | xappConn1.TestMsgChanEmpty(t) |
| 4577 | e2termConn1.TestMsgChanEmpty(t) |
| 4578 | mainCtrl.wait_registry_empty(t, 10) |
| 4579 | } |
| 4580 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4581 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 4582 | |
| 4583 | subReqCount := 2 |
| 4584 | |
| 4585 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4586 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4587 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4588 | Counter{cSubReqToE2, 2}, |
| 4589 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4590 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4591 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4592 | Counter{cSubDelReqToE2, 2}, |
| 4593 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4594 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4595 | }) |
| 4596 | |
| 4597 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4598 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4599 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4600 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4601 | |
| 4602 | assert.Equal(t, len(e2SubsIds), 2) |
| 4603 | |
| 4604 | // Del |
| 4605 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4606 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4607 | |
| 4608 | xappConn1.TestMsgChanEmpty(t) |
| 4609 | e2termConn1.TestMsgChanEmpty(t) |
| 4610 | mainCtrl.wait_registry_empty(t, 10) |
| 4611 | |
| 4612 | mainCtrl.VerifyCounterValues(t) |
| 4613 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4614 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 4615 | |
| 4616 | subReqCount := 19 |
| 4617 | |
| 4618 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4619 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4620 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4621 | Counter{cSubReqToE2, 19}, |
| 4622 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4623 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4624 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4625 | Counter{cSubDelReqToE2, 19}, |
| 4626 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4627 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4628 | }) |
| 4629 | |
| 4630 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4631 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4632 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4633 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4634 | |
| 4635 | assert.Equal(t, len(e2SubsIds), 19) |
| 4636 | |
| 4637 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4638 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4639 | |
| 4640 | xappConn1.TestMsgChanEmpty(t) |
| 4641 | e2termConn1.TestMsgChanEmpty(t) |
| 4642 | mainCtrl.wait_registry_empty(t, 10) |
| 4643 | |
| 4644 | mainCtrl.VerifyCounterValues(t) |
| 4645 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4646 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 4647 | |
| 4648 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4649 | |
| 4650 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4651 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4652 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4653 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4654 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4655 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4656 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4657 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4658 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4659 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4660 | }) |
| 4661 | |
| 4662 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4663 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4664 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4665 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4666 | |
| 4667 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4668 | |
| 4669 | // Del |
| 4670 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4671 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4672 | |
| 4673 | xappConn1.TestMsgChanEmpty(t) |
| 4674 | e2termConn1.TestMsgChanEmpty(t) |
| 4675 | mainCtrl.wait_registry_empty(t, 10) |
| 4676 | |
| 4677 | mainCtrl.VerifyCounterValues(t) |
| 4678 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4679 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4680 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 4681 | |
| 4682 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4683 | |
| 4684 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4685 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4686 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4687 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4688 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4689 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4690 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4691 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4692 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4693 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4694 | }) |
| 4695 | |
| 4696 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4697 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4698 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4699 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4700 | |
| 4701 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4702 | |
| 4703 | // Del |
| 4704 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4705 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4706 | |
| 4707 | xappConn1.TestMsgChanEmpty(t) |
| 4708 | e2termConn1.TestMsgChanEmpty(t) |
| 4709 | mainCtrl.wait_registry_empty(t, 10) |
| 4710 | |
| 4711 | mainCtrl.VerifyCounterValues(t) |
| 4712 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4713 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4714 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 4715 | |
| 4716 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4717 | |
| 4718 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4719 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4720 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4721 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4722 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4723 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4724 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4725 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4726 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4727 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4728 | }) |
| 4729 | |
| 4730 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4731 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4732 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4733 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4734 | |
| 4735 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4736 | |
| 4737 | // Del |
| 4738 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4739 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4740 | |
| 4741 | xappConn1.TestMsgChanEmpty(t) |
| 4742 | e2termConn1.TestMsgChanEmpty(t) |
| 4743 | mainCtrl.wait_registry_empty(t, 10) |
| 4744 | |
| 4745 | mainCtrl.VerifyCounterValues(t) |
| 4746 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4747 | |
| 4748 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 4749 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 4750 | |
| 4751 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4752 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4753 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4754 | Counter{cSubReqToE2, 2}, |
| 4755 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4756 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4757 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4758 | Counter{cSubDelReqToE2, 2}, |
| 4759 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4760 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4761 | }) |
| 4762 | |
| 4763 | // Req1 |
| 4764 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4765 | |
| 4766 | //Subs Create |
| 4767 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4768 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4769 | |
| 4770 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4771 | |
| 4772 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4773 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4774 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame^] | 4775 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4776 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 4777 | |
| 4778 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4779 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4780 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4781 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4782 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4783 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4784 | |
| 4785 | deleteXapp1Subscription(t, &restSubId1) |
| 4786 | deleteXapp2Subscription(t, &restSubId2) |
| 4787 | |
| 4788 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4789 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4790 | |
| 4791 | mainCtrl.VerifyCounterValues(t) |
| 4792 | |
| 4793 | } |
| 4794 | |
| 4795 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 4796 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 4797 | |
| 4798 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4799 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4800 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4801 | Counter{cSubReqToE2, 2}, |
| 4802 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4803 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4804 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4805 | Counter{cSubDelReqToE2, 2}, |
| 4806 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4807 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4808 | }) |
| 4809 | |
| 4810 | // Req1 |
| 4811 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4812 | |
| 4813 | //Subs Create |
| 4814 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4815 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4816 | |
| 4817 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4818 | |
| 4819 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4820 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4821 | params.SetMeid("RAN_NAME_1") |
| 4822 | |
| 4823 | actionId := int64(1) |
| 4824 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame^] | 4825 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4826 | subsequestActionType := "continue" |
| 4827 | timeToWait := "w10ms" |
| 4828 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 4829 | |
| 4830 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4831 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4832 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4833 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4834 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4835 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4836 | |
| 4837 | deleteXapp1Subscription(t, &restSubId1) |
| 4838 | deleteXapp2Subscription(t, &restSubId2) |
| 4839 | |
| 4840 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4841 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4842 | |
| 4843 | mainCtrl.VerifyCounterValues(t) |
| 4844 | |
| 4845 | } |
| 4846 | |
| 4847 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 4848 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 4849 | |
| 4850 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4851 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4852 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4853 | Counter{cSubReqToE2, 2}, |
| 4854 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4855 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4856 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4857 | Counter{cSubDelReqToE2, 2}, |
| 4858 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4859 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4860 | }) |
| 4861 | |
| 4862 | // Req1 |
| 4863 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4864 | |
| 4865 | //Subs Create |
| 4866 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4867 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4868 | |
| 4869 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4870 | |
| 4871 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4872 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4873 | params.SetMeid("RAN_NAME_1") |
| 4874 | params.SetSubActionIDs(int64(2)) |
| 4875 | |
| 4876 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4877 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4878 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4879 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4880 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4881 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4882 | |
| 4883 | deleteXapp1Subscription(t, &restSubId1) |
| 4884 | deleteXapp2Subscription(t, &restSubId2) |
| 4885 | |
| 4886 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4887 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4888 | |
| 4889 | mainCtrl.VerifyCounterValues(t) |
| 4890 | |
| 4891 | } |
| 4892 | |
| 4893 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 4894 | CaseBegin("TestRESTSubReqDiffActionType") |
| 4895 | |
| 4896 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4897 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4898 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4899 | Counter{cSubReqToE2, 2}, |
| 4900 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4901 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4902 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4903 | Counter{cSubDelReqToE2, 2}, |
| 4904 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4905 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4906 | }) |
| 4907 | |
| 4908 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4909 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4910 | |
| 4911 | //Subs Create |
| 4912 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4913 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4914 | |
| 4915 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4916 | |
| 4917 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4918 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4919 | params.SetMeid("RAN_NAME_1") |
| 4920 | |
| 4921 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4922 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4923 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4924 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4925 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4926 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4927 | |
| 4928 | deleteXapp1Subscription(t, &restSubId1) |
| 4929 | deleteXapp2Subscription(t, &restSubId2) |
| 4930 | |
| 4931 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4932 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4933 | |
| 4934 | mainCtrl.VerifyCounterValues(t) |
| 4935 | |
| 4936 | } |
| 4937 | |
| 4938 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 4939 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 4940 | |
| 4941 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4942 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4943 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4944 | Counter{cSubReqToE2, 2}, |
| 4945 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4946 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4947 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4948 | Counter{cSubDelReqToE2, 2}, |
| 4949 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4950 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4951 | }) |
| 4952 | |
| 4953 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4954 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4955 | |
| 4956 | //Subs Create |
| 4957 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4958 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 4959 | |
| 4960 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4961 | |
| 4962 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4963 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4964 | params.SetMeid("RAN_NAME_1") |
| 4965 | |
| 4966 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4967 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4968 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4969 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4970 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4971 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4972 | |
| 4973 | deleteXapp1Subscription(t, &restSubId1) |
| 4974 | deleteXapp2Subscription(t, &restSubId2) |
| 4975 | |
| 4976 | waitSubsCleanup(t, e2SubsId1, 10) |
| 4977 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4978 | |
| 4979 | mainCtrl.VerifyCounterValues(t) |
| 4980 | |
| 4981 | } |
| 4982 | |
| 4983 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 4984 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 4985 | |
| 4986 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4987 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4988 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4989 | Counter{cSubReqToE2, 2}, |
| 4990 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4991 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4992 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4993 | Counter{cSubDelReqToE2, 2}, |
| 4994 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4995 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 4996 | }) |
| 4997 | |
| 4998 | // Req1 |
| 4999 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5000 | |
| 5001 | //Subs Create |
| 5002 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5003 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5004 | |
| 5005 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5006 | |
| 5007 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5008 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5009 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame^] | 5010 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5011 | params.SetSubActionDefinition(actionDefinition) |
| 5012 | |
| 5013 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5014 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5015 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5016 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5017 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5018 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5019 | |
| 5020 | deleteXapp1Subscription(t, &restSubId1) |
| 5021 | deleteXapp2Subscription(t, &restSubId2) |
| 5022 | |
| 5023 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5024 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5025 | |
| 5026 | mainCtrl.VerifyCounterValues(t) |
| 5027 | |
| 5028 | } |
| 5029 | |
| 5030 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5031 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5032 | |
| 5033 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5034 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5035 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5036 | Counter{cSubReqToE2, 2}, |
| 5037 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5038 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5039 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5040 | Counter{cSubDelReqToE2, 2}, |
| 5041 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5042 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5043 | }) |
| 5044 | |
| 5045 | // Req1 |
| 5046 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5047 | |
| 5048 | //Subs Create |
| 5049 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5050 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5051 | |
| 5052 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5053 | |
| 5054 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5055 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5056 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame^] | 5057 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5058 | params.SetSubActionDefinition(actionDefinition) |
| 5059 | |
| 5060 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5061 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5062 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5063 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5064 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5065 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5066 | |
| 5067 | deleteXapp1Subscription(t, &restSubId1) |
| 5068 | deleteXapp2Subscription(t, &restSubId2) |
| 5069 | |
| 5070 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5071 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5072 | |
| 5073 | mainCtrl.VerifyCounterValues(t) |
| 5074 | |
| 5075 | } |
| 5076 | |
| 5077 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5078 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5079 | |
| 5080 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5081 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5082 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5083 | Counter{cSubReqToE2, 2}, |
| 5084 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5085 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5086 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5087 | Counter{cSubDelReqToE2, 2}, |
| 5088 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5089 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5090 | }) |
| 5091 | |
| 5092 | // Req1 |
| 5093 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5094 | |
| 5095 | //Subs Create |
| 5096 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5097 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5098 | |
| 5099 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5100 | |
| 5101 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5102 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5103 | params.SetMeid("RAN_NAME_1") |
| 5104 | params.SetTimeToWait("w200ms") |
| 5105 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5106 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5107 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5108 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5109 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5110 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5111 | |
| 5112 | deleteXapp1Subscription(t, &restSubId1) |
| 5113 | deleteXapp2Subscription(t, &restSubId2) |
| 5114 | |
| 5115 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5116 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5117 | |
| 5118 | mainCtrl.VerifyCounterValues(t) |
| 5119 | |
| 5120 | } |
| 5121 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5122 | //----------------------------------------------------------------------------- |
| 5123 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5124 | // |
| 5125 | // stub stub |
| 5126 | // +-------+ +---------+ +---------+ |
| 5127 | // | xapp | | submgr | | e2term | |
| 5128 | // +-------+ +---------+ +---------+ |
| 5129 | // | | | |
| 5130 | // | RestSubReq | | |
| 5131 | // |---------------->| | |
| 5132 | // | | | |
| 5133 | // | RESTSubResp | | |
| 5134 | // |<----------------| | |
| 5135 | // | | | |
| 5136 | // | | SubReq | |
| 5137 | // | |------------->| |
| 5138 | // | | | |
| 5139 | // | | SubResp | ASN.1 decode fails |
| 5140 | // | |<-------------| |
| 5141 | // | | | |
| 5142 | // | | SubReq | |
| 5143 | // | |------------->| |
| 5144 | // | | | |
| 5145 | // | | SubFail | Duplicated action |
| 5146 | // | |<-------------| |
| 5147 | // | RESTNotif (fail)| | |
| 5148 | // |<----------------| | |
| 5149 | // | | SubDelReq | |
| 5150 | // | |------------->| |
| 5151 | // | | | |
| 5152 | // | | SubDelResp | |
| 5153 | // | |<-------------| |
| 5154 | // |
| 5155 | //----------------------------------------------------------------------------- |
| 5156 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
| 5157 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5158 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5159 | |
| 5160 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5161 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5162 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5163 | |
| 5164 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5165 | // Decode of this response fails which will result resending original request |
| 5166 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5167 | |
| 5168 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5169 | |
| 5170 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5171 | |
| 5172 | // Subscription already created in E2 Node. |
| 5173 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5174 | fparams.Set(crereq) |
| 5175 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5176 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5177 | |
| 5178 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5179 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5180 | |
| 5181 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5182 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5183 | |
| 5184 | // Wait that subs is cleaned |
| 5185 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5186 | |
| 5187 | xappConn1.TestMsgChanEmpty(t) |
| 5188 | e2termConn1.TestMsgChanEmpty(t) |
| 5189 | mainCtrl.wait_registry_empty(t, 10) |
| 5190 | } |
| 5191 | |
| 5192 | //----------------------------------------------------------------------------- |
| 5193 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5194 | // |
| 5195 | // stub stub |
| 5196 | // +-------+ +---------+ +---------+ |
| 5197 | // | xapp | | submgr | | e2term | |
| 5198 | // +-------+ +---------+ +---------+ |
| 5199 | // | | | |
| 5200 | // | RestSubReq | | |
| 5201 | // |---------------->| | |
| 5202 | // | | | |
| 5203 | // | RESTSubResp | | |
| 5204 | // |<----------------| | |
| 5205 | // | | | |
| 5206 | // | | SubReq | |
| 5207 | // | |------------->| |
| 5208 | // | | | |
| 5209 | // | | SubResp | Unknown instanceId |
| 5210 | // | |<-------------| |
| 5211 | // | | | |
| 5212 | // | | SubReq | |
| 5213 | // | |------------->| |
| 5214 | // | | | |
| 5215 | // | | SubFail | Duplicated action |
| 5216 | // | |<-------------| |
| 5217 | // | RESTNotif (fail)| | |
| 5218 | // |<----------------| | |
| 5219 | // | | SubDelReq | |
| 5220 | // | |------------->| |
| 5221 | // | | | |
| 5222 | // | | SubDelResp | |
| 5223 | // | |<-------------| |
| 5224 | // |
| 5225 | //----------------------------------------------------------------------------- |
| 5226 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
| 5227 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5228 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5229 | |
| 5230 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5231 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5232 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5233 | |
| 5234 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5235 | |
| 5236 | // Unknown instanceId in this response which will result resending original request |
| 5237 | orgInstanceId := crereq.RequestId.InstanceId |
| 5238 | crereq.RequestId.InstanceId = 0 |
| 5239 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5240 | |
| 5241 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5242 | |
| 5243 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5244 | |
| 5245 | // Subscription already created in E2 Node. |
| 5246 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5247 | fparams.Set(crereq) |
| 5248 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5249 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5250 | |
| 5251 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5252 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5253 | |
| 5254 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5255 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5256 | |
| 5257 | // Wait that subs is cleaned |
| 5258 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 5259 | |
| 5260 | xappConn1.TestMsgChanEmpty(t) |
| 5261 | e2termConn1.TestMsgChanEmpty(t) |
| 5262 | mainCtrl.wait_registry_empty(t, 10) |
| 5263 | } |
| 5264 | |
| 5265 | //----------------------------------------------------------------------------- |
| 5266 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 5267 | // |
| 5268 | // stub stub |
| 5269 | // +-------+ +---------+ +---------+ |
| 5270 | // | xapp | | submgr | | e2term | |
| 5271 | // +-------+ +---------+ +---------+ |
| 5272 | // | | | |
| 5273 | // | RestSubReq | | |
| 5274 | // |---------------->| | |
| 5275 | // | | | |
| 5276 | // | RESTSubResp | | |
| 5277 | // |<----------------| | |
| 5278 | // | | | |
| 5279 | // | | SubReq | |
| 5280 | // | |------------->| |
| 5281 | // | | | |
| 5282 | // | | SubResp | No transaction for the response |
| 5283 | // | |<-------------| |
| 5284 | // | | | |
| 5285 | // | | SubReq | |
| 5286 | // | |------------->| |
| 5287 | // | | | |
| 5288 | // | | SubFail | Duplicated action |
| 5289 | // | |<-------------| |
| 5290 | // | RESTNotif (fail)| | |
| 5291 | // |<----------------| | |
| 5292 | // | | SubDelReq | |
| 5293 | // | |------------->| |
| 5294 | // | | | |
| 5295 | // | | SubDelResp | |
| 5296 | // | |<-------------| |
| 5297 | // | | | |
| 5298 | // | | SubDelReq | |
| 5299 | // | |------------->| |
| 5300 | // | | | |
| 5301 | // | | SubDelResp | |
| 5302 | // | |<-------------| |
| 5303 | // |
| 5304 | //----------------------------------------------------------------------------- |
| 5305 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
| 5306 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 5307 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5308 | |
| 5309 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5310 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5311 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5312 | |
| 5313 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5314 | |
| 5315 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5316 | // No transaction exist for this response which will result resending original request |
| 5317 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5318 | |
| 5319 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5320 | |
| 5321 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5322 | |
| 5323 | // Subscription already created in E2 Node. |
| 5324 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5325 | fparams.Set(crereq) |
| 5326 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5327 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5328 | |
| 5329 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5330 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5331 | |
| 5332 | // Resending happens because there no transaction |
| 5333 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5334 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5335 | |
| 5336 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5337 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5338 | |
| 5339 | // Wait that subs is cleaned |
| 5340 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5341 | |
| 5342 | xappConn1.TestMsgChanEmpty(t) |
| 5343 | e2termConn1.TestMsgChanEmpty(t) |
| 5344 | mainCtrl.wait_registry_empty(t, 10) |
| 5345 | |
| 5346 | } |
| 5347 | |
| 5348 | //----------------------------------------------------------------------------- |
| 5349 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 5350 | // |
| 5351 | // stub stub |
| 5352 | // +-------+ +---------+ +---------+ |
| 5353 | // | xapp | | submgr | | e2term | |
| 5354 | // +-------+ +---------+ +---------+ |
| 5355 | // | | | |
| 5356 | // | RestSubReq | | |
| 5357 | // |---------------->| | |
| 5358 | // | | | |
| 5359 | // | RESTSubResp | | |
| 5360 | // |<----------------| | |
| 5361 | // | | | |
| 5362 | // | | SubReq | |
| 5363 | // | |------------->| |
| 5364 | // | | | |
| 5365 | // | | SubFail | ASN.1 decode fails |
| 5366 | // | |<-------------| |
| 5367 | // | | | |
| 5368 | // | | SubReq | |
| 5369 | // | |------------->| |
| 5370 | // | | | |
| 5371 | // | | SubFail | Duplicated action |
| 5372 | // | |<-------------| |
| 5373 | // | RESTNotif (fail)| | |
| 5374 | // |<----------------| | |
| 5375 | // | | SubDelReq | |
| 5376 | // | |------------->| |
| 5377 | // | | | |
| 5378 | // | | SubDelResp | |
| 5379 | // | |<-------------| |
| 5380 | // |
| 5381 | //----------------------------------------------------------------------------- |
| 5382 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
| 5383 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 5384 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5385 | |
| 5386 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5387 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5388 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5389 | |
| 5390 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5391 | |
| 5392 | // Decode of this response fails which will result resending original request |
| 5393 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 5394 | |
| 5395 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5396 | |
| 5397 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5398 | |
| 5399 | // Subscription already created in E2 Node. |
| 5400 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5401 | fparams.Set(crereq) |
| 5402 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5403 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5404 | |
| 5405 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5406 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5407 | |
| 5408 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5409 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5410 | |
| 5411 | // Wait that subs is cleaned |
| 5412 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5413 | |
| 5414 | xappConn1.TestMsgChanEmpty(t) |
| 5415 | e2termConn1.TestMsgChanEmpty(t) |
| 5416 | mainCtrl.wait_registry_empty(t, 10) |
| 5417 | } |
| 5418 | |
| 5419 | //----------------------------------------------------------------------------- |
| 5420 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5421 | // |
| 5422 | // stub stub |
| 5423 | // +-------+ +---------+ +---------+ |
| 5424 | // | xapp | | submgr | | e2term | |
| 5425 | // +-------+ +---------+ +---------+ |
| 5426 | // | | | |
| 5427 | // | RestSubReq | | |
| 5428 | // |---------------->| | |
| 5429 | // | | | |
| 5430 | // | RESTSubResp | | |
| 5431 | // |<----------------| | |
| 5432 | // | | | |
| 5433 | // | | SubReq | |
| 5434 | // | |------------->| |
| 5435 | // | | | |
| 5436 | // | | SubFail | Unknown instanceId |
| 5437 | // | |<-------------| |
| 5438 | // | | | |
| 5439 | // | | SubReq | |
| 5440 | // | |------------->| |
| 5441 | // | | | |
| 5442 | // | | SubFail | Duplicated action |
| 5443 | // | |<-------------| |
| 5444 | // | RESTNotif (fail)| | |
| 5445 | // |<----------------| | |
| 5446 | // | | SubDelReq | |
| 5447 | // | |------------->| |
| 5448 | // | | | |
| 5449 | // | | SubDelResp | |
| 5450 | // | |<-------------| |
| 5451 | // |
| 5452 | //----------------------------------------------------------------------------- |
| 5453 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
| 5454 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 5455 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5456 | |
| 5457 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5458 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5459 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5460 | |
| 5461 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5462 | |
| 5463 | // Unknown instanceId in this response which will result resending original request |
| 5464 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5465 | fparams.Set(crereq) |
| 5466 | fparams.Fail.RequestId.InstanceId = 0 |
| 5467 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5468 | |
| 5469 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5470 | |
| 5471 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5472 | |
| 5473 | // Subscription already created in E2 Node. |
| 5474 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5475 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5476 | |
| 5477 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5478 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5479 | |
| 5480 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5481 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5482 | |
| 5483 | // Wait that subs is cleaned |
| 5484 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5485 | |
| 5486 | xappConn1.TestMsgChanEmpty(t) |
| 5487 | e2termConn1.TestMsgChanEmpty(t) |
| 5488 | mainCtrl.wait_registry_empty(t, 10) |
| 5489 | } |
| 5490 | |
| 5491 | //----------------------------------------------------------------------------- |
| 5492 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 5493 | // |
| 5494 | // stub stub |
| 5495 | // +-------+ +---------+ +---------+ |
| 5496 | // | xapp | | submgr | | e2term | |
| 5497 | // +-------+ +---------+ +---------+ |
| 5498 | // | | | |
| 5499 | // | RestSubReq | | |
| 5500 | // |---------------->| | |
| 5501 | // | | | |
| 5502 | // | RESTSubResp | | |
| 5503 | // |<----------------| | |
| 5504 | // | | | |
| 5505 | // | | SubReq | |
| 5506 | // | |------------->| |
| 5507 | // | | | |
| 5508 | // | | SubFail | No transaction for the response |
| 5509 | // | |<-------------| |
| 5510 | // | | | |
| 5511 | // | | SubReq | |
| 5512 | // | |------------->| |
| 5513 | // | | | |
| 5514 | // | | SubFail | Duplicated action |
| 5515 | // | |<-------------| |
| 5516 | // | RESTNotif (fail)| | |
| 5517 | // |<----------------| | |
| 5518 | // | | SubDelReq | |
| 5519 | // | |------------->| |
| 5520 | // | | | |
| 5521 | // | | SubDelResp | |
| 5522 | // | |<-------------| |
| 5523 | // |
| 5524 | //----------------------------------------------------------------------------- |
| 5525 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
| 5526 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 5527 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5528 | |
| 5529 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5530 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5531 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5532 | |
| 5533 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5534 | |
| 5535 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5536 | |
| 5537 | // No transaction exist for this response which will result resending original request |
| 5538 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5539 | fparams.Set(crereq) |
| 5540 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5541 | |
| 5542 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5543 | |
| 5544 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5545 | |
| 5546 | // Subscription already created in E2 Node. |
| 5547 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5548 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5549 | |
| 5550 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5551 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5552 | |
| 5553 | // Resending happens because there no transaction |
| 5554 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5555 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5556 | |
| 5557 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5558 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5559 | |
| 5560 | // Wait that subs is cleaned |
| 5561 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5562 | |
| 5563 | xappConn1.TestMsgChanEmpty(t) |
| 5564 | e2termConn1.TestMsgChanEmpty(t) |
| 5565 | mainCtrl.wait_registry_empty(t, 10) |
| 5566 | } |
| 5567 | |
| 5568 | //----------------------------------------------------------------------------- |
| 5569 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 5570 | // |
| 5571 | // stub stub |
| 5572 | // +-------+ +---------+ +---------+ |
| 5573 | // | xapp | | submgr | | e2term | |
| 5574 | // +-------+ +---------+ +---------+ |
| 5575 | // | | | |
| 5576 | // | [SUBS CREATE] | |
| 5577 | // | | | |
| 5578 | // | | | |
| 5579 | // | RESTSubDelReq | | |
| 5580 | // |---------------->| | |
| 5581 | // | | | |
| 5582 | // | RESTSubDelResp | | |
| 5583 | // |<----------------| | |
| 5584 | // | | | |
| 5585 | // | | SubDelReq | |
| 5586 | // | |------------->| |
| 5587 | // | | | |
| 5588 | // | | SubDelResp | ASN.1 decode fails |
| 5589 | // | |<-------------| |
| 5590 | // | | | |
| 5591 | // | | SubDelReq | |
| 5592 | // | |------------->| |
| 5593 | // | | | |
| 5594 | // | | SubDelFail | Subscription does exist any more |
| 5595 | // | |<-------------| |
| 5596 | // | | | |
| 5597 | // |
| 5598 | //----------------------------------------------------------------------------- |
| 5599 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
| 5600 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
| 5601 | |
| 5602 | // Req |
| 5603 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5604 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5605 | |
| 5606 | // Del |
| 5607 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5608 | |
| 5609 | // E2t: Receive 1st SubsDelReq |
| 5610 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5611 | |
| 5612 | // Decode of this response fails which will result resending original request |
| 5613 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 5614 | |
| 5615 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5616 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5617 | |
| 5618 | // Subscription does not exist in in E2 Node. |
| 5619 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5620 | |
| 5621 | // Wait that subs is cleaned |
| 5622 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5623 | |
| 5624 | xappConn1.TestMsgChanEmpty(t) |
| 5625 | e2termConn1.TestMsgChanEmpty(t) |
| 5626 | mainCtrl.wait_registry_empty(t, 10) |
| 5627 | } |
| 5628 | |
| 5629 | //----------------------------------------------------------------------------- |
| 5630 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 5631 | // |
| 5632 | // stub stub |
| 5633 | // +-------+ +---------+ +---------+ |
| 5634 | // | xapp | | submgr | | e2term | |
| 5635 | // +-------+ +---------+ +---------+ |
| 5636 | // | | | |
| 5637 | // | [SUBS CREATE] | |
| 5638 | // | | | |
| 5639 | // | | | |
| 5640 | // | RESTSubDelReq | | |
| 5641 | // |---------------->| | |
| 5642 | // | | | |
| 5643 | // | RESTSubDelResp | | |
| 5644 | // |<----------------| | |
| 5645 | // | | | |
| 5646 | // | | SubDelReq | |
| 5647 | // | |------------->| |
| 5648 | // | | | |
| 5649 | // | | SubDelResp | Unknown instanceId |
| 5650 | // | |<-------------| |
| 5651 | // | | | |
| 5652 | // | | SubDelReq | |
| 5653 | // | |------------->| |
| 5654 | // | | | |
| 5655 | // | | SubDelFail | Subscription does exist any more |
| 5656 | // | |<-------------| |
| 5657 | // |
| 5658 | //----------------------------------------------------------------------------- |
| 5659 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
| 5660 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
| 5661 | |
| 5662 | // Req |
| 5663 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5664 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5665 | |
| 5666 | // Del |
| 5667 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5668 | |
| 5669 | // E2t: Receive 1st SubsDelReq |
| 5670 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5671 | |
| 5672 | // Unknown instanceId in this response which will result resending original request |
| 5673 | delreq.RequestId.InstanceId = 0 |
| 5674 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5675 | |
| 5676 | // E2t: Receive 2nd SubsDelReq |
| 5677 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5678 | |
| 5679 | // Subscription does not exist in in E2 Node. |
| 5680 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5681 | |
| 5682 | // Wait that subs is cleaned |
| 5683 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5684 | |
| 5685 | xappConn1.TestMsgChanEmpty(t) |
| 5686 | e2termConn1.TestMsgChanEmpty(t) |
| 5687 | mainCtrl.wait_registry_empty(t, 10) |
| 5688 | } |
| 5689 | |
| 5690 | //----------------------------------------------------------------------------- |
| 5691 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 5692 | // |
| 5693 | // stub stub |
| 5694 | // +-------+ +---------+ +---------+ |
| 5695 | // | xapp | | submgr | | e2term | |
| 5696 | // +-------+ +---------+ +---------+ |
| 5697 | // | | | |
| 5698 | // | [SUBS CREATE] | |
| 5699 | // | | | |
| 5700 | // | | | |
| 5701 | // | RESTSubDelReq | | |
| 5702 | // |---------------->| | |
| 5703 | // | | | |
| 5704 | // | RESTSubDelResp | | |
| 5705 | // |<----------------| | |
| 5706 | // | | | |
| 5707 | // | | SubDelReq | |
| 5708 | // | |------------->| |
| 5709 | // | | | |
| 5710 | // | | SubDelResp | No transaction for the response |
| 5711 | // | |<-------------| |
| 5712 | // | | | |
| 5713 | // | | SubDelReq | |
| 5714 | // | |------------->| |
| 5715 | // | | | |
| 5716 | // | | SubDelFail | Subscription does exist any more |
| 5717 | // | |<-------------| |
| 5718 | // |
| 5719 | //----------------------------------------------------------------------------- |
| 5720 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
| 5721 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
| 5722 | |
| 5723 | // Req |
| 5724 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5725 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5726 | |
| 5727 | // Del |
| 5728 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5729 | |
| 5730 | // E2t: Receive 1st SubsDelReq |
| 5731 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5732 | |
| 5733 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5734 | |
| 5735 | // No transaction exist for this response which will result resending original request |
| 5736 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5737 | |
| 5738 | // E2t: Receive 2nd SubsDelReq |
| 5739 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5740 | |
| 5741 | // Subscription does not exist in in E2 Node. |
| 5742 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5743 | |
| 5744 | // Wait that subs is cleaned |
| 5745 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5746 | |
| 5747 | xappConn1.TestMsgChanEmpty(t) |
| 5748 | e2termConn1.TestMsgChanEmpty(t) |
| 5749 | mainCtrl.wait_registry_empty(t, 10) |
| 5750 | } |
| 5751 | |
| 5752 | //----------------------------------------------------------------------------- |
| 5753 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 5754 | // |
| 5755 | // stub stub |
| 5756 | // +-------+ +---------+ +---------+ |
| 5757 | // | xapp | | submgr | | e2term | |
| 5758 | // +-------+ +---------+ +---------+ |
| 5759 | // | | | |
| 5760 | // | [SUBS CREATE] | |
| 5761 | // | | | |
| 5762 | // | | | |
| 5763 | // | RESTSubDelReq | | |
| 5764 | // |---------------->| | |
| 5765 | // | | | |
| 5766 | // | RESTSubDelResp | | |
| 5767 | // |<----------------| | |
| 5768 | // | | | |
| 5769 | // | | SubDelReq | |
| 5770 | // | |------------->| |
| 5771 | // | | | |
| 5772 | // | | SubDelFail | ASN.1 decode fails |
| 5773 | // | |<-------------| |
| 5774 | // | | | |
| 5775 | // | | SubDelReq | |
| 5776 | // | |------------->| |
| 5777 | // | | | |
| 5778 | // | | SubDelFail | Subscription does exist any more |
| 5779 | // | |<-------------| |
| 5780 | // |
| 5781 | //----------------------------------------------------------------------------- |
| 5782 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
| 5783 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
| 5784 | |
| 5785 | // Req |
| 5786 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5787 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5788 | |
| 5789 | // Del |
| 5790 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5791 | |
| 5792 | // E2t: Receive 1st SubsDelReq |
| 5793 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5794 | |
| 5795 | // Decode of this response fails which will result resending original request |
| 5796 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 5797 | |
| 5798 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 5799 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5800 | |
| 5801 | // Subscription does not exist in in E2 Node. |
| 5802 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5803 | |
| 5804 | // Wait that subs is cleaned |
| 5805 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5806 | |
| 5807 | xappConn1.TestMsgChanEmpty(t) |
| 5808 | e2termConn1.TestMsgChanEmpty(t) |
| 5809 | mainCtrl.wait_registry_empty(t, 10) |
| 5810 | } |
| 5811 | |
| 5812 | //----------------------------------------------------------------------------- |
| 5813 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 5814 | // |
| 5815 | // stub stub |
| 5816 | // +-------+ +---------+ +---------+ |
| 5817 | // | xapp | | submgr | | e2term | |
| 5818 | // +-------+ +---------+ +---------+ |
| 5819 | // | | | |
| 5820 | // | [SUBS CREATE] | |
| 5821 | // | | | |
| 5822 | // | | | |
| 5823 | // | RESTSubDelReq | | |
| 5824 | // |---------------->| | |
| 5825 | // | | | |
| 5826 | // | RESTSubDelResp | | |
| 5827 | // |<----------------| | |
| 5828 | // | | | |
| 5829 | // | | SubDelReq | |
| 5830 | // | |------------->| |
| 5831 | // | | | |
| 5832 | // | | SubDelFail | Unknown instanceId |
| 5833 | // | |<-------------| |
| 5834 | // | | | |
| 5835 | // | | SubDelReq | |
| 5836 | // | |------------->| |
| 5837 | // | | | |
| 5838 | // | | SubDelFail | Subscription does exist any more |
| 5839 | // | |<-------------| |
| 5840 | // |
| 5841 | //----------------------------------------------------------------------------- |
| 5842 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
| 5843 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
| 5844 | |
| 5845 | // Req |
| 5846 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5847 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5848 | |
| 5849 | // Del |
| 5850 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5851 | |
| 5852 | // E2t: Receive 1st SubsDelReq |
| 5853 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5854 | |
| 5855 | // Unknown instanceId in this response which will result resending original request |
| 5856 | delreq.RequestId.InstanceId = 0 |
| 5857 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5858 | |
| 5859 | // E2t: Receive 2nd SubsDelReq |
| 5860 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5861 | |
| 5862 | // Subscription does not exist in in E2 Node. |
| 5863 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5864 | |
| 5865 | // Wait that subs is cleaned |
| 5866 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5867 | |
| 5868 | xappConn1.TestMsgChanEmpty(t) |
| 5869 | e2termConn1.TestMsgChanEmpty(t) |
| 5870 | mainCtrl.wait_registry_empty(t, 10) |
| 5871 | } |
| 5872 | |
| 5873 | //----------------------------------------------------------------------------- |
| 5874 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 5875 | // |
| 5876 | // stub stub |
| 5877 | // +-------+ +---------+ +---------+ |
| 5878 | // | xapp | | submgr | | e2term | |
| 5879 | // +-------+ +---------+ +---------+ |
| 5880 | // | | | |
| 5881 | // | [SUBS CREATE] | |
| 5882 | // | | | |
| 5883 | // | | | |
| 5884 | // | RESTSubDelReq | | |
| 5885 | // |---------------->| | |
| 5886 | // | | | |
| 5887 | // | RESTSubDelResp | | |
| 5888 | // |<----------------| | |
| 5889 | // | | | |
| 5890 | // | | SubDelReq | |
| 5891 | // | |------------->| |
| 5892 | // | | | |
| 5893 | // | | SubDelFail | No transaction for the response |
| 5894 | // | |<-------------| |
| 5895 | // | | | |
| 5896 | // | | SubDelReq | |
| 5897 | // | |------------->| |
| 5898 | // | | | |
| 5899 | // | | SubDelFail | Subscription does exist any more |
| 5900 | // | |<-------------| |
| 5901 | // |
| 5902 | //----------------------------------------------------------------------------- |
| 5903 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
| 5904 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
| 5905 | |
| 5906 | // Req |
| 5907 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5908 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 5909 | |
| 5910 | // Del |
| 5911 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5912 | |
| 5913 | // E2t: Receive 1st SubsDelReq |
| 5914 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5915 | |
| 5916 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 5917 | |
| 5918 | // No transaction exist for this response which will result resending original request |
| 5919 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5920 | |
| 5921 | // E2t: Receive 2nd SubsDelReq |
| 5922 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5923 | |
| 5924 | // Subscription does not exist in in E2 Node. |
| 5925 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5926 | |
| 5927 | // Wait that subs is cleaned |
| 5928 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 5929 | |
| 5930 | xappConn1.TestMsgChanEmpty(t) |
| 5931 | e2termConn1.TestMsgChanEmpty(t) |
| 5932 | mainCtrl.wait_registry_empty(t, 10) |
| 5933 | } |
| 5934 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5935 | //----------------------------------------------------------------------------- |
| 5936 | // TestRESTSubReqFailAsn1PackSubReqError |
| 5937 | // |
| 5938 | // stub stub |
| 5939 | // +-------+ +---------+ +---------+ |
| 5940 | // | xapp | | submgr | | e2term | |
| 5941 | // +-------+ +---------+ +---------+ |
| 5942 | // | | | |
| 5943 | // | RESTSubReq | | |
| 5944 | // |---------------->| | |
| 5945 | // | | | |
| 5946 | // | RESTSubResp | | |
| 5947 | // |<----------------| | |
| 5948 | // | | | |
| 5949 | // | ASN.1 encode fails | |
| 5950 | // | | | |
| 5951 | // | | SubDelReq | |
| 5952 | // | |------------->| |
| 5953 | // | | | |
| 5954 | // | | SubDelFail | |
| 5955 | // | |<-------------| |
| 5956 | // | | | |
| 5957 | // | RESTNotif | | |
| 5958 | // | unsuccess | | |
| 5959 | // |<----------------| | |
| 5960 | // | | | |
| 5961 | // | [SUBS DELETE] | |
| 5962 | // | | | |
| 5963 | // |
| 5964 | //----------------------------------------------------------------------------- |
| 5965 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 5966 | |
| 5967 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5968 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5969 | Counter{cRestSubRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5970 | Counter{cSubDelReqToE2, 1}, |
| 5971 | Counter{cSubDelFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5972 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5973 | }) |
| 5974 | |
| 5975 | subReqCount := 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5976 | |
| 5977 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5978 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 5979 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 5980 | |
| 5981 | // Req |
| 5982 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5983 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 5984 | |
| 5985 | // E2t: Receive SubsDelReq |
| 5986 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5987 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5988 | |
| 5989 | // Subscription does not exist in in E2 Node. |
| 5990 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 5991 | |
| 5992 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5993 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 5994 | |
| 5995 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 5996 | // Wait that subs is cleaned |
| 5997 | waitSubsCleanup(t, e2SubsId, 10) |
| 5998 | mainCtrl.VerifyCounterValues(t) |
| 5999 | } |
| 6000 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6001 | //////////////////////////////////////////////////////////////////////////////////// |
| 6002 | // Services for UT cases |
| 6003 | //////////////////////////////////////////////////////////////////////////////////// |
| 6004 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6005 | const host string = "localhost" |
| 6006 | |
| 6007 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6008 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6009 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6010 | } |
| 6011 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 6012 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 6013 | |
| 6014 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 6015 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6016 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 6017 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6018 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6019 | |
| 6020 | return restSubId, e2SubsId |
| 6021 | } |
| 6022 | |
| 6023 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 6024 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6025 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6026 | if meid != "" { |
| 6027 | params.SetMeid(meid) |
| 6028 | } |
| 6029 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 6030 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 6031 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 6032 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 6033 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 6034 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6035 | |
| 6036 | return restSubId, e2SubsId |
| 6037 | } |
| 6038 | |
| 6039 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6040 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6041 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6042 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 6043 | |
| 6044 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6045 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6046 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6047 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6048 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6049 | |
| 6050 | return restSubId, e2SubsId |
| 6051 | } |
| 6052 | |
| 6053 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6054 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6055 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6056 | |
| 6057 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6058 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 6059 | fparams1.Set(crereq1) |
| 6060 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 6061 | |
| 6062 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 6063 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6064 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 6065 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6066 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 6067 | |
| 6068 | return restSubId, e2SubsId |
| 6069 | } |
| 6070 | |
| 6071 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 6072 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 6073 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6074 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6075 | } |
| 6076 | |
| 6077 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 6078 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 6079 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6080 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6081 | } |
| 6082 | |
| 6083 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 6084 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 6085 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6086 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6087 | } |
| 6088 | |
| 6089 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 6090 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6091 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 6092 | assert.Equal(t, resp[0].Meid, meid) |
| 6093 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 6094 | } |
| 6095 | |
| 6096 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 6097 | //Wait that subs is cleaned |
| 6098 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 6099 | |
| 6100 | xappConn1.TestMsgChanEmpty(t) |
| 6101 | xappConn2.TestMsgChanEmpty(t) |
| 6102 | e2termConn1.TestMsgChanEmpty(t) |
| 6103 | mainCtrl.wait_registry_empty(t, timeout) |
| 6104 | } |
| 6105 | |
| 6106 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 6107 | |
| 6108 | var e2SubsId []uint32 |
| 6109 | |
| 6110 | for i := 0; i < count; i++ { |
| 6111 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 6112 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 6113 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6114 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 6115 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6116 | e2SubsId = append(e2SubsId, instanceId) |
| 6117 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 6118 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 6119 | <-time.After(100 * time.Millisecond) |
| 6120 | } |
| 6121 | return e2SubsId |
| 6122 | } |
| 6123 | |
| 6124 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 6125 | |
| 6126 | for i := 0; i < len(e2SubsIds); i++ { |
| 6127 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 6128 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6129 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6130 | <-time.After(1 * time.Second) |
| 6131 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 6132 | <-time.After(100 * time.Millisecond) |
| 6133 | } |
| 6134 | |
| 6135 | // Wait that subs is cleaned |
| 6136 | for i := 0; i < len(e2SubsIds); i++ { |
| 6137 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 6138 | } |
| 6139 | |
| 6140 | } |