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