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 |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 2248 | // Add delay for rtmgt HTTP handling so that HTTP response is received before notify on XAPP side |
| 2249 | waiter := rtmgrHttp.AllocNextSleep(50, false) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2250 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 2251 | |
| 2252 | // Req |
| 2253 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2254 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 2255 | xappConn1.ExpectRESTNotification(t, restSubId) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2256 | waiter.WaitResult(t) |
| 2257 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 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 | //----------------------------------------------------------------------------- |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 2427 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 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 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2479 | // Del2 |
| 2480 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 2481 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2482 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2483 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 2484 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 2485 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2486 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2487 | |
| 2488 | mainCtrl.VerifyCounterValues(t) |
| 2489 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 2490 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 2491 | func TestRESTSubDelReqRetransmission(t *testing.T) { |
| 2492 | CaseBegin("TestRESTSubDelReqRetransmission") |
| 2493 | |
| 2494 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2495 | Counter{cSubReqFromXapp, 1}, |
| 2496 | Counter{cSubReqToE2, 1}, |
| 2497 | Counter{cSubRespFromE2, 1}, |
| 2498 | Counter{cSubRespToXapp, 1}, |
| 2499 | Counter{cSubDelReqFromXapp, 2}, |
| 2500 | Counter{cSubDelReqToE2, 1}, |
| 2501 | Counter{cSubDelRespFromE2, 1}, |
| 2502 | Counter{cSubDelRespToXapp, 1}, |
| 2503 | }) |
| 2504 | |
| 2505 | var params *teststube2ap.RESTSubsReqParams = nil |
| 2506 | |
| 2507 | //Subs Create |
| 2508 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 2509 | |
| 2510 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2511 | |
| 2512 | //Subs Delete |
| 2513 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2514 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2515 | |
| 2516 | seqBef := mainCtrl.get_msgcounter(t) |
| 2517 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2518 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 2519 | |
| 2520 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2521 | |
| 2522 | waitSubsCleanup(t, e2SubsId, 10) |
| 2523 | |
| 2524 | mainCtrl.VerifyCounterValues(t) |
| 2525 | } |
| 2526 | |
| 2527 | //----------------------------------------------------------------------------- |
| 2528 | // TestRESTSubReqDelReq |
| 2529 | // |
| 2530 | // stub stub |
| 2531 | // +-------+ +---------+ +---------+ |
| 2532 | // | xapp | | submgr | | e2term | |
| 2533 | // +-------+ +---------+ +---------+ |
| 2534 | // | | | |
| 2535 | // | RESTSubReq | | |
| 2536 | // |---------------->| | |
| 2537 | // | | | |
| 2538 | // | RESTSubResp | | |
| 2539 | // |<----------------| | |
| 2540 | // | | SubReq | |
| 2541 | // | |------------->| |
| 2542 | // | RESTSubDelReq | | |
| 2543 | // |---------------->| | |
| 2544 | // | RESTSubDelResp | | |
| 2545 | // | unsuccess | | |
| 2546 | // |<----------------| | |
| 2547 | // | | SubResp | |
| 2548 | // | |<-------------| |
| 2549 | // | RESTNotif1 | | |
| 2550 | // |<----------------| | |
| 2551 | // | | | |
| 2552 | // | [SUBS DELETE] | |
| 2553 | // | | | |
| 2554 | // |
| 2555 | //----------------------------------------------------------------------------- |
| 2556 | func TestRESTSubReqDelReq(t *testing.T) { |
| 2557 | CaseBegin("TestRESTSubReqDelReq") |
| 2558 | |
| 2559 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2560 | Counter{cSubReqFromXapp, 1}, |
| 2561 | Counter{cSubReqToE2, 1}, |
| 2562 | Counter{cSubRespFromE2, 1}, |
| 2563 | Counter{cSubRespToXapp, 1}, |
| 2564 | Counter{cSubDelReqFromXapp, 2}, |
| 2565 | Counter{cSubDelReqToE2, 1}, |
| 2566 | Counter{cSubDelRespFromE2, 1}, |
| 2567 | Counter{cSubDelRespToXapp, 1}, |
| 2568 | }) |
| 2569 | |
| 2570 | const subReqCount int = 1 |
| 2571 | const parameterSet = 1 |
| 2572 | const actionDefinitionPresent bool = true |
| 2573 | const actionParamCount int = 1 |
| 2574 | |
| 2575 | // Req |
| 2576 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2577 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2578 | |
| 2579 | // Del. This will fail as processing of the subscription |
| 2580 | // is still ongoing in submgr. Deletion is not allowed before |
| 2581 | // subscription creation has been completed. |
| 2582 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2583 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2584 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2585 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2586 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2587 | |
| 2588 | // Retry del |
| 2589 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2590 | |
| 2591 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2592 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2593 | |
| 2594 | // Wait that subs is cleaned |
| 2595 | waitSubsCleanup(t, e2SubsId, 10) |
| 2596 | mainCtrl.VerifyCounterValues(t) |
| 2597 | |
| 2598 | } |
| 2599 | |
| 2600 | func TestRESTSubDelReqCollision(t *testing.T) { |
| 2601 | CaseBegin("TestRESTSubDelReqCollision - not relevant for REST API") |
| 2602 | } |
| 2603 | |
| 2604 | func TestRESTSubReqAndSubDelOkTwoParallel(t *testing.T) { |
| 2605 | CaseBegin("TestRESTSubReqAndSubDelOkTwoParallel") |
| 2606 | |
| 2607 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2608 | Counter{cSubReqFromXapp, 2}, |
| 2609 | Counter{cSubReqToE2, 2}, |
| 2610 | Counter{cSubRespFromE2, 2}, |
| 2611 | Counter{cSubRespToXapp, 2}, |
| 2612 | Counter{cSubDelReqFromXapp, 2}, |
| 2613 | Counter{cSubDelReqToE2, 2}, |
| 2614 | Counter{cSubDelRespFromE2, 2}, |
| 2615 | Counter{cSubDelRespToXapp, 2}, |
| 2616 | }) |
| 2617 | |
| 2618 | //Req1 |
| 2619 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2620 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 2621 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2622 | |
| 2623 | //Req2 |
| 2624 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2625 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
| 2626 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2627 | |
| 2628 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2629 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 2630 | |
| 2631 | //XappConn1 receives both of the responses |
| 2632 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
| 2633 | |
| 2634 | //Resp1 |
| 2635 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2636 | //Resp2 |
| 2637 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 2638 | |
| 2639 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 2640 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 2641 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 2642 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
| 2643 | |
| 2644 | //Del1 |
| 2645 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2646 | //Del2 |
| 2647 | deleteSubscription(t, xappConn2, e2termConn1, &restSubId2) |
| 2648 | |
| 2649 | //Wait that subs is cleaned |
| 2650 | mainCtrl.wait_subs_clean(t, e2SubsIdA.E2SubsId, 10) |
| 2651 | waitSubsCleanup(t, e2SubsIdB.E2SubsId, 10) |
| 2652 | |
| 2653 | mainCtrl.VerifyCounterValues(t) |
| 2654 | |
| 2655 | } |
| 2656 | |
| 2657 | func TestRESTSameSubsDiffRan(t *testing.T) { |
| 2658 | CaseBegin("TestRESTSameSubsDiffRan") |
| 2659 | |
| 2660 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2661 | Counter{cSubReqFromXapp, 2}, |
| 2662 | Counter{cSubReqToE2, 2}, |
| 2663 | Counter{cSubRespFromE2, 2}, |
| 2664 | Counter{cSubRespToXapp, 2}, |
| 2665 | Counter{cSubDelReqFromXapp, 2}, |
| 2666 | Counter{cSubDelReqToE2, 2}, |
| 2667 | Counter{cSubDelRespFromE2, 2}, |
| 2668 | Counter{cSubDelRespToXapp, 2}, |
| 2669 | }) |
| 2670 | |
| 2671 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2672 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2673 | xapp.Logger.Info("Send 1st REST subscriber request for subscriberId : %v", restSubId1) |
| 2674 | |
| 2675 | params = xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2676 | params.SetMeid("RAN_NAME_2") |
| 2677 | restSubId2, e2SubsId2 := createSubscription(t, xappConn1, e2termConn1, params) |
| 2678 | xapp.Logger.Info("Send 2nd REST subscriber request for subscriberId : %v", restSubId2) |
| 2679 | |
| 2680 | //Del1 |
| 2681 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId1) |
| 2682 | //Del2 |
| 2683 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId2) |
| 2684 | |
| 2685 | //Wait that subs is cleaned |
| 2686 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 2687 | waitSubsCleanup(t, e2SubsId2, 10) |
| 2688 | |
| 2689 | mainCtrl.VerifyCounterValues(t) |
| 2690 | |
| 2691 | } |
| 2692 | |
| 2693 | func TestRESTSubReqRetryInSubmgr(t *testing.T) { |
| 2694 | CaseBegin("TestRESTSubReqRetryInSubmgr start") |
| 2695 | |
| 2696 | // Init counter check |
| 2697 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2698 | Counter{cSubReqFromXapp, 1}, |
| 2699 | Counter{cSubReqToE2, 1}, |
| 2700 | Counter{cSubReReqToE2, 1}, |
| 2701 | Counter{cSubRespFromE2, 1}, |
| 2702 | Counter{cSubRespToXapp, 1}, |
| 2703 | Counter{cSubDelReqFromXapp, 1}, |
| 2704 | Counter{cSubDelReqToE2, 1}, |
| 2705 | Counter{cSubDelRespFromE2, 1}, |
| 2706 | Counter{cSubDelRespToXapp, 1}, |
| 2707 | }) |
| 2708 | |
| 2709 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2710 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2711 | |
| 2712 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2713 | |
| 2714 | // Catch the first message and ignore it |
| 2715 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 2716 | xapp.Logger.Info("Ignore REST subscriber request for subscriber : %v", restSubId) |
| 2717 | |
| 2718 | // The second request is being handled normally |
| 2719 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 2720 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2721 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 2722 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2723 | |
| 2724 | queryXappSubscription(t, int64(e2SubsId), "RAN_NAME_1", []string{"localhost:13560"}) |
| 2725 | |
| 2726 | deleteSubscription(t, xappConn1, e2termConn1, &restSubId) |
| 2727 | |
| 2728 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2729 | //Wait that subs is cleaned |
| 2730 | waitSubsCleanup(t, e2SubsId, 10) |
| 2731 | |
| 2732 | mainCtrl.VerifyCounterValues(t) |
| 2733 | |
| 2734 | } |
| 2735 | |
| 2736 | //----------------------------------------------------------------------------- |
| 2737 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2738 | // |
| 2739 | // stub stub |
| 2740 | // +-------+ +---------+ +---------+ |
| 2741 | // | xapp | | submgr | | e2term | |
| 2742 | // +-------+ +---------+ +---------+ |
| 2743 | // | | | |
| 2744 | // | RESTSubReq | | |
| 2745 | // |---------------->| | |
| 2746 | // | | | |
| 2747 | // | RESTSubResp | | |
| 2748 | // |<----------------| | |
| 2749 | // | | SubReq | |
| 2750 | // | |------------->| |
| 2751 | // | | | |
| 2752 | // | | | |
| 2753 | // | | SubReq | |
| 2754 | // | |------------->| |
| 2755 | // | | | |
| 2756 | // | | SubDelReq | |
| 2757 | // | |------------->| |
| 2758 | // | | | |
| 2759 | // | | | |
| 2760 | // | | SubDelReq | |
| 2761 | // | |------------->| |
| 2762 | // | | | |
| 2763 | // | | | |
| 2764 | // | | SubDelResp | |
| 2765 | // | |<-------------| |
| 2766 | // | RESTNotif | | |
| 2767 | // | unsuccess | | |
| 2768 | // |<----------------| | |
| 2769 | // | | | |
| 2770 | // | [SUBS DELETE] | |
| 2771 | // | | | |
| 2772 | // |
| 2773 | //----------------------------------------------------------------------------- |
| 2774 | func TestRESTSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 2775 | CaseBegin("TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
| 2776 | |
| 2777 | // Init counter check |
| 2778 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2779 | Counter{cSubReqFromXapp, 1}, |
| 2780 | Counter{cSubReqToE2, 1}, |
| 2781 | Counter{cSubReReqToE2, 1}, |
| 2782 | Counter{cSubReqTimerExpiry, 2}, |
| 2783 | Counter{cSubDelReqToE2, 1}, |
| 2784 | Counter{cSubDelRespFromE2, 1}, |
| 2785 | }) |
| 2786 | |
| 2787 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2788 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2789 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2790 | |
| 2791 | e2termConn1.RecvSubsReq(t) |
| 2792 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2793 | |
| 2794 | e2termConn1.RecvSubsReq(t) |
| 2795 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2796 | |
| 2797 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2798 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2799 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2800 | // e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) - TODO: Should we delete this? |
| 2801 | xappConn1.WaitRESTNotification(t, restSubId) |
| 2802 | |
| 2803 | // Wait that subs is cleaned |
| 2804 | waitSubsCleanup(t, delreq.RequestId.InstanceId, 10) |
| 2805 | |
| 2806 | mainCtrl.VerifyCounterValues(t) |
| 2807 | } |
| 2808 | |
| 2809 | func TestREST2eTermNotRespondingToSubReq(t *testing.T) { |
| 2810 | CaseBegin("TestREST2eTermNotRespondingToSubReq start") |
| 2811 | |
| 2812 | // Init counter check |
| 2813 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2814 | Counter{cSubReqFromXapp, 1}, |
| 2815 | Counter{cSubReqToE2, 1}, |
| 2816 | Counter{cSubReReqToE2, 1}, |
| 2817 | Counter{cSubReqTimerExpiry, 2}, |
| 2818 | Counter{cSubDelReqToE2, 1}, |
| 2819 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2820 | }) |
| 2821 | |
| 2822 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2823 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2824 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2825 | |
| 2826 | e2termConn1.RecvSubsReq(t) |
| 2827 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2828 | |
| 2829 | e2termConn1.RecvSubsReq(t) |
| 2830 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2831 | |
| 2832 | e2termConn1.RecvSubsDelReq(t) |
| 2833 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 2834 | |
| 2835 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2836 | e2termConn1.RecvSubsDelReq(t) |
| 2837 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 2838 | |
| 2839 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2840 | |
| 2841 | waitSubsCleanup(t, e2SubsId, 10) |
| 2842 | |
| 2843 | mainCtrl.VerifyCounterValues(t) |
| 2844 | |
| 2845 | } |
| 2846 | |
| 2847 | //----------------------------------------------------------------------------- |
| 2848 | // TestRESTSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 2849 | // |
| 2850 | // stub stub |
| 2851 | // +-------+ +---------+ +---------+ |
| 2852 | // | xapp | | submgr | | e2term | |
| 2853 | // +-------+ +---------+ +---------+ |
| 2854 | // | | | |
| 2855 | // | RESTSubReq | | |
| 2856 | // |---------------->| | |
| 2857 | // | | | |
| 2858 | // | RESTSubResp | | |
| 2859 | // |<----------------| | |
| 2860 | // | | SubReq | |
| 2861 | // | |------------->| |
| 2862 | // | | | |
| 2863 | // | | | |
| 2864 | // | | SubReq | |
| 2865 | // | |------------->| |
| 2866 | // | | | |
| 2867 | // | | SubDelReq | |
| 2868 | // | |------------->| |
| 2869 | // | | | |
| 2870 | // | | | |
| 2871 | // | | SubDelReq | |
| 2872 | // | |------------->| |
| 2873 | // | | | |
| 2874 | // | | | |
| 2875 | // | | SubDelResp | |
| 2876 | // | |<-------------| |
| 2877 | // | RESTNotif | | |
| 2878 | // | unsuccess | | |
| 2879 | // |<----------------| | |
| 2880 | // | | | |
| 2881 | // | [SUBS DELETE] | |
| 2882 | // | | | |
| 2883 | // |
| 2884 | //----------------------------------------------------------------------------- |
| 2885 | func TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 2886 | CaseBegin("TestRESTSubReqTwoRetriesNoRespAtAllInSubmgr start") |
| 2887 | |
| 2888 | // Init counter check |
| 2889 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2890 | Counter{cSubReqFromXapp, 1}, |
| 2891 | Counter{cSubReqToE2, 1}, |
| 2892 | Counter{cSubReReqToE2, 1}, |
| 2893 | Counter{cSubReqTimerExpiry, 2}, |
| 2894 | Counter{cSubDelReqToE2, 1}, |
| 2895 | Counter{cSubDelReReqToE2, 1}, |
| 2896 | Counter{cSubDelReqTimerExpiry, 2}, |
| 2897 | }) |
| 2898 | |
| 2899 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2900 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2901 | xapp.Logger.Info("Send REST subscriber request for subscriber : %v", restSubId) |
| 2902 | |
| 2903 | e2termConn1.RecvSubsReq(t) |
| 2904 | xapp.Logger.Info("Ignore 1st REST subscriber request for subscriber : %v", restSubId) |
| 2905 | |
| 2906 | e2termConn1.RecvSubsReq(t) |
| 2907 | xapp.Logger.Info("Ignore 2nd REST subscriber request for subscriber : %v", restSubId) |
| 2908 | |
| 2909 | e2termConn1.RecvSubsDelReq(t) |
| 2910 | xapp.Logger.Info("Ignore 1st INTERNAL delete request for subscriber : %v", restSubId) |
| 2911 | |
| 2912 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2913 | e2termConn1.RecvSubsDelReq(t) |
| 2914 | xapp.Logger.Info("Ignore 2nd INTERNAL delete request for subscriber : %v", restSubId) |
| 2915 | |
| 2916 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2917 | |
| 2918 | waitSubsCleanup(t, e2SubsId, 10) |
| 2919 | |
| 2920 | mainCtrl.VerifyCounterValues(t) |
| 2921 | } |
| 2922 | |
| 2923 | //----------------------------------------------------------------------------- |
| 2924 | // TestRESTSubReqSubFailRespInSubmgr |
| 2925 | // |
| 2926 | // stub stub |
| 2927 | // +-------+ +---------+ +---------+ |
| 2928 | // | xapp | | submgr | | e2term | |
| 2929 | // +-------+ +---------+ +---------+ |
| 2930 | // | | | |
| 2931 | // | RESTSubReq | | |
| 2932 | // |---------------->| | |
| 2933 | // | | | |
| 2934 | // | RESTSubResp | | |
| 2935 | // |<----------------| | |
| 2936 | // | | SubReq | |
| 2937 | // | |------------->| |
| 2938 | // | | | |
| 2939 | // | | SubFail | |
| 2940 | // | |<-------------| |
| 2941 | // | | | |
| 2942 | // | | SubDelReq | |
| 2943 | // | |------------->| |
| 2944 | // | | | |
| 2945 | // | | SubDelResp | |
| 2946 | // | |<-------------| |
| 2947 | // | | | |
| 2948 | // | RESTNotif | | |
| 2949 | // | unsuccess | | |
| 2950 | // |<----------------| | |
| 2951 | // | | | |
| 2952 | // | [SUBS DELETE] | |
| 2953 | // | | | |
| 2954 | // |
| 2955 | //----------------------------------------------------------------------------- |
| 2956 | func TestRESTSubReqSubFailRespInSubmgr(t *testing.T) { |
| 2957 | CaseBegin("TestRESTSubReqSubFailRespInSubmgr") |
| 2958 | |
| 2959 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 2960 | Counter{cSubReqFromXapp, 1}, |
| 2961 | Counter{cSubReqToE2, 1}, |
| 2962 | Counter{cSubFailFromE2, 1}, |
| 2963 | Counter{cSubRespToXapp, 1}, |
| 2964 | Counter{cSubDelReqFromXapp, 1}, |
| 2965 | }) |
| 2966 | |
| 2967 | const subReqCount int = 1 |
| 2968 | const parameterSet = 1 |
| 2969 | const actionDefinitionPresent bool = true |
| 2970 | const actionParamCount int = 1 |
| 2971 | |
| 2972 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 2973 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 2974 | |
| 2975 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2976 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 2977 | fparams1.Set(crereq1) |
| 2978 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 2979 | |
| 2980 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 2981 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 2982 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 2983 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 2984 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 2985 | |
| 2986 | // REST subscription sill there to be deleted |
| 2987 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 2988 | |
| 2989 | // Wait that subs is cleaned |
| 2990 | waitSubsCleanup(t, e2SubsId, 10) |
| 2991 | |
| 2992 | mainCtrl.VerifyCounterValues(t) |
| 2993 | |
| 2994 | } |
| 2995 | |
| 2996 | //----------------------------------------------------------------------------- |
| 2997 | // TestRESTSubDelReqRetryInSubmgr |
| 2998 | // |
| 2999 | // stub stub |
| 3000 | // +-------+ +---------+ +---------+ |
| 3001 | // | xapp | | submgr | | e2term | |
| 3002 | // +-------+ +---------+ +---------+ |
| 3003 | // | | | |
| 3004 | // | [SUBS CREATE] | |
| 3005 | // | | | |
| 3006 | // | | | |
| 3007 | // | RESTSubDelReq | | |
| 3008 | // |---------------->| | |
| 3009 | // | | | |
| 3010 | // | RESTSubDelResp | | |
| 3011 | // |<----------------| | |
| 3012 | // | | SubDelReq | |
| 3013 | // | |------------->| |
| 3014 | // | | | |
| 3015 | // | | SubDelReq | |
| 3016 | // | |------------->| |
| 3017 | // | | | |
| 3018 | // | | SubDelResp | |
| 3019 | // | |<-------------| |
| 3020 | // | | | |
| 3021 | // |
| 3022 | //----------------------------------------------------------------------------- |
| 3023 | func TestRESTSubDelReqRetryInSubmgr(t *testing.T) { |
| 3024 | CaseBegin("TestRESTSubDelReqRetryInSubmgr") |
| 3025 | |
| 3026 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3027 | Counter{cSubReqFromXapp, 1}, |
| 3028 | Counter{cSubReqToE2, 1}, |
| 3029 | Counter{cSubRespFromE2, 1}, |
| 3030 | Counter{cSubRespToXapp, 1}, |
| 3031 | Counter{cSubDelReqFromXapp, 1}, |
| 3032 | Counter{cSubDelReqToE2, 1}, |
| 3033 | Counter{cSubDelReReqToE2, 1}, |
| 3034 | Counter{cSubDelRespFromE2, 1}, |
| 3035 | Counter{cSubDelRespToXapp, 1}, |
| 3036 | }) |
| 3037 | // Req |
| 3038 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3039 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3040 | |
| 3041 | // Del |
| 3042 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3043 | |
| 3044 | // E2t: Receive 1st SubsDelReq |
| 3045 | e2termConn1.RecvSubsDelReq(t) |
| 3046 | |
| 3047 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3048 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3049 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3050 | |
| 3051 | //Wait that subs is cleaned |
| 3052 | waitSubsCleanup(t, e2SubsId, 10) |
| 3053 | |
| 3054 | mainCtrl.VerifyCounterValues(t) |
| 3055 | } |
| 3056 | |
| 3057 | //----------------------------------------------------------------------------- |
| 3058 | // TestRESTSubDelReqTwoRetriesNoRespInSubmgr |
| 3059 | // |
| 3060 | // stub stub |
| 3061 | // +-------+ +---------+ +---------+ |
| 3062 | // | xapp | | submgr | | e2term | |
| 3063 | // +-------+ +---------+ +---------+ |
| 3064 | // | | | |
| 3065 | // | [SUBS CREATE] | |
| 3066 | // | | | |
| 3067 | // | | | |
| 3068 | // | RESTSubDelReq | | |
| 3069 | // |---------------->| | |
| 3070 | // | | | |
| 3071 | // | RESTSubDelResp | | |
| 3072 | // |<----------------| | |
| 3073 | // | | SubDelReq | |
| 3074 | // | |------------->| |
| 3075 | // | | | |
| 3076 | // | | SubDelReq | |
| 3077 | // | |------------->| |
| 3078 | // | | | |
| 3079 | // | | | |
| 3080 | // |
| 3081 | //----------------------------------------------------------------------------- |
| 3082 | func TestRESTSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 3083 | CaseBegin("TestRESTSubDelReTwoRetriesNoRespInSubmgr") |
| 3084 | |
| 3085 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3086 | Counter{cSubReqFromXapp, 1}, |
| 3087 | Counter{cSubReqToE2, 1}, |
| 3088 | Counter{cSubRespFromE2, 1}, |
| 3089 | Counter{cSubRespToXapp, 1}, |
| 3090 | Counter{cSubDelReqFromXapp, 1}, |
| 3091 | Counter{cSubDelReqToE2, 1}, |
| 3092 | Counter{cSubDelReReqToE2, 1}, |
| 3093 | Counter{cSubDelRespFromE2, 1}, |
| 3094 | Counter{cSubDelRespToXapp, 1}, |
| 3095 | }) |
| 3096 | |
| 3097 | // Req |
| 3098 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3099 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3100 | |
| 3101 | // Del |
| 3102 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3103 | |
| 3104 | // E2t: Receive 1st SubsDelReq |
| 3105 | e2termConn1.RecvSubsDelReq(t) |
| 3106 | |
| 3107 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
| 3108 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3109 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 3110 | |
| 3111 | //Wait that subs is cleaned |
| 3112 | waitSubsCleanup(t, e2SubsId, 10) |
| 3113 | |
| 3114 | mainCtrl.VerifyCounterValues(t) |
| 3115 | } |
| 3116 | |
| 3117 | //----------------------------------------------------------------------------- |
| 3118 | // TestRESTSubDelReqSubDelFailRespInSubmgr |
| 3119 | // |
| 3120 | // stub stub |
| 3121 | // +-------+ +---------+ +---------+ |
| 3122 | // | xapp | | submgr | | e2term | |
| 3123 | // +-------+ +---------+ +---------+ |
| 3124 | // | | | |
| 3125 | // | [SUBS CREATE] | |
| 3126 | // | | | |
| 3127 | // | | | |
| 3128 | // | RESTSubDelReq | | |
| 3129 | // |---------------->| | |
| 3130 | // | | | |
| 3131 | // | RESTSubDelResp | | |
| 3132 | // |<----------------| | |
| 3133 | // | | SubDelReq | |
| 3134 | // | |------------->| |
| 3135 | // | | | |
| 3136 | // | | SubDelFail | |
| 3137 | // | |<-------------| |
| 3138 | // | | | |
| 3139 | // |
| 3140 | //----------------------------------------------------------------------------- |
| 3141 | func TestRESTSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 3142 | CaseBegin("TestRESTSubDelReqSubDelFailRespInSubmgr") |
| 3143 | |
| 3144 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3145 | Counter{cSubReqFromXapp, 1}, |
| 3146 | Counter{cSubReqToE2, 1}, |
| 3147 | Counter{cSubRespFromE2, 1}, |
| 3148 | Counter{cSubRespToXapp, 1}, |
| 3149 | Counter{cSubDelReqFromXapp, 1}, |
| 3150 | Counter{cSubDelReqToE2, 1}, |
| 3151 | Counter{cSubDelFailFromE2, 1}, |
| 3152 | Counter{cSubDelRespToXapp, 1}, |
| 3153 | }) |
| 3154 | |
| 3155 | // Req |
| 3156 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3157 | restSubId, e2SubsId := createSubscription(t, xappConn1, e2termConn1, params) |
| 3158 | |
| 3159 | // Del |
| 3160 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 3161 | |
| 3162 | // E2t: Send receive SubsDelReq and send SubsDelFail |
| 3163 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 3164 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
| 3165 | |
| 3166 | //Wait that subs is cleaned |
| 3167 | waitSubsCleanup(t, e2SubsId, 10) |
| 3168 | |
| 3169 | mainCtrl.VerifyCounterValues(t) |
| 3170 | } |
| 3171 | |
| 3172 | //----------------------------------------------------------------------------- |
| 3173 | // TestRESTSubReqAndSubDelOkSameAction |
| 3174 | // |
| 3175 | // stub stub |
| 3176 | // +-------+ +-------+ +---------+ +---------+ |
| 3177 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3178 | // +-------+ +-------+ +---------+ +---------+ |
| 3179 | // | | | | |
| 3180 | // | | RESTSubReq1 | | |
| 3181 | // | |---------------->| | |
| 3182 | // | | | | |
| 3183 | // | | RESTSubResp1 | | |
| 3184 | // | |<----------------| | |
| 3185 | // | | | | |
| 3186 | // | | | SubReq1 | |
| 3187 | // | | |------------->| |
| 3188 | // | | | SubResp1 | |
| 3189 | // | | |<-------------| |
| 3190 | // | | RESTNotif1 | | |
| 3191 | // | |<----------------| | |
| 3192 | // | | | | |
| 3193 | // | RESTSubReq2 | | |
| 3194 | // |------------------------------>| | |
| 3195 | // | | | | |
| 3196 | // | RESTSubResp2 | | |
| 3197 | // |<------------------------------| | |
| 3198 | // | | | | |
| 3199 | // | | RESTNotif2 | | |
| 3200 | // |<------------------------------| | |
| 3201 | // | | | | |
| 3202 | // | | RESTSubDelReq1 | | |
| 3203 | // | |---------------->| | |
| 3204 | // | | | | |
| 3205 | // | | RESTSubDelResp1 | | |
| 3206 | // | |<----------------| | |
| 3207 | // | | | | |
| 3208 | // | RESTSubDelReq2 | | |
| 3209 | // |------------------------------>| | |
| 3210 | // | | | | |
| 3211 | // | RESTSubDelResp2 | | |
| 3212 | // |<------------------------------| | |
| 3213 | // | | | | |
| 3214 | // | | | SubDelReq2 | |
| 3215 | // | | |------------->| |
| 3216 | // | | | | |
| 3217 | // | | | SubDelResp2 | |
| 3218 | // | | |<-------------| |
| 3219 | // | | | | |
| 3220 | // |
| 3221 | //----------------------------------------------------------------------------- |
| 3222 | func TestRESTSubReqAndSubDelOkSameAction(t *testing.T) { |
| 3223 | CaseBegin("TestRESTSubReqAndSubDelOkSameAction") |
| 3224 | |
| 3225 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3226 | Counter{cSubReqFromXapp, 2}, |
| 3227 | Counter{cSubReqToE2, 1}, |
| 3228 | Counter{cSubRespFromE2, 1}, |
| 3229 | Counter{cSubRespToXapp, 2}, |
| 3230 | Counter{cMergedSubscriptions, 1}, |
| 3231 | Counter{cUnmergedSubscriptions, 1}, |
| 3232 | Counter{cSubDelReqFromXapp, 2}, |
| 3233 | Counter{cSubDelReqToE2, 1}, |
| 3234 | Counter{cSubDelRespFromE2, 1}, |
| 3235 | Counter{cSubDelRespToXapp, 2}, |
| 3236 | }) |
| 3237 | |
| 3238 | // Req1 |
| 3239 | var params *teststube2ap.RESTSubsReqParams = nil |
| 3240 | |
| 3241 | //Subs Create |
| 3242 | restSubId1, e2SubsId1 := createSubscription(t, xappConn1, e2termConn1, params) |
| 3243 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560"}) |
| 3244 | |
| 3245 | // Req2 |
| 3246 | params = xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3247 | params.SetMeid("RAN_NAME_1") |
| 3248 | |
| 3249 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 3250 | xappConn2.WaitRESTNotificationForAnySubscriptionId(t) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3251 | waiter := rtmgrHttp.AllocNextSleep(10, true) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3252 | restSubId2 := xappConn2.SendRESTSubsReq(t, params) |
Markku Virtanen | 5ae07f4 | 2021-05-18 12:03:16 +0000 | [diff] [blame] | 3253 | waiter.WaitResult(t) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3254 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId2) |
| 3255 | e2SubsId2 := <-xappConn2.RESTNotification |
| 3256 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId2) |
| 3257 | |
| 3258 | queryXappSubscription(t, int64(e2SubsId1), "RAN_NAME_1", []string{"localhost:13560", "localhost:13660"}) |
| 3259 | |
| 3260 | // Del1 |
| 3261 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3262 | |
| 3263 | // Del2 |
| 3264 | deleteXapp2Subscription(t, &restSubId2) |
| 3265 | |
| 3266 | //Wait that subs is cleaned |
| 3267 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3268 | |
| 3269 | mainCtrl.VerifyCounterValues(t) |
| 3270 | } |
| 3271 | |
| 3272 | //----------------------------------------------------------------------------- |
| 3273 | // TestSubReqAndSubDelOkSameActionParallel |
| 3274 | // |
| 3275 | // stub stub stub |
| 3276 | // +-------+ +-------+ +---------+ +---------+ |
| 3277 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3278 | // +-------+ +-------+ +---------+ +---------+ |
| 3279 | // | | | | |
| 3280 | // | | | | |
| 3281 | // | | | | |
| 3282 | // | | SubReq1 | | |
| 3283 | // | |------------->| | |
| 3284 | // | | | | |
| 3285 | // | | | SubReq1 | |
| 3286 | // | | |------------->| |
| 3287 | // | SubReq2 | | |
| 3288 | // |--------------------------->| | |
| 3289 | // | | | SubResp1 | |
| 3290 | // | | |<-------------| |
| 3291 | // | | SubResp1 | | |
| 3292 | // | |<-------------| | |
| 3293 | // | | | SubReq2 | |
| 3294 | // | | |------------->| |
| 3295 | // | | | | |
| 3296 | // | | | SubResp2 | |
| 3297 | // | | |<-------------| |
| 3298 | // | SubResp2 | | |
| 3299 | // |<---------------------------| | |
| 3300 | // | | | | |
| 3301 | // | | SubDelReq 1 | | |
| 3302 | // | |------------->| | |
| 3303 | // | | | | |
| 3304 | // | | SubDelResp 1 | | |
| 3305 | // | |<-------------| | |
| 3306 | // | | | | |
| 3307 | // | SubDelReq 2 | | |
| 3308 | // |--------------------------->| | |
| 3309 | // | | | | |
| 3310 | // | | | SubDelReq 2 | |
| 3311 | // | | |------------->| |
| 3312 | // | | | | |
| 3313 | // | | | SubDelReq 2 | |
| 3314 | // | | |------------->| |
| 3315 | // | | | | |
| 3316 | // | SubDelResp 2 | | |
| 3317 | // |<---------------------------| | |
| 3318 | // |
| 3319 | func TestRESTSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
| 3320 | CaseBegin("TestRESTSubReqAndSubDelOkSameActionParallel") |
| 3321 | |
| 3322 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3323 | Counter{cSubReqFromXapp, 2}, |
| 3324 | Counter{cSubReqToE2, 2}, |
| 3325 | Counter{cSubRespFromE2, 2}, |
| 3326 | Counter{cSubRespToXapp, 2}, |
| 3327 | Counter{cSubDelReqFromXapp, 2}, |
| 3328 | Counter{cSubDelReqToE2, 2}, |
| 3329 | Counter{cSubDelRespFromE2, 2}, |
| 3330 | Counter{cSubDelRespToXapp, 2}, |
| 3331 | }) |
| 3332 | |
| 3333 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3334 | restSubId1 := xappConn1.SendRESTSubsReq(t, params) |
| 3335 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 3336 | |
| 3337 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3338 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3339 | |
| 3340 | xappConn1.ExpectRESTNotification(t, restSubId1) |
| 3341 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 3342 | e2SubsId1 := xappConn1.WaitRESTNotification(t, restSubId1) |
| 3343 | |
| 3344 | xappConn2.ExpectRESTNotification(t, restSubId2) |
| 3345 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 3346 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 3347 | e2SubsId2 := xappConn2.WaitRESTNotification(t, restSubId2) |
| 3348 | |
| 3349 | // Del1 |
| 3350 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3351 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 3352 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3353 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 3354 | |
| 3355 | // Del2 |
| 3356 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3357 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 3358 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 3359 | |
| 3360 | waitSubsCleanup(t, e2SubsId2, 10) |
| 3361 | |
| 3362 | mainCtrl.VerifyCounterValues(t) |
| 3363 | } |
| 3364 | |
| 3365 | //----------------------------------------------------------------------------- |
| 3366 | // TestRESTSubReqAndSubDelNoAnswerSameActionParallel |
| 3367 | // |
| 3368 | // stub stub stub |
| 3369 | // +-------+ +-------+ +---------+ +---------+ |
| 3370 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 3371 | // +-------+ +-------+ +---------+ +---------+ |
| 3372 | // | | | | |
| 3373 | // | | | | |
| 3374 | // | | | | |
| 3375 | // | | RESTSubReq1 | | |
| 3376 | // | |---------------->| | |
| 3377 | // | | | | |
| 3378 | // | | RESTSubResp1 | | |
| 3379 | // | |<----------------| | |
| 3380 | // | | | SubReq1 | |
| 3381 | // | | |------------->| |
| 3382 | // | RESTSubReq2 | | |
| 3383 | // |------------------------------>| | |
| 3384 | // | | | | |
| 3385 | // | RESTSubDelResp2 | | |
| 3386 | // |<------------------------------| | |
| 3387 | // | | | SubReq1 | |
| 3388 | // | | |------------->| |
| 3389 | // | | | | |
| 3390 | // | | | | |
| 3391 | // | | | SubDelReq | |
| 3392 | // | | |------------->| |
| 3393 | // | | | | |
| 3394 | // | | | SubDelResp | |
| 3395 | // | | |<-------------| |
| 3396 | // | | RESTNotif1 | | |
| 3397 | // | | unsuccess | | |
| 3398 | // | |<----------------| | |
| 3399 | // | RESTNotif2 | | |
| 3400 | // | | unsuccess | | |
| 3401 | // |<------------------------------| | |
| 3402 | // | | | | |
| 3403 | // | | RESTSubDelReq1 | | |
| 3404 | // | |---------------->| | |
| 3405 | // | | | | |
| 3406 | // | | RESTSubDelResp1 | | |
| 3407 | // | |<----------------| | |
| 3408 | // | | | | |
| 3409 | // | RESTSubDelReq2 | | |
| 3410 | // |------------------------------>| | |
| 3411 | // | | | | |
| 3412 | // | RESTSubDelResp2 | | |
| 3413 | // |<------------------------------| | |
| 3414 | // |
| 3415 | //----------------------------------------------------------------------------- |
| 3416 | func TestRESTSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
| 3417 | CaseBegin("TestRESTSubReqAndSubDelNoAnswerSameActionParallel") |
| 3418 | |
| 3419 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 3420 | Counter{cSubReqFromXapp, 2}, |
| 3421 | Counter{cSubReqToE2, 1}, |
| 3422 | Counter{cSubRespToXapp, 2}, |
| 3423 | Counter{cSubDelReqFromXapp, 2}, |
| 3424 | Counter{cSubDelReqToE2, 1}, |
| 3425 | Counter{cSubDelRespFromE2, 1}, |
| 3426 | Counter{cSubDelRespToXapp, 2}, |
| 3427 | }) |
| 3428 | |
| 3429 | const subReqCount int = 1 |
| 3430 | const parameterSet = 1 |
| 3431 | const actionDefinitionPresent bool = true |
| 3432 | const actionParamCount int = 1 |
| 3433 | |
| 3434 | // Req1 |
| 3435 | params1 := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3436 | restSubId1 := xappConn1.SendRESTSubsReq(t, params1) |
| 3437 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
| 3438 | |
| 3439 | // Req2 |
| 3440 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
| 3441 | params2 := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 3442 | params2.SetMeid("RAN_NAME_1") |
| 3443 | restSubId2 := xappConn2.SendRESTSubsReq(t, params2) |
| 3444 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
| 3445 | |
| 3446 | //Req1 (retransmitted) |
| 3447 | e2termConn1.RecvSubsReq(t) |
| 3448 | |
| 3449 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 3450 | |
| 3451 | xappConn1.WaitListedRestNotifications(t, []string{restSubId1, restSubId2}) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3452 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 3453 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 3454 | e2SubsIdA := <-xappConn1.ListedRESTNotifications |
| 3455 | xapp.Logger.Info("TEST: 1.st XAPP notification received e2SubsId=%v", e2SubsIdA) |
| 3456 | e2SubsIdB := <-xappConn1.ListedRESTNotifications |
| 3457 | xapp.Logger.Info("TEST: 2.nd XAPP notification received e2SubsId=%v", e2SubsIdB) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3458 | |
| 3459 | // Del1 |
| 3460 | xappConn1.SendRESTSubsDelReq(t, &restSubId1) |
| 3461 | |
| 3462 | // Del2 |
| 3463 | xappConn2.SendRESTSubsDelReq(t, &restSubId2) |
| 3464 | |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 3465 | mainCtrl.wait_multi_subs_clean(t, []uint32{e2SubsIdA.E2SubsId, e2SubsIdB.E2SubsId}, 10) |
| 3466 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 3467 | //Wait that subs is cleaned |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 3468 | waitSubsCleanup(t, e2SubsIdA.E2SubsId, 10) |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 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 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4339 | func TestRESTTwoPolicySubReqAndSubDelOk(t *testing.T) { |
| 4340 | |
| 4341 | subReqCount := 2 |
| 4342 | |
| 4343 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4344 | Counter{cSubReqFromXapp, 1}, |
| 4345 | Counter{cSubReqToE2, 2}, |
| 4346 | Counter{cSubRespFromE2, 2}, |
| 4347 | Counter{cSubRespToXapp, 2}, |
| 4348 | Counter{cSubDelReqFromXapp, 1}, |
| 4349 | Counter{cSubDelReqToE2, 2}, |
| 4350 | Counter{cSubDelRespFromE2, 2}, |
| 4351 | Counter{cSubDelRespToXapp, 1}, |
| 4352 | }) |
| 4353 | |
| 4354 | // Req |
| 4355 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4356 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4357 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4358 | |
| 4359 | assert.Equal(t, len(e2SubsIds), 2) |
| 4360 | |
| 4361 | // Del |
| 4362 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4363 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4364 | |
| 4365 | xappConn1.TestMsgChanEmpty(t) |
| 4366 | e2termConn1.TestMsgChanEmpty(t) |
| 4367 | mainCtrl.wait_registry_empty(t, 10) |
| 4368 | |
| 4369 | mainCtrl.VerifyCounterValues(t) |
| 4370 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4371 | func TestRESTPolicySubReqAndSubDelOkFullAmount(t *testing.T) { |
| 4372 | |
| 4373 | subReqCount := 19 |
| 4374 | |
| 4375 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4376 | Counter{cSubReqFromXapp, 1}, |
| 4377 | Counter{cSubReqToE2, 19}, |
| 4378 | Counter{cSubRespFromE2, 19}, |
| 4379 | Counter{cSubRespToXapp, 19}, |
| 4380 | Counter{cSubDelReqFromXapp, 1}, |
| 4381 | Counter{cSubDelReqToE2, 19}, |
| 4382 | Counter{cSubDelRespFromE2, 19}, |
| 4383 | Counter{cSubDelRespToXapp, 1}, |
| 4384 | }) |
| 4385 | |
| 4386 | // Req |
| 4387 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4388 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4389 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4390 | |
| 4391 | assert.Equal(t, len(e2SubsIds), 19) |
| 4392 | |
| 4393 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4394 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4395 | |
| 4396 | xappConn1.TestMsgChanEmpty(t) |
| 4397 | e2termConn1.TestMsgChanEmpty(t) |
| 4398 | mainCtrl.wait_registry_empty(t, 10) |
| 4399 | |
| 4400 | mainCtrl.VerifyCounterValues(t) |
| 4401 | } |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4402 | func TestRESTTwoReportSubReqAndSubDelOk(t *testing.T) { |
| 4403 | |
| 4404 | subReqCount := 2 |
| 4405 | parameterSet := 1 |
| 4406 | actionDefinitionPresent := true |
| 4407 | actionParamCount := 1 |
| 4408 | |
| 4409 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4410 | Counter{cSubReqFromXapp, 1}, |
| 4411 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4412 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4413 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4414 | Counter{cSubDelReqFromXapp, 1}, |
| 4415 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4416 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4417 | Counter{cSubDelRespToXapp, 1}, |
| 4418 | }) |
| 4419 | |
| 4420 | // Req |
| 4421 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4422 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4423 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4424 | |
| 4425 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4426 | |
| 4427 | // Del |
| 4428 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4429 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4430 | |
| 4431 | xappConn1.TestMsgChanEmpty(t) |
| 4432 | e2termConn1.TestMsgChanEmpty(t) |
| 4433 | mainCtrl.wait_registry_empty(t, 10) |
| 4434 | |
| 4435 | mainCtrl.VerifyCounterValues(t) |
| 4436 | } |
Markku Virtanen | da34eec | 2021-05-20 08:22:04 +0000 | [diff] [blame^] | 4437 | |
archagge | afbf95f | 2021-04-14 08:54:05 +0300 | [diff] [blame] | 4438 | /* |
| 4439 | func TestRESTTwoReportSubReqAndSubDelOkNoActParams(t *testing.T) { |
| 4440 | |
| 4441 | subReqCount := 2 |
| 4442 | parameterSet := 1 |
| 4443 | actionDefinitionPresent := false |
| 4444 | actionParamCount := 0 |
| 4445 | |
| 4446 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4447 | Counter{cSubReqFromXapp, 1}, |
| 4448 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4449 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4450 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4451 | Counter{cSubDelReqFromXapp, 1}, |
| 4452 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4453 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4454 | Counter{cSubDelRespToXapp, 1}, |
| 4455 | }) |
| 4456 | |
| 4457 | // Req |
| 4458 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4459 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4460 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4461 | |
| 4462 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4463 | |
| 4464 | // Del |
| 4465 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4466 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4467 | |
| 4468 | xappConn1.TestMsgChanEmpty(t) |
| 4469 | e2termConn1.TestMsgChanEmpty(t) |
| 4470 | mainCtrl.wait_registry_empty(t, 10) |
| 4471 | |
| 4472 | mainCtrl.VerifyCounterValues(t) |
| 4473 | } |
| 4474 | */ |
| 4475 | /* |
| 4476 | func TestRESTFullAmountReportSubReqAndSubDelOk(t *testing.T) { |
| 4477 | |
| 4478 | subReqCount := 19 |
| 4479 | parameterSet := 1 |
| 4480 | actionDefinitionPresent := false |
| 4481 | actionParamCount := 0 |
| 4482 | |
| 4483 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 4484 | Counter{cSubReqFromXapp, 1}, |
| 4485 | Counter{cSubReqToE2, uint64(subReqCount)}, |
| 4486 | Counter{cSubRespFromE2, uint64(subReqCount)}, |
| 4487 | Counter{cSubRespToXapp, uint64(subReqCount)}, |
| 4488 | Counter{cSubDelReqFromXapp, 1}, |
| 4489 | Counter{cSubDelReqToE2, uint64(subReqCount)}, |
| 4490 | Counter{cSubDelRespFromE2, uint64(subReqCount)}, |
| 4491 | Counter{cSubDelRespToXapp, 1}, |
| 4492 | }) |
| 4493 | |
| 4494 | // Req |
| 4495 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4496 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4497 | e2SubsIds := sendAndReceiveMultipleE2SubReqs(t, subReqCount, xappConn1, e2termConn1, restSubId) |
| 4498 | |
| 4499 | assert.Equal(t, len(e2SubsIds), subReqCount) |
| 4500 | |
| 4501 | // Del |
| 4502 | xappConn1.SendRESTSubsDelReq(t, &restSubId) |
| 4503 | sendAndReceiveMultipleE2DelReqs(t, e2SubsIds, e2termConn1) |
| 4504 | |
| 4505 | xappConn1.TestMsgChanEmpty(t) |
| 4506 | e2termConn1.TestMsgChanEmpty(t) |
| 4507 | mainCtrl.wait_registry_empty(t, 10) |
| 4508 | |
| 4509 | mainCtrl.VerifyCounterValues(t) |
| 4510 | } |
| 4511 | */ |
| 4512 | //////////////////////////////////////////////////////////////////////////////////// |
| 4513 | // Services for UT cases |
| 4514 | //////////////////////////////////////////////////////////////////////////////////// |
| 4515 | const subReqCount int = 1 |
| 4516 | const parameterSet = 1 |
| 4517 | const actionDefinitionPresent bool = true |
| 4518 | const actionParamCount int = 1 |
| 4519 | const policyParamCount int = 1 |
| 4520 | const host string = "localhost" |
| 4521 | |
| 4522 | func createSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, params *teststube2ap.RESTSubsReqParams) (string, uint32) { |
| 4523 | if params == nil { |
| 4524 | params = fromXappConn.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4525 | } |
| 4526 | restSubId := fromXappConn.SendRESTSubsReq(t, params) |
| 4527 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 4528 | |
| 4529 | crereq1, cremsg1 := toE2termConn.RecvSubsReq(t) |
| 4530 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 4531 | toE2termConn.SendSubsResp(t, crereq1, cremsg1) |
| 4532 | e2SubsId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 4533 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4534 | |
| 4535 | return restSubId, e2SubsId |
| 4536 | } |
| 4537 | |
| 4538 | func createXapp2MergedSubscription(t *testing.T, meid string) (string, uint32) { |
| 4539 | |
| 4540 | params := xappConn2.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4541 | if meid != "" { |
| 4542 | params.SetMeid(meid) |
| 4543 | } |
| 4544 | xapp.Subscription.SetResponseCB(xappConn2.SubscriptionRespHandler) |
| 4545 | restSubId := xappConn2.SendRESTSubsReq(t, params) |
| 4546 | xappConn2.ExpectRESTNotification(t, restSubId) |
| 4547 | xapp.Logger.Info("Send REST subscriber request for subscriberId : %v", restSubId) |
| 4548 | e2SubsId := xappConn2.WaitRESTNotification(t, restSubId) |
| 4549 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4550 | |
| 4551 | return restSubId, e2SubsId |
| 4552 | } |
| 4553 | |
| 4554 | func createXapp1PolicySubscription(t *testing.T) (string, uint32) { |
| 4555 | params := xappConn1.GetRESTSubsReqPolicyParams(subReqCount, actionDefinitionPresent, policyParamCount) |
| 4556 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4557 | xapp.Logger.Info("Send REST Policy subscriber request for subscriberId : %v", restSubId) |
| 4558 | |
| 4559 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4560 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4561 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 4562 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4563 | xapp.Logger.Info("REST notification received e2SubsId=%v", e2SubsId) |
| 4564 | |
| 4565 | return restSubId, e2SubsId |
| 4566 | } |
| 4567 | |
| 4568 | func createXapp1ReportSubscriptionE2Fail(t *testing.T) (string, uint32) { |
| 4569 | params := xappConn1.GetRESTSubsReqReportParams(subReqCount, parameterSet, actionDefinitionPresent, actionParamCount) |
| 4570 | restSubId := xappConn1.SendRESTSubsReq(t, params) |
| 4571 | |
| 4572 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 4573 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 4574 | fparams1.Set(crereq1) |
| 4575 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 4576 | |
| 4577 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 4578 | xappConn1.ExpectRESTNotification(t, restSubId) |
| 4579 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 4580 | e2SubsId := xappConn1.WaitRESTNotification(t, restSubId) |
| 4581 | xapp.Logger.Info("TEST: REST notification received e2SubsId=%v", e2SubsId) |
| 4582 | |
| 4583 | return restSubId, e2SubsId |
| 4584 | } |
| 4585 | |
| 4586 | func deleteSubscription(t *testing.T, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId *string) { |
| 4587 | fromXappConn.SendRESTSubsDelReq(t, restSubId) |
| 4588 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 4589 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 4590 | } |
| 4591 | |
| 4592 | func deleteXapp1Subscription(t *testing.T, restSubId *string) { |
| 4593 | xappConn1.SendRESTSubsDelReq(t, restSubId) |
| 4594 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4595 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4596 | } |
| 4597 | |
| 4598 | func deleteXapp2Subscription(t *testing.T, restSubId *string) { |
| 4599 | xappConn2.SendRESTSubsDelReq(t, restSubId) |
| 4600 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 4601 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 4602 | } |
| 4603 | |
| 4604 | func queryXappSubscription(t *testing.T, e2SubsId int64, meid string, endpoint []string) { |
| 4605 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 4606 | assert.Equal(t, resp[0].SubscriptionID, e2SubsId) |
| 4607 | assert.Equal(t, resp[0].Meid, meid) |
| 4608 | assert.Equal(t, resp[0].ClientEndpoint, endpoint) |
| 4609 | } |
| 4610 | |
| 4611 | func waitSubsCleanup(t *testing.T, e2SubsId uint32, timeout int) { |
| 4612 | //Wait that subs is cleaned |
| 4613 | mainCtrl.wait_subs_clean(t, e2SubsId, timeout) |
| 4614 | |
| 4615 | xappConn1.TestMsgChanEmpty(t) |
| 4616 | xappConn2.TestMsgChanEmpty(t) |
| 4617 | e2termConn1.TestMsgChanEmpty(t) |
| 4618 | mainCtrl.wait_registry_empty(t, timeout) |
| 4619 | } |
| 4620 | |
| 4621 | func sendAndReceiveMultipleE2SubReqs(t *testing.T, count int, fromXappConn *teststube2ap.E2Stub, toE2termConn *teststube2ap.E2Stub, restSubId string) []uint32 { |
| 4622 | |
| 4623 | var e2SubsId []uint32 |
| 4624 | |
| 4625 | for i := 0; i < count; i++ { |
| 4626 | xapp.Logger.Info("TEST: %d ===================================== BEGIN CRE ============================================", i+1) |
| 4627 | crereq, cremsg := toE2termConn.RecvSubsReq(t) |
| 4628 | fromXappConn.ExpectRESTNotification(t, restSubId) |
| 4629 | toE2termConn.SendSubsResp(t, crereq, cremsg) |
| 4630 | instanceId := fromXappConn.WaitRESTNotification(t, restSubId) |
| 4631 | e2SubsId = append(e2SubsId, instanceId) |
| 4632 | xapp.Logger.Info("TEST: %v", e2SubsId) |
| 4633 | xapp.Logger.Info("TEST: %d ===================================== END CRE ============================================", i+1) |
| 4634 | <-time.After(100 * time.Millisecond) |
| 4635 | } |
| 4636 | return e2SubsId |
| 4637 | } |
| 4638 | |
| 4639 | func sendAndReceiveMultipleE2DelReqs(t *testing.T, e2SubsIds []uint32, toE2termConn *teststube2ap.E2Stub) { |
| 4640 | |
| 4641 | for i := 0; i < len(e2SubsIds); i++ { |
| 4642 | xapp.Logger.Info("TEST: %d ===================================== BEGIN DEL ============================================", i+1) |
| 4643 | delreq, delmsg := toE2termConn.RecvSubsDelReq(t) |
| 4644 | toE2termConn.SendSubsDelResp(t, delreq, delmsg) |
| 4645 | <-time.After(1 * time.Second) |
| 4646 | xapp.Logger.Info("TEST: %d ===================================== END DEL ============================================", i+1) |
| 4647 | <-time.After(100 * time.Millisecond) |
| 4648 | } |
| 4649 | |
| 4650 | // Wait that subs is cleaned |
| 4651 | for i := 0; i < len(e2SubsIds); i++ { |
| 4652 | mainCtrl.wait_subs_clean(t, e2SubsIds[i], 10) |
| 4653 | } |
| 4654 | |
| 4655 | } |