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