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 | rparams1.Req.EventTriggerDefinition.ProcedureCode = 5 |
| 376 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 377 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 378 | |
| 379 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 380 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 381 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 382 | rparams2.Req.EventTriggerDefinition.ProcedureCode = 28 |
| 383 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 384 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 385 | |
| 386 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 387 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 388 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 389 | |
| 390 | //Resp2 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 391 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 392 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 393 | |
| 394 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 395 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 396 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 397 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 398 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 399 | //Wait that subs is cleaned |
| 400 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 401 | |
| 402 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 403 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 404 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 405 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 406 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 407 | //Wait that subs is cleaned |
| 408 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 409 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 410 | xappConn1.TestMsgChanEmpty(t) |
| 411 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 412 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 413 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 414 | } |
| 415 | |
| 416 | //----------------------------------------------------------------------------- |
| 417 | // TestSameSubsDiffRan |
| 418 | // Same subscription to different RANs |
| 419 | // |
| 420 | // stub stub |
| 421 | // +-------+ +---------+ +---------+ |
| 422 | // | xapp | | submgr | | e2term | |
| 423 | // +-------+ +---------+ +---------+ |
| 424 | // | | | |
| 425 | // | | | |
| 426 | // | | | |
| 427 | // | SubReq(r1) | | |
| 428 | // |------------->| | |
| 429 | // | | | |
| 430 | // | | SubReq(r1) | |
| 431 | // | |------------->| |
| 432 | // | | | |
| 433 | // | | SubResp(r1) | |
| 434 | // | |<-------------| |
| 435 | // | | | |
| 436 | // | SubResp(r1) | | |
| 437 | // |<-------------| | |
| 438 | // | | | |
| 439 | // | SubReq(r2) | | |
| 440 | // |------------->| | |
| 441 | // | | | |
| 442 | // | | SubReq(r2) | |
| 443 | // | |------------->| |
| 444 | // | | | |
| 445 | // | | SubResp(r2) | |
| 446 | // | |<-------------| |
| 447 | // | | | |
| 448 | // | SubResp(r2) | | |
| 449 | // |<-------------| | |
| 450 | // | | | |
| 451 | // | [SUBS r1 DELETE] | |
| 452 | // | | | |
| 453 | // | [SUBS r2 DELETE] | |
| 454 | // | | | |
| 455 | // |
| 456 | //----------------------------------------------------------------------------- |
| 457 | func TestSameSubsDiffRan(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 458 | CaseBegin("TestSameSubsDiffRan") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 459 | |
| 460 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 461 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 462 | xappConn1.SendSubsReq(t, nil, cretrans1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 463 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 464 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 465 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 466 | |
| 467 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 468 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 469 | xappConn1.SendSubsReq(t, nil, cretrans2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 470 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 471 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 472 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 473 | |
| 474 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 475 | deltrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 476 | xappConn1.SendSubsDelReq(t, deltrans1, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 477 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 478 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 479 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 480 | //Wait that subs is cleaned |
| 481 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 482 | |
| 483 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 484 | deltrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_2") |
| 485 | xappConn1.SendSubsDelReq(t, deltrans2, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 486 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 487 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 488 | xappConn1.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 489 | //Wait that subs is cleaned |
| 490 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 491 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 492 | xappConn1.TestMsgChanEmpty(t) |
| 493 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 494 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 495 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | //----------------------------------------------------------------------------- |
| 499 | // TestSubReqRetryInSubmgr |
| 500 | // |
| 501 | // stub stub |
| 502 | // +-------+ +---------+ +---------+ |
| 503 | // | xapp | | submgr | | e2term | |
| 504 | // +-------+ +---------+ +---------+ |
| 505 | // | | | |
| 506 | // | SubReq | | |
| 507 | // |------------->| | |
| 508 | // | | | |
| 509 | // | | SubReq | |
| 510 | // | |------------->| |
| 511 | // | | | |
| 512 | // | | | |
| 513 | // | | SubReq | |
| 514 | // | |------------->| |
| 515 | // | | | |
| 516 | // | | SubResp | |
| 517 | // | |<-------------| |
| 518 | // | | | |
| 519 | // | SubResp | | |
| 520 | // |<-------------| | |
| 521 | // | | | |
| 522 | // | [SUBS DELETE] | |
| 523 | // | | | |
| 524 | // |
| 525 | //----------------------------------------------------------------------------- |
| 526 | |
| 527 | func TestSubReqRetryInSubmgr(t *testing.T) { |
| 528 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 529 | CaseBegin("TestSubReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 530 | |
| 531 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 532 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 533 | |
| 534 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 535 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 536 | |
| 537 | // E2t: Receive 2nd SubsReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 538 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 539 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 540 | |
| 541 | // Xapp: Receive SubsResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 542 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 543 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 544 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 545 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 546 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 547 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 548 | |
| 549 | // Wait that subs is cleaned |
| 550 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 551 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 552 | xappConn1.TestMsgChanEmpty(t) |
| 553 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 554 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 555 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | //----------------------------------------------------------------------------- |
| 559 | // TestSubReqTwoRetriesNoRespSubDelRespInSubmgr |
| 560 | // |
| 561 | // stub stub |
| 562 | // +-------+ +---------+ +---------+ |
| 563 | // | xapp | | submgr | | e2term | |
| 564 | // +-------+ +---------+ +---------+ |
| 565 | // | | | |
| 566 | // | SubReq | | |
| 567 | // |------------->| | |
| 568 | // | | | |
| 569 | // | | SubReq | |
| 570 | // | |------------->| |
| 571 | // | | | |
| 572 | // | | | |
| 573 | // | | SubReq | |
| 574 | // | |------------->| |
| 575 | // | | | |
| 576 | // | | SubDelReq | |
| 577 | // | |------------->| |
| 578 | // | | | |
| 579 | // | | | |
| 580 | // | | SubDelReq | |
| 581 | // | |------------->| |
| 582 | // | | | |
| 583 | // | | | |
| 584 | // | | SubDelResp | |
| 585 | // | |<-------------| |
| 586 | // | | | |
| 587 | // |
| 588 | //----------------------------------------------------------------------------- |
| 589 | |
| 590 | func TestSubReqRetryNoRespSubDelRespInSubmgr(t *testing.T) { |
| 591 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 592 | CaseBegin("TestSubReqTwoRetriesNoRespSubDelRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 593 | |
| 594 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 595 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 596 | |
| 597 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 598 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 599 | |
| 600 | // E2t: Receive 2nd 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: Send receive SubsDelReq and send SubsResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 604 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 605 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 606 | |
| 607 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 608 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 609 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 610 | xappConn1.TestMsgChanEmpty(t) |
| 611 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 612 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 613 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 614 | } |
| 615 | |
| 616 | //----------------------------------------------------------------------------- |
| 617 | // TestSubReqTwoRetriesNoRespAtAllInSubmgr |
| 618 | // |
| 619 | // stub stub |
| 620 | // +-------+ +---------+ +---------+ |
| 621 | // | xapp | | submgr | | e2term | |
| 622 | // +-------+ +---------+ +---------+ |
| 623 | // | | | |
| 624 | // | SubReq | | |
| 625 | // |------------->| | |
| 626 | // | | | |
| 627 | // | | SubReq | |
| 628 | // | |------------->| |
| 629 | // | | | |
| 630 | // | | | |
| 631 | // | | SubReq | |
| 632 | // | |------------->| |
| 633 | // | | | |
| 634 | // | | SubDelReq | |
| 635 | // | |------------->| |
| 636 | // | | | |
| 637 | // | | | |
| 638 | // | | SubDelReq | |
| 639 | // | |------------->| |
| 640 | // | | | |
| 641 | // | | | |
| 642 | // |
| 643 | //----------------------------------------------------------------------------- |
| 644 | |
| 645 | func TestSubReqTwoRetriesNoRespAtAllInSubmgr(t *testing.T) { |
| 646 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 647 | CaseBegin("TestSubReqTwoRetriesNoRespAtAllInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 648 | |
| 649 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 650 | xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 651 | |
| 652 | // E2t: Receive 1st SubsReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 653 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 654 | |
| 655 | // E2t: Receive 2nd 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 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 659 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 660 | |
| 661 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 662 | delreq, _ := e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 663 | |
| 664 | // Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 665 | mainCtrl.wait_subs_clean(t, delreq.RequestId.InstanceId, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 666 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 667 | xappConn1.TestMsgChanEmpty(t) |
| 668 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 669 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 670 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 671 | } |
| 672 | |
| 673 | //----------------------------------------------------------------------------- |
| 674 | // TestSubReqSubFailRespInSubmgr |
| 675 | // |
| 676 | // stub stub |
| 677 | // +-------+ +---------+ +---------+ |
| 678 | // | xapp | | submgr | | e2term | |
| 679 | // +-------+ +---------+ +---------+ |
| 680 | // | | | |
| 681 | // | SubReq | | |
| 682 | // |------------->| | |
| 683 | // | | | |
| 684 | // | | SubReq | |
| 685 | // | |------------->| |
| 686 | // | | | |
| 687 | // | | SubFail | |
| 688 | // | |<-------------| |
| 689 | // | | | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 690 | // | | SubDelReq | |
| 691 | // | |------------->| |
| 692 | // | | | |
| 693 | // | | SubDelResp | |
| 694 | // | |<-------------| |
| 695 | // | | | |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 696 | // | SubFail | | |
| 697 | // |<-------------| | |
| 698 | // | | | |
| 699 | // |
| 700 | //----------------------------------------------------------------------------- |
| 701 | |
| 702 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
| 703 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 704 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 705 | |
| 706 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 707 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 708 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 709 | // E2t: Receive SubsReq and send SubsFail (first) |
| 710 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 711 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 712 | fparams1.Set(crereq1) |
| 713 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 714 | |
| 715 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 716 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 717 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 718 | |
| 719 | // Xapp: Receive SubsFail |
| 720 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
| 721 | |
| 722 | // Wait that subs is cleaned |
| 723 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 724 | |
| 725 | xappConn1.TestMsgChanEmpty(t) |
| 726 | xappConn2.TestMsgChanEmpty(t) |
| 727 | e2termConn1.TestMsgChanEmpty(t) |
| 728 | mainCtrl.wait_registry_empty(t, 10) |
| 729 | } |
| 730 | |
| 731 | //----------------------------------------------------------------------------- |
| 732 | // TestSubReqSubFailRespInSubmgrWithDuplicate |
| 733 | // |
| 734 | // stub stub |
| 735 | // +-------+ +---------+ +---------+ |
| 736 | // | xapp | | submgr | | e2term | |
| 737 | // +-------+ +---------+ +---------+ |
| 738 | // | | | |
| 739 | // | SubReq | | |
| 740 | // |------------->| | |
| 741 | // | | | |
| 742 | // | | SubReq | |
| 743 | // | |------------->| |
| 744 | // | | | |
| 745 | // | | SubFail | |
| 746 | // | |<-------------| |
| 747 | // | | | |
| 748 | // | | SubDelReq | |
| 749 | // | |------------->| |
| 750 | // | | | |
| 751 | // | | SubDelResp | |
| 752 | // | |<-------------| |
| 753 | // | | | |
| 754 | // | | SubReq | |
| 755 | // | |------------->| |
| 756 | // | | | |
| 757 | // | | SubResp | |
| 758 | // | |<-------------| |
| 759 | // | | | |
| 760 | // | SubResp | | |
| 761 | // |<-------------| | |
| 762 | // | | | |
| 763 | // | [SUBS DELETE] | |
| 764 | // | | | |
| 765 | // |
| 766 | //----------------------------------------------------------------------------- |
| 767 | |
| 768 | func TestSubReqSubFailRespInSubmgrWithDuplicate(t *testing.T) { |
| 769 | |
| 770 | CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicate start") |
| 771 | |
| 772 | // Xapp: Send SubsReq |
| 773 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 774 | |
| 775 | // E2t: Receive SubsReq and send SubsFail (first) |
| 776 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 777 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 778 | fparams1.Set(crereq1) |
| 779 | fparams1.SetCauseVal(-1, 5, 3) |
| 780 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 781 | |
| 782 | // E2t: Receive SubsDelReq and send SubsDelResp (internal) |
| 783 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 784 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 785 | |
| 786 | // E2t: Receive SubsReq and send SubsResp (second) |
| 787 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 788 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 789 | |
| 790 | // XAPP: Receive SubsResp |
| 791 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 792 | |
| 793 | // Delete |
| 794 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 795 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 796 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 797 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 798 | |
| 799 | // Wait that subs is cleaned |
| 800 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 801 | |
| 802 | xappConn1.TestMsgChanEmpty(t) |
| 803 | xappConn2.TestMsgChanEmpty(t) |
| 804 | e2termConn1.TestMsgChanEmpty(t) |
| 805 | mainCtrl.wait_registry_empty(t, 10) |
| 806 | } |
| 807 | |
| 808 | //----------------------------------------------------------------------------- |
| 809 | // TestSubReqSubFailRespInSubmgrWithDuplicateFail |
| 810 | // |
| 811 | // stub stub |
| 812 | // +-------+ +---------+ +---------+ |
| 813 | // | xapp | | submgr | | e2term | |
| 814 | // +-------+ +---------+ +---------+ |
| 815 | // | | | |
| 816 | // | SubReq | | |
| 817 | // |------------->| | |
| 818 | // | | | |
| 819 | // | | SubReq | |
| 820 | // | |------------->| |
| 821 | // | | | |
| 822 | // | | SubFail | |
| 823 | // | |<-------------| |
| 824 | // | | | |
| 825 | // | | SubDelReq | |
| 826 | // | |------------->| |
| 827 | // | | | |
| 828 | // | | SubDelResp | |
| 829 | // | |<-------------| |
| 830 | // | | | |
| 831 | // | | SubReq | |
| 832 | // | |------------->| |
| 833 | // | | | |
| 834 | // | | SubFail | |
| 835 | // | |<-------------| |
| 836 | // | | | |
| 837 | // | | SubDelReq | |
| 838 | // | |------------->| |
| 839 | // | | | |
| 840 | // | | SubDelResp | |
| 841 | // | |<-------------| |
| 842 | // | SubFail | | |
| 843 | // |<-------------| | |
| 844 | // | | | |
| 845 | // |
| 846 | //----------------------------------------------------------------------------- |
| 847 | |
| 848 | func TestSubReqSubFailRespInSubmgrWithDuplicateFail(t *testing.T) { |
| 849 | |
| 850 | CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicateFail start") |
| 851 | |
| 852 | // Xapp: Send SubsReq |
| 853 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 854 | |
| 855 | // E2t: Receive SubsReq and send SubsFail (first) |
| 856 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 857 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 858 | fparams1.Set(crereq1) |
| 859 | fparams1.SetCauseVal(-1, 5, 3) |
| 860 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 861 | |
| 862 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 863 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 864 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 865 | |
| 866 | // E2t: Receive SubsReq and send SubsFail (second) |
| 867 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 868 | fparams2 := &teststube2ap.E2StubSubsFailParams{} |
| 869 | fparams2.Set(crereq2) |
| 870 | fparams2.SetCauseVal(-1, 5, 3) |
| 871 | e2termConn1.SendSubsFail(t, fparams2, cremsg2) |
| 872 | |
| 873 | // E2t: Receive SubsDelReq and send SubsDelResp (internal second) |
| 874 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 875 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 876 | |
| 877 | // Xapp: Receive SubsFail |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 878 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 879 | |
| 880 | // Wait that subs is cleaned |
| 881 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 882 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 883 | xappConn1.TestMsgChanEmpty(t) |
| 884 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 885 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 886 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 887 | } |
| 888 | |
| 889 | //----------------------------------------------------------------------------- |
| 890 | // TestSubDelReqRetryInSubmgr |
| 891 | // |
| 892 | // stub stub |
| 893 | // +-------+ +---------+ +---------+ |
| 894 | // | xapp | | submgr | | e2term | |
| 895 | // +-------+ +---------+ +---------+ |
| 896 | // | | | |
| 897 | // | [SUBS CREATE] | |
| 898 | // | | | |
| 899 | // | | | |
| 900 | // | SubDelReq | | |
| 901 | // |------------->| | |
| 902 | // | | | |
| 903 | // | | SubDelReq | |
| 904 | // | |------------->| |
| 905 | // | | | |
| 906 | // | | SubDelReq | |
| 907 | // | |------------->| |
| 908 | // | | | |
| 909 | // | | SubDelResp | |
| 910 | // | |<-------------| |
| 911 | // | | | |
| 912 | // | SubDelResp | | |
| 913 | // |<-------------| | |
| 914 | // |
| 915 | //----------------------------------------------------------------------------- |
| 916 | |
| 917 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 918 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 919 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 920 | |
| 921 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 922 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 923 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 924 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 925 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 926 | |
| 927 | // Subs Delete |
| 928 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 929 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 930 | |
| 931 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 932 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 933 | |
| 934 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 935 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 936 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 937 | |
| 938 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 939 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 940 | |
| 941 | // Wait that subs is cleaned |
| 942 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 943 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 944 | xappConn1.TestMsgChanEmpty(t) |
| 945 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 946 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 947 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 948 | } |
| 949 | |
| 950 | //----------------------------------------------------------------------------- |
| 951 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 952 | // |
| 953 | // stub stub |
| 954 | // +-------+ +---------+ +---------+ |
| 955 | // | xapp | | submgr | | e2term | |
| 956 | // +-------+ +---------+ +---------+ |
| 957 | // | | | |
| 958 | // | [SUBS CREATE] | |
| 959 | // | | | |
| 960 | // | | | |
| 961 | // | SubDelReq | | |
| 962 | // |------------->| | |
| 963 | // | | | |
| 964 | // | | SubDelReq | |
| 965 | // | |------------->| |
| 966 | // | | | |
| 967 | // | | SubDelReq | |
| 968 | // | |------------->| |
| 969 | // | | | |
| 970 | // | | | |
| 971 | // | SubDelResp | | |
| 972 | // |<-------------| | |
| 973 | // |
| 974 | //----------------------------------------------------------------------------- |
| 975 | |
| 976 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 977 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 978 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 979 | |
| 980 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 981 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 982 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 983 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 984 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 985 | |
| 986 | // Subs Delete |
| 987 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 988 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 989 | |
| 990 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 991 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 992 | |
| 993 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 994 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 995 | |
| 996 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 997 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 998 | |
| 999 | // Wait that subs is cleaned |
| 1000 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1001 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1002 | xappConn1.TestMsgChanEmpty(t) |
| 1003 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1004 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1005 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | //----------------------------------------------------------------------------- |
| 1009 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1010 | // |
| 1011 | // stub stub |
| 1012 | // +-------+ +---------+ +---------+ |
| 1013 | // | xapp | | submgr | | e2term | |
| 1014 | // +-------+ +---------+ +---------+ |
| 1015 | // | | | |
| 1016 | // | [SUBS CREATE] | |
| 1017 | // | | | |
| 1018 | // | | | |
| 1019 | // | SubDelReq | | |
| 1020 | // |------------->| | |
| 1021 | // | | | |
| 1022 | // | | SubDelReq | |
| 1023 | // | |------------->| |
| 1024 | // | | | |
| 1025 | // | | SubDelFail | |
| 1026 | // | |<-------------| |
| 1027 | // | | | |
| 1028 | // | SubDelResp | | |
| 1029 | // |<-------------| | |
| 1030 | // | | | |
| 1031 | // |
| 1032 | //----------------------------------------------------------------------------- |
| 1033 | |
| 1034 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 1035 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1036 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1037 | |
| 1038 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1039 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1040 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1041 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1042 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1043 | |
| 1044 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1045 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1046 | |
| 1047 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1048 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1049 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1050 | |
| 1051 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1052 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1053 | |
| 1054 | // Wait that subs is cleaned |
| 1055 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1056 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1057 | xappConn1.TestMsgChanEmpty(t) |
| 1058 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1059 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1060 | mainCtrl.wait_registry_empty(t, 10) |
| 1061 | } |
| 1062 | |
| 1063 | //----------------------------------------------------------------------------- |
| 1064 | // TestSubReqAndSubDelOkSameAction |
| 1065 | // |
| 1066 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1067 | // +-------+ +-------+ +---------+ +---------+ |
| 1068 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1069 | // +-------+ +-------+ +---------+ +---------+ |
| 1070 | // | | | | |
| 1071 | // | | | | |
| 1072 | // | | | | |
| 1073 | // | | SubReq1 | | |
| 1074 | // | |------------->| | |
| 1075 | // | | | | |
| 1076 | // | | | SubReq1 | |
| 1077 | // | | |------------->| |
| 1078 | // | | | SubResp1 | |
| 1079 | // | | |<-------------| |
| 1080 | // | | SubResp1 | | |
| 1081 | // | |<-------------| | |
| 1082 | // | | | | |
| 1083 | // | SubReq2 | | |
| 1084 | // |--------------------------->| | |
| 1085 | // | | | | |
| 1086 | // | SubResp2 | | |
| 1087 | // |<---------------------------| | |
| 1088 | // | | | | |
| 1089 | // | | SubDelReq 1 | | |
| 1090 | // | |------------->| | |
| 1091 | // | | | | |
| 1092 | // | | SubDelResp 1 | | |
| 1093 | // | |<-------------| | |
| 1094 | // | | | | |
| 1095 | // | SubDelReq 2 | | |
| 1096 | // |--------------------------->| | |
| 1097 | // | | | | |
| 1098 | // | | | SubDelReq 2 | |
| 1099 | // | | |------------->| |
| 1100 | // | | | | |
| 1101 | // | | | SubDelReq 2 | |
| 1102 | // | | |------------->| |
| 1103 | // | | | | |
| 1104 | // | SubDelResp 2 | | |
| 1105 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1106 | // |
| 1107 | //----------------------------------------------------------------------------- |
| 1108 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1109 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1110 | |
| 1111 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1112 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1113 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1114 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1115 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1116 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1117 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1118 | |
| 1119 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1120 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1121 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1122 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1123 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1124 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1125 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1126 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1127 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1128 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1129 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 1130 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 1131 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1132 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1133 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1134 | //e2termConn1.RecvSubsDelReq(t) |
| 1135 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1137 | //Wait that subs is cleaned |
| 1138 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1139 | |
| 1140 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1141 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1142 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1143 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1144 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1145 | //Wait that subs is cleaned |
| 1146 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1147 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1148 | xappConn1.TestMsgChanEmpty(t) |
| 1149 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1150 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1151 | mainCtrl.wait_registry_empty(t, 10) |
| 1152 | } |
| 1153 | |
| 1154 | //----------------------------------------------------------------------------- |
| 1155 | // TestSubReqAndSubDelOkSameActionParallel |
| 1156 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1157 | // stub stub stub |
| 1158 | // +-------+ +-------+ +---------+ +---------+ |
| 1159 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1160 | // +-------+ +-------+ +---------+ +---------+ |
| 1161 | // | | | | |
| 1162 | // | | | | |
| 1163 | // | | | | |
| 1164 | // | | SubReq1 | | |
| 1165 | // | |------------->| | |
| 1166 | // | | | | |
| 1167 | // | | | SubReq1 | |
| 1168 | // | | |------------->| |
| 1169 | // | SubReq2 | | |
| 1170 | // |--------------------------->| | |
| 1171 | // | | | SubResp1 | |
| 1172 | // | | |<-------------| |
| 1173 | // | | SubResp1 | | |
| 1174 | // | |<-------------| | |
| 1175 | // | | | | |
| 1176 | // | SubResp2 | | |
| 1177 | // |<---------------------------| | |
| 1178 | // | | | | |
| 1179 | // | | SubDelReq 1 | | |
| 1180 | // | |------------->| | |
| 1181 | // | | | | |
| 1182 | // | | SubDelResp 1 | | |
| 1183 | // | |<-------------| | |
| 1184 | // | | | | |
| 1185 | // | SubDelReq 2 | | |
| 1186 | // |--------------------------->| | |
| 1187 | // | | | | |
| 1188 | // | | | SubDelReq 2 | |
| 1189 | // | | |------------->| |
| 1190 | // | | | | |
| 1191 | // | | | SubDelReq 2 | |
| 1192 | // | | |------------->| |
| 1193 | // | | | | |
| 1194 | // | SubDelResp 2 | | |
| 1195 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1196 | // |
| 1197 | //----------------------------------------------------------------------------- |
| 1198 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1199 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1200 | |
| 1201 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1202 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1203 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1204 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1205 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1206 | |
| 1207 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1208 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1209 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1210 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1211 | |
| 1212 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1213 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1214 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1215 | |
| 1216 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1218 | |
| 1219 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1220 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1221 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1222 | |
| 1223 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1224 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1225 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1226 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1227 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1228 | |
| 1229 | //Wait that subs is cleaned |
| 1230 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1231 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1232 | xappConn1.TestMsgChanEmpty(t) |
| 1233 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1234 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1235 | mainCtrl.wait_registry_empty(t, 10) |
| 1236 | } |
| 1237 | |
| 1238 | //----------------------------------------------------------------------------- |
| 1239 | // TestSubReqAndSubDelNokSameActionParallel |
| 1240 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1241 | // stub stub stub |
| 1242 | // +-------+ +-------+ +---------+ +---------+ |
| 1243 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1244 | // +-------+ +-------+ +---------+ +---------+ |
| 1245 | // | | | | |
| 1246 | // | | | | |
| 1247 | // | | | | |
| 1248 | // | | SubReq1 | | |
| 1249 | // | |------------->| | |
| 1250 | // | | | | |
| 1251 | // | | | SubReq1 | |
| 1252 | // | | |------------->| |
| 1253 | // | SubReq2 | | |
| 1254 | // |--------------------------->| | |
| 1255 | // | | | SubFail1 | |
| 1256 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1257 | // | | | | |
| 1258 | // | | | SubDelReq | |
| 1259 | // | | |------------->| |
| 1260 | // | | | SubDelResp | |
| 1261 | // | | |<-------------| |
| 1262 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1263 | // | | SubFail1 | | |
| 1264 | // | |<-------------| | |
| 1265 | // | | | | |
| 1266 | // | SubFail2 | | |
| 1267 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1268 | // |
| 1269 | //----------------------------------------------------------------------------- |
| 1270 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1271 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1272 | |
| 1273 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1274 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1275 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1276 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1277 | |
| 1278 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1279 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1280 | |
| 1281 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1282 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1283 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame^] | 1284 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1285 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame^] | 1286 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1287 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1288 | // E2t: send SubsFail (first) |
| 1289 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1290 | fparams1.Set(crereq1) |
| 1291 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1292 | |
| 1293 | // E2t: internal delete |
| 1294 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1295 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1296 | |
| 1297 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1298 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1299 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1300 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1301 | |
| 1302 | //Wait that subs is cleaned |
| 1303 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1304 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1305 | xappConn1.TestMsgChanEmpty(t) |
| 1306 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1307 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1308 | mainCtrl.wait_registry_empty(t, 10) |
| 1309 | } |
| 1310 | |
| 1311 | //----------------------------------------------------------------------------- |
| 1312 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1313 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1314 | // stub stub stub |
| 1315 | // +-------+ +-------+ +---------+ +---------+ |
| 1316 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1317 | // +-------+ +-------+ +---------+ +---------+ |
| 1318 | // | | | | |
| 1319 | // | | | | |
| 1320 | // | | | | |
| 1321 | // | | SubReq1 | | |
| 1322 | // | |------------->| | |
| 1323 | // | | | | |
| 1324 | // | | | SubReq1 | |
| 1325 | // | | |------------->| |
| 1326 | // | | SubReq2 | | |
| 1327 | // |--------------------------->| | |
| 1328 | // | | | | |
| 1329 | // | | | SubReq1 | |
| 1330 | // | | |------------->| |
| 1331 | // | | | | |
| 1332 | // | | | | |
| 1333 | // | | | SubDelReq | |
| 1334 | // | | |------------->| |
| 1335 | // | | | | |
| 1336 | // | | | SubDelResp | |
| 1337 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1338 | // |
| 1339 | //----------------------------------------------------------------------------- |
| 1340 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1341 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1342 | |
| 1343 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1344 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1345 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1346 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1347 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame^] | 1348 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1349 | |
| 1350 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1351 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1352 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame^] | 1353 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1354 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame^] | 1355 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1356 | |
| 1357 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1358 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1359 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1360 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1361 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1362 | |
| 1363 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1364 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1365 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1366 | xappConn1.TestMsgChanEmpty(t) |
| 1367 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1368 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1369 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1370 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1371 | |
| 1372 | //----------------------------- Policy cases --------------------------------- |
| 1373 | //----------------------------------------------------------------------------- |
| 1374 | // TestSubReqPolicyAndSubDelOk |
| 1375 | // |
| 1376 | // stub stub |
| 1377 | // +-------+ +---------+ +---------+ |
| 1378 | // | xapp | | submgr | | e2term | |
| 1379 | // +-------+ +---------+ +---------+ |
| 1380 | // | | | |
| 1381 | // | SubReq | | |
| 1382 | // |------------->| | |
| 1383 | // | | | |
| 1384 | // | | SubReq | |
| 1385 | // | |------------->| |
| 1386 | // | | | |
| 1387 | // | | SubResp | |
| 1388 | // | |<-------------| |
| 1389 | // | | | |
| 1390 | // | SubResp | | |
| 1391 | // |<-------------| | |
| 1392 | // | | | |
| 1393 | // | | | |
| 1394 | // | SubDelReq | | |
| 1395 | // |------------->| | |
| 1396 | // | | | |
| 1397 | // | | SubDelReq | |
| 1398 | // | |------------->| |
| 1399 | // | | | |
| 1400 | // | | SubDelResp | |
| 1401 | // | |<-------------| |
| 1402 | // | | | |
| 1403 | // | SubDelResp | | |
| 1404 | // |<-------------| | |
| 1405 | // |
| 1406 | //----------------------------------------------------------------------------- |
| 1407 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1408 | CaseBegin("TestSubReqAndSubDelOk") |
| 1409 | |
| 1410 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1411 | rparams1.Init() |
| 1412 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1413 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1414 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1415 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1416 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1417 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1418 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1419 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1420 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1421 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1422 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1423 | |
| 1424 | //Wait that subs is cleaned |
| 1425 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1426 | |
| 1427 | xappConn1.TestMsgChanEmpty(t) |
| 1428 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1429 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1430 | mainCtrl.wait_registry_empty(t, 10) |
| 1431 | } |
| 1432 | |
| 1433 | //----------------------------------------------------------------------------- |
| 1434 | // TestSubReqPolicyChangeAndSubDelOk |
| 1435 | // |
| 1436 | // stub stub |
| 1437 | // +-------+ +---------+ +---------+ |
| 1438 | // | xapp | | submgr | | e2term | |
| 1439 | // +-------+ +---------+ +---------+ |
| 1440 | // | | | |
| 1441 | // | SubReq | | |
| 1442 | // |------------->| | |
| 1443 | // | | | |
| 1444 | // | | SubReq | |
| 1445 | // | |------------->| |
| 1446 | // | | | |
| 1447 | // | | SubResp | |
| 1448 | // | |<-------------| |
| 1449 | // | | | |
| 1450 | // | SubResp | | |
| 1451 | // |<-------------| | |
| 1452 | // | | | |
| 1453 | // | SubReq | | |
| 1454 | // |------------->| | |
| 1455 | // | | | |
| 1456 | // | | SubReq | |
| 1457 | // | |------------->| |
| 1458 | // | | | |
| 1459 | // | | SubResp | |
| 1460 | // | |<-------------| |
| 1461 | // | | | |
| 1462 | // | SubResp | | |
| 1463 | // |<-------------| | |
| 1464 | // | | | |
| 1465 | // | SubDelReq | | |
| 1466 | // |------------->| | |
| 1467 | // | | | |
| 1468 | // | | SubDelReq | |
| 1469 | // | |------------->| |
| 1470 | // | | | |
| 1471 | // | | SubDelResp | |
| 1472 | // | |<-------------| |
| 1473 | // | | | |
| 1474 | // | SubDelResp | | |
| 1475 | // |<-------------| | |
| 1476 | // |
| 1477 | //----------------------------------------------------------------------------- |
| 1478 | |
| 1479 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1480 | CaseBegin("TestSubReqAndSubDelOk") |
| 1481 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1482 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1483 | rparams1.Init() |
| 1484 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1485 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1486 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1487 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1488 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1489 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1490 | |
| 1491 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1492 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1493 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1494 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1495 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1496 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1497 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1498 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1499 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1500 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1501 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1502 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1503 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1504 | |
| 1505 | //Wait that subs is cleaned |
| 1506 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1507 | |
| 1508 | xappConn1.TestMsgChanEmpty(t) |
| 1509 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1510 | e2termConn1.TestMsgChanEmpty(t) |
| 1511 | mainCtrl.wait_registry_empty(t, 10) |
| 1512 | } |
| 1513 | |
| 1514 | //----------------------------------------------------------------------------- |
| 1515 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1516 | // |
| 1517 | // stub stub stub |
| 1518 | // +-------+ +---------+ +---------+ +---------+ |
| 1519 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1520 | // +-------+ +---------+ +---------+ +---------+ |
| 1521 | // | | | | |
| 1522 | // | | | | |
| 1523 | // | | | | |
| 1524 | // | SubReq1 | | | |
| 1525 | // |------------->| | | |
| 1526 | // | | | | |
| 1527 | // | | SubReq1 | | |
| 1528 | // | |------------->| | |
| 1529 | // | | | | |
| 1530 | // | SubReq2 | | | |
| 1531 | // |------------->| | | |
| 1532 | // | | | | |
| 1533 | // | | SubReq2 | | |
| 1534 | // | |---------------------------->| |
| 1535 | // | | | | |
| 1536 | // | | SubResp1 | | |
| 1537 | // | |<-------------| | |
| 1538 | // | SubResp1 | | | |
| 1539 | // |<-------------| | | |
| 1540 | // | | SubResp2 | | |
| 1541 | // | |<----------------------------| |
| 1542 | // | SubResp2 | | | |
| 1543 | // |<-------------| | | |
| 1544 | // | | | | |
| 1545 | // | [SUBS 1 DELETE] | | |
| 1546 | // | | | | |
| 1547 | // | [SUBS 2 DELETE] | | |
| 1548 | // | | | | |
| 1549 | // |
| 1550 | //----------------------------------------------------------------------------- |
| 1551 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1552 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1553 | |
| 1554 | //Req1 |
| 1555 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1556 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1557 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1558 | |
| 1559 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1560 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1561 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1562 | |
| 1563 | //Resp1 |
| 1564 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1565 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1566 | |
| 1567 | //Resp2 |
| 1568 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1569 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1570 | |
| 1571 | //Del1 |
| 1572 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1573 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1574 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1575 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1576 | //Wait that subs is cleaned |
| 1577 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1578 | |
| 1579 | //Del2 |
| 1580 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1581 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1582 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1583 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1584 | //Wait that subs is cleaned |
| 1585 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1586 | |
| 1587 | xappConn1.TestMsgChanEmpty(t) |
| 1588 | xappConn2.TestMsgChanEmpty(t) |
| 1589 | e2termConn1.TestMsgChanEmpty(t) |
| 1590 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1591 | mainCtrl.wait_registry_empty(t, 10) |
| 1592 | } |