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