Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1 | /* |
| 2 | ================================================================================== |
| 3 | Copyright (c) 2019 AT&T Intellectual Property. |
| 4 | Copyright (c) 2019 Nokia |
| 5 | |
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | you may not use this file except in compliance with the License. |
| 8 | You may obtain a copy of the License at |
| 9 | |
| 10 | http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | |
| 12 | Unless required by applicable law or agreed to in writing, software |
| 13 | distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | See the License for the specific language governing permissions and |
| 16 | limitations under the License. |
| 17 | ================================================================================== |
| 18 | */ |
| 19 | |
| 20 | package control |
| 21 | |
| 22 | import ( |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 23 | "testing" |
| 24 | "time" |
| 25 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 26 | "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 27 | "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/teststube2ap" |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 28 | "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" |
| 29 | "github.com/stretchr/testify/assert" |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 30 | ) |
| 31 | |
| 32 | //----------------------------------------------------------------------------- |
| 33 | // TestSubReqAndRouteNok |
| 34 | // |
| 35 | // stub stub |
| 36 | // +-------+ +---------+ +---------+ |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 37 | // | xapp | | submgr | | rtmgr | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 38 | // +-------+ +---------+ +---------+ |
| 39 | // | | | |
| 40 | // | SubReq | | |
| 41 | // |------------->| | |
| 42 | // | | | |
| 43 | // | | RouteCreate | |
| 44 | // | |------------->| |
| 45 | // | | | |
| 46 | // | | RouteCreate | |
| 47 | // | | status:400 | |
| 48 | // | |<-------------| |
| 49 | // | | | |
| 50 | // | [SUBS INT DELETE] | |
| 51 | // | | | |
| 52 | // |
| 53 | //----------------------------------------------------------------------------- |
| 54 | |
| 55 | func TestSubReqAndRouteNok(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 56 | CaseBegin("TestSubReqAndRouteNok") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 57 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 58 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 59 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 60 | Counter{cSubReqFromXapp, 1}, |
| 61 | Counter{cRouteCreateFail, 1}, |
| 62 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 63 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 64 | waiter := rtmgrHttp.AllocNextEvent(false) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 65 | newSubsId := mainCtrl.get_registry_next_subid(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 66 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 67 | waiter.WaitResult(t) |
| 68 | |
| 69 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 70 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 71 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 72 | xappConn1.TestMsgChanEmpty(t) |
| 73 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 74 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 75 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 76 | |
| 77 | <-time.After(1 * time.Second) |
| 78 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | //----------------------------------------------------------------------------- |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 82 | // TestSubReqAndRouteUpdateNok |
| 83 | |
| 84 | // stub stub |
| 85 | // +-------+ +-------+ +---------+ +---------+ |
| 86 | // | xapp2 | | xapp1 | | submgr | | rtmgr | |
| 87 | // +-------+ +-------+ +---------+ +---------+ |
| 88 | // | | | | |
| 89 | // | [SUBS CREATE] | | |
| 90 | // | | | | |
| 91 | // | | | | |
| 92 | // | | | | |
| 93 | // | SubReq (mergeable) | | |
| 94 | // |--------------------------->| | | |
| 95 | // | | | | |
| 96 | // | | | RouteUpdate | |
| 97 | // | | |------------->| |
| 98 | // | | | | |
| 99 | // | | | RouteUpdate | |
| 100 | // | | | status:400 | |
| 101 | // | | |<-------------| |
| 102 | // | | | | |
| 103 | // | [SUBS INT DELETE] | | |
| 104 | // | | | | |
| 105 | // | | | | |
| 106 | // | [SUBS DELETE] | | |
| 107 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 108 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 109 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 110 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 111 | |
| 112 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 113 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 114 | Counter{cSubReqFromXapp, 2}, |
| 115 | Counter{cSubReqToE2, 1}, |
| 116 | Counter{cSubRespFromE2, 1}, |
| 117 | Counter{cSubRespToXapp, 1}, |
| 118 | Counter{cRouteCreateUpdateFail, 1}, |
| 119 | Counter{cSubDelReqFromXapp, 1}, |
| 120 | Counter{cSubDelReqToE2, 1}, |
| 121 | Counter{cSubDelRespFromE2, 1}, |
| 122 | Counter{cSubDelRespToXapp, 1}, |
| 123 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 124 | |
| 125 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 126 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 127 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 128 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 129 | |
| 130 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 131 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 132 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 133 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 134 | |
| 135 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 136 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 137 | xappConn2.SendSubsReq(t, nil, nil) |
| 138 | waiter.WaitResult(t) |
| 139 | |
| 140 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 141 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 142 | |
| 143 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 144 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 145 | |
| 146 | //Wait that subs is cleaned |
| 147 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 148 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 149 | |
| 150 | xappConn1.TestMsgChanEmpty(t) |
| 151 | xappConn2.TestMsgChanEmpty(t) |
| 152 | e2termConn1.TestMsgChanEmpty(t) |
| 153 | mainCtrl.wait_registry_empty(t, 10) |
| 154 | |
| 155 | mainCtrl.VerifyCounterValues(t) |
| 156 | } |
| 157 | |
| 158 | //----------------------------------------------------------------------------- |
| 159 | // TestSubDelReqAndRouteDeleteNok |
| 160 | // |
| 161 | // stub stub |
| 162 | // +-------+ +---------+ +---------+ +---------+ |
| 163 | // | xapp | | submgr | | e2term | | rtmgr | |
| 164 | // +-------+ +---------+ +---------+ +---------+ |
| 165 | // | | | | |
| 166 | // | [SUBS CREATE] | | |
| 167 | // | | | | |
| 168 | // | | | | |
| 169 | // | | | | |
| 170 | // | SubDelReq | | | |
| 171 | // |------------->| | | |
| 172 | // | | SubDelReq | | |
| 173 | // | |------------->| | |
| 174 | // | | SubDelRsp | | |
| 175 | // | |<-------------| | |
| 176 | // | SubDelRsp | | | |
| 177 | // |<-------------| | | |
| 178 | // | | RouteDelete | | |
| 179 | // | |---------------------------->| |
| 180 | // | | | | |
| 181 | // | | RouteDelete | | |
| 182 | // | | status:400 | | |
| 183 | // | |<----------------------------| |
| 184 | // | | | | |
| 185 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 186 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 187 | |
| 188 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 189 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 190 | Counter{cSubReqFromXapp, 1}, |
| 191 | Counter{cSubReqToE2, 1}, |
| 192 | Counter{cSubRespFromE2, 1}, |
| 193 | Counter{cSubRespToXapp, 1}, |
| 194 | Counter{cSubDelReqFromXapp, 1}, |
| 195 | Counter{cRouteDeleteFail, 1}, |
| 196 | Counter{cSubDelReqToE2, 1}, |
| 197 | Counter{cSubDelRespFromE2, 1}, |
| 198 | Counter{cSubDelRespToXapp, 1}, |
| 199 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 200 | |
| 201 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 202 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 203 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 204 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 205 | |
| 206 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 207 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 208 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 209 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 210 | |
| 211 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 212 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 213 | |
| 214 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 215 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 216 | waiter.WaitResult(t) |
| 217 | |
| 218 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 219 | |
| 220 | //Wait that subs is cleaned |
| 221 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 222 | |
| 223 | xappConn1.TestMsgChanEmpty(t) |
| 224 | xappConn2.TestMsgChanEmpty(t) |
| 225 | e2termConn1.TestMsgChanEmpty(t) |
| 226 | mainCtrl.wait_registry_empty(t, 10) |
| 227 | |
| 228 | mainCtrl.VerifyCounterValues(t) |
| 229 | } |
| 230 | |
| 231 | //----------------------------------------------------------------------------- |
| 232 | // TestSubMergeDelAndRouteUpdateNok |
| 233 | // stub stub |
| 234 | // +-------+ +-------+ +---------+ +---------+ |
| 235 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 236 | // +-------+ +-------+ +---------+ +---------+ |
| 237 | // | | | | |
| 238 | // | | | | |
| 239 | // | | | | |
| 240 | // | | SubReq1 | | |
| 241 | // | |------------->| | |
| 242 | // | | | | |
| 243 | // | | | SubReq1 | |
| 244 | // | | |------------->| |
| 245 | // | | | SubResp1 | |
| 246 | // | | |<-------------| |
| 247 | // | | SubResp1 | | |
| 248 | // | |<-------------| | |
| 249 | // | | | | |
| 250 | // | SubReq2 | | |
| 251 | // |--------------------------->| | |
| 252 | // | | | | |
| 253 | // | SubResp2 | | |
| 254 | // |<---------------------------| | |
| 255 | // | | | | |
| 256 | // | | SubDelReq 1 | | |
| 257 | // | |------------->| | |
| 258 | // | | | RouteUpdate | |
| 259 | // | | |-----> rtmgr | |
| 260 | // | | | | |
| 261 | // | | | RouteUpdate | |
| 262 | // | | | status:400 | |
| 263 | // | | |<----- rtmgr | |
| 264 | // | | | | |
| 265 | // | | SubDelResp 1 | | |
| 266 | // | |<-------------| | |
| 267 | // | | | | |
| 268 | // | SubDelReq 2 | | |
| 269 | // |--------------------------->| | |
| 270 | // | | | | |
| 271 | // | | | SubDelReq 2 | |
| 272 | // | | |------------->| |
| 273 | // | | | | |
| 274 | // | | | SubDelReq 2 | |
| 275 | // | | |------------->| |
| 276 | // | | | | |
| 277 | // | SubDelResp 2 | | |
| 278 | // |<---------------------------| | |
| 279 | // |
| 280 | //----------------------------------------------------------------------------- |
| 281 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 282 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 283 | |
| 284 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 285 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 286 | Counter{cSubReqFromXapp, 2}, |
| 287 | Counter{cSubReqToE2, 1}, |
| 288 | Counter{cSubRespFromE2, 1}, |
| 289 | Counter{cSubRespToXapp, 2}, |
| 290 | Counter{cSubDelReqFromXapp, 2}, |
| 291 | Counter{cRouteDeleteUpdateFail, 1}, |
| 292 | Counter{cSubDelReqToE2, 1}, |
| 293 | Counter{cSubDelRespFromE2, 1}, |
| 294 | Counter{cSubDelRespToXapp, 2}, |
| 295 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 296 | |
| 297 | //Req1 |
| 298 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 299 | rparams1.Init() |
| 300 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 301 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 302 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 303 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 304 | |
| 305 | //Req2 |
| 306 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 307 | rparams2.Init() |
| 308 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 309 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 310 | |
| 311 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 312 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 313 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 314 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 315 | |
| 316 | //Del1 |
| 317 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 318 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 319 | waiter.WaitResult(t) |
| 320 | |
| 321 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 322 | |
| 323 | //Del2 |
| 324 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 325 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 326 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 327 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 328 | //Wait that subs is cleaned |
| 329 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 330 | |
| 331 | xappConn1.TestMsgChanEmpty(t) |
| 332 | xappConn2.TestMsgChanEmpty(t) |
| 333 | e2termConn1.TestMsgChanEmpty(t) |
| 334 | mainCtrl.wait_registry_empty(t, 10) |
| 335 | |
| 336 | mainCtrl.VerifyCounterValues(t) |
| 337 | } |
| 338 | |
| 339 | //----------------------------------------------------------------------------- |
| 340 | |
| 341 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 342 | // TestSubReqAndSubDelOk |
| 343 | // |
| 344 | // stub stub |
| 345 | // +-------+ +---------+ +---------+ |
| 346 | // | xapp | | submgr | | e2term | |
| 347 | // +-------+ +---------+ +---------+ |
| 348 | // | | | |
| 349 | // | SubReq | | |
| 350 | // |------------->| | |
| 351 | // | | | |
| 352 | // | | SubReq | |
| 353 | // | |------------->| |
| 354 | // | | | |
| 355 | // | | SubResp | |
| 356 | // | |<-------------| |
| 357 | // | | | |
| 358 | // | SubResp | | |
| 359 | // |<-------------| | |
| 360 | // | | | |
| 361 | // | | | |
| 362 | // | SubDelReq | | |
| 363 | // |------------->| | |
| 364 | // | | | |
| 365 | // | | SubDelReq | |
| 366 | // | |------------->| |
| 367 | // | | | |
| 368 | // | | SubDelResp | |
| 369 | // | |<-------------| |
| 370 | // | | | |
| 371 | // | SubDelResp | | |
| 372 | // |<-------------| | |
| 373 | // |
| 374 | //----------------------------------------------------------------------------- |
| 375 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 376 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 377 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 378 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 379 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 380 | Counter{cSubReqFromXapp, 1}, |
| 381 | Counter{cSubReqToE2, 1}, |
| 382 | Counter{cSubRespFromE2, 1}, |
| 383 | Counter{cSubRespToXapp, 1}, |
| 384 | Counter{cSubDelReqFromXapp, 1}, |
| 385 | Counter{cSubDelReqToE2, 1}, |
| 386 | Counter{cSubDelRespFromE2, 1}, |
| 387 | Counter{cSubDelRespToXapp, 1}, |
| 388 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 389 | |
| 390 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 391 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 392 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 393 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 394 | |
| 395 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 396 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 397 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 398 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 399 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 400 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 401 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 402 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 403 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 404 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 405 | |
| 406 | //Wait that subs is cleaned |
| 407 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 408 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 409 | xappConn1.TestMsgChanEmpty(t) |
| 410 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 411 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 412 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 413 | |
| 414 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 415 | } |
| 416 | |
| 417 | //----------------------------------------------------------------------------- |
| 418 | // TestSubReqRetransmission |
| 419 | // |
| 420 | // stub stub |
| 421 | // +-------+ +---------+ +---------+ |
| 422 | // | xapp | | submgr | | e2term | |
| 423 | // +-------+ +---------+ +---------+ |
| 424 | // | | | |
| 425 | // | SubReq | | |
| 426 | // |------------->| | |
| 427 | // | | | |
| 428 | // | | SubReq | |
| 429 | // | |------------->| |
| 430 | // | | | |
| 431 | // | SubReq | | |
| 432 | // | (retrans) | | |
| 433 | // |------------->| | |
| 434 | // | | | |
| 435 | // | | SubResp | |
| 436 | // | |<-------------| |
| 437 | // | | | |
| 438 | // | SubResp | | |
| 439 | // |<-------------| | |
| 440 | // | | | |
| 441 | // | [SUBS DELETE] | |
| 442 | // | | | |
| 443 | // |
| 444 | //----------------------------------------------------------------------------- |
| 445 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 446 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 447 | |
| 448 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 449 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 450 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 451 | |
| 452 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 453 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 454 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 455 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 456 | // hack as there is no real way to see has message be handled. |
| 457 | // Previuos counter check just tells that is has been received by submgr |
| 458 | // --> artificial delay |
| 459 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 460 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 461 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 462 | |
| 463 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 464 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 465 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 466 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 467 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 468 | |
| 469 | //Wait that subs is cleaned |
| 470 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 471 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 472 | xappConn1.TestMsgChanEmpty(t) |
| 473 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 474 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 475 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | //----------------------------------------------------------------------------- |
| 479 | // TestSubDelReqRetransmission |
| 480 | // |
| 481 | // stub stub |
| 482 | // +-------+ +---------+ +---------+ |
| 483 | // | xapp | | submgr | | e2term | |
| 484 | // +-------+ +---------+ +---------+ |
| 485 | // | | | |
| 486 | // | [SUBS CREATE] | |
| 487 | // | | | |
| 488 | // | | | |
| 489 | // | SubDelReq | | |
| 490 | // |------------->| | |
| 491 | // | | | |
| 492 | // | | SubDelReq | |
| 493 | // | |------------->| |
| 494 | // | | | |
| 495 | // | SubDelReq | | |
| 496 | // | (same sub) | | |
| 497 | // | (same xid) | | |
| 498 | // |------------->| | |
| 499 | // | | | |
| 500 | // | | SubDelResp | |
| 501 | // | |<-------------| |
| 502 | // | | | |
| 503 | // | SubDelResp | | |
| 504 | // |<-------------| | |
| 505 | // |
| 506 | //----------------------------------------------------------------------------- |
| 507 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 508 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 509 | |
| 510 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 511 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 512 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 513 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 514 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 515 | |
| 516 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 517 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 518 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 519 | |
| 520 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 521 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 522 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 523 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 524 | // hack as there is no real way to see has message be handled. |
| 525 | // Previuos counter check just tells that is has been received by submgr |
| 526 | // --> artificial delay |
| 527 | <-time.After(1 * time.Second) |
| 528 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 529 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 530 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 531 | |
| 532 | //Wait that subs is cleaned |
| 533 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 534 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 535 | xappConn1.TestMsgChanEmpty(t) |
| 536 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 537 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 538 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | //----------------------------------------------------------------------------- |
| 542 | // TestSubDelReqCollision |
| 543 | // |
| 544 | // stub stub |
| 545 | // +-------+ +---------+ +---------+ |
| 546 | // | xapp | | submgr | | e2term | |
| 547 | // +-------+ +---------+ +---------+ |
| 548 | // | | | |
| 549 | // | [SUBS CREATE] | |
| 550 | // | | | |
| 551 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 552 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 553 | // |------------->| | |
| 554 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 555 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 556 | // | |------------->| |
| 557 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 558 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 559 | // | (same sub) | | |
| 560 | // | (diff xid) | | |
| 561 | // |------------->| | |
| 562 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 563 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 564 | // | |<-------------| |
| 565 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 566 | // | SubDelResp 1 | | |
| 567 | // |<-------------| | |
| 568 | // | | | |
| 569 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 570 | // |<-------------| | |
| 571 | // |
| 572 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 573 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 574 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 575 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 576 | |
| 577 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 578 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 579 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 580 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 581 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 582 | |
| 583 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 584 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 585 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 586 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 587 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 588 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 589 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 590 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 591 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 592 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 593 | // hack as there is no real way to see has message be handled. |
| 594 | // Previuos counter check just tells that is has been received by submgr |
| 595 | // --> artificial delay |
| 596 | <-time.After(1 * time.Second) |
| 597 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 598 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 599 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 600 | |
| 601 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 602 | xappConn1.RecvSubsDelResp(t, nil) |
| 603 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 604 | |
| 605 | //Wait that subs is cleaned |
| 606 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 607 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 608 | xappConn1.TestMsgChanEmpty(t) |
| 609 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 610 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 611 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 612 | } |
| 613 | |
| 614 | //----------------------------------------------------------------------------- |
| 615 | // TestSubReqAndSubDelOkTwoParallel |
| 616 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 617 | // stub stub stub |
| 618 | // +-------+ +-------+ +---------+ +---------+ |
| 619 | // | xapp | | xapp | | submgr | | e2term | |
| 620 | // +-------+ +-------+ +---------+ +---------+ |
| 621 | // | | | | |
| 622 | // | | | | |
| 623 | // | | | | |
| 624 | // | | SubReq1 | | |
| 625 | // | |------------->| | |
| 626 | // | | | | |
| 627 | // | | | SubReq1 | |
| 628 | // | | |------------->| |
| 629 | // | | | | |
| 630 | // | SubReq2 | | |
| 631 | // |------------------------>| | |
| 632 | // | | | | |
| 633 | // | | | SubReq2 | |
| 634 | // | | |------------->| |
| 635 | // | | | | |
| 636 | // | | | SubResp1 | |
| 637 | // | | |<-------------| |
| 638 | // | | SubResp1 | | |
| 639 | // | |<-------------| | |
| 640 | // | | | | |
| 641 | // | | | SubResp2 | |
| 642 | // | | |<-------------| |
| 643 | // | SubResp2 | | |
| 644 | // |<------------------------| | |
| 645 | // | | | | |
| 646 | // | | [SUBS 1 DELETE] | |
| 647 | // | | | | |
| 648 | // | | [SUBS 2 DELETE] | |
| 649 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 650 | // |
| 651 | //----------------------------------------------------------------------------- |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 652 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 653 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 654 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 655 | |
| 656 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 657 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 658 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 659 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 660 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 661 | |
| 662 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 663 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 664 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 665 | |
| 666 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 667 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 668 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 669 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 670 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 671 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 672 | |
| 673 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 674 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 675 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 676 | |
| 677 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 678 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 679 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 680 | |
| 681 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 682 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 683 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 684 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 685 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 686 | //Wait that subs is cleaned |
| 687 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 688 | |
| 689 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 690 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 691 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 692 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 693 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 694 | //Wait that subs is cleaned |
| 695 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 696 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 697 | xappConn1.TestMsgChanEmpty(t) |
| 698 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 699 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 700 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 701 | } |
| 702 | |
| 703 | //----------------------------------------------------------------------------- |
| 704 | // TestSameSubsDiffRan |
| 705 | // Same subscription to different RANs |
| 706 | // |
| 707 | // stub stub |
| 708 | // +-------+ +---------+ +---------+ |
| 709 | // | xapp | | submgr | | e2term | |
| 710 | // +-------+ +---------+ +---------+ |
| 711 | // | | | |
| 712 | // | | | |
| 713 | // | | | |
| 714 | // | SubReq(r1) | | |
| 715 | // |------------->| | |
| 716 | // | | | |
| 717 | // | | SubReq(r1) | |
| 718 | // | |------------->| |
| 719 | // | | | |
| 720 | // | | SubResp(r1) | |
| 721 | // | |<-------------| |
| 722 | // | | | |
| 723 | // | SubResp(r1) | | |
| 724 | // |<-------------| | |
| 725 | // | | | |
| 726 | // | SubReq(r2) | | |
| 727 | // |------------->| | |
| 728 | // | | | |
| 729 | // | | SubReq(r2) | |
| 730 | // | |------------->| |
| 731 | // | | | |
| 732 | // | | SubResp(r2) | |
| 733 | // | |<-------------| |
| 734 | // | | | |
| 735 | // | SubResp(r2) | | |
| 736 | // |<-------------| | |
| 737 | // | | | |
| 738 | // | [SUBS r1 DELETE] | |
| 739 | // | | | |
| 740 | // | [SUBS r2 DELETE] | |
| 741 | // | | | |
| 742 | // |
| 743 | //----------------------------------------------------------------------------- |
| 744 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 745 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 746 | |
| 747 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 748 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 749 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 750 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 751 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 752 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 753 | |
| 754 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 755 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 756 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 757 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 758 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 759 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 760 | |
| 761 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 762 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 763 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 764 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 765 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 766 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 767 | //Wait that subs is cleaned |
| 768 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 769 | |
| 770 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 771 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 772 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 773 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 774 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 775 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 776 | //Wait that subs is cleaned |
| 777 | mainCtrl.wait_subs_clean(t, e2SubsId2, 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 | // TestSubReqRetryInSubmgr |
| 787 | // |
| 788 | // stub stub |
| 789 | // +-------+ +---------+ +---------+ |
| 790 | // | xapp | | submgr | | e2term | |
| 791 | // +-------+ +---------+ +---------+ |
| 792 | // | | | |
| 793 | // | SubReq | | |
| 794 | // |------------->| | |
| 795 | // | | | |
| 796 | // | | SubReq | |
| 797 | // | |------------->| |
| 798 | // | | | |
| 799 | // | | | |
| 800 | // | | SubReq | |
| 801 | // | |------------->| |
| 802 | // | | | |
| 803 | // | | SubResp | |
| 804 | // | |<-------------| |
| 805 | // | | | |
| 806 | // | SubResp | | |
| 807 | // |<-------------| | |
| 808 | // | | | |
| 809 | // | [SUBS DELETE] | |
| 810 | // | | | |
| 811 | // |
| 812 | //----------------------------------------------------------------------------- |
| 813 | |
| 814 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 815 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 816 | |
| 817 | // Init counter check |
| 818 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 819 | Counter{cSubReqFromXapp, 1}, |
| 820 | Counter{cSubReqToE2, 1}, |
| 821 | Counter{cSubReReqToE2, 1}, |
| 822 | Counter{cSubRespFromE2, 1}, |
| 823 | Counter{cSubRespToXapp, 1}, |
| 824 | Counter{cSubDelReqFromXapp, 1}, |
| 825 | Counter{cSubDelReqToE2, 1}, |
| 826 | Counter{cSubDelRespFromE2, 1}, |
| 827 | Counter{cSubDelRespToXapp, 1}, |
| 828 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 829 | |
| 830 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 831 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 832 | |
| 833 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 834 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 835 | |
| 836 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 837 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 838 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 839 | |
| 840 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 841 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 842 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 843 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 844 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 845 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 846 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 847 | |
| 848 | // Wait that subs is cleaned |
| 849 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 850 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 851 | xappConn1.TestMsgChanEmpty(t) |
| 852 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 853 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 854 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 855 | |
| 856 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | //----------------------------------------------------------------------------- |
| 860 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 861 | // |
| 862 | // stub stub |
| 863 | // +-------+ +---------+ +---------+ |
| 864 | // | xapp | | submgr | | e2term | |
| 865 | // +-------+ +---------+ +---------+ |
| 866 | // | | | |
| 867 | // | SubReq | | |
| 868 | // |------------->| | |
| 869 | // | | | |
| 870 | // | | SubReq | |
| 871 | // | |------------->| |
| 872 | // | | | |
| 873 | // | | | |
| 874 | // | | SubReq | |
| 875 | // | |------------->| |
| 876 | // | | | |
| 877 | // | | SubDelReq | |
| 878 | // | |------------->| |
| 879 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 880 | // | | SubDelResp | |
| 881 | // | |<-------------| |
| 882 | // | | | |
| 883 | // |
| 884 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 885 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 886 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 887 | |
| 888 | // Init counter check |
| 889 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 890 | Counter{cSubReqFromXapp, 1}, |
| 891 | Counter{cSubReqToE2, 1}, |
| 892 | Counter{cSubReReqToE2, 1}, |
| 893 | Counter{cSubReqTimerExpiry, 2}, |
| 894 | Counter{cSubDelReqToE2, 1}, |
| 895 | Counter{cSubDelRespFromE2, 1}, |
| 896 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 897 | |
| 898 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 899 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 900 | |
| 901 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 902 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 903 | |
| 904 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 905 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 906 | |
| 907 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 908 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 909 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 910 | |
| 911 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 912 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 913 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 914 | xappConn1.TestMsgChanEmpty(t) |
| 915 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 916 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 917 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 918 | |
| 919 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | } |
| 921 | |
| 922 | //----------------------------------------------------------------------------- |
| 923 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 924 | // |
| 925 | // stub stub |
| 926 | // +-------+ +---------+ +---------+ |
| 927 | // | xapp | | submgr | | e2term | |
| 928 | // +-------+ +---------+ +---------+ |
| 929 | // | | | |
| 930 | // | SubReq | | |
| 931 | // |------------->| | |
| 932 | // | | | |
| 933 | // | | SubReq | |
| 934 | // | |------------->| |
| 935 | // | | | |
| 936 | // | | | |
| 937 | // | | SubReq | |
| 938 | // | |------------->| |
| 939 | // | | | |
| 940 | // | | SubDelReq | |
| 941 | // | |------------->| |
| 942 | // | | | |
| 943 | // | | | |
| 944 | // | | SubDelReq | |
| 945 | // | |------------->| |
| 946 | // | | | |
| 947 | // | | | |
| 948 | // |
| 949 | //----------------------------------------------------------------------------- |
| 950 | |
| 951 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 952 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 953 | |
| 954 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 955 | Counter{cSubReqFromXapp, 1}, |
| 956 | Counter{cSubReqToE2, 1}, |
| 957 | Counter{cSubReReqToE2, 1}, |
| 958 | Counter{cSubReqTimerExpiry, 2}, |
| 959 | Counter{cSubDelReqToE2, 1}, |
| 960 | Counter{cSubDelReReqToE2, 1}, |
| 961 | Counter{cSubDelReqTimerExpiry, 2}, |
| 962 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 963 | |
| 964 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 965 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 966 | |
| 967 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 968 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 969 | |
| 970 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 971 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 972 | |
| 973 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 974 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 975 | |
| 976 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 977 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 978 | |
| 979 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 980 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 981 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 982 | xappConn1.TestMsgChanEmpty(t) |
| 983 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 984 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 985 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 986 | |
| 987 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 988 | } |
| 989 | |
| 990 | //----------------------------------------------------------------------------- |
| 991 | // TestSubReqSubFailRespInSubmgr |
| 992 | // |
| 993 | // stub stub |
| 994 | // +-------+ +---------+ +---------+ |
| 995 | // | xapp | | submgr | | e2term | |
| 996 | // +-------+ +---------+ +---------+ |
| 997 | // | | | |
| 998 | // | SubReq | | |
| 999 | // |------------->| | |
| 1000 | // | | | |
| 1001 | // | | SubReq | |
| 1002 | // | |------------->| |
| 1003 | // | | | |
| 1004 | // | | SubFail | |
| 1005 | // | |<-------------| |
| 1006 | // | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1007 | // | | SubDelReq | |
| 1008 | // | |------------->| |
| 1009 | // | | | |
| 1010 | // | | SubDelResp | |
| 1011 | // | |<-------------| |
| 1012 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1013 | // | SubFail | | |
| 1014 | // |<-------------| | |
| 1015 | // | | | |
| 1016 | // |
| 1017 | //----------------------------------------------------------------------------- |
| 1018 | |
| 1019 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1020 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1021 | |
| 1022 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1023 | Counter{cSubReqFromXapp, 1}, |
| 1024 | Counter{cSubReqToE2, 1}, |
| 1025 | Counter{cSubFailFromE2, 1}, |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1026 | Counter{cSubFailToXapp, 1}, |
| 1027 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1028 | |
| 1029 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1030 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1031 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1032 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1033 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1034 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1035 | fparams1.Set(crereq1) |
| 1036 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1037 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1038 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1039 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1040 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1041 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1042 | // Xapp: Receive SubsFail |
| 1043 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1044 | |
| 1045 | // Wait that subs is cleaned |
| 1046 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1047 | |
| 1048 | xappConn1.TestMsgChanEmpty(t) |
| 1049 | xappConn2.TestMsgChanEmpty(t) |
| 1050 | e2termConn1.TestMsgChanEmpty(t) |
| 1051 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1052 | |
| 1053 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1057 | // TestSubDelReqRetryInSubmgr |
| 1058 | // |
| 1059 | // stub stub |
| 1060 | // +-------+ +---------+ +---------+ |
| 1061 | // | xapp | | submgr | | e2term | |
| 1062 | // +-------+ +---------+ +---------+ |
| 1063 | // | | | |
| 1064 | // | [SUBS CREATE] | |
| 1065 | // | | | |
| 1066 | // | | | |
| 1067 | // | SubDelReq | | |
| 1068 | // |------------->| | |
| 1069 | // | | | |
| 1070 | // | | SubDelReq | |
| 1071 | // | |------------->| |
| 1072 | // | | | |
| 1073 | // | | SubDelReq | |
| 1074 | // | |------------->| |
| 1075 | // | | | |
| 1076 | // | | SubDelResp | |
| 1077 | // | |<-------------| |
| 1078 | // | | | |
| 1079 | // | SubDelResp | | |
| 1080 | // |<-------------| | |
| 1081 | // |
| 1082 | //----------------------------------------------------------------------------- |
| 1083 | |
| 1084 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1085 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1086 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1087 | |
| 1088 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1089 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1090 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1091 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1092 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1093 | |
| 1094 | // Subs Delete |
| 1095 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1096 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1097 | |
| 1098 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1099 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1100 | |
| 1101 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1102 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1103 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1104 | |
| 1105 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1106 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1107 | |
| 1108 | // Wait that subs is cleaned |
| 1109 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1110 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1111 | xappConn1.TestMsgChanEmpty(t) |
| 1112 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1113 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1114 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1115 | } |
| 1116 | |
| 1117 | //----------------------------------------------------------------------------- |
| 1118 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1119 | // |
| 1120 | // stub stub |
| 1121 | // +-------+ +---------+ +---------+ |
| 1122 | // | xapp | | submgr | | e2term | |
| 1123 | // +-------+ +---------+ +---------+ |
| 1124 | // | | | |
| 1125 | // | [SUBS CREATE] | |
| 1126 | // | | | |
| 1127 | // | | | |
| 1128 | // | SubDelReq | | |
| 1129 | // |------------->| | |
| 1130 | // | | | |
| 1131 | // | | SubDelReq | |
| 1132 | // | |------------->| |
| 1133 | // | | | |
| 1134 | // | | SubDelReq | |
| 1135 | // | |------------->| |
| 1136 | // | | | |
| 1137 | // | | | |
| 1138 | // | SubDelResp | | |
| 1139 | // |<-------------| | |
| 1140 | // |
| 1141 | //----------------------------------------------------------------------------- |
| 1142 | |
| 1143 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1144 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1145 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1146 | |
| 1147 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1148 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1149 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1150 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1151 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1152 | |
| 1153 | // Subs Delete |
| 1154 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1155 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1156 | |
| 1157 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1158 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1159 | |
| 1160 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1161 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1162 | |
| 1163 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1164 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1165 | |
| 1166 | // Wait that subs is cleaned |
| 1167 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1168 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1169 | xappConn1.TestMsgChanEmpty(t) |
| 1170 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1171 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1172 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | //----------------------------------------------------------------------------- |
| 1176 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1177 | // |
| 1178 | // stub stub |
| 1179 | // +-------+ +---------+ +---------+ |
| 1180 | // | xapp | | submgr | | e2term | |
| 1181 | // +-------+ +---------+ +---------+ |
| 1182 | // | | | |
| 1183 | // | [SUBS CREATE] | |
| 1184 | // | | | |
| 1185 | // | | | |
| 1186 | // | SubDelReq | | |
| 1187 | // |------------->| | |
| 1188 | // | | | |
| 1189 | // | | SubDelReq | |
| 1190 | // | |------------->| |
| 1191 | // | | | |
| 1192 | // | | SubDelFail | |
| 1193 | // | |<-------------| |
| 1194 | // | | | |
| 1195 | // | SubDelResp | | |
| 1196 | // |<-------------| | |
| 1197 | // | | | |
| 1198 | // |
| 1199 | //----------------------------------------------------------------------------- |
| 1200 | |
| 1201 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1202 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1203 | |
| 1204 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1205 | Counter{cSubReqFromXapp, 1}, |
| 1206 | Counter{cSubReqToE2, 1}, |
| 1207 | Counter{cSubRespFromE2, 1}, |
| 1208 | Counter{cSubRespToXapp, 1}, |
| 1209 | Counter{cSubDelReqFromXapp, 1}, |
| 1210 | Counter{cSubDelReqToE2, 1}, |
| 1211 | Counter{cSubDelFailFromE2, 1}, |
| 1212 | Counter{cSubDelRespToXapp, 1}, |
| 1213 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1214 | |
| 1215 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1216 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1217 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1218 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1219 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1220 | |
| 1221 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1222 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1223 | |
| 1224 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1225 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1226 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1227 | |
| 1228 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1229 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1230 | |
| 1231 | // Wait that subs is cleaned |
| 1232 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1233 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1234 | xappConn1.TestMsgChanEmpty(t) |
| 1235 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1236 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1237 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1238 | |
| 1239 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1240 | } |
| 1241 | |
| 1242 | //----------------------------------------------------------------------------- |
| 1243 | // TestSubReqAndSubDelOkSameAction |
| 1244 | // |
| 1245 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1246 | // +-------+ +-------+ +---------+ +---------+ |
| 1247 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1248 | // +-------+ +-------+ +---------+ +---------+ |
| 1249 | // | | | | |
| 1250 | // | | | | |
| 1251 | // | | | | |
| 1252 | // | | SubReq1 | | |
| 1253 | // | |------------->| | |
| 1254 | // | | | | |
| 1255 | // | | | SubReq1 | |
| 1256 | // | | |------------->| |
| 1257 | // | | | SubResp1 | |
| 1258 | // | | |<-------------| |
| 1259 | // | | SubResp1 | | |
| 1260 | // | |<-------------| | |
| 1261 | // | | | | |
| 1262 | // | SubReq2 | | |
| 1263 | // |--------------------------->| | |
| 1264 | // | | | | |
| 1265 | // | SubResp2 | | |
| 1266 | // |<---------------------------| | |
| 1267 | // | | | | |
| 1268 | // | | SubDelReq 1 | | |
| 1269 | // | |------------->| | |
| 1270 | // | | | | |
| 1271 | // | | SubDelResp 1 | | |
| 1272 | // | |<-------------| | |
| 1273 | // | | | | |
| 1274 | // | SubDelReq 2 | | |
| 1275 | // |--------------------------->| | |
| 1276 | // | | | | |
| 1277 | // | | | SubDelReq 2 | |
| 1278 | // | | |------------->| |
| 1279 | // | | | | |
| 1280 | // | | | SubDelReq 2 | |
| 1281 | // | | |------------->| |
| 1282 | // | | | | |
| 1283 | // | SubDelResp 2 | | |
| 1284 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1285 | // |
| 1286 | //----------------------------------------------------------------------------- |
| 1287 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1288 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1289 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1290 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame] | 1291 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1292 | Counter{cSubReqFromXapp, 2}, |
| 1293 | Counter{cSubReqToE2, 1}, |
| 1294 | Counter{cSubRespFromE2, 1}, |
| 1295 | Counter{cSubRespToXapp, 2}, |
| 1296 | Counter{cMergedSubscriptions, 1}, |
| 1297 | Counter{cUnmergedSubscriptions, 1}, |
| 1298 | Counter{cSubDelReqFromXapp, 2}, |
| 1299 | Counter{cSubDelReqToE2, 1}, |
| 1300 | Counter{cSubDelRespFromE2, 1}, |
| 1301 | Counter{cSubDelRespToXapp, 2}, |
| 1302 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1303 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1304 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1305 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1306 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1307 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1308 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1309 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1310 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1311 | |
| 1312 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1313 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1314 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1315 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1316 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1317 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1318 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1319 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1320 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1321 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1322 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1323 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1324 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1325 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1326 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1327 | //e2termConn1.RecvSubsDelReq(t) |
| 1328 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1329 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1330 | //Wait that subs is cleaned |
| 1331 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1332 | |
| 1333 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1334 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1335 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1336 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1337 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1338 | //Wait that subs is cleaned |
| 1339 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1340 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1341 | xappConn1.TestMsgChanEmpty(t) |
| 1342 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1343 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1344 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1345 | |
| 1346 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | //----------------------------------------------------------------------------- |
| 1350 | // TestSubReqAndSubDelOkSameActionParallel |
| 1351 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1352 | // stub stub stub |
| 1353 | // +-------+ +-------+ +---------+ +---------+ |
| 1354 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1355 | // +-------+ +-------+ +---------+ +---------+ |
| 1356 | // | | | | |
| 1357 | // | | | | |
| 1358 | // | | | | |
| 1359 | // | | SubReq1 | | |
| 1360 | // | |------------->| | |
| 1361 | // | | | | |
| 1362 | // | | | SubReq1 | |
| 1363 | // | | |------------->| |
| 1364 | // | SubReq2 | | |
| 1365 | // |--------------------------->| | |
| 1366 | // | | | SubResp1 | |
| 1367 | // | | |<-------------| |
| 1368 | // | | SubResp1 | | |
| 1369 | // | |<-------------| | |
| 1370 | // | | | | |
| 1371 | // | SubResp2 | | |
| 1372 | // |<---------------------------| | |
| 1373 | // | | | | |
| 1374 | // | | SubDelReq 1 | | |
| 1375 | // | |------------->| | |
| 1376 | // | | | | |
| 1377 | // | | SubDelResp 1 | | |
| 1378 | // | |<-------------| | |
| 1379 | // | | | | |
| 1380 | // | SubDelReq 2 | | |
| 1381 | // |--------------------------->| | |
| 1382 | // | | | | |
| 1383 | // | | | SubDelReq 2 | |
| 1384 | // | | |------------->| |
| 1385 | // | | | | |
| 1386 | // | | | SubDelReq 2 | |
| 1387 | // | | |------------->| |
| 1388 | // | | | | |
| 1389 | // | SubDelResp 2 | | |
| 1390 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1391 | // |
| 1392 | //----------------------------------------------------------------------------- |
| 1393 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1394 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1395 | |
| 1396 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1397 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1398 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1399 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1400 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1401 | |
| 1402 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1403 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1404 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1405 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1406 | |
| 1407 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1408 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1409 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1410 | |
| 1411 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1412 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1413 | |
| 1414 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1415 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1416 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1417 | |
| 1418 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1419 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1420 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1421 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1422 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1423 | |
| 1424 | //Wait that subs is cleaned |
| 1425 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1426 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1427 | xappConn1.TestMsgChanEmpty(t) |
| 1428 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1429 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1430 | mainCtrl.wait_registry_empty(t, 10) |
| 1431 | } |
| 1432 | |
| 1433 | //----------------------------------------------------------------------------- |
| 1434 | // TestSubReqAndSubDelNokSameActionParallel |
| 1435 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1436 | // stub stub stub |
| 1437 | // +-------+ +-------+ +---------+ +---------+ |
| 1438 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1439 | // +-------+ +-------+ +---------+ +---------+ |
| 1440 | // | | | | |
| 1441 | // | | | | |
| 1442 | // | | | | |
| 1443 | // | | SubReq1 | | |
| 1444 | // | |------------->| | |
| 1445 | // | | | | |
| 1446 | // | | | SubReq1 | |
| 1447 | // | | |------------->| |
| 1448 | // | SubReq2 | | |
| 1449 | // |--------------------------->| | |
| 1450 | // | | | SubFail1 | |
| 1451 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1452 | // | | | | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1453 | // | | | SubDelReq | |
| 1454 | // | | |------------->| |
| 1455 | // | | | SubDelResp | |
| 1456 | // | | |<-------------| |
| 1457 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1458 | // | | SubFail1 | | |
| 1459 | // | |<-------------| | |
| 1460 | // | | | | |
| 1461 | // | SubFail2 | | |
| 1462 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1463 | // |
| 1464 | //----------------------------------------------------------------------------- |
| 1465 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1466 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1467 | |
| 1468 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1469 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1470 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1471 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1472 | |
| 1473 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1474 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1475 | |
| 1476 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1477 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1478 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1479 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1480 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1481 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1482 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1483 | // E2t: send SubsFail (first) |
| 1484 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1485 | fparams1.Set(crereq1) |
| 1486 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1487 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1488 | // E2t: internal delete |
| 1489 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1490 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1491 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1492 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1493 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1494 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1495 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1496 | |
| 1497 | //Wait that subs is cleaned |
| 1498 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1499 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1500 | xappConn1.TestMsgChanEmpty(t) |
| 1501 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1502 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1503 | mainCtrl.wait_registry_empty(t, 10) |
| 1504 | } |
| 1505 | |
| 1506 | //----------------------------------------------------------------------------- |
| 1507 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1508 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1509 | // stub stub stub |
| 1510 | // +-------+ +-------+ +---------+ +---------+ |
| 1511 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1512 | // +-------+ +-------+ +---------+ +---------+ |
| 1513 | // | | | | |
| 1514 | // | | | | |
| 1515 | // | | | | |
| 1516 | // | | SubReq1 | | |
| 1517 | // | |------------->| | |
| 1518 | // | | | | |
| 1519 | // | | | SubReq1 | |
| 1520 | // | | |------------->| |
| 1521 | // | | SubReq2 | | |
| 1522 | // |--------------------------->| | |
| 1523 | // | | | | |
| 1524 | // | | | SubReq1 | |
| 1525 | // | | |------------->| |
| 1526 | // | | | | |
| 1527 | // | | | | |
| 1528 | // | | | SubDelReq | |
| 1529 | // | | |------------->| |
| 1530 | // | | | | |
| 1531 | // | | | SubDelResp | |
| 1532 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1533 | // |
| 1534 | //----------------------------------------------------------------------------- |
| 1535 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1536 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1537 | |
| 1538 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1539 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1540 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1541 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1542 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1543 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1544 | |
| 1545 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1546 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1547 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1548 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1549 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1550 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1551 | |
| 1552 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1553 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1554 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1555 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1556 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1557 | |
| 1558 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1559 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1560 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1561 | xappConn1.TestMsgChanEmpty(t) |
| 1562 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1563 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1564 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1565 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1566 | |
| 1567 | //----------------------------- Policy cases --------------------------------- |
| 1568 | //----------------------------------------------------------------------------- |
| 1569 | // TestSubReqPolicyAndSubDelOk |
| 1570 | // |
| 1571 | // stub stub |
| 1572 | // +-------+ +---------+ +---------+ |
| 1573 | // | xapp | | submgr | | e2term | |
| 1574 | // +-------+ +---------+ +---------+ |
| 1575 | // | | | |
| 1576 | // | SubReq | | |
| 1577 | // |------------->| | |
| 1578 | // | | | |
| 1579 | // | | SubReq | |
| 1580 | // | |------------->| |
| 1581 | // | | | |
| 1582 | // | | SubResp | |
| 1583 | // | |<-------------| |
| 1584 | // | | | |
| 1585 | // | SubResp | | |
| 1586 | // |<-------------| | |
| 1587 | // | | | |
| 1588 | // | | | |
| 1589 | // | SubDelReq | | |
| 1590 | // |------------->| | |
| 1591 | // | | | |
| 1592 | // | | SubDelReq | |
| 1593 | // | |------------->| |
| 1594 | // | | | |
| 1595 | // | | SubDelResp | |
| 1596 | // | |<-------------| |
| 1597 | // | | | |
| 1598 | // | SubDelResp | | |
| 1599 | // |<-------------| | |
| 1600 | // |
| 1601 | //----------------------------------------------------------------------------- |
| 1602 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1603 | CaseBegin("TestSubReqAndSubDelOk") |
| 1604 | |
| 1605 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1606 | rparams1.Init() |
| 1607 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1608 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1609 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1610 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1611 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1612 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1613 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1614 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1615 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1616 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1617 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1618 | |
| 1619 | //Wait that subs is cleaned |
| 1620 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1621 | |
| 1622 | xappConn1.TestMsgChanEmpty(t) |
| 1623 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1624 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1625 | mainCtrl.wait_registry_empty(t, 10) |
| 1626 | } |
| 1627 | |
| 1628 | //----------------------------------------------------------------------------- |
| 1629 | // TestSubReqPolicyChangeAndSubDelOk |
| 1630 | // |
| 1631 | // stub stub |
| 1632 | // +-------+ +---------+ +---------+ |
| 1633 | // | xapp | | submgr | | e2term | |
| 1634 | // +-------+ +---------+ +---------+ |
| 1635 | // | | | |
| 1636 | // | SubReq | | |
| 1637 | // |------------->| | |
| 1638 | // | | | |
| 1639 | // | | SubReq | |
| 1640 | // | |------------->| |
| 1641 | // | | | |
| 1642 | // | | SubResp | |
| 1643 | // | |<-------------| |
| 1644 | // | | | |
| 1645 | // | SubResp | | |
| 1646 | // |<-------------| | |
| 1647 | // | | | |
| 1648 | // | SubReq | | |
| 1649 | // |------------->| | |
| 1650 | // | | | |
| 1651 | // | | SubReq | |
| 1652 | // | |------------->| |
| 1653 | // | | | |
| 1654 | // | | SubResp | |
| 1655 | // | |<-------------| |
| 1656 | // | | | |
| 1657 | // | SubResp | | |
| 1658 | // |<-------------| | |
| 1659 | // | | | |
| 1660 | // | SubDelReq | | |
| 1661 | // |------------->| | |
| 1662 | // | | | |
| 1663 | // | | SubDelReq | |
| 1664 | // | |------------->| |
| 1665 | // | | | |
| 1666 | // | | SubDelResp | |
| 1667 | // | |<-------------| |
| 1668 | // | | | |
| 1669 | // | SubDelResp | | |
| 1670 | // |<-------------| | |
| 1671 | // |
| 1672 | //----------------------------------------------------------------------------- |
| 1673 | |
| 1674 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1675 | CaseBegin("TestSubReqAndSubDelOk") |
| 1676 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1677 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1678 | rparams1.Init() |
| 1679 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1680 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1681 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1682 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1683 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1684 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1685 | |
| 1686 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1687 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1688 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1689 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1690 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1691 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1692 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1693 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1694 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1695 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1696 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1697 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1698 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1699 | |
| 1700 | //Wait that subs is cleaned |
| 1701 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1702 | |
| 1703 | xappConn1.TestMsgChanEmpty(t) |
| 1704 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1705 | e2termConn1.TestMsgChanEmpty(t) |
| 1706 | mainCtrl.wait_registry_empty(t, 10) |
| 1707 | } |
| 1708 | |
| 1709 | //----------------------------------------------------------------------------- |
| 1710 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1711 | // |
| 1712 | // stub stub stub |
| 1713 | // +-------+ +---------+ +---------+ +---------+ |
| 1714 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1715 | // +-------+ +---------+ +---------+ +---------+ |
| 1716 | // | | | | |
| 1717 | // | | | | |
| 1718 | // | | | | |
| 1719 | // | SubReq1 | | | |
| 1720 | // |------------->| | | |
| 1721 | // | | | | |
| 1722 | // | | SubReq1 | | |
| 1723 | // | |------------->| | |
| 1724 | // | | | | |
| 1725 | // | SubReq2 | | | |
| 1726 | // |------------->| | | |
| 1727 | // | | | | |
| 1728 | // | | SubReq2 | | |
| 1729 | // | |---------------------------->| |
| 1730 | // | | | | |
| 1731 | // | | SubResp1 | | |
| 1732 | // | |<-------------| | |
| 1733 | // | SubResp1 | | | |
| 1734 | // |<-------------| | | |
| 1735 | // | | SubResp2 | | |
| 1736 | // | |<----------------------------| |
| 1737 | // | SubResp2 | | | |
| 1738 | // |<-------------| | | |
| 1739 | // | | | | |
| 1740 | // | [SUBS 1 DELETE] | | |
| 1741 | // | | | | |
| 1742 | // | [SUBS 2 DELETE] | | |
| 1743 | // | | | | |
| 1744 | // |
| 1745 | //----------------------------------------------------------------------------- |
| 1746 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1747 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1748 | |
| 1749 | //Req1 |
| 1750 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1751 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1752 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1753 | |
| 1754 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1755 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1756 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1757 | |
| 1758 | //Resp1 |
| 1759 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1760 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1761 | |
| 1762 | //Resp2 |
| 1763 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1764 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1765 | |
| 1766 | //Del1 |
| 1767 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1768 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1769 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1770 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1771 | //Wait that subs is cleaned |
| 1772 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1773 | |
| 1774 | //Del2 |
| 1775 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1776 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1777 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1778 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1779 | //Wait that subs is cleaned |
| 1780 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1781 | |
| 1782 | xappConn1.TestMsgChanEmpty(t) |
| 1783 | xappConn2.TestMsgChanEmpty(t) |
| 1784 | e2termConn1.TestMsgChanEmpty(t) |
| 1785 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1786 | mainCtrl.wait_registry_empty(t, 10) |
| 1787 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1788 | |
| 1789 | //----------------------------------------------------------------------------- |
| 1790 | // TestSubReqInsertAndSubDelOk |
| 1791 | // |
| 1792 | // stub stub |
| 1793 | // +-------+ +---------+ +---------+ |
| 1794 | // | xapp | | submgr | | e2term | |
| 1795 | // +-------+ +---------+ +---------+ |
| 1796 | // | | | |
| 1797 | // | SubReq | | |
| 1798 | // |------------->| | |
| 1799 | // | | | |
| 1800 | // | | SubReq | |
| 1801 | // | |------------->| |
| 1802 | // | | | |
| 1803 | // | | SubResp | |
| 1804 | // | |<-------------| |
| 1805 | // | | | |
| 1806 | // | SubResp | | |
| 1807 | // |<-------------| | |
| 1808 | // | | | |
| 1809 | // | | | |
| 1810 | // | SubDelReq | | |
| 1811 | // |------------->| | |
| 1812 | // | | | |
| 1813 | // | | SubDelReq | |
| 1814 | // | |------------->| |
| 1815 | // | | | |
| 1816 | // | | SubDelResp | |
| 1817 | // | |<-------------| |
| 1818 | // | | | |
| 1819 | // | SubDelResp | | |
| 1820 | // |<-------------| | |
| 1821 | // |
| 1822 | //----------------------------------------------------------------------------- |
| 1823 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1824 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1825 | |
| 1826 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1827 | rparams1.Init() |
| 1828 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 1829 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1830 | |
| 1831 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1832 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1833 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1834 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1835 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1836 | |
| 1837 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1838 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1839 | |
| 1840 | //Wait that subs is cleaned |
| 1841 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1842 | |
| 1843 | xappConn1.TestMsgChanEmpty(t) |
| 1844 | xappConn2.TestMsgChanEmpty(t) |
| 1845 | e2termConn1.TestMsgChanEmpty(t) |
| 1846 | mainCtrl.wait_registry_empty(t, 10) |
| 1847 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 1848 | |
| 1849 | //----------------------------------------------------------------------------- |
| 1850 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 1851 | // |
| 1852 | // This case simulates case where xApp restarts and starts sending same |
| 1853 | // subscription requests which have already subscribed successfully |
| 1854 | |
| 1855 | // stub stub |
| 1856 | // +-------+ +---------+ +---------+ |
| 1857 | // | xapp | | submgr | | e2term | |
| 1858 | // +-------+ +---------+ +---------+ |
| 1859 | // | | | |
| 1860 | // | SubReq | | |
| 1861 | // |------------->| | |
| 1862 | // | | | |
| 1863 | // | | SubReq | |
| 1864 | // | |------------->| |
| 1865 | // | | | |
| 1866 | // | | SubResp | |
| 1867 | // | |<-------------| |
| 1868 | // | | | |
| 1869 | // | SubResp | | |
| 1870 | // |<-------------| | |
| 1871 | // | | | |
| 1872 | // | xApp restart | | |
| 1873 | // | | | |
| 1874 | // | SubReq | | |
| 1875 | // | (retrans with same xApp generated subid but diff xid) |
| 1876 | // |------------->| | |
| 1877 | // | | | |
| 1878 | // | SubResp | | |
| 1879 | // |<-------------| | |
| 1880 | // | | | |
| 1881 | // | [SUBS DELETE] | |
| 1882 | // | | | |
| 1883 | // |
| 1884 | //----------------------------------------------------------------------------- |
| 1885 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 1886 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 1887 | |
| 1888 | //Subs Create |
| 1889 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 1890 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1891 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1892 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1893 | |
| 1894 | // xApp restart here |
| 1895 | // --> artificial delay |
| 1896 | <-time.After(1 * time.Second) |
| 1897 | |
| 1898 | //Subs Create |
| 1899 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 1900 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1901 | |
| 1902 | //Subs Delete |
| 1903 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1904 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1905 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1906 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1907 | |
| 1908 | //Wait that subs is cleaned |
| 1909 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1910 | |
| 1911 | xappConn1.TestMsgChanEmpty(t) |
| 1912 | xappConn2.TestMsgChanEmpty(t) |
| 1913 | e2termConn1.TestMsgChanEmpty(t) |
| 1914 | mainCtrl.wait_registry_empty(t, 10) |
| 1915 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 1916 | |
| 1917 | //----------------------------------------------------------------------------- |
| 1918 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 1919 | // |
| 1920 | // stub stub |
| 1921 | // +-------+ +---------+ +---------+ |
| 1922 | // | xapp | | submgr | | e2term | |
| 1923 | // +-------+ +---------+ +---------+ |
| 1924 | // | | | |
| 1925 | // | SubReq | | |
| 1926 | // |------------->| | |
| 1927 | // | | | |
| 1928 | // | | SubReq | |
| 1929 | // | |------------->| |
| 1930 | // | | | |
| 1931 | // | | SubResp | |
| 1932 | // | <----| |
| 1933 | // | | |
| 1934 | // | Submgr restart | |
| 1935 | // | | |
| 1936 | // | | | |
| 1937 | // | | SubDelReq | |
| 1938 | // | |------------->| |
| 1939 | // | | | |
| 1940 | // | | SubDelResp | |
| 1941 | // | |<-------------| |
| 1942 | // | | | |
| 1943 | // |
| 1944 | //----------------------------------------------------------------------------- |
| 1945 | |
| 1946 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 1947 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 1948 | |
| 1949 | // Remove possible existing subscrition |
| 1950 | mainCtrl.removeExistingSubscriptions(t) |
| 1951 | |
| 1952 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 1953 | xappConn1.SendSubsReq(t, nil, nil) |
| 1954 | e2termConn1.RecvSubsReq(t) |
| 1955 | mainCtrl.SetResetTestFlag(t, false) |
| 1956 | |
| 1957 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1958 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1959 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 1960 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 1961 | t.Logf("e2SubsId = %v", e2SubsId) |
| 1962 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 1963 | mainCtrl.SimulateRestart(t) |
| 1964 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 1965 | |
| 1966 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1967 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1968 | |
| 1969 | // Wait that subs is cleaned |
| 1970 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1971 | |
| 1972 | xappConn1.TestMsgChanEmpty(t) |
| 1973 | xappConn2.TestMsgChanEmpty(t) |
| 1974 | e2termConn1.TestMsgChanEmpty(t) |
| 1975 | mainCtrl.wait_registry_empty(t, 10) |
| 1976 | } |
| 1977 | |
| 1978 | //----------------------------------------------------------------------------- |
| 1979 | // TestSubReqAndSubDelOkWithRestartInMiddle |
| 1980 | // |
| 1981 | // stub stub |
| 1982 | // +-------+ +---------+ +---------+ |
| 1983 | // | xapp | | submgr | | e2term | |
| 1984 | // +-------+ +---------+ +---------+ |
| 1985 | // | | | |
| 1986 | // | SubReq | | |
| 1987 | // |------------->| | |
| 1988 | // | | | |
| 1989 | // | | SubReq | |
| 1990 | // | |------------->| |
| 1991 | // | | | |
| 1992 | // | | SubResp | |
| 1993 | // | |<-------------| |
| 1994 | // | | | |
| 1995 | // | SubResp | | |
| 1996 | // |<-------------| | |
| 1997 | // | | | |
| 1998 | // | | |
| 1999 | // | Submgr restart | |
| 2000 | // | | |
| 2001 | // | SubDelReq | | |
| 2002 | // |------------->| | |
| 2003 | // | | | |
| 2004 | // | | SubDelReq | |
| 2005 | // | |------------->| |
| 2006 | // | | | |
| 2007 | // | | SubDelResp | |
| 2008 | // | |<-------------| |
| 2009 | // | | | |
| 2010 | // | SubDelResp | | |
| 2011 | // |<-------------| | |
| 2012 | // |
| 2013 | //----------------------------------------------------------------------------- |
| 2014 | |
| 2015 | func TestSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 2016 | CaseBegin("TestSubReqAndSubDelOkWithRestartInMiddle") |
| 2017 | |
| 2018 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 2019 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2020 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2021 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 2022 | |
| 2023 | // Check subscription |
| 2024 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 2025 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2026 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2027 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2028 | |
| 2029 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2030 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2031 | |
| 2032 | // Check that subscription is restored correctly after restart |
| 2033 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2034 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2035 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2036 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2037 | |
| 2038 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2039 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2040 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2041 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2042 | |
| 2043 | //Wait that subs is cleaned |
| 2044 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2045 | |
| 2046 | xappConn1.TestMsgChanEmpty(t) |
| 2047 | xappConn2.TestMsgChanEmpty(t) |
| 2048 | e2termConn1.TestMsgChanEmpty(t) |
| 2049 | mainCtrl.wait_registry_empty(t, 10) |
| 2050 | } |
| 2051 | |
| 2052 | //----------------------------------------------------------------------------- |
| 2053 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2054 | // |
| 2055 | // stub stub |
| 2056 | // +-------+ +-------+ +---------+ +---------+ |
| 2057 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2058 | // +-------+ +-------+ +---------+ +---------+ |
| 2059 | // | | | | |
| 2060 | // | | | | |
| 2061 | // | | | | |
| 2062 | // | | SubReq1 | | |
| 2063 | // | |------------->| | |
| 2064 | // | | | | |
| 2065 | // | | | SubReq1 | |
| 2066 | // | | |------------->| |
| 2067 | // | | | SubResp1 | |
| 2068 | // | | |<-------------| |
| 2069 | // | | SubResp1 | | |
| 2070 | // | |<-------------| | |
| 2071 | // | | | | |
| 2072 | // | | |
| 2073 | // | submgr restart | |
| 2074 | // | | |
| 2075 | // | | | | |
| 2076 | // | | | | |
| 2077 | // | SubReq2 | | |
| 2078 | // |--------------------------->| | |
| 2079 | // | | | | |
| 2080 | // | SubResp2 | | |
| 2081 | // |<---------------------------| | |
| 2082 | // | | | | |
| 2083 | // | | SubDelReq 1 | | |
| 2084 | // | |------------->| | |
| 2085 | // | | | | |
| 2086 | // | | SubDelResp 1 | | |
| 2087 | // | |<-------------| | |
| 2088 | // | | | | |
| 2089 | // | | | | |
| 2090 | // | | |
| 2091 | // | submgr restart | |
| 2092 | // | | |
| 2093 | // | | | | |
| 2094 | // | SubDelReq 2 | | |
| 2095 | // |--------------------------->| | |
| 2096 | // | | | | |
| 2097 | // | | | SubDelReq 2 | |
| 2098 | // | | |------------->| |
| 2099 | // | | | | |
| 2100 | // | | | SubDelReq 2 | |
| 2101 | // | | |------------->| |
| 2102 | // | | | | |
| 2103 | // | SubDelResp 2 | | |
| 2104 | // |<---------------------------| | |
| 2105 | // |
| 2106 | //----------------------------------------------------------------------------- |
| 2107 | |
| 2108 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2109 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2110 | |
| 2111 | //Req1 |
| 2112 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2113 | rparams1.Init() |
| 2114 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2115 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2116 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2117 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2118 | |
| 2119 | //Req2 |
| 2120 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2121 | rparams2.Init() |
| 2122 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2123 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2124 | |
| 2125 | // Check subscription |
| 2126 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2127 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2128 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2129 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2130 | |
| 2131 | mainCtrl.SimulateRestart(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2132 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2133 | |
| 2134 | // Check that subscription is restored correctly after restart |
| 2135 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2136 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2137 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
archagge | a5c58bc | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2138 | assert.Equal(t, resp[0].ClientEndpoint, []string{"localhost:13560", "localhost:13660"}) |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 2139 | |
| 2140 | //Del1 |
| 2141 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2142 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2143 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2144 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2145 | |
| 2146 | mainCtrl.SimulateRestart(t) |
| 2147 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2148 | |
| 2149 | //Del2 |
| 2150 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2151 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2152 | |
| 2153 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2154 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2155 | |
| 2156 | //Wait that subs is cleaned |
| 2157 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2158 | |
| 2159 | xappConn1.TestMsgChanEmpty(t) |
| 2160 | xappConn2.TestMsgChanEmpty(t) |
| 2161 | e2termConn1.TestMsgChanEmpty(t) |
| 2162 | mainCtrl.wait_registry_empty(t, 10) |
| 2163 | } |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2164 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2165 | //***************************************************************************** |
| 2166 | // REST interface test cases |
| 2167 | //***************************************************************************** |
| 2168 | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2169 | //----------------------------------------------------------------------------- |
| 2170 | // Test debug GET and POST requests |
| 2171 | // |
| 2172 | // curl |
| 2173 | // +-------+ +---------+ |
| 2174 | // | user | | submgr | |
| 2175 | // +-------+ +---------+ |
| 2176 | // | | |
| 2177 | // | GET/POST Req | |
| 2178 | // |------------->| |
| 2179 | // | Resp | |
| 2180 | // |<-------------| |
| 2181 | // | | |
Anssi Mannila | 47518ae | 2021-04-16 09:27:07 +0300 | [diff] [blame] | 2182 | func TestGetSubscriptions(t *testing.T) { |
| 2183 | |
| 2184 | mainCtrl.sendGetRequest(t, "localhost:8088", "/ric/v1/subscriptions") |
| 2185 | } |
| 2186 | |
| 2187 | func TestGetSymptomData(t *testing.T) { |
| 2188 | |
| 2189 | mainCtrl.sendGetRequest(t, "localhost:8080", "/ric/v1/symptomdata") |
| 2190 | } |
| 2191 | |
| 2192 | func TestPostdeleteSubId(t *testing.T) { |
| 2193 | |
| 2194 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/deletesubid=1") |
| 2195 | } |
| 2196 | |
| 2197 | func TestPostEmptyDb(t *testing.T) { |
| 2198 | |
| 2199 | mainCtrl.sendPostRequest(t, "localhost:8080", "/ric/v1/test/emptydb") |
| 2200 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2201 | |
| 2202 | //----------------------------------------------------------------------------- |
| 2203 | // TestRESTSubReqAndRouteNok |
| 2204 | // |
| 2205 | // stub stub |
| 2206 | // +-------+ +---------+ +---------+ |
| 2207 | // | xapp | | submgr | | rtmgr | |
| 2208 | // +-------+ +---------+ +---------+ |
| 2209 | // | | | |
| 2210 | // | RESTSubReq | | |
| 2211 | // |---------------->| | |
| 2212 | // | | | |
| 2213 | // | RESTSubResp | | |
| 2214 | // |<----------------| | |
| 2215 | // | | RouteCreate | |
| 2216 | // | |------------->| |
| 2217 | // | | | |
| 2218 | // | | RouteCreate | |
| 2219 | // | | status:400 | |
| 2220 | // | |(Bad request) | |
| 2221 | // | |<-------------| |
| 2222 | // | RESTNotif | | |
| 2223 | // |<----------------| | |
| 2224 | // | | | |
| 2225 | // | [SUBS INT DELETE] | |
| 2226 | // | | | |
| 2227 | // | RESTSubDelReq | | |
| 2228 | // |---------------->| | |
| 2229 | // | RESTSubDelResp | | |
| 2230 | // |<----------------| | |
| 2231 | // |
| 2232 | //----------------------------------------------------------------------------- |
| 2233 | func TestRESTSubReqAndRouteNok(t *testing.T) { |
| 2234 | CaseBegin("TestRESTSubReqAndRouteNok") |
| 2235 | |
| 2236 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2237 | Counter{cSubReqFromXapp, 1}, |
| 2238 | Counter{cRouteCreateFail, 1}, |
| 2239 | Counter{cSubRespToXapp, 1}, |
| 2240 | Counter{cSubDelReqFromXapp, 1}, |
| 2241 | Counter{cSubDelRespToXapp, 1}, |
| 2242 | }) |
| 2243 | |
| 2244 | const subReqCount int = 1 |
| 2245 | const parameterSet = 1 |
| 2246 | const actionDefinitionPresent bool = true |
| 2247 | const actionParamCount int = 1 |
| 2248 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2249 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2250 | |
| 2251 | // Req |
| 2252 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2253 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2254 | |
| 2255 | waiter.WaitResult(t) |
| 2256 | |
| 2257 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2258 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2259 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2260 | |
| 2261 | // Del |
| 2262 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2263 | |
| 2264 | // Wait that subs is cleaned |
| 2265 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2266 | waitSubsCleanup(t, e2SubsId, 10) |
| 2267 | mainCtrl.VerifyCounterValues(t) |
| 2268 | } |
| 2269 | |
| 2270 | func TestRESTSubReqAndRouteUpdateNok(t *testing.T) { |
| 2271 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 2272 | |
| 2273 | //Init counter check |
| 2274 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2275 | Counter{cSubReqFromXapp, 2}, |
| 2276 | Counter{cSubReqToE2, 1}, |
| 2277 | Counter{cSubRespFromE2, 1}, |
| 2278 | Counter{cSubRespToXapp, 2}, |
| 2279 | Counter{cRouteCreateUpdateFail, 1}, |
| 2280 | Counter{cSubDelReqFromXapp, 1}, |
| 2281 | Counter{cSubDelReqToE2, 1}, |
| 2282 | Counter{cSubDelRespFromE2, 1}, |
| 2283 | Counter{cSubDelRespToXapp, 1}, |
| 2284 | }) |
| 2285 | |
| 2286 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2287 | |
| 2288 | //Subs Create |
| 2289 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2290 | |
| 2291 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2292 | |
| 2293 | // xapp2 ROUTE creation shall fail with 400 from rtmgr -> submgr |
| 2294 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2295 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2296 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2297 | params.SetMeid("RAN_NAME_1") |
| 2298 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2299 | xapp.Logger.Info("Send REST subscriber request for second subscriber : %v", restSubId2) |
| 2300 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 2301 | waiter.WaitResult(t) |
| 2302 | // e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) - TOD: missing delete |
| 2303 | xappConn2.WaitRESTNotification(t, restSubId2) |
| 2304 | |
| 2305 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2306 | |
| 2307 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2308 | |
| 2309 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 2310 | //Wait that subs is cleaned |
| 2311 | waitSubsCleanup(t, e2SubsId, 10) |
| 2312 | |
| 2313 | mainCtrl.VerifyCounterValues(t) |
| 2314 | } |
| 2315 | |
| 2316 | func TestRESTSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 2317 | CaseBegin("TestRESTSubDelReqAndRouteDeleteNok") |
| 2318 | |
| 2319 | // Init counter check |
| 2320 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2321 | Counter{cSubReqFromXapp, 1}, |
| 2322 | Counter{cSubReqToE2, 1}, |
| 2323 | Counter{cSubRespFromE2, 1}, |
| 2324 | Counter{cSubRespToXapp, 1}, |
| 2325 | Counter{cSubDelReqFromXapp, 1}, |
| 2326 | Counter{cRouteDeleteFail, 1}, |
| 2327 | Counter{cSubDelReqToE2, 1}, |
| 2328 | Counter{cSubDelRespFromE2, 1}, |
| 2329 | Counter{cSubDelRespToXapp, 1}, |
| 2330 | }) |
| 2331 | |
| 2332 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2333 | |
| 2334 | //Subs Create |
| 2335 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2336 | |
| 2337 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2338 | |
| 2339 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2340 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2341 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2342 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2343 | waiter.WaitResult(t) |
| 2344 | |
| 2345 | waitSubsCleanup(t, e2SubsId, 10) |
| 2346 | |
| 2347 | mainCtrl.VerifyCounterValues(t) |
| 2348 | } |
| 2349 | |
| 2350 | func TestRESTSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 2351 | CaseBegin("TestRESTSubMergeDelAndRouteUpdateNok") |
| 2352 | |
| 2353 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2354 | Counter{cSubReqFromXapp, 2}, |
| 2355 | Counter{cSubReqToE2, 1}, |
| 2356 | Counter{cSubRespFromE2, 1}, |
| 2357 | Counter{cSubRespToXapp, 2}, |
| 2358 | Counter{cSubDelReqFromXapp, 2}, |
| 2359 | Counter{cRouteDeleteUpdateFail, 1}, |
| 2360 | Counter{cSubDelReqToE2, 1}, |
| 2361 | Counter{cSubDelRespFromE2, 1}, |
| 2362 | Counter{cSubDelRespToXapp, 2}, |
| 2363 | }) |
| 2364 | |
| 2365 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2366 | |
| 2367 | //Subs Create |
| 2368 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2369 | |
| 2370 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2371 | restSubId2, e2SubsId2 := createXapp2MergedSubscription(t, "RAN_NAME_1") |
| 2372 | |
| 2373 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 2374 | |
| 2375 | //Del1, this shall fail on rtmgr side |
| 2376 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 2377 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2378 | waiter.WaitResult(t) |
| 2379 | |
| 2380 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13660"}) |
| 2381 | |
| 2382 | //Del2 |
| 2383 | deleteXapp2Subscription(t, &restSubId2) |
| 2384 | |
| 2385 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2386 | |
| 2387 | mainCtrl.VerifyCounterValues(t) |
| 2388 | } |
| 2389 | |
| 2390 | //----------------------------------------------------------------------------- |
| 2391 | // TestRESTSubReqRetransmission |
| 2392 | // |
| 2393 | // stub stub |
| 2394 | // +-------+ +---------+ +---------+ |
| 2395 | // | xapp | | submgr | | e2term | |
| 2396 | // +-------+ +---------+ +---------+ |
| 2397 | // | | | |
| 2398 | // | RESTSubReq1 | | |
| 2399 | // |---------------->| | |
| 2400 | // | | | |
| 2401 | // | RESTSubResp | | |
| 2402 | // |<----------------| | |
| 2403 | // | | SubReq1 | |
| 2404 | // | |------------->| |
| 2405 | // | | | |
| 2406 | // | RESTSubReq2 | | |
| 2407 | // | (retrans) | | |
| 2408 | // |---------------->| | |
| 2409 | // | | | |
| 2410 | // | | SubReq2 | |
| 2411 | // | |------------->| |
| 2412 | // | RESTSubResp2 | | |
| 2413 | // |<----------------| | |
| 2414 | // | | SubResp1 | |
| 2415 | // | |<-------------| |
| 2416 | // | RESTNotif1 | | |
| 2417 | // |<----------------| | |
| 2418 | // | | SubResp1 | |
| 2419 | // | |<-------------| |
| 2420 | // | RESTNotif2 | | |
| 2421 | // |<----------------| | |
| 2422 | // | | | |
| 2423 | // | [SUBS DELETE] | |
| 2424 | // | | | |
| 2425 | // |
| 2426 | //----------------------------------------------------------------------------- |
| 2427 | /* |
| 2428 | func TestRESTSubReqRetransmission(t *testing.T) { |
| 2429 | CaseBegin("TestRESTSubReqRetransmission") |
| 2430 | |
| 2431 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2432 | Counter{cSubReqFromXapp, 2}, |
| 2433 | Counter{cSubReqToE2, 2}, |
| 2434 | Counter{cSubRespFromE2, 2}, |
| 2435 | Counter{cSubRespToXapp, 2}, |
| 2436 | Counter{cSubDelReqFromXapp, 2}, |
| 2437 | Counter{cSubDelReqToE2, 2}, |
| 2438 | Counter{cSubDelRespFromE2, 2}, |
| 2439 | Counter{cSubDelRespToXapp, 2}, |
| 2440 | }) |
| 2441 | // Retry/duplicate will get the same way as the first request. Submgr cannot detect duplicate RESTRequests |
| 2442 | // Contianed duplicate messages from same xapp will not be merged. Here we use xappConn2 to simulate sending |
| 2443 | // second request from same xapp as doing it from xappConn1 would not work as notification would not be received |
| 2444 | |
| 2445 | // Subs Create |
| 2446 | const subReqCount int = 1 |
| 2447 | const parameterSet = 1 |
| 2448 | const actionDefinitionPresent bool = true |
| 2449 | const actionParamCount int = 1 |
| 2450 | |
| 2451 | // In order to force both XAPP's to create their own subscriptions, force rtmgr to block a while so that 2nd create |
| 2452 | // gets into execution before the rtmgrg responds for the first one. |
| 2453 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
| 2454 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2455 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2456 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2457 | |
| 2458 | waiter.WaitResult(t) |
| 2459 | |
| 2460 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2461 | |
| 2462 | // Depending one goroutine scheduling order, we cannot say for sure which xapp reaches e2term first. Thus |
| 2463 | // the order is not significant he6re. |
| 2464 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2465 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2466 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2467 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2468 | |
| 2469 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2470 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2471 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2472 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2473 | |
| 2474 | // Del1 |
| 2475 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 2476 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2477 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2478 | |
| 2479 | // Wait that subs is cleaned |
| 2480 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2481 | |
| 2482 | // Del2 |
| 2483 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 2484 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2485 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2486 | |
| 2487 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2488 | |
| 2489 | mainCtrl.VerifyCounterValues(t) |
| 2490 | } |
| 2491 | */ |
| 2492 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 2493 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 2494 | |
| 2495 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2496 | Counter{cSubReqFromXapp, 1}, |
| 2497 | Counter{cSubReqToE2, 1}, |
| 2498 | Counter{cSubRespFromE2, 1}, |
| 2499 | Counter{cSubRespToXapp, 1}, |
| 2500 | Counter{cSubDelReqFromXapp, 2}, |
| 2501 | Counter{cSubDelReqToE2, 1}, |
| 2502 | Counter{cSubDelRespFromE2, 1}, |
| 2503 | Counter{cSubDelRespToXapp, 1}, |
| 2504 | }) |
| 2505 | |
| 2506 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2507 | |
| 2508 | //Subs Create |
| 2509 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2510 | |
| 2511 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2512 | |
| 2513 | //Subs Delete |
| 2514 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2515 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2516 | |
| 2517 | seqBef := mainCtrl.get_msgcounter(t) |
| 2518 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2519 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 2520 | |
| 2521 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2522 | |
| 2523 | waitSubsCleanup(t, e2SubsId, 10) |
| 2524 | |
| 2525 | mainCtrl.VerifyCounterValues(t) |
| 2526 | } |
| 2527 | |
| 2528 | //----------------------------------------------------------------------------- |
| 2529 | // TestRESTSubReqDelReq |
| 2530 | // |
| 2531 | // stub stub |
| 2532 | // +-------+ +---------+ +---------+ |
| 2533 | // | xapp | | submgr | | e2term | |
| 2534 | // +-------+ +---------+ +---------+ |
| 2535 | // | | | |
| 2536 | // | RESTSubReq | | |
| 2537 | // |---------------->| | |
| 2538 | // | | | |
| 2539 | // | RESTSubResp | | |
| 2540 | // |<----------------| | |
| 2541 | // | | SubReq | |
| 2542 | // | |------------->| |
| 2543 | // | RESTSubDelReq | | |
| 2544 | // |---------------->| | |
| 2545 | // | RESTSubDelResp | | |
| 2546 | // | unsuccess | | |
| 2547 | // |<----------------| | |
| 2548 | // | | SubResp | |
| 2549 | // | |<-------------| |
| 2550 | // | RESTNotif1 | | |
| 2551 | // |<----------------| | |
| 2552 | // | | | |
| 2553 | // | [SUBS DELETE] | |
| 2554 | // | | | |
| 2555 | // |
| 2556 | //----------------------------------------------------------------------------- |
| 2557 | func TestRESTSubReqDelReq(t *testing.T) { |
| 2558 | CaseBegin("TestRESTSubReqDelReq") |
| 2559 | |
| 2560 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2561 | Counter{cSubReqFromXapp, 1}, |
| 2562 | Counter{cSubReqToE2, 1}, |
| 2563 | Counter{cSubRespFromE2, 1}, |
| 2564 | Counter{cSubRespToXapp, 1}, |
| 2565 | Counter{cSubDelReqFromXapp, 2}, |
| 2566 | Counter{cSubDelReqToE2, 1}, |
| 2567 | Counter{cSubDelRespFromE2, 1}, |
| 2568 | Counter{cSubDelRespToXapp, 1}, |
| 2569 | }) |
| 2570 | |
| 2571 | const subReqCount int = 1 |
| 2572 | const parameterSet = 1 |
| 2573 | const actionDefinitionPresent bool = true |
| 2574 | const actionParamCount int = 1 |
| 2575 | |
| 2576 | // Req |
| 2577 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2578 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2579 | |
| 2580 | // Del. This will fail as processing of the subscription |
| 2581 | // is still ongoing in submgr. Deletion is not allowed before |
| 2582 | // subscription creation has been completed. |
| 2583 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2584 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2585 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2586 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2587 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2588 | |
| 2589 | // Retry del |
| 2590 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2591 | |
| 2592 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2593 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2594 | |
| 2595 | // Wait that subs is cleaned |
| 2596 | waitSubsCleanup(t, e2SubsId, 10) |
| 2597 | mainCtrl.VerifyCounterValues(t) |
| 2598 | |
| 2599 | } |
| 2600 | |
| 2601 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 2602 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 2603 | } |
| 2604 | |
| 2605 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 2606 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 2607 | |
| 2608 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2609 | Counter{cSubReqFromXapp, 2}, |
| 2610 | Counter{cSubReqToE2, 2}, |
| 2611 | Counter{cSubRespFromE2, 2}, |
| 2612 | Counter{cSubRespToXapp, 2}, |
| 2613 | Counter{cSubDelReqFromXapp, 2}, |
| 2614 | Counter{cSubDelReqToE2, 2}, |
| 2615 | Counter{cSubDelRespFromE2, 2}, |
| 2616 | Counter{cSubDelRespToXapp, 2}, |
| 2617 | }) |
| 2618 | |
| 2619 | //Req1 |
| 2620 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2621 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2622 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2623 | |
| 2624 | //Req2 |
| 2625 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2626 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2627 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2628 | |
| 2629 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2630 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2631 | |
| 2632 | //XappConn1 receives both of the responses |
| 2633 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2634 | |
| 2635 | //Resp1 |
| 2636 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2637 | //Resp2 |
| 2638 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2639 | |
| 2640 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2641 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2642 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2643 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2644 | |
| 2645 | //Del1 |
| 2646 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2647 | //Del2 |
| 2648 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 2649 | |
| 2650 | //Wait that subs is cleaned |
| 2651 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2652 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2653 | |
| 2654 | mainCtrl.VerifyCounterValues(t) |
| 2655 | |
| 2656 | } |
| 2657 | |
| 2658 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 2659 | CaseBegin("TestRESTSameSubsDiffRan") |
| 2660 | |
| 2661 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2662 | Counter{cSubReqFromXapp, 2}, |
| 2663 | Counter{cSubReqToE2, 2}, |
| 2664 | Counter{cSubRespFromE2, 2}, |
| 2665 | Counter{cSubRespToXapp, 2}, |
| 2666 | Counter{cSubDelReqFromXapp, 2}, |
| 2667 | Counter{cSubDelReqToE2, 2}, |
| 2668 | Counter{cSubDelRespFromE2, 2}, |
| 2669 | Counter{cSubDelRespToXapp, 2}, |
| 2670 | }) |
| 2671 | |
| 2672 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2673 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2674 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2675 | |
| 2676 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2677 | params.SetMeid("RAN_NAME_2") |
| 2678 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2679 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2680 | |
| 2681 | //Del1 |
| 2682 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2683 | //Del2 |
| 2684 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 2685 | |
| 2686 | //Wait that subs is cleaned |
| 2687 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2688 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2689 | |
| 2690 | mainCtrl.VerifyCounterValues(t) |
| 2691 | |
| 2692 | } |
| 2693 | |
| 2694 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 2695 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 2696 | |
| 2697 | // Init counter check |
| 2698 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2699 | Counter{cSubReqFromXapp, 1}, |
| 2700 | Counter{cSubReqToE2, 1}, |
| 2701 | Counter{cSubReReqToE2, 1}, |
| 2702 | Counter{cSubRespFromE2, 1}, |
| 2703 | Counter{cSubRespToXapp, 1}, |
| 2704 | Counter{cSubDelReqFromXapp, 1}, |
| 2705 | Counter{cSubDelReqToE2, 1}, |
| 2706 | Counter{cSubDelRespFromE2, 1}, |
| 2707 | Counter{cSubDelRespToXapp, 1}, |
| 2708 | }) |
| 2709 | |
| 2710 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2711 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2712 | |
| 2713 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2714 | |
| 2715 | // Catch the first message and ignore it |
| 2716 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2717 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 2718 | |
| 2719 | // The second request is being handled normally |
| 2720 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2721 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2722 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2723 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2724 | |
| 2725 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2726 | |
| 2727 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2728 | |
| 2729 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2730 | //Wait that subs is cleaned |
| 2731 | waitSubsCleanup(t, e2SubsId, 10) |
| 2732 | |
| 2733 | mainCtrl.VerifyCounterValues(t) |
| 2734 | |
| 2735 | } |
| 2736 | |
| 2737 | //----------------------------------------------------------------------------- |
| 2738 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2739 | // |
| 2740 | // stub stub |
| 2741 | // +-------+ +---------+ +---------+ |
| 2742 | // | xapp | | submgr | | e2term | |
| 2743 | // +-------+ +---------+ +---------+ |
| 2744 | // | | | |
| 2745 | // | RESTSubReq | | |
| 2746 | // |---------------->| | |
| 2747 | // | | | |
| 2748 | // | RESTSubResp | | |
| 2749 | // |<----------------| | |
| 2750 | // | | SubReq | |
| 2751 | // | |------------->| |
| 2752 | // | | | |
| 2753 | // | | | |
| 2754 | // | | SubReq | |
| 2755 | // | |------------->| |
| 2756 | // | | | |
| 2757 | // | | SubDelReq | |
| 2758 | // | |------------->| |
| 2759 | // | | | |
| 2760 | // | | | |
| 2761 | // | | SubDelReq | |
| 2762 | // | |------------->| |
| 2763 | // | | | |
| 2764 | // | | | |
| 2765 | // | | SubDelResp | |
| 2766 | // | |<-------------| |
| 2767 | // | RESTNotif | | |
| 2768 | // | unsuccess | | |
| 2769 | // |<----------------| | |
| 2770 | // | | | |
| 2771 | // | [SUBS DELETE] | |
| 2772 | // | | | |
| 2773 | // |
| 2774 | //----------------------------------------------------------------------------- |
| 2775 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 2776 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 2777 | |
| 2778 | // Init counter check |
| 2779 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2780 | Counter{cSubReqFromXapp, 1}, |
| 2781 | Counter{cSubReqToE2, 1}, |
| 2782 | Counter{cSubReReqToE2, 1}, |
| 2783 | Counter{cSubReqTimerExpiry, 2}, |
| 2784 | Counter{cSubDelReqToE2, 1}, |
| 2785 | Counter{cSubDelRespFromE2, 1}, |
| 2786 | }) |
| 2787 | |
| 2788 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2789 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2790 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2791 | |
| 2792 | e2termConn1.RecvSubsReq(t) |
| 2793 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2794 | |
| 2795 | e2termConn1.RecvSubsReq(t) |
| 2796 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2797 | |
| 2798 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2799 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2800 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2801 | // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? |
| 2802 | xappConn1.WaitRESTNotification(t, restSubId) |
| 2803 | |
| 2804 | // Wait that subs is cleaned |
| 2805 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 2806 | |
| 2807 | mainCtrl.VerifyCounterValues(t) |
| 2808 | } |
| 2809 | |
| 2810 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 2811 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 2812 | |
| 2813 | // Init counter check |
| 2814 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2815 | Counter{cSubReqFromXapp, 1}, |
| 2816 | Counter{cSubReqToE2, 1}, |
| 2817 | Counter{cSubReReqToE2, 1}, |
| 2818 | Counter{cSubReqTimerExpiry, 2}, |
| 2819 | Counter{cSubDelReqToE2, 1}, |
| 2820 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2821 | }) |
| 2822 | |
| 2823 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2824 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2825 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2826 | |
| 2827 | e2termConn1.RecvSubsReq(t) |
| 2828 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2829 | |
| 2830 | e2termConn1.RecvSubsReq(t) |
| 2831 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2832 | |
| 2833 | e2termConn1.RecvSubsDelReq(t) |
| 2834 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 2835 | |
| 2836 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2837 | e2termConn1.RecvSubsDelReq(t) |
| 2838 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 2839 | |
| 2840 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2841 | |
| 2842 | waitSubsCleanup(t, e2SubsId, 10) |
| 2843 | |
| 2844 | mainCtrl.VerifyCounterValues(t) |
| 2845 | |
| 2846 | } |
| 2847 | |
| 2848 | //----------------------------------------------------------------------------- |
| 2849 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2850 | // |
| 2851 | // stub stub |
| 2852 | // +-------+ +---------+ +---------+ |
| 2853 | // | xapp | | submgr | | e2term | |
| 2854 | // +-------+ +---------+ +---------+ |
| 2855 | // | | | |
| 2856 | // | RESTSubReq | | |
| 2857 | // |---------------->| | |
| 2858 | // | | | |
| 2859 | // | RESTSubResp | | |
| 2860 | // |<----------------| | |
| 2861 | // | | SubReq | |
| 2862 | // | |------------->| |
| 2863 | // | | | |
| 2864 | // | | | |
| 2865 | // | | SubReq | |
| 2866 | // | |------------->| |
| 2867 | // | | | |
| 2868 | // | | SubDelReq | |
| 2869 | // | |------------->| |
| 2870 | // | | | |
| 2871 | // | | | |
| 2872 | // | | SubDelReq | |
| 2873 | // | |------------->| |
| 2874 | // | | | |
| 2875 | // | | | |
| 2876 | // | | SubDelResp | |
| 2877 | // | |<-------------| |
| 2878 | // | RESTNotif | | |
| 2879 | // | unsuccess | | |
| 2880 | // |<----------------| | |
| 2881 | // | | | |
| 2882 | // | [SUBS DELETE] | |
| 2883 | // | | | |
| 2884 | // |
| 2885 | //----------------------------------------------------------------------------- |
| 2886 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 2887 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 2888 | |
| 2889 | // Init counter check |
| 2890 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2891 | Counter{cSubReqFromXapp, 1}, |
| 2892 | Counter{cSubReqToE2, 1}, |
| 2893 | Counter{cSubReReqToE2, 1}, |
| 2894 | Counter{cSubReqTimerExpiry, 2}, |
| 2895 | Counter{cSubDelReqToE2, 1}, |
| 2896 | Counter{cSubDelReReqToE2, 1}, |
| 2897 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2898 | }) |
| 2899 | |
| 2900 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2901 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2902 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2903 | |
| 2904 | e2termConn1.RecvSubsReq(t) |
| 2905 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2906 | |
| 2907 | e2termConn1.RecvSubsReq(t) |
| 2908 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2909 | |
| 2910 | e2termConn1.RecvSubsDelReq(t) |
| 2911 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 2912 | |
| 2913 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2914 | e2termConn1.RecvSubsDelReq(t) |
| 2915 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 2916 | |
| 2917 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2918 | |
| 2919 | waitSubsCleanup(t, e2SubsId, 10) |
| 2920 | |
| 2921 | mainCtrl.VerifyCounterValues(t) |
| 2922 | } |
| 2923 | |
| 2924 | //----------------------------------------------------------------------------- |
| 2925 | // TestRESTSubReqSubFailRespInSubmgr |
| 2926 | // |
| 2927 | // stub stub |
| 2928 | // +-------+ +---------+ +---------+ |
| 2929 | // | xapp | | submgr | | e2term | |
| 2930 | // +-------+ +---------+ +---------+ |
| 2931 | // | | | |
| 2932 | // | RESTSubReq | | |
| 2933 | // |---------------->| | |
| 2934 | // | | | |
| 2935 | // | RESTSubResp | | |
| 2936 | // |<----------------| | |
| 2937 | // | | SubReq | |
| 2938 | // | |------------->| |
| 2939 | // | | | |
| 2940 | // | | SubFail | |
| 2941 | // | |<-------------| |
| 2942 | // | | | |
| 2943 | // | | SubDelReq | |
| 2944 | // | |------------->| |
| 2945 | // | | | |
| 2946 | // | | SubDelResp | |
| 2947 | // | |<-------------| |
| 2948 | // | | | |
| 2949 | // | RESTNotif | | |
| 2950 | // | unsuccess | | |
| 2951 | // |<----------------| | |
| 2952 | // | | | |
| 2953 | // | [SUBS DELETE] | |
| 2954 | // | | | |
| 2955 | // |
| 2956 | //----------------------------------------------------------------------------- |
| 2957 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 2958 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 2959 | |
| 2960 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2961 | Counter{cSubReqFromXapp, 1}, |
| 2962 | Counter{cSubReqToE2, 1}, |
| 2963 | Counter{cSubFailFromE2, 1}, |
| 2964 | Counter{cSubRespToXapp, 1}, |
| 2965 | Counter{cSubDelReqFromXapp, 1}, |
| 2966 | }) |
| 2967 | |
| 2968 | const subReqCount int = 1 |
| 2969 | const parameterSet = 1 |
| 2970 | const actionDefinitionPresent bool = true |
| 2971 | const actionParamCount int = 1 |
| 2972 | |
| 2973 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2974 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2975 | |
| 2976 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2977 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 2978 | fparams1.Set(crereq1) |
| 2979 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 2980 | |
| 2981 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2982 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2983 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2984 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2985 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2986 | |
| 2987 | // REST subscription sill there to be deleted |
| 2988 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2989 | |
| 2990 | // Wait that subs is cleaned |
| 2991 | waitSubsCleanup(t, e2SubsId, 10) |
| 2992 | |
| 2993 | mainCtrl.VerifyCounterValues(t) |
| 2994 | |
| 2995 | } |
| 2996 | |
| 2997 | //----------------------------------------------------------------------------- |
| 2998 | // TestRESTSubDelReqRetryInSubmgr |
| 2999 | // |
| 3000 | // stub stub |
| 3001 | // +-------+ +---------+ +---------+ |
| 3002 | // | xapp | | submgr | | e2term | |
| 3003 | // +-------+ +---------+ +---------+ |
| 3004 | // | | | |
| 3005 | // | [SUBS CREATE] | |
| 3006 | // | | | |
| 3007 | // | | | |
| 3008 | // | RESTSubDelReq | | |
| 3009 | // |---------------->| | |
| 3010 | // | | | |
| 3011 | // | RESTSubDelResp | | |
| 3012 | // |<----------------| | |
| 3013 | // | | SubDelReq | |
| 3014 | // | |------------->| |
| 3015 | // | | | |
| 3016 | // | | SubDelReq | |
| 3017 | // | |------------->| |
| 3018 | // | | | |
| 3019 | // | | SubDelResp | |
| 3020 | // | |<-------------| |
| 3021 | // | | | |
| 3022 | // |
| 3023 | //----------------------------------------------------------------------------- |
| 3024 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3025 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3026 | |
| 3027 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3028 | Counter{cSubReqFromXapp, 1}, |
| 3029 | Counter{cSubReqToE2, 1}, |
| 3030 | Counter{cSubRespFromE2, 1}, |
| 3031 | Counter{cSubRespToXapp, 1}, |
| 3032 | Counter{cSubDelReqFromXapp, 1}, |
| 3033 | Counter{cSubDelReqToE2, 1}, |
| 3034 | Counter{cSubDelReReqToE2, 1}, |
| 3035 | Counter{cSubDelRespFromE2, 1}, |
| 3036 | Counter{cSubDelRespToXapp, 1}, |
| 3037 | }) |
| 3038 | // Req |
| 3039 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3040 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3041 | |
| 3042 | // Del |
| 3043 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3044 | |
| 3045 | // E2t: Receive 1st SubsDelReq |
| 3046 | e2termConn1.RecvSubsDelReq(t) |
| 3047 | |
| 3048 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3049 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3050 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3051 | |
| 3052 | //Wait that subs is cleaned |
| 3053 | waitSubsCleanup(t, e2SubsId, 10) |
| 3054 | |
| 3055 | mainCtrl.VerifyCounterValues(t) |
| 3056 | } |
| 3057 | |
| 3058 | //----------------------------------------------------------------------------- |
| 3059 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3060 | // |
| 3061 | // stub stub |
| 3062 | // +-------+ +---------+ +---------+ |
| 3063 | // | xapp | | submgr | | e2term | |
| 3064 | // +-------+ +---------+ +---------+ |
| 3065 | // | | | |
| 3066 | // | [SUBS CREATE] | |
| 3067 | // | | | |
| 3068 | // | | | |
| 3069 | // | RESTSubDelReq | | |
| 3070 | // |---------------->| | |
| 3071 | // | | | |
| 3072 | // | RESTSubDelResp | | |
| 3073 | // |<----------------| | |
| 3074 | // | | SubDelReq | |
| 3075 | // | |------------->| |
| 3076 | // | | | |
| 3077 | // | | SubDelReq | |
| 3078 | // | |------------->| |
| 3079 | // | | | |
| 3080 | // | | | |
| 3081 | // |
| 3082 | //----------------------------------------------------------------------------- |
| 3083 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3084 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3085 | |
| 3086 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3087 | Counter{cSubReqFromXapp, 1}, |
| 3088 | Counter{cSubReqToE2, 1}, |
| 3089 | Counter{cSubRespFromE2, 1}, |
| 3090 | Counter{cSubRespToXapp, 1}, |
| 3091 | Counter{cSubDelReqFromXapp, 1}, |
| 3092 | Counter{cSubDelReqToE2, 1}, |
| 3093 | Counter{cSubDelReReqToE2, 1}, |
| 3094 | Counter{cSubDelRespFromE2, 1}, |
| 3095 | Counter{cSubDelRespToXapp, 1}, |
| 3096 | }) |
| 3097 | |
| 3098 | // Req |
| 3099 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3100 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3101 | |
| 3102 | // Del |
| 3103 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3104 | |
| 3105 | // E2t: Receive 1st SubsDelReq |
| 3106 | e2termConn1.RecvSubsDelReq(t) |
| 3107 | |
| 3108 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3109 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3110 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3111 | |
| 3112 | //Wait that subs is cleaned |
| 3113 | waitSubsCleanup(t, e2SubsId, 10) |
| 3114 | |
| 3115 | mainCtrl.VerifyCounterValues(t) |
| 3116 | } |
| 3117 | |
| 3118 | //----------------------------------------------------------------------------- |
| 3119 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3120 | // |
| 3121 | // stub stub |
| 3122 | // +-------+ +---------+ +---------+ |
| 3123 | // | xapp | | submgr | | e2term | |
| 3124 | // +-------+ +---------+ +---------+ |
| 3125 | // | | | |
| 3126 | // | [SUBS CREATE] | |
| 3127 | // | | | |
| 3128 | // | | | |
| 3129 | // | RESTSubDelReq | | |
| 3130 | // |---------------->| | |
| 3131 | // | | | |
| 3132 | // | RESTSubDelResp | | |
| 3133 | // |<----------------| | |
| 3134 | // | | SubDelReq | |
| 3135 | // | |------------->| |
| 3136 | // | | | |
| 3137 | // | | SubDelFail | |
| 3138 | // | |<-------------| |
| 3139 | // | | | |
| 3140 | // |
| 3141 | //----------------------------------------------------------------------------- |
| 3142 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3143 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3144 | |
| 3145 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3146 | Counter{cSubReqFromXapp, 1}, |
| 3147 | Counter{cSubReqToE2, 1}, |
| 3148 | Counter{cSubRespFromE2, 1}, |
| 3149 | Counter{cSubRespToXapp, 1}, |
| 3150 | Counter{cSubDelReqFromXapp, 1}, |
| 3151 | Counter{cSubDelReqToE2, 1}, |
| 3152 | Counter{cSubDelFailFromE2, 1}, |
| 3153 | Counter{cSubDelRespToXapp, 1}, |
| 3154 | }) |
| 3155 | |
| 3156 | // Req |
| 3157 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3158 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3159 | |
| 3160 | // Del |
| 3161 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3162 | |
| 3163 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3164 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3165 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3166 | |
| 3167 | //Wait that subs is cleaned |
| 3168 | waitSubsCleanup(t, e2SubsId, 10) |
| 3169 | |
| 3170 | mainCtrl.VerifyCounterValues(t) |
| 3171 | } |
| 3172 | |
| 3173 | //----------------------------------------------------------------------------- |
| 3174 | // TestRESTSubReqAndSubDelOkSameAction |
| 3175 | // |
| 3176 | // stub stub |
| 3177 | // +-------+ +-------+ +---------+ +---------+ |
| 3178 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3179 | // +-------+ +-------+ +---------+ +---------+ |
| 3180 | // | | | | |
| 3181 | // | | RESTSubReq1 | | |
| 3182 | // | |---------------->| | |
| 3183 | // | | | | |
| 3184 | // | | RESTSubResp1 | | |
| 3185 | // | |<----------------| | |
| 3186 | // | | | | |
| 3187 | // | | | SubReq1 | |
| 3188 | // | | |------------->| |
| 3189 | // | | | SubResp1 | |
| 3190 | // | | |<-------------| |
| 3191 | // | | RESTNotif1 | | |
| 3192 | // | |<----------------| | |
| 3193 | // | | | | |
| 3194 | // | RESTSubReq2 | | |
| 3195 | // |------------------------------>| | |
| 3196 | // | | | | |
| 3197 | // | RESTSubResp2 | | |
| 3198 | // |<------------------------------| | |
| 3199 | // | | | | |
| 3200 | // | | RESTNotif2 | | |
| 3201 | // |<------------------------------| | |
| 3202 | // | | | | |
| 3203 | // | | RESTSubDelReq1 | | |
| 3204 | // | |---------------->| | |
| 3205 | // | | | | |
| 3206 | // | | RESTSubDelResp1 | | |
| 3207 | // | |<----------------| | |
| 3208 | // | | | | |
| 3209 | // | RESTSubDelReq2 | | |
| 3210 | // |------------------------------>| | |
| 3211 | // | | | | |
| 3212 | // | RESTSubDelResp2 | | |
| 3213 | // |<------------------------------| | |
| 3214 | // | | | | |
| 3215 | // | | | SubDelReq2 | |
| 3216 | // | | |------------->| |
| 3217 | // | | | | |
| 3218 | // | | | SubDelResp2 | |
| 3219 | // | | |<-------------| |
| 3220 | // | | | | |
| 3221 | // |
| 3222 | //----------------------------------------------------------------------------- |
| 3223 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3224 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3225 | |
| 3226 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3227 | Counter{cSubReqFromXapp, 2}, |
| 3228 | Counter{cSubReqToE2, 1}, |
| 3229 | Counter{cSubRespFromE2, 1}, |
| 3230 | Counter{cSubRespToXapp, 2}, |
| 3231 | Counter{cMergedSubscriptions, 1}, |
| 3232 | Counter{cUnmergedSubscriptions, 1}, |
| 3233 | Counter{cSubDelReqFromXapp, 2}, |
| 3234 | Counter{cSubDelReqToE2, 1}, |
| 3235 | Counter{cSubDelRespFromE2, 1}, |
| 3236 | Counter{cSubDelRespToXapp, 2}, |
| 3237 | }) |
| 3238 | |
| 3239 | // Req1 |
| 3240 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3241 | |
| 3242 | //Subs Create |
| 3243 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3244 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3245 | |
| 3246 | // Req2 |
| 3247 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3248 | params.SetMeid("RAN_NAME_1") |
| 3249 | |
| 3250 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 3251 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame^] | 3252 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3253 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame^] | 3254 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3255 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 3256 | e2SubsId2 := <-xappConn2.RESTNotification |
| 3257 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3258 | |
| 3259 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3260 | |
| 3261 | // Del1 |
| 3262 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3263 | |
| 3264 | // Del2 |
| 3265 | deleteXapp2Subscription(t, &restSubId2) |
| 3266 | |
| 3267 | //Wait that subs is cleaned |
| 3268 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3269 | |
| 3270 | mainCtrl.VerifyCounterValues(t) |
| 3271 | } |
| 3272 | |
| 3273 | //----------------------------------------------------------------------------- |
| 3274 | // TestSubReqAndSubDelOkSameActionParallel |
| 3275 | // |
| 3276 | // stub stub stub |
| 3277 | // +-------+ +-------+ +---------+ +---------+ |
| 3278 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3279 | // +-------+ +-------+ +---------+ +---------+ |
| 3280 | // | | | | |
| 3281 | // | | | | |
| 3282 | // | | | | |
| 3283 | // | | SubReq1 | | |
| 3284 | // | |------------->| | |
| 3285 | // | | | | |
| 3286 | // | | | SubReq1 | |
| 3287 | // | | |------------->| |
| 3288 | // | SubReq2 | | |
| 3289 | // |--------------------------->| | |
| 3290 | // | | | SubResp1 | |
| 3291 | // | | |<-------------| |
| 3292 | // | | SubResp1 | | |
| 3293 | // | |<-------------| | |
| 3294 | // | | | SubReq2 | |
| 3295 | // | | |------------->| |
| 3296 | // | | | | |
| 3297 | // | | | SubResp2 | |
| 3298 | // | | |<-------------| |
| 3299 | // | SubResp2 | | |
| 3300 | // |<---------------------------| | |
| 3301 | // | | | | |
| 3302 | // | | SubDelReq 1 | | |
| 3303 | // | |------------->| | |
| 3304 | // | | | | |
| 3305 | // | | SubDelResp 1 | | |
| 3306 | // | |<-------------| | |
| 3307 | // | | | | |
| 3308 | // | SubDelReq 2 | | |
| 3309 | // |--------------------------->| | |
| 3310 | // | | | | |
| 3311 | // | | | SubDelReq 2 | |
| 3312 | // | | |------------->| |
| 3313 | // | | | | |
| 3314 | // | | | SubDelReq 2 | |
| 3315 | // | | |------------->| |
| 3316 | // | | | | |
| 3317 | // | SubDelResp 2 | | |
| 3318 | // |<---------------------------| | |
| 3319 | // |
| 3320 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 3321 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 3322 | |
| 3323 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3324 | Counter{cSubReqFromXapp, 2}, |
| 3325 | Counter{cSubReqToE2, 2}, |
| 3326 | Counter{cSubRespFromE2, 2}, |
| 3327 | Counter{cSubRespToXapp, 2}, |
| 3328 | Counter{cSubDelReqFromXapp, 2}, |
| 3329 | Counter{cSubDelReqToE2, 2}, |
| 3330 | Counter{cSubDelRespFromE2, 2}, |
| 3331 | Counter{cSubDelRespToXapp, 2}, |
| 3332 | }) |
| 3333 | |
| 3334 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3335 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3336 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3337 | |
| 3338 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3339 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3340 | |
| 3341 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3342 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3343 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3344 | |
| 3345 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3346 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3347 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3348 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3349 | |
| 3350 | // Del1 |
| 3351 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3352 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3353 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3354 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3355 | |
| 3356 | // Del2 |
| 3357 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3358 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 3359 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 3360 | |
| 3361 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3362 | |
| 3363 | mainCtrl.VerifyCounterValues(t) |
| 3364 | } |
| 3365 | |
| 3366 | //----------------------------------------------------------------------------- |
| 3367 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 3368 | // |
| 3369 | // stub stub stub |
| 3370 | // +-------+ +-------+ +---------+ +---------+ |
| 3371 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3372 | // +-------+ +-------+ +---------+ +---------+ |
| 3373 | // | | | | |
| 3374 | // | | | | |
| 3375 | // | | | | |
| 3376 | // | | RESTSubReq1 | | |
| 3377 | // | |---------------->| | |
| 3378 | // | | | | |
| 3379 | // | | RESTSubResp1 | | |
| 3380 | // | |<----------------| | |
| 3381 | // | | | SubReq1 | |
| 3382 | // | | |------------->| |
| 3383 | // | RESTSubReq2 | | |
| 3384 | // |------------------------------>| | |
| 3385 | // | | | | |
| 3386 | // | RESTSubDelResp2 | | |
| 3387 | // |<------------------------------| | |
| 3388 | // | | | SubReq1 | |
| 3389 | // | | |------------->| |
| 3390 | // | | | | |
| 3391 | // | | | | |
| 3392 | // | | | SubDelReq | |
| 3393 | // | | |------------->| |
| 3394 | // | | | | |
| 3395 | // | | | SubDelResp | |
| 3396 | // | | |<-------------| |
| 3397 | // | | RESTNotif1 | | |
| 3398 | // | | unsuccess | | |
| 3399 | // | |<----------------| | |
| 3400 | // | RESTNotif2 | | |
| 3401 | // | | unsuccess | | |
| 3402 | // |<------------------------------| | |
| 3403 | // | | | | |
| 3404 | // | | RESTSubDelReq1 | | |
| 3405 | // | |---------------->| | |
| 3406 | // | | | | |
| 3407 | // | | RESTSubDelResp1 | | |
| 3408 | // | |<----------------| | |
| 3409 | // | | | | |
| 3410 | // | RESTSubDelReq2 | | |
| 3411 | // |------------------------------>| | |
| 3412 | // | | | | |
| 3413 | // | RESTSubDelResp2 | | |
| 3414 | // |<------------------------------| | |
| 3415 | // |
| 3416 | //----------------------------------------------------------------------------- |
| 3417 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 3418 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 3419 | |
| 3420 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3421 | Counter{cSubReqFromXapp, 2}, |
| 3422 | Counter{cSubReqToE2, 1}, |
| 3423 | Counter{cSubRespToXapp, 2}, |
| 3424 | Counter{cSubDelReqFromXapp, 2}, |
| 3425 | Counter{cSubDelReqToE2, 1}, |
| 3426 | Counter{cSubDelRespFromE2, 1}, |
| 3427 | Counter{cSubDelRespToXapp, 2}, |
| 3428 | }) |
| 3429 | |
| 3430 | const subReqCount int = 1 |
| 3431 | const parameterSet = 1 |
| 3432 | const actionDefinitionPresent bool = true |
| 3433 | const actionParamCount int = 1 |
| 3434 | |
| 3435 | // Req1 |
| 3436 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3437 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 3438 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 3439 | |
| 3440 | // Req2 |
| 3441 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
| 3442 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3443 | params2.SetMeid("RAN_NAME_1") |
| 3444 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3445 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3446 | |
| 3447 | //Req1 (retransmitted) |
| 3448 | e2termConn1.RecvSubsReq(t) |
| 3449 | |
| 3450 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3451 | xappConn1.ExpectRESTNotification(t, restSubId1) // or restSubId2? |
| 3452 | // xappConn2.WaitRESTNotification(t) |
| 3453 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3454 | |
| 3455 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3456 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId1) |
| 3457 | |
| 3458 | // e2SubsId2 := <-xappConn2.RESTNotification |
| 3459 | // xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId2) |
| 3460 | |
| 3461 | // Del1 |
| 3462 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3463 | |
| 3464 | // Del2 |
| 3465 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3466 | |
| 3467 | //Wait that subs is cleaned |
| 3468 | waitSubsCleanup(t, e2SubsId1, 10) |
| 3469 | |
| 3470 | mainCtrl.VerifyCounterValues(t) |
| 3471 | } |
| 3472 | |
| 3473 | //----------------------------------------------------------------------------- |
| 3474 | // TestRESTSubReqAndSubDelNokSameActionParallel |
| 3475 | // |
| 3476 | // stub stub stub |
| 3477 | // +-------+ +-------+ +---------+ +---------+ |
| 3478 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3479 | // +-------+ +-------+ +---------+ +---------+ |
| 3480 | // | | | | |
| 3481 | // | | | | |
| 3482 | // | | | | |
| 3483 | // | | RESTSubReq1 | | |
| 3484 | // | |---------------->| | |
| 3485 | // | | | | |
| 3486 | // | | RESTSubResp1 | | |
| 3487 | // | |<----------------| | |
| 3488 | // | | | SubReq1 | |
| 3489 | // | | |------------->| |
| 3490 | // | RESTSubReq2 | | |
| 3491 | // |------------------------------>| | |
| 3492 | // | | | | |
| 3493 | // | RESTSubDelResp2 | | |
| 3494 | // |<------------------------------| | |
| 3495 | // | | | SubFail1 | |
| 3496 | // | | |<-------------| |
| 3497 | // | | | | |
| 3498 | // | | RESTNotif1 | | |
| 3499 | // | | unsuccess | | |
| 3500 | // | |<----------------| | |
| 3501 | // | RESTNotif2 | | |
| 3502 | // | | unsuccess | | |
| 3503 | // |<------------------------------| | |
| 3504 | // | | | SubDelReq | |
| 3505 | // | | |------------->| |
| 3506 | // | | | SubDelResp | |
| 3507 | // | | |<-------------| |
| 3508 | // | | | | |
| 3509 | // | | RESTSubDelReq1 | | |
| 3510 | // | |---------------->| | |
| 3511 | // | | | | |
| 3512 | // | | RESTSubDelResp1 | | |
| 3513 | // | |<----------------| | |
| 3514 | // | | | | |
| 3515 | // | RESTSubDelReq2 | | |
| 3516 | // |------------------------------>| | |
| 3517 | // | | | | |
| 3518 | // | RESTSubDelResp2 | | |
| 3519 | // |<------------------------------| | |
| 3520 | // |
| 3521 | //----------------------------------------------------------------------------- |
| 3522 | func TestRESTSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
| 3523 | CaseBegin("TestRESTSubReqAndSubDelNokSameActionParallel") |
| 3524 | |
| 3525 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3526 | Counter{cSubReqFromXapp, 2}, |
| 3527 | Counter{cSubReqToE2, 1}, |
| 3528 | Counter{cSubFailFromE2, 1}, |
| 3529 | Counter{cSubRespToXapp, 2}, |
| 3530 | Counter{cSubDelReqFromXapp, 2}, |
| 3531 | Counter{cSubDelReqToE2, 1}, |
| 3532 | Counter{cSubDelRespFromE2, 1}, |
| 3533 | Counter{cSubDelRespToXapp, 2}, |
| 3534 | }) |
| 3535 | |
| 3536 | const subReqCount int = 1 |
| 3537 | const parameterSet = 1 |
| 3538 | const actionDefinitionPresent bool = true |
| 3539 | const actionParamCount int = 1 |
| 3540 | |
| 3541 | // Req1 |
| 3542 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3543 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3544 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3545 | |
| 3546 | // Req2 |
| 3547 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
| 3548 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3549 | params2.SetMeid("RAN_NAME_1") |
| 3550 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3551 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3552 | |
| 3553 | // E2t: send SubsFail (first) |
| 3554 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 3555 | fparams1.Set(crereq1) |
| 3556 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 3557 | |
| 3558 | // E2t: internal delete |
| 3559 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3560 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 3561 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3562 | |
| 3563 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3564 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3565 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3566 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 3567 | |
| 3568 | // Del1 |
| 3569 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3570 | |
| 3571 | // Del2 |
| 3572 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3573 | |
| 3574 | //Wait that subs is cleaned |
| 3575 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
| 3576 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 3577 | |
| 3578 | mainCtrl.VerifyCounterValues(t) |
| 3579 | } |
| 3580 | |
| 3581 | func TestRESTSubReqPolicyAndSubDelOk(t *testing.T) { |
| 3582 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3583 | |
| 3584 | // Init counter check |
| 3585 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3586 | Counter{cSubReqFromXapp, 1}, |
| 3587 | Counter{cSubReqToE2, 1}, |
| 3588 | Counter{cSubRespFromE2, 1}, |
| 3589 | Counter{cSubRespToXapp, 1}, |
| 3590 | Counter{cSubDelReqFromXapp, 1}, |
| 3591 | Counter{cSubDelReqToE2, 1}, |
| 3592 | Counter{cSubDelRespFromE2, 1}, |
| 3593 | Counter{cSubDelRespToXapp, 1}, |
| 3594 | }) |
| 3595 | |
| 3596 | const subReqCount int = 1 |
| 3597 | const parameterSet = 1 |
| 3598 | const actionDefinitionPresent bool = true |
| 3599 | const actionParamCount int = 1 |
| 3600 | |
| 3601 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 3602 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3603 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 3604 | |
| 3605 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3606 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 3607 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3608 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 3609 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 3610 | |
| 3611 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3612 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3613 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3614 | |
| 3615 | // Wait that subs is cleaned |
| 3616 | waitSubsCleanup(t, e2SubsId, 10) |
| 3617 | mainCtrl.VerifyCounterValues(t) |
| 3618 | } |
| 3619 | |
| 3620 | //----------------------------------------------------------------------------- |
| 3621 | // TestRESTSubReqPolicyChangeAndSubDelOk |
| 3622 | // |
| 3623 | // stub stub |
| 3624 | // +-------+ +---------+ +---------+ |
| 3625 | // | xapp | | submgr | | e2term | |
| 3626 | // +-------+ +---------+ +---------+ |
| 3627 | // | | | |
| 3628 | // | RESTSubReq | | |
| 3629 | // |---------------->| | |
| 3630 | // | | | |
| 3631 | // | RESTSubResp | | |
| 3632 | // |<----------------| | |
| 3633 | // | | SubReq | |
| 3634 | // | |------------->| |
| 3635 | // | | | |
| 3636 | // | | SubResp | |
| 3637 | // | |<-------------| |
| 3638 | // | | | |
| 3639 | // | RESTNotif | | |
| 3640 | // |<----------------| | |
| 3641 | // | | | |
| 3642 | // | RESTSubReq | | |
| 3643 | // |---------------->| | |
| 3644 | // | | | |
| 3645 | // | RESTSubResp | | |
| 3646 | // |<----------------| | |
| 3647 | // | | SubReq | |
| 3648 | // | |------------->| |
| 3649 | // | | | |
| 3650 | // | | SubResp | |
| 3651 | // | |<-------------| |
| 3652 | // | | | |
| 3653 | // | RESTNotif | | |
| 3654 | // |<----------------| | |
| 3655 | // | | | |
| 3656 | // | RESTSubDelReq | | |
| 3657 | // |---------------->| | |
| 3658 | // | | | |
| 3659 | // | | SubDelReq | |
| 3660 | // | |------------->| |
| 3661 | // | | | |
| 3662 | // | | SubDelResp | |
| 3663 | // | |<-------------| |
| 3664 | // | | | |
| 3665 | // | RESTSubDelResp | | |
| 3666 | // |<----------------| | |
| 3667 | // |
| 3668 | //----------------------------------------------------------------------------- |
| 3669 | func TestRESTSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 3670 | CaseBegin("TestRESTSubReqPolicyAndSubDelOk") |
| 3671 | |
| 3672 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3673 | Counter{cSubReqFromXapp, 2}, |
| 3674 | Counter{cSubReqToE2, 2}, |
| 3675 | Counter{cSubRespFromE2, 2}, |
| 3676 | Counter{cSubRespToXapp, 2}, |
| 3677 | Counter{cSubDelReqFromXapp, 1}, |
| 3678 | Counter{cSubDelReqToE2, 1}, |
| 3679 | Counter{cSubDelRespFromE2, 1}, |
| 3680 | Counter{cSubDelRespToXapp, 1}, |
| 3681 | }) |
| 3682 | |
| 3683 | const subReqCount int = 1 |
| 3684 | const parameterSet = 1 |
| 3685 | const actionDefinitionPresent bool = true |
| 3686 | const policyParamCount int = 1 |
| 3687 | |
| 3688 | // Req |
| 3689 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 3690 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3691 | |
| 3692 | // Policy change |
| 3693 | instanceId := int64(e2SubsId) |
| 3694 | // GetRESTSubsReqPolicyParams sets some coutners on tc side. |
| 3695 | params = xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 3696 | params.SubsReqParams.SubscriptionDetails[0].InstanceID = &instanceId |
| 3697 | params.SetTimeToWait("w200ms") |
| 3698 | restSubId, e2SubsId = createSubscription(t, xappConn1, e2termConn1, params) |
| 3699 | |
| 3700 | // Del |
| 3701 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3702 | |
| 3703 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3704 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3705 | |
| 3706 | // Wait that subs is cleaned |
| 3707 | waitSubsCleanup(t, e2SubsId, 10) |
| 3708 | mainCtrl.VerifyCounterValues(t) |
| 3709 | } |
| 3710 | |
| 3711 | //----------------------------------------------------------------------------- |
| 3712 | // TestRESTSubReqAndSubDelOkTwoE2termParallel |
| 3713 | // |
| 3714 | // stub stub stub |
| 3715 | // +-------+ +---------+ +---------+ +---------+ |
| 3716 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 3717 | // +-------+ +---------+ +---------+ +---------+ |
| 3718 | // | | | | |
| 3719 | // | | | | |
| 3720 | // | | | | |
| 3721 | // | RESTSubReq1 | | | |
| 3722 | // |---------------->| | | |
| 3723 | // | | | | |
| 3724 | // | RESTSubResp1 | | | |
| 3725 | // |<----------------| | | |
| 3726 | // | | SubReq1 | | |
| 3727 | // | |------------->| | |
| 3728 | // | | | | |
| 3729 | // | RESTSubReq2 | | | |
| 3730 | // |---------------->| | | |
| 3731 | // | | | | |
| 3732 | // | RESTSubResp2 | | | |
| 3733 | // |<----------------| | | |
| 3734 | // | | SubReq2 | | |
| 3735 | // | |---------------------------->| |
| 3736 | // | | | | |
| 3737 | // | | SubResp1 | | |
| 3738 | // | |<-------------| | |
| 3739 | // | RESTNotif1 | | | |
| 3740 | // |<----------------| | | |
| 3741 | // | | SubResp2 | | |
| 3742 | // | |<----------------------------| |
| 3743 | // | RESTNotif2 | | | |
| 3744 | // |<----------------| | | |
| 3745 | // | | | | |
| 3746 | // | [SUBS 1 DELETE] | | |
| 3747 | // | | | | |
| 3748 | // | [SUBS 2 DELETE] | | |
| 3749 | // | | | | |
| 3750 | // |
| 3751 | //----------------------------------------------------------------------------- |
| 3752 | func TestRESTSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 3753 | CaseBegin("TestRESTSubReqAndSubDelOkTwoE2termParallel") |
| 3754 | |
| 3755 | // Init counter check |
| 3756 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3757 | Counter{cSubReqFromXapp, 2}, |
| 3758 | Counter{cSubReqToE2, 2}, |
| 3759 | Counter{cSubRespFromE2, 2}, |
| 3760 | Counter{cSubRespToXapp, 2}, |
| 3761 | Counter{cSubDelReqFromXapp, 2}, |
| 3762 | Counter{cSubDelReqToE2, 2}, |
| 3763 | Counter{cSubDelRespFromE2, 2}, |
| 3764 | Counter{cSubDelRespToXapp, 2}, |
| 3765 | }) |
| 3766 | |
| 3767 | const subReqCount int = 1 |
| 3768 | const parameterSet = 1 |
| 3769 | const actionDefinitionPresent bool = true |
| 3770 | const actionParamCount int = 1 |
| 3771 | |
| 3772 | // Req1 |
| 3773 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3774 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3775 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3776 | |
| 3777 | // Req2 |
| 3778 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3779 | params.SetMeid("RAN_NAME_11") |
| 3780 | // Here we use xappConn2 to simulate sending second request from same xapp as doing it from xappConn1 |
| 3781 | // would not work as notification would not be received |
| 3782 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 3783 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 3784 | |
| 3785 | // Resp1 |
| 3786 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3787 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3788 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3789 | xapp.Logger.Info("TEST: REST notification received e2SubsId1=%v", e2SubsId1) |
| 3790 | |
| 3791 | // Resp2 |
| 3792 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3793 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 3794 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3795 | xapp.Logger.Info("TEST: REST notification received e2SubsId2=%v", e2SubsId2) |
| 3796 | |
| 3797 | // Delete1 |
| 3798 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3799 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3800 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3801 | |
| 3802 | // Wait that subs is cleaned |
| 3803 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3804 | |
| 3805 | // Delete2 |
| 3806 | xappConn1.SendRESTSubsDelReq(t, &restSubId2) |
| 3807 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 3808 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 3809 | |
| 3810 | // Wait that subs is cleaned |
| 3811 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3812 | |
| 3813 | mainCtrl.VerifyCounterValues(t) |
| 3814 | } |
| 3815 | |
| 3816 | //----------------------------------------------------------------------------- |
| 3817 | // TestRESTSubReqAsn1EncodeFail |
| 3818 | // |
| 3819 | // In this case submgr send RICSubscriptionDeleteRequest after encode failure which should not happen! |
| 3820 | // stub stub |
| 3821 | // +-------+ +---------+ +---------+ |
| 3822 | // | xapp | | submgr | | e2term | |
| 3823 | // +-------+ +---------+ +---------+ |
| 3824 | // | | | |
| 3825 | // | RESTSubReq | | |
| 3826 | // |---------------->| | |
| 3827 | // | | | |
| 3828 | // | RESTSubResp | | |
| 3829 | // |<----------------| | |
| 3830 | // | RESTSubDelReq | | |
| 3831 | // |---------------->| | |
| 3832 | // | RESTSubDelResp | | |
| 3833 | // | unsuccess | | |
| 3834 | // |<----------------| | |
| 3835 | // | | | |
| 3836 | // |
| 3837 | //----------------------------------------------------------------------------- |
| 3838 | func TestRESTSubReqAsn1EncodeFail(t *testing.T) { |
| 3839 | CaseBegin("TestRESTSubReqAsn1EncodeFail") |
| 3840 | |
| 3841 | xapp.Logger.Info("Xapp-frame, v0.8.1 sufficient REST API validation") |
| 3842 | |
| 3843 | } |
| 3844 | |
| 3845 | //----------------------------------------------------------------------------- |
| 3846 | // TestRESTSubReqInsertAndSubDelOk |
| 3847 | // |
| 3848 | // stub stub |
| 3849 | // +-------+ +---------+ +---------+ |
| 3850 | // | xapp | | submgr | | e2term | |
| 3851 | // +-------+ +---------+ +---------+ |
| 3852 | // | | | |
| 3853 | // | RestSubReq | | |
| 3854 | // |---------------->| | |
| 3855 | // | | | |
| 3856 | // | RESTSubResp | | |
| 3857 | // |<----------------| | |
| 3858 | // | | | |
| 3859 | // | | SubReq | |
| 3860 | // | |------------->| |
| 3861 | // | | | |
| 3862 | // | | SubResp | |
| 3863 | // | |<-------------| |
| 3864 | // | RESTNotif | | |
| 3865 | // |<----------------| | |
| 3866 | // | ... | ... | |
| 3867 | // | | | |
| 3868 | // | RESTSubDelReq | | |
| 3869 | // |---------------->| | |
| 3870 | // | | | |
| 3871 | // | | SubDelReq | |
| 3872 | // | |------------->| |
| 3873 | // | | | |
| 3874 | // | | SubDelResp | |
| 3875 | // | |<-------------| |
| 3876 | // | | | |
| 3877 | // | RESTSubDelResp| | |
| 3878 | // |<----------------| | |
| 3879 | // |
| 3880 | //----------------------------------------------------------------------------- |
| 3881 | func TestRESTSubReqInsertAndSubDelOk(t *testing.T) { |
| 3882 | CaseBegin("TestRESTInsertSubReqAndSubDelOk") |
| 3883 | |
| 3884 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3885 | Counter{cSubReqFromXapp, 1}, |
| 3886 | Counter{cSubReqToE2, 1}, |
| 3887 | Counter{cSubRespFromE2, 1}, |
| 3888 | Counter{cSubRespToXapp, 1}, |
| 3889 | Counter{cSubDelReqFromXapp, 1}, |
| 3890 | Counter{cSubDelReqToE2, 1}, |
| 3891 | Counter{cSubDelRespFromE2, 1}, |
| 3892 | Counter{cSubDelRespToXapp, 1}, |
| 3893 | }) |
| 3894 | |
| 3895 | const subReqCount int = 1 |
| 3896 | const parameterSet int = 1 |
| 3897 | const actionDefinitionPresent bool = true |
| 3898 | const actionParamCount int = 1 |
| 3899 | |
| 3900 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3901 | params.SetSubActionTypes("insert") |
| 3902 | |
| 3903 | // Req |
| 3904 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3905 | |
| 3906 | // Del |
| 3907 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3908 | |
| 3909 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3910 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3911 | |
| 3912 | // Wait that subs is cleaned |
| 3913 | waitSubsCleanup(t, e2SubsId, 10) |
| 3914 | mainCtrl.VerifyCounterValues(t) |
| 3915 | } |
| 3916 | |
| 3917 | //----------------------------------------------------------------------------- |
| 3918 | // TestRESTSubReqNokAndSubDelOkWithRestartInMiddle |
| 3919 | // |
| 3920 | // stub stub |
| 3921 | // +-------+ +---------+ +---------+ |
| 3922 | // | xapp | | submgr | | e2term | |
| 3923 | // +-------+ +---------+ +---------+ |
| 3924 | // | | | |
| 3925 | // | RESTSubReq | | |
| 3926 | // |------------->| | |
| 3927 | // | | | |
| 3928 | // | | SubReq | |
| 3929 | // | |------------->| |
| 3930 | // | | | |
| 3931 | // | | SubResp | |
| 3932 | // | <----| |
| 3933 | // | | |
| 3934 | // | Submgr restart | |
| 3935 | // | | |
| 3936 | // | | | |
| 3937 | // | | SubDelReq | |
| 3938 | // | |------------->| |
| 3939 | // | | | |
| 3940 | // | | SubDelResp | |
| 3941 | // | |<-------------| |
| 3942 | // | | | |
| 3943 | // |
| 3944 | //----------------------------------------------------------------------------- |
| 3945 | func TestRESTSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 3946 | CaseBegin("TestRESTSubReqNokAndSubDelOkWithRestartInMiddle") |
| 3947 | |
| 3948 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3949 | Counter{cSubReqFromXapp, 1}, |
| 3950 | Counter{cSubReqToE2, 1}, |
| 3951 | Counter{cSubDelReqFromXapp, 1}, |
| 3952 | Counter{cSubDelReqToE2, 1}, |
| 3953 | Counter{cSubDelRespFromE2, 1}, |
| 3954 | }) |
| 3955 | |
| 3956 | const subReqCount int = 1 |
| 3957 | const parameterSet = 1 |
| 3958 | const actionDefinitionPresent bool = true |
| 3959 | const actionParamCount int = 1 |
| 3960 | |
| 3961 | // Remove possible existing subscription |
| 3962 | mainCtrl.removeExistingSubscriptions(t) |
| 3963 | |
| 3964 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3965 | |
| 3966 | //Req |
| 3967 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 3968 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 3969 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 3970 | |
| 3971 | e2termConn1.RecvSubsReq(t) |
| 3972 | |
| 3973 | mainCtrl.SetResetTestFlag(t, false) |
| 3974 | |
| 3975 | mainCtrl.SimulateRestart(t) |
| 3976 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 3977 | |
| 3978 | //Del |
| 3979 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3980 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3981 | |
| 3982 | xappConn1.TestMsgChanEmpty(t) |
| 3983 | xappConn2.TestMsgChanEmpty(t) |
| 3984 | e2termConn1.TestMsgChanEmpty(t) |
| 3985 | mainCtrl.wait_registry_empty(t, 10) |
| 3986 | |
| 3987 | mainCtrl.VerifyCounterValues(t) |
| 3988 | } |
| 3989 | |
| 3990 | //----------------------------------------------------------------------------- |
| 3991 | // TestRESTSubReqAndSubDelOkWithRestartInMiddle |
| 3992 | // |
| 3993 | // stub stub |
| 3994 | // +-------+ +---------+ +---------+ |
| 3995 | // | xapp | | submgr | | e2term | |
| 3996 | // +-------+ +---------+ +---------+ |
| 3997 | // | | | |
| 3998 | // | RESTSubReq | | |
| 3999 | // |---------------->| | |
| 4000 | // | | | |
| 4001 | // | RESTSubResp | | |
| 4002 | // |<----------------| | |
| 4003 | // | | SubReq | |
| 4004 | // | |------------->| |
| 4005 | // | | | |
| 4006 | // | | SubResp | |
| 4007 | // | |<-------------| |
| 4008 | // | | | |
| 4009 | // | RESTNotif | | |
| 4010 | // |<----------------| | |
| 4011 | // | | | |
| 4012 | // | | |
| 4013 | // | Submgr restart | |
| 4014 | // | | | |
| 4015 | // | RESTSubDelReq | | |
| 4016 | // |---------------->| | |
| 4017 | // | | | |
| 4018 | // | | SubDelReq | |
| 4019 | // | |------------->| |
| 4020 | // | | | |
| 4021 | // | | SubDelResp | |
| 4022 | // | |<-------------| |
| 4023 | // | | | |
| 4024 | // | RESTSubDelResp | | |
| 4025 | // |<----------------| | |
| 4026 | // |
| 4027 | //----------------------------------------------------------------------------- |
| 4028 | func TestRESTSubReqAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 4029 | CaseBegin("TestRESTSubReqAndSubDelOkWithRestartInMiddle") |
| 4030 | |
| 4031 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4032 | Counter{cSubReqFromXapp, 1}, |
| 4033 | Counter{cSubReqToE2, 1}, |
| 4034 | Counter{cSubRespFromE2, 1}, |
| 4035 | Counter{cSubRespToXapp, 1}, |
| 4036 | Counter{cSubDelReqFromXapp, 1}, |
| 4037 | Counter{cSubDelReqToE2, 1}, |
| 4038 | Counter{cSubDelRespToXapp, 1}, |
| 4039 | }) |
| 4040 | |
| 4041 | // Remove possible existing subscription |
| 4042 | mainCtrl.removeExistingSubscriptions(t) |
| 4043 | |
| 4044 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4045 | |
| 4046 | // Create subscription |
| 4047 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 4048 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 4049 | |
| 4050 | // Check subscription |
| 4051 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4052 | |
| 4053 | // When SDL support for the REST Interface is added |
| 4054 | // the submgr restart statement below should be removed |
| 4055 | // from the comment. |
| 4056 | |
| 4057 | // mainCtrl.SimulateRestart(t) |
| 4058 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4059 | |
| 4060 | // Check subscription |
| 4061 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 4062 | |
| 4063 | // Delete subscription |
| 4064 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 4065 | |
| 4066 | //Wait that subs is cleaned |
| 4067 | waitSubsCleanup(t, e2SubsId, 10) |
| 4068 | |
| 4069 | mainCtrl.VerifyCounterValues(t) |
| 4070 | } |
| 4071 | |
| 4072 | //----------------------------------------------------------------------------- |
| 4073 | // TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 4074 | // |
| 4075 | // stub stub |
| 4076 | // +-------+ +-------+ +---------+ +---------+ |
| 4077 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 4078 | // +-------+ +-------+ +---------+ +---------+ |
| 4079 | // | | | | |
| 4080 | // | | RESTSubReq1 | | |
| 4081 | // | |---------------->| | |
| 4082 | // | | | | |
| 4083 | // | | RESTSubResp1 | | |
| 4084 | // | |<----------------| | |
| 4085 | // | | | | |
| 4086 | // | | | SubReq1 | |
| 4087 | // | | |------------->| |
| 4088 | // | | | SubResp1 | |
| 4089 | // | | |<-------------| |
| 4090 | // | | RESTNotif1 | | |
| 4091 | // | |<----------------| | |
| 4092 | // | | | | |
| 4093 | // | RESTSubReq2 | | |
| 4094 | // |------------------------------>| | |
| 4095 | // | | | | |
| 4096 | // | RESTSubResp2 | | |
| 4097 | // |<------------------------------| | |
| 4098 | // | | | | |
| 4099 | // | | RESTNotif2 | | |
| 4100 | // |<------------------------------| | |
| 4101 | // | | | | |
| 4102 | // | | Submgr restart | |
| 4103 | // | | | | |
| 4104 | // | | RESTSubDelReq1 | | |
| 4105 | // | |---------------->| | |
| 4106 | // | | | | |
| 4107 | // | | RESTSubDelResp1 | | |
| 4108 | // | |<----------------| | |
| 4109 | // | | | | |
| 4110 | // | | Submgr restart | |
| 4111 | // | | | | |
| 4112 | // | RESTSubDelReq2 | | |
| 4113 | // |------------------------------>| | |
| 4114 | // | | | | |
| 4115 | // | RESTSubDelResp2 | | |
| 4116 | // |<------------------------------| | |
| 4117 | // | | | | |
| 4118 | // | | | SubDelReq2 | |
| 4119 | // | | |------------->| |
| 4120 | // | | | | |
| 4121 | // | | | SubDelResp2 | |
| 4122 | // | | |<-------------| |
| 4123 | // | | | | |
| 4124 | // |
| 4125 | //----------------------------------------------------------------------------- |
| 4126 | func TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 4127 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 4128 | |
| 4129 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4130 | Counter{cSubReqFromXapp, 2}, |
| 4131 | Counter{cSubReqToE2, 1}, |
| 4132 | Counter{cSubRespFromE2, 1}, |
| 4133 | Counter{cSubRespToXapp, 2}, |
| 4134 | Counter{cMergedSubscriptions, 1}, |
| 4135 | Counter{cUnmergedSubscriptions, 1}, |
| 4136 | Counter{cSubDelReqFromXapp, 2}, |
| 4137 | Counter{cSubDelReqToE2, 1}, |
| 4138 | Counter{cSubDelRespFromE2, 1}, |
| 4139 | Counter{cSubDelRespToXapp, 2}, |
| 4140 | }) |
| 4141 | |
| 4142 | // Remove possible existing subscription |
| 4143 | mainCtrl.removeExistingSubscriptions(t) |
| 4144 | |
| 4145 | var params *teststube2ap.RESTSubsReqParams = nil |
| 4146 | |
| 4147 | // Create subscription 1 |
| 4148 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 4149 | xapp.Logger.Info("Send REST subscriber request for subscriber 1 : %v", restSubId1) |
| 4150 | |
| 4151 | // Create subscription 2 with same action |
| 4152 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4153 | params.SetMeid("RAN_NAME_1") |
| 4154 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4155 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
| 4156 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 4157 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 4158 | e2SubsId2 := <-xappConn2.RESTNotification |
| 4159 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 4160 | |
| 4161 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 4162 | |
| 4163 | // When SDL support for the REST Interface is added |
| 4164 | // the submgr restart statement below should be removed |
| 4165 | // from the comment. |
| 4166 | |
| 4167 | // mainCtrl.SimulateRestart(t) |
| 4168 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4169 | |
| 4170 | // Delete subscription 1 |
| 4171 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 4172 | |
| 4173 | // When SDL support for the REST Interface is added |
| 4174 | // the submgr restart statement below should be removed |
| 4175 | // from the comment. |
| 4176 | |
| 4177 | // mainCtrl.SimulateRestart(t) |
| 4178 | // xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 4179 | |
| 4180 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13660"}) |
| 4181 | |
| 4182 | // Delete subscription 2 |
| 4183 | deleteXapp2Subscription(t, &restSubId2) |
| 4184 | |
| 4185 | //Wait that subs is cleaned |
| 4186 | waitSubsCleanup(t, e2SubsId2, 10) |
| 4187 | |
| 4188 | mainCtrl.VerifyCounterValues(t) |
| 4189 | } |
| 4190 | |
| 4191 | //----------------------------------------------------------------------------- |
| 4192 | // TestRESTReportSubReqAndSubDelOk |
| 4193 | // |
| 4194 | // stub stub |
| 4195 | // +-------+ +---------+ +---------+ |
| 4196 | // | xapp | | submgr | | e2term | |
| 4197 | // +-------+ +---------+ +---------+ |
| 4198 | // | | | |
| 4199 | // | RestSubReq | | |
| 4200 | // |---------------->| | |
| 4201 | // | | | |
| 4202 | // | RESTSubResp | | |
| 4203 | // |<----------------| | |
| 4204 | // | | | |
| 4205 | // | | SubReq | |
| 4206 | // | |------------->| |
| 4207 | // | | | |
| 4208 | // | | SubResp | |
| 4209 | // | |<-------------| |
| 4210 | // | RESTNotif | | |
| 4211 | // |<----------------| | |
| 4212 | // | | SubReq | |
| 4213 | // | |------------->| |
| 4214 | // | | | |
| 4215 | // | | SubResp | |
| 4216 | // | |<-------------| |
| 4217 | // | RESTNotif | | |
| 4218 | // |<----------------| | |
| 4219 | // | ... | ... | |
| 4220 | // | | | |
| 4221 | // | | | |
| 4222 | // | RESTSubDelReq | | |
| 4223 | // |---------------->| | |
| 4224 | // | | | |
| 4225 | // | | SubDelReq | |
| 4226 | // | |------------->| |
| 4227 | // | | | |
| 4228 | // | | SubDelResp | |
| 4229 | // | |<-------------| |
| 4230 | // | | | |
| 4231 | // | RESTSubDelResp| | |
| 4232 | // |<----------------| | |
| 4233 | // |
| 4234 | //----------------------------------------------------------------------------- |
| 4235 | func TestRESTReportSubReqAndSubDelOk(t *testing.T) { |
| 4236 | CaseBegin("TestRESTReportSubReqAndSubDelOk") |
| 4237 | subReqCount := 1 |
| 4238 | parameterSet := 1 // E2SM-gNB-X2 |
| 4239 | actionDefinitionPresent := true |
| 4240 | actionParamCount := 1 |
| 4241 | testIndex := 1 |
| 4242 | RESTReportSubReqAndSubDelOk(t, subReqCount, parameterSet, actionDefinitionPresent, actionParamCount, testIndex) |
| 4243 | } |
| 4244 | |
| 4245 | func RESTReportSubReqAndSubDelOk(t *testing.T, subReqCount int, parameterSet int, actionDefinitionPresent bool, actionParamCount int, testIndex int) { |
| 4246 | xapp.Logger.Info("TEST: TestRESTReportSubReqAndSubDelOk with parameter set %v", testIndex) |
| 4247 | |
| 4248 | // Req |
| 4249 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4250 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4251 | |
| 4252 | var e2SubsId []uint32 |
| 4253 | for i := 0; i < subReqCount; i++ { |
| 4254 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4255 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4256 | |
| 4257 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4258 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4259 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4260 | e2SubsId = append(e2SubsId, instanceId) |
| 4261 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4262 | assert.Equal(t, resp[i].SubscriptionID, (int64)(instanceId)) |
| 4263 | assert.Equal(t, resp[i].Meid, "RAN_NAME_1") |
| 4264 | assert.Equal(t, resp[i].ClientEndpoint, []string{"localhost:13560"}) |
| 4265 | |
| 4266 | } |
| 4267 | |
| 4268 | // Del |
| 4269 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4270 | |
| 4271 | for i := 0; i < subReqCount; i++ { |
| 4272 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4273 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4274 | } |
| 4275 | |
| 4276 | // Wait that subs is cleaned |
| 4277 | for i := 0; i < subReqCount; i++ { |
| 4278 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4279 | } |
| 4280 | |
| 4281 | xappConn1.TestMsgChanEmpty(t) |
| 4282 | e2termConn1.TestMsgChanEmpty(t) |
| 4283 | mainCtrl.wait_registry_empty(t, 10) |
| 4284 | } |
| 4285 | |
| 4286 | /* |
| 4287 | func TestRESTPolicySubReqAndSubDelOk(t *testing.T) { |
| 4288 | CaseBegin("TestRESTPolicySubReqAndSubDelOk") |
| 4289 | |
| 4290 | subReqCount := 2 |
| 4291 | actionDefinitionPresent := true |
| 4292 | policyParamCount := 1 |
| 4293 | testIndex := 1 |
| 4294 | RESTPolicySubReqAndSubDelOk(t, subReqCount, actionDefinitionPresent, policyParamCount, testIndex) |
| 4295 | |
| 4296 | subReqCount = 19 |
| 4297 | actionDefinitionPresent = false |
| 4298 | policyParamCount = 0 |
| 4299 | testIndex = 2 |
| 4300 | RESTPolicySubReqAndSubDelOk(t, subReqCount, actionDefinitionPresent, policyParamCount, testIndex) |
| 4301 | } |
| 4302 | */ |
| 4303 | func RESTPolicySubReqAndSubDelOk(t *testing.T, subReqCount int, actionDefinitionPresent bool, policyParamCount int, testIndex int) { |
| 4304 | xapp.Logger.Info("TEST: TestRESTPolicySubReqAndSubDelOk with parameter set %v", testIndex) |
| 4305 | |
| 4306 | // Req |
| 4307 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4308 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4309 | //params := xappConn1.GetRESTSubsReqPolicyParams1(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4310 | //restSubId := xappConn1.SendRESTPolicySubsReq(t, params) |
| 4311 | |
| 4312 | var e2SubsId []uint32 |
| 4313 | for i := 0; i < subReqCount; i++ { |
| 4314 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 4315 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4316 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 4317 | instanceId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4318 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", instanceId) |
| 4319 | e2SubsId = append(e2SubsId, instanceId) |
| 4320 | } |
| 4321 | |
| 4322 | // Del |
| 4323 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4324 | |
| 4325 | for i := 0; i < subReqCount; i++ { |
| 4326 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4327 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4328 | } |
| 4329 | |
| 4330 | // Wait that subs is cleaned |
| 4331 | for i := 0; i < subReqCount; i++ { |
| 4332 | mainCtrl.wait_subs_clean(t, e2SubsId[i], 10) |
| 4333 | } |
| 4334 | xappConn1.TestMsgChanEmpty(t) |
| 4335 | e2termConn1.TestMsgChanEmpty(t) |
| 4336 | mainCtrl.wait_registry_empty(t, 10) |
| 4337 | } |
| 4338 | |
| 4339 | /* |
| 4340 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 4341 | |
| 4342 | subReqCount := 2 |
| 4343 | |
| 4344 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4345 | Counter{cSubReqFromXapp, 1}, |
| 4346 | Counter{cSubReqToE2, 2}, |
| 4347 | Counter{cSubRespFromE2, 2}, |
| 4348 | Counter{cSubRespToXapp, 2}, |
| 4349 | Counter{cSubDelReqFromXapp, 1}, |
| 4350 | Counter{cSubDelReqToE2, 2}, |
| 4351 | Counter{cSubDelRespFromE2, 2}, |
| 4352 | Counter{cSubDelRespToXapp, 1}, |
| 4353 | }) |
| 4354 | |
| 4355 | // Req |
| 4356 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4357 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4358 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4359 | |
| 4360 | assert.Equal(t, len(e2SubsIds), 2) |
| 4361 | |
| 4362 | // Del |
| 4363 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4364 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4365 | |
| 4366 | xappConn1.TestMsgChanEmpty(t) |
| 4367 | e2termConn1.TestMsgChanEmpty(t) |
| 4368 | mainCtrl.wait_registry_empty(t, 10) |
| 4369 | |
| 4370 | mainCtrl.VerifyCounterValues(t) |
| 4371 | } |
| 4372 | */ |
| 4373 | /* |
| 4374 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 4375 | |
| 4376 | subReqCount := 19 |
| 4377 | |
| 4378 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4379 | Counter{cSubReqFromXapp, 1}, |
| 4380 | Counter{cSubReqToE2, 19}, |
| 4381 | Counter{cSubRespFromE2, 19}, |
| 4382 | Counter{cSubRespToXapp, 19}, |
| 4383 | Counter{cSubDelReqFromXapp, 1}, |
| 4384 | Counter{cSubDelReqToE2, 19}, |
| 4385 | Counter{cSubDelRespFromE2, 19}, |
| 4386 | Counter{cSubDelRespToXapp, 1}, |
| 4387 | }) |
| 4388 | |
| 4389 | // Req |
| 4390 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4391 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4392 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4393 | |
| 4394 | assert.Equal(t, len(e2SubsIds), 19) |
| 4395 | |
| 4396 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4397 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4398 | |
| 4399 | xappConn1.TestMsgChanEmpty(t) |
| 4400 | e2termConn1.TestMsgChanEmpty(t) |
| 4401 | mainCtrl.wait_registry_empty(t, 10) |
| 4402 | |
| 4403 | mainCtrl.VerifyCounterValues(t) |
| 4404 | } |
| 4405 | */ |
| 4406 | /* |
| 4407 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 4408 | |
| 4409 | subReqCount := 2 |
| 4410 | parameterSet := 1 |
| 4411 | actionDefinitionPresent := true |
| 4412 | actionParamCount := 1 |
| 4413 | |
| 4414 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4415 | Counter{cSubReqFromXapp, 1}, |
| 4416 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4417 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4418 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4419 | Counter{cSubDelReqFromXapp, 1}, |
| 4420 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4421 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4422 | Counter{cSubDelRespToXapp, 1}, |
| 4423 | }) |
| 4424 | |
| 4425 | // Req |
| 4426 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4427 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4428 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4429 | |
| 4430 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4431 | |
| 4432 | // Del |
| 4433 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4434 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4435 | |
| 4436 | xappConn1.TestMsgChanEmpty(t) |
| 4437 | e2termConn1.TestMsgChanEmpty(t) |
| 4438 | mainCtrl.wait_registry_empty(t, 10) |
| 4439 | |
| 4440 | mainCtrl.VerifyCounterValues(t) |
| 4441 | } |
| 4442 | */ |
| 4443 | /* |
| 4444 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 4445 | |
| 4446 | subReqCount := 2 |
| 4447 | parameterSet := 1 |
| 4448 | actionDefinitionPresent := false |
| 4449 | actionParamCount := 0 |
| 4450 | |
| 4451 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4452 | Counter{cSubReqFromXapp, 1}, |
| 4453 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4454 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4455 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4456 | Counter{cSubDelReqFromXapp, 1}, |
| 4457 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4458 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4459 | Counter{cSubDelRespToXapp, 1}, |
| 4460 | }) |
| 4461 | |
| 4462 | // Req |
| 4463 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4464 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4465 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4466 | |
| 4467 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4468 | |
| 4469 | // Del |
| 4470 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4471 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4472 | |
| 4473 | xappConn1.TestMsgChanEmpty(t) |
| 4474 | e2termConn1.TestMsgChanEmpty(t) |
| 4475 | mainCtrl.wait_registry_empty(t, 10) |
| 4476 | |
| 4477 | mainCtrl.VerifyCounterValues(t) |
| 4478 | } |
| 4479 | */ |
| 4480 | /* |
| 4481 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 4482 | |
| 4483 | subReqCount := 19 |
| 4484 | parameterSet := 1 |
| 4485 | actionDefinitionPresent := false |
| 4486 | actionParamCount := 0 |
| 4487 | |
| 4488 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4489 | Counter{cSubReqFromXapp, 1}, |
| 4490 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4491 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4492 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4493 | Counter{cSubDelReqFromXapp, 1}, |
| 4494 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4495 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4496 | Counter{cSubDelRespToXapp, 1}, |
| 4497 | }) |
| 4498 | |
| 4499 | // Req |
| 4500 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4501 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4502 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4503 | |
| 4504 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4505 | |
| 4506 | // Del |
| 4507 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4508 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4509 | |
| 4510 | xappConn1.TestMsgChanEmpty(t) |
| 4511 | e2termConn1.TestMsgChanEmpty(t) |
| 4512 | mainCtrl.wait_registry_empty(t, 10) |
| 4513 | |
| 4514 | mainCtrl.VerifyCounterValues(t) |
| 4515 | } |
| 4516 | */ |
| 4517 | //////////////////////////////////////////////////////////////////////////////////// |
| 4518 | // Services for UT cases |
| 4519 | //////////////////////////////////////////////////////////////////////////////////// |
| 4520 | const subReqCount int = 1 |
| 4521 | const parameterSet = 1 |
| 4522 | const actionDefinitionPresent bool = true |
| 4523 | const actionParamCount int = 1 |
| 4524 | const policyParamCount int = 1 |
| 4525 | const host string = "localhost" |
| 4526 | |
| 4527 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 4528 | if params == nil { |
| 4529 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4530 | } |
| 4531 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 4532 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 4533 | |
| 4534 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 4535 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 4536 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 4537 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 4538 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4539 | |
| 4540 | return restSubId, e2SubsId |
| 4541 | } |
| 4542 | |
| 4543 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 4544 | |
| 4545 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4546 | if meid != "" { |
| 4547 | params.SetMeid(meid) |
| 4548 | } |
| 4549 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4550 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 4551 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 4552 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 4553 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 4554 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4555 | |
| 4556 | return restSubId, e2SubsId |
| 4557 | } |
| 4558 | |
| 4559 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
| 4560 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4561 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4562 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 4563 | |
| 4564 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4565 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4566 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4567 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4568 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4569 | |
| 4570 | return restSubId, e2SubsId |
| 4571 | } |
| 4572 | |
| 4573 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
| 4574 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4575 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4576 | |
| 4577 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4578 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4579 | fparams1.Set(crereq1) |
| 4580 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4581 | |
| 4582 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4583 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4584 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4585 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4586 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 4587 | |
| 4588 | return restSubId, e2SubsId |
| 4589 | } |
| 4590 | |
| 4591 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 4592 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 4593 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 4594 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 4595 | } |
| 4596 | |
| 4597 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 4598 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 4599 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4600 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4601 | } |
| 4602 | |
| 4603 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 4604 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 4605 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4606 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4607 | } |
| 4608 | |
| 4609 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 4610 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4611 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 4612 | assert.Equal(t, resp[0].Meid, meid) |
| 4613 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 4614 | } |
| 4615 | |
| 4616 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 4617 | //Wait that subs is cleaned |
| 4618 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 4619 | |
| 4620 | xappConn1.TestMsgChanEmpty(t) |
| 4621 | xappConn2.TestMsgChanEmpty(t) |
| 4622 | e2termConn1.TestMsgChanEmpty(t) |
| 4623 | mainCtrl.wait_registry_empty(t, timeout) |
| 4624 | } |
| 4625 | |
| 4626 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 4627 | |
| 4628 | var e2SubsId []uint32 |
| 4629 | |
| 4630 | for i := 0; i < count; i++ { |
| 4631 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 4632 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 4633 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 4634 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 4635 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 4636 | e2SubsId = append(e2SubsId, instanceId) |
| 4637 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 4638 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 4639 | <-time.After(100 * time.Millisecond) |
| 4640 | } |
| 4641 | return e2SubsId |
| 4642 | } |
| 4643 | |
| 4644 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 4645 | |
| 4646 | for i := 0; i < len(e2SubsIds); i++ { |
| 4647 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 4648 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 4649 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 4650 | <-time.After(1 * time.Second) |
| 4651 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 4652 | <-time.After(100 * time.Millisecond) |
| 4653 | } |
| 4654 | |
| 4655 | // Wait that subs is cleaned |
| 4656 | for i := 0; i < len(e2SubsIds); i++ { |
| 4657 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 4658 | } |
| 4659 | |
| 4660 | } |