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