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