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