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 | // | | | |
| 675 | // | SubFail | | |
| 676 | // |<-------------| | |
| 677 | // | | | |
| 678 | // |
| 679 | //----------------------------------------------------------------------------- |
| 680 | |
| 681 | func TestSubReqSubFailRespInSubmgr(t *testing.T) { |
| 682 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 683 | CaseBegin("TestSubReqSubFailRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 684 | |
| 685 | // Xapp: Send SubsReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 686 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 687 | |
| 688 | // E2t: Receive SubsReq and send SubsFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 689 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 690 | fparams := &teststube2ap.E2StubSubsFailParams{} |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 691 | fparams.Set(crereq) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 692 | e2termConn1.SendSubsFail(t, fparams, cremsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 693 | |
| 694 | // Xapp: Receive SubsFail |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 695 | e2SubsId := xappConn1.RecvSubsFail(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 696 | |
| 697 | // Wait that subs is cleaned |
| 698 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 699 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 700 | xappConn1.TestMsgChanEmpty(t) |
| 701 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 702 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 703 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 704 | } |
| 705 | |
| 706 | //----------------------------------------------------------------------------- |
| 707 | // TestSubDelReqRetryInSubmgr |
| 708 | // |
| 709 | // stub stub |
| 710 | // +-------+ +---------+ +---------+ |
| 711 | // | xapp | | submgr | | e2term | |
| 712 | // +-------+ +---------+ +---------+ |
| 713 | // | | | |
| 714 | // | [SUBS CREATE] | |
| 715 | // | | | |
| 716 | // | | | |
| 717 | // | SubDelReq | | |
| 718 | // |------------->| | |
| 719 | // | | | |
| 720 | // | | SubDelReq | |
| 721 | // | |------------->| |
| 722 | // | | | |
| 723 | // | | SubDelReq | |
| 724 | // | |------------->| |
| 725 | // | | | |
| 726 | // | | SubDelResp | |
| 727 | // | |<-------------| |
| 728 | // | | | |
| 729 | // | SubDelResp | | |
| 730 | // |<-------------| | |
| 731 | // |
| 732 | //----------------------------------------------------------------------------- |
| 733 | |
| 734 | func TestSubDelReqRetryInSubmgr(t *testing.T) { |
| 735 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 736 | CaseBegin("TestSubDelReqRetryInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 737 | |
| 738 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 739 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 740 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 741 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 742 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 743 | |
| 744 | // Subs Delete |
| 745 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 746 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 747 | |
| 748 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 749 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 750 | |
| 751 | // E2t: Receive 2nd SubsDelReq and send SubsDelResp |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 752 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 753 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 754 | |
| 755 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 756 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 757 | |
| 758 | // Wait that subs is cleaned |
| 759 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 760 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 761 | xappConn1.TestMsgChanEmpty(t) |
| 762 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 763 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 764 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 765 | } |
| 766 | |
| 767 | //----------------------------------------------------------------------------- |
| 768 | // TestSubDelReqTwoRetriesNoRespInSubmgr |
| 769 | // |
| 770 | // stub stub |
| 771 | // +-------+ +---------+ +---------+ |
| 772 | // | xapp | | submgr | | e2term | |
| 773 | // +-------+ +---------+ +---------+ |
| 774 | // | | | |
| 775 | // | [SUBS CREATE] | |
| 776 | // | | | |
| 777 | // | | | |
| 778 | // | SubDelReq | | |
| 779 | // |------------->| | |
| 780 | // | | | |
| 781 | // | | SubDelReq | |
| 782 | // | |------------->| |
| 783 | // | | | |
| 784 | // | | SubDelReq | |
| 785 | // | |------------->| |
| 786 | // | | | |
| 787 | // | | | |
| 788 | // | SubDelResp | | |
| 789 | // |<-------------| | |
| 790 | // |
| 791 | //----------------------------------------------------------------------------- |
| 792 | |
| 793 | func TestSubDelReqTwoRetriesNoRespInSubmgr(t *testing.T) { |
| 794 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 795 | CaseBegin("TestSubDelReTwoRetriesNoRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 796 | |
| 797 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 798 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 799 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 800 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 801 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 802 | |
| 803 | // Subs Delete |
| 804 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 805 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 806 | |
| 807 | // E2t: Receive 1st SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 808 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 809 | |
| 810 | // E2t: Receive 2nd SubsDelReq |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 811 | e2termConn1.RecvSubsDelReq(t) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 812 | |
| 813 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 814 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 815 | |
| 816 | // Wait that subs is cleaned |
| 817 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 818 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 819 | xappConn1.TestMsgChanEmpty(t) |
| 820 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 821 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 822 | mainCtrl.wait_registry_empty(t, 10) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | //----------------------------------------------------------------------------- |
| 826 | // TestSubDelReqSubDelFailRespInSubmgr |
| 827 | // |
| 828 | // stub stub |
| 829 | // +-------+ +---------+ +---------+ |
| 830 | // | xapp | | submgr | | e2term | |
| 831 | // +-------+ +---------+ +---------+ |
| 832 | // | | | |
| 833 | // | [SUBS CREATE] | |
| 834 | // | | | |
| 835 | // | | | |
| 836 | // | SubDelReq | | |
| 837 | // |------------->| | |
| 838 | // | | | |
| 839 | // | | SubDelReq | |
| 840 | // | |------------->| |
| 841 | // | | | |
| 842 | // | | SubDelFail | |
| 843 | // | |<-------------| |
| 844 | // | | | |
| 845 | // | SubDelResp | | |
| 846 | // |<-------------| | |
| 847 | // | | | |
| 848 | // |
| 849 | //----------------------------------------------------------------------------- |
| 850 | |
| 851 | func TestSubDelReqSubDelFailRespInSubmgr(t *testing.T) { |
| 852 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 853 | CaseBegin("TestSubReqSubDelFailRespInSubmgr start") |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 854 | |
| 855 | // Subs Create |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 856 | cretrans := xappConn1.SendSubsReq(t, nil, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 857 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 858 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 859 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 860 | |
| 861 | // Xapp: Send SubsDelReq |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 862 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 863 | |
| 864 | // E2t: Send receive SubsDelReq and send SubsDelFail |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 865 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
| 866 | e2termConn1.SendSubsDelFail(t, delreq, delmsg) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 867 | |
| 868 | // Xapp: Receive SubsDelResp |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 869 | xappConn1.RecvSubsDelResp(t, deltrans) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 870 | |
| 871 | // Wait that subs is cleaned |
| 872 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 873 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 874 | xappConn1.TestMsgChanEmpty(t) |
| 875 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 876 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 877 | mainCtrl.wait_registry_empty(t, 10) |
| 878 | } |
| 879 | |
| 880 | //----------------------------------------------------------------------------- |
| 881 | // TestSubReqAndSubDelOkSameAction |
| 882 | // |
| 883 | // stub stub |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 884 | // +-------+ +-------+ +---------+ +---------+ |
| 885 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 886 | // +-------+ +-------+ +---------+ +---------+ |
| 887 | // | | | | |
| 888 | // | | | | |
| 889 | // | | | | |
| 890 | // | | SubReq1 | | |
| 891 | // | |------------->| | |
| 892 | // | | | | |
| 893 | // | | | SubReq1 | |
| 894 | // | | |------------->| |
| 895 | // | | | SubResp1 | |
| 896 | // | | |<-------------| |
| 897 | // | | SubResp1 | | |
| 898 | // | |<-------------| | |
| 899 | // | | | | |
| 900 | // | SubReq2 | | |
| 901 | // |--------------------------->| | |
| 902 | // | | | | |
| 903 | // | SubResp2 | | |
| 904 | // |<---------------------------| | |
| 905 | // | | | | |
| 906 | // | | SubDelReq 1 | | |
| 907 | // | |------------->| | |
| 908 | // | | | | |
| 909 | // | | SubDelResp 1 | | |
| 910 | // | |<-------------| | |
| 911 | // | | | | |
| 912 | // | SubDelReq 2 | | |
| 913 | // |--------------------------->| | |
| 914 | // | | | | |
| 915 | // | | | SubDelReq 2 | |
| 916 | // | | |------------->| |
| 917 | // | | | | |
| 918 | // | | | SubDelReq 2 | |
| 919 | // | | |------------->| |
| 920 | // | | | | |
| 921 | // | SubDelResp 2 | | |
| 922 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 923 | // |
| 924 | //----------------------------------------------------------------------------- |
| 925 | func TestSubReqAndSubDelOkSameAction(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 926 | CaseBegin("TestSubReqAndSubDelOkSameAction") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 927 | |
| 928 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 929 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 930 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 931 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 932 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 933 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 934 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 935 | |
| 936 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 937 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 938 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 939 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 940 | //crereq2, cremsg2 := e2termConn1.RecvSubsReq(t) |
| 941 | //e2termConn1.SendSubsResp(t, crereq2, cremsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 942 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 943 | |
Juha Hyttinen | c9eb08a | 2020-02-28 08:53:33 +0200 | [diff] [blame^] | 944 | resp, _ := xapp.Subscription.QuerySubscriptions() |
| 945 | assert.Equal(t, resp[0].SubscriptionID, int64(e2SubsId1)) |
| 946 | assert.Equal(t, resp[0].Meid, "RAN_NAME_1") |
| 947 | assert.Equal(t, resp[0].Endpoint, []string{"localhost:13560", "localhost:13660"}) |
| 948 | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 949 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 950 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 951 | //e2termConn1.RecvSubsDelReq(t) |
| 952 | //e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 953 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 954 | //Wait that subs is cleaned |
| 955 | //mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 956 | |
| 957 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 958 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 959 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 960 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 961 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 962 | //Wait that subs is cleaned |
| 963 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 964 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 965 | xappConn1.TestMsgChanEmpty(t) |
| 966 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 967 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 968 | mainCtrl.wait_registry_empty(t, 10) |
| 969 | } |
| 970 | |
| 971 | //----------------------------------------------------------------------------- |
| 972 | // TestSubReqAndSubDelOkSameActionParallel |
| 973 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 974 | // stub stub stub |
| 975 | // +-------+ +-------+ +---------+ +---------+ |
| 976 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 977 | // +-------+ +-------+ +---------+ +---------+ |
| 978 | // | | | | |
| 979 | // | | | | |
| 980 | // | | | | |
| 981 | // | | SubReq1 | | |
| 982 | // | |------------->| | |
| 983 | // | | | | |
| 984 | // | | | SubReq1 | |
| 985 | // | | |------------->| |
| 986 | // | SubReq2 | | |
| 987 | // |--------------------------->| | |
| 988 | // | | | SubResp1 | |
| 989 | // | | |<-------------| |
| 990 | // | | SubResp1 | | |
| 991 | // | |<-------------| | |
| 992 | // | | | | |
| 993 | // | SubResp2 | | |
| 994 | // |<---------------------------| | |
| 995 | // | | | | |
| 996 | // | | SubDelReq 1 | | |
| 997 | // | |------------->| | |
| 998 | // | | | | |
| 999 | // | | SubDelResp 1 | | |
| 1000 | // | |<-------------| | |
| 1001 | // | | | | |
| 1002 | // | SubDelReq 2 | | |
| 1003 | // |--------------------------->| | |
| 1004 | // | | | | |
| 1005 | // | | | SubDelReq 2 | |
| 1006 | // | | |------------->| |
| 1007 | // | | | | |
| 1008 | // | | | SubDelReq 2 | |
| 1009 | // | | |------------->| |
| 1010 | // | | | | |
| 1011 | // | SubDelResp 2 | | |
| 1012 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1013 | // |
| 1014 | //----------------------------------------------------------------------------- |
| 1015 | func TestSubReqAndSubDelOkSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1016 | CaseBegin("TestSubReqAndSubDelOkSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1017 | |
| 1018 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1019 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1020 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1021 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1022 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1023 | |
| 1024 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1025 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1026 | rparams2.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1027 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1028 | |
| 1029 | //Resp1 |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1030 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1031 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1032 | |
| 1033 | //Resp2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1034 | e2SubsId2 := xappConn2.RecvSubsResp(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1035 | |
| 1036 | //Del1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1037 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1038 | xappConn1.RecvSubsDelResp(t, deltrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1039 | |
| 1040 | //Del2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1041 | deltrans2 := xappConn2.SendSubsDelReq(t, nil, e2SubsId2) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1042 | delreq2, delmsg2 := e2termConn1.RecvSubsDelReq(t) |
| 1043 | e2termConn1.SendSubsDelResp(t, delreq2, delmsg2) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1044 | xappConn2.RecvSubsDelResp(t, deltrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1045 | |
| 1046 | //Wait that subs is cleaned |
| 1047 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1048 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1049 | xappConn1.TestMsgChanEmpty(t) |
| 1050 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1051 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1052 | mainCtrl.wait_registry_empty(t, 10) |
| 1053 | } |
| 1054 | |
| 1055 | //----------------------------------------------------------------------------- |
| 1056 | // TestSubReqAndSubDelNokSameActionParallel |
| 1057 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1058 | // stub stub stub |
| 1059 | // +-------+ +-------+ +---------+ +---------+ |
| 1060 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1061 | // +-------+ +-------+ +---------+ +---------+ |
| 1062 | // | | | | |
| 1063 | // | | | | |
| 1064 | // | | | | |
| 1065 | // | | SubReq1 | | |
| 1066 | // | |------------->| | |
| 1067 | // | | | | |
| 1068 | // | | | SubReq1 | |
| 1069 | // | | |------------->| |
| 1070 | // | SubReq2 | | |
| 1071 | // |--------------------------->| | |
| 1072 | // | | | SubFail1 | |
| 1073 | // | | |<-------------| |
| 1074 | // | | SubFail1 | | |
| 1075 | // | |<-------------| | |
| 1076 | // | | | | |
| 1077 | // | SubFail2 | | |
| 1078 | // |<---------------------------| | |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1079 | // |
| 1080 | //----------------------------------------------------------------------------- |
| 1081 | func TestSubReqAndSubDelNokSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1082 | CaseBegin("TestSubReqAndSubDelNokSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1083 | |
| 1084 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1085 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1086 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1087 | cretrans1 := xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1088 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1089 | |
| 1090 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1091 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1092 | rparams2.Init() |
| 1093 | seqBef2 := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1094 | cretrans2 := xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1095 | mainCtrl.wait_msgcounter_change(t, seqBef2, 10) |
| 1096 | |
| 1097 | //E2T Fail |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1098 | fparams := &teststube2ap.E2StubSubsFailParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1099 | fparams.Set(crereq1) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1100 | e2termConn1.SendSubsFail(t, fparams, cremsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1101 | |
| 1102 | //Fail1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1103 | e2SubsId1 := xappConn1.RecvSubsFail(t, cretrans1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1104 | //Fail2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1105 | xappConn2.RecvSubsFail(t, cretrans2) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1106 | |
| 1107 | //Wait that subs is cleaned |
| 1108 | mainCtrl.wait_subs_clean(t, e2SubsId1, 15) |
| 1109 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1110 | xappConn1.TestMsgChanEmpty(t) |
| 1111 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1112 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1113 | mainCtrl.wait_registry_empty(t, 10) |
| 1114 | } |
| 1115 | |
| 1116 | //----------------------------------------------------------------------------- |
| 1117 | // TestSubReqAndSubDelNoAnswerSameActionParallel |
| 1118 | // |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1119 | // stub stub stub |
| 1120 | // +-------+ +-------+ +---------+ +---------+ |
| 1121 | // | xapp2 | | xapp1 | | submgr | | e2term | |
| 1122 | // +-------+ +-------+ +---------+ +---------+ |
| 1123 | // | | | | |
| 1124 | // | | | | |
| 1125 | // | | | | |
| 1126 | // | | SubReq1 | | |
| 1127 | // | |------------->| | |
| 1128 | // | | | | |
| 1129 | // | | | SubReq1 | |
| 1130 | // | | |------------->| |
| 1131 | // | | SubReq2 | | |
| 1132 | // |--------------------------->| | |
| 1133 | // | | | | |
| 1134 | // | | | SubReq1 | |
| 1135 | // | | |------------->| |
| 1136 | // | | | | |
| 1137 | // | | | | |
| 1138 | // | | | SubDelReq | |
| 1139 | // | | |------------->| |
| 1140 | // | | | | |
| 1141 | // | | | SubDelResp | |
| 1142 | // | | |<-------------| |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1143 | // |
| 1144 | //----------------------------------------------------------------------------- |
| 1145 | func TestSubReqAndSubDelNoAnswerSameActionParallel(t *testing.T) { |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1146 | CaseBegin("TestSubReqAndSubDelNoAnswerSameActionParallel") |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1147 | |
| 1148 | //Req1 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1149 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1150 | rparams1.Init() |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1151 | xappConn1.SendSubsReq(t, rparams1, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1152 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1153 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1154 | |
| 1155 | //Req2 |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1156 | rparams2 := &teststube2ap.E2StubSubsReqParams{} |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1157 | rparams2.Init() |
| 1158 | seqBef2 := mainCtrl.get_msgcounter(t) |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1159 | xappConn2.SendSubsReq(t, rparams2, nil) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1160 | mainCtrl.wait_msgcounter_change(t, seqBef2, 10) |
| 1161 | |
| 1162 | //Req1 (retransmitted) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1163 | e2termConn1.RecvSubsReq(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1164 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1165 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1166 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1167 | |
| 1168 | //Wait that subs is cleaned |
Juha Hyttinen | 83ada00 | 2020-01-30 10:36:33 +0200 | [diff] [blame] | 1169 | mainCtrl.wait_subs_clean(t, delreq1.RequestId.Seq, 10) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1170 | |
Juha Hyttinen | 5f8ffa0 | 2020-02-06 15:28:59 +0200 | [diff] [blame] | 1171 | xappConn1.TestMsgChanEmpty(t) |
| 1172 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1173 | e2termConn1.TestMsgChanEmpty(t) |
Juha Hyttinen | 3944a22 | 2020-01-24 11:51:46 +0200 | [diff] [blame] | 1174 | mainCtrl.wait_registry_empty(t, 15) |
Juha Hyttinen | fa01566 | 2020-01-24 10:05:18 +0200 | [diff] [blame] | 1175 | } |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1176 | |
| 1177 | //----------------------------- Policy cases --------------------------------- |
| 1178 | //----------------------------------------------------------------------------- |
| 1179 | // TestSubReqPolicyAndSubDelOk |
| 1180 | // |
| 1181 | // stub stub |
| 1182 | // +-------+ +---------+ +---------+ |
| 1183 | // | xapp | | submgr | | e2term | |
| 1184 | // +-------+ +---------+ +---------+ |
| 1185 | // | | | |
| 1186 | // | SubReq | | |
| 1187 | // |------------->| | |
| 1188 | // | | | |
| 1189 | // | | SubReq | |
| 1190 | // | |------------->| |
| 1191 | // | | | |
| 1192 | // | | SubResp | |
| 1193 | // | |<-------------| |
| 1194 | // | | | |
| 1195 | // | SubResp | | |
| 1196 | // |<-------------| | |
| 1197 | // | | | |
| 1198 | // | | | |
| 1199 | // | SubDelReq | | |
| 1200 | // |------------->| | |
| 1201 | // | | | |
| 1202 | // | | SubDelReq | |
| 1203 | // | |------------->| |
| 1204 | // | | | |
| 1205 | // | | SubDelResp | |
| 1206 | // | |<-------------| |
| 1207 | // | | | |
| 1208 | // | SubDelResp | | |
| 1209 | // |<-------------| | |
| 1210 | // |
| 1211 | //----------------------------------------------------------------------------- |
| 1212 | func TestSubReqPolicyAndSubDelOk(t *testing.T) { |
| 1213 | CaseBegin("TestSubReqAndSubDelOk") |
| 1214 | |
| 1215 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1216 | rparams1.Init() |
| 1217 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1218 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
| 1219 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1220 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1221 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1222 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1223 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1224 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1225 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1226 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1227 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1228 | |
| 1229 | //Wait that subs is cleaned |
| 1230 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1231 | |
| 1232 | xappConn1.TestMsgChanEmpty(t) |
| 1233 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1234 | e2termConn1.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1235 | mainCtrl.wait_registry_empty(t, 10) |
| 1236 | } |
| 1237 | |
| 1238 | //----------------------------------------------------------------------------- |
| 1239 | // TestSubReqPolicyChangeAndSubDelOk |
| 1240 | // |
| 1241 | // stub stub |
| 1242 | // +-------+ +---------+ +---------+ |
| 1243 | // | xapp | | submgr | | e2term | |
| 1244 | // +-------+ +---------+ +---------+ |
| 1245 | // | | | |
| 1246 | // | SubReq | | |
| 1247 | // |------------->| | |
| 1248 | // | | | |
| 1249 | // | | SubReq | |
| 1250 | // | |------------->| |
| 1251 | // | | | |
| 1252 | // | | SubResp | |
| 1253 | // | |<-------------| |
| 1254 | // | | | |
| 1255 | // | SubResp | | |
| 1256 | // |<-------------| | |
| 1257 | // | | | |
| 1258 | // | SubReq | | |
| 1259 | // |------------->| | |
| 1260 | // | | | |
| 1261 | // | | SubReq | |
| 1262 | // | |------------->| |
| 1263 | // | | | |
| 1264 | // | | SubResp | |
| 1265 | // | |<-------------| |
| 1266 | // | | | |
| 1267 | // | SubResp | | |
| 1268 | // |<-------------| | |
| 1269 | // | | | |
| 1270 | // | SubDelReq | | |
| 1271 | // |------------->| | |
| 1272 | // | | | |
| 1273 | // | | SubDelReq | |
| 1274 | // | |------------->| |
| 1275 | // | | | |
| 1276 | // | | SubDelResp | |
| 1277 | // | |<-------------| |
| 1278 | // | | | |
| 1279 | // | SubDelResp | | |
| 1280 | // |<-------------| | |
| 1281 | // |
| 1282 | //----------------------------------------------------------------------------- |
| 1283 | |
| 1284 | func TestSubReqPolicyChangeAndSubDelOk(t *testing.T) { |
| 1285 | CaseBegin("TestSubReqAndSubDelOk") |
| 1286 | |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1287 | rparams1 := &teststube2ap.E2StubSubsReqParams{} |
| 1288 | rparams1.Init() |
| 1289 | rparams1.Req.ActionSetups[0].ActionType = e2ap.E2AP_ActionTypePolicy |
| 1290 | cretrans := xappConn1.SendSubsReq(t, rparams1, nil) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1291 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1292 | crereq, cremsg := e2termConn1.RecvSubsReq(t) |
| 1293 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1294 | e2SubsId := xappConn1.RecvSubsResp(t, cretrans) |
| 1295 | |
| 1296 | //Policy change |
| 1297 | rparams1.Req.RequestId.Seq = e2SubsId |
| 1298 | rparams1.Req.ActionSetups[0].SubsequentAction.TimetoWait = e2ap.E2AP_TimeToWaitW200ms |
| 1299 | xappConn1.SendSubsReq(t, rparams1, cretrans) |
| 1300 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1301 | crereq, cremsg = e2termConn1.RecvSubsReq(t) |
| 1302 | e2termConn1.SendSubsResp(t, crereq, cremsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1303 | e2SubsId = xappConn1.RecvSubsResp(t, cretrans) |
| 1304 | deltrans := xappConn1.SendSubsDelReq(t, nil, e2SubsId) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1305 | delreq, delmsg := e2termConn1.RecvSubsDelReq(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1306 | |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1307 | e2termConn1.SendSubsDelResp(t, delreq, delmsg) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1308 | xappConn1.RecvSubsDelResp(t, deltrans) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1309 | |
| 1310 | //Wait that subs is cleaned |
| 1311 | mainCtrl.wait_subs_clean(t, e2SubsId, 10) |
| 1312 | |
| 1313 | xappConn1.TestMsgChanEmpty(t) |
| 1314 | xappConn2.TestMsgChanEmpty(t) |
Juha Hyttinen | 896c3ac | 2020-02-24 12:49:20 +0200 | [diff] [blame] | 1315 | e2termConn1.TestMsgChanEmpty(t) |
| 1316 | mainCtrl.wait_registry_empty(t, 10) |
| 1317 | } |
| 1318 | |
| 1319 | //----------------------------------------------------------------------------- |
| 1320 | // TestSubReqAndSubDelOkTwoE2termParallel |
| 1321 | // |
| 1322 | // stub stub stub |
| 1323 | // +-------+ +---------+ +---------+ +---------+ |
| 1324 | // | xapp | | submgr | | e2term1 | | e2term2 | |
| 1325 | // +-------+ +---------+ +---------+ +---------+ |
| 1326 | // | | | | |
| 1327 | // | | | | |
| 1328 | // | | | | |
| 1329 | // | SubReq1 | | | |
| 1330 | // |------------->| | | |
| 1331 | // | | | | |
| 1332 | // | | SubReq1 | | |
| 1333 | // | |------------->| | |
| 1334 | // | | | | |
| 1335 | // | SubReq2 | | | |
| 1336 | // |------------->| | | |
| 1337 | // | | | | |
| 1338 | // | | SubReq2 | | |
| 1339 | // | |---------------------------->| |
| 1340 | // | | | | |
| 1341 | // | | SubResp1 | | |
| 1342 | // | |<-------------| | |
| 1343 | // | SubResp1 | | | |
| 1344 | // |<-------------| | | |
| 1345 | // | | SubResp2 | | |
| 1346 | // | |<----------------------------| |
| 1347 | // | SubResp2 | | | |
| 1348 | // |<-------------| | | |
| 1349 | // | | | | |
| 1350 | // | [SUBS 1 DELETE] | | |
| 1351 | // | | | | |
| 1352 | // | [SUBS 2 DELETE] | | |
| 1353 | // | | | | |
| 1354 | // |
| 1355 | //----------------------------------------------------------------------------- |
| 1356 | func TestSubReqAndSubDelOkTwoE2termParallel(t *testing.T) { |
| 1357 | CaseBegin("TestSubReqAndSubDelOkTwoE2termParallel") |
| 1358 | |
| 1359 | //Req1 |
| 1360 | cretrans1 := xappConn1.NewRmrTransactionId("", "RAN_NAME_1") |
| 1361 | xappConn1.SendSubsReq(t, nil, cretrans1) |
| 1362 | crereq1, cremsg1 := e2termConn1.RecvSubsReq(t) |
| 1363 | |
| 1364 | cretrans2 := xappConn1.NewRmrTransactionId("", "RAN_NAME_11") |
| 1365 | xappConn1.SendSubsReq(t, nil, cretrans2) |
| 1366 | crereq2, cremsg2 := e2termConn2.RecvSubsReq(t) |
| 1367 | |
| 1368 | //Resp1 |
| 1369 | e2termConn1.SendSubsResp(t, crereq1, cremsg1) |
| 1370 | e2SubsId1 := xappConn1.RecvSubsResp(t, cretrans1) |
| 1371 | |
| 1372 | //Resp2 |
| 1373 | e2termConn2.SendSubsResp(t, crereq2, cremsg2) |
| 1374 | e2SubsId2 := xappConn1.RecvSubsResp(t, cretrans2) |
| 1375 | |
| 1376 | //Del1 |
| 1377 | deltrans1 := xappConn1.SendSubsDelReq(t, nil, e2SubsId1) |
| 1378 | delreq1, delmsg1 := e2termConn1.RecvSubsDelReq(t) |
| 1379 | e2termConn1.SendSubsDelResp(t, delreq1, delmsg1) |
| 1380 | xappConn1.RecvSubsDelResp(t, deltrans1) |
| 1381 | //Wait that subs is cleaned |
| 1382 | mainCtrl.wait_subs_clean(t, e2SubsId1, 10) |
| 1383 | |
| 1384 | //Del2 |
| 1385 | deltrans2 := xappConn1.SendSubsDelReq(t, nil, e2SubsId2) |
| 1386 | delreq2, delmsg2 := e2termConn2.RecvSubsDelReq(t) |
| 1387 | e2termConn2.SendSubsDelResp(t, delreq2, delmsg2) |
| 1388 | xappConn1.RecvSubsDelResp(t, deltrans2) |
| 1389 | //Wait that subs is cleaned |
| 1390 | mainCtrl.wait_subs_clean(t, e2SubsId2, 10) |
| 1391 | |
| 1392 | xappConn1.TestMsgChanEmpty(t) |
| 1393 | xappConn2.TestMsgChanEmpty(t) |
| 1394 | e2termConn1.TestMsgChanEmpty(t) |
| 1395 | e2termConn2.TestMsgChanEmpty(t) |
Anssi Mannila | 9bcb0a4 | 2020-02-11 11:30:44 +0200 | [diff] [blame] | 1396 | mainCtrl.wait_registry_empty(t, 10) |
| 1397 | } |