Change in osmo-ttcn3-hacks[master]: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unbl...

2020-11-12 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108 )

Change subject: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG 
becomes unblocked
..

NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unblocked

In case of a NS-VCG with multiple NS-VC, we must BVC-RESET only when the
first NS-VC becomes unblocked, i.e. as soon as we have any connection
to the peer at all.  Whether we have further additional links doesn't
matter, at least not in the sense that all state should be reset.

Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449
---
M library/BSSGP_Emulation.ttcnpp
M library/NS_Emulation.ttcnpp
2 files changed, 43 insertions(+), 9 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp
index a4a939d..1370958 100644
--- a/library/BSSGP_Emulation.ttcnpp
+++ b/library/BSSGP_Emulation.ttcnpp
@@ -359,7 +359,7 @@
 /* We are in BVC_S_WAIT_NS_ALIVE_UNBLOCKED (only happens in BSS role) */
 altstep as_sig_wait_ns_alive_unblocked() runs on BSSGP_CT {
var NsStatusIndication nsi;
-   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement 
(NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED}) -> value nsi {
+   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement 
(NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED, true}) -> value nsi {
/* if we just became NS-unblocked, send a BCC-RESET */
if (g_cfg.sgsn_role == false) {

BSCP.send(f_BnsUdReq(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, 0, omit), 0));
@@ -450,9 +450,9 @@
}
}
/* Keep NS Status Indicaitons to us; no need to inform per-BVC 
components [for now?] */
-   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei, ?, ?, ?}) -> value nsi 
{ }
+   [] BSCP.receive(tr_NsStsInd(g_cfg.nsei)) -> value nsi { }
/* We should never see any different NSEI: There's one BSSGP_CT per NSE 
*/
-   [] BSCP.receive(NsStatusIndication:{?, ?, ?, ?}) -> value nsi {
+   [] BSCP.receive(tr_NsStsInd(?)) -> value nsi {
setverdict(fail, "Rx NsStatusInd for wrong NSEI ", nsi);
}

diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp
index e286945..7958938 100644
--- a/library/NS_Emulation.ttcnpp
+++ b/library/NS_Emulation.ttcnpp
@@ -73,25 +73,30 @@
Nseinsei,
Nsvci   nsvci,
NsvcState   old_state,
-   NsvcState   new_state
+   NsvcState   new_state,
+   boolean first_or_last
}

template (present) NsStatusIndication tr_NsStsInd(template (present) 
Nsei nsei := ?,
  template (present) 
Nsvci nsvci := ?,
  template (present) 
NsvcState old_state := ?,
- template (present) 
NsvcState state := ?) := {
+ template (present) 
NsvcState state := ?,
+ template (present) 
boolean first_or_last := ?) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
-   new_state := state
+   new_state := state,
+   first_or_last := first_or_last
}


-   template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, 
NsvcState old_state, NsvcState state) := {
+   template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, 
NsvcState old_state, NsvcState state,
+   boolean first_or_last 
:= false) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
-   new_state := state
+   new_state := state,
+   first_or_last := first_or_last
}

type enumerated NsvcState {
@@ -247,12 +252,41 @@
}
}

+   function f_count_nsvcs_in_state(template NsvcState state := ?) runs on 
NS_CT return integer {
+   var integer i;
+   var integer res := 0;
+   for (i := 0; i < lengthof(g_nsvcs); i := i+1) {
+   if (match(g_nsvcs[i].state, state)) {
+   res := res + 1;
+   }
+   }
+   return res;
+   }
+
private altstep as_ns_common() runs on NS_CT {
var NsStatusIndication rx_nssi;
var NsUnitdataIndication rx_nsudi;
var NsUnitdataRequest rx_nsudr;
/* pass from 

Change in osmo-ttcn3-hacks[master]: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unbl...

2020-11-12 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108 )

Change subject: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG 
becomes unblocked
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449
Gerrit-Change-Number: 21108
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 12 Nov 2020 20:01:34 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unbl...

2020-11-11 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108 )

Change subject: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG 
becomes unblocked
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449
Gerrit-Change-Number: 21108
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 11 Nov 2020 22:39:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unbl...

2020-11-11 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108 )


Change subject: NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG 
becomes unblocked
..

NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unblocked

In case of a NS-VCG with multiple NS-VC, we must BVC-RESET only when the
first NS-VC becomes unblocked, i.e. as soon as we have any connection
to the peer at all.  Whether we have further additional links doesn't
matter, at least not in the sense that all state should be reset.

Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449
---
M library/BSSGP_Emulation.ttcnpp
M library/NS_Emulation.ttcnpp
2 files changed, 43 insertions(+), 9 deletions(-)



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

diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp
index a4a939d..1370958 100644
--- a/library/BSSGP_Emulation.ttcnpp
+++ b/library/BSSGP_Emulation.ttcnpp
@@ -359,7 +359,7 @@
 /* We are in BVC_S_WAIT_NS_ALIVE_UNBLOCKED (only happens in BSS role) */
 altstep as_sig_wait_ns_alive_unblocked() runs on BSSGP_CT {
var NsStatusIndication nsi;
-   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement 
(NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED}) -> value nsi {
+   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement 
(NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED, true}) -> value nsi {
/* if we just became NS-unblocked, send a BCC-RESET */
if (g_cfg.sgsn_role == false) {

BSCP.send(f_BnsUdReq(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, 0, omit), 0));
@@ -450,9 +450,9 @@
}
}
/* Keep NS Status Indicaitons to us; no need to inform per-BVC 
components [for now?] */
-   [] BSCP.receive(NsStatusIndication:{g_cfg.nsei, ?, ?, ?}) -> value nsi 
{ }
+   [] BSCP.receive(tr_NsStsInd(g_cfg.nsei)) -> value nsi { }
/* We should never see any different NSEI: There's one BSSGP_CT per NSE 
*/
-   [] BSCP.receive(NsStatusIndication:{?, ?, ?, ?}) -> value nsi {
+   [] BSCP.receive(tr_NsStsInd(?)) -> value nsi {
setverdict(fail, "Rx NsStatusInd for wrong NSEI ", nsi);
}

diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp
index e286945..7958938 100644
--- a/library/NS_Emulation.ttcnpp
+++ b/library/NS_Emulation.ttcnpp
@@ -73,25 +73,30 @@
Nseinsei,
Nsvci   nsvci,
NsvcState   old_state,
-   NsvcState   new_state
+   NsvcState   new_state,
+   boolean first_or_last
}

template (present) NsStatusIndication tr_NsStsInd(template (present) 
Nsei nsei := ?,
  template (present) 
Nsvci nsvci := ?,
  template (present) 
NsvcState old_state := ?,
- template (present) 
NsvcState state := ?) := {
+ template (present) 
NsvcState state := ?,
+ template (present) 
boolean first_or_last := ?) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
-   new_state := state
+   new_state := state,
+   first_or_last := first_or_last
}


-   template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, 
NsvcState old_state, NsvcState state) := {
+   template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, 
NsvcState old_state, NsvcState state,
+   boolean first_or_last 
:= false) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
-   new_state := state
+   new_state := state,
+   first_or_last := first_or_last
}

type enumerated NsvcState {
@@ -247,12 +252,41 @@
}
}

+   function f_count_nsvcs_in_state(template NsvcState state := ?) runs on 
NS_CT return integer {
+   var integer i;
+   var integer res := 0;
+   for (i := 0; i < lengthof(g_nsvcs); i := i+1) {
+   if (match(g_nsvcs[i].state, state)) {
+   res := res + 1;
+   }
+   }
+   return res;
+   }
+
private altstep as_ns_common() runs on NS_CT {
var NsStatusIndication rx_nssi;
var NsUnitdataIndication rx_nsudi;
var NsUnitdataRequest rx_nsudr;
/* pass from NS-VCs up to user */
-   []