<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">NS+BSSGP: Only send BVC-RESET when _first_ NSVC of NSVCG becomes unblocked<br><br>In case of a NS-VCG with multiple NS-VC, we must BVC-RESET only when the<br>first NS-VC becomes unblocked, i.e. as soon as we have any connection<br>to the peer at all.  Whether we have further additional links doesn't<br>matter, at least not in the sense that all state should be reset.<br><br>Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449<br>---<br>M library/BSSGP_Emulation.ttcnpp<br>M library/NS_Emulation.ttcnpp<br>2 files changed, 43 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/08/21108/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp</span><br><span>index a4a939d..1370958 100644</span><br><span>--- a/library/BSSGP_Emulation.ttcnpp</span><br><span>+++ b/library/BSSGP_Emulation.ttcnpp</span><br><span>@@ -359,7 +359,7 @@</span><br><span> /* We are in BVC_S_WAIT_NS_ALIVE_UNBLOCKED (only happens in BSS role) */</span><br><span> altstep as_sig_wait_ns_alive_unblocked() runs on BSSGP_CT {</span><br><span>        var NsStatusIndication nsi;</span><br><span style="color: hsl(0, 100%, 40%);">-     [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement (NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED}) -> value nsi {</span><br><span style="color: hsl(120, 100%, 40%);">+     [] BSCP.receive(NsStatusIndication:{g_cfg.nsei,?, complement (NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED, true}) -> value nsi {</span><br><span>              /* if we just became NS-unblocked, send a BCC-RESET */</span><br><span>               if (g_cfg.sgsn_role == false) {</span><br><span>                      BSCP.send(f_BnsUdReq(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, 0, omit), 0));</span><br><span>@@ -450,9 +450,9 @@</span><br><span>          }</span><br><span>    }</span><br><span>    /* Keep NS Status Indicaitons to us; no need to inform per-BVC components [for now?] */</span><br><span style="color: hsl(0, 100%, 40%);">- [] BSCP.receive(NsStatusIndication:{g_cfg.nsei, ?, ?, ?}) -> value nsi { }</span><br><span style="color: hsl(120, 100%, 40%);">+ [] BSCP.receive(tr_NsStsInd(g_cfg.nsei)) -> value nsi { }</span><br><span>         /* We should never see any different NSEI: There's one BSSGP_CT per NSE */</span><br><span style="color: hsl(0, 100%, 40%);">-  [] BSCP.receive(NsStatusIndication:{?, ?, ?, ?}) -> value nsi {</span><br><span style="color: hsl(120, 100%, 40%);">+    [] BSCP.receive(tr_NsStsInd(?)) -> value nsi {</span><br><span>            setverdict(fail, "Rx NsStatusInd for wrong NSEI ", nsi);</span><br><span>   }</span><br><span> </span><br><span>diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp</span><br><span>index e286945..7958938 100644</span><br><span>--- a/library/NS_Emulation.ttcnpp</span><br><span>+++ b/library/NS_Emulation.ttcnpp</span><br><span>@@ -73,25 +73,30 @@</span><br><span>                 Nsei            nsei,</span><br><span>                Nsvci           nsvci,</span><br><span>               NsvcState       old_state,</span><br><span style="color: hsl(0, 100%, 40%);">-              NsvcState       new_state</span><br><span style="color: hsl(120, 100%, 40%);">+             NsvcState       new_state,</span><br><span style="color: hsl(120, 100%, 40%);">+            boolean         first_or_last</span><br><span>        }</span><br><span> </span><br><span>        template (present) NsStatusIndication tr_NsStsInd(template (present) Nsei nsei := ?,</span><br><span>                                                           template (present) Nsvci nsvci := ?,</span><br><span>                                                         template (present) NsvcState old_state := ?,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                    template (present) NsvcState state := ?) := {</span><br><span style="color: hsl(120, 100%, 40%);">+                                                         template (present) NsvcState state := ?,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                      template (present) boolean first_or_last := ?) := {</span><br><span>                nsei := nsei,</span><br><span>                nsvci := nsvci,</span><br><span>              old_state := old_state,</span><br><span style="color: hsl(0, 100%, 40%);">-         new_state := state</span><br><span style="color: hsl(120, 100%, 40%);">+            new_state := state,</span><br><span style="color: hsl(120, 100%, 40%);">+           first_or_last := first_or_last</span><br><span>       }</span><br><span> </span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, NsvcState old_state, NsvcState state) := {</span><br><span style="color: hsl(120, 100%, 40%);">+    template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, NsvcState old_state, NsvcState state,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                 boolean first_or_last := false) := {</span><br><span>                 nsei := nsei,</span><br><span>                nsvci := nsvci,</span><br><span>              old_state := old_state,</span><br><span style="color: hsl(0, 100%, 40%);">-         new_state := state</span><br><span style="color: hsl(120, 100%, 40%);">+            new_state := state,</span><br><span style="color: hsl(120, 100%, 40%);">+           first_or_last := first_or_last</span><br><span>       }</span><br><span> </span><br><span>        type enumerated NsvcState {</span><br><span>@@ -247,12 +252,41 @@</span><br><span>          }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ function f_count_nsvcs_in_state(template NsvcState state := ?) runs on NS_CT return integer {</span><br><span style="color: hsl(120, 100%, 40%);">+         var integer i;</span><br><span style="color: hsl(120, 100%, 40%);">+                var integer res := 0;</span><br><span style="color: hsl(120, 100%, 40%);">+         for (i := 0; i < lengthof(g_nsvcs); i := i+1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    if (match(g_nsvcs[i].state, state)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                         res := res + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+                       }</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span style="color: hsl(120, 100%, 40%);">+             return res;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  private altstep as_ns_common() runs on NS_CT {</span><br><span>               var NsStatusIndication rx_nssi;</span><br><span>              var NsUnitdataIndication rx_nsudi;</span><br><span>           var NsUnitdataRequest rx_nsudr;</span><br><span>              /* pass from NS-VCs up to user */</span><br><span style="color: hsl(0, 100%, 40%);">-               [] NSVC.receive(tr_NsStsInd(g_config.nsei)) -> value rx_nssi {</span><br><span style="color: hsl(120, 100%, 40%);">+             [] NSVC.receive(tr_NsStsInd(g_config.nsei, ?, ?, NSVC_S_ALIVE_UNBLOCKED)) -> value rx_nssi {</span><br><span style="color: hsl(120, 100%, 40%);">+                       /* check if this one is the first to be unblocked */</span><br><span style="color: hsl(120, 100%, 40%);">+                  var integer num_nsvc_unblocked := f_count_nsvcs_in_state(NSVC_S_ALIVE_UNBLOCKED);</span><br><span style="color: hsl(120, 100%, 40%);">+                     f_nsvc_update_state(rx_nssi.nsvci, rx_nssi.new_state);</span><br><span style="color: hsl(120, 100%, 40%);">+                        if (num_nsvc_unblocked == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                rx_nssi.first_or_last := true;</span><br><span style="color: hsl(120, 100%, 40%);">+                        }</span><br><span style="color: hsl(120, 100%, 40%);">+                     NS_SP.send(rx_nssi);</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span style="color: hsl(120, 100%, 40%);">+             [] NSVC.receive(tr_NsStsInd(g_config.nsei, ?, ?, NSVC_S_DEAD_BLOCKED)) -> value rx_nssi {</span><br><span style="color: hsl(120, 100%, 40%);">+                  f_nsvc_update_state(rx_nssi.nsvci, rx_nssi.new_state);</span><br><span style="color: hsl(120, 100%, 40%);">+                        /* check if this one is the last to be blocked */</span><br><span style="color: hsl(120, 100%, 40%);">+                     var integer num_nsvc_unblocked := f_count_nsvcs_in_state(NSVC_S_ALIVE_UNBLOCKED);</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (num_nsvc_unblocked == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                rx_nssi.first_or_last := true;</span><br><span style="color: hsl(120, 100%, 40%);">+                        }</span><br><span style="color: hsl(120, 100%, 40%);">+                     NS_SP.send(rx_nssi);</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span style="color: hsl(120, 100%, 40%);">+             [] NSVC.receive(tr_NsStsInd(g_config.nsei, ?, ?, ?)) -> value rx_nssi {</span><br><span>                   f_nsvc_update_state(rx_nssi.nsvci, rx_nssi.new_state);</span><br><span>                       NS_SP.send(rx_nssi);</span><br><span>                         }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108">change 21108</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21108"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I69b2e9bd919fc981f189b6671b4234c3642e2449 </div>
<div style="display:none"> Gerrit-Change-Number: 21108 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>