From a059f9ee8d09534799991e168cbbb754f99789e2 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Fri, 23 Jul 2021 12:40:46 +0200 Subject: [PATCH 1/5] Initial --- ItsBtp_TestCases.ttcn | 390 ++++++++++++++++++++++++++ ItsBtp_TestControl.ttcn | 28 ++ lib/LibItsBtp_EncdecDeclarations.ttcn | 30 ++ lib/LibItsBtp_Functions.ttcn | 237 ++++++++++++++++ lib/LibItsBtp_Pixits.ttcn | 49 ++++ lib/LibItsBtp_Templates.ttcn | 204 ++++++++++++++ lib/LibItsBtp_TestSystem.ttcn | 117 ++++++++ lib/LibItsBtp_TypesAndValues.ttcn | 178 ++++++++++++ lib/module.mk | 6 + module.mk | 33 +++ 10 files changed, 1272 insertions(+) create mode 100755 ItsBtp_TestCases.ttcn create mode 100755 ItsBtp_TestControl.ttcn create mode 100755 lib/LibItsBtp_EncdecDeclarations.ttcn create mode 100755 lib/LibItsBtp_Functions.ttcn create mode 100755 lib/LibItsBtp_Pixits.ttcn create mode 100755 lib/LibItsBtp_Templates.ttcn create mode 100755 lib/LibItsBtp_TestSystem.ttcn create mode 100755 lib/LibItsBtp_TypesAndValues.ttcn create mode 100755 lib/module.mk create mode 100755 module.mk diff --git a/ItsBtp_TestCases.ttcn b/ItsBtp_TestCases.ttcn new file mode 100755 index 0000000..d7f3b1d --- /dev/null +++ b/ItsBtp_TestCases.ttcn @@ -0,0 +1,390 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsBTP/ItsBtp_TestCases.ttcn $ + * $Id: ItsBtp_TestCases.ttcn 2655 2017-01-26 10:46:08Z filatov $ + * @desc Testcases for Basic Transport Protocol (TP version: 0.0.3) + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module ItsBtp_TestCases { + + // LibCommon + import from LibCommon_Sync all; + import from LibCommon_Time all; +// import from LibCommon_VerdictControl all; + + // LibIts + import from LibItsBtp_TestSystem all; + import from LibItsBtp_Functions all; + import from LibItsBtp_Templates all; +// import from LibItsBtp_Pixits all; +// import from LibItsBtp_TypesAndValues all; +// import from LibItsCommon_Functions all; + + group btpPacketGeneration { + + group btpBtpA { + + /** + * @desc Checks that BTP-A packets is well-formatted + *
        
+         * PICS Selection: none 
+         * Initial conditions:
+         *  with {
+         *      the IUT being in the "initial state"
+         *  }
+         * Expected behaviour:
+         *  ensure that {
+         *      when {
+         *          the IUT is requested to send a BTP packet via a BTP-data request
+         *              containing BTP Type
+         *                  indicationg value 'BTP-A'
+         *              containing Source PorT
+         *                  indicating value 'SOURCE_PORT'
+         *              containing Destination Port
+         *                  indicating value 'DESTINATION_PORT'
+         *      }
+         *      then {
+         *          the IUT sends a valid BTP-A packet
+         *              containing source port
+         *                  indicating 'SOURCE_PORT',
+         *              containing destination port
+         *                  indicating 'DESTINATION_PORT',
+         *              containing the Upper Layer payload
+         *      }
+         *  }
+         * 
+ * + * @version 0.0.3 + * @see ETSI TS 102 870-2 v1.1.1 TP/BTP/PGA/BV/01 + */ + testcase TC_BTP_PGA_BV_01() runs on ItsBtp system ItsBtpSystem { + + // Local variables + + // Test control + + // Test component configuration + f_cfUp(); + + // Test adapter configuration + + // Preamble + f_prInitialState(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_utTriggerEvent(m_generateBtpA(f_getBtpDstPort(), f_getBtpSrcPort())); + tc_ac.start; + alt { + [] btpPort.receive( mw_btpInd( mw_btpA (f_getBtpDstPort(), f_getBtpSrcPort(), *))) { + tc_ac.stop; + log("*** TC_BTP_PGA_BV_01: PASS: BTP-A packet correclty received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + + [] tc_ac.timeout { + log("*** TC_BTP_PGA_BV_01: INCONC: Expected BTP packet not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poDefault(); + f_cfDown(); + + }// end TC_BTP_PGA_BV_0 + + } // end btpBtpA + + group btpBtpB { + + /** + * @desc Checks that BTP-B packets is well-formatted if Destination Port info is provided + *
        
+         * PICS Selection: none 
+         * Initial conditions:
+         *  with {
+         *      the IUT being in the "initial state"
+         *  }
+         * Expected behaviour:
+         *  ensure that {
+         *      when {
+         *          the IUT is requested to send a BTP packet via a BTP-data request
+         *              containing BTP Type
+         *                  indicationg value 'BTP-B'
+         *              containing Destination Port
+         *                  indicating value 'DESTINATION_PORT'
+         *              containing Destination Port Info
+         *                  indicating value 'DESTINATION_PORT_INFO'
+         *      }
+         *      then {
+         *          the IUT sends a valid BTP-B packet
+         *              containing Destination Port
+         *                  indicating value 'DESTINATION_PORT'
+         *              containing Destination Port Info
+         *                  indicating value 'DESTINATION_PORT_INFO'
+         *              containing the Upper Layer payload
+         *      }
+         *  }
+         * 
+ * + * @version 0.0.3 + * @see ETSI TS 102 870-2 v1.1.1 TP/BTP/PGB/BV/01 + */ + testcase TC_BTP_PGB_BV_01() runs on ItsBtp system ItsBtpSystem { + + // Local variables + + // Test control + + // Test component configuration + f_cfUp(); + + // Test adapter configuration + + // Preamble + f_prInitialState(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_utTriggerEvent(m_generateBtpB(f_getBtpDstPort(), f_getBtpDstPortInfo())); + tc_ac.start; + alt { + [] btpPort.receive( mw_btpInd( mw_btpB (f_getBtpDstPort(), f_getBtpDstPortInfo(), *))) { + tc_ac.stop; + log("*** TC_BTP_PGB_BV_01: PASS: BTP-B packet correclty received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + + [] tc_ac.timeout { + log("*** TC_BTP_PGB_BV_01: INCONC: Expected BTP packet not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poDefault(); + f_cfDown(); + + }// end TC_BTP_PGB_BV_01 + + /** + * @desc Checks that BTP-B packets are well-formatted if no Destination Port Info is provided + *
        
+         * PICS Selection: none 
+         * Initial conditions:
+         *  with {
+         *      the IUT being in the "initial state"
+         *  }
+         * Expected behaviour:
+         *  ensure that {
+         *      when {
+         *          the IUT is requested to send a BTP packet via a BTP-data request
+         *              containing BTP Type
+         *                  indicationg value 'BTP-B'
+         *              containing Destination Port
+         *                  indicating value 'DESTINATION_PORT'
+         *              not containing Destination Port Info parameter
+         *      }
+         *      then {
+         *          the IUT sends a valid BTP-B packet
+         *              containing Destination Port
+         *                  indicating value 'DESTINATION_PORT'
+         *              containing Destination Port Info
+         *                  indicating '0'
+         *              containing the Upper Layer payload
+         *      }
+         *  }
+         * 
+ * + * @version 0.0.3 + * @see ETSI TS 102 870-2 v1.1.1 TP/BTP/PGB/BV/02 + */ + testcase TC_BTP_PGB_BV_02() runs on ItsBtp system ItsBtpSystem { + + // Local variables + + // Test control + + // Test component configuration + f_cfUp(); + + // Test adapter configuration + + // Preamble + f_prInitialState(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_utTriggerEvent(m_generateBtpB(f_getBtpDstPort(), 0)); + tc_ac.start; + alt { + [] btpPort.receive( mw_btpInd( mw_btpB (f_getBtpDstPort(), 0, *))) { + tc_ac.stop; + log("*** TC_BTP_PGB_BV_02: PASS: BTP-B packet correclty received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + + [] tc_ac.timeout { + log("*** TC_BTP_PGB_BV_02: INCONC: Expected BTP packet not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poDefault(); + f_cfDown(); + + }// end TC_BTP_PGB_BV_02 + + } // end btpBtpB + + } // end btpPacketGeneration + + group btpPacketProcessing { + + group btpValid { + + /** + * @desc Checks that BTP passes a valid BTP-A packets to the upper protocol entity + *
        
+         * PICS Selection: none 
+         * Initial conditions:
+         *  with {
+         *      the IUT being in the "initial state"
+         *  }
+         * Expected behaviour:
+         *  ensure that {
+         *      when {
+         *          the IUT receives a valid BTP-A packet
+         *              containing Source Port
+         *                  indicating 'SOURCE_PORT'
+         *              containing Destination Port
+         *                  indicating'DESTINATION_PORT'
+         *              containing the payload
+         *      }
+         *      then {
+         *          the IUT passes the payload to the upper layer
+         *      }
+         *  }
+         * 
+ * + * @version 0.0.3 + * @see ETSI TS 102 870-2 v1.1.1 TP/BTP/PP/BV/01 + */ + testcase TC_BTP_PP_BV_01() runs on ItsBtp system ItsBtpSystem { + + // Local variables + var BtpReq v_btpReq; + var integer i; + + // Test control + + // Test component configuration + f_cfUp(); + + // Test adapter configuration + + // Preamble + f_prInitialState(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_btpReq := valueof(m_btpReq( m_btpAWithPorts (f_getBtpDstPort(), f_getBtpSrcPort(), f_getBtpPayload()))); + btpPort.send(v_btpReq); + + f_sleep(PX_TNOAC); + for(i:=0; i < lengthof(vc_utEvents) and not match(v_btpReq.msgOut.payload, vc_utEvents[i].rawPayload); i:=i+1) { + // empty on purpose + } + if(i < lengthof(vc_utEvents)) { + log("*** " & testcasename() & ": PASS: BTP was transmitted to upper layer***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + else { + log("*** " & testcasename() & ": FAIL: BTP was not transmitted to upper layer***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + + // Postamble + f_poDefault(); + f_cfDown(); + + }// end TC_BTP_PP_BV_01 + + /** + * @desc Checks that BTP passes a valid BTP-B packets to the upper protocol entity + *
        
+         * PICS Selection: none 
+         * Initial conditions:
+         *  with {
+         *      the IUT being in the "initial state"
+         *  }
+         * Expected behaviour:
+         *  ensure that {
+         *      when {
+         *          the IUT receives a valid BTP-B packet
+         *              containing Destination Port
+         *                  indicating'DESTINATION_PORT'
+         *              containing Destination Port Info
+         *                  indicating'DESTINATION_PORT_INFO'
+         *              containing the payload
+         *      }
+         *      then {
+         *          the IUT passes the payload to the upper layer
+         *      }
+         *  }
+         * 
+ * + * @version 0.0.3 + * @see ETSI TS 102 870-2 v1.1.1 TP/BTP/PP/BV/02 + */ + testcase TC_BTP_PP_BV_02() runs on ItsBtp system ItsBtpSystem { + + // Local variables + var BtpReq v_btpReq; + var integer i; + + // Test control + + // Test component configuration + f_cfUp(); + + // Test adapter configuration + + // Preamble + f_prInitialState(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_btpReq := valueof(m_btpReq( m_btpBWithPorts (f_getBtpDstPort(), f_getBtpDstPortInfo(), f_getBtpPayload()))); + btpPort.send(v_btpReq); + + f_sleep(PX_TNOAC); + for(i:=0; i < lengthof(vc_utEvents) and not match(v_btpReq.msgOut.payload, vc_utEvents[i].rawPayload); i:=i+1) { + // empty on purpose + } + if(i < lengthof(vc_utEvents)) { + log("*** " & testcasename() & ": PASS: BTP was transmitted to upper layer***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + else { + log("*** " & testcasename() & ": FAIL: BTP was not transmitted to upper layer***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + + // Postamble + f_poDefault(); + f_cfDown(); + + }// end TC_BTP_PP_BV_02 + + } // end btpValid + + } // end btpPacketProcessing + +} // end ItsBtp_TestCases diff --git a/ItsBtp_TestControl.ttcn b/ItsBtp_TestControl.ttcn new file mode 100755 index 0000000..8d56169 --- /dev/null +++ b/ItsBtp_TestControl.ttcn @@ -0,0 +1,28 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsBTP/ItsBtp_TestControl.ttcn $ + * $Id: ItsBtp_TestControl.ttcn 2655 2017-01-26 10:46:08Z filatov $ + * @desc Test Control file for Basic Transport Protocol + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module ItsBtp_TestControl { + + // ATS BTP + import from ItsBtp_TestCases {testcase all}; + + // Test Execution + control { + + execute(TC_BTP_PGA_BV_01()); + execute(TC_BTP_PGB_BV_01()); + execute(TC_BTP_PGB_BV_02()); + execute(TC_BTP_PP_BV_01()); + execute(TC_BTP_PP_BV_02()); + + } + +} // end ItsBtp_TestControl diff --git a/lib/LibItsBtp_EncdecDeclarations.ttcn b/lib/LibItsBtp_EncdecDeclarations.ttcn new file mode 100755 index 0000000..e4f6332 --- /dev/null +++ b/lib/LibItsBtp_EncdecDeclarations.ttcn @@ -0,0 +1,30 @@ +module LibItsBtp_EncdecDeclarations { + + // LibItsBtp + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_TestSystem all; + + /* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016) + external function fx_dec_BtpPayload (inout bitstring b, out BtpPayload p) return integer + with {extension "prototype(sliding) decode(LibItsBtp)"} + */ + + external function fx_enc_BtpReq (BtpReq p) return bitstring + with {extension "prototype(convert) encode(LibIts_Interface)"} + + external function fx_enc_BtpInd (BtpInd p) return bitstring + with {extension "prototype(convert) encode(LibIts_Interface)"} + + external function fx_dec_BtpInd (inout bitstring b, out BtpInd p) return integer + with {extension "prototype(sliding) decode(LibIts_Interface)"} + + external function fx_dec_BtpReq (inout bitstring b, out BtpReq p) return integer + with {extension "prototype(sliding) decode(LibIts_Interface)"} + + external function fx_enc_BtpPacket (BtpPacket p) return bitstring + with {extension "prototype(convert) encode(LibIts_Interface)"} + + external function fx_dec_BtpPacket (inout bitstring b, out BtpPacket p) return integer + with {extension "prototype(sliding) decode(LibIts_Interface)"} + +} // End of module LibItsBtp_EncdecDeclarations diff --git a/lib/LibItsBtp_Functions.ttcn b/lib/LibItsBtp_Functions.ttcn new file mode 100755 index 0000000..fab6859 --- /dev/null +++ b/lib/LibItsBtp_Functions.ttcn @@ -0,0 +1,237 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Functions.ttcn $ + * $Id: LibItsBtp_Functions.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Module containing functions for basic Transport Protocol + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ + + module LibItsBtp_Functions { + + // LibCommon + import from LibCommon_Sync all; + + // LibItsCommon + import from LibItsCommon_TypesAndValues all; + + // LibItsBtp + import from LibItsBtp_TestSystem all; + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Templates all; + import from LibItsBtp_Pixits all; + + group utFuntions { + + /** + * @desc Requests to bring the IUT in an initial state + * @param p_init The initialisation to trigger. + */ + function f_utInitializeIut(template (value) UtBtpInitialize p_init) runs on ItsBtp { + + //deactivate btpPort default alts + vc_btpDefaultActive := false; + + utPort.send(p_init); + tc_wait.start; + alt { + [] utPort.receive(UtBtpResults: { utBtpInitializeResult := true}) { + tc_wait.stop; + log("*** f_utInitializeIut: INFO: IUT initialized ***"); + } + [] utPort.receive { + tc_wait.stop; + log("*** f_utInitializeIut: INFO: IUT could not be initialized ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + [] tc_wait.timeout { + log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + } + + //activate btpPort default alts + vc_btpDefaultActive := true; + + } + + /** + * @desc Triggers event from the application layer + * @param p_event The event to trigger. + */ + function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp { + + //deactivate btpPort default alts + vc_btpDefaultActive := false; + + utPort.send(p_event); + alt { + [] utPort.receive(UtBtpResults: { utBtpTriggerResult := true }) { + tc_wait.stop; + } + [] utPort.receive { + tc_wait.stop; + } + [] tc_wait.timeout { + } + } + + //activate btpPort default alts + vc_btpDefaultActive := true; + + } + + } // End of group utFunctions + + group configurationFunctions { + + /** + * @desc Setups default configuration + */ + function f_cfUp() runs on ItsBtp system ItsBtpSystem { + + map(self:utPort, system:utPort); + map(self:btpPort, system:btpPort); + f_connect4SelfOrClientSync(); + + } // end f_cfUp + + /** + * @desc Deletes default configuration + */ + function f_cfDown() runs on ItsBtp system ItsBtpSystem { + + unmap(self:utPort, system:utPort); + unmap(self:btpPort, system:btpPort); + f_disconnect4SelfOrClientSync(); + + } // end f_cfDown + + } // end configurationFunctions + + group btpAltsteps { + + /** + * @desc The base default. + */ + altstep a_default() runs on ItsBtp { + + [vc_btpDefaultActive] btpPort.receive { + log("*** a_default: ERROR: Received an unexpected message ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + [] tc_wait.timeout { + log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + [] tc_ac.timeout { + log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + [] a_shutdown() { + f_poDefault(); + f_cfDown(); + log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); + stop; + } + } + + /** + * @desc The default for handling upper tester messages. + */ + altstep a_utDefault() runs on ItsBtp { + var UtBtpEventInd v_ind; + [vc_utDefaultActive] utPort.receive(UtBtpEventInd:?) -> value v_ind { + //store every upper tester indication received + vc_utEvents[lengthof(vc_utEvents)] := v_ind; + repeat; + } + [vc_utDefaultActive] utPort.receive { + log("*** " & testcasename() & ": INFO: Received unhandled/unknown UT message from IUT ***"); + repeat; + } + } + + } //end btpAltsteps + + group preambles { + + /** + * @desc The default preamble. + */ + function f_prDefault() runs on ItsBtp { + activate(a_default()); + activate(a_utDefault()); + } + + /** + * @desc Brings the IUT into an initial state. + */ + function f_prInitialState() runs on ItsBtp { + + f_utInitializeIut(m_btpInitialize); + f_prDefault(); + + } + + } // end of group preambles + + + group postambles { + + /** + * @desc The default postamble. + */ + function f_poDefault() runs on ItsBtp { + //empty + } + + } // end postambles + + group getFunctions { + + /** + * @desc Gets the BTP source port of the IUT. + * @return BTP source port ID + */ + function f_getBtpSrcPort() return BtpPortId { + return PX_SOURCE_PORT; + } + + /** + * @desc Gets the BTP destination port of the IUT. + * @return BTP destination port ID + */ + function f_getBtpDstPort() return BtpPortId { + return PX_DESTINATION_PORT; + } + + /** + * @desc Gets a unknown BTP destination port of the IUT. + * @return Unknown BTP destination port ID + */ + function f_getBtpUnknownDstPort() return BtpPortId { + return PX_UNKNOWN_DESTINATION_PORT; + } + + /** + * @desc Gets the BTP destination port info of the IUT. + * @return BTP destination port info + */ + function f_getBtpDstPortInfo() return BtpPortId { + return PX_DESTINATION_PORT_INFO; + } + + /** + * @desc Gets the BTP payload to use. + * @return BTP payload + */ + function f_getBtpPayload() return BtpRawPayload { + return PX_PAYLOAD; + } + + } // end getFunctions +} // end LibItsBtp_Functions diff --git a/lib/LibItsBtp_Pixits.ttcn b/lib/LibItsBtp_Pixits.ttcn new file mode 100755 index 0000000..cd8dfc1 --- /dev/null +++ b/lib/LibItsBtp_Pixits.ttcn @@ -0,0 +1,49 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Pixits.ttcn $ + * $Id: LibItsBtp_Pixits.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Basic Transport Protocol Templates + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibItsBtp_Pixits { + + // LibIts + import from LibItsBtp_TypesAndValues all; + + + /** + * @desc BTP source port of the IUT + * + */ + modulepar BtpPortId PX_SOURCE_PORT := 0; + + /** + * @desc BTP Destination port of the IUT + * + */ + modulepar BtpPortId PX_DESTINATION_PORT := 0; + + /** + * @desc BTP Unknown Destination port of the IUT + * + */ + modulepar BtpPortId PX_UNKNOWN_DESTINATION_PORT := 0; + + /** + * @desc BTP Destination port Info of the IUT + * + */ + modulepar BtpPortId PX_DESTINATION_PORT_INFO := 0; + + /** + * @desc Payload to be sent to the IUT for testing matter + * + */ + modulepar BtpRawPayload PX_PAYLOAD := '0102030405'O ; + + +} // end LibItsBtp_Pixits \ No newline at end of file diff --git a/lib/LibItsBtp_Templates.ttcn b/lib/LibItsBtp_Templates.ttcn new file mode 100755 index 0000000..fe93038 --- /dev/null +++ b/lib/LibItsBtp_Templates.ttcn @@ -0,0 +1,204 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Templates.ttcn $ + * $Id: LibItsBtp_Templates.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Basic Transport Protocol Templates + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibItsBtp_Templates { + + // LibIts + import from LibItsBtp_TestSystem all; + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Pixits all; + import from LibItsCommon_TypesAndValues all; + + group btpPrimitivesTemplates { + + /** + * @desc Send template for BTP packet (BtpPort Primitive) + * @param p_btpPkt BTP Packet to be sent + */ + template (value) BtpReq m_btpReq( + template (value) BtpPacket p_btpPkt + ) := { + msgOut := p_btpPkt + } + + /** + * @desc Receive template for BTP packet (BtpPort Primitive) + * @param p_btpPkt BTP Packet to be received + */ + template BtpInd mw_btpInd( + template (present) BtpPacket p_btpPkt + ) := { + msgIn := p_btpPkt + } + + group utPrimitives { + + /** + * @desc Initializes the BTP IUT. + */ + template (value) UtBtpInitialize m_btpInitialize := { + hashedId8 := '0000000000000000'O + } + + /** + * @desc Generate a BTP A packet + * @param p_destPort The destination port + * @param p_srcPort The source port + */ + template (value) UtBtpTrigger m_generateBtpA(in BtpPortId p_destPort, in BtpPortId p_srcPort) := { + btpA := { + btpAHeader := { + destinationPort := p_destPort, + sourcePort := p_srcPort + } + } + } + + /** + * @desc Generate a BTP B packet + * @param p_destPort The destination port + * @param p_destPortInfo The destination port information + */ + template (value) UtBtpTrigger m_generateBtpB(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := { + btpB := { + btpBHeader := { + destinationPort := p_destPort, + destinationPortInfo := p_destPortInfo + } + } + } + + } // end utPrimitives + + } // btpPrimitivesTemplates + + group btpPduTemplates { + + /** + * @desc Send template for BTP-A packet + * @param p_destPort Destination port + * @param p_srcPort Source port + * @param p_payload Payload + */ + template (value) BtpPacket m_btpA ( + template (value) BtpRawPayload p_payload + ):= { + header := { + btpAHeader := { + destinationPort := PX_DESTINATION_PORT, + sourcePort := PX_SOURCE_PORT + } + }, + payload := p_payload + } + + /** + * @desc Send template for BTP-B packet + * @param p_destPort Destination port + * @param p_destPortInfo Destination port information + * @param p_payload Payload + */ + template( value) BtpPacket m_btpB ( + template (value) BtpRawPayload p_payload + ) := { + header := { + btpBHeader := { + destinationPort := PX_DESTINATION_PORT, + destinationPortInfo := 0 + } + }, + payload := p_payload + } + + /** + * @desc Send template for BTP-A packet with port parameters + * @param p_destPort Destination port + * @param p_srcPort Source port + * @param p_payload Payload + */ + template (value) BtpPacket m_btpAWithPorts ( + template (value) BtpPortId p_destPort, + template (value) BtpPortId p_srcPort, + template (value) BtpRawPayload p_payload + ):= { + header := { + btpAHeader := { + destinationPort := p_destPort, + sourcePort := p_srcPort + } + }, + payload := p_payload + } + + /** + * @desc Send template for BTP-B packet with port parameters + * @param p_destPort Destination port + * @param p_destPortInfo Destination port information + * @param p_payload Payload + */ + template( value) BtpPacket m_btpBWithPorts ( + template (value) BtpPortId p_destPort, + template (value) BtpPortInfo p_destPortInfo, + template (value) BtpRawPayload p_payload + ) := { + header := { + btpBHeader := { + destinationPort := p_destPort, + destinationPortInfo := p_destPortInfo + } + }, + payload := p_payload + } + + /** + * @desc Receive template for BTP-A packet + * @param p_destPort Destination port + * @param p_srcPort Source port + * @param p_payload Payload + */ + template BtpPacket mw_btpA ( + template (present) BtpPortId p_destPort, + template (present) BtpPortId p_srcPort, + template BtpRawPayload p_payload + ) := { + header := { + btpAHeader := { + destinationPort := p_destPort, + sourcePort := p_srcPort + } + }, + payload := p_payload + } + + /** + * @desc Receive template for BTP-B packet + * @param p_destPort Destination port + * @param p_destPortInfo Destination port information + * @param p_payload Payload + */ + template BtpPacket mw_btpB ( + template (present) BtpPortId p_destPort, + template (present) BtpPortInfo p_destPortInfo, + template BtpRawPayload p_payload + ) := { + header := { + btpBHeader := { + destinationPort := p_destPort, + destinationPortInfo := p_destPortInfo + } + }, + payload := p_payload + } + + } // end btpPduTemplates + + +} // end LibItsBtp_Templates diff --git a/lib/LibItsBtp_TestSystem.ttcn b/lib/LibItsBtp_TestSystem.ttcn new file mode 100755 index 0000000..39a3ca0 --- /dev/null +++ b/lib/LibItsBtp_TestSystem.ttcn @@ -0,0 +1,117 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_TestSystem.ttcn $ + * $Id: LibItsBtp_TestSystem.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Test System module for ITS BTP + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibItsBtp_TestSystem { + + // LibCommon +// import from LibCommon_Time {modulepar all}; +// import from LibCommon_Sync all; + + // LibIts + import from LibItsCommon_TestSystem all; + import from LibItsCommon_TypesAndValues all; + import from LibItsBtp_TypesAndValues all; + + group portDefinitions { + + /** + * @desc Upper Tester port + */ + type port UpperTesterPort message { + out + UtBtpInitialize, UtBtpTrigger; + in + UtBtpResults, UtBtpEventInd; + } // end UpperTesterPort + + } // end portDefinitions + + group interfacePorts { + + group networkAndTransportPorts { + + group nt1Ports { + + /** + * @desc NT1 BTP Port (BTP/GeoNet/G5) + */ + type port BtpPort message { + in BtpInd; + out BtpReq; + } // end BtpPort + + } // End of group nt1Ports + + } // End of group networkAndTransportPorts + + } // End of group interfacePorts + + group componentDefinitions { + + /** + * @desc ITS System Adapter + */ + type component ItsBtpSystem { + + port UpperTesterPort utPort; + + // NT1 ports + port BtpPort btpPort; + + } // end component ItsAdapter + + } // End of group componentDefinitions + + /** + * @desc Test component for ITS Network and Transport layer + */ + type component ItsBtp extends ItsBaseComponent { + + port UpperTesterPort utPort; + + // NT1 ports + port BtpPort btpPort; + + // timers + + var UtBtpEventIndList vc_utEvents := {}; + + var boolean vc_utDefaultActive := true; + var boolean vc_btpDefaultActive := true; + + } // End of component ItsBtp + + group networkAndTransportPrimitives { + + group nt1Primitives { + + /** + * @desc NT1 BTP Indication Primitive + */ + type record BtpInd { + BtpPacket msgIn + } + + /** + * @desc NT1 BTP Request Primitive + */ + type record BtpReq { + BtpPacket msgOut + } + + } // end nt1Primitives + + } // End of group networkAndTransportPrimitives + with { + encode "LibIts_Interface" + } // end interfacePrimitives + +} // End of module LibItsBtp_TestSystem diff --git a/lib/LibItsBtp_TypesAndValues.ttcn b/lib/LibItsBtp_TypesAndValues.ttcn new file mode 100755 index 0000000..7be3626 --- /dev/null +++ b/lib/LibItsBtp_TypesAndValues.ttcn @@ -0,0 +1,178 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_TypesAndValues.ttcn $ + * $Id: LibItsBtp_TypesAndValues.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Module containing types and values for Basic Transport Protocol + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibItsBtp_TypesAndValues { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + + type octetstring BtpRawPayload; + + group btpPdus { + + /** + * @desc BTP Packet + * @see ETSI TS 102 636-5-1 chapter 6 + * @member header + * @member payload + */ + type record BtpPacket { + BtpHeader header, + BtpRawPayload payload optional + } + with { + encode "LibIts_Interface" + variant "FIELDORDER(msb)" + } + + } // end btpPdus + + group btpHeaders { + + /** + * @desc BTP Header + * @see ETSI TS 102 636-5-1 chapter 7.1 + * @member btpAHeader + * @member btpBHeader + */ + type union BtpHeader { + BtpAHeader btpAHeader, + BtpBHeader btpBHeader + } with { + variant "FIELDORDER(msb)" + } + + + /** + * @desc BTP-A Header + * @see ETSI TS 102 636-5-1 chapter 7.2 + * @member destinationPort + * @member sourcePort + */ + type record BtpAHeader { + BtpPortId destinationPort, + BtpPortId sourcePort + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc BTP-B Header + * @see ETSI TS 102 636-5-1 chapter 7.3 + * @member destinationPort + * @member destinationPortInfo + */ + type record BtpBHeader { + BtpPortId destinationPort, + BtpPortInfo destinationPortInfo + } with { + variant "FIELDORDER(msb)" + } + + + /** + * @desc BTP Port ID + * @see ETSI TS 102 636-5-1 chapter 7.3.2 + */ + type UInt16 BtpPortId; + + /** + * @desc BTP-B Port info + * @see ETSI TS 102 636-5-1 chapter 7.3.2 + */ + type UInt16 BtpPortInfo; + + } // end btpHeaders + + group utPrimitives { + + group utCommonPrimitives { + + /** + * @desc Upper Tester message to initialize IUT + * @member hashedId8 In case of secured mode set, hashedId8 indicate which certificate the IUT shall use + */ + type record UtBtpInitialize { + Oct8 hashedId8 + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc Upper Tester results message of the Btp IUT + * @member utBtpInitialize - + * @member utBtpTriggerResult - + */ + type union UtBtpResults { + boolean utBtpInitializeResult, + boolean utBtpTriggerResult + } with { + variant "" + } + + /** + * @desc UT primitives for BTP + * @member btpA - + * @member btpB - + */ + type union UtBtpTrigger { + GenerateBtpA btpA, + GenerateBtpB btpB + } with { + variant "" + } + + /** + * @desc Upper Tester message to request triggering of an BTPA message at IUT + */ + type record GenerateBtpA { + BtpAHeader btpAHeader + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc Upper Tester message to request triggering of an BTPB message at IUT + */ + type record GenerateBtpB { + BtpBHeader btpBHeader + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc Upper Tester message to check event/status on BTP IUT + */ + type record UtBtpEventInd { + BtpRawPayload rawPayload + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc List of Upper Tester messages to check event/status on CAM IUT + */ + type record of UtBtpEventInd UtBtpEventIndList; + + } + + } // end utPrimitives + with { + variant "" + encode "UpperTester" + } + +} with { + variant "" + encode "LibItsBtp" +} + diff --git a/lib/module.mk b/lib/module.mk new file mode 100755 index 0000000..f1c9679 --- /dev/null +++ b/lib/module.mk @@ -0,0 +1,6 @@ +sources := LibItsBtp_EncdecDeclarations.ttcn \ + LibItsBtp_Functions.ttcn \ + LibItsBtp_Pixits.ttcn \ + LibItsBtp_Templates.ttcn \ + LibItsBtp_TestSystem.ttcn \ + LibItsBtp_TypesAndValues.ttcn diff --git a/module.mk b/module.mk new file mode 100755 index 0000000..d1519fd --- /dev/null +++ b/module.mk @@ -0,0 +1,33 @@ +sources := \ + ItsBtp_TestCases.ttcn \ + ItsBtp_TestControl.ttcn \ + +modules := lib \ + ../LibCommon \ + ../LibIts \ + ../AtsIPv6OverGeoNetworking/lib \ + ../AtsGeoNetworking/lib \ + ../AtsSecurity/lib \ + /ccsrc/Ports/LibIts_ports \ + /ccsrc/Ports/LibIts_ports/BTP_ports \ + /ccsrc/Ports/LibIts_ports/GN_ports \ + /ccsrc/Ports/LibIts_ports/IPv6oGN_ports \ + /ccsrc/EncDec \ + /ccsrc/Framework \ + /ccsrc/Externals \ + /ccsrc/loggers \ + /ccsrc/geospacial \ + /ccsrc/Asn1c \ + /ccsrc/Protocols/BTP \ + /ccsrc/Protocols/GeoNetworking \ + /ccsrc/Protocols/UpperTester \ + /ccsrc/Protocols/Security \ + /ccsrc/Protocols/Pcap \ + /ccsrc/geospacial + +# ../../ccsrc/Protocols/BTP \ +# ../../ccsrc/Protocols/Http \ +# ../../ccsrc/Protocols/DENM \ +# ../../ccsrc/Protocols/IVIM \ +# ../../ccsrc/Protocols/MapemSpatem \ +# ../../ccsrc/Protocols/SremSsem \ -- GitLab From 30a18035ac19012c9ea94e54bbaebdc33cdd7d0c Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Thu, 9 Dec 2021 11:17:15 +0100 Subject: [PATCH 2/5] Remove execution rights on non executable files --- ItsBtp_TestCases.ttcn | 0 ItsBtp_TestControl.ttcn | 0 lib/LibItsBtp_EncdecDeclarations.ttcn | 0 lib/LibItsBtp_Functions.ttcn | 0 lib/LibItsBtp_Pixits.ttcn | 0 lib/LibItsBtp_Templates.ttcn | 0 lib/LibItsBtp_TestSystem.ttcn | 0 lib/LibItsBtp_TypesAndValues.ttcn | 0 lib/module.mk | 0 module.mk | 0 10 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 ItsBtp_TestCases.ttcn mode change 100755 => 100644 ItsBtp_TestControl.ttcn mode change 100755 => 100644 lib/LibItsBtp_EncdecDeclarations.ttcn mode change 100755 => 100644 lib/LibItsBtp_Functions.ttcn mode change 100755 => 100644 lib/LibItsBtp_Pixits.ttcn mode change 100755 => 100644 lib/LibItsBtp_Templates.ttcn mode change 100755 => 100644 lib/LibItsBtp_TestSystem.ttcn mode change 100755 => 100644 lib/LibItsBtp_TypesAndValues.ttcn mode change 100755 => 100644 lib/module.mk mode change 100755 => 100644 module.mk diff --git a/ItsBtp_TestCases.ttcn b/ItsBtp_TestCases.ttcn old mode 100755 new mode 100644 diff --git a/ItsBtp_TestControl.ttcn b/ItsBtp_TestControl.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_EncdecDeclarations.ttcn b/lib/LibItsBtp_EncdecDeclarations.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_Functions.ttcn b/lib/LibItsBtp_Functions.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_Pixits.ttcn b/lib/LibItsBtp_Pixits.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_Templates.ttcn b/lib/LibItsBtp_Templates.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_TestSystem.ttcn b/lib/LibItsBtp_TestSystem.ttcn old mode 100755 new mode 100644 diff --git a/lib/LibItsBtp_TypesAndValues.ttcn b/lib/LibItsBtp_TypesAndValues.ttcn old mode 100755 new mode 100644 diff --git a/lib/module.mk b/lib/module.mk old mode 100755 new mode 100644 diff --git a/module.mk b/module.mk old mode 100755 new mode 100644 -- GitLab From 5b06c2f6372bcf06210b905471854d37b40c8f23 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 14 Dec 2021 13:35:37 +0100 Subject: [PATCH 3/5] Separate typing and test system --- ItsBtp_TestCases.ttcn | 2 +- lib/LibItsBtp_EncdecDeclarations.ttcn | 1 - lib/LibItsBtp_Functions.ttcn | 237 -------------------------- lib/LibItsBtp_Templates.ttcn | 1 - lib/LibItsBtp_TestSystem.ttcn | 117 ------------- lib/LibItsBtp_TypesAndValues.ttcn | 25 +++ lib/module.mk | 2 - module.mk | 16 +- 8 files changed, 32 insertions(+), 369 deletions(-) delete mode 100644 lib/LibItsBtp_Functions.ttcn delete mode 100644 lib/LibItsBtp_TestSystem.ttcn diff --git a/ItsBtp_TestCases.ttcn b/ItsBtp_TestCases.ttcn index d7f3b1d..c2f400c 100644 --- a/ItsBtp_TestCases.ttcn +++ b/ItsBtp_TestCases.ttcn @@ -17,11 +17,11 @@ module ItsBtp_TestCases { // import from LibCommon_VerdictControl all; // LibIts + import from LibItsBtp_TypesAndValues all; import from LibItsBtp_TestSystem all; import from LibItsBtp_Functions all; import from LibItsBtp_Templates all; // import from LibItsBtp_Pixits all; -// import from LibItsBtp_TypesAndValues all; // import from LibItsCommon_Functions all; group btpPacketGeneration { diff --git a/lib/LibItsBtp_EncdecDeclarations.ttcn b/lib/LibItsBtp_EncdecDeclarations.ttcn index e4f6332..2b6595d 100644 --- a/lib/LibItsBtp_EncdecDeclarations.ttcn +++ b/lib/LibItsBtp_EncdecDeclarations.ttcn @@ -2,7 +2,6 @@ module LibItsBtp_EncdecDeclarations { // LibItsBtp import from LibItsBtp_TypesAndValues all; - import from LibItsBtp_TestSystem all; /* TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016) external function fx_dec_BtpPayload (inout bitstring b, out BtpPayload p) return integer diff --git a/lib/LibItsBtp_Functions.ttcn b/lib/LibItsBtp_Functions.ttcn deleted file mode 100644 index fab6859..0000000 --- a/lib/LibItsBtp_Functions.ttcn +++ /dev/null @@ -1,237 +0,0 @@ -/** - * @author ETSI / STF405 - * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Functions.ttcn $ - * $Id: LibItsBtp_Functions.ttcn 1318 2017-01-26 10:20:53Z filatov $ - * @desc Module containing functions for basic Transport Protocol - * @copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * - */ - - module LibItsBtp_Functions { - - // LibCommon - import from LibCommon_Sync all; - - // LibItsCommon - import from LibItsCommon_TypesAndValues all; - - // LibItsBtp - import from LibItsBtp_TestSystem all; - import from LibItsBtp_TypesAndValues all; - import from LibItsBtp_Templates all; - import from LibItsBtp_Pixits all; - - group utFuntions { - - /** - * @desc Requests to bring the IUT in an initial state - * @param p_init The initialisation to trigger. - */ - function f_utInitializeIut(template (value) UtBtpInitialize p_init) runs on ItsBtp { - - //deactivate btpPort default alts - vc_btpDefaultActive := false; - - utPort.send(p_init); - tc_wait.start; - alt { - [] utPort.receive(UtBtpResults: { utBtpInitializeResult := true}) { - tc_wait.stop; - log("*** f_utInitializeIut: INFO: IUT initialized ***"); - } - [] utPort.receive { - tc_wait.stop; - log("*** f_utInitializeIut: INFO: IUT could not be initialized ***"); - f_selfOrClientSyncAndVerdict("error", e_error); - } - [] tc_wait.timeout { - log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***"); - f_selfOrClientSyncAndVerdict("error", e_timeout); - } - } - - //activate btpPort default alts - vc_btpDefaultActive := true; - - } - - /** - * @desc Triggers event from the application layer - * @param p_event The event to trigger. - */ - function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp { - - //deactivate btpPort default alts - vc_btpDefaultActive := false; - - utPort.send(p_event); - alt { - [] utPort.receive(UtBtpResults: { utBtpTriggerResult := true }) { - tc_wait.stop; - } - [] utPort.receive { - tc_wait.stop; - } - [] tc_wait.timeout { - } - } - - //activate btpPort default alts - vc_btpDefaultActive := true; - - } - - } // End of group utFunctions - - group configurationFunctions { - - /** - * @desc Setups default configuration - */ - function f_cfUp() runs on ItsBtp system ItsBtpSystem { - - map(self:utPort, system:utPort); - map(self:btpPort, system:btpPort); - f_connect4SelfOrClientSync(); - - } // end f_cfUp - - /** - * @desc Deletes default configuration - */ - function f_cfDown() runs on ItsBtp system ItsBtpSystem { - - unmap(self:utPort, system:utPort); - unmap(self:btpPort, system:btpPort); - f_disconnect4SelfOrClientSync(); - - } // end f_cfDown - - } // end configurationFunctions - - group btpAltsteps { - - /** - * @desc The base default. - */ - altstep a_default() runs on ItsBtp { - - [vc_btpDefaultActive] btpPort.receive { - log("*** a_default: ERROR: Received an unexpected message ***"); - f_selfOrClientSyncAndVerdict("error", e_error); - } - [] tc_wait.timeout { - log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***"); - f_selfOrClientSyncAndVerdict("error", e_timeout); - } - [] tc_ac.timeout { - log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***"); - f_selfOrClientSyncAndVerdict("error", e_timeout); - } - [] a_shutdown() { - f_poDefault(); - f_cfDown(); - log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); - stop; - } - } - - /** - * @desc The default for handling upper tester messages. - */ - altstep a_utDefault() runs on ItsBtp { - var UtBtpEventInd v_ind; - [vc_utDefaultActive] utPort.receive(UtBtpEventInd:?) -> value v_ind { - //store every upper tester indication received - vc_utEvents[lengthof(vc_utEvents)] := v_ind; - repeat; - } - [vc_utDefaultActive] utPort.receive { - log("*** " & testcasename() & ": INFO: Received unhandled/unknown UT message from IUT ***"); - repeat; - } - } - - } //end btpAltsteps - - group preambles { - - /** - * @desc The default preamble. - */ - function f_prDefault() runs on ItsBtp { - activate(a_default()); - activate(a_utDefault()); - } - - /** - * @desc Brings the IUT into an initial state. - */ - function f_prInitialState() runs on ItsBtp { - - f_utInitializeIut(m_btpInitialize); - f_prDefault(); - - } - - } // end of group preambles - - - group postambles { - - /** - * @desc The default postamble. - */ - function f_poDefault() runs on ItsBtp { - //empty - } - - } // end postambles - - group getFunctions { - - /** - * @desc Gets the BTP source port of the IUT. - * @return BTP source port ID - */ - function f_getBtpSrcPort() return BtpPortId { - return PX_SOURCE_PORT; - } - - /** - * @desc Gets the BTP destination port of the IUT. - * @return BTP destination port ID - */ - function f_getBtpDstPort() return BtpPortId { - return PX_DESTINATION_PORT; - } - - /** - * @desc Gets a unknown BTP destination port of the IUT. - * @return Unknown BTP destination port ID - */ - function f_getBtpUnknownDstPort() return BtpPortId { - return PX_UNKNOWN_DESTINATION_PORT; - } - - /** - * @desc Gets the BTP destination port info of the IUT. - * @return BTP destination port info - */ - function f_getBtpDstPortInfo() return BtpPortId { - return PX_DESTINATION_PORT_INFO; - } - - /** - * @desc Gets the BTP payload to use. - * @return BTP payload - */ - function f_getBtpPayload() return BtpRawPayload { - return PX_PAYLOAD; - } - - } // end getFunctions -} // end LibItsBtp_Functions diff --git a/lib/LibItsBtp_Templates.ttcn b/lib/LibItsBtp_Templates.ttcn index fe93038..c8d860c 100644 --- a/lib/LibItsBtp_Templates.ttcn +++ b/lib/LibItsBtp_Templates.ttcn @@ -12,7 +12,6 @@ module LibItsBtp_Templates { // LibIts - import from LibItsBtp_TestSystem all; import from LibItsBtp_TypesAndValues all; import from LibItsBtp_Pixits all; import from LibItsCommon_TypesAndValues all; diff --git a/lib/LibItsBtp_TestSystem.ttcn b/lib/LibItsBtp_TestSystem.ttcn deleted file mode 100644 index 39a3ca0..0000000 --- a/lib/LibItsBtp_TestSystem.ttcn +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @author ETSI / STF405 - * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_TestSystem.ttcn $ - * $Id: LibItsBtp_TestSystem.ttcn 1318 2017-01-26 10:20:53Z filatov $ - * @desc Test System module for ITS BTP - * @copyright ETSI Copyright Notification - * No part may be reproduced except as authorized by written permission. - * The copyright and the foregoing restriction extend to reproduction in all media. - * All rights reserved. - * - */ -module LibItsBtp_TestSystem { - - // LibCommon -// import from LibCommon_Time {modulepar all}; -// import from LibCommon_Sync all; - - // LibIts - import from LibItsCommon_TestSystem all; - import from LibItsCommon_TypesAndValues all; - import from LibItsBtp_TypesAndValues all; - - group portDefinitions { - - /** - * @desc Upper Tester port - */ - type port UpperTesterPort message { - out - UtBtpInitialize, UtBtpTrigger; - in - UtBtpResults, UtBtpEventInd; - } // end UpperTesterPort - - } // end portDefinitions - - group interfacePorts { - - group networkAndTransportPorts { - - group nt1Ports { - - /** - * @desc NT1 BTP Port (BTP/GeoNet/G5) - */ - type port BtpPort message { - in BtpInd; - out BtpReq; - } // end BtpPort - - } // End of group nt1Ports - - } // End of group networkAndTransportPorts - - } // End of group interfacePorts - - group componentDefinitions { - - /** - * @desc ITS System Adapter - */ - type component ItsBtpSystem { - - port UpperTesterPort utPort; - - // NT1 ports - port BtpPort btpPort; - - } // end component ItsAdapter - - } // End of group componentDefinitions - - /** - * @desc Test component for ITS Network and Transport layer - */ - type component ItsBtp extends ItsBaseComponent { - - port UpperTesterPort utPort; - - // NT1 ports - port BtpPort btpPort; - - // timers - - var UtBtpEventIndList vc_utEvents := {}; - - var boolean vc_utDefaultActive := true; - var boolean vc_btpDefaultActive := true; - - } // End of component ItsBtp - - group networkAndTransportPrimitives { - - group nt1Primitives { - - /** - * @desc NT1 BTP Indication Primitive - */ - type record BtpInd { - BtpPacket msgIn - } - - /** - * @desc NT1 BTP Request Primitive - */ - type record BtpReq { - BtpPacket msgOut - } - - } // end nt1Primitives - - } // End of group networkAndTransportPrimitives - with { - encode "LibIts_Interface" - } // end interfacePrimitives - -} // End of module LibItsBtp_TestSystem diff --git a/lib/LibItsBtp_TypesAndValues.ttcn b/lib/LibItsBtp_TypesAndValues.ttcn index 7be3626..f64f2a7 100644 --- a/lib/LibItsBtp_TypesAndValues.ttcn +++ b/lib/LibItsBtp_TypesAndValues.ttcn @@ -171,6 +171,31 @@ module LibItsBtp_TypesAndValues { encode "UpperTester" } + group networkAndTransportPrimitives { + + group nt1Primitives { + + /** + * @desc NT1 BTP Indication Primitive + */ + type record BtpInd { + BtpPacket msgIn + } + + /** + * @desc NT1 BTP Request Primitive + */ + type record BtpReq { + BtpPacket msgOut + } + + } // end nt1Primitives + + } // End of group networkAndTransportPrimitives + with { + encode "LibIts_Interface" + } // end interfacePrimitives + } with { variant "" encode "LibItsBtp" diff --git a/lib/module.mk b/lib/module.mk index f1c9679..ec3a5bb 100644 --- a/lib/module.mk +++ b/lib/module.mk @@ -1,6 +1,4 @@ sources := LibItsBtp_EncdecDeclarations.ttcn \ - LibItsBtp_Functions.ttcn \ LibItsBtp_Pixits.ttcn \ LibItsBtp_Templates.ttcn \ - LibItsBtp_TestSystem.ttcn \ LibItsBtp_TypesAndValues.ttcn diff --git a/module.mk b/module.mk index d1519fd..bac0f47 100644 --- a/module.mk +++ b/module.mk @@ -3,11 +3,15 @@ sources := \ ItsBtp_TestControl.ttcn \ modules := lib \ + lib_system \ ../LibCommon \ ../LibIts \ - ../AtsIPv6OverGeoNetworking/lib \ ../AtsGeoNetworking/lib \ + ../AtsGeoNetworking/lib_system \ + ../AtsIPv6OverGeoNetworking/lib \ + ../AtsIPv6OverGeoNetworking/lib_system \ ../AtsSecurity/lib \ + ../AtsSecurity/lib_system \ /ccsrc/Ports/LibIts_ports \ /ccsrc/Ports/LibIts_ports/BTP_ports \ /ccsrc/Ports/LibIts_ports/GN_ports \ @@ -22,12 +26,4 @@ modules := lib \ /ccsrc/Protocols/GeoNetworking \ /ccsrc/Protocols/UpperTester \ /ccsrc/Protocols/Security \ - /ccsrc/Protocols/Pcap \ - /ccsrc/geospacial - -# ../../ccsrc/Protocols/BTP \ -# ../../ccsrc/Protocols/Http \ -# ../../ccsrc/Protocols/DENM \ -# ../../ccsrc/Protocols/IVIM \ -# ../../ccsrc/Protocols/MapemSpatem \ -# ../../ccsrc/Protocols/SremSsem \ + /ccsrc/Protocols/Pcap -- GitLab From 8220384412a2ed89fb798e322a27ae8c1b71016e Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Tue, 14 Dec 2021 13:48:48 +0100 Subject: [PATCH 4/5] Separate typing and test system --- lib_system/LibItsBtp_Functions.ttcn | 237 +++++++++++++++++++++++++++ lib_system/LibItsBtp_TestSystem.ttcn | 92 +++++++++++ lib_system/module.mk | 2 + 3 files changed, 331 insertions(+) create mode 100644 lib_system/LibItsBtp_Functions.ttcn create mode 100644 lib_system/LibItsBtp_TestSystem.ttcn create mode 100644 lib_system/module.mk diff --git a/lib_system/LibItsBtp_Functions.ttcn b/lib_system/LibItsBtp_Functions.ttcn new file mode 100644 index 0000000..fab6859 --- /dev/null +++ b/lib_system/LibItsBtp_Functions.ttcn @@ -0,0 +1,237 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Functions.ttcn $ + * $Id: LibItsBtp_Functions.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Module containing functions for basic Transport Protocol + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ + + module LibItsBtp_Functions { + + // LibCommon + import from LibCommon_Sync all; + + // LibItsCommon + import from LibItsCommon_TypesAndValues all; + + // LibItsBtp + import from LibItsBtp_TestSystem all; + import from LibItsBtp_TypesAndValues all; + import from LibItsBtp_Templates all; + import from LibItsBtp_Pixits all; + + group utFuntions { + + /** + * @desc Requests to bring the IUT in an initial state + * @param p_init The initialisation to trigger. + */ + function f_utInitializeIut(template (value) UtBtpInitialize p_init) runs on ItsBtp { + + //deactivate btpPort default alts + vc_btpDefaultActive := false; + + utPort.send(p_init); + tc_wait.start; + alt { + [] utPort.receive(UtBtpResults: { utBtpInitializeResult := true}) { + tc_wait.stop; + log("*** f_utInitializeIut: INFO: IUT initialized ***"); + } + [] utPort.receive { + tc_wait.stop; + log("*** f_utInitializeIut: INFO: IUT could not be initialized ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + [] tc_wait.timeout { + log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + } + + //activate btpPort default alts + vc_btpDefaultActive := true; + + } + + /** + * @desc Triggers event from the application layer + * @param p_event The event to trigger. + */ + function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp { + + //deactivate btpPort default alts + vc_btpDefaultActive := false; + + utPort.send(p_event); + alt { + [] utPort.receive(UtBtpResults: { utBtpTriggerResult := true }) { + tc_wait.stop; + } + [] utPort.receive { + tc_wait.stop; + } + [] tc_wait.timeout { + } + } + + //activate btpPort default alts + vc_btpDefaultActive := true; + + } + + } // End of group utFunctions + + group configurationFunctions { + + /** + * @desc Setups default configuration + */ + function f_cfUp() runs on ItsBtp system ItsBtpSystem { + + map(self:utPort, system:utPort); + map(self:btpPort, system:btpPort); + f_connect4SelfOrClientSync(); + + } // end f_cfUp + + /** + * @desc Deletes default configuration + */ + function f_cfDown() runs on ItsBtp system ItsBtpSystem { + + unmap(self:utPort, system:utPort); + unmap(self:btpPort, system:btpPort); + f_disconnect4SelfOrClientSync(); + + } // end f_cfDown + + } // end configurationFunctions + + group btpAltsteps { + + /** + * @desc The base default. + */ + altstep a_default() runs on ItsBtp { + + [vc_btpDefaultActive] btpPort.receive { + log("*** a_default: ERROR: Received an unexpected message ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + [] tc_wait.timeout { + log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + [] tc_ac.timeout { + log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + [] a_shutdown() { + f_poDefault(); + f_cfDown(); + log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***"); + stop; + } + } + + /** + * @desc The default for handling upper tester messages. + */ + altstep a_utDefault() runs on ItsBtp { + var UtBtpEventInd v_ind; + [vc_utDefaultActive] utPort.receive(UtBtpEventInd:?) -> value v_ind { + //store every upper tester indication received + vc_utEvents[lengthof(vc_utEvents)] := v_ind; + repeat; + } + [vc_utDefaultActive] utPort.receive { + log("*** " & testcasename() & ": INFO: Received unhandled/unknown UT message from IUT ***"); + repeat; + } + } + + } //end btpAltsteps + + group preambles { + + /** + * @desc The default preamble. + */ + function f_prDefault() runs on ItsBtp { + activate(a_default()); + activate(a_utDefault()); + } + + /** + * @desc Brings the IUT into an initial state. + */ + function f_prInitialState() runs on ItsBtp { + + f_utInitializeIut(m_btpInitialize); + f_prDefault(); + + } + + } // end of group preambles + + + group postambles { + + /** + * @desc The default postamble. + */ + function f_poDefault() runs on ItsBtp { + //empty + } + + } // end postambles + + group getFunctions { + + /** + * @desc Gets the BTP source port of the IUT. + * @return BTP source port ID + */ + function f_getBtpSrcPort() return BtpPortId { + return PX_SOURCE_PORT; + } + + /** + * @desc Gets the BTP destination port of the IUT. + * @return BTP destination port ID + */ + function f_getBtpDstPort() return BtpPortId { + return PX_DESTINATION_PORT; + } + + /** + * @desc Gets a unknown BTP destination port of the IUT. + * @return Unknown BTP destination port ID + */ + function f_getBtpUnknownDstPort() return BtpPortId { + return PX_UNKNOWN_DESTINATION_PORT; + } + + /** + * @desc Gets the BTP destination port info of the IUT. + * @return BTP destination port info + */ + function f_getBtpDstPortInfo() return BtpPortId { + return PX_DESTINATION_PORT_INFO; + } + + /** + * @desc Gets the BTP payload to use. + * @return BTP payload + */ + function f_getBtpPayload() return BtpRawPayload { + return PX_PAYLOAD; + } + + } // end getFunctions +} // end LibItsBtp_Functions diff --git a/lib_system/LibItsBtp_TestSystem.ttcn b/lib_system/LibItsBtp_TestSystem.ttcn new file mode 100644 index 0000000..fbf66b3 --- /dev/null +++ b/lib_system/LibItsBtp_TestSystem.ttcn @@ -0,0 +1,92 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_TestSystem.ttcn $ + * $Id: LibItsBtp_TestSystem.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Test System module for ITS BTP + * @copyright ETSI Copyright Notification + * No part may be reproduced except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * All rights reserved. + * + */ +module LibItsBtp_TestSystem { + + // LibCommon +// import from LibCommon_Time {modulepar all}; +// import from LibCommon_Sync all; + + // LibIts + import from LibItsCommon_TestSystem all; + import from LibItsCommon_TypesAndValues all; + import from LibItsBtp_TypesAndValues all; + + group portDefinitions { + + /** + * @desc Upper Tester port + */ + type port UpperTesterPort message { + out + UtBtpInitialize, UtBtpTrigger; + in + UtBtpResults, UtBtpEventInd; + } // end UpperTesterPort + + } // end portDefinitions + + group interfacePorts { + + group networkAndTransportPorts { + + group nt1Ports { + + /** + * @desc NT1 BTP Port (BTP/GeoNet/G5) + */ + type port BtpPort message { + in BtpInd; + out BtpReq; + } // end BtpPort + + } // End of group nt1Ports + + } // End of group networkAndTransportPorts + + } // End of group interfacePorts + + group componentDefinitions { + + /** + * @desc ITS System Adapter + */ + type component ItsBtpSystem { + + port UpperTesterPort utPort; + + // NT1 ports + port BtpPort btpPort; + + } // end component ItsAdapter + + } // End of group componentDefinitions + + /** + * @desc Test component for ITS Network and Transport layer + */ + type component ItsBtp extends ItsBaseComponent { + + port UpperTesterPort utPort; + + // NT1 ports + port BtpPort btpPort; + + // timers + + var UtBtpEventIndList vc_utEvents := {}; + + var boolean vc_utDefaultActive := true; + var boolean vc_btpDefaultActive := true; + + } // End of component ItsBtp + +} // End of module LibItsBtp_TestSystem diff --git a/lib_system/module.mk b/lib_system/module.mk new file mode 100644 index 0000000..2ddc242 --- /dev/null +++ b/lib_system/module.mk @@ -0,0 +1,2 @@ +sources := LibItsBtp_Functions.ttcn \ + LibItsBtp_TestSystem.ttcn -- GitLab From 8fb9b439d6f4f84598a4f4ce52f6e420cf111832 Mon Sep 17 00:00:00 2001 From: Denis Filatov Date: Sun, 16 Jan 2022 12:40:30 +0000 Subject: [PATCH 5/5] Update README.md: v1.2.1 --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f6d4073..7ffb273 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,7 @@ -# BTP TS 102 870-3 +# BTP TS 102 870-3 - GeoNetworking BTP ATS +GeoNetworking Basic Transport Protocol (BTP) abstract test suite (ATS) as defined in [ETSI TS 102 859-3](https://www.etsi.org/deliver/etsi_ts/102800_102899/10287003/01.02.01_60/ts_10287003v010201p.pdf) + +This code is a part of the ETSI ITS test suite, available on https://forge.etsi.org/rep/ITS/TS.ITS + +This version of the test suite was developed by the _TTF-011_ and published as version **v1.2.1** -- GitLab