Change in osmo-ttcn3-hacks[master]: NS_Emulation: Work around "alive" race condition in IP-SNS

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Feb 13 15:52:44 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22899 )

Change subject: NS_Emulation: Work around "alive" race condition in IP-SNS
......................................................................

NS_Emulation: Work around "alive" race condition in IP-SNS

We need to modify the state of each NS-VC within a NS-VCG/NSE once
we receive the final SNS-CONFIG-ACK PDU.  However, sometimes the
IUT sends its first NS-PDU _before_ we even have communicated the
state-change locally to all our NS-VCs.

In order to avoid the problem, let's mark the NS-VCs as alive before
sending the the SNS-CONFIG.  This means we have one RTT more time
to locally propagate the state change to all NS-VCs.

Change-Id: Idac522a81f01553df52dc012cbab15e1c73c0862
Closes: OS#5023
---
M library/NS_Emulation.ttcnpp
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp
index 1b9b1df..38f132a 100644
--- a/library/NS_Emulation.ttcnpp
+++ b/library/NS_Emulation.ttcnpp
@@ -263,7 +263,8 @@
 	type enumerated NsCtrlRequest {
 		StartAliveProcedure	(0),
 		DisableReq		(1),	/* administratively disable NS-VC */
-		EnableReq		(2)	/* administratively enable NS-VC */
+		EnableReq		(2),	/* administratively enable NS-VC */
+		ForceAliveState		(3)
 	};
 
 	/* add one NSVC (component and table entry */
@@ -487,6 +488,10 @@
 										-> value sind sender vc {
 			/* blindly acknowledge whatever the PCU sends */
 			NSVC.send(SnsRequest:{sind.nsvci, ts_SNS_CONFIG_ACK(g_config.nsei, omit)}) to vc;
+			/* switch to "alive" state already before sending the SNS-CONFIG, as otherwise
+			 * there would be a race condition between internally performing the state change
+			 * of all related NS-VCs and the first incoming NS-PDU after SNS-CONFIG-ACK */
+			f_broadcast_ns_ctrl(NsCtrlRequest:ForceAliveState);
 			/* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
 			var template (omit) IP4_Elements v4;
 			var template (omit) IP6_Elements v6;
@@ -494,6 +499,9 @@
 			NSVC.send(SnsRequest:{sind.nsvci,
 					      ts_SNS_CONFIG(g_config.nsei, true, v4, v6)}) to vc;
 			alt {
+			[] as_ns_common_status() {
+				repeat;
+				}
 			[] NSVC.receive(SnsIndication:{sind.nsvci,
 							tr_SNS_CONFIG_ACK(g_config.nsei, omit)}) from vc {
 				/* success */
@@ -735,8 +743,10 @@
 			setverdict(fail, "Unexpected SNS from NSVC: ", sreq);
 			self.stop;
 		}
-		[] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {
+		[] NS_SP.receive(NsCtrlRequest:ForceAliveState) {
 			f_change_state(NSVC_S_ALIVE_UNBLOCKED);
+			}
+		[] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {
 			f_sendAlive();
 			Tns_test.start;
 		}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22899
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: Idac522a81f01553df52dc012cbab15e1c73c0862
Gerrit-Change-Number: 22899
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210213/203e2078/attachment.htm>


More information about the gerrit-log mailing list