Change in osmo-ttcn3-hacks[master]: pcu: Test SNS where initial IP/port is not part of configured NS-VCs

2019-03-16 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13292 )

Change subject: pcu: Test SNS where initial IP/port is not part of configured 
NS-VCs
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13292
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie2a017250ca1d5386e2cf42d1945e61d170ac92d
Gerrit-Change-Number: 13292
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Sat, 16 Mar 2019 13:51:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: pcu: Test SNS where initial IP/port is not part of configured NS-VCs

2019-03-16 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13292 )

Change subject: pcu: Test SNS where initial IP/port is not part of configured 
NS-VCs
..

pcu: Test SNS where initial IP/port is not part of configured NS-VCs

As per section 6.2.1 of 3GPP TS 48.016, the initial IP/port where the
SNS SIZE/CONFIG procedures are being performed is not automatically part
of the later NS-VCs.  This means we shall not perform the NS-ALIVE
procedure or any other procedure beyond SNS with that specific endpoint.

This adds a new TC_sns_1c1u_separate() to test for this behavior.

Change-Id: Ie2a017250ca1d5386e2cf42d1945e61d170ac92d
Related: OS#3844
---
M pcu/PCU_Tests_RAW.ttcn
M pcu/PCU_Tests_RAW_SNS.ttcn
2 files changed, 91 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 923b086..a30829e 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -124,6 +124,37 @@
}
 }

+/* perform outbound NS-ALIVE procedure */
+function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs 
on RAW_NS_CT {
+   timer T := tout;
+   NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE));
+   T.start;
+   alt {
+   [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)) {
+   setverdict(fail, "Received unexpected NS-ALIVE ACK");
+   }
+   [] NSCP[idx].receive { repeat; }
+   [] T.timeout {
+   setverdict(pass);
+   }
+   }
+}
+
+/* ensure no matching message is received within 'tout' */
+function f_ensure_no_ns(template PDU_NS ns := ?, integer idx := 0, float tout 
:= 3.0)
+runs on RAW_Test_CT {
+   timer T := tout;
+   T.start;
+   alt {
+   [] NSCP[idx].receive(t_NS_RecvFrom(ns)) {
+   setverdict(fail, "NS-ALIVE from unconfigured (possibly initial) 
endpoint");
+   }
+   [] T.timeout {
+   setverdict(pass);
+   }
+   }
+}
+
 /* perform outbound NS-BLOCK procedure */
 function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on 
RAW_NS_CT {
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, 
g_nsconfig[idx].nsvci)));
diff --git a/pcu/PCU_Tests_RAW_SNS.ttcn b/pcu/PCU_Tests_RAW_SNS.ttcn
index cc3cb5b..a216dbe 100644
--- a/pcu/PCU_Tests_RAW_SNS.ttcn
+++ b/pcu/PCU_Tests_RAW_SNS.ttcn
@@ -67,6 +67,19 @@
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
 }

+/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 
for user */
+function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := 
omit, integer idx := 0)
+runs on RAW_NS_CT {
+   log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
+   var PDU_NS rx;
+   var template (omit) IP4_Elements v4 := { 
ts_SNS_IPv4(g_nsconfig[1].local_ip,
+
g_nsconfig[1].local_udp_port, 1, 0),
+
ts_SNS_IPv4(g_nsconfig[2].local_ip,
+
g_nsconfig[2].local_udp_port, 0, 1) };
+   NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], 
ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
+   rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
+}
+
 function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t 
w_user := 1, integer idx := 0)
 runs on RAW_NS_CT {
log("f_outgoing_sns_add(idx_add=", idx_add, ")");
@@ -211,6 +224,52 @@
setverdict(pass);
 }

+private function f_sns_bringup_1c1u_separate() runs on RAW_Test_CT {
+   /* Activate two NS codec ports */
+   f_init_ns_codec();
+   f_init_ns_codec(1);
+   f_init_ns_codec(2);
+   f_init_pcuif();
+   /* Perform Size + BSS-originated config */
+   f_incoming_sns_size();
+   f_incoming_sns_config();
+   /* perform SGSN-originated config using idx==0 for signalling and 
idx==1 for user traffic */
+   f_outgoing_sns_config_1c1u_separate();
+
+   /* wait for one ALIVE cycle, then ACK any further ALIVE in the 
background
+* for both NS-VCs */
+   as_rx_alive_tx_ack(oneshot := true, idx := 1);
+   activate(as_rx_alive_tx_ack(idx := 1));
+   as_rx_alive_tx_ack(oneshot := true, idx := 2);
+   activate(as_rx_alive_tx_ack(idx := 2));
+   /* ensure there's no NS-ALIVE received on idx==0 */
+   f_ensure_no_ns(t_NS_ALIVE, idx := 0);
+
+   /* perform outgoing ALIVE procedure for both NS-VCs */
+   f_outgoing_ns_alive(1);
+   f_outgoing_ns_alive(2);
+   /* ensure there's no response to NS-ALIVE sent on idx==0 */
+   f_outgoing_ns_alive_no_ack(idx := 0);
+
+   /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */
+   as_rx_bvc_reset_tx_ack(0, oneshot := 

Change in osmo-ttcn3-hacks[master]: pcu: Test SNS where initial IP/port is not part of configured NS-VCs

2019-03-16 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13292


Change subject: pcu: Test SNS where initial IP/port is not part of configured 
NS-VCs
..

pcu: Test SNS where initial IP/port is not part of configured NS-VCs

As per section 6.2.1 of 3GPP TS 48.016, the initial IP/port where the
SNS SIZE/CONFIG procedures are being performed is not automatically part
of the later NS-VCs.  This means we shall not perform the NS-ALIVE
procedure or any other procedure beyond SNS with that specific endpoint.

This adds a new TC_sns_1c1u_separate() to test for this behavior.

Change-Id: Ie2a017250ca1d5386e2cf42d1945e61d170ac92d
Related: OS#3844
---
M pcu/PCU_Tests_RAW.ttcn
M pcu/PCU_Tests_RAW_SNS.ttcn
2 files changed, 91 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/92/13292/1

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 923b086..a30829e 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -124,6 +124,37 @@
}
 }

+/* perform outbound NS-ALIVE procedure */
+function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs 
on RAW_NS_CT {
+   timer T := tout;
+   NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], t_NS_ALIVE));
+   T.start;
+   alt {
+   [] NSCP[idx].receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)) {
+   setverdict(fail, "Received unexpected NS-ALIVE ACK");
+   }
+   [] NSCP[idx].receive { repeat; }
+   [] T.timeout {
+   setverdict(pass);
+   }
+   }
+}
+
+/* ensure no matching message is received within 'tout' */
+function f_ensure_no_ns(template PDU_NS ns := ?, integer idx := 0, float tout 
:= 3.0)
+runs on RAW_Test_CT {
+   timer T := tout;
+   T.start;
+   alt {
+   [] NSCP[idx].receive(t_NS_RecvFrom(ns)) {
+   setverdict(fail, "NS-ALIVE from unconfigured (possibly initial) 
endpoint");
+   }
+   [] T.timeout {
+   setverdict(pass);
+   }
+   }
+}
+
 /* perform outbound NS-BLOCK procedure */
 function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on 
RAW_NS_CT {
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, 
g_nsconfig[idx].nsvci)));
diff --git a/pcu/PCU_Tests_RAW_SNS.ttcn b/pcu/PCU_Tests_RAW_SNS.ttcn
index cc3cb5b..a216dbe 100644
--- a/pcu/PCU_Tests_RAW_SNS.ttcn
+++ b/pcu/PCU_Tests_RAW_SNS.ttcn
@@ -67,6 +67,19 @@
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
 }

+/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 
for user */
+function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := 
omit, integer idx := 0)
+runs on RAW_NS_CT {
+   log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
+   var PDU_NS rx;
+   var template (omit) IP4_Elements v4 := { 
ts_SNS_IPv4(g_nsconfig[1].local_ip,
+
g_nsconfig[1].local_udp_port, 1, 0),
+
ts_SNS_IPv4(g_nsconfig[2].local_ip,
+
g_nsconfig[2].local_udp_port, 0, 1) };
+   NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], 
ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
+   rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
+}
+
 function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t 
w_user := 1, integer idx := 0)
 runs on RAW_NS_CT {
log("f_outgoing_sns_add(idx_add=", idx_add, ")");
@@ -211,6 +224,52 @@
setverdict(pass);
 }

+private function f_sns_bringup_1c1u_separate() runs on RAW_Test_CT {
+   /* Activate two NS codec ports */
+   f_init_ns_codec();
+   f_init_ns_codec(1);
+   f_init_ns_codec(2);
+   f_init_pcuif();
+   /* Perform Size + BSS-originated config */
+   f_incoming_sns_size();
+   f_incoming_sns_config();
+   /* perform SGSN-originated config using idx==0 for signalling and 
idx==1 for user traffic */
+   f_outgoing_sns_config_1c1u_separate();
+
+   /* wait for one ALIVE cycle, then ACK any further ALIVE in the 
background
+* for both NS-VCs */
+   as_rx_alive_tx_ack(oneshot := true, idx := 1);
+   activate(as_rx_alive_tx_ack(idx := 1));
+   as_rx_alive_tx_ack(oneshot := true, idx := 2);
+   activate(as_rx_alive_tx_ack(idx := 2));
+   /* ensure there's no NS-ALIVE received on idx==0 */
+   f_ensure_no_ns(t_NS_ALIVE, idx := 0);
+
+   /* perform outgoing ALIVE procedure for both NS-VCs */
+   f_outgoing_ns_alive(1);
+   f_outgoing_ns_alive(2);
+   /* ensure there's no response to NS-ALIVE sent on idx==0 */
+   f_outgoing_ns_alive_no_ack(idx := 0);
+
+   /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */
+   as_rx_bvc_reset_tx_ack(0, oneshot := true,