Change in osmo-ttcn3-hacks[master]: BSSGP_Emulation: Allow a "CreateCb" to handle unknown inbound TLLI

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/.

daniel gerrit-no-reply at lists.osmocom.org
Mon Nov 16 19:13:26 UTC 2020


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

Change subject: BSSGP_Emulation: Allow a "CreateCb" to handle unknown inbound TLLI
......................................................................

BSSGP_Emulation: Allow a "CreateCb" to handle unknown inbound TLLI

The existing BSSGP Code assumed that the TLLIs were always known "a
priori" by the test case.  With the newly-introduced create_cb,
the user can provide a function to handle any incoming messages for an
unknown TLLL.  The default handler behaves like before: fail +
terminate.

Change-Id: Ice0e145f5a6518ff79547dd851042b7965f38e00
---
M fr-net/FRNET_Tests.ttcn
M fr/FR_Tests.ttcn
M gbproxy/GBProxy_Tests.ttcn
M library/BSSGP_Emulation.ttcnpp
M pcu/SGSN_Components.ttcn
M sgsn/SGSN_Tests.ttcn
6 files changed, 45 insertions(+), 17 deletions(-)

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



diff --git a/fr-net/FRNET_Tests.ttcn b/fr-net/FRNET_Tests.ttcn
index 721dd32..87b9bd7 100644
--- a/fr-net/FRNET_Tests.ttcn
+++ b/fr-net/FRNET_Tests.ttcn
@@ -65,7 +65,8 @@
 			},
 			cell_id := base + 600 + idx
 		},
-		depth := BSSGP_DECODE_DEPTH_LLC
+		depth := BSSGP_DECODE_DEPTH_LLC,
+		create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 	};
 	return bvc;
 }
diff --git a/fr/FR_Tests.ttcn b/fr/FR_Tests.ttcn
index b220bb9..9f9b70e 100644
--- a/fr/FR_Tests.ttcn
+++ b/fr/FR_Tests.ttcn
@@ -66,7 +66,8 @@
 			},
 			cell_id := base + 600 + idx
 		},
-		depth := BSSGP_DECODE_DEPTH_LLC
+		depth := BSSGP_DECODE_DEPTH_LLC,
+		create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 	};
 	return bvc;
 }
diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 580d567..8de16d2 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -264,7 +264,8 @@
 					},
 				cell_id := 20960
 			},
-			depth := BSSGP_DECODE_DEPTH_BSSGP
+			depth := BSSGP_DECODE_DEPTH_BSSGP,
+			create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 		} }
 	};
 	g_pcu[1].cfg := {
@@ -280,7 +281,8 @@
 					},
 				cell_id := 20961
 			},
-			depth := BSSGP_DECODE_DEPTH_BSSGP
+			depth := BSSGP_DECODE_DEPTH_BSSGP,
+			create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 		} }
 	};
 	g_pcu[2].cfg := {
@@ -296,7 +298,8 @@
 					},
 				cell_id := 20962
 			},
-			depth := BSSGP_DECODE_DEPTH_BSSGP
+			depth := BSSGP_DECODE_DEPTH_BSSGP,
+			create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 		} }
 	};
 
@@ -314,7 +317,8 @@
 						},
 					cell_id := 20960
 				},
-				depth := BSSGP_DECODE_DEPTH_BSSGP
+				depth := BSSGP_DECODE_DEPTH_BSSGP,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			},
 			{
 				bvci := 210,
@@ -326,7 +330,8 @@
 						},
 					cell_id := 20961
 				},
-				depth := BSSGP_DECODE_DEPTH_BSSGP
+				depth := BSSGP_DECODE_DEPTH_BSSGP,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			},
 			{
 				bvci := 220,
@@ -338,7 +343,8 @@
 						},
 					cell_id := 20962
 				},
-				depth := BSSGP_DECODE_DEPTH_BSSGP
+				depth := BSSGP_DECODE_DEPTH_BSSGP,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			}
 		}
 	};
diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp
index cb0c82c..63e11f2 100644
--- a/library/BSSGP_Emulation.ttcnpp
+++ b/library/BSSGP_Emulation.ttcnpp
@@ -681,7 +681,8 @@
 type record BssgpBvcConfig {
 	BssgpBvci bvci,
 	BssgpCellId cell_id,
-	BssgpDecodeDepth depth
+	BssgpDecodeDepth depth,
+	BssgpCreateCallback create_cb
 };
 type record of BssgpBvcConfig BssgpBvcConfigs;
 type enumerated BssgpDecodeDepth {
@@ -693,6 +694,14 @@
 	BSSGP_DECODE_DEPTH_L3
 #endif
 };
+/* call-back function type: Called for inbound BSSGP for unknown TLLIs; could create BSSGP_ClienT_CT */
+type function BssgpCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT;
+
+/* Default Create Callback function: Fail and terminate */
+function DefaultCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT {
+	setverdict(fail, "Couldn't find Component for TLLI ", tlli);
+	mtc.stop;
+}
 
 /*
 private function f_tbl_init() runs on BSSGP_BVC_CT {
@@ -792,8 +801,7 @@
 			return ClientTable[i].comp_ref;
 		}
 	}
-	setverdict(fail, "Couldn't find Component for TLLI ", tlli);
-	mtc.stop;
+	return null;
 }
 
 private function f_tbl_idx_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_BVC_CT return integer {
@@ -987,7 +995,11 @@
 		var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
 		if (isvalue(tlli)) {
 			vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
-			f_send_bssgp_dec(dec, vc_conn, BSSGP_SP);
+			if (vc_conn == null) {
+				g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec);
+			} else {
+				f_send_bssgp_dec(dec, vc_conn, BSSGP_SP);
+			}
 		} else {
 			log("No TLLI: Broadcasting ", dec);
 			/* broadcast this message to all components */
@@ -1006,7 +1018,11 @@
 		var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
 		if (isvalue(tlli)) {
 			vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
-			f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
+			if (vc_conn == null) {
+				g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec);
+			} else {
+				f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
+			}
 		} else {
 			log("No TLLI: Broadcasting ", dec);
 			/* broadcast this message to all components */
diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn
index 5f05595..ca1dec6 100644
--- a/pcu/SGSN_Components.ttcn
+++ b/pcu/SGSN_Components.ttcn
@@ -33,7 +33,8 @@
 					},
 					cell_id := 20960
 				},
-				depth := BSSGP_DECODE_DEPTH_BSSGP
+				depth := BSSGP_DECODE_DEPTH_BSSGP,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			}
 		}
 	};
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index a602b21..0b298bb 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -334,7 +334,8 @@
 					},
 					cell_id := 20960
 				},
-				depth := BSSGP_DECODE_DEPTH_L3
+				depth := BSSGP_DECODE_DEPTH_L3,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			}
 		}
 	};
@@ -354,7 +355,8 @@
 					},
 					cell_id := 20961
 				},
-				depth := BSSGP_DECODE_DEPTH_L3
+				depth := BSSGP_DECODE_DEPTH_L3,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			}
 		}
 	};
@@ -374,7 +376,8 @@
 					},
 					cell_id := 20962
 				},
-				depth := BSSGP_DECODE_DEPTH_L3
+				depth := BSSGP_DECODE_DEPTH_L3,
+				create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
 			}
 		}
 	};

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21131
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: Ice0e145f5a6518ff79547dd851042b7965f38e00
Gerrit-Change-Number: 21131
Gerrit-PatchSet: 5
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201116/f571d446/attachment.htm>


More information about the gerrit-log mailing list