pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38464?usp=email )
Change subject: library: Move IPCP templates GTPv1C_Templates.ttcn -> IPCP_Templates.ttcn ......................................................................
library: Move IPCP templates GTPv1C_Templates.ttcn -> IPCP_Templates.ttcn
We already have an IPCP_Types.ttcn, and the GTPv1C_Types from ProtocolModules dep we use doesn't actually specify any record for IPCP, so those are totally protocol independent.
Change-Id: I233292ea886e1b69a2f9aa1a159c816791b47136 --- M gbproxy/gen_links.sh M ggsn_tests/GGSN_Tests.ttcn M ggsn_tests/gen_links.sh M hnodeb/gen_links.sh M library/GTPv1C_Templates.ttcn A library/IPCP_Templates.ttcn M mme/gen_links.sh M pgw/gen_links.sh M sgsn/gen_links.sh 9 files changed, 77 insertions(+), 59 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/gbproxy/gen_links.sh b/gbproxy/gen_links.sh index c7756ec..b0bdf09 100755 --- a/gbproxy/gen_links.sh +++ b/gbproxy/gen_links.sh @@ -92,7 +92,7 @@ # IPA_Emulation + dependencies FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc " FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn -GTPv1C_Templates.ttcn IPCP_Types.ttcn " +GTPv1C_Templates.ttcn IPCP_Types.ttcn IPCP_Templates.ttcn " gen_links $DIR $FILES
ignore_pp_results diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn index 7c4c5a1..8d091f9 100644 --- a/ggsn_tests/GGSN_Tests.ttcn +++ b/ggsn_tests/GGSN_Tests.ttcn @@ -27,6 +27,7 @@ import from GTPv1C_Templates all; import from GTPv1U_Templates all; import from IPCP_Types all; + import from IPCP_Templates all; import from PAP_Types all; import from IP_Types all; import from ICMP_Types all; diff --git a/ggsn_tests/gen_links.sh b/ggsn_tests/gen_links.sh index bc17b64..45c84bd 100755 --- a/ggsn_tests/gen_links.sh +++ b/ggsn_tests/gen_links.sh @@ -58,7 +58,7 @@ gen_links $DIR $FILES
DIR=../library -FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn PAP_Types.ttcn " +FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn PAP_Types.ttcn " FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn " FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn " FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn " diff --git a/hnodeb/gen_links.sh b/hnodeb/gen_links.sh index 71265b1..ea78c83 100755 --- a/hnodeb/gen_links.sh +++ b/hnodeb/gen_links.sh @@ -65,7 +65,7 @@ FILES+="StatsD_Types.ttcn StatsD_CodecPort.ttcn StatsD_CodecPort_CtrlFunct.ttcn StatsD_CodecPort_CtrlFunctdef.cc StatsD_Checker.ttcnpp " FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn " FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn " -FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn GSM_Types.ttcn " +FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn IPCP_Templates.ttcn GSM_Types.ttcn " FILES+="SCTP_Templates.ttcn " gen_links $DIR $FILES
diff --git a/library/GTPv1C_Templates.ttcn b/library/GTPv1C_Templates.ttcn index 8eae7c0..9f963f3 100644 --- a/library/GTPv1C_Templates.ttcn +++ b/library/GTPv1C_Templates.ttcn @@ -16,6 +16,7 @@ import from GTPC_Types all; import from GTPv1C_CodecPort all; import from IPCP_Types all; +import from IPCP_Templates all; import from GSM_Types all; // RoutingAreaIdentification, CellIdentity
template (present) OCT1 gtp1_requests := ( @@ -1307,59 +1308,6 @@ return ''O; }
-template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, - template (present) uint8_t identifier, - template (present) IpcpOptionList opts) := { - code := code, - identifier := identifier, - len := ?, - options := opts -} -template (value) IpcpPacket ts_IPCP(template (value) LcpCode code, - template (value) uint8_t identifier, - template (value) IpcpOptionList opts) := { - code := code, - identifier := identifier, - len := 0, /* overwritten */ - options := opts -} -template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := { - code := IPCP_OPT_PrimaryDNS, - len := 6, - data := addr -} -template (value) IpcpOption ts_IPCP_PrimaryDns(template (value) OCT4 addr) := { - code := IPCP_OPT_PrimaryDNS, - len := 6, - data := addr -} -template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := { - code := IPCP_OPT_SecondaryDNS, - len := 6, - data := addr -} -template (value) IpcpOption ts_IPCP_SecondaryDns(template (value) OCT4 addr) := { - code := IPCP_OPT_SecondaryDNS, - len := 6, - data := addr -} -template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?, - template (present) OCT4 dns1 := ?, - template (present) OCT4 dns2 := ?) := - tr_IPCP(LCP_Configure_Ack, identifier, - { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * }); - -template (value) IpcpPacket ts_IPCP_ReqDNS(template (value) uint8_t identifier := 0) := - ts_IPCP(LCP_Configure_Request, identifier, - { ts_IPCP_PrimaryDns('00000000'O), ts_IPCP_SecondaryDns('00000000'O) }); - -template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(template (value) uint8_t identifier := 0) := - ts_IPCP(LCP_Configure_Request, identifier, - { ts_IPCP_PrimaryDns('00000000'O) }); -template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(template (value) uint8_t identifier := 0) := - ts_IPCP(LCP_Configure_Request, identifier, - { ts_IPCP_SecondaryDns('00000000'O) }); - function f_teardown_ind_IE(in template (omit) BIT1 ind) return template (omit) TearDownInd { if (istemplatekind(ind, "omit")) { return omit; diff --git a/library/IPCP_Templates.ttcn b/library/IPCP_Templates.ttcn new file mode 100644 index 0000000..bdf1a70 --- /dev/null +++ b/library/IPCP_Templates.ttcn @@ -0,0 +1,69 @@ +/* Templates for IPCP (IP Configuration Protocol) in TTCN-3 + * (C) 2017 Harald Welte laforge@gnumonks.org + * All rights reserved. + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module IPCP_Templates { +import from General_Types all; +import from Osmocom_Types all; +import from IPCP_Types all; + +template (present) IpcpPacket tr_IPCP(template (present) LcpCode code, + template (present) uint8_t identifier, + template (present) IpcpOptionList opts) := { + code := code, + identifier := identifier, + len := ?, + options := opts +} +template (value) IpcpPacket ts_IPCP(template (value) LcpCode code, + template (value) uint8_t identifier, + template (value) IpcpOptionList opts) := { + code := code, + identifier := identifier, + len := 0, /* overwritten */ + options := opts +} +template (present) IpcpOption tr_IPCP_PrimaryDns(template (present) OCT4 addr) := { + code := IPCP_OPT_PrimaryDNS, + len := 6, + data := addr +} +template (value) IpcpOption ts_IPCP_PrimaryDns(template (value) OCT4 addr) := { + code := IPCP_OPT_PrimaryDNS, + len := 6, + data := addr +} +template (present) IpcpOption tr_IPCP_SecondaryDns(template (present) OCT4 addr) := { + code := IPCP_OPT_SecondaryDNS, + len := 6, + data := addr +} +template (value) IpcpOption ts_IPCP_SecondaryDns(template (value) OCT4 addr) := { + code := IPCP_OPT_SecondaryDNS, + len := 6, + data := addr +} +template (present) IpcpPacket tr_IPCP_Ack_DNS(template (present) uint8_t identifier := ?, + template (present) OCT4 dns1 := ?, + template (present) OCT4 dns2 := ?) := + tr_IPCP(LCP_Configure_Ack, identifier, + { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * }); + +template (value) IpcpPacket ts_IPCP_ReqDNS(template (value) uint8_t identifier := 0) := + ts_IPCP(LCP_Configure_Request, identifier, + { ts_IPCP_PrimaryDns('00000000'O), ts_IPCP_SecondaryDns('00000000'O) }); + +template (value) IpcpPacket ts_IPCP_ReqDNS_Primary(template (value) uint8_t identifier := 0) := + ts_IPCP(LCP_Configure_Request, identifier, + { ts_IPCP_PrimaryDns('00000000'O) }); +template (value) IpcpPacket ts_IPCP_ReqDNS_Secondary(template (value) uint8_t identifier := 0) := + ts_IPCP(LCP_Configure_Request, identifier, + { ts_IPCP_SecondaryDns('00000000'O) }); + +} with { encode "RAW" } diff --git a/mme/gen_links.sh b/mme/gen_links.sh index dad9c23..d2b17ce 100755 --- a/mme/gen_links.sh +++ b/mme/gen_links.sh @@ -70,7 +70,7 @@ gen_links $DIR $FILES
DIR=../library -FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn " +FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn " FILES+="SGsAP_Templates.ttcn SGsAP_CodecPort.ttcn SGsAP_CodecPort_CtrlFunct.ttcn SGsAP_CodecPort_CtrlFunctDef.cc SGsAP_Emulation.ttcn DNS_Helpers.ttcn " FILES+="L3_Templates.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn " FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn S1AP_Emulation.ttcn " diff --git a/pgw/gen_links.sh b/pgw/gen_links.sh index 07907e7..ff7d1c6 100755 --- a/pgw/gen_links.sh +++ b/pgw/gen_links.sh @@ -58,7 +58,7 @@ gen_links $DIR $FILES
DIR=../library -FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn PAP_Types.ttcn " +FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn PAP_Types.ttcn " FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn " FILES+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn " FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn " diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh index 2e5d9f9..bae9a3b 100755 --- a/sgsn/gen_links.sh +++ b/sgsn/gen_links.sh @@ -96,7 +96,7 @@ FILES+="PCO_Types.ttcn GSUP_Types.ttcn GSUP_Templates.ttcn GSUP_Emulation.ttcn " FILES+="GTPv1C_CodecPort.ttcn GTPv1C_CodecPort_CtrlFunct.ttcn GTPv1C_CodecPort_CtrlFunctDef.cc GTPv1C_Templates.ttcn Osmocom_Gb_Types.ttcn " FILES+="GTPv1U_CodecPort.ttcn GTPv1U_CodecPort_CtrlFunct.ttcn GTPv1U_CodecPort_CtrlFunctDef.cc GTPv1U_Templates.ttcn " -FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn RAW_NS.ttcnpp " +FILES+="GTP_Emulation.ttcn IPCP_Types.ttcn IPCP_Templates.ttcn RAW_NS.ttcnpp " gen_links $DIR $FILES
ignore_pp_results