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 | //----------------------------------------------------------------------------- |
| 735 | // TestSubReqSubFailRespInSubmgrWithDuplicate |
| 736 | // |
| 737 | // stub stub |
| 738 | // +-------+ +---------+ +---------+ |
| 739 | // | xapp | | submgr | | e2term | |
| 740 | // +-------+ +---------+ +---------+ |
| 741 | // | | | |
| 742 | // | SubReq | | |
| 743 | // |------------->| | |
| 744 | // | | | |
| 745 | // | | SubReq | |
| 746 | // | |------------->| |
| 747 | // | | | |
| 748 | // | | SubFail | |
| 749 | // | |<-------------| |
| 750 | // | | | |
| 751 | // | | SubDelReq | |
| 752 | // | |------------->| |
| 753 | // | | | |
| 754 | // | | SubDelResp | |
| 755 | // | |<-------------| |
| 756 | // | | | |
| 757 | // | | SubReq | |
| 758 | // | |------------->| |
| 759 | // | | | |
| 760 | // | | SubResp | |
| 761 | // | |<-------------| |
| 762 | // | | | |
| 763 | // | SubResp | | |
| 764 | // |<-------------| | |
| 765 | // | | | |
| 766 | // | [SUBS DELETE] | |
| 767 | // | | | |
| 768 | // |
| 769 | //----------------------------------------------------------------------------- |
| 770 | |
| 771 | func TestSubReqSubFailRespInSubmgrWithDuplicate(t *testing.T) { |
| 772 | |
| 773 | CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicate start") |
| 774 | |
| 775 | // Xapp: Send SubsReq |
| 776 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 777 | |
| 778 | // E2t: Receive SubsReq and send SubsFail (first) |
| 779 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 780 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 781 | fparams1.Set(crereq1) |
| 782 | fparams1.SetCauseVal(-1, 5, 3) |
| 783 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 784 | |
| 785 | // E2t: Receive SubsDelReq and send SubsDelResp (internal) |
| 786 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 787 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 788 | |
| 789 | // E2t: Receive SubsReq and send SubsResp (second) |
| 790 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 791 | e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
| 792 | |
| 793 | // XAPP: Receive SubsResp |
| 794 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 795 | |
| 796 | // Delete |
| 797 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 798 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 799 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
| 800 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 801 | |
| 802 | // Wait that subs is cleaned |
| 803 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 804 | |
| 805 | xappConn1.TestMsgChanEmpty(t) |
| 806 | xappConn2.TestMsgChanEmpty(t) |
| 807 | e2termConn1.TestMsgChanEmpty(t) |
| 808 | mainCtrl.wait_registry_empty(t, 10) |
| 809 | } |
| 810 | |
| 811 | //----------------------------------------------------------------------------- |
| 812 | // TestSubReqSubFailRespInSubmgrWithDuplicateFail |
| 813 | // |
| 814 | // stub stub |
| 815 | // +-------+ +---------+ +---------+ |
| 816 | // | xapp | | submgr | | e2term | |
| 817 | // +-------+ +---------+ +---------+ |
| 818 | // | | | |
| 819 | // | SubReq | | |
| 820 | // |------------->| | |
| 821 | // | | | |
| 822 | // | | SubReq | |
| 823 | // | |------------->| |
| 824 | // | | | |
| 825 | // | | SubFail | |
| 826 | // | |<-------------| |
| 827 | // | | | |
| 828 | // | | SubDelReq | |
| 829 | // | |------------->| |
| 830 | // | | | |
| 831 | // | | SubDelResp | |
| 832 | // | |<-------------| |
| 833 | // | | | |
| 834 | // | | SubReq | |
| 835 | // | |------------->| |
| 836 | // | | | |
| 837 | // | | SubFail | |
| 838 | // | |<-------------| |
| 839 | // | | | |
| 840 | // | | SubDelReq | |
| 841 | // | |------------->| |
| 842 | // | | | |
| 843 | // | | SubDelResp | |
| 844 | // | |<-------------| |
| 845 | // | SubFail | | |
| 846 | // |<-------------| | |
| 847 | // | | | |
| 848 | // |
| 849 | //----------------------------------------------------------------------------- |
| 850 | |
| 851 | func TestSubReqSubFailRespInSubmgrWithDuplicateFail(t *testing.T) { |
| 852 | |
| 853 | CaseBegin("TestSubReqSubFailRespInSubmgrWithDuplicateFail start") |
| 854 | |
| 855 | // Xapp: Send SubsReq |
| 856 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 857 | |
| 858 | // E2t: Receive SubsReq and send SubsFail (first) |
| 859 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 860 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 861 | fparams1.Set(crereq1) |
| 862 | fparams1.SetCauseVal(-1, 5, 3) |
| 863 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 864 | |
| 865 | // E2t: Receive SubsDelReq and send SubsDelResp (internal first) |
| 866 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 867 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 868 | |
| 869 | // E2t: Receive SubsReq and send SubsFail (second) |
| 870 | crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 871 | fparams2 := &teststube2ap.E2StubSubsFailParams{} |
| 872 | fparams2.Set(crereq2) |
| 873 | fparams2.SetCauseVal(-1, 5, 3) |
| 874 | e2termConn1.SendSubsFail(t, fparams2, cremsg2) |
| 875 | |
| 876 | // E2t: Receive SubsDelReq and send SubsDelResp (internal second) |
| 877 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 878 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 879 | |
| 880 | // Xapp: Receive SubsFail |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 881 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 882 | |
| 883 | // Wait that subs is cleaned |
| 884 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 885 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 886 | xappConn1.TestMsgChanEmpty(t) |
| 887 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 888 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 889 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | //----------------------------------------------------------------------------- |
| 893 | // TestSubDelReqRetryInSubmgr |
| 894 | // |
| 895 | // stub stub |
| 896 | // +-------+ +---------+ +---------+ |
| 897 | // | xapp | | submgr | | e2term | |
| 898 | // +-------+ +---------+ +---------+ |
| 899 | // | | | |
| 900 | // | [SUBS CREATE] | |
| 901 | // | | | |
| 902 | // | | | |
| 903 | // | SubDelReq | | |
| 904 | // |------------->| | |
| 905 | // | | | |
| 906 | // | | SubDelReq | |
| 907 | // | |------------->| |
| 908 | // | | | |
| 909 | // | | SubDelReq | |
| 910 | // | |------------->| |
| 911 | // | | | |
| 912 | // | | SubDelResp | |
| 913 | // | |<-------------| |
| 914 | // | | | |
| 915 | // | SubDelResp | | |
| 916 | // |<-------------| | |
| 917 | // |
| 918 | //----------------------------------------------------------------------------- |
| 919 | |
| 920 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 921 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 922 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 923 | |
| 924 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 925 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 926 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 927 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 928 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 929 | |
| 930 | // Subs Delete |
| 931 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 932 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 933 | |
| 934 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 935 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 936 | |
| 937 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 938 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 939 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 940 | |
| 941 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 942 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 943 | |
| 944 | // Wait that subs is cleaned |
| 945 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 946 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 947 | xappConn1.TestMsgChanEmpty(t) |
| 948 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 949 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 950 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 951 | } |
| 952 | |
| 953 | //----------------------------------------------------------------------------- |
| 954 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 955 | // |
| 956 | // stub stub |
| 957 | // +-------+ +---------+ +---------+ |
| 958 | // | xapp | | submgr | | e2term | |
| 959 | // +-------+ +---------+ +---------+ |
| 960 | // | | | |
| 961 | // | [SUBS CREATE] | |
| 962 | // | | | |
| 963 | // | | | |
| 964 | // | SubDelReq | | |
| 965 | // |------------->| | |
| 966 | // | | | |
| 967 | // | | SubDelReq | |
| 968 | // | |------------->| |
| 969 | // | | | |
| 970 | // | | SubDelReq | |
| 971 | // | |------------->| |
| 972 | // | | | |
| 973 | // | | | |
| 974 | // | SubDelResp | | |
| 975 | // |<-------------| | |
| 976 | // |
| 977 | //----------------------------------------------------------------------------- |
| 978 | |
| 979 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 980 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 981 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 982 | |
| 983 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 984 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 985 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 986 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 987 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 988 | |
| 989 | // Subs Delete |
| 990 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 991 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 992 | |
| 993 | // E2t: Receive 1st 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 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 997 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 998 | |
| 999 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1000 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1001 | |
| 1002 | // Wait that subs is cleaned |
| 1003 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1004 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1005 | xappConn1.TestMsgChanEmpty(t) |
| 1006 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1007 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1008 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1009 | } |
| 1010 | |
| 1011 | //----------------------------------------------------------------------------- |
| 1012 | // TestSubDelReqSubDelFailRespInSubmgr |
| 1013 | // |
| 1014 | // stub stub |
| 1015 | // +-------+ +---------+ +---------+ |
| 1016 | // | xapp | | submgr | | e2term | |
| 1017 | // +-------+ +---------+ +---------+ |
| 1018 | // | | | |
| 1019 | // | [SUBS CREATE] | |
| 1020 | // | | | |
| 1021 | // | | | |
| 1022 | // | SubDelReq | | |
| 1023 | // |------------->| | |
| 1024 | // | | | |
| 1025 | // | | SubDelReq | |
| 1026 | // | |------------->| |
| 1027 | // | | | |
| 1028 | // | | SubDelFail | |
| 1029 | // | |<-------------| |
| 1030 | // | | | |
| 1031 | // | SubDelResp | | |
| 1032 | // |<-------------| | |
| 1033 | // | | | |
| 1034 | // |
| 1035 | //----------------------------------------------------------------------------- |
| 1036 | |
| 1037 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 1038 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1039 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1040 | |
| 1041 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1042 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1043 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1044 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1045 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1046 | |
| 1047 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1048 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1049 | |
| 1050 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1051 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1052 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1053 | |
| 1054 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1055 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1056 | |
| 1057 | // Wait that subs is cleaned |
| 1058 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1059 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1060 | xappConn1.TestMsgChanEmpty(t) |
| 1061 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1062 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1063 | mainCtrl.wait_registry_empty(t, 10) |
| 1064 | } |
| 1065 | |
| 1066 | //----------------------------------------------------------------------------- |
| 1067 | // TestSubReqAndSubDelOkSameAction |
| 1068 | // |
| 1069 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1070 | // +-------+ +-------+ +---------+ +---------+ |
| 1071 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1072 | // +-------+ +-------+ +---------+ +---------+ |
| 1073 | // | | | | |
| 1074 | // | | | | |
| 1075 | // | | | | |
| 1076 | // | | SubReq1 | | |
| 1077 | // | |------------->| | |
| 1078 | // | | | | |
| 1079 | // | | | SubReq1 | |
| 1080 | // | | |------------->| |
| 1081 | // | | | SubResp1 | |
| 1082 | // | | |<-------------| |
| 1083 | // | | SubResp1 | | |
| 1084 | // | |<-------------| | |
| 1085 | // | | | | |
| 1086 | // | SubReq2 | | |
| 1087 | // |--------------------------->| | |
| 1088 | // | | | | |
| 1089 | // | SubResp2 | | |
| 1090 | // |<---------------------------| | |
| 1091 | // | | | | |
| 1092 | // | | SubDelReq 1 | | |
| 1093 | // | |------------->| | |
| 1094 | // | | | | |
| 1095 | // | | SubDelResp 1 | | |
| 1096 | // | |<-------------| | |
| 1097 | // | | | | |
| 1098 | // | SubDelReq 2 | | |
| 1099 | // |--------------------------->| | |
| 1100 | // | | | | |
| 1101 | // | | | SubDelReq 2 | |
| 1102 | // | | |------------->| |
| 1103 | // | | | | |
| 1104 | // | | | SubDelReq 2 | |
| 1105 | // | | |------------->| |
| 1106 | // | | | | |
| 1107 | // | SubDelResp 2 | | |
| 1108 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1109 | // |
| 1110 | //----------------------------------------------------------------------------- |
| 1111 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1112 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1113 | |
| 1114 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1115 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1116 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1117 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1118 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1119 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1120 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1121 | |
| 1122 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1123 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1124 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1125 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1126 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 1127 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1128 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1129 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame] | 1130 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 1131 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 1132 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 1133 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 1134 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1135 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1136 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1137 | //e2termConn1.RecvSubsDelReq(t) |
| 1138 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1139 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1140 | //Wait that subs is cleaned |
| 1141 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1142 | |
| 1143 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1144 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1145 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1146 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1147 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1148 | //Wait that subs is cleaned |
| 1149 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1150 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1151 | xappConn1.TestMsgChanEmpty(t) |
| 1152 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1153 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1154 | mainCtrl.wait_registry_empty(t, 10) |
| 1155 | } |
| 1156 | |
| 1157 | //----------------------------------------------------------------------------- |
| 1158 | // TestSubReqAndSubDelOkSameActionParallel |
| 1159 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1160 | // stub stub stub |
| 1161 | // +-------+ +-------+ +---------+ +---------+ |
| 1162 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1163 | // +-------+ +-------+ +---------+ +---------+ |
| 1164 | // | | | | |
| 1165 | // | | | | |
| 1166 | // | | | | |
| 1167 | // | | SubReq1 | | |
| 1168 | // | |------------->| | |
| 1169 | // | | | | |
| 1170 | // | | | SubReq1 | |
| 1171 | // | | |------------->| |
| 1172 | // | SubReq2 | | |
| 1173 | // |--------------------------->| | |
| 1174 | // | | | SubResp1 | |
| 1175 | // | | |<-------------| |
| 1176 | // | | SubResp1 | | |
| 1177 | // | |<-------------| | |
| 1178 | // | | | | |
| 1179 | // | SubResp2 | | |
| 1180 | // |<---------------------------| | |
| 1181 | // | | | | |
| 1182 | // | | SubDelReq 1 | | |
| 1183 | // | |------------->| | |
| 1184 | // | | | | |
| 1185 | // | | SubDelResp 1 | | |
| 1186 | // | |<-------------| | |
| 1187 | // | | | | |
| 1188 | // | SubDelReq 2 | | |
| 1189 | // |--------------------------->| | |
| 1190 | // | | | | |
| 1191 | // | | | SubDelReq 2 | |
| 1192 | // | | |------------->| |
| 1193 | // | | | | |
| 1194 | // | | | SubDelReq 2 | |
| 1195 | // | | |------------->| |
| 1196 | // | | | | |
| 1197 | // | SubDelResp 2 | | |
| 1198 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1199 | // |
| 1200 | //----------------------------------------------------------------------------- |
| 1201 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1202 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1203 | |
| 1204 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1205 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1206 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1207 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1208 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1209 | |
| 1210 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1211 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1212 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1213 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1214 | |
| 1215 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1216 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1217 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1218 | |
| 1219 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1220 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1221 | |
| 1222 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1223 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1224 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1225 | |
| 1226 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1227 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1228 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1229 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1230 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1231 | |
| 1232 | //Wait that subs is cleaned |
| 1233 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1234 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1235 | xappConn1.TestMsgChanEmpty(t) |
| 1236 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1237 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1238 | mainCtrl.wait_registry_empty(t, 10) |
| 1239 | } |
| 1240 | |
| 1241 | //----------------------------------------------------------------------------- |
| 1242 | // TestSubReqAndSubDelNokSameActionParallel |
| 1243 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1244 | // stub stub stub |
| 1245 | // +-------+ +-------+ +---------+ +---------+ |
| 1246 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1247 | // +-------+ +-------+ +---------+ +---------+ |
| 1248 | // | | | | |
| 1249 | // | | | | |
| 1250 | // | | | | |
| 1251 | // | | SubReq1 | | |
| 1252 | // | |------------->| | |
| 1253 | // | | | | |
| 1254 | // | | | SubReq1 | |
| 1255 | // | | |------------->| |
| 1256 | // | SubReq2 | | |
| 1257 | // |--------------------------->| | |
| 1258 | // | | | SubFail1 | |
| 1259 | // | | |<-------------| |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1260 | // | | | | |
| 1261 | // | | | SubDelReq | |
| 1262 | // | | |------------->| |
| 1263 | // | | | SubDelResp | |
| 1264 | // | | |<-------------| |
| 1265 | // | | | | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1266 | // | | SubFail1 | | |
| 1267 | // | |<-------------| | |
| 1268 | // | | | | |
| 1269 | // | SubFail2 | | |
| 1270 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1271 | // |
| 1272 | //----------------------------------------------------------------------------- |
| 1273 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1274 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1275 | |
| 1276 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1277 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1278 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1279 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1280 | |
| 1281 | // E2t: Receive SubsReq (first) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1282 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1283 | |
| 1284 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1285 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1286 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1287 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1288 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1289 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1290 | |
Juha Hyttinen | f28853b | 2020-03-09 14:02:50 +0200 | [diff] [blame] | 1291 | // E2t: send SubsFail (first) |
| 1292 | fparams1 := &teststube2ap.E2StubSubsFailParams{} |
| 1293 | fparams1.Set(crereq1) |
| 1294 | e2termConn1.SendSubsFail(t, fparams1, cremsg1) |
| 1295 | |
| 1296 | // E2t: internal delete |
| 1297 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1298 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1299 | |
| 1300 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1301 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1302 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1303 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1304 | |
| 1305 | //Wait that subs is cleaned |
| 1306 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1307 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1308 | xappConn1.TestMsgChanEmpty(t) |
| 1309 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1310 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1311 | mainCtrl.wait_registry_empty(t, 10) |
| 1312 | } |
| 1313 | |
| 1314 | //----------------------------------------------------------------------------- |
| 1315 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1316 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1317 | // stub stub stub |
| 1318 | // +-------+ +-------+ +---------+ +---------+ |
| 1319 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1320 | // +-------+ +-------+ +---------+ +---------+ |
| 1321 | // | | | | |
| 1322 | // | | | | |
| 1323 | // | | | | |
| 1324 | // | | SubReq1 | | |
| 1325 | // | |------------->| | |
| 1326 | // | | | | |
| 1327 | // | | | SubReq1 | |
| 1328 | // | | |------------->| |
| 1329 | // | | SubReq2 | | |
| 1330 | // |--------------------------->| | |
| 1331 | // | | | | |
| 1332 | // | | | SubReq1 | |
| 1333 | // | | |------------->| |
| 1334 | // | | | | |
| 1335 | // | | | | |
| 1336 | // | | | SubDelReq | |
| 1337 | // | | |------------->| |
| 1338 | // | | | | |
| 1339 | // | | | SubDelResp | |
| 1340 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1341 | // |
| 1342 | //----------------------------------------------------------------------------- |
| 1343 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1344 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1345 | |
| 1346 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1347 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1348 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1349 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1350 | |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1351 | crereq1, _ := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1352 | |
| 1353 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1354 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1355 | rparams2.Init() |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1356 | subepcnt2 := mainCtrl.get_subs_entrypoint_cnt(t, crereq1.RequestId.InstanceId) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1357 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 1683f91 | 2020-04-17 10:39:57 +0300 | [diff] [blame] | 1358 | mainCtrl.wait_subs_entrypoint_cnt_change(t, crereq1.RequestId.InstanceId, subepcnt2, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1359 | |
| 1360 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1361 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1362 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1363 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1364 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1365 | |
| 1366 | //Wait that subs is cleaned |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1367 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.InstanceId, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1368 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1369 | xappConn1.TestMsgChanEmpty(t) |
| 1370 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1371 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1372 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1373 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1374 | |
| 1375 | //----------------------------- Policy cases --------------------------------- |
| 1376 | //----------------------------------------------------------------------------- |
| 1377 | // TestSubReqPolicyAndSubDelOk |
| 1378 | // |
| 1379 | // stub stub |
| 1380 | // +-------+ +---------+ +---------+ |
| 1381 | // | xapp | | submgr | | e2term | |
| 1382 | // +-------+ +---------+ +---------+ |
| 1383 | // | | | |
| 1384 | // | SubReq | | |
| 1385 | // |------------->| | |
| 1386 | // | | | |
| 1387 | // | | SubReq | |
| 1388 | // | |------------->| |
| 1389 | // | | | |
| 1390 | // | | SubResp | |
| 1391 | // | |<-------------| |
| 1392 | // | | | |
| 1393 | // | SubResp | | |
| 1394 | // |<-------------| | |
| 1395 | // | | | |
| 1396 | // | | | |
| 1397 | // | SubDelReq | | |
| 1398 | // |------------->| | |
| 1399 | // | | | |
| 1400 | // | | SubDelReq | |
| 1401 | // | |------------->| |
| 1402 | // | | | |
| 1403 | // | | SubDelResp | |
| 1404 | // | |<-------------| |
| 1405 | // | | | |
| 1406 | // | SubDelResp | | |
| 1407 | // |<-------------| | |
| 1408 | // |
| 1409 | //----------------------------------------------------------------------------- |
| 1410 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1411 | CaseBegin("TestSubReqAndSubDelOk") |
| 1412 | |
| 1413 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1414 | rparams1.Init() |
| 1415 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1416 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1417 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1418 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1419 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1420 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1421 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1422 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1423 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1424 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1425 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1426 | |
| 1427 | //Wait that subs is cleaned |
| 1428 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1429 | |
| 1430 | xappConn1.TestMsgChanEmpty(t) |
| 1431 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1432 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1433 | mainCtrl.wait_registry_empty(t, 10) |
| 1434 | } |
| 1435 | |
| 1436 | //----------------------------------------------------------------------------- |
| 1437 | // TestSubReqPolicyChangeAndSubDelOk |
| 1438 | // |
| 1439 | // stub stub |
| 1440 | // +-------+ +---------+ +---------+ |
| 1441 | // | xapp | | submgr | | e2term | |
| 1442 | // +-------+ +---------+ +---------+ |
| 1443 | // | | | |
| 1444 | // | SubReq | | |
| 1445 | // |------------->| | |
| 1446 | // | | | |
| 1447 | // | | SubReq | |
| 1448 | // | |------------->| |
| 1449 | // | | | |
| 1450 | // | | SubResp | |
| 1451 | // | |<-------------| |
| 1452 | // | | | |
| 1453 | // | SubResp | | |
| 1454 | // |<-------------| | |
| 1455 | // | | | |
| 1456 | // | SubReq | | |
| 1457 | // |------------->| | |
| 1458 | // | | | |
| 1459 | // | | SubReq | |
| 1460 | // | |------------->| |
| 1461 | // | | | |
| 1462 | // | | SubResp | |
| 1463 | // | |<-------------| |
| 1464 | // | | | |
| 1465 | // | SubResp | | |
| 1466 | // |<-------------| | |
| 1467 | // | | | |
| 1468 | // | SubDelReq | | |
| 1469 | // |------------->| | |
| 1470 | // | | | |
| 1471 | // | | SubDelReq | |
| 1472 | // | |------------->| |
| 1473 | // | | | |
| 1474 | // | | SubDelResp | |
| 1475 | // | |<-------------| |
| 1476 | // | | | |
| 1477 | // | SubDelResp | | |
| 1478 | // |<-------------| | |
| 1479 | // |
| 1480 | //----------------------------------------------------------------------------- |
| 1481 | |
| 1482 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1483 | CaseBegin("TestSubReqAndSubDelOk") |
| 1484 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1485 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1486 | rparams1.Init() |
| 1487 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1488 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1489 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1490 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1491 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1492 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1493 | |
| 1494 | //Policy change |
Juha Hyttinen | aada645 | 2020-04-07 08:47:58 +0300 | [diff] [blame] | 1495 | rparams1.Req.RequestId.InstanceId = e2SubsId |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1496 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1497 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1498 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1499 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1500 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1501 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1502 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1503 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1504 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1505 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1506 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1507 | |
| 1508 | //Wait that subs is cleaned |
| 1509 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1510 | |
| 1511 | xappConn1.TestMsgChanEmpty(t) |
| 1512 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1513 | e2termConn1.TestMsgChanEmpty(t) |
| 1514 | mainCtrl.wait_registry_empty(t, 10) |
| 1515 | } |
| 1516 | |
| 1517 | //----------------------------------------------------------------------------- |
| 1518 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1519 | // |
| 1520 | // stub stub stub |
| 1521 | // +-------+ +---------+ +---------+ +---------+ |
| 1522 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1523 | // +-------+ +---------+ +---------+ +---------+ |
| 1524 | // | | | | |
| 1525 | // | | | | |
| 1526 | // | | | | |
| 1527 | // | SubReq1 | | | |
| 1528 | // |------------->| | | |
| 1529 | // | | | | |
| 1530 | // | | SubReq1 | | |
| 1531 | // | |------------->| | |
| 1532 | // | | | | |
| 1533 | // | SubReq2 | | | |
| 1534 | // |------------->| | | |
| 1535 | // | | | | |
| 1536 | // | | SubReq2 | | |
| 1537 | // | |---------------------------->| |
| 1538 | // | | | | |
| 1539 | // | | SubResp1 | | |
| 1540 | // | |<-------------| | |
| 1541 | // | SubResp1 | | | |
| 1542 | // |<-------------| | | |
| 1543 | // | | SubResp2 | | |
| 1544 | // | |<----------------------------| |
| 1545 | // | SubResp2 | | | |
| 1546 | // |<-------------| | | |
| 1547 | // | | | | |
| 1548 | // | [SUBS 1 DELETE] | | |
| 1549 | // | | | | |
| 1550 | // | [SUBS 2 DELETE] | | |
| 1551 | // | | | | |
| 1552 | // |
| 1553 | //----------------------------------------------------------------------------- |
| 1554 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1555 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1556 | |
| 1557 | //Req1 |
| 1558 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1559 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1560 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1561 | |
| 1562 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1563 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1564 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1565 | |
| 1566 | //Resp1 |
| 1567 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1568 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1569 | |
| 1570 | //Resp2 |
| 1571 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1572 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1573 | |
| 1574 | //Del1 |
| 1575 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1576 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1577 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1578 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1579 | //Wait that subs is cleaned |
| 1580 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1581 | |
| 1582 | //Del2 |
| 1583 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1584 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1585 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1586 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1587 | //Wait that subs is cleaned |
| 1588 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1589 | |
| 1590 | xappConn1.TestMsgChanEmpty(t) |
| 1591 | xappConn2.TestMsgChanEmpty(t) |
| 1592 | e2termConn1.TestMsgChanEmpty(t) |
| 1593 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1594 | mainCtrl.wait_registry_empty(t, 10) |
| 1595 | } |
Anssi Mannila | f0d9526 | 2020-08-17 13:00:20 +0300 | [diff] [blame] | 1596 | |
| 1597 | //----------------------------------------------------------------------------- |
| 1598 | // TestSubReqInsertAndSubDelOk |
| 1599 | // |
| 1600 | // stub stub |
| 1601 | // +-------+ +---------+ +---------+ |
| 1602 | // | xapp | | submgr | | e2term | |
| 1603 | // +-------+ +---------+ +---------+ |
| 1604 | // | | | |
| 1605 | // | SubReq | | |
| 1606 | // |------------->| | |
| 1607 | // | | | |
| 1608 | // | | SubReq | |
| 1609 | // | |------------->| |
| 1610 | // | | | |
| 1611 | // | | SubResp | |
| 1612 | // | |<-------------| |
| 1613 | // | | | |
| 1614 | // | SubResp | | |
| 1615 | // |<-------------| | |
| 1616 | // | | | |
| 1617 | // | | | |
| 1618 | // | SubDelReq | | |
| 1619 | // |------------->| | |
| 1620 | // | | | |
| 1621 | // | | SubDelReq | |
| 1622 | // | |------------->| |
| 1623 | // | | | |
| 1624 | // | | SubDelResp | |
| 1625 | // | |<-------------| |
| 1626 | // | | | |
| 1627 | // | SubDelResp | | |
| 1628 | // |<-------------| | |
| 1629 | // |
| 1630 | //----------------------------------------------------------------------------- |
| 1631 | func TestSubReqInsertAndSubDelOk(t *testing.T) { |
| 1632 | CaseBegin("TestInsertSubReqAndSubDelOk") |
| 1633 | |
| 1634 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1635 | rparams1.Init() |
| 1636 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypeInsert |
| 1637 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1638 | |
| 1639 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1640 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1641 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1642 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1643 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1644 | |
| 1645 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1646 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1647 | |
| 1648 | //Wait that subs is cleaned |
| 1649 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1650 | |
| 1651 | xappConn1.TestMsgChanEmpty(t) |
| 1652 | xappConn2.TestMsgChanEmpty(t) |
| 1653 | e2termConn1.TestMsgChanEmpty(t) |
| 1654 | mainCtrl.wait_registry_empty(t, 10) |
| 1655 | } |
Anssi Mannila | 2f26fb2 | 2020-12-07 08:32:13 +0200 | [diff] [blame^] | 1656 | |
| 1657 | //----------------------------------------------------------------------------- |
| 1658 | // TestSubReqRetransmissionWithSameSubIdDiffXid |
| 1659 | // |
| 1660 | // This case simulates case where xApp restarts and starts sending same |
| 1661 | // subscription requests which have already subscribed successfully |
| 1662 | |
| 1663 | // stub stub |
| 1664 | // +-------+ +---------+ +---------+ |
| 1665 | // | xapp | | submgr | | e2term | |
| 1666 | // +-------+ +---------+ +---------+ |
| 1667 | // | | | |
| 1668 | // | SubReq | | |
| 1669 | // |------------->| | |
| 1670 | // | | | |
| 1671 | // | | SubReq | |
| 1672 | // | |------------->| |
| 1673 | // | | | |
| 1674 | // | | SubResp | |
| 1675 | // | |<-------------| |
| 1676 | // | | | |
| 1677 | // | SubResp | | |
| 1678 | // |<-------------| | |
| 1679 | // | | | |
| 1680 | // | xApp restart | | |
| 1681 | // | | | |
| 1682 | // | SubReq | | |
| 1683 | // | (retrans with same xApp generated subid but diff xid) |
| 1684 | // |------------->| | |
| 1685 | // | | | |
| 1686 | // | SubResp | | |
| 1687 | // |<-------------| | |
| 1688 | // | | | |
| 1689 | // | [SUBS DELETE] | |
| 1690 | // | | | |
| 1691 | // |
| 1692 | //----------------------------------------------------------------------------- |
| 1693 | func TestSubReqRetransmissionWithSameSubIdDiffXid(t *testing.T) { |
| 1694 | CaseBegin("TestSubReqRetransmissionWithSameSubIdDiffXid") |
| 1695 | |
| 1696 | //Subs Create |
| 1697 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
| 1698 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1699 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
| 1700 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1701 | |
| 1702 | // xApp restart here |
| 1703 | // --> artificial delay |
| 1704 | <-time.After(1 * time.Second) |
| 1705 | |
| 1706 | //Subs Create |
| 1707 | cretrans = xappConn1.SendSubsReq(t, nil, nil) //Retransmitted SubReq |
| 1708 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1709 | |
| 1710 | //Subs Delete |
| 1711 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
| 1712 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 1713 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
| 1714 | xappConn1.RecvSubsDelResp(t, deltrans) |
| 1715 | |
| 1716 | //Wait that subs is cleaned |
| 1717 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1718 | |
| 1719 | xappConn1.TestMsgChanEmpty(t) |
| 1720 | xappConn2.TestMsgChanEmpty(t) |
| 1721 | e2termConn1.TestMsgChanEmpty(t) |
| 1722 | mainCtrl.wait_registry_empty(t, 10) |
| 1723 | } |