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 | // | | | | |
| 108 | func TestSubReqAndRouteUpdateNok(t *testing.T) { |
| 109 | CaseBegin("TestSubReqAndRouteUpdateNok") |
| 110 | |
| 111 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 112 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 113 | Counter{cSubReqFromXapp, 2}, |
| 114 | Counter{cSubReqToE2, 1}, |
| 115 | Counter{cSubRespFromE2, 1}, |
| 116 | Counter{cSubRespToXapp, 1}, |
| 117 | Counter{cRouteCreateUpdateFail, 1}, |
| 118 | Counter{cSubDelReqFromXapp, 1}, |
| 119 | Counter{cSubDelReqToE2, 1}, |
| 120 | Counter{cSubDelRespFromE2, 1}, |
| 121 | Counter{cSubDelRespToXapp, 1}, |
| 122 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 123 | |
| 124 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 125 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 126 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 127 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 128 | |
| 129 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 130 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 131 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 132 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 133 | |
| 134 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 135 | newSubsId := mainCtrl.get_registry_next_subid(t) |
| 136 | xappConn2.SendSubsReq(t, nil, nil) |
| 137 | waiter.WaitResult(t) |
| 138 | |
| 139 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 140 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 141 | |
| 142 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 143 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 144 | |
| 145 | //Wait that subs is cleaned |
| 146 | mainCtrl.wait_subs_clean(t, newSubsId, 10) |
| 147 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 148 | |
| 149 | xappConn1.TestMsgChanEmpty(t) |
| 150 | xappConn2.TestMsgChanEmpty(t) |
| 151 | e2termConn1.TestMsgChanEmpty(t) |
| 152 | mainCtrl.wait_registry_empty(t, 10) |
| 153 | |
| 154 | mainCtrl.VerifyCounterValues(t) |
| 155 | } |
| 156 | |
| 157 | //----------------------------------------------------------------------------- |
| 158 | // TestSubDelReqAndRouteDeleteNok |
| 159 | // |
| 160 | // stub stub |
| 161 | // +-------+ +---------+ +---------+ +---------+ |
| 162 | // | xapp | | submgr | | e2term | | rtmgr | |
| 163 | // +-------+ +---------+ +---------+ +---------+ |
| 164 | // | | | | |
| 165 | // | [SUBS CREATE] | | |
| 166 | // | | | | |
| 167 | // | | | | |
| 168 | // | | | | |
| 169 | // | SubDelReq | | | |
| 170 | // |------------->| | | |
| 171 | // | | SubDelReq | | |
| 172 | // | |------------->| | |
| 173 | // | | SubDelRsp | | |
| 174 | // | |<-------------| | |
| 175 | // | SubDelRsp | | | |
| 176 | // |<-------------| | | |
| 177 | // | | RouteDelete | | |
| 178 | // | |---------------------------->| |
| 179 | // | | | | |
| 180 | // | | RouteDelete | | |
| 181 | // | | status:400 | | |
| 182 | // | |<----------------------------| |
| 183 | // | | | | |
| 184 | func TestSubDelReqAndRouteDeleteNok(t *testing.T) { |
| 185 | CaseBegin("TestSubDelReqAndRouteDeleteNok") |
| 186 | |
| 187 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 188 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 189 | Counter{cSubReqFromXapp, 1}, |
| 190 | Counter{cSubReqToE2, 1}, |
| 191 | Counter{cSubRespFromE2, 1}, |
| 192 | Counter{cSubRespToXapp, 1}, |
| 193 | Counter{cSubDelReqFromXapp, 1}, |
| 194 | Counter{cRouteDeleteFail, 1}, |
| 195 | Counter{cSubDelReqToE2, 1}, |
| 196 | Counter{cSubDelRespFromE2, 1}, |
| 197 | Counter{cSubDelRespToXapp, 1}, |
| 198 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 199 | |
| 200 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 201 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 202 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 203 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 204 | |
| 205 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 206 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 207 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 208 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 209 | |
| 210 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 211 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 212 | |
| 213 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 214 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 215 | waiter.WaitResult(t) |
| 216 | |
| 217 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 218 | |
| 219 | //Wait that subs is cleaned |
| 220 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 221 | |
| 222 | xappConn1.TestMsgChanEmpty(t) |
| 223 | xappConn2.TestMsgChanEmpty(t) |
| 224 | e2termConn1.TestMsgChanEmpty(t) |
| 225 | mainCtrl.wait_registry_empty(t, 10) |
| 226 | |
| 227 | mainCtrl.VerifyCounterValues(t) |
| 228 | } |
| 229 | |
| 230 | //----------------------------------------------------------------------------- |
| 231 | // TestSubMergeDelAndRouteUpdateNok |
| 232 | // stub stub |
| 233 | // +-------+ +-------+ +---------+ +---------+ |
| 234 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 235 | // +-------+ +-------+ +---------+ +---------+ |
| 236 | // | | | | |
| 237 | // | | | | |
| 238 | // | | | | |
| 239 | // | | SubReq1 | | |
| 240 | // | |------------->| | |
| 241 | // | | | | |
| 242 | // | | | SubReq1 | |
| 243 | // | | |------------->| |
| 244 | // | | | SubResp1 | |
| 245 | // | | |<-------------| |
| 246 | // | | SubResp1 | | |
| 247 | // | |<-------------| | |
| 248 | // | | | | |
| 249 | // | SubReq2 | | |
| 250 | // |--------------------------->| | |
| 251 | // | | | | |
| 252 | // | SubResp2 | | |
| 253 | // |<---------------------------| | |
| 254 | // | | | | |
| 255 | // | | SubDelReq 1 | | |
| 256 | // | |------------->| | |
| 257 | // | | | RouteUpdate | |
| 258 | // | | |-----> rtmgr | |
| 259 | // | | | | |
| 260 | // | | | RouteUpdate | |
| 261 | // | | | status:400 | |
| 262 | // | | |<----- rtmgr | |
| 263 | // | | | | |
| 264 | // | | SubDelResp 1 | | |
| 265 | // | |<-------------| | |
| 266 | // | | | | |
| 267 | // | SubDelReq 2 | | |
| 268 | // |--------------------------->| | |
| 269 | // | | | | |
| 270 | // | | | SubDelReq 2 | |
| 271 | // | | |------------->| |
| 272 | // | | | | |
| 273 | // | | | SubDelReq 2 | |
| 274 | // | | |------------->| |
| 275 | // | | | | |
| 276 | // | SubDelResp 2 | | |
| 277 | // |<---------------------------| | |
| 278 | // |
| 279 | //----------------------------------------------------------------------------- |
| 280 | func TestSubMergeDelAndRouteUpdateNok(t *testing.T) { |
| 281 | CaseBegin("TestSubMergeDelAndRouteUpdateNok") |
| 282 | |
| 283 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 284 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 285 | Counter{cSubReqFromXapp, 2}, |
| 286 | Counter{cSubReqToE2, 1}, |
| 287 | Counter{cSubRespFromE2, 1}, |
| 288 | Counter{cSubRespToXapp, 2}, |
| 289 | Counter{cSubDelReqFromXapp, 2}, |
| 290 | Counter{cRouteDeleteUpdateFail, 1}, |
| 291 | Counter{cSubDelReqToE2, 1}, |
| 292 | Counter{cSubDelRespFromE2, 1}, |
| 293 | Counter{cSubDelRespToXapp, 2}, |
| 294 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 295 | |
| 296 | //Req1 |
| 297 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 298 | rparams1.Init() |
| 299 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 300 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 301 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 302 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 303 | |
| 304 | //Req2 |
| 305 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 306 | rparams2.Init() |
| 307 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 308 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 309 | |
| 310 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 311 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 312 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 313 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 314 | |
| 315 | //Del1 |
| 316 | waiter := rtmgrHttp.AllocNextEvent(false) |
| 317 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 318 | waiter.WaitResult(t) |
| 319 | |
| 320 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 321 | |
| 322 | //Del2 |
| 323 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 324 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 325 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 326 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 327 | //Wait that subs is cleaned |
| 328 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 329 | |
| 330 | xappConn1.TestMsgChanEmpty(t) |
| 331 | xappConn2.TestMsgChanEmpty(t) |
| 332 | e2termConn1.TestMsgChanEmpty(t) |
| 333 | mainCtrl.wait_registry_empty(t, 10) |
| 334 | |
| 335 | mainCtrl.VerifyCounterValues(t) |
| 336 | } |
| 337 | |
| 338 | //----------------------------------------------------------------------------- |
| 339 | |
| 340 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 341 | // TestSubReqAndSubDelOk |
| 342 | // |
| 343 | // stub stub |
| 344 | // +-------+ +---------+ +---------+ |
| 345 | // | xapp | | submgr | | e2term | |
| 346 | // +-------+ +---------+ +---------+ |
| 347 | // | | | |
| 348 | // | SubReq | | |
| 349 | // |------------->| | |
| 350 | // | | | |
| 351 | // | | SubReq | |
| 352 | // | |------------->| |
| 353 | // | | | |
| 354 | // | | SubResp | |
| 355 | // | |<-------------| |
| 356 | // | | | |
| 357 | // | SubResp | | |
| 358 | // |<-------------| | |
| 359 | // | | | |
| 360 | // | | | |
| 361 | // | SubDelReq | | |
| 362 | // |------------->| | |
| 363 | // | | | |
| 364 | // | | SubDelReq | |
| 365 | // | |------------->| |
| 366 | // | | | |
| 367 | // | | SubDelResp | |
| 368 | // | |<-------------| |
| 369 | // | | | |
| 370 | // | SubDelResp | | |
| 371 | // |<-------------| | |
| 372 | // |
| 373 | //----------------------------------------------------------------------------- |
| 374 | func TestSubReqAndSubDelOk(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 375 | CaseBegin("TestSubReqAndSubDelOk") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 376 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 377 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 378 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 379 | Counter{cSubReqFromXapp, 1}, |
| 380 | Counter{cSubReqToE2, 1}, |
| 381 | Counter{cSubRespFromE2, 1}, |
| 382 | Counter{cSubRespToXapp, 1}, |
| 383 | Counter{cSubDelReqFromXapp, 1}, |
| 384 | Counter{cSubDelReqToE2, 1}, |
| 385 | Counter{cSubDelRespFromE2, 1}, |
| 386 | Counter{cSubDelRespToXapp, 1}, |
| 387 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 388 | |
| 389 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 390 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 391 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 392 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 393 | |
| 394 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 395 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 396 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 397 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 398 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 399 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 400 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 401 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 402 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 403 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 404 | |
| 405 | //Wait that subs is cleaned |
| 406 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 407 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 408 | xappConn1.TestMsgChanEmpty(t) |
| 409 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 410 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 411 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 412 | |
| 413 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | //----------------------------------------------------------------------------- |
| 417 | // TestSubReqRetransmission |
| 418 | // |
| 419 | // stub stub |
| 420 | // +-------+ +---------+ +---------+ |
| 421 | // | xapp | | submgr | | e2term | |
| 422 | // +-------+ +---------+ +---------+ |
| 423 | // | | | |
| 424 | // | SubReq | | |
| 425 | // |------------->| | |
| 426 | // | | | |
| 427 | // | | SubReq | |
| 428 | // | |------------->| |
| 429 | // | | | |
| 430 | // | SubReq | | |
| 431 | // | (retrans) | | |
| 432 | // |------------->| | |
| 433 | // | | | |
| 434 | // | | SubResp | |
| 435 | // | |<-------------| |
| 436 | // | | | |
| 437 | // | SubResp | | |
| 438 | // |<-------------| | |
| 439 | // | | | |
| 440 | // | [SUBS DELETE] | |
| 441 | // | | | |
| 442 | // |
| 443 | //----------------------------------------------------------------------------- |
| 444 | func TestSubReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 445 | CaseBegin("TestSubReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 446 | |
| 447 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 448 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 449 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 450 | |
| 451 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 452 | xappConn1.SendSubsReq(t, nil, cretrans) //Retransmitted SubReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 453 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 454 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 455 | // hack as there is no real way to see has message be handled. |
| 456 | // Previuos counter check just tells that is has been received by submgr |
| 457 | // --> artificial delay |
| 458 | <-time.After(1 * time.Second) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 459 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 460 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 461 | |
| 462 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 463 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 464 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 465 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 466 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 467 | |
| 468 | //Wait that subs is cleaned |
| 469 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 470 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 471 | xappConn1.TestMsgChanEmpty(t) |
| 472 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 473 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 474 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | //----------------------------------------------------------------------------- |
| 478 | // TestSubDelReqRetransmission |
| 479 | // |
| 480 | // stub stub |
| 481 | // +-------+ +---------+ +---------+ |
| 482 | // | xapp | | submgr | | e2term | |
| 483 | // +-------+ +---------+ +---------+ |
| 484 | // | | | |
| 485 | // | [SUBS CREATE] | |
| 486 | // | | | |
| 487 | // | | | |
| 488 | // | SubDelReq | | |
| 489 | // |------------->| | |
| 490 | // | | | |
| 491 | // | | SubDelReq | |
| 492 | // | |------------->| |
| 493 | // | | | |
| 494 | // | SubDelReq | | |
| 495 | // | (same sub) | | |
| 496 | // | (same xid) | | |
| 497 | // |------------->| | |
| 498 | // | | | |
| 499 | // | | SubDelResp | |
| 500 | // | |<-------------| |
| 501 | // | | | |
| 502 | // | SubDelResp | | |
| 503 | // |<-------------| | |
| 504 | // |
| 505 | //----------------------------------------------------------------------------- |
| 506 | func TestSubDelReqRetransmission(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 507 | CaseBegin("TestSubDelReqRetransmission") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 508 | |
| 509 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 510 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 511 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 512 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 513 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 514 | |
| 515 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 516 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 517 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 518 | |
| 519 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 520 | xappConn1.SendSubsDelReq(t, deltrans, e2SubsId) //Retransmitted SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 521 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 522 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 523 | // hack as there is no real way to see has message be handled. |
| 524 | // Previuos counter check just tells that is has been received by submgr |
| 525 | // --> artificial delay |
| 526 | <-time.After(1 * time.Second) |
| 527 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 528 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 529 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 530 | |
| 531 | //Wait that subs is cleaned |
| 532 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 533 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 534 | xappConn1.TestMsgChanEmpty(t) |
| 535 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 536 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 537 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 538 | } |
| 539 | |
| 540 | //----------------------------------------------------------------------------- |
| 541 | // TestSubDelReqCollision |
| 542 | // |
| 543 | // stub stub |
| 544 | // +-------+ +---------+ +---------+ |
| 545 | // | xapp | | submgr | | e2term | |
| 546 | // +-------+ +---------+ +---------+ |
| 547 | // | | | |
| 548 | // | [SUBS CREATE] | |
| 549 | // | | | |
| 550 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 551 | // | SubDelReq 1 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 552 | // |------------->| | |
| 553 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 554 | // | | SubDelReq 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 555 | // | |------------->| |
| 556 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 557 | // | SubDelReq 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 558 | // | (same sub) | | |
| 559 | // | (diff xid) | | |
| 560 | // |------------->| | |
| 561 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 562 | // | | SubDelResp 1 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 563 | // | |<-------------| |
| 564 | // | | | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 565 | // | SubDelResp 1 | | |
| 566 | // |<-------------| | |
| 567 | // | | | |
| 568 | // | SubDelResp 2 | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 569 | // |<-------------| | |
| 570 | // |
| 571 | //----------------------------------------------------------------------------- |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 572 | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 573 | func TestSubDelReqCollision(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 574 | CaseBegin("TestSubDelReqCollision") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 575 | |
| 576 | //Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 577 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 578 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 579 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 580 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 581 | |
| 582 | //Subs Delete |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 583 | xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 584 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 585 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 586 | // Subs Delete colliding |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 587 | seqBef := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 588 | deltranscol2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 589 | xappConn1.SendSubsDelReq(t, deltranscol2, e2SubsId) //Colliding SubDelReq |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 590 | mainCtrl.wait_msgcounter_change(t, seqBef, 10) |
| 591 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 592 | // hack as there is no real way to see has message be handled. |
| 593 | // Previuos counter check just tells that is has been received by submgr |
| 594 | // --> artificial delay |
| 595 | <-time.After(1 * time.Second) |
| 596 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 597 | // Del resp for first and second |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 598 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 599 | |
| 600 | // don't care in which order responses are received |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 601 | xappConn1.RecvSubsDelResp(t, nil) |
| 602 | xappConn1.RecvSubsDelResp(t, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 603 | |
| 604 | //Wait that subs is cleaned |
| 605 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 606 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 607 | xappConn1.TestMsgChanEmpty(t) |
| 608 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 609 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 610 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | //----------------------------------------------------------------------------- |
| 614 | // TestSubReqAndSubDelOkTwoParallel |
| 615 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 616 | // stub stub stub |
| 617 | // +-------+ +-------+ +---------+ +---------+ |
| 618 | // | xapp | | xapp | | submgr | | e2term | |
| 619 | // +-------+ +-------+ +---------+ +---------+ |
| 620 | // | | | | |
| 621 | // | | | | |
| 622 | // | | | | |
| 623 | // | | SubReq1 | | |
| 624 | // | |------------->| | |
| 625 | // | | | | |
| 626 | // | | | SubReq1 | |
| 627 | // | | |------------->| |
| 628 | // | | | | |
| 629 | // | SubReq2 | | |
| 630 | // |------------------------>| | |
| 631 | // | | | | |
| 632 | // | | | SubReq2 | |
| 633 | // | | |------------->| |
| 634 | // | | | | |
| 635 | // | | | SubResp1 | |
| 636 | // | | |<-------------| |
| 637 | // | | SubResp1 | | |
| 638 | // | |<-------------| | |
| 639 | // | | | | |
| 640 | // | | | SubResp2 | |
| 641 | // | | |<-------------| |
| 642 | // | SubResp2 | | |
| 643 | // |<------------------------| | |
| 644 | // | | | | |
| 645 | // | | [SUBS 1 DELETE] | |
| 646 | // | | | | |
| 647 | // | | [SUBS 2 DELETE] | |
| 648 | // | | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 649 | // |
| 650 | //----------------------------------------------------------------------------- |
| 651 | func TestSubReqAndSubDelOkTwoParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 652 | CaseBegin("TestSubReqAndSubDelOkTwoParallel") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 653 | |
| 654 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 655 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 656 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 657 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 658 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 659 | |
| 660 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 661 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 662 | rparams2.Init() |
Juha Hyttinen | cdc35bf | 2020-07-11 13:32:57 +0300 | [diff] [blame] | 663 | |
| 664 | rparams2.Req.EventTriggerDefinition.Data.Length = 1 |
| 665 | rparams2.Req.EventTriggerDefinition.Data.Data = make([]uint8, rparams2.Req.EventTriggerDefinition.Data.Length) |
| 666 | rparams2.Req.EventTriggerDefinition.Data.Data[0] = 2 |
| 667 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 668 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 669 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 670 | |
| 671 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 672 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 673 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 674 | |
| 675 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 676 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 677 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 678 | |
| 679 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 680 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 681 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 682 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 683 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 684 | //Wait that subs is cleaned |
| 685 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 686 | |
| 687 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 688 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 689 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 690 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 691 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 692 | //Wait that subs is cleaned |
| 693 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 694 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 695 | xappConn1.TestMsgChanEmpty(t) |
| 696 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 697 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 698 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | //----------------------------------------------------------------------------- |
| 702 | // TestSameSubsDiffRan |
| 703 | // Same subscription to different RANs |
| 704 | // |
| 705 | // stub stub |
| 706 | // +-------+ +---------+ +---------+ |
| 707 | // | xapp | | submgr | | e2term | |
| 708 | // +-------+ +---------+ +---------+ |
| 709 | // | | | |
| 710 | // | | | |
| 711 | // | | | |
| 712 | // | SubReq(r1) | | |
| 713 | // |------------->| | |
| 714 | // | | | |
| 715 | // | | SubReq(r1) | |
| 716 | // | |------------->| |
| 717 | // | | | |
| 718 | // | | SubResp(r1) | |
| 719 | // | |<-------------| |
| 720 | // | | | |
| 721 | // | SubResp(r1) | | |
| 722 | // |<-------------| | |
| 723 | // | | | |
| 724 | // | SubReq(r2) | | |
| 725 | // |------------->| | |
| 726 | // | | | |
| 727 | // | | SubReq(r2) | |
| 728 | // | |------------->| |
| 729 | // | | | |
| 730 | // | | SubResp(r2) | |
| 731 | // | |<-------------| |
| 732 | // | | | |
| 733 | // | SubResp(r2) | | |
| 734 | // |<-------------| | |
| 735 | // | | | |
| 736 | // | [SUBS r1 DELETE] | |
| 737 | // | | | |
| 738 | // | [SUBS r2 DELETE] | |
| 739 | // | | | |
| 740 | // |
| 741 | //----------------------------------------------------------------------------- |
| 742 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 743 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 744 | |
| 745 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 746 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 747 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 748 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 749 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 750 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 751 | |
| 752 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 753 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 754 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 755 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 756 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 757 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 758 | |
| 759 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 760 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 761 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 762 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 763 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 764 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 765 | //Wait that subs is cleaned |
| 766 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 767 | |
| 768 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 769 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 770 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 771 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 772 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 773 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 774 | //Wait that subs is cleaned |
| 775 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 776 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 777 | xappConn1.TestMsgChanEmpty(t) |
| 778 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 779 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 780 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 781 | } |
| 782 | |
| 783 | //----------------------------------------------------------------------------- |
| 784 | // TestSubReqRetryInSubmgr |
| 785 | // |
| 786 | // stub stub |
| 787 | // +-------+ +---------+ +---------+ |
| 788 | // | xapp | | submgr | | e2term | |
| 789 | // +-------+ +---------+ +---------+ |
| 790 | // | | | |
| 791 | // | SubReq | | |
| 792 | // |------------->| | |
| 793 | // | | | |
| 794 | // | | SubReq | |
| 795 | // | |------------->| |
| 796 | // | | | |
| 797 | // | | | |
| 798 | // | | SubReq | |
| 799 | // | |------------->| |
| 800 | // | | | |
| 801 | // | | SubResp | |
| 802 | // | |<-------------| |
| 803 | // | | | |
| 804 | // | SubResp | | |
| 805 | // |<-------------| | |
| 806 | // | | | |
| 807 | // | [SUBS DELETE] | |
| 808 | // | | | |
| 809 | // |
| 810 | //----------------------------------------------------------------------------- |
| 811 | |
| 812 | func TestSubReqRetryInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 813 | CaseBegin("TestSubReqRetryInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 814 | |
| 815 | // Init counter check |
| 816 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 817 | Counter{cSubReqFromXapp, 1}, |
| 818 | Counter{cSubReqToE2, 1}, |
| 819 | Counter{cSubReReqToE2, 1}, |
| 820 | Counter{cSubRespFromE2, 1}, |
| 821 | Counter{cSubRespToXapp, 1}, |
| 822 | Counter{cSubDelReqFromXapp, 1}, |
| 823 | Counter{cSubDelReqToE2, 1}, |
| 824 | Counter{cSubDelRespFromE2, 1}, |
| 825 | Counter{cSubDelRespToXapp, 1}, |
| 826 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 827 | |
| 828 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 829 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 830 | |
| 831 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 832 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 833 | |
| 834 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 835 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 836 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 837 | |
| 838 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 839 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 840 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 841 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 842 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 843 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 844 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 845 | |
| 846 | // Wait that subs is cleaned |
| 847 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 848 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 849 | xappConn1.TestMsgChanEmpty(t) |
| 850 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 851 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 852 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 853 | |
| 854 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 855 | } |
| 856 | |
| 857 | //----------------------------------------------------------------------------- |
| 858 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 859 | // |
| 860 | // stub stub |
| 861 | // +-------+ +---------+ +---------+ |
| 862 | // | xapp | | submgr | | e2term | |
| 863 | // +-------+ +---------+ +---------+ |
| 864 | // | | | |
| 865 | // | SubReq | | |
| 866 | // |------------->| | |
| 867 | // | | | |
| 868 | // | | SubReq | |
| 869 | // | |------------->| |
| 870 | // | | | |
| 871 | // | | | |
| 872 | // | | SubReq | |
| 873 | // | |------------->| |
| 874 | // | | | |
| 875 | // | | SubDelReq | |
| 876 | // | |------------->| |
| 877 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 878 | // | | SubDelResp | |
| 879 | // | |<-------------| |
| 880 | // | | | |
| 881 | // |
| 882 | //----------------------------------------------------------------------------- |
| 883 | |
| 884 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 885 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 886 | |
| 887 | // Init counter check |
| 888 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 889 | Counter{cSubReqFromXapp, 1}, |
| 890 | Counter{cSubReqToE2, 1}, |
| 891 | Counter{cSubReReqToE2, 1}, |
| 892 | Counter{cSubReqTimerExpiry, 2}, |
| 893 | Counter{cSubDelReqToE2, 1}, |
| 894 | Counter{cSubDelRespFromE2, 1}, |
| 895 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 896 | |
| 897 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 898 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 899 | |
| 900 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 901 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 902 | |
| 903 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 904 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 905 | |
| 906 | // E2t: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 907 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 908 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 909 | |
| 910 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 911 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 912 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 913 | xappConn1.TestMsgChanEmpty(t) |
| 914 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 915 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 916 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 917 | |
| 918 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 919 | } |
| 920 | |
| 921 | //----------------------------------------------------------------------------- |
| 922 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 923 | // |
| 924 | // stub stub |
| 925 | // +-------+ +---------+ +---------+ |
| 926 | // | xapp | | submgr | | e2term | |
| 927 | // +-------+ +---------+ +---------+ |
| 928 | // | | | |
| 929 | // | SubReq | | |
| 930 | // |------------->| | |
| 931 | // | | | |
| 932 | // | | SubReq | |
| 933 | // | |------------->| |
| 934 | // | | | |
| 935 | // | | | |
| 936 | // | | SubReq | |
| 937 | // | |------------->| |
| 938 | // | | | |
| 939 | // | | SubDelReq | |
| 940 | // | |------------->| |
| 941 | // | | | |
| 942 | // | | | |
| 943 | // | | SubDelReq | |
| 944 | // | |------------->| |
| 945 | // | | | |
| 946 | // | | | |
| 947 | // |
| 948 | //----------------------------------------------------------------------------- |
| 949 | |
| 950 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 951 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 952 | |
| 953 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 954 | Counter{cSubReqFromXapp, 1}, |
| 955 | Counter{cSubReqToE2, 1}, |
| 956 | Counter{cSubReReqToE2, 1}, |
| 957 | Counter{cSubReqTimerExpiry, 2}, |
| 958 | Counter{cSubDelReqToE2, 1}, |
| 959 | Counter{cSubDelReReqToE2, 1}, |
| 960 | Counter{cSubDelReqTimerExpiry, 2}, |
| 961 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 962 | |
| 963 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 964 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 965 | |
| 966 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 967 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 968 | |
| 969 | // E2t: Receive 2nd SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 970 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 971 | |
| 972 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 973 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 974 | |
| 975 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 976 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 977 | |
| 978 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 979 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 980 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 981 | xappConn1.TestMsgChanEmpty(t) |
| 982 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 983 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 984 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 985 | |
| 986 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 987 | } |
| 988 | |
| 989 | //----------------------------------------------------------------------------- |
| 990 | // TestSubReqSubFailRespInSubmgr |
| 991 | // |
| 992 | // stub stub |
| 993 | // +-------+ +---------+ +---------+ |
| 994 | // | xapp | | submgr | | e2term | |
| 995 | // +-------+ +---------+ +---------+ |
| 996 | // | | | |
| 997 | // | SubReq | | |
| 998 | // |------------->| | |
| 999 | // | | | |
| 1000 | // | | SubReq | |
| 1001 | // | |------------->| |
| 1002 | // | | | |
| 1003 | // | | SubFail | |
| 1004 | // | |<-------------| |
| 1005 | // | | | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1006 | // | | SubDelReq | |
| 1007 | // | |------------->| |
| 1008 | // | | | |
| 1009 | // | | SubDelResp | |
| 1010 | // | |<-------------| |
| 1011 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1012 | // | SubFail | | |
| 1013 | // |<-------------| | |
| 1014 | // | | | |
| 1015 | // |
| 1016 | //----------------------------------------------------------------------------- |
| 1017 | |
| 1018 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1019 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 1020 | |
| 1021 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1022 | Counter{cSubReqFromXapp, 1}, |
| 1023 | Counter{cSubReqToE2, 1}, |
| 1024 | Counter{cSubFailFromE2, 1}, |
| 1025 | Counter{cSubDelReqToE2, 1}, |
| 1026 | Counter{cSubDelRespFromE2, 1}, |
| 1027 | Counter{cSubFailToXapp, 1}, |
| 1028 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1029 | |
| 1030 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1031 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1032 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1033 | // E2t: Receive SubsReq and send SubsFail (first) |
| 1034 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1035 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1036 | fparams1.Set(crereq1) |
| 1037 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1038 | |
| 1039 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 1040 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1041 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1042 | |
| 1043 | // Xapp: Receive SubsFail |
| 1044 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 1045 | |
| 1046 | // Wait that subs is cleaned |
| 1047 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1048 | |
| 1049 | xappConn1.TestMsgChanEmpty(t) |
| 1050 | xappConn2.TestMsgChanEmpty(t) |
| 1051 | e2termConn1.TestMsgChanEmpty(t) |
| 1052 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1053 | |
| 1054 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1055 | } |
| 1056 | |
| 1057 | //----------------------------------------------------------------------------- |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1058 | // TestSubDelReqRetryInSubmgr |
| 1059 | // |
| 1060 | // stub stub |
| 1061 | // +-------+ +---------+ +---------+ |
| 1062 | // | xapp | | submgr | | e2term | |
| 1063 | // +-------+ +---------+ +---------+ |
| 1064 | // | | | |
| 1065 | // | [SUBS CREATE] | |
| 1066 | // | | | |
| 1067 | // | | | |
| 1068 | // | SubDelReq | | |
| 1069 | // |------------->| | |
| 1070 | // | | | |
| 1071 | // | | SubDelReq | |
| 1072 | // | |------------->| |
| 1073 | // | | | |
| 1074 | // | | SubDelReq | |
| 1075 | // | |------------->| |
| 1076 | // | | | |
| 1077 | // | | SubDelResp | |
| 1078 | // | |<-------------| |
| 1079 | // | | | |
| 1080 | // | SubDelResp | | |
| 1081 | // |<-------------| | |
| 1082 | // |
| 1083 | //----------------------------------------------------------------------------- |
| 1084 | |
| 1085 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 1086 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1087 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1088 | |
| 1089 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1090 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1091 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1092 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1093 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1094 | |
| 1095 | // Subs Delete |
| 1096 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1097 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1098 | |
| 1099 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1100 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1101 | |
| 1102 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1103 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1104 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1105 | |
| 1106 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1107 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1108 | |
| 1109 | // Wait that subs is cleaned |
| 1110 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1111 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1112 | xappConn1.TestMsgChanEmpty(t) |
| 1113 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1114 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1115 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1116 | } |
| 1117 | |
| 1118 | //----------------------------------------------------------------------------- |
| 1119 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 1120 | // |
| 1121 | // stub stub |
| 1122 | // +-------+ +---------+ +---------+ |
| 1123 | // | xapp | | submgr | | e2term | |
| 1124 | // +-------+ +---------+ +---------+ |
| 1125 | // | | | |
| 1126 | // | [SUBS CREATE] | |
| 1127 | // | | | |
| 1128 | // | | | |
| 1129 | // | SubDelReq | | |
| 1130 | // |------------->| | |
| 1131 | // | | | |
| 1132 | // | | SubDelReq | |
| 1133 | // | |------------->| |
| 1134 | // | | | |
| 1135 | // | | SubDelReq | |
| 1136 | // | |------------->| |
| 1137 | // | | | |
| 1138 | // | | | |
| 1139 | // | SubDelResp | | |
| 1140 | // |<-------------| | |
| 1141 | // |
| 1142 | //----------------------------------------------------------------------------- |
| 1143 | |
| 1144 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 1145 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1146 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1147 | |
| 1148 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1150 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1151 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1152 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1153 | |
| 1154 | // Subs Delete |
| 1155 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1156 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1157 | |
| 1158 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1159 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1160 | |
| 1161 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1162 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1163 | |
| 1164 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1165 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1166 | |
| 1167 | // Wait that subs is cleaned |
| 1168 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1169 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1170 | xappConn1.TestMsgChanEmpty(t) |
| 1171 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1172 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1173 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1174 | } |
| 1175 | |
| 1176 | //----------------------------------------------------------------------------- |
| 1177 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1178 | // |
| 1179 | // stub stub |
| 1180 | // +-------+ +---------+ +---------+ |
| 1181 | // | xapp | | submgr | | e2term | |
| 1182 | // +-------+ +---------+ +---------+ |
| 1183 | // | | | |
| 1184 | // | [SUBS CREATE] | |
| 1185 | // | | | |
| 1186 | // | | | |
| 1187 | // | SubDelReq | | |
| 1188 | // |------------->| | |
| 1189 | // | | | |
| 1190 | // | | SubDelReq | |
| 1191 | // | |------------->| |
| 1192 | // | | | |
| 1193 | // | | SubDelFail | |
| 1194 | // | |<-------------| |
| 1195 | // | | | |
| 1196 | // | SubDelResp | | |
| 1197 | // |<-------------| | |
| 1198 | // | | | |
| 1199 | // |
| 1200 | //----------------------------------------------------------------------------- |
| 1201 | |
| 1202 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1203 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 1204 | |
| 1205 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1206 | Counter{cSubReqFromXapp, 1}, |
| 1207 | Counter{cSubReqToE2, 1}, |
| 1208 | Counter{cSubRespFromE2, 1}, |
| 1209 | Counter{cSubRespToXapp, 1}, |
| 1210 | Counter{cSubDelReqFromXapp, 1}, |
| 1211 | Counter{cSubDelReqToE2, 1}, |
| 1212 | Counter{cSubDelFailFromE2, 1}, |
| 1213 | Counter{cSubDelRespToXapp, 1}, |
| 1214 | }) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1215 | |
| 1216 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1218 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1219 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1220 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1221 | |
| 1222 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1223 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1224 | |
| 1225 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1226 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1227 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1228 | |
| 1229 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1230 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1231 | |
| 1232 | // Wait that subs is cleaned |
| 1233 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1234 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1235 | xappConn1.TestMsgChanEmpty(t) |
| 1236 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1237 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1238 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1239 | |
| 1240 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1241 | } |
| 1242 | |
| 1243 | //----------------------------------------------------------------------------- |
| 1244 | // TestSubReqAndSubDelOkSameAction |
| 1245 | // |
| 1246 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1247 | // +-------+ +-------+ +---------+ +---------+ |
| 1248 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1249 | // +-------+ +-------+ +---------+ +---------+ |
| 1250 | // | | | | |
| 1251 | // | | | | |
| 1252 | // | | | | |
| 1253 | // | | SubReq1 | | |
| 1254 | // | |------------->| | |
| 1255 | // | | | | |
| 1256 | // | | | SubReq1 | |
| 1257 | // | | |------------->| |
| 1258 | // | | | SubResp1 | |
| 1259 | // | | |<-------------| |
| 1260 | // | | SubResp1 | | |
| 1261 | // | |<-------------| | |
| 1262 | // | | | | |
| 1263 | // | SubReq2 | | |
| 1264 | // |--------------------------->| | |
| 1265 | // | | | | |
| 1266 | // | SubResp2 | | |
| 1267 | // |<---------------------------| | |
| 1268 | // | | | | |
| 1269 | // | | SubDelReq 1 | | |
| 1270 | // | |------------->| | |
| 1271 | // | | | | |
| 1272 | // | | SubDelResp 1 | | |
| 1273 | // | |<-------------| | |
| 1274 | // | | | | |
| 1275 | // | SubDelReq 2 | | |
| 1276 | // |--------------------------->| | |
| 1277 | // | | | | |
| 1278 | // | | | SubDelReq 2 | |
| 1279 | // | | |------------->| |
| 1280 | // | | | | |
| 1281 | // | | | SubDelReq 2 | |
| 1282 | // | | |------------->| |
| 1283 | // | | | | |
| 1284 | // | SubDelResp 2 | | |
| 1285 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1286 | // |
| 1287 | //----------------------------------------------------------------------------- |
| 1288 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1289 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1290 | |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1291 | // Init counter check |
Anssi Mannila | 6b3796f | 2021-02-12 09:11:35 +0200 | [diff] [blame^] | 1292 | mainCtrl.CounterValuesToBeVeriefied(t, CountersToBeAdded{ |
| 1293 | Counter{cSubReqFromXapp, 2}, |
| 1294 | Counter{cSubReqToE2, 1}, |
| 1295 | Counter{cSubRespFromE2, 1}, |
| 1296 | Counter{cSubRespToXapp, 2}, |
| 1297 | Counter{cMergedSubscriptions, 1}, |
| 1298 | Counter{cUnmergedSubscriptions, 1}, |
| 1299 | Counter{cSubDelReqFromXapp, 2}, |
| 1300 | Counter{cSubDelReqToE2, 1}, |
| 1301 | Counter{cSubDelRespFromE2, 1}, |
| 1302 | Counter{cSubDelRespToXapp, 2}, |
| 1303 | }) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1304 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1305 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1306 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1307 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1308 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1309 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1310 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1311 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1312 | |
| 1313 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1314 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1315 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1316 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1317 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1318 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1319 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1320 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1321 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1322 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1323 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 1324 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 1325 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1326 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1327 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1328 | //e2termConn1.RecvSubsDelReq(t) |
| 1329 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1330 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1331 | //Wait that subs is cleaned |
| 1332 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1333 | |
| 1334 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1335 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1336 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1337 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1338 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1339 | //Wait that subs is cleaned |
| 1340 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1341 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1342 | xappConn1.TestMsgChanEmpty(t) |
| 1343 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1344 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1345 | mainCtrl.wait_registry_empty(t, 10) |
Anssi Mannila | 4abf180 | 2021-01-28 13:06:46 +0200 | [diff] [blame] | 1346 | |
| 1347 | mainCtrl.VerifyCounterValues(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1348 | } |
| 1349 | |
| 1350 | //----------------------------------------------------------------------------- |
| 1351 | // TestSubReqAndSubDelOkSameActionParallel |
| 1352 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1353 | // stub stub stub |
| 1354 | // +-------+ +-------+ +---------+ +---------+ |
| 1355 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1356 | // +-------+ +-------+ +---------+ +---------+ |
| 1357 | // | | | | |
| 1358 | // | | | | |
| 1359 | // | | | | |
| 1360 | // | | SubReq1 | | |
| 1361 | // | |------------->| | |
| 1362 | // | | | | |
| 1363 | // | | | SubReq1 | |
| 1364 | // | | |------------->| |
| 1365 | // | SubReq2 | | |
| 1366 | // |--------------------------->| | |
| 1367 | // | | | SubResp1 | |
| 1368 | // | | |<-------------| |
| 1369 | // | | SubResp1 | | |
| 1370 | // | |<-------------| | |
| 1371 | // | | | | |
| 1372 | // | SubResp2 | | |
| 1373 | // |<---------------------------| | |
| 1374 | // | | | | |
| 1375 | // | | SubDelReq 1 | | |
| 1376 | // | |------------->| | |
| 1377 | // | | | | |
| 1378 | // | | SubDelResp 1 | | |
| 1379 | // | |<-------------| | |
| 1380 | // | | | | |
| 1381 | // | SubDelReq 2 | | |
| 1382 | // |--------------------------->| | |
| 1383 | // | | | | |
| 1384 | // | | | SubDelReq 2 | |
| 1385 | // | | |------------->| |
| 1386 | // | | | | |
| 1387 | // | | | SubDelReq 2 | |
| 1388 | // | | |------------->| |
| 1389 | // | | | | |
| 1390 | // | SubDelResp 2 | | |
| 1391 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1392 | // |
| 1393 | //----------------------------------------------------------------------------- |
| 1394 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1395 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1396 | |
| 1397 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1398 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1399 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1400 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1401 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1402 | |
| 1403 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1404 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1405 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1406 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1407 | |
| 1408 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1409 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1410 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1411 | |
| 1412 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1413 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1414 | |
| 1415 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1416 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1417 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1418 | |
| 1419 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1420 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1421 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1422 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1423 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1424 | |
| 1425 | //Wait that subs is cleaned |
| 1426 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1427 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1428 | xappConn1.TestMsgChanEmpty(t) |
| 1429 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1430 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1431 | mainCtrl.wait_registry_empty(t, 10) |
| 1432 | } |
| 1433 | |
| 1434 | //----------------------------------------------------------------------------- |
| 1435 | // TestSubReqAndSubDelNokSameActionParallel |
| 1436 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1437 | // stub stub stub |
| 1438 | // +-------+ +-------+ +---------+ +---------+ |
| 1439 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1440 | // +-------+ +-------+ +---------+ +---------+ |
| 1441 | // | | | | |
| 1442 | // | | | | |
| 1443 | // | | | | |
| 1444 | // | | SubReq1 | | |
| 1445 | // | |------------->| | |
| 1446 | // | | | | |
| 1447 | // | | | SubReq1 | |
| 1448 | // | | |------------->| |
| 1449 | // | SubReq2 | | |
| 1450 | // |--------------------------->| | |
| 1451 | // | | | SubFail1 | |
| 1452 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1453 | // | | | | |
| 1454 | // | | | SubDelReq | |
| 1455 | // | | |------------->| |
| 1456 | // | | | SubDelResp | |
| 1457 | // | | |<-------------| |
| 1458 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1459 | // | | SubFail1 | | |
| 1460 | // | |<-------------| | |
| 1461 | // | | | | |
| 1462 | // | SubFail2 | | |
| 1463 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1464 | // |
| 1465 | //----------------------------------------------------------------------------- |
| 1466 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1467 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1468 | |
| 1469 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1470 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1471 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1472 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1473 | |
| 1474 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1475 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1476 | |
| 1477 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1478 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1479 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1480 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1481 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1482 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1483 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1484 | // E2t: send SubsFail (first) |
| 1485 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1486 | fparams1.Set(crereq1) |
| 1487 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1488 | |
| 1489 | // E2t: internal delete |
| 1490 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1491 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1492 | |
| 1493 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1494 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1495 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1496 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1497 | |
| 1498 | //Wait that subs is cleaned |
| 1499 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1500 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1501 | xappConn1.TestMsgChanEmpty(t) |
| 1502 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1503 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1504 | mainCtrl.wait_registry_empty(t, 10) |
| 1505 | } |
| 1506 | |
| 1507 | //----------------------------------------------------------------------------- |
| 1508 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1509 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1510 | // stub stub stub |
| 1511 | // +-------+ +-------+ +---------+ +---------+ |
| 1512 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1513 | // +-------+ +-------+ +---------+ +---------+ |
| 1514 | // | | | | |
| 1515 | // | | | | |
| 1516 | // | | | | |
| 1517 | // | | SubReq1 | | |
| 1518 | // | |------------->| | |
| 1519 | // | | | | |
| 1520 | // | | | SubReq1 | |
| 1521 | // | | |------------->| |
| 1522 | // | | SubReq2 | | |
| 1523 | // |--------------------------->| | |
| 1524 | // | | | | |
| 1525 | // | | | SubReq1 | |
| 1526 | // | | |------------->| |
| 1527 | // | | | | |
| 1528 | // | | | | |
| 1529 | // | | | SubDelReq | |
| 1530 | // | | |------------->| |
| 1531 | // | | | | |
| 1532 | // | | | SubDelResp | |
| 1533 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1534 | // |
| 1535 | //----------------------------------------------------------------------------- |
| 1536 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1537 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1538 | |
| 1539 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1540 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1541 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1542 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1543 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1544 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1545 | |
| 1546 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1547 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1548 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1549 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1550 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1551 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1552 | |
| 1553 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1554 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1555 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1556 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1557 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1558 | |
| 1559 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1560 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1561 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1562 | xappConn1.TestMsgChanEmpty(t) |
| 1563 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1564 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1565 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1566 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1567 | |
| 1568 | //----------------------------- Policy cases --------------------------------- |
| 1569 | //----------------------------------------------------------------------------- |
| 1570 | // TestSubReqPolicyAndSubDelOk |
| 1571 | // |
| 1572 | // stub stub |
| 1573 | // +-------+ +---------+ +---------+ |
| 1574 | // | xapp | | submgr | | e2term | |
| 1575 | // +-------+ +---------+ +---------+ |
| 1576 | // | | | |
| 1577 | // | SubReq | | |
| 1578 | // |------------->| | |
| 1579 | // | | | |
| 1580 | // | | SubReq | |
| 1581 | // | |------------->| |
| 1582 | // | | | |
| 1583 | // | | SubResp | |
| 1584 | // | |<-------------| |
| 1585 | // | | | |
| 1586 | // | SubResp | | |
| 1587 | // |<-------------| | |
| 1588 | // | | | |
| 1589 | // | | | |
| 1590 | // | SubDelReq | | |
| 1591 | // |------------->| | |
| 1592 | // | | | |
| 1593 | // | | SubDelReq | |
| 1594 | // | |------------->| |
| 1595 | // | | | |
| 1596 | // | | SubDelResp | |
| 1597 | // | |<-------------| |
| 1598 | // | | | |
| 1599 | // | SubDelResp | | |
| 1600 | // |<-------------| | |
| 1601 | // |
| 1602 | //----------------------------------------------------------------------------- |
| 1603 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1604 | CaseBegin("TestSubReqAndSubDelOk") |
| 1605 | |
| 1606 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1607 | rparams1.Init() |
| 1608 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1609 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1610 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1611 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1612 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1613 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1614 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1615 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1616 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1617 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1618 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1619 | |
| 1620 | //Wait that subs is cleaned |
| 1621 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1622 | |
| 1623 | xappConn1.TestMsgChanEmpty(t) |
| 1624 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1625 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1626 | mainCtrl.wait_registry_empty(t, 10) |
| 1627 | } |
| 1628 | |
| 1629 | //----------------------------------------------------------------------------- |
| 1630 | // TestSubReqPolicyChangeAndSubDelOk |
| 1631 | // |
| 1632 | // stub stub |
| 1633 | // +-------+ +---------+ +---------+ |
| 1634 | // | xapp | | submgr | | e2term | |
| 1635 | // +-------+ +---------+ +---------+ |
| 1636 | // | | | |
| 1637 | // | SubReq | | |
| 1638 | // |------------->| | |
| 1639 | // | | | |
| 1640 | // | | SubReq | |
| 1641 | // | |------------->| |
| 1642 | // | | | |
| 1643 | // | | SubResp | |
| 1644 | // | |<-------------| |
| 1645 | // | | | |
| 1646 | // | SubResp | | |
| 1647 | // |<-------------| | |
| 1648 | // | | | |
| 1649 | // | SubReq | | |
| 1650 | // |------------->| | |
| 1651 | // | | | |
| 1652 | // | | SubReq | |
| 1653 | // | |------------->| |
| 1654 | // | | | |
| 1655 | // | | SubResp | |
| 1656 | // | |<-------------| |
| 1657 | // | | | |
| 1658 | // | SubResp | | |
| 1659 | // |<-------------| | |
| 1660 | // | | | |
| 1661 | // | SubDelReq | | |
| 1662 | // |------------->| | |
| 1663 | // | | | |
| 1664 | // | | SubDelReq | |
| 1665 | // | |------------->| |
| 1666 | // | | | |
| 1667 | // | | SubDelResp | |
| 1668 | // | |<-------------| |
| 1669 | // | | | |
| 1670 | // | SubDelResp | | |
| 1671 | // |<-------------| | |
| 1672 | // |
| 1673 | //----------------------------------------------------------------------------- |
| 1674 | |
| 1675 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1676 | CaseBegin("TestSubReqAndSubDelOk") |
| 1677 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1678 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1679 | rparams1.Init() |
| 1680 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1681 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1682 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1683 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1684 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1685 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1686 | |
| 1687 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1688 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1689 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1690 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1691 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1692 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1693 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1694 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1695 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1696 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1697 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1698 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1699 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1700 | |
| 1701 | //Wait that subs is cleaned |
| 1702 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1703 | |
| 1704 | xappConn1.TestMsgChanEmpty(t) |
| 1705 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1706 | e2termConn1.TestMsgChanEmpty(t) |
| 1707 | mainCtrl.wait_registry_empty(t, 10) |
| 1708 | } |
| 1709 | |
| 1710 | //----------------------------------------------------------------------------- |
| 1711 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1712 | // |
| 1713 | // stub stub stub |
| 1714 | // +-------+ +---------+ +---------+ +---------+ |
| 1715 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1716 | // +-------+ +---------+ +---------+ +---------+ |
| 1717 | // | | | | |
| 1718 | // | | | | |
| 1719 | // | | | | |
| 1720 | // | SubReq1 | | | |
| 1721 | // |------------->| | | |
| 1722 | // | | | | |
| 1723 | // | | SubReq1 | | |
| 1724 | // | |------------->| | |
| 1725 | // | | | | |
| 1726 | // | SubReq2 | | | |
| 1727 | // |------------->| | | |
| 1728 | // | | | | |
| 1729 | // | | SubReq2 | | |
| 1730 | // | |---------------------------->| |
| 1731 | // | | | | |
| 1732 | // | | SubResp1 | | |
| 1733 | // | |<-------------| | |
| 1734 | // | SubResp1 | | | |
| 1735 | // |<-------------| | | |
| 1736 | // | | SubResp2 | | |
| 1737 | // | |<----------------------------| |
| 1738 | // | SubResp2 | | | |
| 1739 | // |<-------------| | | |
| 1740 | // | | | | |
| 1741 | // | [SUBS 1 DELETE] | | |
| 1742 | // | | | | |
| 1743 | // | [SUBS 2 DELETE] | | |
| 1744 | // | | | | |
| 1745 | // |
| 1746 | //----------------------------------------------------------------------------- |
| 1747 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1748 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1749 | |
| 1750 | //Req1 |
| 1751 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1752 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1753 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1754 | |
| 1755 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1756 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1757 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1758 | |
| 1759 | //Resp1 |
| 1760 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1761 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1762 | |
| 1763 | //Resp2 |
| 1764 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1765 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1766 | |
| 1767 | //Del1 |
| 1768 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1769 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1770 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1771 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1772 | //Wait that subs is cleaned |
| 1773 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1774 | |
| 1775 | //Del2 |
| 1776 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1777 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1778 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1779 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1780 | //Wait that subs is cleaned |
| 1781 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1782 | |
| 1783 | xappConn1.TestMsgChanEmpty(t) |
| 1784 | xappConn2.TestMsgChanEmpty(t) |
| 1785 | e2termConn1.TestMsgChanEmpty(t) |
| 1786 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1787 | mainCtrl.wait_registry_empty(t, 10) |
| 1788 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1789 | |
| 1790 | //----------------------------------------------------------------------------- |
| 1791 | // TestSubReqInsertAndSubDelOk |
| 1792 | // |
| 1793 | // stub stub |
| 1794 | // +-------+ +---------+ +---------+ |
| 1795 | // | xapp | | submgr | | e2term | |
| 1796 | // +-------+ +---------+ +---------+ |
| 1797 | // | | | |
| 1798 | // | SubReq | | |
| 1799 | // |------------->| | |
| 1800 | // | | | |
| 1801 | // | | SubReq | |
| 1802 | // | |------------->| |
| 1803 | // | | | |
| 1804 | // | | SubResp | |
| 1805 | // | |<-------------| |
| 1806 | // | | | |
| 1807 | // | SubResp | | |
| 1808 | // |<-------------| | |
| 1809 | // | | | |
| 1810 | // | | | |
| 1811 | // | SubDelReq | | |
| 1812 | // |------------->| | |
| 1813 | // | | | |
| 1814 | // | | SubDelReq | |
| 1815 | // | |------------->| |
| 1816 | // | | | |
| 1817 | // | | SubDelResp | |
| 1818 | // | |<-------------| |
| 1819 | // | | | |
| 1820 | // | SubDelResp | | |
| 1821 | // |<-------------| | |
| 1822 | // |
| 1823 | //----------------------------------------------------------------------------- |
| 1824 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1825 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1826 | |
| 1827 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1828 | rparams1.Init() |
| 1829 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 1830 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1831 | |
| 1832 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1833 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1834 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1835 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1836 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1837 | |
| 1838 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1839 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1840 | |
| 1841 | //Wait that subs is cleaned |
| 1842 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1843 | |
| 1844 | xappConn1.TestMsgChanEmpty(t) |
| 1845 | xappConn2.TestMsgChanEmpty(t) |
| 1846 | e2termConn1.TestMsgChanEmpty(t) |
| 1847 | mainCtrl.wait_registry_empty(t, 10) |
| 1848 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame] | 1849 | |
| 1850 | //----------------------------------------------------------------------------- |
| 1851 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 1852 | // |
| 1853 | // This case simulates case where xApp restarts and starts sending same |
| 1854 | // subscription requests which have already subscribed successfully |
| 1855 | |
| 1856 | // stub stub |
| 1857 | // +-------+ +---------+ +---------+ |
| 1858 | // | xapp | | submgr | | e2term | |
| 1859 | // +-------+ +---------+ +---------+ |
| 1860 | // | | | |
| 1861 | // | SubReq | | |
| 1862 | // |------------->| | |
| 1863 | // | | | |
| 1864 | // | | SubReq | |
| 1865 | // | |------------->| |
| 1866 | // | | | |
| 1867 | // | | SubResp | |
| 1868 | // | |<-------------| |
| 1869 | // | | | |
| 1870 | // | SubResp | | |
| 1871 | // |<-------------| | |
| 1872 | // | | | |
| 1873 | // | xApp restart | | |
| 1874 | // | | | |
| 1875 | // | SubReq | | |
| 1876 | // | (retrans with same xApp generated subid but diff xid) |
| 1877 | // |------------->| | |
| 1878 | // | | | |
| 1879 | // | SubResp | | |
| 1880 | // |<-------------| | |
| 1881 | // | | | |
| 1882 | // | [SUBS DELETE] | |
| 1883 | // | | | |
| 1884 | // |
| 1885 | //----------------------------------------------------------------------------- |
| 1886 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 1887 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 1888 | |
| 1889 | //Subs Create |
| 1890 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 1891 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1892 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1893 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1894 | |
| 1895 | // xApp restart here |
| 1896 | // --> artificial delay |
| 1897 | <-time.After(1 * time.Second) |
| 1898 | |
| 1899 | //Subs Create |
| 1900 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 1901 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1902 | |
| 1903 | //Subs Delete |
| 1904 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1905 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1906 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1907 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1908 | |
| 1909 | //Wait that subs is cleaned |
| 1910 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1911 | |
| 1912 | xappConn1.TestMsgChanEmpty(t) |
| 1913 | xappConn2.TestMsgChanEmpty(t) |
| 1914 | e2termConn1.TestMsgChanEmpty(t) |
| 1915 | mainCtrl.wait_registry_empty(t, 10) |
| 1916 | } |
Anssi Mannila | c92b421 | 2020-12-07 14:59:34 +0200 | [diff] [blame] | 1917 | |
| 1918 | //----------------------------------------------------------------------------- |
| 1919 | // TestSubReqNokAndSubDelOkWithRestartInMiddle |
| 1920 | // |
| 1921 | // stub stub |
| 1922 | // +-------+ +---------+ +---------+ |
| 1923 | // | xapp | | submgr | | e2term | |
| 1924 | // +-------+ +---------+ +---------+ |
| 1925 | // | | | |
| 1926 | // | SubReq | | |
| 1927 | // |------------->| | |
| 1928 | // | | | |
| 1929 | // | | SubReq | |
| 1930 | // | |------------->| |
| 1931 | // | | | |
| 1932 | // | | SubResp | |
| 1933 | // | <----| |
| 1934 | // | | |
| 1935 | // | Submgr restart | |
| 1936 | // | | |
| 1937 | // | | | |
| 1938 | // | | SubDelReq | |
| 1939 | // | |------------->| |
| 1940 | // | | | |
| 1941 | // | | SubDelResp | |
| 1942 | // | |<-------------| |
| 1943 | // | | | |
| 1944 | // |
| 1945 | //----------------------------------------------------------------------------- |
| 1946 | |
| 1947 | func TestSubReqNokAndSubDelOkWithRestartInMiddle(t *testing.T) { |
| 1948 | CaseBegin("TestSubReqNokAndSubDelOkWithRestartInMiddle") |
| 1949 | |
| 1950 | // Remove possible existing subscrition |
| 1951 | mainCtrl.removeExistingSubscriptions(t) |
| 1952 | |
| 1953 | mainCtrl.SetResetTestFlag(t, true) // subs.DoNotWaitSubResp will be set TRUE for the subscription |
| 1954 | xappConn1.SendSubsReq(t, nil, nil) |
| 1955 | e2termConn1.RecvSubsReq(t) |
| 1956 | mainCtrl.SetResetTestFlag(t, false) |
| 1957 | |
| 1958 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1959 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 1960 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 1961 | e2SubsId := uint32(resp[0].SubscriptionID) |
| 1962 | t.Logf("e2SubsId = %v", e2SubsId) |
| 1963 | |
| 1964 | mainCtrl.SimulateRestart(t) // This will trigger sending of SubDelReq |
| 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") |
| 2027 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 2028 | |
| 2029 | mainCtrl.SimulateRestart(t) |
| 2030 | |
| 2031 | // Check that subscription is restored correctly after restart |
| 2032 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2033 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId)) |
| 2034 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 2035 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560"}) |
| 2036 | |
| 2037 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 2038 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 2039 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 2040 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 2041 | |
| 2042 | //Wait that subs is cleaned |
| 2043 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 2044 | |
| 2045 | xappConn1.TestMsgChanEmpty(t) |
| 2046 | xappConn2.TestMsgChanEmpty(t) |
| 2047 | e2termConn1.TestMsgChanEmpty(t) |
| 2048 | mainCtrl.wait_registry_empty(t, 10) |
| 2049 | } |
| 2050 | |
| 2051 | //----------------------------------------------------------------------------- |
| 2052 | // TestSubReqAndSubDelOkSameActionWithRestartsInMiddle |
| 2053 | // |
| 2054 | // stub stub |
| 2055 | // +-------+ +-------+ +---------+ +---------+ |
| 2056 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 2057 | // +-------+ +-------+ +---------+ +---------+ |
| 2058 | // | | | | |
| 2059 | // | | | | |
| 2060 | // | | | | |
| 2061 | // | | SubReq1 | | |
| 2062 | // | |------------->| | |
| 2063 | // | | | | |
| 2064 | // | | | SubReq1 | |
| 2065 | // | | |------------->| |
| 2066 | // | | | SubResp1 | |
| 2067 | // | | |<-------------| |
| 2068 | // | | SubResp1 | | |
| 2069 | // | |<-------------| | |
| 2070 | // | | | | |
| 2071 | // | | |
| 2072 | // | submgr restart | |
| 2073 | // | | |
| 2074 | // | | | | |
| 2075 | // | | | | |
| 2076 | // | SubReq2 | | |
| 2077 | // |--------------------------->| | |
| 2078 | // | | | | |
| 2079 | // | SubResp2 | | |
| 2080 | // |<---------------------------| | |
| 2081 | // | | | | |
| 2082 | // | | SubDelReq 1 | | |
| 2083 | // | |------------->| | |
| 2084 | // | | | | |
| 2085 | // | | SubDelResp 1 | | |
| 2086 | // | |<-------------| | |
| 2087 | // | | | | |
| 2088 | // | | | | |
| 2089 | // | | |
| 2090 | // | submgr restart | |
| 2091 | // | | |
| 2092 | // | | | | |
| 2093 | // | SubDelReq 2 | | |
| 2094 | // |--------------------------->| | |
| 2095 | // | | | | |
| 2096 | // | | | SubDelReq 2 | |
| 2097 | // | | |------------->| |
| 2098 | // | | | | |
| 2099 | // | | | SubDelReq 2 | |
| 2100 | // | | |------------->| |
| 2101 | // | | | | |
| 2102 | // | SubDelResp 2 | | |
| 2103 | // |<---------------------------| | |
| 2104 | // |
| 2105 | //----------------------------------------------------------------------------- |
| 2106 | |
| 2107 | func TestSubReqAndSubDelOkSameActionWithRestartsInMiddle(t *testing.T) { |
| 2108 | CaseBegin("TestSubReqAndSubDelOkSameActionWithRestartsInMiddle") |
| 2109 | |
| 2110 | //Req1 |
| 2111 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 2112 | rparams1.Init() |
| 2113 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
| 2114 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 2115 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 2116 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 2117 | |
| 2118 | //Req2 |
| 2119 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
| 2120 | rparams2.Init() |
| 2121 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
| 2122 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
| 2123 | |
| 2124 | // Check subscription |
| 2125 | resp, _ := xapp.Subscription.QuerySubscriptions() //////////////////////////////// |
| 2126 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2127 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 2128 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 2129 | |
| 2130 | mainCtrl.SimulateRestart(t) |
| 2131 | |
| 2132 | // Check that subscription is restored correctly after restart |
| 2133 | resp, _ = xapp.Subscription.QuerySubscriptions() |
| 2134 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 2135 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 2136 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 2137 | |
| 2138 | //Del1 |
| 2139 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 2140 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp") |
| 2141 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 2142 | xapp.Logger.Debug("xappConn1.RecvSubsDelResp received") |
| 2143 | |
| 2144 | mainCtrl.SimulateRestart(t) |
| 2145 | xapp.Logger.Debug("mainCtrl.SimulateRestart done") |
| 2146 | |
| 2147 | //Del2 |
| 2148 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
| 2149 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 2150 | |
| 2151 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 2152 | xappConn2.RecvSubsDelResp(t, deltrans2) |
| 2153 | |
| 2154 | //Wait that subs is cleaned |
| 2155 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 2156 | |
| 2157 | xappConn1.TestMsgChanEmpty(t) |
| 2158 | xappConn2.TestMsgChanEmpty(t) |
| 2159 | e2termConn1.TestMsgChanEmpty(t) |
| 2160 | mainCtrl.wait_registry_empty(t, 10) |
| 2161 | } |