Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 23 | "strings" |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 24 | "testing" |
| 25 | "time" |
| 26 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap_wrapper" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 29 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 30 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 31 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 32 | ) |
| 33 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 34 | func TestSuiteSetup(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 35 | // The effect of this call shall endure thgough the UT suite! |
| 36 | // If this causes any issues, the previout interface can be restored |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 37 | // like this:git log |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 38 | // SetPackerIf(e2ap_wrapper.NewAsn1E2APPacker()) |
| 39 | |
| 40 | SetPackerIf(e2ap_wrapper.NewUtAsn1E2APPacker()) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 41 | |
| 42 | restDuplicateCtrl.Init() |
| 43 | |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | //----------------------------------------------------------------------------- |
| 47 | // TestRESTSubReqAndDeleteOkWithE2apUtWrapper |
| 48 | // |
| 49 | // stub stub stub |
| 50 | // +-------+ +---------+ +---------+ +---------+ |
| 51 | // | xapp | | submgr | | e2term | | rtmgr | |
| 52 | // +-------+ +---------+ +---------+ +---------+ |
| 53 | // | | | | |
| 54 | // | RESTSubReq | | | |
| 55 | // |---------------->| | | |
| 56 | // | | RouteCreate | | |
| 57 | // | |--------------------------->| // The order of these events may vary |
| 58 | // | | | | |
| 59 | // | RESTSubResp | | | // The order of these events may vary |
| 60 | // |<----------------| | | |
| 61 | // | | RouteResponse| | |
| 62 | // | |<---------------------------| // The order of these events may vary |
| 63 | // | | | | |
| 64 | // | | SubReq | | |
| 65 | // | |------------->| | // The order of these events may vary |
| 66 | // | | | | |
| 67 | // | | SubResp | | |
| 68 | // | |<-------------| | |
| 69 | // | RESTNotif1 | | | |
| 70 | // |<----------------| | | |
| 71 | // | | | | |
| 72 | // | RESTSubDelReq | | | |
| 73 | // |---------------->| | | |
| 74 | // | | SubDelReq | | |
| 75 | // | |------------->| | |
| 76 | // | | | | |
| 77 | // | RESTSubDelResp| | | |
| 78 | // |<----------------| | | |
| 79 | // | | | | |
| 80 | // | | SubDelResp | | |
| 81 | // | |<-------------| | |
| 82 | // | | | | |
| 83 | // | | | | |
| 84 | // |
| 85 | //----------------------------------------------------------------------------- |
| 86 | func TestRESTSubReqAndDeleteOkWithE2apUtWrapper(t *testing.T) { |
Markku Virtanen | fa39fed | 2021-05-25 08:18:43 +0000 | [diff] [blame] | 87 | |
| 88 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 89 | |
| 90 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 91 | |
| 92 | waitSubsCleanup(t, e2SubsId, 10) |
| 93 | } |
| 94 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 95 | //----------------------------------------------------------------------------- |
Markku Virtanen | ac8bde4 | 2021-05-25 09:54:42 +0000 | [diff] [blame] | 96 | // TestRESTSubReqAndE1apDeleteReqPackingError |
| 97 | // |
| 98 | // stub stub stub |
| 99 | // +-------+ +---------+ +---------+ +---------+ |
| 100 | // | xapp | | submgr | | e2term | | rtmgr | |
| 101 | // +-------+ +---------+ +---------+ +---------+ |
| 102 | // | | | | |
| 103 | // | RESTSubReq | | | |
| 104 | // |---------------->| | | |
| 105 | // | | RouteCreate | | |
| 106 | // | |--------------------------->| // The order of these events may vary |
| 107 | // | | | | |
| 108 | // | RESTSubResp | | | // The order of these events may vary |
| 109 | // |<----------------| | | |
| 110 | // | | RouteResponse| | |
| 111 | // | |<---------------------------| // The order of these events may vary |
| 112 | // | | | | |
| 113 | // | | SubReq | | |
| 114 | // | |------------->| | // The order of these events may vary |
| 115 | // | | | | |
| 116 | // | | SubResp | | |
| 117 | // | |<-------------| | |
| 118 | // | RESTNotif1 | | | |
| 119 | // |<----------------| | | |
| 120 | // | | | | |
| 121 | // | RESTSubDelReq | | | |
| 122 | // |---------------->| | | |
| 123 | // | | | | |
| 124 | // | RESTSubDelResp| | | |
| 125 | // |<----------------| | | |
| 126 | // | | | | |
| 127 | // | | | | |
| 128 | // |
| 129 | //----------------------------------------------------------------------------- |
| 130 | func TestRESTSubReqAndE1apDeleteReqPackingError(t *testing.T) { |
| 131 | |
| 132 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 133 | |
| 134 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, false) |
| 135 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 136 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_REQ, true) |
| 137 | |
| 138 | waitSubsCleanup(t, e2SubsId, 10) |
| 139 | } |
| 140 | |
| 141 | //----------------------------------------------------------------------------- |
| 142 | // TestRESTSubReqAndE1apDeleteRespUnpackingError |
| 143 | // |
| 144 | // stub stub stub |
| 145 | // +-------+ +---------+ +---------+ +---------+ |
| 146 | // | xapp | | submgr | | e2term | | rtmgr | |
| 147 | // +-------+ +---------+ +---------+ +---------+ |
| 148 | // | | | | |
| 149 | // | RESTSubReq | | | |
| 150 | // |---------------->| | | |
| 151 | // | | RouteCreate | | |
| 152 | // | |--------------------------->| // The order of these events may vary |
| 153 | // | | | | |
| 154 | // | RESTSubResp | | | // The order of these events may vary |
| 155 | // |<----------------| | | |
| 156 | // | | RouteResponse| | |
| 157 | // | |<---------------------------| // The order of these events may vary |
| 158 | // | | | | |
| 159 | // | | SubReq | | |
| 160 | // | |------------->| | // The order of these events may vary |
| 161 | // | | | | |
| 162 | // | | SubResp | | |
| 163 | // | |<-------------| | |
| 164 | // | RESTNotif1 | | | |
| 165 | // |<----------------| | | |
| 166 | // | | | | |
| 167 | // | RESTSubDelReq | | | |
| 168 | // |---------------->| | | |
| 169 | // | | SubDelReq | | |
| 170 | // | |------------->| | |
| 171 | // | | | | |
| 172 | // | RESTSubDelResp| | | |
| 173 | // |<----------------| | | // The order of these events may vary |
| 174 | // | | | | |
| 175 | // | | SubDelResp | | |
| 176 | // | |<-------------| | // 1.st NOK |
| 177 | // | | | | |
| 178 | // | | SubDelReq | | |
| 179 | // | |------------->| | |
| 180 | // | | | | |
| 181 | // | | SubDelResp | | |
| 182 | // | |<-------------| | // 2.nd NOK |
| 183 | // |
| 184 | //----------------------------------------------------------------------------- |
| 185 | |
| 186 | func TestRESTSubReqAndE1apDeleteRespUnpackingError(t *testing.T) { |
| 187 | |
| 188 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, nil) |
| 189 | |
| 190 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 191 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, false) |
| 192 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 193 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 194 | |
| 195 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 196 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 197 | |
| 198 | defer e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_DEL_RESP, true) |
| 199 | |
| 200 | waitSubsCleanup(t, e2SubsId, 10) |
| 201 | } |
| 202 | |
| 203 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 204 | // TestSubReqAndRouteNok |
| 205 | // |
| 206 | // stub stub |
| 207 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 208 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 209 | // +-------+ +---------+ +---------+ |
| 210 | // | | | |
| 211 | // | SubReq | | |
| 212 | // |------------->| | |
| 213 | // | | | |
| 214 | // | | RouteCreate | |
| 215 | // | |------------->| |
| 216 | // | | | |
| 217 | // | | RouteCreate | |
| 218 | // | | status:400 | |
| 219 | // | |<-------------| |
| 220 | // | | | |
| 221 | // | [SUBS INT DELETE] | |
| 222 | // | | | |
| 223 | // |
| 224 | //----------------------------------------------------------------------------- |
| 225 | |
| 226 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 227 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 228 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 229 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 230 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 231 | Counter{cSubReqFromXapp, 1}, |
| 232 | Counter{cRouteCreateFail, 1}, |
| 233 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 234 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 235 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 236 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 237 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 238 | waiter.WaitResult(t) |
| 239 | |
| 240 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 241 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 242 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 243 | xappConn1.TestMsgChanEmpty(t) |
| 244 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 245 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 246 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 247 | |
| 248 | <-time.After(1 * time.Second) |
| 249 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 253 | // TestSubReqAndRouteUpdateNok |
| 254 | |
| 255 | // stub stub |
| 256 | // +-------+ +-------+ +---------+ +---------+ |
| 257 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 258 | // +-------+ +-------+ +---------+ +---------+ |
| 259 | // | | | | |
| 260 | // | [SUBS CREATE] | | |
| 261 | // | | | | |
| 262 | // | | | | |
| 263 | // | | | | |
| 264 | // | SubReq (mergeable) | | |
| 265 | // |--------------------------->| | | |
| 266 | // | | | | |
| 267 | // | | | RouteUpdate | |
| 268 | // | | |------------->| |
| 269 | // | | | | |
| 270 | // | | | RouteUpdate | |
| 271 | // | | | status:400 | |
| 272 | // | | |<-------------| |
| 273 | // | | | | |
| 274 | // | [SUBS INT DELETE] | | |
| 275 | // | | | | |
| 276 | // | | | | |
| 277 | // | [SUBS DELETE] | | |
| 278 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 279 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 280 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 281 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 282 | |
| 283 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 285 | Counter{cSubReqFromXapp, 2}, |
| 286 | Counter{cSubReqToE2, 1}, |
| 287 | Counter{cSubRespFromE2, 1}, |
| 288 | Counter{cSubRespToXapp, 1}, |
| 289 | Counter{cRouteCreateUpdateFail, 1}, |
| 290 | Counter{cSubDelReqFromXapp, 1}, |
| 291 | Counter{cSubDelReqToE2, 1}, |
| 292 | Counter{cSubDelRespFromE2, 1}, |
| 293 | Counter{cSubDelRespToXapp, 1}, |
| 294 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 295 | |
| 296 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 297 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 298 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 299 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 300 | |
| 301 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 302 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 303 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 304 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 305 | |
| 306 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 307 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 308 | xappConn2.SendSubsReq(t, nil, nil) |
| 309 | waiter.WaitResult(t) |
| 310 | |
| 311 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 312 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 313 | |
| 314 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 315 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 316 | |
| 317 | //Wait that subs is cleaned |
| 318 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 319 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 320 | |
| 321 | xappConn1.TestMsgChanEmpty(t) |
| 322 | xappConn2.TestMsgChanEmpty(t) |
| 323 | e2termConn1.TestMsgChanEmpty(t) |
| 324 | mainCtrl.wait_registry_empty(t, 10) |
| 325 | |
| 326 | mainCtrl.VerifyCounterValues(t) |
| 327 | } |
| 328 | |
| 329 | //----------------------------------------------------------------------------- |
| 330 | // TestSubDelReqAndRouteDeleteNok |
| 331 | // |
| 332 | // stub stub |
| 333 | // +-------+ +---------+ +---------+ +---------+ |
| 334 | // | xapp | | submgr | | e2term | | rtmgr | |
| 335 | // +-------+ +---------+ +---------+ +---------+ |
| 336 | // | | | | |
| 337 | // | [SUBS CREATE] | | |
| 338 | // | | | | |
| 339 | // | | | | |
| 340 | // | | | | |
| 341 | // | SubDelReq | | | |
| 342 | // |------------->| | | |
| 343 | // | | SubDelReq | | |
| 344 | // | |------------->| | |
| 345 | // | | SubDelRsp | | |
| 346 | // | |<-------------| | |
| 347 | // | SubDelRsp | | | |
| 348 | // |<-------------| | | |
| 349 | // | | RouteDelete | | |
| 350 | // | |---------------------------->| |
| 351 | // | | | | |
| 352 | // | | RouteDelete | | |
| 353 | // | | status:400 | | |
| 354 | // | |<----------------------------| |
| 355 | // | | | | |
| 356 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 357 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 358 | |
| 359 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 360 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 361 | Counter{cSubReqFromXapp, 1}, |
| 362 | Counter{cSubReqToE2, 1}, |
| 363 | Counter{cSubRespFromE2, 1}, |
| 364 | Counter{cSubRespToXapp, 1}, |
| 365 | Counter{cSubDelReqFromXapp, 1}, |
| 366 | Counter{cRouteDeleteFail, 1}, |
| 367 | Counter{cSubDelReqToE2, 1}, |
| 368 | Counter{cSubDelRespFromE2, 1}, |
| 369 | Counter{cSubDelRespToXapp, 1}, |
| 370 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 371 | |
| 372 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 373 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 374 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 375 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 376 | |
| 377 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 378 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 379 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 380 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 381 | |
| 382 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 383 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 384 | |
| 385 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 386 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 387 | waiter.WaitResult(t) |
| 388 | |
| 389 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 390 | |
| 391 | //Wait that subs is cleaned |
| 392 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 393 | |
| 394 | xappConn1.TestMsgChanEmpty(t) |
| 395 | xappConn2.TestMsgChanEmpty(t) |
| 396 | e2termConn1.TestMsgChanEmpty(t) |
| 397 | mainCtrl.wait_registry_empty(t, 10) |
| 398 | |
| 399 | mainCtrl.VerifyCounterValues(t) |
| 400 | } |
| 401 | |
| 402 | //----------------------------------------------------------------------------- |
| 403 | // TestSubMergeDelAndRouteUpdateNok |
| 404 | // stub stub |
| 405 | // +-------+ +-------+ +---------+ +---------+ |
| 406 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 407 | // +-------+ +-------+ +---------+ +---------+ |
| 408 | // | | | | |
| 409 | // | | | | |
| 410 | // | | | | |
| 411 | // | | SubReq1 | | |
| 412 | // | |------------->| | |
| 413 | // | | | | |
| 414 | // | | | SubReq1 | |
| 415 | // | | |------------->| |
| 416 | // | | | SubResp1 | |
| 417 | // | | |<-------------| |
| 418 | // | | SubResp1 | | |
| 419 | // | |<-------------| | |
| 420 | // | | | | |
| 421 | // | SubReq2 | | |
| 422 | // |--------------------------->| | |
| 423 | // | | | | |
| 424 | // | SubResp2 | | |
| 425 | // |<---------------------------| | |
| 426 | // | | | | |
| 427 | // | | SubDelReq 1 | | |
| 428 | // | |------------->| | |
| 429 | // | | | RouteUpdate | |
| 430 | // | | |-----> rtmgr | |
| 431 | // | | | | |
| 432 | // | | | RouteUpdate | |
| 433 | // | | | status:400 | |
| 434 | // | | |<----- rtmgr | |
| 435 | // | | | | |
| 436 | // | | SubDelResp 1 | | |
| 437 | // | |<-------------| | |
| 438 | // | | | | |
| 439 | // | SubDelReq 2 | | |
| 440 | // |--------------------------->| | |
| 441 | // | | | | |
| 442 | // | | | SubDelReq 2 | |
| 443 | // | | |------------->| |
| 444 | // | | | | |
| 445 | // | | | SubDelReq 2 | |
| 446 | // | | |------------->| |
| 447 | // | | | | |
| 448 | // | SubDelResp 2 | | |
| 449 | // |<---------------------------| | |
| 450 | // |
| 451 | //----------------------------------------------------------------------------- |
| 452 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 453 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 454 | |
| 455 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 456 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 457 | Counter{cSubReqFromXapp, 2}, |
| 458 | Counter{cSubReqToE2, 1}, |
| 459 | Counter{cSubRespFromE2, 1}, |
| 460 | Counter{cSubRespToXapp, 2}, |
| 461 | Counter{cSubDelReqFromXapp, 2}, |
| 462 | Counter{cRouteDeleteUpdateFail, 1}, |
| 463 | Counter{cSubDelReqToE2, 1}, |
| 464 | Counter{cSubDelRespFromE2, 1}, |
| 465 | Counter{cSubDelRespToXapp, 2}, |
| 466 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 467 | |
| 468 | //Req1 |
| 469 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 470 | rparams1.Init() |
| 471 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 472 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 473 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 474 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 475 | |
| 476 | //Req2 |
| 477 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 478 | rparams2.Init() |
| 479 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 480 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 481 | |
| 482 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 483 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 484 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 485 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 486 | |
| 487 | //Del1 |
| 488 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 489 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 490 | waiter.WaitResult(t) |
| 491 | |
| 492 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 493 | |
| 494 | //Del2 |
| 495 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 496 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 497 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 498 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 499 | //Wait that subs is cleaned |
| 500 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 501 | |
| 502 | xappConn1.TestMsgChanEmpty(t) |
| 503 | xappConn2.TestMsgChanEmpty(t) |
| 504 | e2termConn1.TestMsgChanEmpty(t) |
| 505 | mainCtrl.wait_registry_empty(t, 10) |
| 506 | |
| 507 | mainCtrl.VerifyCounterValues(t) |
| 508 | } |
| 509 | |
| 510 | //----------------------------------------------------------------------------- |
| 511 | |
| 512 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 513 | // TestSubReqAndSubDelOk |
| 514 | // |
| 515 | // stub stub |
| 516 | // +-------+ +---------+ +---------+ |
| 517 | // | xapp | | submgr | | e2term | |
| 518 | // +-------+ +---------+ +---------+ |
| 519 | // | | | |
| 520 | // | SubReq | | |
| 521 | // |------------->| | |
| 522 | // | | | |
| 523 | // | | SubReq | |
| 524 | // | |------------->| |
| 525 | // | | | |
| 526 | // | | SubResp | |
| 527 | // | |<-------------| |
| 528 | // | | | |
| 529 | // | SubResp | | |
| 530 | // |<-------------| | |
| 531 | // | | | |
| 532 | // | | | |
| 533 | // | SubDelReq | | |
| 534 | // |------------->| | |
| 535 | // | | | |
| 536 | // | | SubDelReq | |
| 537 | // | |------------->| |
| 538 | // | | | |
| 539 | // | | SubDelResp | |
| 540 | // | |<-------------| |
| 541 | // | | | |
| 542 | // | SubDelResp | | |
| 543 | // |<-------------| | |
| 544 | // |
| 545 | //----------------------------------------------------------------------------- |
| 546 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 547 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 548 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 549 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 550 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 551 | Counter{cSubReqFromXapp, 1}, |
| 552 | Counter{cSubReqToE2, 1}, |
| 553 | Counter{cSubRespFromE2, 1}, |
| 554 | Counter{cSubRespToXapp, 1}, |
| 555 | Counter{cSubDelReqFromXapp, 1}, |
| 556 | Counter{cSubDelReqToE2, 1}, |
| 557 | Counter{cSubDelRespFromE2, 1}, |
| 558 | Counter{cSubDelRespToXapp, 1}, |
| 559 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 560 | |
| 561 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 562 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 563 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 564 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 565 | |
| 566 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 567 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 568 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 569 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 570 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 571 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 572 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 573 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 574 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 575 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 576 | |
| 577 | //Wait that subs is cleaned |
| 578 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 579 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 580 | xappConn1.TestMsgChanEmpty(t) |
| 581 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 582 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 583 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 584 | |
| 585 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | //----------------------------------------------------------------------------- |
| 589 | // TestSubReqRetransmission |
| 590 | // |
| 591 | // stub stub |
| 592 | // +-------+ +---------+ +---------+ |
| 593 | // | xapp | | submgr | | e2term | |
| 594 | // +-------+ +---------+ +---------+ |
| 595 | // | | | |
| 596 | // | SubReq | | |
| 597 | // |------------->| | |
| 598 | // | | | |
| 599 | // | | SubReq | |
| 600 | // | |------------->| |
| 601 | // | | | |
| 602 | // | SubReq | | |
| 603 | // | (retrans) | | |
| 604 | // |------------->| | |
| 605 | // | | | |
| 606 | // | | SubResp | |
| 607 | // | |<-------------| |
| 608 | // | | | |
| 609 | // | SubResp | | |
| 610 | // |<-------------| | |
| 611 | // | | | |
| 612 | // | [SUBS DELETE] | |
| 613 | // | | | |
| 614 | // |
| 615 | //----------------------------------------------------------------------------- |
| 616 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 617 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 618 | |
| 619 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 620 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 621 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 622 | |
| 623 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 624 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 625 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 626 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 627 | // hack as there is no real way to see has message be handled. |
| 628 | // Previuos counter check just tells that is has been received by submgr |
| 629 | // --> artificial delay |
| 630 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 631 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 632 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 633 | |
| 634 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 635 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 636 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 637 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 638 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 639 | |
| 640 | //Wait that subs is cleaned |
| 641 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 642 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 643 | xappConn1.TestMsgChanEmpty(t) |
| 644 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 645 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 646 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | //----------------------------------------------------------------------------- |
| 650 | // TestSubDelReqRetransmission |
| 651 | // |
| 652 | // stub stub |
| 653 | // +-------+ +---------+ +---------+ |
| 654 | // | xapp | | submgr | | e2term | |
| 655 | // +-------+ +---------+ +---------+ |
| 656 | // | | | |
| 657 | // | [SUBS CREATE] | |
| 658 | // | | | |
| 659 | // | | | |
| 660 | // | SubDelReq | | |
| 661 | // |------------->| | |
| 662 | // | | | |
| 663 | // | | SubDelReq | |
| 664 | // | |------------->| |
| 665 | // | | | |
| 666 | // | SubDelReq | | |
| 667 | // | (same sub) | | |
| 668 | // | (same xid) | | |
| 669 | // |------------->| | |
| 670 | // | | | |
| 671 | // | | SubDelResp | |
| 672 | // | |<-------------| |
| 673 | // | | | |
| 674 | // | SubDelResp | | |
| 675 | // |<-------------| | |
| 676 | // |
| 677 | //----------------------------------------------------------------------------- |
| 678 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 679 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 680 | |
| 681 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 682 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 683 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 684 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 685 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 686 | |
| 687 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 688 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 689 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 690 | |
| 691 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 692 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 693 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 694 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 695 | // hack as there is no real way to see has message be handled. |
| 696 | // Previuos counter check just tells that is has been received by submgr |
| 697 | // --> artificial delay |
| 698 | <-time.After(1 * time.Second) |
| 699 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 700 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 701 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 702 | |
| 703 | //Wait that subs is cleaned |
| 704 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 705 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 706 | xappConn1.TestMsgChanEmpty(t) |
| 707 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 708 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 709 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | //----------------------------------------------------------------------------- |
| 713 | // TestSubDelReqCollision |
| 714 | // |
| 715 | // stub stub |
| 716 | // +-------+ +---------+ +---------+ |
| 717 | // | xapp | | submgr | | e2term | |
| 718 | // +-------+ +---------+ +---------+ |
| 719 | // | | | |
| 720 | // | [SUBS CREATE] | |
| 721 | // | | | |
| 722 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 723 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 724 | // |------------->| | |
| 725 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 726 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 727 | // | |------------->| |
| 728 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 729 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 730 | // | (same sub) | | |
| 731 | // | (diff xid) | | |
| 732 | // |------------->| | |
| 733 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 734 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 735 | // | |<-------------| |
| 736 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 737 | // | SubDelResp 1 | | |
| 738 | // |<-------------| | |
| 739 | // | | | |
| 740 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 741 | // |<-------------| | |
| 742 | // |
| 743 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 744 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 745 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 746 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 747 | |
| 748 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 749 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 750 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 751 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 752 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 753 | |
| 754 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 755 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 756 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 757 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 758 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 759 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 760 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 761 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 762 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 763 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 764 | // hack as there is no real way to see has message be handled. |
| 765 | // Previuos counter check just tells that is has been received by submgr |
| 766 | // --> artificial delay |
| 767 | <-time.After(1 * time.Second) |
| 768 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 769 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 770 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 771 | |
| 772 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 773 | xappConn1.RecvSubsDelResp(t, nil) |
| 774 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 775 | |
| 776 | //Wait that subs is cleaned |
| 777 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 778 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 779 | xappConn1.TestMsgChanEmpty(t) |
| 780 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 781 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 782 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | //----------------------------------------------------------------------------- |
| 786 | // TestSubReqAndSubDelOkTwoParallel |
| 787 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 788 | // stub stub stub |
| 789 | // +-------+ +-------+ +---------+ +---------+ |
| 790 | // | xapp | | xapp | | submgr | | e2term | |
| 791 | // +-------+ +-------+ +---------+ +---------+ |
| 792 | // | | | | |
| 793 | // | | | | |
| 794 | // | | | | |
| 795 | // | | SubReq1 | | |
| 796 | // | |------------->| | |
| 797 | // | | | | |
| 798 | // | | | SubReq1 | |
| 799 | // | | |------------->| |
| 800 | // | | | | |
| 801 | // | SubReq2 | | |
| 802 | // |------------------------>| | |
| 803 | // | | | | |
| 804 | // | | | SubReq2 | |
| 805 | // | | |------------->| |
| 806 | // | | | | |
| 807 | // | | | SubResp1 | |
| 808 | // | | |<-------------| |
| 809 | // | | SubResp1 | | |
| 810 | // | |<-------------| | |
| 811 | // | | | | |
| 812 | // | | | SubResp2 | |
| 813 | // | | |<-------------| |
| 814 | // | SubResp2 | | |
| 815 | // |<------------------------| | |
| 816 | // | | | | |
| 817 | // | | [SUBS 1 DELETE] | |
| 818 | // | | | | |
| 819 | // | | [SUBS 2 DELETE] | |
| 820 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 821 | // |
| 822 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 823 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 824 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 825 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 826 | |
| 827 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 828 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 829 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 830 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 831 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 832 | |
| 833 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 834 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 835 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 836 | |
| 837 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 838 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 839 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 840 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 841 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 842 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 843 | |
| 844 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 845 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 847 | |
| 848 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 849 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 850 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 851 | |
| 852 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 853 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 854 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 855 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 856 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 857 | //Wait that subs is cleaned |
| 858 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 859 | |
| 860 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 861 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 862 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 863 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 864 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 865 | //Wait that subs is cleaned |
| 866 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 867 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 868 | xappConn1.TestMsgChanEmpty(t) |
| 869 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 870 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 871 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 872 | } |
| 873 | |
| 874 | //----------------------------------------------------------------------------- |
| 875 | // TestSameSubsDiffRan |
| 876 | // Same subscription to different RANs |
| 877 | // |
| 878 | // stub stub |
| 879 | // +-------+ +---------+ +---------+ |
| 880 | // | xapp | | submgr | | e2term | |
| 881 | // +-------+ +---------+ +---------+ |
| 882 | // | | | |
| 883 | // | | | |
| 884 | // | | | |
| 885 | // | SubReq(r1) | | |
| 886 | // |------------->| | |
| 887 | // | | | |
| 888 | // | | SubReq(r1) | |
| 889 | // | |------------->| |
| 890 | // | | | |
| 891 | // | | SubResp(r1) | |
| 892 | // | |<-------------| |
| 893 | // | | | |
| 894 | // | SubResp(r1) | | |
| 895 | // |<-------------| | |
| 896 | // | | | |
| 897 | // | SubReq(r2) | | |
| 898 | // |------------->| | |
| 899 | // | | | |
| 900 | // | | SubReq(r2) | |
| 901 | // | |------------->| |
| 902 | // | | | |
| 903 | // | | SubResp(r2) | |
| 904 | // | |<-------------| |
| 905 | // | | | |
| 906 | // | SubResp(r2) | | |
| 907 | // |<-------------| | |
| 908 | // | | | |
| 909 | // | [SUBS r1 DELETE] | |
| 910 | // | | | |
| 911 | // | [SUBS r2 DELETE] | |
| 912 | // | | | |
| 913 | // |
| 914 | //----------------------------------------------------------------------------- |
| 915 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 916 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 917 | |
| 918 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 920 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 921 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 922 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 923 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 924 | |
| 925 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 926 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 927 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 928 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 929 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 930 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 931 | |
| 932 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 933 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 934 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 935 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 936 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 937 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 938 | //Wait that subs is cleaned |
| 939 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 940 | |
| 941 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 942 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 943 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 944 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 945 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 946 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 947 | //Wait that subs is cleaned |
| 948 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 949 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 950 | xappConn1.TestMsgChanEmpty(t) |
| 951 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 952 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 953 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | //----------------------------------------------------------------------------- |
| 957 | // TestSubReqRetryInSubmgr |
| 958 | // |
| 959 | // stub stub |
| 960 | // +-------+ +---------+ +---------+ |
| 961 | // | xapp | | submgr | | e2term | |
| 962 | // +-------+ +---------+ +---------+ |
| 963 | // | | | |
| 964 | // | SubReq | | |
| 965 | // |------------->| | |
| 966 | // | | | |
| 967 | // | | SubReq | |
| 968 | // | |------------->| |
| 969 | // | | | |
| 970 | // | | | |
| 971 | // | | SubReq | |
| 972 | // | |------------->| |
| 973 | // | | | |
| 974 | // | | SubResp | |
| 975 | // | |<-------------| |
| 976 | // | | | |
| 977 | // | SubResp | | |
| 978 | // |<-------------| | |
| 979 | // | | | |
| 980 | // | [SUBS DELETE] | |
| 981 | // | | | |
| 982 | // |
| 983 | //----------------------------------------------------------------------------- |
| 984 | |
| 985 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 986 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 987 | |
| 988 | // Init counter check |
| 989 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 990 | Counter{cSubReqFromXapp, 1}, |
| 991 | Counter{cSubReqToE2, 1}, |
| 992 | Counter{cSubReReqToE2, 1}, |
| 993 | Counter{cSubRespFromE2, 1}, |
| 994 | Counter{cSubRespToXapp, 1}, |
| 995 | Counter{cSubDelReqFromXapp, 1}, |
| 996 | Counter{cSubDelReqToE2, 1}, |
| 997 | Counter{cSubDelRespFromE2, 1}, |
| 998 | Counter{cSubDelRespToXapp, 1}, |
| 999 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1000 | |
| 1001 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1002 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1003 | |
| 1004 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1005 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | |
| 1007 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1008 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1009 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1010 | |
| 1011 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1012 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1013 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1014 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1015 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1016 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1017 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1018 | |
| 1019 | // Wait that subs is cleaned |
| 1020 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1021 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1022 | xappConn1.TestMsgChanEmpty(t) |
| 1023 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1024 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1025 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1026 | |
| 1027 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | //----------------------------------------------------------------------------- |
| 1031 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 1032 | // |
| 1033 | // stub stub |
| 1034 | // +-------+ +---------+ +---------+ |
| 1035 | // | xapp | | submgr | | e2term | |
| 1036 | // +-------+ +---------+ +---------+ |
| 1037 | // | | | |
| 1038 | // | SubReq | | |
| 1039 | // |------------->| | |
| 1040 | // | | | |
| 1041 | // | | SubReq | |
| 1042 | // | |------------->| |
| 1043 | // | | | |
| 1044 | // | | | |
| 1045 | // | | SubReq | |
| 1046 | // | |------------->| |
| 1047 | // | | | |
| 1048 | // | | SubDelReq | |
| 1049 | // | |------------->| |
| 1050 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1051 | // | | SubDelResp | |
| 1052 | // | |<-------------| |
| 1053 | // | | | |
| 1054 | // |
| 1055 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1056 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1057 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1058 | |
| 1059 | // Init counter check |
| 1060 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1061 | Counter{cSubReqFromXapp, 1}, |
| 1062 | Counter{cSubReqToE2, 1}, |
| 1063 | Counter{cSubReReqToE2, 1}, |
| 1064 | Counter{cSubReqTimerExpiry, 2}, |
| 1065 | Counter{cSubDelReqToE2, 1}, |
| 1066 | Counter{cSubDelRespFromE2, 1}, |
| 1067 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1068 | |
| 1069 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1070 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1071 | |
| 1072 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1073 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1074 | |
| 1075 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1076 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1077 | |
| 1078 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1079 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1080 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1081 | |
| 1082 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1083 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1084 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1085 | xappConn1.TestMsgChanEmpty(t) |
| 1086 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1087 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1088 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1089 | |
| 1090 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1091 | } |
| 1092 | |
| 1093 | //----------------------------------------------------------------------------- |
| 1094 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 1095 | // |
| 1096 | // stub stub |
| 1097 | // +-------+ +---------+ +---------+ |
| 1098 | // | xapp | | submgr | | e2term | |
| 1099 | // +-------+ +---------+ +---------+ |
| 1100 | // | | | |
| 1101 | // | SubReq | | |
| 1102 | // |------------->| | |
| 1103 | // | | | |
| 1104 | // | | SubReq | |
| 1105 | // | |------------->| |
| 1106 | // | | | |
| 1107 | // | | | |
| 1108 | // | | SubReq | |
| 1109 | // | |------------->| |
| 1110 | // | | | |
| 1111 | // | | SubDelReq | |
| 1112 | // | |------------->| |
| 1113 | // | | | |
| 1114 | // | | | |
| 1115 | // | | SubDelReq | |
| 1116 | // | |------------->| |
| 1117 | // | | | |
| 1118 | // | | | |
| 1119 | // |
| 1120 | //----------------------------------------------------------------------------- |
| 1121 | |
| 1122 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1124 | |
| 1125 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1126 | Counter{cSubReqFromXapp, 1}, |
| 1127 | Counter{cSubReqToE2, 1}, |
| 1128 | Counter{cSubReReqToE2, 1}, |
| 1129 | Counter{cSubReqTimerExpiry, 2}, |
| 1130 | Counter{cSubDelReqToE2, 1}, |
| 1131 | Counter{cSubDelReReqToE2, 1}, |
| 1132 | Counter{cSubDelReqTimerExpiry, 2}, |
| 1133 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1134 | |
| 1135 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1137 | |
| 1138 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1139 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1140 | |
| 1141 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1142 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1143 | |
| 1144 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1148 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1149 | |
| 1150 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1151 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1153 | xappConn1.TestMsgChanEmpty(t) |
| 1154 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1155 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1156 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1157 | |
| 1158 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1159 | } |
| 1160 | |
| 1161 | //----------------------------------------------------------------------------- |
| 1162 | // TestSubReqSubFailRespInSubmgr |
| 1163 | // |
| 1164 | // stub stub |
| 1165 | // +-------+ +---------+ +---------+ |
| 1166 | // | xapp | | submgr | | e2term | |
| 1167 | // +-------+ +---------+ +---------+ |
| 1168 | // | | | |
| 1169 | // | SubReq | | |
| 1170 | // |------------->| | |
| 1171 | // | | | |
| 1172 | // | | SubReq | |
| 1173 | // | |------------->| |
| 1174 | // | | | |
| 1175 | // | | SubFail | |
| 1176 | // | |<-------------| |
| 1177 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1178 | // | | SubDelReq | |
| 1179 | // | |------------->| |
| 1180 | // | | | |
| 1181 | // | | SubDelResp | |
| 1182 | // | |<-------------| |
| 1183 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1184 | // | SubFail | | |
| 1185 | // |<-------------| | |
| 1186 | // | | | |
| 1187 | // |
| 1188 | //----------------------------------------------------------------------------- |
| 1189 | |
| 1190 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1191 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1192 | |
| 1193 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1194 | Counter{cSubReqFromXapp, 1}, |
| 1195 | Counter{cSubReqToE2, 1}, |
| 1196 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1197 | Counter{cSubFailToXapp, 1}, |
| 1198 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1199 | |
| 1200 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1201 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1202 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1203 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1204 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1205 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1206 | fparams1.Set(crereq1) |
| 1207 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1208 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1209 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1210 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1211 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1212 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1213 | // Xapp: Receive SubsFail |
| 1214 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1215 | |
| 1216 | // Wait that subs is cleaned |
| 1217 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1218 | |
| 1219 | xappConn1.TestMsgChanEmpty(t) |
| 1220 | xappConn2.TestMsgChanEmpty(t) |
| 1221 | e2termConn1.TestMsgChanEmpty(t) |
| 1222 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1223 | |
| 1224 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1228 | // TestSubDelReqRetryInSubmgr |
| 1229 | // |
| 1230 | // stub stub |
| 1231 | // +-------+ +---------+ +---------+ |
| 1232 | // | xapp | | submgr | | e2term | |
| 1233 | // +-------+ +---------+ +---------+ |
| 1234 | // | | | |
| 1235 | // | [SUBS CREATE] | |
| 1236 | // | | | |
| 1237 | // | | | |
| 1238 | // | SubDelReq | | |
| 1239 | // |------------->| | |
| 1240 | // | | | |
| 1241 | // | | SubDelReq | |
| 1242 | // | |------------->| |
| 1243 | // | | | |
| 1244 | // | | SubDelReq | |
| 1245 | // | |------------->| |
| 1246 | // | | | |
| 1247 | // | | SubDelResp | |
| 1248 | // | |<-------------| |
| 1249 | // | | | |
| 1250 | // | SubDelResp | | |
| 1251 | // |<-------------| | |
| 1252 | // |
| 1253 | //----------------------------------------------------------------------------- |
| 1254 | |
| 1255 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1256 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1257 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1258 | |
| 1259 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1260 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1261 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1262 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1263 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1264 | |
| 1265 | // Subs Delete |
| 1266 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1267 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1268 | |
| 1269 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1270 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1271 | |
| 1272 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1273 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1274 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1275 | |
| 1276 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1277 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1278 | |
| 1279 | // Wait that subs is cleaned |
| 1280 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1281 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1282 | xappConn1.TestMsgChanEmpty(t) |
| 1283 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1284 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1285 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1286 | } |
| 1287 | |
| 1288 | //----------------------------------------------------------------------------- |
| 1289 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1290 | // |
| 1291 | // stub stub |
| 1292 | // +-------+ +---------+ +---------+ |
| 1293 | // | xapp | | submgr | | e2term | |
| 1294 | // +-------+ +---------+ +---------+ |
| 1295 | // | | | |
| 1296 | // | [SUBS CREATE] | |
| 1297 | // | | | |
| 1298 | // | | | |
| 1299 | // | SubDelReq | | |
| 1300 | // |------------->| | |
| 1301 | // | | | |
| 1302 | // | | SubDelReq | |
| 1303 | // | |------------->| |
| 1304 | // | | | |
| 1305 | // | | SubDelReq | |
| 1306 | // | |------------->| |
| 1307 | // | | | |
| 1308 | // | | | |
| 1309 | // | SubDelResp | | |
| 1310 | // |<-------------| | |
| 1311 | // |
| 1312 | //----------------------------------------------------------------------------- |
| 1313 | |
| 1314 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1315 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1316 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1317 | |
| 1318 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1320 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1321 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1322 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1323 | |
| 1324 | // Subs Delete |
| 1325 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1326 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1327 | |
| 1328 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1329 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1330 | |
| 1331 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1332 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1333 | |
| 1334 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1335 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1336 | |
| 1337 | // Wait that subs is cleaned |
| 1338 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1339 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1340 | xappConn1.TestMsgChanEmpty(t) |
| 1341 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1342 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1343 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1344 | } |
| 1345 | |
| 1346 | //----------------------------------------------------------------------------- |
| 1347 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1348 | // |
| 1349 | // stub stub |
| 1350 | // +-------+ +---------+ +---------+ |
| 1351 | // | xapp | | submgr | | e2term | |
| 1352 | // +-------+ +---------+ +---------+ |
| 1353 | // | | | |
| 1354 | // | [SUBS CREATE] | |
| 1355 | // | | | |
| 1356 | // | | | |
| 1357 | // | SubDelReq | | |
| 1358 | // |------------->| | |
| 1359 | // | | | |
| 1360 | // | | SubDelReq | |
| 1361 | // | |------------->| |
| 1362 | // | | | |
| 1363 | // | | SubDelFail | |
| 1364 | // | |<-------------| |
| 1365 | // | | | |
| 1366 | // | SubDelResp | | |
| 1367 | // |<-------------| | |
| 1368 | // | | | |
| 1369 | // |
| 1370 | //----------------------------------------------------------------------------- |
| 1371 | |
| 1372 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1373 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1374 | |
| 1375 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1376 | Counter{cSubReqFromXapp, 1}, |
| 1377 | Counter{cSubReqToE2, 1}, |
| 1378 | Counter{cSubRespFromE2, 1}, |
| 1379 | Counter{cSubRespToXapp, 1}, |
| 1380 | Counter{cSubDelReqFromXapp, 1}, |
| 1381 | Counter{cSubDelReqToE2, 1}, |
| 1382 | Counter{cSubDelFailFromE2, 1}, |
| 1383 | Counter{cSubDelRespToXapp, 1}, |
| 1384 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1385 | |
| 1386 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1387 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1388 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1389 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1390 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1391 | |
| 1392 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1393 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1394 | |
| 1395 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1396 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1397 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1398 | |
| 1399 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1400 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1401 | |
| 1402 | // Wait that subs is cleaned |
| 1403 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1404 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1405 | xappConn1.TestMsgChanEmpty(t) |
| 1406 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1407 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1408 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1409 | |
| 1410 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | //----------------------------------------------------------------------------- |
| 1414 | // TestSubReqAndSubDelOkSameAction |
| 1415 | // |
| 1416 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1417 | // +-------+ +-------+ +---------+ +---------+ |
| 1418 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1419 | // +-------+ +-------+ +---------+ +---------+ |
| 1420 | // | | | | |
| 1421 | // | | | | |
| 1422 | // | | | | |
| 1423 | // | | SubReq1 | | |
| 1424 | // | |------------->| | |
| 1425 | // | | | | |
| 1426 | // | | | SubReq1 | |
| 1427 | // | | |------------->| |
| 1428 | // | | | SubResp1 | |
| 1429 | // | | |<-------------| |
| 1430 | // | | SubResp1 | | |
| 1431 | // | |<-------------| | |
| 1432 | // | | | | |
| 1433 | // | SubReq2 | | |
| 1434 | // |--------------------------->| | |
| 1435 | // | | | | |
| 1436 | // | SubResp2 | | |
| 1437 | // |<---------------------------| | |
| 1438 | // | | | | |
| 1439 | // | | SubDelReq 1 | | |
| 1440 | // | |------------->| | |
| 1441 | // | | | | |
| 1442 | // | | SubDelResp 1 | | |
| 1443 | // | |<-------------| | |
| 1444 | // | | | | |
| 1445 | // | SubDelReq 2 | | |
| 1446 | // |--------------------------->| | |
| 1447 | // | | | | |
| 1448 | // | | | SubDelReq 2 | |
| 1449 | // | | |------------->| |
| 1450 | // | | | | |
| 1451 | // | | | SubDelReq 2 | |
| 1452 | // | | |------------->| |
| 1453 | // | | | | |
| 1454 | // | SubDelResp 2 | | |
| 1455 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1456 | // |
| 1457 | //----------------------------------------------------------------------------- |
| 1458 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1459 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1460 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1461 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1462 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1463 | Counter{cSubReqFromXapp, 2}, |
| 1464 | Counter{cSubReqToE2, 1}, |
| 1465 | Counter{cSubRespFromE2, 1}, |
| 1466 | Counter{cSubRespToXapp, 2}, |
| 1467 | Counter{cMergedSubscriptions, 1}, |
| 1468 | Counter{cUnmergedSubscriptions, 1}, |
| 1469 | Counter{cSubDelReqFromXapp, 2}, |
| 1470 | Counter{cSubDelReqToE2, 1}, |
| 1471 | Counter{cSubDelRespFromE2, 1}, |
| 1472 | Counter{cSubDelRespToXapp, 2}, |
| 1473 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1474 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1475 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1476 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1477 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1478 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1479 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1480 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1482 | |
| 1483 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1484 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1485 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1486 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1487 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1488 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1489 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1490 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1491 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1492 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1493 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1494 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1495 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1496 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1497 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1498 | //e2termConn1.RecvSubsDelReq(t) |
| 1499 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1500 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1501 | //Wait that subs is cleaned |
| 1502 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1503 | |
| 1504 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1505 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1506 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1507 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1508 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1509 | //Wait that subs is cleaned |
| 1510 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1511 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1512 | xappConn1.TestMsgChanEmpty(t) |
| 1513 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1514 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1515 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1516 | |
| 1517 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1518 | } |
| 1519 | |
| 1520 | //----------------------------------------------------------------------------- |
| 1521 | // TestSubReqAndSubDelOkSameActionParallel |
| 1522 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1523 | // stub stub stub |
| 1524 | // +-------+ +-------+ +---------+ +---------+ |
| 1525 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1526 | // +-------+ +-------+ +---------+ +---------+ |
| 1527 | // | | | | |
| 1528 | // | | | | |
| 1529 | // | | | | |
| 1530 | // | | SubReq1 | | |
| 1531 | // | |------------->| | |
| 1532 | // | | | | |
| 1533 | // | | | SubReq1 | |
| 1534 | // | | |------------->| |
| 1535 | // | SubReq2 | | |
| 1536 | // |--------------------------->| | |
| 1537 | // | | | SubResp1 | |
| 1538 | // | | |<-------------| |
| 1539 | // | | SubResp1 | | |
| 1540 | // | |<-------------| | |
| 1541 | // | | | | |
| 1542 | // | SubResp2 | | |
| 1543 | // |<---------------------------| | |
| 1544 | // | | | | |
| 1545 | // | | SubDelReq 1 | | |
| 1546 | // | |------------->| | |
| 1547 | // | | | | |
| 1548 | // | | SubDelResp 1 | | |
| 1549 | // | |<-------------| | |
| 1550 | // | | | | |
| 1551 | // | SubDelReq 2 | | |
| 1552 | // |--------------------------->| | |
| 1553 | // | | | | |
| 1554 | // | | | SubDelReq 2 | |
| 1555 | // | | |------------->| |
| 1556 | // | | | | |
| 1557 | // | | | SubDelReq 2 | |
| 1558 | // | | |------------->| |
| 1559 | // | | | | |
| 1560 | // | SubDelResp 2 | | |
| 1561 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1562 | // |
| 1563 | //----------------------------------------------------------------------------- |
| 1564 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1565 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1566 | |
| 1567 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1568 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1569 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1570 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1571 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1572 | |
| 1573 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1574 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1575 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1576 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1577 | |
| 1578 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1579 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1580 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1581 | |
| 1582 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1583 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1584 | |
| 1585 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1586 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1587 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1588 | |
| 1589 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1590 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1591 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1592 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1593 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1594 | |
| 1595 | //Wait that subs is cleaned |
| 1596 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1597 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1598 | xappConn1.TestMsgChanEmpty(t) |
| 1599 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1600 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1601 | mainCtrl.wait_registry_empty(t, 10) |
| 1602 | } |
| 1603 | |
| 1604 | //----------------------------------------------------------------------------- |
| 1605 | // TestSubReqAndSubDelNokSameActionParallel |
| 1606 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1607 | // stub stub stub |
| 1608 | // +-------+ +-------+ +---------+ +---------+ |
| 1609 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1610 | // +-------+ +-------+ +---------+ +---------+ |
| 1611 | // | | | | |
| 1612 | // | | | | |
| 1613 | // | | | | |
| 1614 | // | | SubReq1 | | |
| 1615 | // | |------------->| | |
| 1616 | // | | | | |
| 1617 | // | | | SubReq1 | |
| 1618 | // | | |------------->| |
| 1619 | // | SubReq2 | | |
| 1620 | // |--------------------------->| | |
| 1621 | // | | | SubFail1 | |
| 1622 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1623 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1624 | // | | | SubDelReq | |
| 1625 | // | | |------------->| |
| 1626 | // | | | SubDelResp | |
| 1627 | // | | |<-------------| |
| 1628 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1629 | // | | SubFail1 | | |
| 1630 | // | |<-------------| | |
| 1631 | // | | | | |
| 1632 | // | SubFail2 | | |
| 1633 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1634 | // |
| 1635 | //----------------------------------------------------------------------------- |
| 1636 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1637 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1638 | |
| 1639 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1640 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1641 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1642 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1643 | |
| 1644 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1645 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1646 | |
| 1647 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1648 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1649 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1650 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1651 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1652 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1653 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1654 | // E2t: send SubsFail (first) |
| 1655 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1656 | fparams1.Set(crereq1) |
| 1657 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1658 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1659 | // E2t: internal delete |
| 1660 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1661 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1662 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1663 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1664 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1665 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1666 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1667 | |
| 1668 | //Wait that subs is cleaned |
| 1669 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1670 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1671 | xappConn1.TestMsgChanEmpty(t) |
| 1672 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1673 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1674 | mainCtrl.wait_registry_empty(t, 10) |
| 1675 | } |
| 1676 | |
| 1677 | //----------------------------------------------------------------------------- |
| 1678 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1679 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1680 | // stub stub stub |
| 1681 | // +-------+ +-------+ +---------+ +---------+ |
| 1682 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1683 | // +-------+ +-------+ +---------+ +---------+ |
| 1684 | // | | | | |
| 1685 | // | | | | |
| 1686 | // | | | | |
| 1687 | // | | SubReq1 | | |
| 1688 | // | |------------->| | |
| 1689 | // | | | | |
| 1690 | // | | | SubReq1 | |
| 1691 | // | | |------------->| |
| 1692 | // | | SubReq2 | | |
| 1693 | // |--------------------------->| | |
| 1694 | // | | | | |
| 1695 | // | | | SubReq1 | |
| 1696 | // | | |------------->| |
| 1697 | // | | | | |
| 1698 | // | | | | |
| 1699 | // | | | SubDelReq | |
| 1700 | // | | |------------->| |
| 1701 | // | | | | |
| 1702 | // | | | SubDelResp | |
| 1703 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1704 | // |
| 1705 | //----------------------------------------------------------------------------- |
| 1706 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1707 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1708 | |
| 1709 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1710 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1711 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1712 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1713 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1714 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1715 | |
| 1716 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1717 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1718 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1719 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1720 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1721 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1722 | |
| 1723 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1724 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1725 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1726 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1727 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1728 | |
| 1729 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1730 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1731 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1732 | xappConn1.TestMsgChanEmpty(t) |
| 1733 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1734 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1735 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1736 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1737 | |
| 1738 | //----------------------------- Policy cases --------------------------------- |
| 1739 | //----------------------------------------------------------------------------- |
| 1740 | // TestSubReqPolicyAndSubDelOk |
| 1741 | // |
| 1742 | // stub stub |
| 1743 | // +-------+ +---------+ +---------+ |
| 1744 | // | xapp | | submgr | | e2term | |
| 1745 | // +-------+ +---------+ +---------+ |
| 1746 | // | | | |
| 1747 | // | SubReq | | |
| 1748 | // |------------->| | |
| 1749 | // | | | |
| 1750 | // | | SubReq | |
| 1751 | // | |------------->| |
| 1752 | // | | | |
| 1753 | // | | SubResp | |
| 1754 | // | |<-------------| |
| 1755 | // | | | |
| 1756 | // | SubResp | | |
| 1757 | // |<-------------| | |
| 1758 | // | | | |
| 1759 | // | | | |
| 1760 | // | SubDelReq | | |
| 1761 | // |------------->| | |
| 1762 | // | | | |
| 1763 | // | | SubDelReq | |
| 1764 | // | |------------->| |
| 1765 | // | | | |
| 1766 | // | | SubDelResp | |
| 1767 | // | |<-------------| |
| 1768 | // | | | |
| 1769 | // | SubDelResp | | |
| 1770 | // |<-------------| | |
| 1771 | // |
| 1772 | //----------------------------------------------------------------------------- |
| 1773 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1774 | CaseBegin("TestSubReqAndSubDelOk") |
| 1775 | |
| 1776 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1777 | rparams1.Init() |
| 1778 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1779 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1780 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1781 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1782 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1783 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1784 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1785 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1786 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1787 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1788 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1789 | |
| 1790 | //Wait that subs is cleaned |
| 1791 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1792 | |
| 1793 | xappConn1.TestMsgChanEmpty(t) |
| 1794 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1795 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1796 | mainCtrl.wait_registry_empty(t, 10) |
| 1797 | } |
| 1798 | |
| 1799 | //----------------------------------------------------------------------------- |
| 1800 | // TestSubReqPolicyChangeAndSubDelOk |
| 1801 | // |
| 1802 | // stub stub |
| 1803 | // +-------+ +---------+ +---------+ |
| 1804 | // | xapp | | submgr | | e2term | |
| 1805 | // +-------+ +---------+ +---------+ |
| 1806 | // | | | |
| 1807 | // | SubReq | | |
| 1808 | // |------------->| | |
| 1809 | // | | | |
| 1810 | // | | SubReq | |
| 1811 | // | |------------->| |
| 1812 | // | | | |
| 1813 | // | | SubResp | |
| 1814 | // | |<-------------| |
| 1815 | // | | | |
| 1816 | // | SubResp | | |
| 1817 | // |<-------------| | |
| 1818 | // | | | |
| 1819 | // | SubReq | | |
| 1820 | // |------------->| | |
| 1821 | // | | | |
| 1822 | // | | SubReq | |
| 1823 | // | |------------->| |
| 1824 | // | | | |
| 1825 | // | | SubResp | |
| 1826 | // | |<-------------| |
| 1827 | // | | | |
| 1828 | // | SubResp | | |
| 1829 | // |<-------------| | |
| 1830 | // | | | |
| 1831 | // | SubDelReq | | |
| 1832 | // |------------->| | |
| 1833 | // | | | |
| 1834 | // | | SubDelReq | |
| 1835 | // | |------------->| |
| 1836 | // | | | |
| 1837 | // | | SubDelResp | |
| 1838 | // | |<-------------| |
| 1839 | // | | | |
| 1840 | // | SubDelResp | | |
| 1841 | // |<-------------| | |
| 1842 | // |
| 1843 | //----------------------------------------------------------------------------- |
| 1844 | |
| 1845 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1846 | CaseBegin("TestSubReqAndSubDelOk") |
| 1847 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1848 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1849 | rparams1.Init() |
| 1850 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1851 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1852 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1853 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1854 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1855 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1856 | |
| 1857 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1858 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1859 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1860 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1861 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1862 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1863 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1864 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1865 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1866 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1867 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1868 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1869 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1870 | |
| 1871 | //Wait that subs is cleaned |
| 1872 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1873 | |
| 1874 | xappConn1.TestMsgChanEmpty(t) |
| 1875 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1876 | e2termConn1.TestMsgChanEmpty(t) |
| 1877 | mainCtrl.wait_registry_empty(t, 10) |
| 1878 | } |
| 1879 | |
| 1880 | //----------------------------------------------------------------------------- |
| 1881 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1882 | // |
| 1883 | // stub stub stub |
| 1884 | // +-------+ +---------+ +---------+ +---------+ |
| 1885 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1886 | // +-------+ +---------+ +---------+ +---------+ |
| 1887 | // | | | | |
| 1888 | // | | | | |
| 1889 | // | | | | |
| 1890 | // | SubReq1 | | | |
| 1891 | // |------------->| | | |
| 1892 | // | | | | |
| 1893 | // | | SubReq1 | | |
| 1894 | // | |------------->| | |
| 1895 | // | | | | |
| 1896 | // | SubReq2 | | | |
| 1897 | // |------------->| | | |
| 1898 | // | | | | |
| 1899 | // | | SubReq2 | | |
| 1900 | // | |---------------------------->| |
| 1901 | // | | | | |
| 1902 | // | | SubResp1 | | |
| 1903 | // | |<-------------| | |
| 1904 | // | SubResp1 | | | |
| 1905 | // |<-------------| | | |
| 1906 | // | | SubResp2 | | |
| 1907 | // | |<----------------------------| |
| 1908 | // | SubResp2 | | | |
| 1909 | // |<-------------| | | |
| 1910 | // | | | | |
| 1911 | // | [SUBS 1 DELETE] | | |
| 1912 | // | | | | |
| 1913 | // | [SUBS 2 DELETE] | | |
| 1914 | // | | | | |
| 1915 | // |
| 1916 | //----------------------------------------------------------------------------- |
| 1917 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1918 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1919 | |
| 1920 | //Req1 |
| 1921 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1922 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1923 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1924 | |
| 1925 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1926 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1927 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1928 | |
| 1929 | //Resp1 |
| 1930 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1931 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1932 | |
| 1933 | //Resp2 |
| 1934 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1935 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1936 | |
| 1937 | //Del1 |
| 1938 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1939 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1940 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1941 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1942 | //Wait that subs is cleaned |
| 1943 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1944 | |
| 1945 | //Del2 |
| 1946 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1947 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1948 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1949 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1950 | //Wait that subs is cleaned |
| 1951 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1952 | |
| 1953 | xappConn1.TestMsgChanEmpty(t) |
| 1954 | xappConn2.TestMsgChanEmpty(t) |
| 1955 | e2termConn1.TestMsgChanEmpty(t) |
| 1956 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1957 | mainCtrl.wait_registry_empty(t, 10) |
| 1958 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1959 | |
| 1960 | //----------------------------------------------------------------------------- |
| 1961 | // TestSubReqInsertAndSubDelOk |
| 1962 | // |
| 1963 | // stub stub |
| 1964 | // +-------+ +---------+ +---------+ |
| 1965 | // | xapp | | submgr | | e2term | |
| 1966 | // +-------+ +---------+ +---------+ |
| 1967 | // | | | |
| 1968 | // | SubReq | | |
| 1969 | // |------------->| | |
| 1970 | // | | | |
| 1971 | // | | SubReq | |
| 1972 | // | |------------->| |
| 1973 | // | | | |
| 1974 | // | | SubResp | |
| 1975 | // | |<-------------| |
| 1976 | // | | | |
| 1977 | // | SubResp | | |
| 1978 | // |<-------------| | |
| 1979 | // | | | |
| 1980 | // | | | |
| 1981 | // | SubDelReq | | |
| 1982 | // |------------->| | |
| 1983 | // | | | |
| 1984 | // | | SubDelReq | |
| 1985 | // | |------------->| |
| 1986 | // | | | |
| 1987 | // | | SubDelResp | |
| 1988 | // | |<-------------| |
| 1989 | // | | | |
| 1990 | // | SubDelResp | | |
| 1991 | // |<-------------| | |
| 1992 | // |
| 1993 | //----------------------------------------------------------------------------- |
| 1994 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1995 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1996 | |
| 1997 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1998 | rparams1.Init() |
| 1999 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 2000 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2001 | |
| 2002 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2003 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2004 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2005 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2006 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2007 | |
| 2008 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2009 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2010 | |
| 2011 | //Wait that subs is cleaned |
| 2012 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2013 | |
| 2014 | xappConn1.TestMsgChanEmpty(t) |
| 2015 | xappConn2.TestMsgChanEmpty(t) |
| 2016 | e2termConn1.TestMsgChanEmpty(t) |
| 2017 | mainCtrl.wait_registry_empty(t, 10) |
| 2018 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 2019 | |
| 2020 | //----------------------------------------------------------------------------- |
| 2021 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 2022 | // |
| 2023 | // This case simulates case where xApp restarts and starts sending same |
| 2024 | // subscription requests which have already subscribed successfully |
| 2025 | |
| 2026 | // stub stub |
| 2027 | // +-------+ +---------+ +---------+ |
| 2028 | // | xapp | | submgr | | e2term | |
| 2029 | // +-------+ +---------+ +---------+ |
| 2030 | // | | | |
| 2031 | // | SubReq | | |
| 2032 | // |------------->| | |
| 2033 | // | | | |
| 2034 | // | | SubReq | |
| 2035 | // | |------------->| |
| 2036 | // | | | |
| 2037 | // | | SubResp | |
| 2038 | // | |<-------------| |
| 2039 | // | | | |
| 2040 | // | SubResp | | |
| 2041 | // |<-------------| | |
| 2042 | // | | | |
| 2043 | // | xApp restart | | |
| 2044 | // | | | |
| 2045 | // | SubReq | | |
| 2046 | // | (retrans with same xApp generated subid but diff xid) |
| 2047 | // |------------->| | |
| 2048 | // | | | |
| 2049 | // | SubResp | | |
| 2050 | // |<-------------| | |
| 2051 | // | | | |
| 2052 | // | [SUBS DELETE] | |
| 2053 | // | | | |
| 2054 | // |
| 2055 | //----------------------------------------------------------------------------- |
| 2056 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 2057 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 2058 | |
| 2059 | //Subs Create |
| 2060 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2061 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2062 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2063 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2064 | |
| 2065 | // xApp restart here |
| 2066 | // --> artificial delay |
| 2067 | <-time.After(1 * time.Second) |
| 2068 | |
| 2069 | //Subs Create |
| 2070 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 2071 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 2072 | |
| 2073 | //Subs Delete |
| 2074 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2075 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2076 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2077 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2078 | |
| 2079 | //Wait that subs is cleaned |
| 2080 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2081 | |
| 2082 | xappConn1.TestMsgChanEmpty(t) |
| 2083 | xappConn2.TestMsgChanEmpty(t) |
| 2084 | e2termConn1.TestMsgChanEmpty(t) |
| 2085 | mainCtrl.wait_registry_empty(t, 10) |
| 2086 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2087 | |
| 2088 | //----------------------------------------------------------------------------- |
| 2089 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 2090 | // |
| 2091 | // stub stub |
| 2092 | // +-------+ +---------+ +---------+ |
| 2093 | // | xapp | | submgr | | e2term | |
| 2094 | // +-------+ +---------+ +---------+ |
| 2095 | // | | | |
| 2096 | // | SubReq | | |
| 2097 | // |------------->| | |
| 2098 | // | | | |
| 2099 | // | | SubReq | |
| 2100 | // | |------------->| |
| 2101 | // | | | |
| 2102 | // | | SubResp | |
| 2103 | // | <----| |
| 2104 | // | | |
| 2105 | // | Submgr restart | |
| 2106 | // | | |
| 2107 | // | | | |
| 2108 | // | | SubDelReq | |
| 2109 | // | |------------->| |
| 2110 | // | | | |
| 2111 | // | | SubDelResp | |
| 2112 | // | |<-------------| |
| 2113 | // | | | |
| 2114 | // |
| 2115 | //----------------------------------------------------------------------------- |
| 2116 | |
| 2117 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2118 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 2119 | |
| 2120 | // Remove possible existing subscrition |
| 2121 | mainCtrl.removeExistingSubscriptions(t) |
| 2122 | |
| 2123 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 2124 | xappConn1.SendSubsReq(t, nil, nil) |
| 2125 | e2termConn1.RecvSubsReq(t) |
| 2126 | mainCtrl.SetResetTestFlag(t, false) |
| 2127 | |
| 2128 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2129 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2130 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2131 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 2132 | t.Logf("e2SubsId = %v", e2SubsId) |
| 2133 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2134 | mainCtrl.SimulateRestart(t) |
| 2135 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2136 | |
| 2137 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2138 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2139 | |
| 2140 | // Wait that subs is cleaned |
| 2141 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2142 | |
| 2143 | xappConn1.TestMsgChanEmpty(t) |
| 2144 | xappConn2.TestMsgChanEmpty(t) |
| 2145 | e2termConn1.TestMsgChanEmpty(t) |
| 2146 | mainCtrl.wait_registry_empty(t, 10) |
| 2147 | } |
| 2148 | |
| 2149 | //----------------------------------------------------------------------------- |
| 2150 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 2151 | // |
| 2152 | // stub stub |
| 2153 | // +-------+ +---------+ +---------+ |
| 2154 | // | xapp | | submgr | | e2term | |
| 2155 | // +-------+ +---------+ +---------+ |
| 2156 | // | | | |
| 2157 | // | SubReq | | |
| 2158 | // |------------->| | |
| 2159 | // | | | |
| 2160 | // | | SubReq | |
| 2161 | // | |------------->| |
| 2162 | // | | | |
| 2163 | // | | SubResp | |
| 2164 | // | |<-------------| |
| 2165 | // | | | |
| 2166 | // | SubResp | | |
| 2167 | // |<-------------| | |
| 2168 | // | | | |
| 2169 | // | | |
| 2170 | // | Submgr restart | |
| 2171 | // | | |
| 2172 | // | SubDelReq | | |
| 2173 | // |------------->| | |
| 2174 | // | | | |
| 2175 | // | | SubDelReq | |
| 2176 | // | |------------->| |
| 2177 | // | | | |
| 2178 | // | | SubDelResp | |
| 2179 | // | |<-------------| |
| 2180 | // | | | |
| 2181 | // | SubDelResp | | |
| 2182 | // |<-------------| | |
| 2183 | // |
| 2184 | //----------------------------------------------------------------------------- |
| 2185 | |
| 2186 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2187 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2188 | |
| 2189 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2190 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2191 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2192 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2193 | |
| 2194 | // Check subscription |
| 2195 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2196 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2197 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2198 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2199 | |
| 2200 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2201 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2202 | |
| 2203 | // Check that subscription is restored correctly after restart |
| 2204 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2205 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2206 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2207 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2208 | |
| 2209 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2210 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2211 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2212 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2213 | |
| 2214 | //Wait that subs is cleaned |
| 2215 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2216 | |
| 2217 | xappConn1.TestMsgChanEmpty(t) |
| 2218 | xappConn2.TestMsgChanEmpty(t) |
| 2219 | e2termConn1.TestMsgChanEmpty(t) |
| 2220 | mainCtrl.wait_registry_empty(t, 10) |
| 2221 | } |
| 2222 | |
| 2223 | //----------------------------------------------------------------------------- |
| 2224 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2225 | // |
| 2226 | // stub stub |
| 2227 | // +-------+ +-------+ +---------+ +---------+ |
| 2228 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2229 | // +-------+ +-------+ +---------+ +---------+ |
| 2230 | // | | | | |
| 2231 | // | | | | |
| 2232 | // | | | | |
| 2233 | // | | SubReq1 | | |
| 2234 | // | |------------->| | |
| 2235 | // | | | | |
| 2236 | // | | | SubReq1 | |
| 2237 | // | | |------------->| |
| 2238 | // | | | SubResp1 | |
| 2239 | // | | |<-------------| |
| 2240 | // | | SubResp1 | | |
| 2241 | // | |<-------------| | |
| 2242 | // | | | | |
| 2243 | // | | |
| 2244 | // | submgr restart | |
| 2245 | // | | |
| 2246 | // | | | | |
| 2247 | // | | | | |
| 2248 | // | SubReq2 | | |
| 2249 | // |--------------------------->| | |
| 2250 | // | | | | |
| 2251 | // | SubResp2 | | |
| 2252 | // |<---------------------------| | |
| 2253 | // | | | | |
| 2254 | // | | SubDelReq 1 | | |
| 2255 | // | |------------->| | |
| 2256 | // | | | | |
| 2257 | // | | SubDelResp 1 | | |
| 2258 | // | |<-------------| | |
| 2259 | // | | | | |
| 2260 | // | | | | |
| 2261 | // | | |
| 2262 | // | submgr restart | |
| 2263 | // | | |
| 2264 | // | | | | |
| 2265 | // | SubDelReq 2 | | |
| 2266 | // |--------------------------->| | |
| 2267 | // | | | | |
| 2268 | // | | | SubDelReq 2 | |
| 2269 | // | | |------------->| |
| 2270 | // | | | | |
| 2271 | // | | | SubDelReq 2 | |
| 2272 | // | | |------------->| |
| 2273 | // | | | | |
| 2274 | // | SubDelResp 2 | | |
| 2275 | // |<---------------------------| | |
| 2276 | // |
| 2277 | //----------------------------------------------------------------------------- |
| 2278 | |
| 2279 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2280 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2281 | |
| 2282 | //Req1 |
| 2283 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2284 | rparams1.Init() |
| 2285 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2286 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2287 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2288 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2289 | |
| 2290 | //Req2 |
| 2291 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2292 | rparams2.Init() |
| 2293 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2294 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2295 | |
| 2296 | // Check subscription |
| 2297 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2298 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2299 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2300 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2301 | |
| 2302 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2303 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2304 | |
| 2305 | // Check that subscription is restored correctly after restart |
| 2306 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2307 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2308 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2309 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2310 | |
| 2311 | //Del1 |
| 2312 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2313 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2314 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2315 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2316 | |
| 2317 | mainCtrl.SimulateRestart(t) |
| 2318 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2319 | |
| 2320 | //Del2 |
| 2321 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2322 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2323 | |
| 2324 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2325 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2326 | |
| 2327 | //Wait that subs is cleaned |
| 2328 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2329 | |
| 2330 | xappConn1.TestMsgChanEmpty(t) |
| 2331 | xappConn2.TestMsgChanEmpty(t) |
| 2332 | e2termConn1.TestMsgChanEmpty(t) |
| 2333 | mainCtrl.wait_registry_empty(t, 10) |
| 2334 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2335 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2336 | //***************************************************************************** |
| 2337 | // REST interface test cases |
| 2338 | //***************************************************************************** |
| 2339 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2340 | //----------------------------------------------------------------------------- |
| 2341 | // Test debug GET and POST requests |
| 2342 | // |
| 2343 | // curl |
| 2344 | // +-------+ +---------+ |
| 2345 | // | user | | submgr | |
| 2346 | // +-------+ +---------+ |
| 2347 | // | | |
| 2348 | // | GET/POST Req | |
| 2349 | // |------------->| |
| 2350 | // | Resp | |
| 2351 | // |<-------------| |
| 2352 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2353 | func TestGetSubscriptions(t *testing.T) { |
| 2354 | |
| 2355 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2356 | } |
| 2357 | |
| 2358 | func TestGetSymptomData(t *testing.T) { |
| 2359 | |
| 2360 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2361 | } |
| 2362 | |
| 2363 | func TestPostdeleteSubId(t *testing.T) { |
| 2364 | |
| 2365 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2366 | } |
| 2367 | |
| 2368 | func TestPostEmptyDb(t *testing.T) { |
| 2369 | |
| 2370 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2371 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2372 | |
Anssi Mannila | b73e7cd | 2021-08-03 11:57:11 +0300 | [diff] [blame] | 2373 | func TestGetRestSubscriptions(t *testing.T) { |
| 2374 | |
| 2375 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/restsubscriptions") |
| 2376 | } |
| 2377 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2378 | //----------------------------------------------------------------------------- |
| 2379 | // TestRESTSubReqAndRouteNok |
| 2380 | // |
| 2381 | // stub stub |
| 2382 | // +-------+ +---------+ +---------+ |
| 2383 | // | xapp | | submgr | | rtmgr | |
| 2384 | // +-------+ +---------+ +---------+ |
| 2385 | // | | | |
| 2386 | // | RESTSubReq | | |
| 2387 | // |---------------->| | |
| 2388 | // | | | |
| 2389 | // | RESTSubResp | | |
| 2390 | // |<----------------| | |
| 2391 | // | | RouteCreate | |
| 2392 | // | |------------->| |
| 2393 | // | | | |
| 2394 | // | | RouteCreate | |
| 2395 | // | | status:400 | |
| 2396 | // | |(Bad request) | |
| 2397 | // | |<-------------| |
| 2398 | // | RESTNotif | | |
| 2399 | // |<----------------| | |
| 2400 | // | | | |
| 2401 | // | [SUBS INT DELETE] | |
| 2402 | // | | | |
| 2403 | // | RESTSubDelReq | | |
| 2404 | // |---------------->| | |
| 2405 | // | RESTSubDelResp | | |
| 2406 | // |<----------------| | |
| 2407 | // |
| 2408 | //----------------------------------------------------------------------------- |
| 2409 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2410 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2411 | |
| 2412 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2413 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2414 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2415 | Counter{cRouteCreateFail, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2416 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2417 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2418 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2419 | }) |
| 2420 | |
| 2421 | const subReqCount int = 1 |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2422 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2423 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2424 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2425 | |
| 2426 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2427 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2428 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2429 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "failAll") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2430 | waiter.WaitResult(t) |
| 2431 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2432 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2433 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2434 | |
| 2435 | // Del |
| 2436 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2437 | |
| 2438 | // Wait that subs is cleaned |
| 2439 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2440 | waitSubsCleanup(t, e2SubsId, 10) |
| 2441 | mainCtrl.VerifyCounterValues(t) |
| 2442 | } |
| 2443 | |
| 2444 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2445 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2446 | |
| 2447 | //Init counter check |
| 2448 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2449 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2450 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2451 | Counter{cSubReqToE2, 1}, |
| 2452 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2453 | Counter{cRestSubNotifToXapp, 1}, |
| 2454 | Counter{cRestSubFailNotifToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2455 | Counter{cRouteCreateUpdateFail, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2456 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2457 | Counter{cSubDelReqToE2, 1}, |
| 2458 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2459 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2460 | }) |
| 2461 | |
| 2462 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2463 | |
| 2464 | //Subs Create |
| 2465 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2466 | |
| 2467 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2468 | |
| 2469 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2470 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2471 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2472 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2473 | params.SetMeid("RAN_NAME_1") |
| 2474 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2475 | xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 2476 | xappConn2.ExpectRESTNotificationNok(t, restSubId2, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2477 | waiter.WaitResult(t) |
| 2478 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2479 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2480 | |
| 2481 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2482 | |
| 2483 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2484 | |
| 2485 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2486 | //Wait that subs is cleaned |
| 2487 | waitSubsCleanup(t, e2SubsId, 10) |
| 2488 | |
| 2489 | mainCtrl.VerifyCounterValues(t) |
| 2490 | } |
| 2491 | |
| 2492 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2493 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2494 | |
| 2495 | // Init counter check |
| 2496 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2497 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2498 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2499 | Counter{cSubReqToE2, 1}, |
| 2500 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2501 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2502 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2503 | Counter{cRouteDeleteFail, 1}, |
| 2504 | Counter{cSubDelReqToE2, 1}, |
| 2505 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2506 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2507 | }) |
| 2508 | |
| 2509 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2510 | |
| 2511 | //Subs Create |
| 2512 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2513 | |
| 2514 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2515 | |
| 2516 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2517 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2518 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2519 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2520 | waiter.WaitResult(t) |
| 2521 | |
| 2522 | waitSubsCleanup(t, e2SubsId, 10) |
| 2523 | |
| 2524 | mainCtrl.VerifyCounterValues(t) |
| 2525 | } |
| 2526 | |
| 2527 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2528 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2529 | |
| 2530 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2531 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2532 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2533 | Counter{cSubReqToE2, 1}, |
| 2534 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2535 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2536 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2537 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2538 | Counter{cSubDelReqToE2, 1}, |
| 2539 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2540 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2541 | }) |
| 2542 | |
| 2543 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2544 | |
| 2545 | //Subs Create |
| 2546 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2547 | |
| 2548 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2549 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2550 | |
| 2551 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2552 | |
| 2553 | //Del1, this shall fail on rtmgr side |
| 2554 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2555 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2556 | waiter.WaitResult(t) |
| 2557 | |
| 2558 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2559 | |
| 2560 | //Del2 |
| 2561 | deleteXapp2Subscription(t, &restSubId2) |
| 2562 | |
| 2563 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2564 | |
| 2565 | mainCtrl.VerifyCounterValues(t) |
| 2566 | } |
| 2567 | |
| 2568 | //----------------------------------------------------------------------------- |
| 2569 | // TestRESTSubReqRetransmission |
| 2570 | // |
| 2571 | // stub stub |
| 2572 | // +-------+ +---------+ +---------+ |
| 2573 | // | xapp | | submgr | | e2term | |
| 2574 | // +-------+ +---------+ +---------+ |
| 2575 | // | | | |
| 2576 | // | RESTSubReq1 | | |
| 2577 | // |---------------->| | |
| 2578 | // | | | |
| 2579 | // | RESTSubResp | | |
| 2580 | // |<----------------| | |
| 2581 | // | | SubReq1 | |
| 2582 | // | |------------->| |
| 2583 | // | | | |
| 2584 | // | RESTSubReq2 | | |
| 2585 | // | (retrans) | | |
| 2586 | // |---------------->| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2587 | // | RESTSubResp(201)| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2588 | // |<----------------| | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2589 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2590 | // | | SubResp1 | |
| 2591 | // | |<-------------| |
| 2592 | // | RESTNotif1 | | |
| 2593 | // |<----------------| | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2594 | // | | | |
| 2595 | // | [SUBS DELETE] | |
| 2596 | // | | | |
| 2597 | // |
| 2598 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2599 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2600 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2601 | CaseBegin("TestRESTSubReqRetransmission") |
| 2602 | |
| 2603 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 2604 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 2605 | Counter{cRestSubRespToXapp, 2}, |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2606 | Counter{cSubReqToE2, 1}, |
| 2607 | Counter{cSubRespFromE2, 1}, |
| 2608 | Counter{cRestSubNotifToXapp, 1}, |
| 2609 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2610 | Counter{cSubDelReqToE2, 1}, |
| 2611 | Counter{cSubDelRespFromE2, 1}, |
| 2612 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2613 | }) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2614 | // Retry/duplicate will get the same way as the first request. |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2615 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2616 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2617 | |
| 2618 | // Subs Create |
| 2619 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2620 | |
| 2621 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2622 | // gets into execution before the rtmgrg responds for the first one. |
| 2623 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 2624 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2625 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2626 | xappConn2.SendRESTSubsReq(t, params) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2627 | |
| 2628 | waiter.WaitResult(t) |
| 2629 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2630 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2631 | |
| 2632 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2633 | // the order is not significant he6re. |
| 2634 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2635 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2636 | |
| 2637 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2638 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2639 | |
| 2640 | // Del1 |
| 2641 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2642 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2643 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2644 | |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 2645 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId}, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2646 | |
| 2647 | mainCtrl.VerifyCounterValues(t) |
| 2648 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 2649 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2650 | //----------------------------------------------------------------------------- |
| 2651 | // stub stub stub |
| 2652 | // +-------+ +---------+ +---------+ +---------+ |
| 2653 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2654 | // +-------+ +---------+ +---------+ +---------+ |
| 2655 | // | | | | |
| 2656 | // | RESTSubReq | | | |
| 2657 | // |---------------->| | | |
| 2658 | // | RESTSubResp | | | |
| 2659 | // |<----------------| | | |
| 2660 | // | | RouteCreate | | |
| 2661 | // | |--------------------------->| |
| 2662 | // | | RouteResponse| | |
| 2663 | // | |<---------------------------| // The order of these events may vary |
| 2664 | // | | SubReq | | |
| 2665 | // | |------------->| | // The order of these events may vary |
| 2666 | // | | SubResp | | |
| 2667 | // | |<-------------| | |
| 2668 | // | RESTNotif1 | | | |
| 2669 | // |<----------------| | | |
| 2670 | // | RESTSubReq | | | |
| 2671 | // | [RETRANS1] | | | |
| 2672 | // |---------------->| | | |
| 2673 | // | RESTNotif1 | | | |
| 2674 | // |<----------------| | | |
| 2675 | // | RESTSubReq | | | |
| 2676 | // | [RETRANS2] | | | |
| 2677 | // |---------------->| | | |
| 2678 | // | RESTNotif1 | | | |
| 2679 | // |<----------------| | | |
| 2680 | // | RESTSubDelReq | | | |
| 2681 | // |---------------->| | | |
| 2682 | // | | SubDelReq | | |
| 2683 | // | |------------->| | |
| 2684 | // | RESTSubDelResp| | | |
| 2685 | // |<----------------| | | |
| 2686 | // | | SubDelResp | | |
| 2687 | // | |<-------------| | |
| 2688 | // | | | | |
| 2689 | // |
| 2690 | //----------------------------------------------------------------------------- |
| 2691 | |
| 2692 | func TestRESTSubReqRetransmissionV2(t *testing.T) { |
| 2693 | CaseBegin("TestRESTSubReqRetransmissionV2") |
| 2694 | |
| 2695 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2696 | Counter{cRestSubReqFromXapp, 3}, |
| 2697 | Counter{cRestSubRespToXapp, 3}, |
| 2698 | Counter{cSubReqToE2, 1}, |
| 2699 | Counter{cSubRespFromE2, 1}, |
| 2700 | Counter{cRestSubNotifToXapp, 3}, |
| 2701 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2702 | Counter{cSubDelReqToE2, 1}, |
| 2703 | Counter{cSubDelRespFromE2, 1}, |
| 2704 | Counter{cRestSubDelRespToXapp, 1}, |
| 2705 | }) |
| 2706 | |
| 2707 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2708 | |
| 2709 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2710 | |
| 2711 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2712 | |
| 2713 | //1.st resend |
| 2714 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2715 | |
| 2716 | assert.Equal(t, restSubId_resend, restSubId) |
| 2717 | |
| 2718 | <-time.After(100 * time.Millisecond) |
| 2719 | |
| 2720 | //2.nd resend |
| 2721 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2722 | |
| 2723 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2724 | |
| 2725 | <-time.After(100 * time.Millisecond) |
| 2726 | |
| 2727 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2728 | |
| 2729 | waitSubsCleanup(t, e2SubsId, 10) |
| 2730 | |
| 2731 | //Wait that subs is cleaned |
| 2732 | mainCtrl.VerifyCounterValues(t) |
| 2733 | } |
| 2734 | |
| 2735 | //----------------------------------------------------------------------------- |
| 2736 | // stub stub stub |
| 2737 | // +-------+ +---------+ +---------+ +---------+ |
| 2738 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2739 | // +-------+ +---------+ +---------+ +---------+ |
| 2740 | // | | | | |
| 2741 | // | RESTSubReq | | | |
| 2742 | // |---------------->| | | |
| 2743 | // | RESTSubResp | | | |
| 2744 | // |<----------------| | | |
| 2745 | // | | RouteCreate | | |
| 2746 | // | |--------------------------->| |
| 2747 | // | | RouteResponse| | |
| 2748 | // | |<---------------------------| // The order of these events may vary |
| 2749 | // | | SubReq | | |
| 2750 | // | |------------->| | // The order of these events may vary |
| 2751 | // | | SubResp | | |
| 2752 | // | |<-------------| | |
| 2753 | // | RESTNotif1 | | | |
| 2754 | // |<----------------| | | |
| 2755 | // | RESTSubReq | | | |
| 2756 | // | [RETRANS, with RESTsubsId] | | |
| 2757 | // |---------------->| | | |
| 2758 | // | RESTNotif1 | | | |
| 2759 | // |<----------------| | | |
| 2760 | // | RESTSubReq | | | |
| 2761 | // | [RETRANS, without RESTsubsId] | | |
| 2762 | // |---------------->| | | |
| 2763 | // | RESTNotif1 | | | |
| 2764 | // |<----------------| | | |
| 2765 | // | RESTSubDelReq | | | |
| 2766 | // |---------------->| | | |
| 2767 | // | | SubDelReq | | |
| 2768 | // | |------------->| | |
| 2769 | // | RESTSubDelResp| | | |
| 2770 | // |<----------------| | | |
| 2771 | // | | SubDelResp | | |
| 2772 | // | |<-------------| | |
| 2773 | // | | | | |
| 2774 | // |
| 2775 | //----------------------------------------------------------------------------- |
| 2776 | func TestRESTSubReqRetransmissionV3(t *testing.T) { |
| 2777 | CaseBegin("TestRESTSubReqRetransmissionV3") |
| 2778 | |
| 2779 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2780 | Counter{cRestSubReqFromXapp, 3}, |
| 2781 | Counter{cRestSubRespToXapp, 3}, |
| 2782 | Counter{cSubReqToE2, 1}, |
| 2783 | Counter{cSubRespFromE2, 1}, |
| 2784 | Counter{cRestSubNotifToXapp, 3}, |
| 2785 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2786 | Counter{cSubDelReqToE2, 1}, |
| 2787 | Counter{cSubDelRespFromE2, 1}, |
| 2788 | Counter{cRestSubDelRespToXapp, 1}, |
| 2789 | }) |
| 2790 | |
| 2791 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2792 | |
| 2793 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2794 | |
| 2795 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2796 | |
| 2797 | <-time.After(100 * time.Millisecond) |
| 2798 | |
| 2799 | //1.st resend with subscription ID |
| 2800 | params.SetSubscriptionID(&restSubId) |
| 2801 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params) |
| 2802 | |
| 2803 | assert.Equal(t, restSubId_resend, restSubId) |
| 2804 | |
| 2805 | <-time.After(100 * time.Millisecond) |
| 2806 | |
| 2807 | //2.nd resend without subscription ID (faking app restart) |
| 2808 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2809 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2810 | |
| 2811 | assert.Equal(t, restSubId_resend2, restSubId) |
| 2812 | |
| 2813 | <-time.After(100 * time.Millisecond) |
| 2814 | |
| 2815 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2816 | |
| 2817 | waitSubsCleanup(t, e2SubsId, 10) |
| 2818 | |
| 2819 | //Wait that subs is cleaned |
| 2820 | mainCtrl.VerifyCounterValues(t) |
| 2821 | } |
| 2822 | |
| 2823 | //----------------------------------------------------------------------------- |
| 2824 | // stub stub stub |
| 2825 | // +-------+ +---------+ +---------+ +---------+ |
| 2826 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2827 | // +-------+ +---------+ +---------+ +---------+ |
| 2828 | // | | | | |
| 2829 | // | RESTSubReq | | | |
| 2830 | // |---------------->| | | |
| 2831 | // | RESTSubResp | | | |
| 2832 | // |<----------------| | | |
| 2833 | // | | RouteCreate | | |
| 2834 | // | |--------------------------->| |
| 2835 | // | | RouteResponse| | |
| 2836 | // | |<---------------------------| |
| 2837 | // | | SubReq | | |
| 2838 | // | |------------->| | |
| 2839 | // | | SubResp | | |
| 2840 | // | |<-------------| | |
| 2841 | // | RESTNotif1 | | | |
| 2842 | // |<----------------| | | |
| 2843 | // | RESTSubReq | | | |
| 2844 | // | [with RestSUbsId + one additional e2 subDetail] |
| 2845 | // |---------------->| | | |
| 2846 | // | RESTNotif1 | | | |
| 2847 | // | [for initial e2 subDetail] | | |
| 2848 | // |<----------------| | | |
| 2849 | // | | RouteCreate | | |
| 2850 | // | |--------------------------->| |
| 2851 | // | | RouteResponse| | |
| 2852 | // | |<---------------------------| |
| 2853 | // | | SubReq | | |
| 2854 | // | |------------->| | |
| 2855 | // | | SubResp | | |
| 2856 | // | |<-------------| | |
| 2857 | // | RESTNotif1 | | | |
| 2858 | // |<----------------| | | |
| 2859 | // | RESTSubReq | | | |
| 2860 | // | [with RESTsubsId initial request] | |
| 2861 | // |---------------->| | | |
| 2862 | // | RESTNotif1 | | | |
| 2863 | // |<----------------| | | |
| 2864 | // | RESTSubDelReq | | | |
| 2865 | // |---------------->| | | |
| 2866 | // | RESTSubDelResp| | | |
| 2867 | // |<----------------| | | |
| 2868 | // | | SubDelReq | | |
| 2869 | // | |------------->| | |
| 2870 | // | | SubDelResp | | |
| 2871 | // | |<-------------| | |
| 2872 | // | | SubDelReq | | |
| 2873 | // | |------------->| | |
| 2874 | // | | SubDelResp | | |
| 2875 | // | |<-------------| | |
| 2876 | // | | | | |
| 2877 | // |
| 2878 | //----------------------------------------------------------------------------- |
| 2879 | |
| 2880 | func TestRESTSubReqRetransmissionV4(t *testing.T) { |
| 2881 | CaseBegin("TestRESTSubReqRetransmissionV4") |
| 2882 | |
| 2883 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2884 | Counter{cRestSubReqFromXapp, 3}, |
| 2885 | Counter{cRestSubRespToXapp, 3}, |
| 2886 | Counter{cSubReqToE2, 2}, |
| 2887 | Counter{cSubRespFromE2, 2}, |
| 2888 | Counter{cRestSubNotifToXapp, 4}, |
| 2889 | Counter{cRestSubDelReqFromXapp, 1}, |
| 2890 | Counter{cSubDelReqToE2, 2}, |
| 2891 | Counter{cSubDelRespFromE2, 2}, |
| 2892 | Counter{cRestSubDelRespToXapp, 1}, |
| 2893 | }) |
| 2894 | |
| 2895 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2896 | |
| 2897 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2898 | |
| 2899 | <-time.After(100 * time.Millisecond) |
| 2900 | |
| 2901 | // Send modified requst, this time with e2 subscriptions. |
| 2902 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 2903 | params2.SetSubscriptionID(&restSubId) |
| 2904 | |
| 2905 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2906 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2907 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 2908 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2909 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 2910 | assert.Equal(t, e2SubsId, e2SubsId1) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2911 | |
| 2912 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2913 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2914 | xappConn1.DecrementRequestCount() |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2915 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 2916 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2917 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 2918 | assert.NotEqual(t, e2SubsId2, 0) |
| 2919 | |
| 2920 | <-time.After(100 * time.Millisecond) |
| 2921 | |
| 2922 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 2923 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 2924 | params.SetSubscriptionID(&restSubId) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2925 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2926 | // Resend the original request again with only one e2 subscription (detail), this time with restsubsid |
| 2927 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 2928 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 2929 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 2930 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 2931 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 2932 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 2933 | // Delete both e2 subscriptions |
| 2934 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2935 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 2936 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 2937 | |
| 2938 | waitSubsCleanup(t, e2SubsId, 10) |
| 2939 | |
| 2940 | //Wait that subs is cleaned |
| 2941 | mainCtrl.VerifyCounterValues(t) |
| 2942 | } |
| 2943 | |
| 2944 | //----------------------------------------------------------------------------- |
| 2945 | // stub stub stub |
| 2946 | // +-------+ +---------+ +---------+ +---------+ |
| 2947 | // | xapp | | submgr | | e2term | | rtmgr | |
| 2948 | // +-------+ +---------+ +---------+ +---------+ |
| 2949 | // | | | | |
| 2950 | // | RESTSubReq | | | |
| 2951 | // |---------------->| | | |
| 2952 | // | RESTSubResp | | | |
| 2953 | // |<----------------| | | |
| 2954 | // | | RouteCreate | | |
| 2955 | // | |--------------------------->| |
| 2956 | // | | RouteResponse| | |
| 2957 | // | |<---------------------------| |
| 2958 | // | | SubReq | | |
| 2959 | // | |------------->| | |
| 2960 | // | | SubResp | | |
| 2961 | // | |<-------------| | |
| 2962 | // | RESTNotif1 | | | |
| 2963 | // |<----------------| | | |
| 2964 | // | RESTSubReq | | | |
| 2965 | // | [with RestSUbsId + one additional e2 subDetail] |
| 2966 | // |---------------->| | | |
| 2967 | // | RESTNotif1 | | | |
| 2968 | // | [for initial e2 subDetail] | | |
| 2969 | // |<----------------| | | |
| 2970 | // | | RouteCreate | | |
| 2971 | // | |--------------------------->| |
| 2972 | // | | RouteResponse| | |
| 2973 | // | |<---------------------------| |
| 2974 | // | | SubReq | | |
| 2975 | // | |------------->| | |
| 2976 | // | | SubResp | | |
| 2977 | // | |<-------------| | |
| 2978 | // | RESTNotif1 | | | |
| 2979 | // |<----------------| | | |
| 2980 | // | RESTSubReq | | | |
| 2981 | // | [without RESTsubsId initial request] | |
| 2982 | // |---------------->| | | |
| 2983 | // | RESTNotif1 | | | |
| 2984 | // |<----------------| | | |
| 2985 | // | RESTSubDelReq | | | |
| 2986 | // |---------------->| | | |
| 2987 | // | RESTSubDelResp| | | |
| 2988 | // |<----------------| | | |
| 2989 | // | | SubDelReq | | |
| 2990 | // | |------------->| | |
| 2991 | // | | SubDelResp | | |
| 2992 | // | |<-------------| | |
| 2993 | // | | SubDelReq | | |
| 2994 | // | |------------->| | |
| 2995 | // | | SubDelResp | | |
| 2996 | // | |<-------------| | |
| 2997 | // | | | | |
| 2998 | // |
| 2999 | //----------------------------------------------------------------------------- |
| 3000 | |
| 3001 | func TestRESTSubReqRetransmissionV5(t *testing.T) { |
| 3002 | CaseBegin("TestRESTSubReqRetransmissionV5") |
| 3003 | |
| 3004 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3005 | Counter{cRestSubReqFromXapp, 3}, |
| 3006 | Counter{cRestSubRespToXapp, 3}, |
| 3007 | Counter{cSubReqToE2, 2}, |
| 3008 | Counter{cSubRespFromE2, 2}, |
| 3009 | Counter{cRestSubNotifToXapp, 4}, |
| 3010 | Counter{cRestSubDelReqFromXapp, 1}, |
| 3011 | Counter{cSubDelReqToE2, 2}, |
| 3012 | Counter{cSubDelRespFromE2, 2}, |
| 3013 | Counter{cRestSubDelRespToXapp, 1}, |
| 3014 | }) |
| 3015 | |
| 3016 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3017 | |
| 3018 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3019 | |
| 3020 | <-time.After(100 * time.Millisecond) |
| 3021 | |
| 3022 | // Send modified requst, this time with e2 subscriptions. |
| 3023 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3024 | params2.SetSubscriptionID(&restSubId) |
| 3025 | |
| 3026 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3027 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3028 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3029 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3030 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3031 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3032 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3033 | // The first E2 subscription returns immediately, manually decrement expected request count for the remaining request handling |
| 3034 | xappConn1.DecrementRequestCount() |
| 3035 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3036 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3037 | |
| 3038 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3039 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3040 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3041 | assert.NotEqual(t, e2SubsId2, 0) |
| 3042 | |
| 3043 | <-time.After(100 * time.Millisecond) |
| 3044 | |
| 3045 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
| 3046 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3047 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3048 | // Resend the original request again with only one e2 subscription (detail), WITHOUT restsubsid |
| 3049 | // md5sum shall find the original request |
| 3050 | restSubId_resend2 := xappConn1.SendRESTSubsReq(t, params) |
| 3051 | assert.Equal(t, restSubId_resend, restSubId_resend2) |
| 3052 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3053 | e2SubsId1 = xappConn1.WaitAnyRESTNotification(t) |
| 3054 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3055 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3056 | // Delete both e2 subscriptions |
| 3057 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3058 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3059 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3060 | |
| 3061 | waitSubsCleanup(t, e2SubsId, 10) |
| 3062 | |
| 3063 | //Wait that subs is cleaned |
| 3064 | mainCtrl.VerifyCounterValues(t) |
| 3065 | } |
| 3066 | |
| 3067 | //----------------------------------------------------------------------------- |
| 3068 | // stub stub stub |
| 3069 | // +-------+ +---------+ +---------+ +---------+ |
| 3070 | // | xapp | | submgr | | e2term | | rtmgr | |
| 3071 | // +-------+ +---------+ +---------+ +---------+ |
| 3072 | // | | | | |
| 3073 | // | RESTSubReq | | | |
| 3074 | // |---------------->| | | |
| 3075 | // | RESTSubResp | | | |
| 3076 | // |<----------------| | | |
| 3077 | // | | RouteCreate | | |
| 3078 | // | |--------------------------->| |
| 3079 | // | | RouteResponse| | |
| 3080 | // | |<---------------------------| |
| 3081 | // | | SubReq | | |
| 3082 | // | |------------->| | |
| 3083 | // | | SubResp | | |
| 3084 | // | |<-------------| | |
| 3085 | // | RESTNotif1 | | | |
| 3086 | // |<----------------| | | |
| 3087 | // | RESTSubReq | | | |
| 3088 | // | [with RestSUbsId + one additional e2 subDetail] |
| 3089 | // |---------------->| | | |
| 3090 | // | RESTNotif1 | | | |
| 3091 | // | [for initial e2 subDetail] | | |
| 3092 | // |<----------------| | | |
| 3093 | // | | RouteCreate | | |
| 3094 | // | |--------------------------->| |
| 3095 | // | | RouteResponse| | |
| 3096 | // | |<---------------------------| |
| 3097 | // | | SubReq | | |
| 3098 | // | |------------->| | |
| 3099 | // | | SubResp | | |
| 3100 | // | |<-------------| | |
| 3101 | // | RESTNotif1 | | | |
| 3102 | // |<----------------| | | |
| 3103 | // | RESTSubDelReq | | | |
| 3104 | // |---------------->| | | |
| 3105 | // | RESTSubDelResp| | | |
| 3106 | // |<----------------| | | |
| 3107 | // | | SubDelReq | | |
| 3108 | // | |------------->| | |
| 3109 | // | | SubDelResp | | |
| 3110 | // | |<-------------| | |
| 3111 | // | | SubDelReq | | |
| 3112 | // | |------------->| | |
| 3113 | // | | SubDelResp | | |
| 3114 | // | |<-------------| | |
| 3115 | // | RESTSubReq | | | |
| 3116 | // | [with RESTsubsId initial request] | |
| 3117 | // |---------------->| | | |
| 3118 | // | RESTSubResp | | | |
| 3119 | // |<----------------| | | |
| 3120 | // | | RouteCreate | | |
| 3121 | // | |--------------------------->| |
| 3122 | // | | RouteResponse| | |
| 3123 | // | |<---------------------------| |
| 3124 | // | | SubReq | | |
| 3125 | // | |------------->| | |
| 3126 | // | | SubResp | | |
| 3127 | // | |<-------------| | |
| 3128 | // | RESTNotif1 | | | |
| 3129 | // |<----------------| | | |
| 3130 | // | | | | |
| 3131 | // |
| 3132 | //----------------------------------------------------------------------------- |
| 3133 | func TestRESTSubReqRetransmissionV6(t *testing.T) { |
| 3134 | CaseBegin("TestRESTSubReqRetransmissionV6") |
| 3135 | |
| 3136 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3137 | Counter{cRestSubReqFromXapp, 3}, |
| 3138 | Counter{cRestSubRespToXapp, 3}, |
| 3139 | Counter{cSubReqToE2, 3}, |
| 3140 | Counter{cSubRespFromE2, 3}, |
| 3141 | Counter{cRestSubNotifToXapp, 4}, |
| 3142 | Counter{cRestSubDelReqFromXapp, 2}, |
| 3143 | Counter{cSubDelReqToE2, 3}, |
| 3144 | Counter{cSubDelRespFromE2, 3}, |
| 3145 | Counter{cRestSubDelRespToXapp, 2}, |
| 3146 | }) |
| 3147 | |
| 3148 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
| 3149 | |
| 3150 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3151 | |
| 3152 | <-time.After(100 * time.Millisecond) |
| 3153 | |
| 3154 | // Send modified requst, this time with e2 subscriptions. |
| 3155 | params2 := xappConn1.GetRESTSubsReqReportParams(subReqCount + 1) |
| 3156 | params2.SetSubscriptionID(&restSubId) |
| 3157 | |
| 3158 | xapp.Subscription.SetResponseCB(xappConn1.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3159 | xappConn1.ExpectAnyNotification(t) |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3160 | // Resend the original request with an additional e2 subscription (detail), this time with restsubsid |
| 3161 | restSubId_resend := xappConn1.SendRESTSubsReq(t, params2) |
| 3162 | |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3163 | e2SubsId1 := xappConn1.WaitAnyRESTNotification(t) |
| 3164 | assert.Equal(t, e2SubsId, e2SubsId1) |
| 3165 | |
Markku Virtanen | 42723e2 | 2021-06-15 10:09:23 +0300 | [diff] [blame] | 3166 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3167 | |
| 3168 | xappConn1.ExpectRESTNotification(t, restSubId_resend) |
| 3169 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3170 | e2SubsId2 := xappConn1.WaitRESTNotification(t, restSubId_resend) |
| 3171 | assert.NotEqual(t, e2SubsId2, 0) |
| 3172 | |
| 3173 | <-time.After(100 * time.Millisecond) |
| 3174 | |
| 3175 | // Delete both e2 subscriptions |
| 3176 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3177 | e2SubsIds := []uint32{e2SubsId, e2SubsId2} |
| 3178 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 3179 | |
| 3180 | waitSubsCleanup(t, e2SubsId, 10) |
| 3181 | |
| 3182 | // Resend the original request, we shall find it's previous md5sum/restsubs |
| 3183 | // but the restsubscription has been already removed. This shall trigger a |
| 3184 | // fresh create. |
| 3185 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3186 | |
| 3187 | <-time.After(100 * time.Millisecond) |
| 3188 | |
| 3189 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3190 | |
| 3191 | waitSubsCleanup(t, e2SubsId, 10) |
| 3192 | |
| 3193 | //Wait that subs is cleaned |
| 3194 | mainCtrl.VerifyCounterValues(t) |
| 3195 | } |
| 3196 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3197 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 3198 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 3199 | |
| 3200 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3201 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3202 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3203 | Counter{cSubReqToE2, 1}, |
| 3204 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3205 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3206 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3207 | Counter{cSubDelReqToE2, 1}, |
| 3208 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3209 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3210 | }) |
| 3211 | |
| 3212 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3213 | |
| 3214 | //Subs Create |
| 3215 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3216 | |
| 3217 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3218 | |
| 3219 | //Subs Delete |
| 3220 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3221 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3222 | |
| 3223 | seqBef := mainCtrl.get_msgcounter(t) |
| 3224 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3225 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 3226 | |
| 3227 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3228 | |
| 3229 | waitSubsCleanup(t, e2SubsId, 10) |
| 3230 | |
| 3231 | mainCtrl.VerifyCounterValues(t) |
| 3232 | } |
| 3233 | |
| 3234 | //----------------------------------------------------------------------------- |
| 3235 | // TestRESTSubReqDelReq |
| 3236 | // |
| 3237 | // stub stub |
| 3238 | // +-------+ +---------+ +---------+ |
| 3239 | // | xapp | | submgr | | e2term | |
| 3240 | // +-------+ +---------+ +---------+ |
| 3241 | // | | | |
| 3242 | // | RESTSubReq | | |
| 3243 | // |---------------->| | |
| 3244 | // | | | |
| 3245 | // | RESTSubResp | | |
| 3246 | // |<----------------| | |
| 3247 | // | | SubReq | |
| 3248 | // | |------------->| |
| 3249 | // | RESTSubDelReq | | |
| 3250 | // |---------------->| | |
| 3251 | // | RESTSubDelResp | | |
| 3252 | // | unsuccess | | |
| 3253 | // |<----------------| | |
| 3254 | // | | SubResp | |
| 3255 | // | |<-------------| |
| 3256 | // | RESTNotif1 | | |
| 3257 | // |<----------------| | |
| 3258 | // | | | |
| 3259 | // | [SUBS DELETE] | |
| 3260 | // | | | |
| 3261 | // |
| 3262 | //----------------------------------------------------------------------------- |
| 3263 | func TestRESTSubReqDelReq(t *testing.T) { |
| 3264 | CaseBegin("TestRESTSubReqDelReq") |
| 3265 | |
| 3266 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3267 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3268 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3269 | Counter{cSubReqToE2, 1}, |
| 3270 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3271 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3272 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3273 | Counter{cSubDelReqToE2, 1}, |
| 3274 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3275 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3276 | }) |
| 3277 | |
| 3278 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3279 | |
| 3280 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3281 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3282 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3283 | |
| 3284 | // Del. This will fail as processing of the subscription |
| 3285 | // is still ongoing in submgr. Deletion is not allowed before |
| 3286 | // subscription creation has been completed. |
| 3287 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3288 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3289 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3290 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3291 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3292 | |
| 3293 | // Retry del |
| 3294 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3295 | |
| 3296 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3297 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3298 | |
| 3299 | // Wait that subs is cleaned |
| 3300 | waitSubsCleanup(t, e2SubsId, 10) |
| 3301 | mainCtrl.VerifyCounterValues(t) |
| 3302 | |
| 3303 | } |
| 3304 | |
| 3305 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 3306 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 3307 | } |
| 3308 | |
| 3309 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 3310 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 3311 | |
| 3312 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3313 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3314 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3315 | Counter{cSubReqToE2, 2}, |
| 3316 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3317 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3318 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3319 | Counter{cSubDelReqToE2, 2}, |
| 3320 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3321 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3322 | }) |
| 3323 | |
| 3324 | //Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3325 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3326 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3327 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 3328 | |
| 3329 | //Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3330 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3331 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 3332 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 3333 | |
| 3334 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3335 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3336 | |
| 3337 | //XappConn1 receives both of the responses |
| 3338 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3339 | |
| 3340 | //Resp1 |
| 3341 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3342 | //Resp2 |
| 3343 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3344 | |
| 3345 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3346 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3347 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3348 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 3349 | |
| 3350 | //Del1 |
| 3351 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3352 | //Del2 |
| 3353 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 3354 | |
| 3355 | //Wait that subs is cleaned |
| 3356 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 3357 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3358 | |
| 3359 | mainCtrl.VerifyCounterValues(t) |
| 3360 | |
| 3361 | } |
| 3362 | |
| 3363 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 3364 | CaseBegin("TestRESTSameSubsDiffRan") |
| 3365 | |
| 3366 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3367 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3368 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3369 | Counter{cSubReqToE2, 2}, |
| 3370 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3371 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3372 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3373 | Counter{cSubDelReqToE2, 2}, |
| 3374 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3375 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3376 | }) |
| 3377 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3378 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3379 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3380 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 3381 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3382 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3383 | params.SetMeid("RAN_NAME_2") |
| 3384 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3385 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 3386 | |
| 3387 | //Del1 |
| 3388 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 3389 | //Del2 |
| 3390 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 3391 | |
| 3392 | //Wait that subs is cleaned |
| 3393 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3394 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3395 | |
| 3396 | mainCtrl.VerifyCounterValues(t) |
| 3397 | |
| 3398 | } |
| 3399 | |
| 3400 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 3401 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 3402 | |
| 3403 | // Init counter check |
| 3404 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3405 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3406 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3407 | Counter{cSubReqToE2, 1}, |
| 3408 | Counter{cSubReReqToE2, 1}, |
| 3409 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3410 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3411 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3412 | Counter{cSubDelReqToE2, 1}, |
| 3413 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3414 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3415 | }) |
| 3416 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3417 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3418 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3419 | |
| 3420 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3421 | |
| 3422 | // Catch the first message and ignore it |
| 3423 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 3424 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 3425 | |
| 3426 | // The second request is being handled normally |
| 3427 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 3428 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3429 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 3430 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3431 | |
| 3432 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3433 | |
| 3434 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 3435 | |
| 3436 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 3437 | //Wait that subs is cleaned |
| 3438 | waitSubsCleanup(t, e2SubsId, 10) |
| 3439 | |
| 3440 | mainCtrl.VerifyCounterValues(t) |
| 3441 | |
| 3442 | } |
| 3443 | |
| 3444 | //----------------------------------------------------------------------------- |
| 3445 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3446 | // |
| 3447 | // stub stub |
| 3448 | // +-------+ +---------+ +---------+ |
| 3449 | // | xapp | | submgr | | e2term | |
| 3450 | // +-------+ +---------+ +---------+ |
| 3451 | // | | | |
| 3452 | // | RESTSubReq | | |
| 3453 | // |---------------->| | |
| 3454 | // | | | |
| 3455 | // | RESTSubResp | | |
| 3456 | // |<----------------| | |
| 3457 | // | | SubReq | |
| 3458 | // | |------------->| |
| 3459 | // | | | |
| 3460 | // | | | |
| 3461 | // | | SubReq | |
| 3462 | // | |------------->| |
| 3463 | // | | | |
| 3464 | // | | SubDelReq | |
| 3465 | // | |------------->| |
| 3466 | // | | | |
| 3467 | // | | | |
| 3468 | // | | SubDelReq | |
| 3469 | // | |------------->| |
| 3470 | // | | | |
| 3471 | // | | | |
| 3472 | // | | SubDelResp | |
| 3473 | // | |<-------------| |
| 3474 | // | RESTNotif | | |
| 3475 | // | unsuccess | | |
| 3476 | // |<----------------| | |
| 3477 | // | | | |
| 3478 | // | [SUBS DELETE] | |
| 3479 | // | | | |
| 3480 | // |
| 3481 | //----------------------------------------------------------------------------- |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3482 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3483 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 3484 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 3485 | |
| 3486 | // Init counter check |
| 3487 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3488 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3489 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3490 | Counter{cSubReqToE2, 1}, |
| 3491 | Counter{cSubReReqToE2, 1}, |
| 3492 | Counter{cSubReqTimerExpiry, 2}, |
| 3493 | Counter{cSubDelReqToE2, 1}, |
| 3494 | Counter{cSubDelRespFromE2, 1}, |
| 3495 | }) |
| 3496 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3497 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3498 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3499 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3500 | |
| 3501 | e2termConn1.RecvSubsReq(t) |
| 3502 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3503 | |
| 3504 | e2termConn1.RecvSubsReq(t) |
| 3505 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3506 | |
| 3507 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3508 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3509 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3510 | xappConn1.WaitRESTNotification(t, restSubId) |
| 3511 | |
| 3512 | // Wait that subs is cleaned |
| 3513 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 3514 | |
| 3515 | mainCtrl.VerifyCounterValues(t) |
| 3516 | } |
| 3517 | |
| 3518 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 3519 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 3520 | |
| 3521 | // Init counter check |
| 3522 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3523 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3524 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3525 | Counter{cSubReqToE2, 1}, |
| 3526 | Counter{cSubReReqToE2, 1}, |
| 3527 | Counter{cSubReqTimerExpiry, 2}, |
| 3528 | Counter{cSubDelReqToE2, 1}, |
| 3529 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3530 | }) |
| 3531 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3532 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3533 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3534 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3535 | |
| 3536 | e2termConn1.RecvSubsReq(t) |
| 3537 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3538 | |
| 3539 | e2termConn1.RecvSubsReq(t) |
| 3540 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3541 | |
| 3542 | e2termConn1.RecvSubsDelReq(t) |
| 3543 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3544 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3545 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3546 | e2termConn1.RecvSubsDelReq(t) |
| 3547 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3548 | |
| 3549 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3550 | |
| 3551 | waitSubsCleanup(t, e2SubsId, 10) |
| 3552 | |
| 3553 | mainCtrl.VerifyCounterValues(t) |
| 3554 | |
| 3555 | } |
| 3556 | |
| 3557 | //----------------------------------------------------------------------------- |
| 3558 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 3559 | // |
| 3560 | // stub stub |
| 3561 | // +-------+ +---------+ +---------+ |
| 3562 | // | xapp | | submgr | | e2term | |
| 3563 | // +-------+ +---------+ +---------+ |
| 3564 | // | | | |
| 3565 | // | RESTSubReq | | |
| 3566 | // |---------------->| | |
| 3567 | // | | | |
| 3568 | // | RESTSubResp | | |
| 3569 | // |<----------------| | |
| 3570 | // | | SubReq | |
| 3571 | // | |------------->| |
| 3572 | // | | | |
| 3573 | // | | | |
| 3574 | // | | SubReq | |
| 3575 | // | |------------->| |
| 3576 | // | | | |
| 3577 | // | | SubDelReq | |
| 3578 | // | |------------->| |
| 3579 | // | | | |
| 3580 | // | | | |
| 3581 | // | | SubDelReq | |
| 3582 | // | |------------->| |
| 3583 | // | | | |
| 3584 | // | | | |
| 3585 | // | | SubDelResp | |
| 3586 | // | |<-------------| |
| 3587 | // | RESTNotif | | |
| 3588 | // | unsuccess | | |
| 3589 | // |<----------------| | |
| 3590 | // | | | |
| 3591 | // | [SUBS DELETE] | |
| 3592 | // | | | |
| 3593 | // |
| 3594 | //----------------------------------------------------------------------------- |
| 3595 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 3596 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 3597 | |
| 3598 | // Init counter check |
| 3599 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3600 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3601 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3602 | Counter{cSubReqToE2, 1}, |
| 3603 | Counter{cSubReReqToE2, 1}, |
| 3604 | Counter{cSubReqTimerExpiry, 2}, |
| 3605 | Counter{cSubDelReqToE2, 1}, |
| 3606 | Counter{cSubDelReReqToE2, 1}, |
| 3607 | Counter{cSubDelReqTimerExpiry, 2}, |
| 3608 | }) |
| 3609 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3610 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3611 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3612 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3613 | |
| 3614 | e2termConn1.RecvSubsReq(t) |
| 3615 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 3616 | |
| 3617 | e2termConn1.RecvSubsReq(t) |
| 3618 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 3619 | |
| 3620 | e2termConn1.RecvSubsDelReq(t) |
| 3621 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 3622 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3623 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3624 | e2termConn1.RecvSubsDelReq(t) |
| 3625 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 3626 | |
| 3627 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3628 | |
| 3629 | waitSubsCleanup(t, e2SubsId, 10) |
| 3630 | |
| 3631 | mainCtrl.VerifyCounterValues(t) |
| 3632 | } |
| 3633 | |
| 3634 | //----------------------------------------------------------------------------- |
| 3635 | // TestRESTSubReqSubFailRespInSubmgr |
| 3636 | // |
| 3637 | // stub stub |
| 3638 | // +-------+ +---------+ +---------+ |
| 3639 | // | xapp | | submgr | | e2term | |
| 3640 | // +-------+ +---------+ +---------+ |
| 3641 | // | | | |
| 3642 | // | RESTSubReq | | |
| 3643 | // |---------------->| | |
| 3644 | // | | | |
| 3645 | // | RESTSubResp | | |
| 3646 | // |<----------------| | |
| 3647 | // | | SubReq | |
| 3648 | // | |------------->| |
| 3649 | // | | | |
| 3650 | // | | SubFail | |
| 3651 | // | |<-------------| |
| 3652 | // | | | |
| 3653 | // | | SubDelReq | |
| 3654 | // | |------------->| |
| 3655 | // | | | |
| 3656 | // | | SubDelResp | |
| 3657 | // | |<-------------| |
| 3658 | // | | | |
| 3659 | // | RESTNotif | | |
| 3660 | // | unsuccess | | |
| 3661 | // |<----------------| | |
| 3662 | // | | | |
| 3663 | // | [SUBS DELETE] | |
| 3664 | // | | | |
| 3665 | // |
| 3666 | //----------------------------------------------------------------------------- |
| 3667 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 3668 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 3669 | |
| 3670 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3671 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3672 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3673 | Counter{cSubReqToE2, 1}, |
| 3674 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3675 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3676 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3677 | }) |
| 3678 | |
| 3679 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3680 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3681 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3682 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3683 | |
| 3684 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3685 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3686 | fparams1.Set(crereq1) |
| 3687 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3688 | |
| 3689 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 3690 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3691 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3692 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3693 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 3694 | |
| 3695 | // REST subscription sill there to be deleted |
| 3696 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3697 | |
| 3698 | // Wait that subs is cleaned |
| 3699 | waitSubsCleanup(t, e2SubsId, 10) |
| 3700 | |
| 3701 | mainCtrl.VerifyCounterValues(t) |
| 3702 | |
| 3703 | } |
| 3704 | |
| 3705 | //----------------------------------------------------------------------------- |
| 3706 | // TestRESTSubDelReqRetryInSubmgr |
| 3707 | // |
| 3708 | // stub stub |
| 3709 | // +-------+ +---------+ +---------+ |
| 3710 | // | xapp | | submgr | | e2term | |
| 3711 | // +-------+ +---------+ +---------+ |
| 3712 | // | | | |
| 3713 | // | [SUBS CREATE] | |
| 3714 | // | | | |
| 3715 | // | | | |
| 3716 | // | RESTSubDelReq | | |
| 3717 | // |---------------->| | |
| 3718 | // | | | |
| 3719 | // | RESTSubDelResp | | |
| 3720 | // |<----------------| | |
| 3721 | // | | SubDelReq | |
| 3722 | // | |------------->| |
| 3723 | // | | | |
| 3724 | // | | SubDelReq | |
| 3725 | // | |------------->| |
| 3726 | // | | | |
| 3727 | // | | SubDelResp | |
| 3728 | // | |<-------------| |
| 3729 | // | | | |
| 3730 | // |
| 3731 | //----------------------------------------------------------------------------- |
| 3732 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3733 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3734 | |
| 3735 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3736 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3737 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3738 | Counter{cSubReqToE2, 1}, |
| 3739 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3740 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3741 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3742 | Counter{cSubDelReqToE2, 1}, |
| 3743 | Counter{cSubDelReReqToE2, 1}, |
| 3744 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3745 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3746 | }) |
| 3747 | // Req |
| 3748 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3749 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3750 | |
| 3751 | // Del |
| 3752 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3753 | |
| 3754 | // E2t: Receive 1st SubsDelReq |
| 3755 | e2termConn1.RecvSubsDelReq(t) |
| 3756 | |
| 3757 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3758 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3759 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3760 | |
| 3761 | //Wait that subs is cleaned |
| 3762 | waitSubsCleanup(t, e2SubsId, 10) |
| 3763 | |
| 3764 | mainCtrl.VerifyCounterValues(t) |
| 3765 | } |
| 3766 | |
| 3767 | //----------------------------------------------------------------------------- |
| 3768 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3769 | // |
| 3770 | // stub stub |
| 3771 | // +-------+ +---------+ +---------+ |
| 3772 | // | xapp | | submgr | | e2term | |
| 3773 | // +-------+ +---------+ +---------+ |
| 3774 | // | | | |
| 3775 | // | [SUBS CREATE] | |
| 3776 | // | | | |
| 3777 | // | | | |
| 3778 | // | RESTSubDelReq | | |
| 3779 | // |---------------->| | |
| 3780 | // | | | |
| 3781 | // | RESTSubDelResp | | |
| 3782 | // |<----------------| | |
| 3783 | // | | SubDelReq | |
| 3784 | // | |------------->| |
| 3785 | // | | | |
| 3786 | // | | SubDelReq | |
| 3787 | // | |------------->| |
| 3788 | // | | | |
| 3789 | // | | | |
| 3790 | // |
| 3791 | //----------------------------------------------------------------------------- |
| 3792 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3793 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3794 | |
| 3795 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3796 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3797 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3798 | Counter{cSubReqToE2, 1}, |
| 3799 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3800 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3801 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3802 | Counter{cSubDelReqToE2, 1}, |
| 3803 | Counter{cSubDelReReqToE2, 1}, |
| 3804 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3805 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3806 | }) |
| 3807 | |
| 3808 | // Req |
| 3809 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3810 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3811 | |
| 3812 | // Del |
| 3813 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3814 | |
| 3815 | // E2t: Receive 1st SubsDelReq |
| 3816 | e2termConn1.RecvSubsDelReq(t) |
| 3817 | |
| 3818 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3819 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3820 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3821 | |
| 3822 | //Wait that subs is cleaned |
| 3823 | waitSubsCleanup(t, e2SubsId, 10) |
| 3824 | |
| 3825 | mainCtrl.VerifyCounterValues(t) |
| 3826 | } |
| 3827 | |
| 3828 | //----------------------------------------------------------------------------- |
| 3829 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3830 | // |
| 3831 | // stub stub |
| 3832 | // +-------+ +---------+ +---------+ |
| 3833 | // | xapp | | submgr | | e2term | |
| 3834 | // +-------+ +---------+ +---------+ |
| 3835 | // | | | |
| 3836 | // | [SUBS CREATE] | |
| 3837 | // | | | |
| 3838 | // | | | |
| 3839 | // | RESTSubDelReq | | |
| 3840 | // |---------------->| | |
| 3841 | // | | | |
| 3842 | // | RESTSubDelResp | | |
| 3843 | // |<----------------| | |
| 3844 | // | | SubDelReq | |
| 3845 | // | |------------->| |
| 3846 | // | | | |
| 3847 | // | | SubDelFail | |
| 3848 | // | |<-------------| |
| 3849 | // | | | |
| 3850 | // |
| 3851 | //----------------------------------------------------------------------------- |
| 3852 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3853 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3854 | |
| 3855 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3856 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3857 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3858 | Counter{cSubReqToE2, 1}, |
| 3859 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3860 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3861 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3862 | Counter{cSubDelReqToE2, 1}, |
| 3863 | Counter{cSubDelFailFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3864 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3865 | }) |
| 3866 | |
| 3867 | // Req |
| 3868 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3869 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3870 | |
| 3871 | // Del |
| 3872 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3873 | |
| 3874 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3875 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3876 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3877 | |
| 3878 | //Wait that subs is cleaned |
| 3879 | waitSubsCleanup(t, e2SubsId, 10) |
| 3880 | |
| 3881 | mainCtrl.VerifyCounterValues(t) |
| 3882 | } |
| 3883 | |
| 3884 | //----------------------------------------------------------------------------- |
| 3885 | // TestRESTSubReqAndSubDelOkSameAction |
| 3886 | // |
| 3887 | // stub stub |
| 3888 | // +-------+ +-------+ +---------+ +---------+ |
| 3889 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3890 | // +-------+ +-------+ +---------+ +---------+ |
| 3891 | // | | | | |
| 3892 | // | | RESTSubReq1 | | |
| 3893 | // | |---------------->| | |
| 3894 | // | | | | |
| 3895 | // | | RESTSubResp1 | | |
| 3896 | // | |<----------------| | |
| 3897 | // | | | | |
| 3898 | // | | | SubReq1 | |
| 3899 | // | | |------------->| |
| 3900 | // | | | SubResp1 | |
| 3901 | // | | |<-------------| |
| 3902 | // | | RESTNotif1 | | |
| 3903 | // | |<----------------| | |
| 3904 | // | | | | |
| 3905 | // | RESTSubReq2 | | |
| 3906 | // |------------------------------>| | |
| 3907 | // | | | | |
| 3908 | // | RESTSubResp2 | | |
| 3909 | // |<------------------------------| | |
| 3910 | // | | | | |
| 3911 | // | | RESTNotif2 | | |
| 3912 | // |<------------------------------| | |
| 3913 | // | | | | |
| 3914 | // | | RESTSubDelReq1 | | |
| 3915 | // | |---------------->| | |
| 3916 | // | | | | |
| 3917 | // | | RESTSubDelResp1 | | |
| 3918 | // | |<----------------| | |
| 3919 | // | | | | |
| 3920 | // | RESTSubDelReq2 | | |
| 3921 | // |------------------------------>| | |
| 3922 | // | | | | |
| 3923 | // | RESTSubDelResp2 | | |
| 3924 | // |<------------------------------| | |
| 3925 | // | | | | |
| 3926 | // | | | SubDelReq2 | |
| 3927 | // | | |------------->| |
| 3928 | // | | | | |
| 3929 | // | | | SubDelResp2 | |
| 3930 | // | | |<-------------| |
| 3931 | // | | | | |
| 3932 | // |
| 3933 | //----------------------------------------------------------------------------- |
| 3934 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3935 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3936 | |
| 3937 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3938 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3939 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3940 | Counter{cSubReqToE2, 1}, |
| 3941 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 3942 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3943 | Counter{cMergedSubscriptions, 1}, |
| 3944 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3945 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3946 | Counter{cSubDelReqToE2, 1}, |
| 3947 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 3948 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3949 | }) |
| 3950 | |
| 3951 | // Req1 |
| 3952 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3953 | |
| 3954 | //Subs Create |
| 3955 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3956 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3957 | |
| 3958 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 3959 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3960 | params.SetMeid("RAN_NAME_1") |
| 3961 | |
| 3962 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3963 | xappConn2.ExpectAnyNotification(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3964 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3965 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3966 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3967 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 3968 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3969 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3970 | |
| 3971 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3972 | |
| 3973 | // Del1 |
| 3974 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3975 | |
| 3976 | // Del2 |
| 3977 | deleteXapp2Subscription(t, &restSubId2) |
| 3978 | |
| 3979 | //Wait that subs is cleaned |
| 3980 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3981 | |
| 3982 | mainCtrl.VerifyCounterValues(t) |
| 3983 | } |
| 3984 | |
| 3985 | //----------------------------------------------------------------------------- |
| 3986 | // TestSubReqAndSubDelOkSameActionParallel |
| 3987 | // |
| 3988 | // stub stub stub |
| 3989 | // +-------+ +-------+ +---------+ +---------+ |
| 3990 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3991 | // +-------+ +-------+ +---------+ +---------+ |
| 3992 | // | | | | |
| 3993 | // | | | | |
| 3994 | // | | | | |
| 3995 | // | | SubReq1 | | |
| 3996 | // | |------------->| | |
| 3997 | // | | | | |
| 3998 | // | | | SubReq1 | |
| 3999 | // | | |------------->| |
| 4000 | // | SubReq2 | | |
| 4001 | // |--------------------------->| | |
| 4002 | // | | | SubResp1 | |
| 4003 | // | | |<-------------| |
| 4004 | // | | SubResp1 | | |
| 4005 | // | |<-------------| | |
| 4006 | // | | | SubReq2 | |
| 4007 | // | | |------------->| |
| 4008 | // | | | | |
| 4009 | // | | | SubResp2 | |
| 4010 | // | | |<-------------| |
| 4011 | // | SubResp2 | | |
| 4012 | // |<---------------------------| | |
| 4013 | // | | | | |
| 4014 | // | | SubDelReq 1 | | |
| 4015 | // | |------------->| | |
| 4016 | // | | | | |
| 4017 | // | | SubDelResp 1 | | |
| 4018 | // | |<-------------| | |
| 4019 | // | | | | |
| 4020 | // | SubDelReq 2 | | |
| 4021 | // |--------------------------->| | |
| 4022 | // | | | | |
| 4023 | // | | | SubDelReq 2 | |
| 4024 | // | | |------------->| |
| 4025 | // | | | | |
| 4026 | // | | | SubDelReq 2 | |
| 4027 | // | | |------------->| |
| 4028 | // | | | | |
| 4029 | // | SubDelResp 2 | | |
| 4030 | // |<---------------------------| | |
| 4031 | // |
| 4032 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 4033 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 4034 | |
| 4035 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4036 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4037 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4038 | Counter{cSubReqToE2, 2}, |
| 4039 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4040 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4041 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4042 | Counter{cSubDelReqToE2, 2}, |
| 4043 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4044 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4045 | }) |
| 4046 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4047 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4048 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4049 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4050 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4051 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4052 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4053 | |
| 4054 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4055 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4056 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4057 | |
| 4058 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4059 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 4060 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 4061 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4062 | |
| 4063 | // Del1 |
| 4064 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4065 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4066 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4067 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4068 | |
| 4069 | // Del2 |
| 4070 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4071 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 4072 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 4073 | |
| 4074 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4075 | |
| 4076 | mainCtrl.VerifyCounterValues(t) |
| 4077 | } |
| 4078 | |
| 4079 | //----------------------------------------------------------------------------- |
| 4080 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 4081 | // |
| 4082 | // stub stub stub |
| 4083 | // +-------+ +-------+ +---------+ +---------+ |
| 4084 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4085 | // +-------+ +-------+ +---------+ +---------+ |
| 4086 | // | | | | |
| 4087 | // | | | | |
| 4088 | // | | | | |
| 4089 | // | | RESTSubReq1 | | |
| 4090 | // | |---------------->| | |
| 4091 | // | | | | |
| 4092 | // | | RESTSubResp1 | | |
| 4093 | // | |<----------------| | |
| 4094 | // | | | SubReq1 | |
| 4095 | // | | |------------->| |
| 4096 | // | RESTSubReq2 | | |
| 4097 | // |------------------------------>| | |
| 4098 | // | | | | |
| 4099 | // | RESTSubDelResp2 | | |
| 4100 | // |<------------------------------| | |
| 4101 | // | | | SubReq1 | |
| 4102 | // | | |------------->| |
| 4103 | // | | | | |
| 4104 | // | | | | |
| 4105 | // | | | SubDelReq | |
| 4106 | // | | |------------->| |
| 4107 | // | | | | |
| 4108 | // | | | SubDelResp | |
| 4109 | // | | |<-------------| |
| 4110 | // | | RESTNotif1 | | |
| 4111 | // | | unsuccess | | |
| 4112 | // | |<----------------| | |
| 4113 | // | RESTNotif2 | | |
| 4114 | // | | unsuccess | | |
| 4115 | // |<------------------------------| | |
| 4116 | // | | | | |
| 4117 | // | | RESTSubDelReq1 | | |
| 4118 | // | |---------------->| | |
| 4119 | // | | | | |
| 4120 | // | | RESTSubDelResp1 | | |
| 4121 | // | |<----------------| | |
| 4122 | // | | | | |
| 4123 | // | RESTSubDelReq2 | | |
| 4124 | // |------------------------------>| | |
| 4125 | // | | | | |
| 4126 | // | RESTSubDelResp2 | | |
| 4127 | // |<------------------------------| | |
| 4128 | // |
| 4129 | //----------------------------------------------------------------------------- |
| 4130 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 4131 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 4132 | |
| 4133 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4134 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4135 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4136 | Counter{cSubReqToE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4137 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4138 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4139 | Counter{cSubDelReqToE2, 1}, |
| 4140 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4141 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4142 | }) |
| 4143 | |
| 4144 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4145 | |
| 4146 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4147 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4148 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 4149 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 4150 | |
| 4151 | // Req2 |
| 4152 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4153 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4154 | params2.SetMeid("RAN_NAME_1") |
| 4155 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4156 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4157 | |
| 4158 | //Req1 (retransmitted) |
| 4159 | e2termConn1.RecvSubsReq(t) |
| 4160 | |
| 4161 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4162 | |
| 4163 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4164 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4165 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4166 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 4167 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 4168 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 4169 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4170 | |
| 4171 | // Del1 |
| 4172 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4173 | |
| 4174 | // Del2 |
| 4175 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4176 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4177 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 4178 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4179 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 4180 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4181 | |
| 4182 | mainCtrl.VerifyCounterValues(t) |
| 4183 | } |
| 4184 | |
| 4185 | //----------------------------------------------------------------------------- |
| 4186 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 4187 | // |
| 4188 | // stub stub stub |
| 4189 | // +-------+ +-------+ +---------+ +---------+ |
| 4190 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4191 | // +-------+ +-------+ +---------+ +---------+ |
| 4192 | // | | | | |
| 4193 | // | | | | |
| 4194 | // | | | | |
| 4195 | // | | RESTSubReq1 | | |
| 4196 | // | |---------------->| | |
| 4197 | // | | | | |
| 4198 | // | | RESTSubResp1 | | |
| 4199 | // | |<----------------| | |
| 4200 | // | | | SubReq1 | |
| 4201 | // | | |------------->| |
| 4202 | // | RESTSubReq2 | | |
| 4203 | // |------------------------------>| | |
| 4204 | // | | | | |
| 4205 | // | RESTSubDelResp2 | | |
| 4206 | // |<------------------------------| | |
| 4207 | // | | | SubFail1 | |
| 4208 | // | | |<-------------| |
| 4209 | // | | | | |
| 4210 | // | | RESTNotif1 | | |
| 4211 | // | | unsuccess | | |
| 4212 | // | |<----------------| | |
| 4213 | // | RESTNotif2 | | |
| 4214 | // | | unsuccess | | |
| 4215 | // |<------------------------------| | |
| 4216 | // | | | SubDelReq | |
| 4217 | // | | |------------->| |
| 4218 | // | | | SubDelResp | |
| 4219 | // | | |<-------------| |
| 4220 | // | | | | |
| 4221 | // | | RESTSubDelReq1 | | |
| 4222 | // | |---------------->| | |
| 4223 | // | | | | |
| 4224 | // | | RESTSubDelResp1 | | |
| 4225 | // | |<----------------| | |
| 4226 | // | | | | |
| 4227 | // | RESTSubDelReq2 | | |
| 4228 | // |------------------------------>| | |
| 4229 | // | | | | |
| 4230 | // | RESTSubDelResp2 | | |
| 4231 | // |<------------------------------| | |
| 4232 | // |
| 4233 | //----------------------------------------------------------------------------- |
| 4234 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 4235 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 4236 | |
| 4237 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4238 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4239 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4240 | Counter{cSubReqToE2, 1}, |
| 4241 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4242 | Counter{cRestSubFailNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4243 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4244 | Counter{cSubDelReqToE2, 1}, |
| 4245 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4246 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4247 | }) |
| 4248 | |
| 4249 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4250 | |
| 4251 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4252 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4253 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4254 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4255 | |
| 4256 | // Req2 |
| 4257 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4258 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4259 | params2.SetMeid("RAN_NAME_1") |
| 4260 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 4261 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 4262 | |
| 4263 | // E2t: send SubsFail (first) |
| 4264 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4265 | fparams1.Set(crereq1) |
| 4266 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4267 | |
| 4268 | // E2t: internal delete |
| 4269 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4270 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 4271 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4272 | |
| 4273 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 4274 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 4275 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 4276 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 4277 | |
| 4278 | // Del1 |
| 4279 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4280 | |
| 4281 | // Del2 |
| 4282 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 4283 | |
| 4284 | //Wait that subs is cleaned |
| 4285 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 4286 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 4287 | |
| 4288 | mainCtrl.VerifyCounterValues(t) |
| 4289 | } |
| 4290 | |
| 4291 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 4292 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4293 | |
| 4294 | // Init counter check |
| 4295 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4296 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4297 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4298 | Counter{cSubReqToE2, 1}, |
| 4299 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4300 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4301 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4302 | Counter{cSubDelReqToE2, 1}, |
| 4303 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4304 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4305 | }) |
| 4306 | |
| 4307 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4308 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4309 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4310 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4311 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 4312 | |
| 4313 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4314 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4315 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4316 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4317 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4318 | |
| 4319 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4320 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4321 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4322 | |
| 4323 | // Wait that subs is cleaned |
| 4324 | waitSubsCleanup(t, e2SubsId, 10) |
| 4325 | mainCtrl.VerifyCounterValues(t) |
| 4326 | } |
| 4327 | |
| 4328 | //----------------------------------------------------------------------------- |
| 4329 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 4330 | // |
| 4331 | // stub stub |
| 4332 | // +-------+ +---------+ +---------+ |
| 4333 | // | xapp | | submgr | | e2term | |
| 4334 | // +-------+ +---------+ +---------+ |
| 4335 | // | | | |
| 4336 | // | RESTSubReq | | |
| 4337 | // |---------------->| | |
| 4338 | // | | | |
| 4339 | // | RESTSubResp | | |
| 4340 | // |<----------------| | |
| 4341 | // | | SubReq | |
| 4342 | // | |------------->| |
| 4343 | // | | | |
| 4344 | // | | SubResp | |
| 4345 | // | |<-------------| |
| 4346 | // | | | |
| 4347 | // | RESTNotif | | |
| 4348 | // |<----------------| | |
| 4349 | // | | | |
| 4350 | // | RESTSubReq | | |
| 4351 | // |---------------->| | |
| 4352 | // | | | |
| 4353 | // | RESTSubResp | | |
| 4354 | // |<----------------| | |
| 4355 | // | | SubReq | |
| 4356 | // | |------------->| |
| 4357 | // | | | |
| 4358 | // | | SubResp | |
| 4359 | // | |<-------------| |
| 4360 | // | | | |
| 4361 | // | RESTNotif | | |
| 4362 | // |<----------------| | |
| 4363 | // | | | |
| 4364 | // | RESTSubDelReq | | |
| 4365 | // |---------------->| | |
| 4366 | // | | | |
| 4367 | // | | SubDelReq | |
| 4368 | // | |------------->| |
| 4369 | // | | | |
| 4370 | // | | SubDelResp | |
| 4371 | // | |<-------------| |
| 4372 | // | | | |
| 4373 | // | RESTSubDelResp | | |
| 4374 | // |<----------------| | |
| 4375 | // |
| 4376 | //----------------------------------------------------------------------------- |
| 4377 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 4378 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 4379 | |
| 4380 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4381 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4382 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4383 | Counter{cSubReqToE2, 2}, |
| 4384 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4385 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4386 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4387 | Counter{cSubDelReqToE2, 1}, |
| 4388 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4389 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4390 | }) |
| 4391 | |
| 4392 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4393 | |
| 4394 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4395 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4396 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4397 | |
| 4398 | // Policy change |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4399 | // GetRESTSubsReqPolicyParams sets some coutners on tc side. |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4400 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4401 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4402 | params.SetSubscriptionID(&restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4403 | params.SetTimeToWait("w200ms") |
| 4404 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 4405 | |
| 4406 | // Del |
| 4407 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4408 | |
| 4409 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4410 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4411 | |
| 4412 | // Wait that subs is cleaned |
| 4413 | waitSubsCleanup(t, e2SubsId, 10) |
| 4414 | mainCtrl.VerifyCounterValues(t) |
| 4415 | } |
| 4416 | |
| 4417 | //----------------------------------------------------------------------------- |
Konstantinos Archangelof | e93b00f | 2021-06-03 10:00:19 +0000 | [diff] [blame] | 4418 | // TestRESTSubReqPolicyChangeNOk |
| 4419 | // |
| 4420 | // stub stub |
| 4421 | // +-------+ +---------+ +---------+ |
| 4422 | // | xapp | | submgr | | e2term | |
| 4423 | // +-------+ +---------+ +---------+ |
| 4424 | // | | | |
| 4425 | // | RESTSubReq | | |
| 4426 | // |---------------->| | |
| 4427 | // | | | |
| 4428 | // | RESTSubResp | | |
| 4429 | // |<----------------| | |
| 4430 | // | | SubReq | |
| 4431 | // | |------------->| |
| 4432 | // | | | |
| 4433 | // | | SubResp | |
| 4434 | // | |<-------------| |
| 4435 | // | | | |
| 4436 | // | RESTNotif | | |
| 4437 | // |<----------------| | |
| 4438 | // | | | |
| 4439 | // | RESTSubReq | | |
| 4440 | // |---------------->| | |
| 4441 | // | | | |
| 4442 | // | RESTSubUpdateFail | |
| 4443 | // | | | |
| 4444 | // | RESTSubDelReq | | |
| 4445 | // |---------------->| | |
| 4446 | // | | | |
| 4447 | // | | SubDelReq | |
| 4448 | // | |------------->| |
| 4449 | // | | | |
| 4450 | // | | SubDelResp | |
| 4451 | // | |<-------------| |
| 4452 | // | | | |
| 4453 | // | RESTSubDelResp | | |
| 4454 | // |<----------------| | |
| 4455 | // |
| 4456 | //----------------------------------------------------------------------------- |
| 4457 | func TestRESTSubReqPolicyChangeNOk(t *testing.T) { |
| 4458 | CaseBegin("TestRESTSubReqPolicyChangeNOk") |
| 4459 | |
| 4460 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4461 | Counter{cRestSubReqFromXapp, 2}, |
| 4462 | Counter{cRestSubRespToXapp, 1}, |
| 4463 | Counter{cSubReqToE2, 1}, |
| 4464 | Counter{cSubRespFromE2, 1}, |
| 4465 | Counter{cRestSubNotifToXapp, 1}, |
| 4466 | Counter{cRestSubFailToXapp, 1}, |
| 4467 | Counter{cRestSubDelReqFromXapp, 1}, |
| 4468 | Counter{cSubDelReqToE2, 1}, |
| 4469 | Counter{cSubDelRespFromE2, 1}, |
| 4470 | Counter{cRestSubDelRespToXapp, 1}, |
| 4471 | }) |
| 4472 | |
| 4473 | const subReqCount int = 1 |
| 4474 | |
| 4475 | // Req |
| 4476 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4477 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4478 | |
| 4479 | // Policy change |
| 4480 | |
| 4481 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
| 4482 | |
| 4483 | restSubIdUpd := strings.ToUpper(restSubId) |
| 4484 | params.SetSubscriptionID(&restSubIdUpd) |
| 4485 | params.SetTimeToWait("w200ms") |
| 4486 | |
| 4487 | restSubId2 := xappConn1.SendRESTSubsReq(t, params) |
| 4488 | assert.Equal(t, restSubId2, "") |
| 4489 | |
| 4490 | // Del |
| 4491 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4492 | |
| 4493 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4494 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4495 | |
| 4496 | // Wait that subs is cleaned |
| 4497 | waitSubsCleanup(t, e2SubsId, 10) |
| 4498 | mainCtrl.VerifyCounterValues(t) |
| 4499 | } |
| 4500 | |
| 4501 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4502 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 4503 | // |
| 4504 | // stub stub stub |
| 4505 | // +-------+ +---------+ +---------+ +---------+ |
| 4506 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 4507 | // +-------+ +---------+ +---------+ +---------+ |
| 4508 | // | | | | |
| 4509 | // | | | | |
| 4510 | // | | | | |
| 4511 | // | RESTSubReq1 | | | |
| 4512 | // |---------------->| | | |
| 4513 | // | | | | |
| 4514 | // | RESTSubResp1 | | | |
| 4515 | // |<----------------| | | |
| 4516 | // | | SubReq1 | | |
| 4517 | // | |------------->| | |
| 4518 | // | | | | |
| 4519 | // | RESTSubReq2 | | | |
| 4520 | // |---------------->| | | |
| 4521 | // | | | | |
| 4522 | // | RESTSubResp2 | | | |
| 4523 | // |<----------------| | | |
| 4524 | // | | SubReq2 | | |
| 4525 | // | |---------------------------->| |
| 4526 | // | | | | |
| 4527 | // | | SubResp1 | | |
| 4528 | // | |<-------------| | |
| 4529 | // | RESTNotif1 | | | |
| 4530 | // |<----------------| | | |
| 4531 | // | | SubResp2 | | |
| 4532 | // | |<----------------------------| |
| 4533 | // | RESTNotif2 | | | |
| 4534 | // |<----------------| | | |
| 4535 | // | | | | |
| 4536 | // | [SUBS 1 DELETE] | | |
| 4537 | // | | | | |
| 4538 | // | [SUBS 2 DELETE] | | |
| 4539 | // | | | | |
| 4540 | // |
| 4541 | //----------------------------------------------------------------------------- |
| 4542 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 4543 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 4544 | |
| 4545 | // Init counter check |
| 4546 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4547 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4548 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4549 | Counter{cSubReqToE2, 2}, |
| 4550 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4551 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4552 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4553 | Counter{cSubDelReqToE2, 2}, |
| 4554 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4555 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4556 | }) |
| 4557 | |
| 4558 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4559 | |
| 4560 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4561 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4562 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 4563 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4564 | |
| 4565 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4566 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4567 | params.SetMeid("RAN_NAME_11") |
| 4568 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 4569 | // would not work as notification would not be received |
| 4570 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4571 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 4572 | |
| 4573 | // Resp1 |
| 4574 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 4575 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4576 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 4577 | xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
| 4578 | |
| 4579 | // Resp2 |
| 4580 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 4581 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 4582 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 4583 | xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
| 4584 | |
| 4585 | // Delete1 |
| 4586 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4587 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4588 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4589 | |
| 4590 | // Wait that subs is cleaned |
| 4591 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 4592 | |
| 4593 | // Delete2 |
| 4594 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 4595 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 4596 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 4597 | |
| 4598 | // Wait that subs is cleaned |
| 4599 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4600 | |
| 4601 | mainCtrl.VerifyCounterValues(t) |
| 4602 | } |
| 4603 | |
| 4604 | //----------------------------------------------------------------------------- |
| 4605 | // TestRESTSubReqAsn1EncodeFail |
| 4606 | // |
| 4607 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 4608 | // stub stub |
| 4609 | // +-------+ +---------+ +---------+ |
| 4610 | // | xapp | | submgr | | e2term | |
| 4611 | // +-------+ +---------+ +---------+ |
| 4612 | // | | | |
| 4613 | // | RESTSubReq | | |
| 4614 | // |---------------->| | |
| 4615 | // | | | |
| 4616 | // | RESTSubResp | | |
| 4617 | // |<----------------| | |
| 4618 | // | RESTSubDelReq | | |
| 4619 | // |---------------->| | |
| 4620 | // | RESTSubDelResp | | |
| 4621 | // | unsuccess | | |
| 4622 | // |<----------------| | |
| 4623 | // | | | |
| 4624 | // |
| 4625 | //----------------------------------------------------------------------------- |
| 4626 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 4627 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 4628 | |
| 4629 | xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") |
| 4630 | |
| 4631 | } |
| 4632 | |
| 4633 | //----------------------------------------------------------------------------- |
| 4634 | // TestRESTSubReqInsertAndSubDelOk |
| 4635 | // |
| 4636 | // stub stub |
| 4637 | // +-------+ +---------+ +---------+ |
| 4638 | // | xapp | | submgr | | e2term | |
| 4639 | // +-------+ +---------+ +---------+ |
| 4640 | // | | | |
| 4641 | // | RestSubReq | | |
| 4642 | // |---------------->| | |
| 4643 | // | | | |
| 4644 | // | RESTSubResp | | |
| 4645 | // |<----------------| | |
| 4646 | // | | | |
| 4647 | // | | SubReq | |
| 4648 | // | |------------->| |
| 4649 | // | | | |
| 4650 | // | | SubResp | |
| 4651 | // | |<-------------| |
| 4652 | // | RESTNotif | | |
| 4653 | // |<----------------| | |
| 4654 | // | ... | ... | |
| 4655 | // | | | |
| 4656 | // | RESTSubDelReq | | |
| 4657 | // |---------------->| | |
| 4658 | // | | | |
| 4659 | // | | SubDelReq | |
| 4660 | // | |------------->| |
| 4661 | // | | | |
| 4662 | // | | SubDelResp | |
| 4663 | // | |<-------------| |
| 4664 | // | | | |
| 4665 | // | RESTSubDelResp| | |
| 4666 | // |<----------------| | |
| 4667 | // |
| 4668 | //----------------------------------------------------------------------------- |
| 4669 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 4670 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 4671 | |
| 4672 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4673 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4674 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4675 | Counter{cSubReqToE2, 1}, |
| 4676 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4677 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4678 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4679 | Counter{cSubDelReqToE2, 1}, |
| 4680 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4681 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4682 | }) |
| 4683 | |
| 4684 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4685 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4686 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4687 | params.SetSubActionTypes("insert") |
| 4688 | |
| 4689 | // Req |
| 4690 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4691 | |
| 4692 | // Del |
| 4693 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4694 | |
| 4695 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4696 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4697 | |
| 4698 | // Wait that subs is cleaned |
| 4699 | waitSubsCleanup(t, e2SubsId, 10) |
| 4700 | mainCtrl.VerifyCounterValues(t) |
| 4701 | } |
| 4702 | |
| 4703 | //----------------------------------------------------------------------------- |
| 4704 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 4705 | // |
| 4706 | // stub stub |
| 4707 | // +-------+ +---------+ +---------+ |
| 4708 | // | xapp | | submgr | | e2term | |
| 4709 | // +-------+ +---------+ +---------+ |
| 4710 | // | | | |
| 4711 | // | RESTSubReq | | |
| 4712 | // |------------->| | |
| 4713 | // | | | |
| 4714 | // | | SubReq | |
| 4715 | // | |------------->| |
| 4716 | // | | | |
| 4717 | // | | SubResp | |
| 4718 | // | <----| |
| 4719 | // | | |
| 4720 | // | Submgr restart | |
| 4721 | // | | |
| 4722 | // | | | |
| 4723 | // | | SubDelReq | |
| 4724 | // | |------------->| |
| 4725 | // | | | |
| 4726 | // | | SubDelResp | |
| 4727 | // | |<-------------| |
| 4728 | // | | | |
| 4729 | // |
| 4730 | //----------------------------------------------------------------------------- |
| 4731 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4732 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 4733 | |
| 4734 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4735 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4736 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4737 | Counter{cSubReqToE2, 1}, |
| 4738 | Counter{cSubDelReqFromXapp, 1}, |
| 4739 | Counter{cSubDelReqToE2, 1}, |
| 4740 | Counter{cSubDelRespFromE2, 1}, |
| 4741 | }) |
| 4742 | |
| 4743 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4744 | |
| 4745 | // Remove possible existing subscription |
| 4746 | mainCtrl.removeExistingSubscriptions(t) |
| 4747 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4748 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4749 | |
| 4750 | //Req |
| 4751 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 4752 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4753 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4754 | |
| 4755 | e2termConn1.RecvSubsReq(t) |
| 4756 | |
| 4757 | mainCtrl.SetResetTestFlag(t, false) |
| 4758 | |
| 4759 | mainCtrl.SimulateRestart(t) |
| 4760 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4761 | |
| 4762 | //Del |
| 4763 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4764 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4765 | |
| 4766 | xappConn1.TestMsgChanEmpty(t) |
| 4767 | xappConn2.TestMsgChanEmpty(t) |
| 4768 | e2termConn1.TestMsgChanEmpty(t) |
| 4769 | mainCtrl.wait_registry_empty(t, 10) |
| 4770 | |
| 4771 | mainCtrl.VerifyCounterValues(t) |
| 4772 | } |
| 4773 | |
| 4774 | //----------------------------------------------------------------------------- |
| 4775 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 4776 | // |
| 4777 | // stub stub |
| 4778 | // +-------+ +---------+ +---------+ |
| 4779 | // | xapp | | submgr | | e2term | |
| 4780 | // +-------+ +---------+ +---------+ |
| 4781 | // | | | |
| 4782 | // | RESTSubReq | | |
| 4783 | // |---------------->| | |
| 4784 | // | | | |
| 4785 | // | RESTSubResp | | |
| 4786 | // |<----------------| | |
| 4787 | // | | SubReq | |
| 4788 | // | |------------->| |
| 4789 | // | | | |
| 4790 | // | | SubResp | |
| 4791 | // | |<-------------| |
| 4792 | // | | | |
| 4793 | // | RESTNotif | | |
| 4794 | // |<----------------| | |
| 4795 | // | | | |
| 4796 | // | | |
| 4797 | // | Submgr restart | |
| 4798 | // | | | |
| 4799 | // | RESTSubDelReq | | |
| 4800 | // |---------------->| | |
| 4801 | // | | | |
| 4802 | // | | SubDelReq | |
| 4803 | // | |------------->| |
| 4804 | // | | | |
| 4805 | // | | SubDelResp | |
| 4806 | // | |<-------------| |
| 4807 | // | | | |
| 4808 | // | RESTSubDelResp | | |
| 4809 | // |<----------------| | |
| 4810 | // |
| 4811 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 4812 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4813 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4814 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4815 | |
| 4816 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4817 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4818 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4819 | Counter{cSubReqToE2, 1}, |
| 4820 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4821 | Counter{cRestSubNotifToXapp, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4822 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4823 | Counter{cSubDelReqToE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4824 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4825 | }) |
| 4826 | |
| 4827 | // Remove possible existing subscription |
| 4828 | mainCtrl.removeExistingSubscriptions(t) |
| 4829 | |
| 4830 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4831 | |
| 4832 | // Create subscription |
| 4833 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4834 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4835 | |
| 4836 | // Check subscription |
| 4837 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4838 | |
| 4839 | // When SDL support for the REST Interface is added |
| 4840 | // the submgr restart statement below should be removed |
| 4841 | // from the comment. |
| 4842 | |
| 4843 | // mainCtrl.SimulateRestart(t) |
| 4844 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4845 | |
| 4846 | // Check subscription |
| 4847 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4848 | |
| 4849 | // Delete subscription |
| 4850 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4851 | |
| 4852 | //Wait that subs is cleaned |
| 4853 | waitSubsCleanup(t, e2SubsId, 10) |
| 4854 | |
| 4855 | mainCtrl.VerifyCounterValues(t) |
| 4856 | } |
| 4857 | |
| 4858 | //----------------------------------------------------------------------------- |
| 4859 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4860 | // |
| 4861 | // stub stub |
| 4862 | // +-------+ +-------+ +---------+ +---------+ |
| 4863 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4864 | // +-------+ +-------+ +---------+ +---------+ |
| 4865 | // | | | | |
| 4866 | // | | RESTSubReq1 | | |
| 4867 | // | |---------------->| | |
| 4868 | // | | | | |
| 4869 | // | | RESTSubResp1 | | |
| 4870 | // | |<----------------| | |
| 4871 | // | | | | |
| 4872 | // | | | SubReq1 | |
| 4873 | // | | |------------->| |
| 4874 | // | | | SubResp1 | |
| 4875 | // | | |<-------------| |
| 4876 | // | | RESTNotif1 | | |
| 4877 | // | |<----------------| | |
| 4878 | // | | | | |
| 4879 | // | RESTSubReq2 | | |
| 4880 | // |------------------------------>| | |
| 4881 | // | | | | |
| 4882 | // | RESTSubResp2 | | |
| 4883 | // |<------------------------------| | |
| 4884 | // | | | | |
| 4885 | // | | RESTNotif2 | | |
| 4886 | // |<------------------------------| | |
| 4887 | // | | | | |
| 4888 | // | | Submgr restart | |
| 4889 | // | | | | |
| 4890 | // | | RESTSubDelReq1 | | |
| 4891 | // | |---------------->| | |
| 4892 | // | | | | |
| 4893 | // | | RESTSubDelResp1 | | |
| 4894 | // | |<----------------| | |
| 4895 | // | | | | |
| 4896 | // | | Submgr restart | |
| 4897 | // | | | | |
| 4898 | // | RESTSubDelReq2 | | |
| 4899 | // |------------------------------>| | |
| 4900 | // | | | | |
| 4901 | // | RESTSubDelResp2 | | |
| 4902 | // |<------------------------------| | |
| 4903 | // | | | | |
| 4904 | // | | | SubDelReq2 | |
| 4905 | // | | |------------->| |
| 4906 | // | | | | |
| 4907 | // | | | SubDelResp2 | |
| 4908 | // | | |<-------------| |
| 4909 | // | | | | |
| 4910 | // |
| 4911 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 4912 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4913 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4914 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4915 | |
| 4916 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4917 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4918 | Counter{cRestSubRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4919 | Counter{cSubReqToE2, 1}, |
| 4920 | Counter{cSubRespFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 4921 | Counter{cRestSubNotifToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4922 | Counter{cMergedSubscriptions, 1}, |
| 4923 | Counter{cUnmergedSubscriptions, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4924 | Counter{cRestSubDelReqFromXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4925 | Counter{cSubDelReqToE2, 1}, |
| 4926 | Counter{cSubDelRespFromE2, 1}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 4927 | Counter{cRestSubDelRespToXapp, 2}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4928 | }) |
| 4929 | |
| 4930 | // Remove possible existing subscription |
| 4931 | mainCtrl.removeExistingSubscriptions(t) |
| 4932 | |
| 4933 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4934 | |
| 4935 | // Create subscription 1 |
| 4936 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4937 | xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
| 4938 | |
| 4939 | // Create subscription 2 with same action |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 4940 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4941 | params.SetMeid("RAN_NAME_1") |
| 4942 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4943 | xappConn2.ExpectAnyNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4944 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4945 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
Markku Virtanen | 2b512b6 | 2021-07-30 12:04:00 +0000 | [diff] [blame] | 4946 | e2SubsId2 := xappConn2.WaitAnyRESTNotification(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4947 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 4948 | |
| 4949 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4950 | |
| 4951 | // When SDL support for the REST Interface is added |
| 4952 | // the submgr restart statement below should be removed |
| 4953 | // from the comment. |
| 4954 | |
| 4955 | // mainCtrl.SimulateRestart(t) |
| 4956 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4957 | |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4958 | // Delete subscription 1, and wait until it has removed the first endpoint |
| 4959 | subepcnt := mainCtrl.get_subs_entrypoint_cnt(t, e2SubsId1) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4960 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 4961 | mainCtrl.wait_subs_entrypoint_cnt_change(t, e2SubsId1, subepcnt, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4962 | |
| 4963 | // When SDL support for the REST Interface is added |
| 4964 | // the submgr restart statement below should be removed |
| 4965 | // from the comment. |
| 4966 | |
| 4967 | // mainCtrl.SimulateRestart(t) |
| 4968 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4969 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4970 | |
| 4971 | // Delete subscription 2 |
| 4972 | deleteXapp2Subscription(t, &restSubId2) |
| 4973 | |
| 4974 | //Wait that subs is cleaned |
| 4975 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4976 | |
| 4977 | mainCtrl.VerifyCounterValues(t) |
| 4978 | } |
| 4979 | |
| 4980 | //----------------------------------------------------------------------------- |
| 4981 | // TestRESTReportSubReqAndSubDelOk |
| 4982 | // |
| 4983 | // stub stub |
| 4984 | // +-------+ +---------+ +---------+ |
| 4985 | // | xapp | | submgr | | e2term | |
| 4986 | // +-------+ +---------+ +---------+ |
| 4987 | // | | | |
| 4988 | // | RestSubReq | | |
| 4989 | // |---------------->| | |
| 4990 | // | | | |
| 4991 | // | RESTSubResp | | |
| 4992 | // |<----------------| | |
| 4993 | // | | | |
| 4994 | // | | SubReq | |
| 4995 | // | |------------->| |
| 4996 | // | | | |
| 4997 | // | | SubResp | |
| 4998 | // | |<-------------| |
| 4999 | // | RESTNotif | | |
| 5000 | // |<----------------| | |
| 5001 | // | | SubReq | |
| 5002 | // | |------------->| |
| 5003 | // | | | |
| 5004 | // | | SubResp | |
| 5005 | // | |<-------------| |
| 5006 | // | RESTNotif | | |
| 5007 | // |<----------------| | |
| 5008 | // | ... | ... | |
| 5009 | // | | | |
| 5010 | // | | | |
| 5011 | // | RESTSubDelReq | | |
| 5012 | // |---------------->| | |
| 5013 | // | | | |
| 5014 | // | | SubDelReq | |
| 5015 | // | |------------->| |
| 5016 | // | | | |
| 5017 | // | | SubDelResp | |
| 5018 | // | |<-------------| |
| 5019 | // | | | |
| 5020 | // | RESTSubDelResp| | |
| 5021 | // |<----------------| | |
| 5022 | // |
| 5023 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5024 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5025 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 5026 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
| 5027 | subReqCount := 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5028 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5029 | RESTReportSubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5030 | } |
| 5031 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5032 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 5033 | xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5034 | |
| 5035 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5036 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5037 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5038 | |
| 5039 | var e2SubsId []uint32 |
| 5040 | for i := 0; i < subReqCount; i++ { |
| 5041 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5042 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5043 | |
| 5044 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5045 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5046 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5047 | e2SubsId = append(e2SubsId, instanceId) |
| 5048 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 5049 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 5050 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 5051 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 5052 | |
| 5053 | } |
| 5054 | |
| 5055 | // Del |
| 5056 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5057 | |
| 5058 | for i := 0; i < subReqCount; i++ { |
| 5059 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5060 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5061 | } |
| 5062 | |
| 5063 | // Wait that subs is cleaned |
| 5064 | for i := 0; i < subReqCount; i++ { |
| 5065 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5066 | } |
| 5067 | |
| 5068 | xappConn1.TestMsgChanEmpty(t) |
| 5069 | e2termConn1.TestMsgChanEmpty(t) |
| 5070 | mainCtrl.wait_registry_empty(t, 10) |
| 5071 | } |
| 5072 | |
| 5073 | /* |
| 5074 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 5075 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 5076 | |
| 5077 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5078 | testIndex := 1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5079 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5080 | |
| 5081 | subReqCount = 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5082 | testIndex = 2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5083 | RESTPolicySubReqAndSubDelOk(t, subReqCount, testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5084 | } |
| 5085 | */ |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5086 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, testIndex int) { |
| 5087 | xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with testIndex %v", testIndex) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5088 | |
| 5089 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5090 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5091 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5092 | //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5093 | //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) |
| 5094 | |
| 5095 | var e2SubsId []uint32 |
| 5096 | for i := 0; i < subReqCount; i++ { |
| 5097 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5098 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 5099 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5100 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5101 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5102 | e2SubsId = append(e2SubsId, instanceId) |
| 5103 | } |
| 5104 | |
| 5105 | // Del |
| 5106 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5107 | |
| 5108 | for i := 0; i < subReqCount; i++ { |
| 5109 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5110 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5111 | } |
| 5112 | |
| 5113 | // Wait that subs is cleaned |
| 5114 | for i := 0; i < subReqCount; i++ { |
| 5115 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 5116 | } |
| 5117 | xappConn1.TestMsgChanEmpty(t) |
| 5118 | e2termConn1.TestMsgChanEmpty(t) |
| 5119 | mainCtrl.wait_registry_empty(t, 10) |
| 5120 | } |
| 5121 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5122 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 5123 | |
| 5124 | subReqCount := 2 |
| 5125 | |
| 5126 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5127 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5128 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5129 | Counter{cSubReqToE2, 2}, |
| 5130 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5131 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5132 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5133 | Counter{cSubDelReqToE2, 2}, |
| 5134 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5135 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5136 | }) |
| 5137 | |
| 5138 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5139 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5140 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5141 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5142 | |
| 5143 | assert.Equal(t, len(e2SubsIds), 2) |
| 5144 | |
| 5145 | // Del |
| 5146 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5147 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5148 | |
| 5149 | xappConn1.TestMsgChanEmpty(t) |
| 5150 | e2termConn1.TestMsgChanEmpty(t) |
| 5151 | mainCtrl.wait_registry_empty(t, 10) |
| 5152 | |
| 5153 | mainCtrl.VerifyCounterValues(t) |
| 5154 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5155 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 5156 | |
| 5157 | subReqCount := 19 |
| 5158 | |
| 5159 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5160 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5161 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5162 | Counter{cSubReqToE2, 19}, |
| 5163 | Counter{cSubRespFromE2, 19}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5164 | Counter{cRestSubNotifToXapp, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5165 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5166 | Counter{cSubDelReqToE2, 19}, |
| 5167 | Counter{cSubDelRespFromE2, 19}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5168 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5169 | }) |
| 5170 | |
| 5171 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5172 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5173 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5174 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5175 | |
| 5176 | assert.Equal(t, len(e2SubsIds), 19) |
| 5177 | |
| 5178 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5179 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5180 | |
| 5181 | xappConn1.TestMsgChanEmpty(t) |
| 5182 | e2termConn1.TestMsgChanEmpty(t) |
| 5183 | mainCtrl.wait_registry_empty(t, 10) |
| 5184 | |
| 5185 | mainCtrl.VerifyCounterValues(t) |
| 5186 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5187 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 5188 | |
| 5189 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5190 | |
| 5191 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5192 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5193 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5194 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5195 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5196 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5197 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5198 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5199 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5200 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5201 | }) |
| 5202 | |
| 5203 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5204 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5205 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5206 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5207 | |
| 5208 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5209 | |
| 5210 | // Del |
| 5211 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5212 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5213 | |
| 5214 | xappConn1.TestMsgChanEmpty(t) |
| 5215 | e2termConn1.TestMsgChanEmpty(t) |
| 5216 | mainCtrl.wait_registry_empty(t, 10) |
| 5217 | |
| 5218 | mainCtrl.VerifyCounterValues(t) |
| 5219 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame] | 5220 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5221 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 5222 | |
| 5223 | subReqCount := 2 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5224 | |
| 5225 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5226 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5227 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5228 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5229 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5230 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5231 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5232 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5233 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5234 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5235 | }) |
| 5236 | |
| 5237 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5238 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5239 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5240 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5241 | |
| 5242 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5243 | |
| 5244 | // Del |
| 5245 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5246 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5247 | |
| 5248 | xappConn1.TestMsgChanEmpty(t) |
| 5249 | e2termConn1.TestMsgChanEmpty(t) |
| 5250 | mainCtrl.wait_registry_empty(t, 10) |
| 5251 | |
| 5252 | mainCtrl.VerifyCounterValues(t) |
| 5253 | } |
Markku Virtanen | fe2cdab | 2021-05-21 10:59:29 +0000 | [diff] [blame] | 5254 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5255 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 5256 | |
| 5257 | subReqCount := 19 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5258 | |
| 5259 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5260 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5261 | Counter{cRestSubRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5262 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 5263 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5264 | Counter{cRestSubNotifToXapp, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5265 | Counter{cRestSubDelReqFromXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5266 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 5267 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5268 | Counter{cRestSubDelRespToXapp, 1}, |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5269 | }) |
| 5270 | |
| 5271 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5272 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 5273 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5274 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 5275 | |
| 5276 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 5277 | |
| 5278 | // Del |
| 5279 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 5280 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 5281 | |
| 5282 | xappConn1.TestMsgChanEmpty(t) |
| 5283 | e2termConn1.TestMsgChanEmpty(t) |
| 5284 | mainCtrl.wait_registry_empty(t, 10) |
| 5285 | |
| 5286 | mainCtrl.VerifyCounterValues(t) |
| 5287 | } |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5288 | |
| 5289 | func TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen(t *testing.T) { |
| 5290 | CaseBegin("TestRESTSubReqReportSameActionDiffEventTriggerDefinitionLen") |
| 5291 | |
| 5292 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5293 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5294 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5295 | Counter{cSubReqToE2, 2}, |
| 5296 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5297 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5298 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5299 | Counter{cSubDelReqToE2, 2}, |
| 5300 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5301 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5302 | }) |
| 5303 | |
| 5304 | // Req1 |
| 5305 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5306 | |
| 5307 | //Subs Create |
| 5308 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5309 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5310 | |
| 5311 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5312 | |
| 5313 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5314 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5315 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5316 | eventTriggerDefinition := []int64{1234, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5317 | params.SetSubEventTriggerDefinition(eventTriggerDefinition) |
| 5318 | |
| 5319 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5320 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5321 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5322 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5323 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5324 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5325 | |
| 5326 | deleteXapp1Subscription(t, &restSubId1) |
| 5327 | deleteXapp2Subscription(t, &restSubId2) |
| 5328 | |
| 5329 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5330 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5331 | |
| 5332 | mainCtrl.VerifyCounterValues(t) |
| 5333 | |
| 5334 | } |
| 5335 | |
| 5336 | func TestRESTSubReqReportSameActionDiffActionListLen(t *testing.T) { |
| 5337 | CaseBegin("TestRESTSubReqReportSameActionDiffActionListLen") |
| 5338 | |
| 5339 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5340 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5341 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5342 | Counter{cSubReqToE2, 2}, |
| 5343 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5344 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5345 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5346 | Counter{cSubDelReqToE2, 2}, |
| 5347 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5348 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5349 | }) |
| 5350 | |
| 5351 | // Req1 |
| 5352 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5353 | |
| 5354 | //Subs Create |
| 5355 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5356 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5357 | |
| 5358 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5359 | |
| 5360 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5361 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5362 | params.SetMeid("RAN_NAME_1") |
| 5363 | |
| 5364 | actionId := int64(1) |
| 5365 | actionType := "report" |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5366 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5367 | subsequestActionType := "continue" |
| 5368 | timeToWait := "w10ms" |
| 5369 | params.AppendActionToActionToBeSetupList(actionId, actionType, actionDefinition, subsequestActionType, timeToWait) |
| 5370 | |
| 5371 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5372 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5373 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5374 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5375 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5376 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5377 | |
| 5378 | deleteXapp1Subscription(t, &restSubId1) |
| 5379 | deleteXapp2Subscription(t, &restSubId2) |
| 5380 | |
| 5381 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5382 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5383 | |
| 5384 | mainCtrl.VerifyCounterValues(t) |
| 5385 | |
| 5386 | } |
| 5387 | |
| 5388 | func TestRESTSubReqReportSameActionDiffActionID(t *testing.T) { |
| 5389 | CaseBegin("TestRESTSubReqReportSameActionDiffActionID") |
| 5390 | |
| 5391 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5392 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5393 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5394 | Counter{cSubReqToE2, 2}, |
| 5395 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5396 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5397 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5398 | Counter{cSubDelReqToE2, 2}, |
| 5399 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5400 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5401 | }) |
| 5402 | |
| 5403 | // Req1 |
| 5404 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5405 | |
| 5406 | //Subs Create |
| 5407 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5408 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5409 | |
| 5410 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5411 | |
| 5412 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5413 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5414 | params.SetMeid("RAN_NAME_1") |
| 5415 | params.SetSubActionIDs(int64(2)) |
| 5416 | |
| 5417 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5418 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5419 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5420 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5421 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5422 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5423 | |
| 5424 | deleteXapp1Subscription(t, &restSubId1) |
| 5425 | deleteXapp2Subscription(t, &restSubId2) |
| 5426 | |
| 5427 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5428 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5429 | |
| 5430 | mainCtrl.VerifyCounterValues(t) |
| 5431 | |
| 5432 | } |
| 5433 | |
| 5434 | func TestRESTSubReqDiffActionType(t *testing.T) { |
| 5435 | CaseBegin("TestRESTSubReqDiffActionType") |
| 5436 | |
| 5437 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5438 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5439 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5440 | Counter{cSubReqToE2, 2}, |
| 5441 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5442 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5443 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5444 | Counter{cSubDelReqToE2, 2}, |
| 5445 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5446 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5447 | }) |
| 5448 | |
| 5449 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5450 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5451 | |
| 5452 | //Subs Create |
| 5453 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5454 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5455 | |
| 5456 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5457 | |
| 5458 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5459 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5460 | params.SetMeid("RAN_NAME_1") |
| 5461 | |
| 5462 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5463 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5464 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5465 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5466 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5467 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5468 | |
| 5469 | deleteXapp1Subscription(t, &restSubId1) |
| 5470 | deleteXapp2Subscription(t, &restSubId2) |
| 5471 | |
| 5472 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5473 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5474 | |
| 5475 | mainCtrl.VerifyCounterValues(t) |
| 5476 | |
| 5477 | } |
| 5478 | |
| 5479 | func TestRESTSubReqPolicyAndSubDelOkSameAction(t *testing.T) { |
| 5480 | CaseBegin("TestRESTSubReqPolicyAndSubDelOkSameAction") |
| 5481 | |
| 5482 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5483 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5484 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5485 | Counter{cSubReqToE2, 2}, |
| 5486 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5487 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5488 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5489 | Counter{cSubDelReqToE2, 2}, |
| 5490 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5491 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5492 | }) |
| 5493 | |
| 5494 | // Req1 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5495 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5496 | |
| 5497 | //Subs Create |
| 5498 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5499 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5500 | |
| 5501 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5502 | |
| 5503 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5504 | params = xappConn2.GetRESTSubsReqPolicyParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5505 | params.SetMeid("RAN_NAME_1") |
| 5506 | |
| 5507 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5508 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5509 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5510 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5511 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5512 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5513 | |
| 5514 | deleteXapp1Subscription(t, &restSubId1) |
| 5515 | deleteXapp2Subscription(t, &restSubId2) |
| 5516 | |
| 5517 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5518 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5519 | |
| 5520 | mainCtrl.VerifyCounterValues(t) |
| 5521 | |
| 5522 | } |
| 5523 | |
| 5524 | func TestRESTSubReqReportSameActionDiffActionDefinitionLen(t *testing.T) { |
| 5525 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionLen") |
| 5526 | |
| 5527 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5528 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5529 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5530 | Counter{cSubReqToE2, 2}, |
| 5531 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5532 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5533 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5534 | Counter{cSubDelReqToE2, 2}, |
| 5535 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5536 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5537 | }) |
| 5538 | |
| 5539 | // Req1 |
| 5540 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5541 | |
| 5542 | //Subs Create |
| 5543 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5544 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5545 | |
| 5546 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5547 | |
| 5548 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5549 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5550 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5551 | actionDefinition := []int64{5678, 1} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5552 | params.SetSubActionDefinition(actionDefinition) |
| 5553 | |
| 5554 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5555 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5556 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5557 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5558 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5559 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5560 | |
| 5561 | deleteXapp1Subscription(t, &restSubId1) |
| 5562 | deleteXapp2Subscription(t, &restSubId2) |
| 5563 | |
| 5564 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5565 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5566 | |
| 5567 | mainCtrl.VerifyCounterValues(t) |
| 5568 | |
| 5569 | } |
| 5570 | |
| 5571 | func TestRESTSubReqReportSameActionDiffActionDefinitionContents(t *testing.T) { |
| 5572 | CaseBegin("TestRESTSubReqReportSameActionDiffActionDefinitionContents") |
| 5573 | |
| 5574 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5575 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5576 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5577 | Counter{cSubReqToE2, 2}, |
| 5578 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5579 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5580 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5581 | Counter{cSubDelReqToE2, 2}, |
| 5582 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5583 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5584 | }) |
| 5585 | |
| 5586 | // Req1 |
| 5587 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5588 | |
| 5589 | //Subs Create |
| 5590 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5591 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5592 | |
| 5593 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5594 | |
| 5595 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5596 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5597 | params.SetMeid("RAN_NAME_1") |
Konstantinos Archangelof | bd9c98e | 2021-06-07 17:32:10 +0000 | [diff] [blame] | 5598 | actionDefinition := []int64{56782} |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5599 | params.SetSubActionDefinition(actionDefinition) |
| 5600 | |
| 5601 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5602 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5603 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5604 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5605 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5606 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5607 | |
| 5608 | deleteXapp1Subscription(t, &restSubId1) |
| 5609 | deleteXapp2Subscription(t, &restSubId2) |
| 5610 | |
| 5611 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5612 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5613 | |
| 5614 | mainCtrl.VerifyCounterValues(t) |
| 5615 | |
| 5616 | } |
| 5617 | |
| 5618 | func TestRESTSubReqReportSameActionDiffSubsAction(t *testing.T) { |
| 5619 | CaseBegin("TestRESTSubReqReportSameActionDiffSubsAction") |
| 5620 | |
| 5621 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5622 | Counter{cRestSubReqFromXapp, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5623 | Counter{cRestSubRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5624 | Counter{cSubReqToE2, 2}, |
| 5625 | Counter{cSubRespFromE2, 2}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 5626 | Counter{cRestSubNotifToXapp, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5627 | Counter{cRestSubDelReqFromXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5628 | Counter{cSubDelReqToE2, 2}, |
| 5629 | Counter{cSubDelRespFromE2, 2}, |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 5630 | Counter{cRestSubDelRespToXapp, 2}, |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5631 | }) |
| 5632 | |
| 5633 | // Req1 |
| 5634 | var params *teststube2ap.RESTSubsReqParams = nil |
| 5635 | |
| 5636 | //Subs Create |
| 5637 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 5638 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId1) |
| 5639 | |
| 5640 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 5641 | |
| 5642 | // Req2 |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5643 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | 39d94ea | 2021-05-21 09:36:45 +0000 | [diff] [blame] | 5644 | params.SetMeid("RAN_NAME_1") |
| 5645 | params.SetTimeToWait("w200ms") |
| 5646 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 5647 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 5648 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5649 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 5650 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5651 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 5652 | |
| 5653 | deleteXapp1Subscription(t, &restSubId1) |
| 5654 | deleteXapp2Subscription(t, &restSubId2) |
| 5655 | |
| 5656 | waitSubsCleanup(t, e2SubsId1, 10) |
| 5657 | waitSubsCleanup(t, e2SubsId2, 10) |
| 5658 | |
| 5659 | mainCtrl.VerifyCounterValues(t) |
| 5660 | |
| 5661 | } |
| 5662 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5663 | //----------------------------------------------------------------------------- |
| 5664 | // TestRESTUnpackSubscriptionResponseDecodeFail |
| 5665 | // |
| 5666 | // stub stub |
| 5667 | // +-------+ +---------+ +---------+ |
| 5668 | // | xapp | | submgr | | e2term | |
| 5669 | // +-------+ +---------+ +---------+ |
| 5670 | // | | | |
| 5671 | // | RestSubReq | | |
| 5672 | // |---------------->| | |
| 5673 | // | | | |
| 5674 | // | RESTSubResp | | |
| 5675 | // |<----------------| | |
| 5676 | // | | | |
| 5677 | // | | SubReq | |
| 5678 | // | |------------->| |
| 5679 | // | | | |
| 5680 | // | | SubResp | ASN.1 decode fails |
| 5681 | // | |<-------------| |
| 5682 | // | | | |
| 5683 | // | | SubReq | |
| 5684 | // | |------------->| |
| 5685 | // | | | |
| 5686 | // | | SubFail | Duplicated action |
| 5687 | // | |<-------------| |
| 5688 | // | RESTNotif (fail)| | |
| 5689 | // |<----------------| | |
| 5690 | // | | SubDelReq | |
| 5691 | // | |------------->| |
| 5692 | // | | | |
| 5693 | // | | SubDelResp | |
| 5694 | // | |<-------------| |
| 5695 | // |
| 5696 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5697 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5698 | func TestRESTUnpackSubscriptionResponseDecodeFail(t *testing.T) { |
| 5699 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseDecodeFail") |
| 5700 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5701 | |
| 5702 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5703 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5704 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5705 | |
| 5706 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5707 | // Decode of this response fails which will result resending original request |
| 5708 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_RESP) |
| 5709 | |
| 5710 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5711 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5712 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5713 | |
| 5714 | // Subscription already created in E2 Node. |
| 5715 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5716 | fparams.Set(crereq) |
| 5717 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5718 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5719 | |
| 5720 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5721 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5722 | |
| 5723 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5724 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5725 | |
| 5726 | // Wait that subs is cleaned |
| 5727 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5728 | |
| 5729 | xappConn1.TestMsgChanEmpty(t) |
| 5730 | e2termConn1.TestMsgChanEmpty(t) |
| 5731 | mainCtrl.wait_registry_empty(t, 10) |
| 5732 | } |
| 5733 | |
| 5734 | //----------------------------------------------------------------------------- |
| 5735 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5736 | // |
| 5737 | // stub stub |
| 5738 | // +-------+ +---------+ +---------+ |
| 5739 | // | xapp | | submgr | | e2term | |
| 5740 | // +-------+ +---------+ +---------+ |
| 5741 | // | | | |
| 5742 | // | RestSubReq | | |
| 5743 | // |---------------->| | |
| 5744 | // | | | |
| 5745 | // | RESTSubResp | | |
| 5746 | // |<----------------| | |
| 5747 | // | | | |
| 5748 | // | | SubReq | |
| 5749 | // | |------------->| |
| 5750 | // | | | |
| 5751 | // | | SubResp | Unknown instanceId |
| 5752 | // | |<-------------| |
| 5753 | // | | | |
| 5754 | // | | SubReq | |
| 5755 | // | |------------->| |
| 5756 | // | | | |
| 5757 | // | | SubFail | Duplicated action |
| 5758 | // | |<-------------| |
| 5759 | // | RESTNotif (fail)| | |
| 5760 | // |<----------------| | |
| 5761 | // | | SubDelReq | |
| 5762 | // | |------------->| |
| 5763 | // | | | |
| 5764 | // | | SubDelResp | |
| 5765 | // | |<-------------| |
| 5766 | // |
| 5767 | //----------------------------------------------------------------------------- |
Markku Virtanen | b642a19 | 2021-06-09 09:08:14 +0000 | [diff] [blame] | 5768 | |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5769 | func TestRESTUnpackSubscriptionResponseUnknownInstanceId(t *testing.T) { |
| 5770 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseUnknownInstanceId") |
| 5771 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5772 | |
| 5773 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5774 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5775 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5776 | |
| 5777 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5778 | |
| 5779 | // Unknown instanceId in this response which will result resending original request |
| 5780 | orgInstanceId := crereq.RequestId.InstanceId |
| 5781 | crereq.RequestId.InstanceId = 0 |
| 5782 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5783 | |
| 5784 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5785 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5786 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5787 | |
| 5788 | // Subscription already created in E2 Node. |
| 5789 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5790 | fparams.Set(crereq) |
| 5791 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5792 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5793 | |
| 5794 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5795 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5796 | |
| 5797 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5798 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5799 | |
| 5800 | // Wait that subs is cleaned |
| 5801 | mainCtrl.wait_subs_clean(t, orgInstanceId, 10) |
| 5802 | |
| 5803 | xappConn1.TestMsgChanEmpty(t) |
| 5804 | e2termConn1.TestMsgChanEmpty(t) |
| 5805 | mainCtrl.wait_registry_empty(t, 10) |
| 5806 | } |
| 5807 | |
| 5808 | //----------------------------------------------------------------------------- |
| 5809 | // TestRESTUnpackSubscriptionResponseNoTransaction |
| 5810 | // |
| 5811 | // stub stub |
| 5812 | // +-------+ +---------+ +---------+ |
| 5813 | // | xapp | | submgr | | e2term | |
| 5814 | // +-------+ +---------+ +---------+ |
| 5815 | // | | | |
| 5816 | // | RestSubReq | | |
| 5817 | // |---------------->| | |
| 5818 | // | | | |
| 5819 | // | RESTSubResp | | |
| 5820 | // |<----------------| | |
| 5821 | // | | | |
| 5822 | // | | SubReq | |
| 5823 | // | |------------->| |
| 5824 | // | | | |
| 5825 | // | | SubResp | No transaction for the response |
| 5826 | // | |<-------------| |
| 5827 | // | | | |
| 5828 | // | | SubReq | |
| 5829 | // | |------------->| |
| 5830 | // | | | |
| 5831 | // | | SubFail | Duplicated action |
| 5832 | // | |<-------------| |
| 5833 | // | RESTNotif (fail)| | |
| 5834 | // |<----------------| | |
| 5835 | // | | SubDelReq | |
| 5836 | // | |------------->| |
| 5837 | // | | | |
| 5838 | // | | SubDelResp | |
| 5839 | // | |<-------------| |
| 5840 | // | | | |
| 5841 | // | | SubDelReq | |
| 5842 | // | |------------->| |
| 5843 | // | | | |
| 5844 | // | | SubDelResp | |
| 5845 | // | |<-------------| |
| 5846 | // |
| 5847 | //----------------------------------------------------------------------------- |
| 5848 | func TestRESTUnpackSubscriptionResponseNoTransaction(t *testing.T) { |
| 5849 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionResponseNoTransaction") |
| 5850 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5851 | |
| 5852 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5853 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5854 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5855 | |
| 5856 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5857 | |
| 5858 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 5859 | // No transaction exist for this response which will result resending original request |
| 5860 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 5861 | |
| 5862 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5863 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5864 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5865 | |
| 5866 | // Subscription already created in E2 Node. |
| 5867 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5868 | fparams.Set(crereq) |
| 5869 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5870 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5871 | |
| 5872 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5873 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5874 | |
| 5875 | // Resending happens because there no transaction |
| 5876 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 5877 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5878 | |
| 5879 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5880 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5881 | |
| 5882 | // Wait that subs is cleaned |
| 5883 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5884 | |
| 5885 | xappConn1.TestMsgChanEmpty(t) |
| 5886 | e2termConn1.TestMsgChanEmpty(t) |
| 5887 | mainCtrl.wait_registry_empty(t, 10) |
| 5888 | |
| 5889 | } |
| 5890 | |
| 5891 | //----------------------------------------------------------------------------- |
| 5892 | // TestRESTUnpackSubscriptionFailureDecodeFail |
| 5893 | // |
| 5894 | // stub stub |
| 5895 | // +-------+ +---------+ +---------+ |
| 5896 | // | xapp | | submgr | | e2term | |
| 5897 | // +-------+ +---------+ +---------+ |
| 5898 | // | | | |
| 5899 | // | RestSubReq | | |
| 5900 | // |---------------->| | |
| 5901 | // | | | |
| 5902 | // | RESTSubResp | | |
| 5903 | // |<----------------| | |
| 5904 | // | | | |
| 5905 | // | | SubReq | |
| 5906 | // | |------------->| |
| 5907 | // | | | |
| 5908 | // | | SubFail | ASN.1 decode fails |
| 5909 | // | |<-------------| |
| 5910 | // | | | |
| 5911 | // | | SubReq | |
| 5912 | // | |------------->| |
| 5913 | // | | | |
| 5914 | // | | SubFail | Duplicated action |
| 5915 | // | |<-------------| |
| 5916 | // | RESTNotif (fail)| | |
| 5917 | // |<----------------| | |
| 5918 | // | | SubDelReq | |
| 5919 | // | |------------->| |
| 5920 | // | | | |
| 5921 | // | | SubDelResp | |
| 5922 | // | |<-------------| |
| 5923 | // |
| 5924 | //----------------------------------------------------------------------------- |
| 5925 | func TestRESTUnpackSubscriptionFailureDecodeFail(t *testing.T) { |
| 5926 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureDecodeFail") |
| 5927 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5928 | |
| 5929 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 5930 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5931 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 5932 | |
| 5933 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 5934 | |
| 5935 | // Decode of this response fails which will result resending original request |
| 5936 | e2termConn1.SendInvalidE2Asn1Resp(t, cremsg, xapp.RIC_SUB_FAILURE) |
| 5937 | |
| 5938 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 5939 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 5940 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5941 | |
| 5942 | // Subscription already created in E2 Node. |
| 5943 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 5944 | fparams.Set(crereq) |
| 5945 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 5946 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 5947 | |
| 5948 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 5949 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 5950 | |
| 5951 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 5952 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 5953 | |
| 5954 | // Wait that subs is cleaned |
| 5955 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 5956 | |
| 5957 | xappConn1.TestMsgChanEmpty(t) |
| 5958 | e2termConn1.TestMsgChanEmpty(t) |
| 5959 | mainCtrl.wait_registry_empty(t, 10) |
| 5960 | } |
| 5961 | |
| 5962 | //----------------------------------------------------------------------------- |
| 5963 | // TestRESTUnpackSubscriptionResponseUnknownInstanceId |
| 5964 | // |
| 5965 | // stub stub |
| 5966 | // +-------+ +---------+ +---------+ |
| 5967 | // | xapp | | submgr | | e2term | |
| 5968 | // +-------+ +---------+ +---------+ |
| 5969 | // | | | |
| 5970 | // | RestSubReq | | |
| 5971 | // |---------------->| | |
| 5972 | // | | | |
| 5973 | // | RESTSubResp | | |
| 5974 | // |<----------------| | |
| 5975 | // | | | |
| 5976 | // | | SubReq | |
| 5977 | // | |------------->| |
| 5978 | // | | | |
| 5979 | // | | SubFail | Unknown instanceId |
| 5980 | // | |<-------------| |
| 5981 | // | | | |
| 5982 | // | | SubReq | |
| 5983 | // | |------------->| |
| 5984 | // | | | |
| 5985 | // | | SubFail | Duplicated action |
| 5986 | // | |<-------------| |
| 5987 | // | RESTNotif (fail)| | |
| 5988 | // |<----------------| | |
| 5989 | // | | SubDelReq | |
| 5990 | // | |------------->| |
| 5991 | // | | | |
| 5992 | // | | SubDelResp | |
| 5993 | // | |<-------------| |
| 5994 | // |
| 5995 | //----------------------------------------------------------------------------- |
| 5996 | func TestRESTUnpackSubscriptionFailureUnknownInstanceId(t *testing.T) { |
| 5997 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureUnknownInstanceId") |
| 5998 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 5999 | |
| 6000 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6001 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6002 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6003 | |
| 6004 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6005 | |
| 6006 | // Unknown instanceId in this response which will result resending original request |
| 6007 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6008 | fparams.Set(crereq) |
| 6009 | fparams.Fail.RequestId.InstanceId = 0 |
| 6010 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6011 | |
| 6012 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6013 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6014 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6015 | |
| 6016 | // Subscription already created in E2 Node. |
| 6017 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6018 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6019 | |
| 6020 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6021 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6022 | |
| 6023 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6024 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 6025 | |
| 6026 | // Wait that subs is cleaned |
| 6027 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6028 | |
| 6029 | xappConn1.TestMsgChanEmpty(t) |
| 6030 | e2termConn1.TestMsgChanEmpty(t) |
| 6031 | mainCtrl.wait_registry_empty(t, 10) |
| 6032 | } |
| 6033 | |
| 6034 | //----------------------------------------------------------------------------- |
| 6035 | // TestRESTUnpackSubscriptionFailureNoTransaction |
| 6036 | // |
| 6037 | // stub stub |
| 6038 | // +-------+ +---------+ +---------+ |
| 6039 | // | xapp | | submgr | | e2term | |
| 6040 | // +-------+ +---------+ +---------+ |
| 6041 | // | | | |
| 6042 | // | RestSubReq | | |
| 6043 | // |---------------->| | |
| 6044 | // | | | |
| 6045 | // | RESTSubResp | | |
| 6046 | // |<----------------| | |
| 6047 | // | | | |
| 6048 | // | | SubReq | |
| 6049 | // | |------------->| |
| 6050 | // | | | |
| 6051 | // | | SubFail | No transaction for the response |
| 6052 | // | |<-------------| |
| 6053 | // | | | |
| 6054 | // | | SubReq | |
| 6055 | // | |------------->| |
| 6056 | // | | | |
| 6057 | // | | SubFail | Duplicated action |
| 6058 | // | |<-------------| |
| 6059 | // | RESTNotif (fail)| | |
| 6060 | // |<----------------| | |
| 6061 | // | | SubDelReq | |
| 6062 | // | |------------->| |
| 6063 | // | | | |
| 6064 | // | | SubDelResp | |
| 6065 | // | |<-------------| |
| 6066 | // |
| 6067 | //----------------------------------------------------------------------------- |
| 6068 | func TestRESTUnpackSubscriptionFailureNoTransaction(t *testing.T) { |
| 6069 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionFailureNoTransaction") |
| 6070 | subReqCount := 1 |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6071 | |
| 6072 | // Req |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6073 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6074 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6075 | |
| 6076 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 6077 | |
| 6078 | mainCtrl.MakeTransactionNil(t, crereq.RequestId.InstanceId) |
| 6079 | |
| 6080 | // No transaction exist for this response which will result resending original request |
| 6081 | fparams := &teststube2ap.E2StubSubsFailParams{} |
| 6082 | fparams.Set(crereq) |
| 6083 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6084 | |
| 6085 | _, cremsg = e2termConn1.RecvSubsReq(t) |
| 6086 | |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6087 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Anssi Mannila | 5112239 | 2021-05-25 11:51:31 +0300 | [diff] [blame] | 6088 | |
| 6089 | // Subscription already created in E2 Node. |
| 6090 | fparams.SetCauseVal(0, 1, 3) // CauseRIC / duplicate-action |
| 6091 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
| 6092 | |
| 6093 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6094 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6095 | |
| 6096 | // Resending happens because there no transaction |
| 6097 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6098 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6099 | |
| 6100 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6101 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 6102 | |
| 6103 | // Wait that subs is cleaned |
| 6104 | mainCtrl.wait_subs_clean(t, crereq.RequestId.InstanceId, 10) |
| 6105 | |
| 6106 | xappConn1.TestMsgChanEmpty(t) |
| 6107 | e2termConn1.TestMsgChanEmpty(t) |
| 6108 | mainCtrl.wait_registry_empty(t, 10) |
| 6109 | } |
| 6110 | |
| 6111 | //----------------------------------------------------------------------------- |
| 6112 | // TestRESTUnpackSubscriptionDeleteResponseDecodeFail |
| 6113 | // |
| 6114 | // stub stub |
| 6115 | // +-------+ +---------+ +---------+ |
| 6116 | // | xapp | | submgr | | e2term | |
| 6117 | // +-------+ +---------+ +---------+ |
| 6118 | // | | | |
| 6119 | // | [SUBS CREATE] | |
| 6120 | // | | | |
| 6121 | // | | | |
| 6122 | // | RESTSubDelReq | | |
| 6123 | // |---------------->| | |
| 6124 | // | | | |
| 6125 | // | RESTSubDelResp | | |
| 6126 | // |<----------------| | |
| 6127 | // | | | |
| 6128 | // | | SubDelReq | |
| 6129 | // | |------------->| |
| 6130 | // | | | |
| 6131 | // | | SubDelResp | ASN.1 decode fails |
| 6132 | // | |<-------------| |
| 6133 | // | | | |
| 6134 | // | | SubDelReq | |
| 6135 | // | |------------->| |
| 6136 | // | | | |
| 6137 | // | | SubDelFail | Subscription does exist any more |
| 6138 | // | |<-------------| |
| 6139 | // | | | |
| 6140 | // |
| 6141 | //----------------------------------------------------------------------------- |
| 6142 | func TestRESTUnpackSubscriptionDeleteResponseDecodeFail(t *testing.T) { |
| 6143 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseDecodeFail") |
| 6144 | |
| 6145 | // Req |
| 6146 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6147 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6148 | |
| 6149 | // Del |
| 6150 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6151 | |
| 6152 | // E2t: Receive 1st SubsDelReq |
| 6153 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6154 | |
| 6155 | // Decode of this response fails which will result resending original request |
| 6156 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_REQ) |
| 6157 | |
| 6158 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6159 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6160 | |
| 6161 | // Subscription does not exist in in E2 Node. |
| 6162 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6163 | |
| 6164 | // Wait that subs is cleaned |
| 6165 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6166 | |
| 6167 | xappConn1.TestMsgChanEmpty(t) |
| 6168 | e2termConn1.TestMsgChanEmpty(t) |
| 6169 | mainCtrl.wait_registry_empty(t, 10) |
| 6170 | } |
| 6171 | |
| 6172 | //----------------------------------------------------------------------------- |
| 6173 | // TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId |
| 6174 | // |
| 6175 | // stub stub |
| 6176 | // +-------+ +---------+ +---------+ |
| 6177 | // | xapp | | submgr | | e2term | |
| 6178 | // +-------+ +---------+ +---------+ |
| 6179 | // | | | |
| 6180 | // | [SUBS CREATE] | |
| 6181 | // | | | |
| 6182 | // | | | |
| 6183 | // | RESTSubDelReq | | |
| 6184 | // |---------------->| | |
| 6185 | // | | | |
| 6186 | // | RESTSubDelResp | | |
| 6187 | // |<----------------| | |
| 6188 | // | | | |
| 6189 | // | | SubDelReq | |
| 6190 | // | |------------->| |
| 6191 | // | | | |
| 6192 | // | | SubDelResp | Unknown instanceId |
| 6193 | // | |<-------------| |
| 6194 | // | | | |
| 6195 | // | | SubDelReq | |
| 6196 | // | |------------->| |
| 6197 | // | | | |
| 6198 | // | | SubDelFail | Subscription does exist any more |
| 6199 | // | |<-------------| |
| 6200 | // |
| 6201 | //----------------------------------------------------------------------------- |
| 6202 | func TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId(t *testing.T) { |
| 6203 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseUnknownInstanceId") |
| 6204 | |
| 6205 | // Req |
| 6206 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6207 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6208 | |
| 6209 | // Del |
| 6210 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6211 | |
| 6212 | // E2t: Receive 1st SubsDelReq |
| 6213 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6214 | |
| 6215 | // Unknown instanceId in this response which will result resending original request |
| 6216 | delreq.RequestId.InstanceId = 0 |
| 6217 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6218 | |
| 6219 | // E2t: Receive 2nd SubsDelReq |
| 6220 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6221 | |
| 6222 | // Subscription does not exist in in E2 Node. |
| 6223 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6224 | |
| 6225 | // Wait that subs is cleaned |
| 6226 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6227 | |
| 6228 | xappConn1.TestMsgChanEmpty(t) |
| 6229 | e2termConn1.TestMsgChanEmpty(t) |
| 6230 | mainCtrl.wait_registry_empty(t, 10) |
| 6231 | } |
| 6232 | |
| 6233 | //----------------------------------------------------------------------------- |
| 6234 | // TestRESTUnpackSubscriptionDeleteResponseNoTransaction |
| 6235 | // |
| 6236 | // stub stub |
| 6237 | // +-------+ +---------+ +---------+ |
| 6238 | // | xapp | | submgr | | e2term | |
| 6239 | // +-------+ +---------+ +---------+ |
| 6240 | // | | | |
| 6241 | // | [SUBS CREATE] | |
| 6242 | // | | | |
| 6243 | // | | | |
| 6244 | // | RESTSubDelReq | | |
| 6245 | // |---------------->| | |
| 6246 | // | | | |
| 6247 | // | RESTSubDelResp | | |
| 6248 | // |<----------------| | |
| 6249 | // | | | |
| 6250 | // | | SubDelReq | |
| 6251 | // | |------------->| |
| 6252 | // | | | |
| 6253 | // | | SubDelResp | No transaction for the response |
| 6254 | // | |<-------------| |
| 6255 | // | | | |
| 6256 | // | | SubDelReq | |
| 6257 | // | |------------->| |
| 6258 | // | | | |
| 6259 | // | | SubDelFail | Subscription does exist any more |
| 6260 | // | |<-------------| |
| 6261 | // |
| 6262 | //----------------------------------------------------------------------------- |
| 6263 | func TestRESTUnpackSubscriptionDeleteResponseNoTransaction(t *testing.T) { |
| 6264 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteResponseNoTransaction") |
| 6265 | |
| 6266 | // Req |
| 6267 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6268 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6269 | |
| 6270 | // Del |
| 6271 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6272 | |
| 6273 | // E2t: Receive 1st SubsDelReq |
| 6274 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6275 | |
| 6276 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6277 | |
| 6278 | // No transaction exist for this response which will result resending original request |
| 6279 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6280 | |
| 6281 | // E2t: Receive 2nd SubsDelReq |
| 6282 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6283 | |
| 6284 | // Subscription does not exist in in E2 Node. |
| 6285 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6286 | |
| 6287 | // Wait that subs is cleaned |
| 6288 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6289 | |
| 6290 | xappConn1.TestMsgChanEmpty(t) |
| 6291 | e2termConn1.TestMsgChanEmpty(t) |
| 6292 | mainCtrl.wait_registry_empty(t, 10) |
| 6293 | } |
| 6294 | |
| 6295 | //----------------------------------------------------------------------------- |
| 6296 | // TestRESTUnpackSubscriptionDeleteFailureDecodeFail |
| 6297 | // |
| 6298 | // stub stub |
| 6299 | // +-------+ +---------+ +---------+ |
| 6300 | // | xapp | | submgr | | e2term | |
| 6301 | // +-------+ +---------+ +---------+ |
| 6302 | // | | | |
| 6303 | // | [SUBS CREATE] | |
| 6304 | // | | | |
| 6305 | // | | | |
| 6306 | // | RESTSubDelReq | | |
| 6307 | // |---------------->| | |
| 6308 | // | | | |
| 6309 | // | RESTSubDelResp | | |
| 6310 | // |<----------------| | |
| 6311 | // | | | |
| 6312 | // | | SubDelReq | |
| 6313 | // | |------------->| |
| 6314 | // | | | |
| 6315 | // | | SubDelFail | ASN.1 decode fails |
| 6316 | // | |<-------------| |
| 6317 | // | | | |
| 6318 | // | | SubDelReq | |
| 6319 | // | |------------->| |
| 6320 | // | | | |
| 6321 | // | | SubDelFail | Subscription does exist any more |
| 6322 | // | |<-------------| |
| 6323 | // |
| 6324 | //----------------------------------------------------------------------------- |
| 6325 | func TestRESTUnpackSubscriptionDeleteFailureDecodeFail(t *testing.T) { |
| 6326 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureDecodeFail") |
| 6327 | |
| 6328 | // Req |
| 6329 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6330 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6331 | |
| 6332 | // Del |
| 6333 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6334 | |
| 6335 | // E2t: Receive 1st SubsDelReq |
| 6336 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6337 | |
| 6338 | // Decode of this response fails which will result resending original request |
| 6339 | e2termConn1.SendInvalidE2Asn1Resp(t, delmsg, xapp.RIC_SUB_DEL_FAILURE) |
| 6340 | |
| 6341 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 6342 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6343 | |
| 6344 | // Subscription does not exist in in E2 Node. |
| 6345 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6346 | |
| 6347 | // Wait that subs is cleaned |
| 6348 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6349 | |
| 6350 | xappConn1.TestMsgChanEmpty(t) |
| 6351 | e2termConn1.TestMsgChanEmpty(t) |
| 6352 | mainCtrl.wait_registry_empty(t, 10) |
| 6353 | } |
| 6354 | |
| 6355 | //----------------------------------------------------------------------------- |
| 6356 | // TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId |
| 6357 | // |
| 6358 | // stub stub |
| 6359 | // +-------+ +---------+ +---------+ |
| 6360 | // | xapp | | submgr | | e2term | |
| 6361 | // +-------+ +---------+ +---------+ |
| 6362 | // | | | |
| 6363 | // | [SUBS CREATE] | |
| 6364 | // | | | |
| 6365 | // | | | |
| 6366 | // | RESTSubDelReq | | |
| 6367 | // |---------------->| | |
| 6368 | // | | | |
| 6369 | // | RESTSubDelResp | | |
| 6370 | // |<----------------| | |
| 6371 | // | | | |
| 6372 | // | | SubDelReq | |
| 6373 | // | |------------->| |
| 6374 | // | | | |
| 6375 | // | | SubDelFail | Unknown instanceId |
| 6376 | // | |<-------------| |
| 6377 | // | | | |
| 6378 | // | | SubDelReq | |
| 6379 | // | |------------->| |
| 6380 | // | | | |
| 6381 | // | | SubDelFail | Subscription does exist any more |
| 6382 | // | |<-------------| |
| 6383 | // |
| 6384 | //----------------------------------------------------------------------------- |
| 6385 | func TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId(t *testing.T) { |
| 6386 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteailureUnknownInstanceId") |
| 6387 | |
| 6388 | // Req |
| 6389 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6390 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6391 | |
| 6392 | // Del |
| 6393 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6394 | |
| 6395 | // E2t: Receive 1st SubsDelReq |
| 6396 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6397 | |
| 6398 | // Unknown instanceId in this response which will result resending original request |
| 6399 | delreq.RequestId.InstanceId = 0 |
| 6400 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6401 | |
| 6402 | // E2t: Receive 2nd SubsDelReq |
| 6403 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6404 | |
| 6405 | // Subscription does not exist in in E2 Node. |
| 6406 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6407 | |
| 6408 | // Wait that subs is cleaned |
| 6409 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6410 | |
| 6411 | xappConn1.TestMsgChanEmpty(t) |
| 6412 | e2termConn1.TestMsgChanEmpty(t) |
| 6413 | mainCtrl.wait_registry_empty(t, 10) |
| 6414 | } |
| 6415 | |
| 6416 | //----------------------------------------------------------------------------- |
| 6417 | // TestRESTUnpackSubscriptionDeleteFailureNoTransaction |
| 6418 | // |
| 6419 | // stub stub |
| 6420 | // +-------+ +---------+ +---------+ |
| 6421 | // | xapp | | submgr | | e2term | |
| 6422 | // +-------+ +---------+ +---------+ |
| 6423 | // | | | |
| 6424 | // | [SUBS CREATE] | |
| 6425 | // | | | |
| 6426 | // | | | |
| 6427 | // | RESTSubDelReq | | |
| 6428 | // |---------------->| | |
| 6429 | // | | | |
| 6430 | // | RESTSubDelResp | | |
| 6431 | // |<----------------| | |
| 6432 | // | | | |
| 6433 | // | | SubDelReq | |
| 6434 | // | |------------->| |
| 6435 | // | | | |
| 6436 | // | | SubDelFail | No transaction for the response |
| 6437 | // | |<-------------| |
| 6438 | // | | | |
| 6439 | // | | SubDelReq | |
| 6440 | // | |------------->| |
| 6441 | // | | | |
| 6442 | // | | SubDelFail | Subscription does exist any more |
| 6443 | // | |<-------------| |
| 6444 | // |
| 6445 | //----------------------------------------------------------------------------- |
| 6446 | func TestRESTUnpackSubscriptionDeleteFailureNoTransaction(t *testing.T) { |
| 6447 | xapp.Logger.Info("TEST: TestRESTUnpackSubscriptionDeleteFailureNoTransaction") |
| 6448 | |
| 6449 | // Req |
| 6450 | var params *teststube2ap.RESTSubsReqParams = nil |
| 6451 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 6452 | |
| 6453 | // Del |
| 6454 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 6455 | |
| 6456 | // E2t: Receive 1st SubsDelReq |
| 6457 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6458 | |
| 6459 | mainCtrl.MakeTransactionNil(t, e2SubsId) |
| 6460 | |
| 6461 | // No transaction exist for this response which will result resending original request |
| 6462 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6463 | |
| 6464 | // E2t: Receive 2nd SubsDelReq |
| 6465 | delreq, delmsg = e2termConn1.RecvSubsDelReq(t) |
| 6466 | |
| 6467 | // Subscription does not exist in in E2 Node. |
| 6468 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6469 | |
| 6470 | // Wait that subs is cleaned |
| 6471 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 6472 | |
| 6473 | xappConn1.TestMsgChanEmpty(t) |
| 6474 | e2termConn1.TestMsgChanEmpty(t) |
| 6475 | mainCtrl.wait_registry_empty(t, 10) |
| 6476 | } |
| 6477 | |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6478 | //----------------------------------------------------------------------------- |
| 6479 | // TestRESTSubReqFailAsn1PackSubReqError |
| 6480 | // |
| 6481 | // stub stub |
| 6482 | // +-------+ +---------+ +---------+ |
| 6483 | // | xapp | | submgr | | e2term | |
| 6484 | // +-------+ +---------+ +---------+ |
| 6485 | // | | | |
| 6486 | // | RESTSubReq | | |
| 6487 | // |---------------->| | |
| 6488 | // | | | |
| 6489 | // | RESTSubResp | | |
| 6490 | // |<----------------| | |
| 6491 | // | | | |
| 6492 | // | ASN.1 encode fails | |
| 6493 | // | | | |
| 6494 | // | | SubDelReq | |
| 6495 | // | |------------->| |
| 6496 | // | | | |
| 6497 | // | | SubDelFail | |
| 6498 | // | |<-------------| |
| 6499 | // | | | |
| 6500 | // | RESTNotif | | |
| 6501 | // | unsuccess | | |
| 6502 | // |<----------------| | |
| 6503 | // | | | |
| 6504 | // | [SUBS DELETE] | |
| 6505 | // | | | |
| 6506 | // |
| 6507 | //----------------------------------------------------------------------------- |
| 6508 | func TestRESTSubReqFailAsn1PackSubReqError(t *testing.T) { |
| 6509 | |
| 6510 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
Konstantinos Archangelof | 27433e7 | 2021-05-31 08:30:35 +0000 | [diff] [blame] | 6511 | Counter{cRestSubReqFromXapp, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6512 | Counter{cRestSubRespToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6513 | Counter{cSubDelReqToE2, 1}, |
| 6514 | Counter{cSubDelFailFromE2, 1}, |
Anssi Mannila | 316d8a1 | 2021-06-02 11:08:54 +0300 | [diff] [blame] | 6515 | Counter{cRestSubFailNotifToXapp, 1}, |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6516 | }) |
| 6517 | |
| 6518 | subReqCount := 1 |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6519 | |
| 6520 | var params *teststube2ap.RESTSubsReqParams = nil |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6521 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount) |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6522 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, false) |
| 6523 | |
| 6524 | // Req |
| 6525 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6526 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 6527 | |
| 6528 | // E2t: Receive SubsDelReq |
| 6529 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | 55d2a28 | 2021-06-04 14:46:56 +0300 | [diff] [blame] | 6530 | xappConn1.ExpectRESTNotificationNok(t, restSubId, "allFail") |
Konstantinos Archangelof | b3277dc | 2021-05-25 14:21:51 +0000 | [diff] [blame] | 6531 | |
| 6532 | // Subscription does not exist in in E2 Node. |
| 6533 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 6534 | |
| 6535 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6536 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 6537 | |
| 6538 | e2ap_wrapper.AllowE2apToProcess(e2ap_wrapper.SUB_REQ, true) |
| 6539 | // Wait that subs is cleaned |
| 6540 | waitSubsCleanup(t, e2SubsId, 10) |
| 6541 | mainCtrl.VerifyCounterValues(t) |
| 6542 | } |
| 6543 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6544 | //////////////////////////////////////////////////////////////////////////////////// |
| 6545 | // Services for UT cases |
| 6546 | //////////////////////////////////////////////////////////////////////////////////// |
| 6547 | const subReqCount int = 1 |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6548 | const host string = "localhost" |
| 6549 | |
| 6550 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 6551 | if params == nil { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6552 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6553 | } |
| 6554 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 6555 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 6556 | |
| 6557 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 6558 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6559 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 6560 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6561 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6562 | |
| 6563 | return restSubId, e2SubsId |
| 6564 | } |
| 6565 | |
| 6566 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 6567 | |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6568 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6569 | if meid != "" { |
| 6570 | params.SetMeid(meid) |
| 6571 | } |
| 6572 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 6573 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 6574 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 6575 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 6576 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 6577 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6578 | |
| 6579 | return restSubId, e2SubsId |
| 6580 | } |
| 6581 | |
| 6582 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6583 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6584 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6585 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 6586 | |
| 6587 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6588 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6589 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 6590 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6591 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 6592 | |
| 6593 | return restSubId, e2SubsId |
| 6594 | } |
| 6595 | |
| 6596 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
Konstantinos Archangelof | c9ef0ba | 2021-05-26 09:52:25 +0000 | [diff] [blame] | 6597 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 6598 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 6599 | |
| 6600 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 6601 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 6602 | fparams1.Set(crereq1) |
| 6603 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 6604 | |
| 6605 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 6606 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 6607 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 6608 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 6609 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 6610 | |
| 6611 | return restSubId, e2SubsId |
| 6612 | } |
| 6613 | |
| 6614 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 6615 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 6616 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6617 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6618 | } |
| 6619 | |
| 6620 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 6621 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 6622 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6623 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6624 | } |
| 6625 | |
| 6626 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 6627 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 6628 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 6629 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 6630 | } |
| 6631 | |
| 6632 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 6633 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 6634 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 6635 | assert.Equal(t, resp[0].Meid, meid) |
| 6636 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 6637 | } |
| 6638 | |
| 6639 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 6640 | //Wait that subs is cleaned |
| 6641 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 6642 | |
| 6643 | xappConn1.TestMsgChanEmpty(t) |
| 6644 | xappConn2.TestMsgChanEmpty(t) |
| 6645 | e2termConn1.TestMsgChanEmpty(t) |
| 6646 | mainCtrl.wait_registry_empty(t, timeout) |
| 6647 | } |
| 6648 | |
| 6649 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 6650 | |
| 6651 | var e2SubsId []uint32 |
| 6652 | |
| 6653 | for i := 0; i < count; i++ { |
| 6654 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 6655 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 6656 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 6657 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 6658 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 6659 | e2SubsId = append(e2SubsId, instanceId) |
| 6660 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 6661 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 6662 | <-time.After(100 * time.Millisecond) |
| 6663 | } |
| 6664 | return e2SubsId |
| 6665 | } |
| 6666 | |
| 6667 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 6668 | |
| 6669 | for i := 0; i < len(e2SubsIds); i++ { |
| 6670 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 6671 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 6672 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 6673 | <-time.After(1 * time.Second) |
| 6674 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 6675 | <-time.After(100 * time.Millisecond) |
| 6676 | } |
| 6677 | |
| 6678 | // Wait that subs is cleaned |
| 6679 | for i := 0; i < len(e2SubsIds); i++ { |
| 6680 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 6681 | } |
| 6682 | |
| 6683 | } |