diff --git a/ItsIpv6OverGeoNetworking_TestCases.ttcn b/ItsIpv6OverGeoNetworking_TestCases.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..54f567c9b027f31dd31f3f7d426bf29c0303543e --- /dev/null +++ b/ItsIpv6OverGeoNetworking_TestCases.ttcn @@ -0,0 +1,2407 @@ +/** + * @author ETSI / STF405 / STF449 + * @version $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsIPv6OverGeoNetworking/ItsIpv6OverGeoNetworking_TestCases.ttcn $ + * $Id: ItsIpv6OverGeoNetworking_TestCases.ttcn 2655 2017-01-26 10:46:08Z filatov $ + * @desc Testcases for IPv6 over GeoNetworking Protocol (TP version: 0.0.4) + * + */ +module ItsIpv6OverGeoNetworking_TestCases { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_Sync all; + import from LibCommon_Time all; + import from LibCommon_VerdictControl all; + import from LibCommon_Time all; + + // LibIts + import from LibItsGeoNetworking_Functions all; + import from LibItsGeoNetworking_Templates all; + import from LibItsGeoNetworking_TypesAndValues all; + import from LibItsIpv6OverGeoNetworking_TestSystem all; + import from LibItsIpv6OverGeoNetworking_Functions all; + import from LibItsIpv6OverGeoNetworking_Templates all; + import from LibItsIpv6OverGeoNetworking_TypesAndValues all; + import from LibItsIpv6OverGeoNetworking_Pixits all; + import from LibItsIpv6OverGeoNetworking_Pics all; + import from LibItsExternal_TypesAndValues all; + + //5.2.1 + group messageGeneration { + + //5.2.1.1 + group mgGvl { + + /** + * @desc Checks that an IPv6 link-local multicast message is carried out over a GeoBroadcast message + * into the correct geographical area, when send over an SVGL + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured SGVL(SGVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with SGVL1 to send link-local multicast packets
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPv6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating a link-local multicast IPv6 address
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoNetworking GeoBroadcast message
+             *              containing the geographical Destination area corresponding to SGVL1
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '4'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/GVL/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 9.2.1 + */ + testcase TC_IPV6GEO_MG_GVL_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var AddressTableEntry v_addressesIut; + var AddressTableEntry v_addressesNodeB; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_addressesNodeB := f_getAddresses(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1}); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + v_addressesIut.lla, + v_addressesNodeB.solNodeMca, + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getGvlInterface(c_gvl1), + v_addressesIut.macAddress, + v_addressesNodeB.macSolNodeMca, + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwBroadcastPacketWithAreaWithNextHeader( + v_longPosVectorIut, + ?, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl1].area), + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoBroadcast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_GVL_BV_01 + + /** + * @desc Checks that an IPv6 global-scoped unicast-prefix-based multicast message is carried out over + * a GeoBroadcast message into the correct geographical area, when sent over an SGVL + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured SGVL (SGVL1)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPv6 packet from the Upper Layer
+             *              containing destination address
+             *                  containing a global-scoped unicast-prefix-based multicast IPv6 address
+             *                      indicating prefix associated with SGVL1
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoNetworking GeoBroadcast message
+             *              containing the geographical Destination area corresponding to SGVL1
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '4'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/GVL/BV/02 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 9.2.1 + */ + testcase TC_IPV6GEO_MG_GVL_BV_02() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var AddressTableEntry v_addressesIut; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1}); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + v_addressesIut.lla, + f_computeGlobalScopedUnicastPrefixBasedMulticastIpv6Address( + f_getPrefix(1), + f_getPrefixLength(1), + 1 + ), + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getGvlInterface(c_gvl1), + v_addressesIut.macAddress, + c_macBroadcastAddr, + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwBroadcastPacketWithAreaWithNextHeader( + v_longPosVectorIut, + ?, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl1].area), + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoBroadcast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_GVL_BV_02 + + /** + * @desc Checks that an IPv6 Geographic anycast message is carried out over a GeoAnycast message + * into the correct geographical area, when send over an SVGL + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured SGVL (SGVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with SGVL1 GVL1 to send Geographic anycast packets
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating a Geographic anycast IPv6 address
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoNetworking GeoAnycast message
+             *              containing the geographical Destination area corresponding to SGVL1
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '3'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/GVL/BV/03 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 9.4 + */ + testcase TC_IPV6GEO_MG_GVL_BV_03() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var AddressTableEntry v_addressesIut; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1}); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl1].prefix, vc_gvlTable[c_gvl1].prefixLength), + f_computeGeographicAnycastIpv6Address( + f_getPrefix(1), + f_getPrefixLength(1) + ), + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getGvlInterface(c_gvl1), + v_addressesIut.macAddress, + c_macBroadcastAddr, + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwAnycastPacketWithAreaWithNextHeader( + v_longPosVectorIut, + ?, + f_getGeoAnycastArea(vc_gvlTable[c_gvl1].area), + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoAnycast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_GVL_BV_03 + + /** + * @desc Checks that an IPv6 unicast message is carried out over a GeoUnicast when using an SGVL + * associated to an Ethernet V2.0/IEEE 802.3 LAN type virtual interface with address resolution + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured SGVL (SGVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with SGVL1
+             *      the IUT being configured with MIB attribute itsgn6aslVIResolAddr set to true
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating unicast IPv6 address of the Tester
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoUnicast message
+             *              containing DEPV field
+             *                  containing GN_ADDR field
+             *                      indicating value derived from the unicast IPv6 address IID
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '2'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/GVL/BV/04 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 10.3 + */ + testcase TC_IPV6GEO_MG_GVL_BV_04() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + if(PICS_GN6_ASL_VI_RESOL_ADDR != true) { + log("*** " & testcasename() & ": ERROR: PICS_GN6_ASL_VI_RESOL_ADDR == true required for executing the TC ***"); + stop; + } + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1}); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl1].prefix, vc_gvlTable[c_gvl1].prefixLength), + f_computeGlobalAddress(c_compNodeA, vc_gvlTable[c_gvl1].prefix, vc_gvlTable[c_gvl1].prefixLength), + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getGvlInterface(c_gvl1), + v_addressesIut.macAddress, + f_gnAddr2MacAddr(f_getPosition(c_compNodeB).gnAddr), // On purpose: IUT should not use this value + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)), // On purpose: IUT should derive this value fron IPv6 address + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + ?, + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": FAIL: Received incorrect GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_GVL_BV_04 + + /** + * @desc Checks that an IPv6 unicast message is carried out over a GeoUnicast when using an SGVL + * associated to an Ethernet V2.0/IEEE 802.3 LAN type virtual interface without address + * resolution + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured SGVL (SGVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with SGVL1
+             *      the IUT being configured with MIB attribute itsgn6aslVIResolAddr set to false
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating unicast IPv6 address of the Tester
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoUnicast message
+             *              containing DEPV field
+             *                  containing GN_ADDR field
+             *                      indicating value derived from the GN6_SAP destination parameter
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '2'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/GVL/BV/05 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 10.3 + */ + testcase TC_IPV6GEO_MG_GVL_BV_05() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var LongPosVector v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeB; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + if(PICS_GN6_ASL_VI_RESOL_ADDR != false) { + log("*** " & testcasename() & ": ERROR: PICS_GN6_ASL_VI_RESOL_ADDR == false required for executing the TC ***"); + stop; + } + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeB := f_getAddresses(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1}); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl1].prefix, vc_gvlTable[c_gvl1].prefixLength), + f_computeGlobalAddress(c_compNodeA, vc_gvlTable[c_gvl1].prefix, vc_gvlTable[c_gvl1].prefixLength), + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getGvlInterface(c_gvl1), + v_addressesIut.macAddress, + v_addressesNodeB.macAddress, // On purpose: IUT must use this value + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)), // On purpose: IUT should derive this value from SAP dest mac + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + ?, + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": FAIL: Received incorrect GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_GVL_BV_05 + + } // end mgGvl + + // 5.2.1.2 + group mgTvl { + + /** + * @desc Checks that an IPv6 unicast message is carried out over a GeoUnicast when using a TVL + * virtual interface with address resolution + *
    
+             * Pics Selection: PICS_TVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured TVL (TVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with TVL1
+             *      the IUT being configured with MIB attribute itsgn6aslVIResolAddr set to true
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating unicast IPv6 address of the Tester
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoUnicast message
+             *              containing DEPV field
+             *                  containing GN_ADDR field
+             *                      indicating value derived from the unicast IPv6 address IID
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '2'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/TVL/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 + */ + testcase TC_IPV6GEO_MG_TVL_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var LongPosVector v_longPosVectorNodeA, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA, v_addressesNodeB; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + if(PICS_GN6_ASL_VI_RESOL_ADDR != true) { + log("*** " & testcasename() & ": ERROR: PICS_GN6_ASL_VI_RESOL_ADDR == true required for executing the TC ***"); + stop; + } + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeB := f_getAddresses(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + f_acUpdateInterfaces(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + v_addressesIut.lla, + v_addressesNodeB.lla, + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getTvlInterface(), + v_addressesIut.macAddress, + f_gnAddr2MacAddr(f_getPosition(c_compNodeA).gnAddr), // On purpose: IUT should not use this value + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)), // On purpose: IUT should derive this value fron IPv6 address + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + ?, + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": FAIL: Received incorrect GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_TVL_BV_01 + + /** + * @desc Checks that an IPv6 unicast message is carried out over a GeoUnicast when using a TVL + * virtual interface without address resolution + *
    
+             * Pics Selection: PICS_TVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured TVL (TVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with TVL1
+             *      the IUT being configured with MIB attribute itsgn6aslVIResolAddr set to false
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating unicast IPv6 address of the Tester
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoUnicast message
+             *              containing DEPV field
+             *                  containing GN_ADDR field
+             *                      indicating value derived from the GN6_SAP destination parameter
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '2'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/TVL/BV/02 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 + */ + testcase TC_IPV6GEO_MG_TVL_BV_02() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var LongPosVector v_longPosVectorNodeA; + var LongPosVector v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + if(PICS_GN6_ASL_VI_RESOL_ADDR != false) { + log("*** " & testcasename() & ": ERROR: PICS_GN6_ASL_VI_RESOL_ADDR == false required for executing the TC ***"); + stop; + } + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + f_acUpdateInterfaces(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + v_addressesIut.lla, + v_addressesNodeA.lla, + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getTvlInterface(), + v_addressesIut.macAddress, + f_getAddresses(c_compNodeB).macAddress, // On purpose: IUT must use this value + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)), // On purpose: IUT should derive this value from SAP dest mac + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwUnicastPacketWithNextHeader( + ?, + ?, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": FAIL: Received incorrect GeoNetworking GeoUnicast ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_TVL_BV_02 + + /** + * @desc Checks that an IPv6 link-local multicast message is carried out over a GeoBroadcast message + * into the correct geographical area, when sent over a TVL + *
    
+             * Pics Selection: PICS_TVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured TVL (TVL1)
+             *      the IUT's Upper Layer being configured to use the virtual interface associated with TVL1 to send link-local multicast packets
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives an IPV6 packet from the Upper Layer
+             *              containing destination address
+             *                  indicating link-local multicast IPv6 address
+             *      }
+             *      then {
+             *          the IUT sends a valid GeoNetworking TSB message
+             *              containing NH field
+             *                  indicating value '3'
+             *              containing HT field
+             *                  indicating value '5'
+             *              carrying the IPv6 packet received from Upper Layer as payload
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MG/TVL/BV/03 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.1 and 9.2.1 + */ + testcase TC_IPV6GEO_MG_TVL_BV_03() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var template (present) LongPosVector v_longPosVectorIut; + var LongPosVector v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeB; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + if(PICS_GN6_ASL_VI_RESOL_ADDR != true) { + log("*** " & testcasename() & ": ERROR: PICS_GN6_ASL_VI_RESOL_ADDR == true required for executing the TC ***"); + stop; + } + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := mw_longPosVectorPosition(f_getPosition(c_compIut)); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeB := f_getAddresses(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + f_acUpdateInterfaces(); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + v_ipv6Packet := m_ipv6Packet( + v_addressesIut.lla, + v_addressesNodeB.solNodeMca, + c_noNextHdr, + omit + ); + + ipv6OverGeoNetworkingPort.send( + m_ipv6OverGeoNwReq( + f_getTvlInterface(), + v_addressesIut.macAddress, + f_gnAddr2MacAddr(f_getPosition(c_compNodeB).gnAddr), + v_ipv6Packet + ) + ); + + tc_ac.start; + alt { + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwTsbPacketWithNextHeader( + ?, + v_longPosVectorIut, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct GeoNetworking TSB ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] geoNetworkingPort.receive( + f_receiveGeoNetMessageWithPayload( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwTsbPacketWithNextHeader( + ?, + v_longPosVectorIut, + e_ipv6 + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": FAIL: Received incorrect GeoNetworking TSB ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MG_TVL_BV_03 + + } // end mgTvl + + } // end group messageGeneration + + //5.2.2 + group messageReception { + + //5.2.2.1 + group mrGvl { + + /** + * @desc Checks handling of a received GeoBroadcast message containing an + * IPv6 packet, which has destination area corresponding to an existing SGVL + * of the IUT + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVL (SGVL1)
+             *      the IUT having configured SGVLs (SGVL2..SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoBroadcast message
+             *              containing Destination Area parameters corresponding to SGVL1
+             *              containing payload 
+             *                  indicating an IPv6 packet
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to GVL1 an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating the broadcast value
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.lla, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl1].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl1), + v_addressesNodeA.macAddress, // FIXME check where this comes from (verify TP) + c_llBroadcast, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_01 + + /** + * @desc Checks handling of a received GeoBroadcast message containing an IPv6 + * packet no carrying a Router Advertisement, which has destination area not corresponding to + * any existing SGVL of the IUT + *
    
+             * Pics Selection: PICS_SGVL and PICS_DGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *      the IUT having configured DGVL (DGVL1)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoBroadcast message
+             *              containing Destination Area parameters not corresponding to any GVLs
+             *              containing payload 
+             *                  containing an IPv6 packet
+             *                      not containing an ICMPv6 RA message
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to DGVL1 an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating the broadcast value
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/02 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_02() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + // No Router Advertisement for gvl2 + f_prConfigureGVL({c_gvl1}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.solNodeMca, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl2].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + complement (f_getGvlInterface(c_gvl1), f_getGvlInterface(c_gvl2)), + v_addressesNodeA.macAddress, + c_llBroadcast, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_02 + + /** + * @desc Checks handling of a received GeoAnycast message containing an IPv6 packet, which + * has destination area corresponding to an existing SGVL of the IUT + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoAnycast message
+             *              containing Destination Area parameters corresponding to SGVL1
+             *              containing payload 
+             *                  indicating an IPv6 packet
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to SGVL1 an Ethernet packet
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6 
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/03 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_03() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.solNodeMca, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwAnycastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoAnycastArea(vc_gvlTable[c_gvl1].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl1), + v_addressesNodeA.macAddress, + ?, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_03 + + /** + * @desc Checks handling of a received GeoAnycast message containing an IPv6 packet, which + * has destination area not corresponding to any existing GVL of the IUT + *
    
+             * Pics Selection: PICS_SGVL and PICS_DGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured GVLs (GVL1 .. GVLx)
+             *      the IUT having configured DGVL (DGVL1)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoAnycast message
+             *              containing Destination Area parameters not corresponding to any SGVLs and
+             *               containing payload 
+             *                   indicating an IPv6 packet
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to DGVL1 an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating the broadcast value
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/04 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_04() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + // No Router Advertisement for gvl_1 + f_prConfigureGVL({c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.lla, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl1].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + complement (f_getGvlInterface(c_gvl1), f_getGvlInterface(c_gvl2)), + v_addressesNodeA.macAddress, + c_llBroadcast, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_04 + + /** + * @desc Checks handling of a received GeoBroadcast message containing an + * IPv6 packet carrying a Router Advertisement, which has destination area not corresponding to + * any existing SGVL of the IUT + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoBroadcast message
+             *              containing Destination Area parameters not corresponding to any SGVLs
+             *                  containing an IPv6 packet
+             *                      indicating an ICMPv6 RA message
+             *      }
+             *      then {
+             *          the IUT creates a new SGVL and a new virtual interface associated to it 
+             *          the IUT transmits on the virtual interface associated to the new GVL an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating '33:33:00:00:00:01'
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/05 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_05() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + //gvl3 handled later + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + c_allNodesMca, + c_icmpHdr, + m_rtAdvWithOptions( + m_rtAdvOpt_prefixOpt( + vc_gvlTable[c_gvl3].prefixLength, + c_lFlag1, + c_aFlag1, + c_validLifetime30s, + c_preferredLifetime30s, + vc_gvlTable[c_gvl3].prefix + ) + ) + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl3].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + f_sleep(PX_T_BUILD_CONFIG); + f_acUpdateInterfaces(); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl3), + v_addressesNodeA.macAddress, + c_macBroadcastAddr, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_05 + + /** + * @desc Checks handling of a received GeoUnicast message, containing an IPv6 packet with + * destination address matching one and only one address associated to a + * virtual interface of the IUT + *
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoUnicast message
+             *              containing an IPv6 packet 
+             *                  containing address associated to one SGVL (SGVLy)
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to SGVLy an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating a value derived from the Destination GN_ADDR field
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/06 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_06() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.lla, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwUnicastPacket( + v_longPosVectorNodeA, + f_longPosVector2ShortPosVector(v_longPosVectorIut), + vc_localSeqNumber + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl2), + v_addressesNodeA.macAddress, + v_addressesIut.macAddress, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_06 + + /** + * @desc Checks handling of a received GeoUnicast message, containing an + * IPv6 packet with destination address not matching addresses associated to IUT's SGVLs and + * with SOPV contained in one and only one geoArea associated to IUT's SGVLs + *
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoUnicast message
+             *              containing payload
+             *                  containing an IPv6 packet
+             *                      containing a destination address
+             *                          indicating address not associated to any GVL
+             *              containing Source position coordinates only contained in GVLy
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to GVLy an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating a value derived from the Destination GN_ADDR field
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/07 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_07() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA, v_addressesNodeB; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeB := f_getAddresses(c_compNodeB); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesNodeB.lla, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwUnicastPacket( + v_longPosVectorNodeB, + f_longPosVector2ShortPosVector(v_longPosVectorIut), + vc_localSeqNumber + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl3), + v_addressesNodeA.macAddress, + v_addressesNodeB.macAddress, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_07 + + /** + * @desc Checks handling of a received GeoUnicast message, containing an IPv6 packet with + * destination address not matching addresses associated to IUT's GVLs and with SOPV not + * contained in any geoArea associated to IUT's GVLs + *
    
+             * Pics Selection: PICS_SGVL and PICS_DGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *      the IUT having configured DGVL (DGVL1)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoUnicast message
+             *              containing payload
+             *                  containing an IPv6 packet
+             *                      containing a destination address
+             *                          indicating address not associated to any GVL
+             *              containing Source position coordinates not contained in any GVL
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to DGVL an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating a value derived from the Destination GN_ADDR field
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/08 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_08() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compNodeA, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwUnicastPacket( + v_longPosVectorNodeB, + f_longPosVector2ShortPosVector(v_longPosVectorIut), + vc_localSeqNumber + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + complement (f_getGvlInterface(c_gvl1), f_getGvlInterface(c_gvl2)), + v_addressesNodeA.macAddress, + v_addressesIut.macAddress, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_08 + + /** + * @desc Checks handling of a received GeoUnicast message, containing an IPv6 packet with + * destination address not matching addresses associated to IUT's SGVLs and with SOPV + * contained in more than one geoArea associated to IUT's SGVLs and with IPv6 source + * address considered to be on-link on at least one of those SGVLs + *
    
+             * Pics Selection: PICS_SGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *      GVLb invalidation timer being higher than SGVLa and SGVLc invalidation timers
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoUnicast message
+             *              containing payload
+             *                  containing an IPv6 packet
+             *                      containing a destination address
+             *                          indicating address not associated to any SGVL
+             *              containing Source position coordinates contained in SGVLa, SGVLb and SGVLc
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to SGVLb an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating a value derived from the Destination GN_ADDR field
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/09 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_09() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2, c_gvl3}, {c_validLifetime20s, c_validLifetime30s, c_validLifetime20s}); + + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compNodeA, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwUnicastPacket( + v_longPosVectorNodeB, + f_longPosVector2ShortPosVector(v_longPosVectorIut), + vc_localSeqNumber + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getGvlInterface(c_gvl2), + v_addressesNodeA.macAddress, + v_addressesIut.macAddress, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_09 + + /** + * @desc Checks handling of a received GeoUnicast message, containing an IPv6 packet with + * destination address not matching addresses associated to IUT's SGVLs and with SOPV + * contained in more than one geoArea associated to IUT's SGVLs and with IPv6 source + * address not considered to be on-link on any of those SGVLs + *
    
+             * Pics Selection: PICS_SGVL and PICS_DGVL
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured SGVLs (SGVL1 .. SGVLx)
+             *      the IUT having configured DGVLs (DGVL1)
+             *      IPv6 address IPV6_SRC not considered to be on-link on SGVLa, SGVLb, and SGVLc
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoUnicast message
+             *              containing payload
+             *                  containing an IPv6 packet
+             *                      containing a destination address
+             *                          indicating address not associated to any SGVL
+             *                      containing a source address IPV6_SRC
+             *              containing Source position coordinates contained in SGVLa, SGVLb and SGVLc
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to DGVL1 an Ethernet packet
+             *              containing Destination MAC address
+             *                  indicating a value derived from the Destination GN_ADDR field
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/GVL/BV/10 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_GVL_BV_10() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeB; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeB := f_getPosition(c_compNodeB); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2, c_gvl3}); + + v_ipv6Packet := m_ipv6Packet( + f_computeGlobalAddress(c_compNodeA, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + f_computeGlobalAddress(c_compIut, vc_gvlTable[c_gvl2].prefix, vc_gvlTable[c_gvl2].prefixLength), + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwUnicastPacket( + v_longPosVectorNodeB, + f_longPosVector2ShortPosVector(v_longPosVectorIut), + vc_localSeqNumber + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + complement (f_getGvlInterface(c_gvl1), f_getGvlInterface(c_gvl2), f_getGvlInterface(c_gvl3)), + v_addressesNodeA.macAddress, + v_addressesIut.macAddress, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_GVL_BV_10 + + } //end mrGvl + + // 5.2.2.2 + group mrTvl { + + /** + * @desc Checks handling of a received link-local IPv6 Unicast message, when using a TVL associated + * to an NBMA type virtual interface + *
    
+             * Pics Selection: PICS_TLV
+             * Initial conditions: 
+             *  with {
+             *      the IUT having a configured TVL (TVL1)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a TSB message
+             *              containing an IPv6 packet
+             *      }
+             *      then {
+             *          the IUT transmits on the virtual interface associated to TVL1 an Ethernet packet
+             *              containing Source MAC address
+             *                  indicating a value derived from Source GN_ADDR field
+             *              containing Ether Type value
+             *                  indicating IPv6
+             *              containing the IPv6 packet
+             *      }
+             *  }
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/MR/TVL/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_MR_TVL_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA; + var AddressTableEntry v_addressesIut, v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorIut := f_getPosition(c_compIut); + v_addressesIut := f_getAddresses(c_compIut); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + + f_acUpdateInterfaces(); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + v_addressesIut.lla, + c_noNextHdr, + omit + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwTsbPacket( + vc_localSeqNumber, + v_longPosVectorIut + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + tc_ac.start; + alt { + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + f_getTvlInterface(), + v_addressesNodeA.macAddress, + ?, + v_ipv6Packet + ) + ) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: Received correct Ethernet packet ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout); + } + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_MR_TVL_BV_01 + + } // end mrTvl + + } // end group messageReception + + group virtualInterfaceManagement { + + group newVirtualInterfaces { + + /** + * @desc Checks the Router Advertisement-triggered creation of a new SGVL associated to an Ethernet + * V2.0/IEEE 802.3 LAN type virtual interface + *
    
+             * Pics Selection: PICS_SGVL and PICS_Ethernet
+             * Initial conditions: 
+             *  with {
+             *      the IUT having automatically configured SGVLs (SGVL1 .. SGVLx)
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          the IUT receives a GeoBroadcast message
+             *              containing Destination Area parameters not corresponding to any GVLs
+             *              containing an ICMPv6 RA payload 
+             *      }
+             *      then {
+             *          the IUT creates a new SGVL and associates to it a new virtual interface (VI1)
+             *              having a MAC address
+             *                  indicating a value derived from the IUT's GN_ADDR (Note)
+             *      }
+             *  }
+             * Note: reverse EUI-64 generation procedure
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/VM/NVI/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2, 10.2.1 + */ + testcase TC_IPV6GEO_VM_NVI_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + //gvl3 handled later + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + c_allNodesMca, + c_icmpHdr, + m_rtAdvWithOptions( + m_rtAdvOpt_prefixOpt( + vc_gvlTable[c_gvl3].prefixLength, + c_lFlag1, + c_aFlag1, + c_validLifetime30s, + c_preferredLifetime30s, + vc_gvlTable[c_gvl3].prefix + ) + ) + ); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl3].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + f_sleep(PX_T_BUILD_CONFIG); + f_acUpdateInterfaces(); + + if(f_getGvlInterface(c_gvl3) != "") { + log("*** " & testcasename() & ": PASS: Virtual interface created ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + else { + log("*** " & testcasename() & ": FAIL: Virtual interface not created ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_VM_NVI_BV_01 + + } // end group newVirtualInterfaces + + group expiredVirtualInterfaces { + + /** + * @desc Checks the removal of an expired GVL and its associated virtual interface + *
+             * Pics Selection: PICS_SGVL and PICS_Ethernet
+             * Initial conditions: 
+             *  with {
+             *      the IUT having configured a SGVL (SGVL1) derived from a received RA
+             *  }
+             * Expected behaviour:
+             *  ensure that {
+             *      when { 
+             *          every prefix entry associated to SGVL1 has expired
+             *      }
+             *      then {
+             *          the IUT removes the expired SGVL SGVL1
+             *          the IUT removes the associated virtual interface VI1
+             *      }
+             *  }
+             * Note: reverse EUI-64 generation procedure
+             * 
+ * + * @see ETSI TS 102 859-2 v2.1.1 TP/IPv6GEO/VM/EVI/BV/01 + * @reference ETSI EN 302 636-6-1 clauses, 8.2.2 + */ + testcase TC_IPV6GEO_VM_EVI_BV_01() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Local variables + var LongPosVector v_longPosVectorNodeA; + var AddressTableEntry v_addressesNodeA; + var template (value) Ipv6Packet v_ipv6Packet; + + // Test control + + // Test component configuration + f_cf01UpGn6(); + v_longPosVectorNodeA := f_getPosition(c_compNodeA); + v_addressesNodeA := f_getAddresses(c_compNodeA); + + // Test adapter configuration + + // Preamble + f_prIpv6Neighbour(); + f_prConfigureGVL({c_gvl1, c_gvl2}); + + v_ipv6Packet := m_ipv6Packet( + v_addressesNodeA.lla, + c_allNodesMca, + c_icmpHdr, + m_rtAdvWithOptions( + m_rtAdvOpt_prefixOpt( + vc_gvlTable[c_gvl3].prefixLength, + c_lFlag1, + c_aFlag1, + c_validLifetime30s, + c_preferredLifetime30s, + vc_gvlTable[c_gvl3].prefix + ) + ) + ); + + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_longPosVectorNodeA, + vc_localSeqNumber, + f_getGeoBroadcastArea(vc_gvlTable[c_gvl3].area) + ) + ) + ), + bit2oct(encvalue(v_ipv6Packet)) + ); + + f_sleep(PX_T_BUILD_CONFIG); + f_acUpdateInterfaces(); + + if(f_getGvlInterface(c_gvl3) == "") { + log("*** " & testcasename() & ": INCONC: Virtual interface not created ***"); + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_error); + } + f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success); + + // Test Body + f_sleep(int2float(c_validLifetime30s)); + f_acUpdateInterfaces(); + + if(f_getGvlInterface(c_gvl3) == "") { + log("*** " & testcasename() & ": PASS: Virtual interface removed ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success); + } + else { + log("*** " & testcasename() & ": FAIL: Virtual interface not removed ***"); + f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error); + } + + // Postamble + f_poIpv6Neighbour(); + f_cf01DownGn6(); + + } // end TC_IPV6GEO_VM_EVI_BV_01 + + } // end group expiredVirtualInterfaces + + } // end virtualInterfaceManagement + +} // end ItsIpv6OverGeoNetworking_TestCases \ No newline at end of file diff --git a/ItsIpv6OverGeoNetworking_TestControl.ttcn b/ItsIpv6OverGeoNetworking_TestControl.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..14edbb4a42f31c2b901b73cbdda73c45ba717f61 --- /dev/null +++ b/ItsIpv6OverGeoNetworking_TestControl.ttcn @@ -0,0 +1,53 @@ +/** + * @author ETSI / STF405 /STF449 + * @version $Url: https://oldforge.etsi.org/svn/ITS/tags/20170222_STF527_Final/ttcn/AtsIPv6OverGeoNetworking/ItsIpv6OverGeoNetworking_TestControl.ttcn $ + * $Id: ItsIpv6OverGeoNetworking_TestControl.ttcn 1423 2014-05-22 13:59:50Z filatov $ + * @desc Test Control file for IPv6 over GeoNetworking Protocol + * + */ +module ItsIpv6OverGeoNetworking_TestControl { + + // ATS IPv6OverGeoNw + import from ItsIpv6OverGeoNetworking_TestCases {testcase all}; + + // Test Execution + control { + + //message generation + //GVL + execute(TC_IPV6GEO_MG_GVL_BV_01()); + execute(TC_IPV6GEO_MG_GVL_BV_02()); + execute(TC_IPV6GEO_MG_GVL_BV_03()); + execute(TC_IPV6GEO_MG_GVL_BV_04()); + execute(TC_IPV6GEO_MG_GVL_BV_05()); + + //TVL + execute(TC_IPV6GEO_MG_TVL_BV_01()); + execute(TC_IPV6GEO_MG_TVL_BV_02()); + execute(TC_IPV6GEO_MG_TVL_BV_03()); + + //message reception + //GVL + execute(TC_IPV6GEO_MR_GVL_BV_01()); + execute(TC_IPV6GEO_MR_GVL_BV_02()); + execute(TC_IPV6GEO_MR_GVL_BV_03()); + execute(TC_IPV6GEO_MR_GVL_BV_04()); + execute(TC_IPV6GEO_MR_GVL_BV_05()); + execute(TC_IPV6GEO_MR_GVL_BV_06()); + execute(TC_IPV6GEO_MR_GVL_BV_07()); + execute(TC_IPV6GEO_MR_GVL_BV_08()); + execute(TC_IPV6GEO_MR_GVL_BV_09()); + execute(TC_IPV6GEO_MR_GVL_BV_10()); + + //TVL + execute(TC_IPV6GEO_MR_TVL_BV_01()); + + //virtualInterfaceManagement + //newVirtualInterfaces + execute(TC_IPV6GEO_VM_NVI_BV_01()); + + //expiredVirtualInterfaces + execute(TC_IPV6GEO_VM_EVI_BV_01()); + } + +} // end ItsIpv6OverGeoNetworking_TestControl diff --git a/README.md b/README.md index a0b6e6a483b877681b57b3110117728520e2a026..7bc5da67a82b96e05cbbc3756b1d329f504c4d14 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # GN IPv6 TS 102 859-3 -IPv6 over GeoNetworking test suite as defined in ETSI TS 102 859-3 \ No newline at end of file +IPv6 over GeoNetworking test suite as defined in ETSI TS 102 859-3 +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.3.1 diff --git a/lib/LibItsIpv6OverGeoNetworking_EncdecDeclarations.ttcn b/lib/LibItsIpv6OverGeoNetworking_EncdecDeclarations.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..0ccedc01a9a2d6d416b8fce48edb5fd0f7ddb002 --- /dev/null +++ b/lib/LibItsIpv6OverGeoNetworking_EncdecDeclarations.ttcn @@ -0,0 +1,11 @@ +module LibItsIpv6OverGeoNetworking_EncdecDeclarations { + + import from LibItsIpv6OverGeoNetworking_TypesAndValues all; + + external function fx_enc_Ipv6Packet (Ipv6Packet p) return bitstring + with {extension "prototype(convert) encode(LibItsIpv6OverGeoNetworking)"} + + external function fx_dec_Ipv6Packet (inout bitstring b, out Ipv6Packet p) return integer + with {extension "prototype(sliding) decode(LibItsIpv6OverGeoNetworking)"} + +} // End of module LibItsIpv6OverGeoNetworking_EncdecDeclarations diff --git a/lib/LibItsIpv6OverGeoNetworking_Pics.ttcn b/lib/LibItsIpv6OverGeoNetworking_Pics.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..5d5efdc304f7259afee16be95933bc1fa1366958 --- /dev/null +++ b/lib/LibItsIpv6OverGeoNetworking_Pics.ttcn @@ -0,0 +1,34 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_Pics.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_Pics.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc IPv6 Over GeoNetworking PICS + * @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 LibItsIpv6OverGeoNetworking_Pics { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + + // LibIts + import from LibItsGeoNetworking_TypesAndValues all; + + group ipv6OverGeoNwPics { + + /** + * @desc Indicates whether the GN6ASL shall resolve the destination link-layer-address + * from the IPv6 address. + * FALSE, perform address resolution, otherwise do not. + * @see ETSI TS 102 859-1 A.10/10 + */ + modulepar boolean PICS_GN6_ASL_VI_RESOL_ADDR := true; + + + } // end ipv6OverGeoNwPics + +} // end LibItsIpv6OverGeoNetworking_Pics \ No newline at end of file diff --git a/lib/LibItsIpv6OverGeoNetworking_Pixits.ttcn b/lib/LibItsIpv6OverGeoNetworking_Pixits.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..68e016f6c6f8b8c1c21dd70fa5c478008860e480 --- /dev/null +++ b/lib/LibItsIpv6OverGeoNetworking_Pixits.ttcn @@ -0,0 +1,66 @@ +/** + * @author ETSI / STF405 /STF449 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_Pixits.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_Pixits.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Module parameters for IPv6 over GeoNetworking 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 LibItsIpv6OverGeoNetworking_Pixits { + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + + /** + * @desc GVL will be configured manually? + */ + modulepar boolean PX_CONFIG_MANUAL_GVL := false; + + /** + * @desc Time for building the configuration and virtual interfaces dynamically. + */ + modulepar float PX_T_BUILD_CONFIG := 5.0; + + /** + * @desc IPv6 prefix 1 to be used for defining GVL + */ + modulepar Oct16 PX_GN6_PREFIX_1 := '3FFE0000000000010000000000000000'O; + + /** + * @desc IPv6 prefix 2 to be used for defining GVL + */ + modulepar Oct16 PX_GN6_PREFIX_2 := '3FFE0000000000020000000000000000'O; + + /** + * @desc IPv6 prefix 3 to be used for defining GVL + */ + modulepar Oct16 PX_GN6_PREFIX_3 := '3FFE0000000000030000000000000000'O; + + /** + * @desc Length of IPv6 prefix 1 + * @see PX_GN6_PREFIX_1 + */ + modulepar UInt8 PX_GN6_PREFIX_LENGTH_1 := 64; + + /** + * @desc Length of IPv6 prefix 2 + * @see PX_GN6_PREFIX_2 + */ + modulepar UInt8 PX_GN6_PREFIX_LENGTH_2 := 64; + + /** + * @desc Length of IPv6 prefix 3 + * @see PX_GN6_PREFIX_3 + */ + modulepar UInt8 PX_GN6_PREFIX_LENGTH_3 := 64; + + /** + * @desc Name of IUT's virtual interface associated with TVL + */ + modulepar charstring PX_GN6_TVL_INTERFACE_NAME := "tvl0"; + +} \ No newline at end of file diff --git a/lib/LibItsIpv6OverGeoNetworking_Templates.ttcn b/lib/LibItsIpv6OverGeoNetworking_Templates.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..fc35a84ca97b956defb229e0f067600f5b2cef83 --- /dev/null +++ b/lib/LibItsIpv6OverGeoNetworking_Templates.ttcn @@ -0,0 +1,291 @@ +/** + * @author ETSI / STF405 / STF449 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_Templates.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_Templates.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc IPv6 over GeoNetworking 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 LibItsIpv6OverGeoNetworking_Templates { + + //LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + + //LibIts + import from LibItsIpv6OverGeoNetworking_TypesAndValues all; + import from LibItsGeoNetworking_TypesAndValues all; + import from LibItsExternal_TypesAndValues {type MacAddress}; + + group ipv6OverGeoNwPrimitivesTemplates { + + /** + * @desc Send template for IPv6OverGeoNetworking packet (IPv6OverGeoNetworking Primitive) + * @param p_interface Which virtual interface to use for sending the packet + * @param p_srcMacAddr Link-layer source address + * @param p_dstMacAddr Link-layer destination address + * @param p_ipv6Packet IPv6 packet to be sent + */ + template (value) IPv6OverGeoNetworkingReq m_ipv6OverGeoNwReq( + template (value) charstring p_interface, + template (value) MacAddress p_srcMacAddr, + template (value) MacAddress p_dstMacAddr, + template (value) Ipv6Packet p_ipv6Packet + ) := { + interface := p_interface, + macSourceAddress := p_srcMacAddr, + macDestinationAddress := p_dstMacAddr, + ipv6Packet := p_ipv6Packet + } + + /** + * @desc Receive template for IPv6OverGeoNetworking packet (IPv6OverGeoNetworking Primitive) + * @param p_interface On which virtual interface the packet is expected + * @param p_srcMacAddr Link-layer source address + * @param p_dstMacAddr Link-layer destination address + * @param p_ipv6Packet Expected IPv6 packet + */ + template IPv6OverGeoNetworkingInd mw_ipv6OverGeoNwInd( + template (present) charstring p_interface, + template (present) MacAddress p_srcMacAddr, + template (present) MacAddress p_dstMacAddr, + template (present) Ipv6Packet p_ipv6Packet + ) := { + interface := p_interface, + macSourceAddress := p_srcMacAddr, + macDestinationAddress := p_dstMacAddr, + ipv6Packet := p_ipv6Packet + } + + } // ipv6OverGeoNwPrimitivesTemplates + + group ipv6 { + + /** + * @desc Send template for IPv6 packet + * @param p_srcAddr IPv6 source address + * @param p_dstAddr IPv6 destination address + * @param p_nextHdr IPv6's next header + * @param p_payload IPv6 payload + */ + template (value) Ipv6Packet m_ipv6Packet( + in template (value) Ipv6Address p_srcAddr, + in template (value) Ipv6Address p_dstAddr, + in template (value) UInt8 p_nextHdr, + in template (omit) Ipv6Payload p_payload + ) := { + ipv6Hdr := m_ipv6Header(p_srcAddr, p_dstAddr, p_nextHdr), + extHdrList := omit, + ipv6Payload := p_payload + } + + /** + * @desc Reception template for IPv6 packet + * @param p_srcAddr IPv6 source address + * @param p_dstAddr IPv6 destination address + * @param p_nextHdr IPv6's next header + * @param p_payload IPv6 payload + */ + template Ipv6Packet mw_ipv6Packet( + in template (present) Ipv6Address p_srcAddr, + in template (present) Ipv6Address p_dstAddr, + in template (present) UInt8 p_nextHdr, + in template Ipv6Payload p_payload + ) := { + ipv6Hdr := mw_ipv6Header(p_srcAddr, p_dstAddr, p_nextHdr), + extHdrList := omit, + ipv6Payload := p_payload + } + + /** + * @desc Send template for IPv6 header + * @param p_srcAddr IPv6 source address + * @param p_dstAddr IPv6 destination address + * @param p_nextHdr IPv6's next header + */ + template (value) Ipv6Header m_ipv6Header( + in template (value) Ipv6Address p_srcAddr, + in template (value) Ipv6Address p_dstAddr, + in template (value) UInt8 p_nextHdr + ) := { + version := 6, + trafficClass := 0, + flowLabel := 0, + payloadLength := 0, //indicates that the adaptation will fill the correct value + nextHeader := p_nextHdr, + hopLimit := 255, + sourceAddress := p_srcAddr, + destinationAddress := p_dstAddr + } + + /** + * @desc Receive template for IPv6 header + * @param p_srcAddr IPv6 source address + * @param p_dstAddr IPv6 destination address + * @param p_nextHdr IPv6's next header + */ + template Ipv6Header mw_ipv6Header( + in template (present) Ipv6Address p_srcAddr, + in template (present) Ipv6Address p_dstAddr, + in template (present) UInt8 p_nextHdr + ) := { + version := 6, + trafficClass := ?, + flowLabel := ?, + payloadLength := ?, + nextHeader := p_nextHdr, + hopLimit := ?, + sourceAddress := p_srcAddr, + destinationAddress := p_dstAddr + } + + /** + * @desc Send template for IPv6 payload containing Router Advertisement + * @param p_rtAdvOptions Router Advertisement options + */ + template (value) Ipv6Payload m_rtAdvWithOptions( + in template (omit) RtAdvOptions p_rtAdvOptions + ) := { + routerAdvMsg := { + icmpType := c_rtAdvMsg, + icmpCode := 0, + checksum := c_2ZeroBytes, //indicates that the adaptation will fill the correct value + curHopLimit := 255, + managedConfigFlag := 0, + otherConfigFlag := 0, + homeAgentFlag := 0, + reserved := 0, + routerLifetime := c_uInt16Max, + reachableTime := c_uInt32Max, + retransTimer := 0, + rtAdvOptions := p_rtAdvOptions + } + } + + /** + * @desc Receive template for IPv6 payload containing Router Advertisement + * @param p_rtAdvOptions Router Advertisement options + */ + template Ipv6Payload mw_rtAdvWithOptions( + in template RtAdvOptions p_rtAdvOptions + ) := { + routerAdvMsg := { + icmpType := c_rtAdvMsg, + icmpCode := 0, + checksum := ?, + curHopLimit := ?, + managedConfigFlag := ?, + otherConfigFlag := ?, + homeAgentFlag := ?, + reserved := ?, + routerLifetime := ?, + reachableTime := ?, + retransTimer := ?, + rtAdvOptions := p_rtAdvOptions + } + } + + /** + * @desc Send template for IPv6 payload containing Router Advertisement + * @param p_rtAdvOptions Router Advertisement options + */ + template (value) Ipv6Payload m_octetstringPayload( + in template (value) octetstring p_payload + ) := { + octetstringMsg := p_payload + } + + /** + * @desc Receive template for IPv6 payload containing Router Advertisement + * @param p_rtAdvOptions Router Advertisement options + */ + template Ipv6Payload mw_octetstringPayload( + in template (present) octetstring p_payload + ) := { + octetstringMsg := p_payload + } + + /** + * @desc Send template for IPv6 Prefix option + * @param p_prefixLength Length of the prefix. + * @param p_lFlag Value for link flag. + * @param p_aFlag Value for autoconfiguration flag. + * @param p_validLifetime Value for valid life time duration. + * @param p_preferredLifetime Value for preffered life time duration. + * @param p_prefix Address prefix to be used + */ + template RtAdvOptions m_rtAdvOpt_prefixOpt ( + in template (value) UInt8 p_prefixLength, + in template (value) UInt1 p_lFlag, + in template (value) UInt1 p_aFlag, + in template (value) UInt32 p_validLifetime, + in template (value) UInt32 p_preferredLifetime, + in template (value) Ipv6Address p_prefix + ):={ + srcLinkLayerAddr := omit, + prefixInfoList := { + m_prefixInfo( + p_prefixLength, + p_lFlag, + p_aFlag, + p_validLifetime, + p_preferredLifetime, + p_prefix + ) + }, + otherOption := omit + } + + /** + * @desc Send template for IPv6 Prefix info + * @param p_prefixLength The length of the prefix + * @param p_lFlag Value for link flag. + * @param p_aFlag Value for autoconfiguration flag. + * @param p_validLifetime Value for valid life time duration. + * @param p_preferredLifetime Value for preferred life time duration. + * @param p_prefix Address prefix to be used + */ + template PrefixInfo m_prefixInfo ( + in template (value) UInt8 p_prefixLength, + in template (value) UInt1 p_lFlag, + in template (value) UInt1 p_aFlag, + in template (value) UInt32 p_validLifetime, + in template (value) UInt32 p_preferredLifetime, + in template (value) Ipv6Address p_prefix + ):= { + icmpType:= c_prefixInfo, + optionLength:= c_prefixInfoLen, + prefixLength:= p_prefixLength, + linkFlag:=p_lFlag, + autoConfigFlag:=p_aFlag, + rtAddrFlag := c_rtAddrFlag0, + reserved1:=0, + validLifetime:=p_validLifetime, + preferredLifetime:=p_preferredLifetime, + reserved2:=0, + prefix:= p_prefix + } + + } // end group ipv6 + + group gn6AcPrimitives { + + /** + * @desc TA primitive for querying link-layer interfaces information + */ + template (value) AcGn6Primitive m_acGetInterfaceInfos := { + getInterfaceInfos := 3 + } + + /** + * @desc TA primitive for retrieving link-layer interfaces information + */ + template AcGn6Response mw_acInterfaceInfos := { + interfaceInfoList := ? + } + } // end gn6AcPrimitives + +} // end LibItsIpv6OverGeoNetworking_TypesAndValues diff --git a/lib/LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn b/lib/LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..aa5a64c069fb77f622a6811d8d8a45946ee62634 --- /dev/null +++ b/lib/LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn @@ -0,0 +1,346 @@ +/** + * @author ETSI / STF405 / STF449 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Types and values for IPv6 over GeoNetworking 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 LibItsIpv6OverGeoNetworking_TypesAndValues { + + //LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + + //LibIts + import from LibItsExternal_TypesAndValues all; + + group ipv6OverGeoConfigurationTypes { + + /** + * @desc Entry of GVL table + * @member key Reference key of the entry + * @member prefix Prefix associated with the GVL + * @member prefixLength Prefix length + * @member area GeoArea associated with th e GVL + * @member interface IUT's interface associated with the GVL + */ + type record GvlTableEntry { + charstring key, + Oct16 prefix, + UInt8 prefixLength, + charstring area, + charstring interface + } + + /** + * @desc Table containing GVL information + */ + type record of GvlTableEntry GvlTable; + + /** + * @desc Entry of Address table + * @member key Reference key of the entry + * @member macAddress Link-layer address + * @member macSolNodeMca Link-layer solicited node multicast address + * @member lla IPv6 link-local address + * @member solNodeMca IPv6 solicited node multicast address + */ + type record AddressTableEntry { + charstring key, + MacAddress macAddress, + MacAddress macSolNodeMca, + Ipv6Address lla, + Ipv6Address solNodeMca + } + + /** + * @desc Table containing Address information + */ + type record of AddressTableEntry AddressTable; + + } // end ipv6OverGeoConfigurationTypes + + group ipv6OverGeoConfigurationValues { + + type record of integer GvlIdxList; + + type record of UInt32 UInt32List; + + const integer c_gvl1 := 0; + const integer c_gvl2 := 1; + const integer c_gvl3 := 2; + + const charstring c_gvl1_name := "GVL1"; + const charstring c_gvl2_name := "GVL2"; + const charstring c_gvl3_name := "GVL3"; + + const charstring c_gvlArea1 := "GVL_AREA1"; + const charstring c_gvlArea2 := "GVL_AREA2"; + const charstring c_gvlArea3 := "GVL_AREA3"; + + } // end ipv6OverGeoConfigurationValues + + group ethernet { + + const MacAddress c_macBroadcastAddr := '333300000001'O; + + } // end ethernet + + group ipv6 { + + /** + * @desc PDU type derived from RFC2460 + */ + type record Ipv6Packet { + Ipv6Header ipv6Hdr, + ExtensionHeaderList extHdrList optional, + Ipv6Payload ipv6Payload optional + } with { + variant "FIELDORDER(msb)" + } + + /** + * @desc Derived from RFC 2460 Section 3 + * @url http://www.ietf.org/rfc/rfc2460.txt + */ + type record Ipv6Header { + UInt4 version, + UInt8 trafficClass, + UInt20 flowLabel, + UInt16 payloadLength, + UInt8 nextHeader, + UInt8 hopLimit, + Ipv6Address sourceAddress, + Ipv6Address destinationAddress + } + + group gn6ExtensionHeaderIds { + const UInt8 c_hopHdr := 0; + const UInt8 c_tcpHdr := 6; + const UInt8 c_udpHdr := 17; + const UInt8 c_tunneledIpHdr := 41; + const UInt8 c_routeHdr := 43; + const UInt8 c_fragHdr := 44; + const UInt8 c_espHdr := 50; + const UInt8 c_authHdr := 51; + const UInt8 c_icmpHdr := 58; + const UInt8 c_noNextHdr := 59; + const UInt8 c_dstHdr := 60; + const UInt8 c_mobileHdr := 135; + } + + /** + * @desc IPv6 extension header list + */ + type octetstring ExtensionHeaderList; + + /** + * @desc IPv6 payload + */ + type union Ipv6Payload { + RouterAdvertisementMsg routerAdvMsg, + octetstring octetstringMsg + } + + /** + * @desc IPv6 Address + */ + type Oct16 Ipv6Address with {encode "length(16)"}; + + group rfc2461MessageTypes { + const UInt8 c_prefixInfo := 3 ; + const UInt8 c_rtAdvMsg := 134; + } // end group rfc2461MessageTypes + + group ipv6Address { + //Prefix + const Oct2 c_llaMcaPrefix := 'FF02'O ; + const Oct2 c_llaPrefix := 'FE80'O ; + //Postfix + const Oct2 c_allNodesMcaPostfix := '0001'O ; + const Oct2 c_allRoutersMcaPostfix := '0002'O ; + const Oct2 c_anycastPostfix := 'FFFF'O ; + const Oct1 c_haAnycastPostfix := '7E'O ; + //Wellknown Multicast Address + const Ipv6Address c_allNodesMca := c_llaMcaPrefix & c_12ZeroBytes & c_allNodesMcaPostfix ; + const Ipv6Address c_allRoutersMca := c_llaMcaPrefix & c_12ZeroBytes & c_allRoutersMcaPostfix ; + //Unspecified + const Ipv6Address c_unspecified := '00000000000000000000000000000000'O; + + //geographic + const Bit7 c_itsGn6aslGeoAnycastID := '1111101'B; // TDB by IANA + }//end group ipv6Address + + /** + * @desc PDU type derived from RFC2461 clause 4.2 + */ + type record RouterAdvertisementMsg { + UInt8 icmpType(c_rtAdvMsg), + UInt8 icmpCode, + Oct2 checksum, + UInt8 curHopLimit, + UInt1 managedConfigFlag, + UInt1 otherConfigFlag, + UInt1 homeAgentFlag, + UInt5 reserved, + UInt16 routerLifetime, + UInt32 reachableTime, + UInt32 retransTimer, + RtAdvOptions rtAdvOptions optional + } // FIXME CHECK while TITAN refuse it: with { variant (checksum) "MarkForIPv6ChecksumCalculation" } + + /** + * @desc RouterAdvertisement option list + * + * @remark Any RtAdvOptions value should at least have + * one of the first three options present! + */ + type set RtAdvOptions { + SrcLinkLayerAddress srcLinkLayerAddr optional, +// MtuOption mtuOption optional, + PrefixInfoList prefixInfoList optional, +// AdvertisementInterval advertisementInterval optional, +// HomeAgentInfo homeAgentInfo optional, + octetstring otherOption optional + } + + /** + * @desc Derived from RFC2461 clause4.6.1 + MIPv6 + * @url http://www.ietf.org/rfc/rfc2461.txt + */ + type record SrcLinkLayerAddress { + UInt8 icmpType(c_srcLinkLayerAddress), + UInt8 optionLength, + Oct6to15 linkLayerAddr + } + + type set length (1..c_maxNrPrefixInfo) of PrefixInfo PrefixInfoList; + + /** + * @desc Derived from RFC 2461 clause 4.6.2 + */ + type record PrefixInfo { + UInt8 icmpType(c_prefixInfo), + UInt8 optionLength, + UInt8 prefixLength, + UInt1 linkFlag, + UInt1 autoConfigFlag, + UInt1 rtAddrFlag, + UInt5 reserved1, + UInt32 validLifetime, + UInt32 preferredLifetime, + UInt32 reserved2, + Prefix prefix + } + + type Ipv6Address Prefix ; + + group neighbourDiscoveryConstants { + const UInt8 c_maxNrPrefixInfo := 10; + const UInt1 c_rtAddrFlag0 := 0; + + const UInt1 c_aFlag0 := 0; + const UInt1 c_aFlag1 := 1; + const UInt1 c_rFlag0 := 0; + const UInt1 c_rFlag1 := 1; + const UInt1 c_sFlag0 := 0; + const UInt1 c_sFlag1 := 1; + const UInt1 c_oFlag0 := 0; + const UInt1 c_oFlag1 := 1; + const UInt1 c_mFlag0 := 0; + const UInt1 c_mFlag1 := 1; + const UInt1 c_lFlag0 := 0; + const UInt1 c_lFlag1 := 1; + + const UInt16 c_zeroLifetime := 0 ; + const UInt32 c_validLifetime20s := 20; + const UInt32 c_validLifetime30s := 30; + const UInt32 c_preferredLifetime30s := 30; + + } // end group neighbourDiscoveryConstants + + const UInt8 c_srcLinkLayerAddress := 1; + const UInt8 c_prefixInfoLen := 4; + + } // end group ipv6 + + group acPrimitives { + + /** + * @desc GN6 TA primitives + * @member getInterfaceInfos Primitive for querying IUT's interface information + */ + type union AcGn6Primitive { + integer getInterfaceInfos + } + + /** + * @desc GN6 TA responses + * @member interfaceInfoList Primitive for retrieving IUT's interface information + */ + type union AcGn6Response { + AcGn6InterfaceInfoList interfaceInfoList + } + + /** + * @desc List of interface informations + */ + type record of AcGn6InterfaceInfo AcGn6InterfaceInfoList; + + /** + * @desc Interface informations + * @member interfaceName Interface name + * @member ipv6AddressList Configured IPv6 addresses for this interface + */ + type record AcGn6InterfaceInfo { + charstring interfaceName, + Ipv6AddressList ipv6AddressList + } + + /** + * @desc List of IPv6 addresses + */ + type record of Ipv6Address Ipv6AddressList; + + } // end acPrimitives + + group networkAndTransportPrimitives { + + group nt2Primitives { + + /** + * @desc NT2 IPv6 over GeoNetworking Indication Primitive + */ + type record IPv6OverGeoNetworkingInd { + charstring interface, + MacAddress macSourceAddress, + MacAddress macDestinationAddress, + Ipv6Packet ipv6Packet + } + + /** + * @desc NT2 IPv6 over GeoNetworking Request Primitive + */ + type record IPv6OverGeoNetworkingReq { + charstring interface, + MacAddress macSourceAddress, + MacAddress macDestinationAddress, + Ipv6Packet ipv6Packet + } + + } // end nt2Primitives + + } // End of group networkAndTransportPrimitives + with { + encode "LibIts_Interface" + } // end interfacePrimitives + +} +with { + variant "" + encode "LibItsIpv6OverGeoNetworking" +} diff --git a/lib/module.mk b/lib/module.mk new file mode 100644 index 0000000000000000000000000000000000000000..7aa792b4e1f9f0a3229b5ad5767aad2973a67798 --- /dev/null +++ b/lib/module.mk @@ -0,0 +1,6 @@ +sources := \ +LibItsIpv6OverGeoNetworking_EncdecDeclarations.ttcn \ +LibItsIpv6OverGeoNetworking_Pics.ttcn \ +LibItsIpv6OverGeoNetworking_Pixits.ttcn \ +LibItsIpv6OverGeoNetworking_Templates.ttcn \ +LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn diff --git a/lib_system/LibItsIpv6OverGeoNetworking_Functions.ttcn b/lib_system/LibItsIpv6OverGeoNetworking_Functions.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..5a52ae0925ce77b148d80224e86b1ff2a1c28c45 --- /dev/null +++ b/lib_system/LibItsIpv6OverGeoNetworking_Functions.ttcn @@ -0,0 +1,761 @@ +/** + * @author ETSI / STF405 / STF449 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_Functions.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_Functions.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Module containing functions for Ipv6OverGeoNetworking + * @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 LibItsIpv6OverGeoNetworking_Functions { + + // Libcommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_DataStrings all; + import from LibCommon_VerdictControl all; + import from LibCommon_Sync all; + import from LibCommon_Time all; + import from LibCommon_TextStrings all; + + // LibIts + import from LibItsGeoNetworking_TypesAndValues all; + import from LibItsGeoNetworking_Functions all; + import from LibItsGeoNetworking_Templates all; + import from LibItsGeoNetworking_TestSystem all; + import from LibItsIpv6OverGeoNetworking_TestSystem all; + import from LibItsIpv6OverGeoNetworking_TypesAndValues all; + import from LibItsIpv6OverGeoNetworking_Templates all; + import from LibItsIpv6OverGeoNetworking_Pixits all; + import from LibItsExternal_TypesAndValues {type MacAddress}; + + group ipv6OverGeoConfigurationFunctions { + + /** + * @desc This configuration features: + * - one ITS node (IUT) + * - two ITS nodes (nodeA, nodeB) + * - three GVLs + */ + function f_cf01UpGn6() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Variables + var float v_distance; + + // Map + map(self:ipv6OverGeoNetworkingPort, system:ipv6OverGeoNetworkingPort); + + f_cf01Up(); + v_distance := f_distance(f_getPosition(c_compNodeB), f_getPosition(c_compIut)); + + // Compute IPv6 addresses + f_addAddresses(vc_addressTable, c_compIut); + f_addAddresses(vc_addressTable, c_compNodeA); + f_addAddresses(vc_addressTable, c_compNodeB); + + // Create additional areas + f_addArea(vc_areaTable, c_gvlArea1, + f_computeSquareArea(f_getPosition(c_compIut), float2int(2.1 * v_distance))); + f_addArea(vc_areaTable, c_gvlArea2, + f_computeSquareArea(f_getPosition(c_compIut), float2int(2.2 * v_distance))); + f_addArea(vc_areaTable, c_gvlArea3, + f_computeSquareArea(f_getPosition(c_compIut), float2int(2.3 * v_distance))); + + // Create GVLs + f_addGvl(c_gvl1_name, f_getPrefix(1), f_getPrefixLength(1), c_gvlArea1, ""); + f_addGvl(c_gvl2_name, f_getPrefix(2), f_getPrefixLength(2), c_gvlArea2, ""); + f_addGvl(c_gvl3_name, f_getPrefix(3), f_getPrefixLength(3), c_gvlArea3, ""); + + + } // end f_cf01Up + + /** + * @desc Deletes configuration cf01Gn6 + */ + function f_cf01DownGn6() runs on ItsIpv6OverGeoNetworking system ItsIpv6OverGeoNetworkingSystem { + + // Map + unmap(self:ipv6OverGeoNetworkingPort, system:ipv6OverGeoNetworkingPort); + + f_cf01Down(); + + } // end f_cf01Down + + } // end group ipv6OverGeoConfigurationFunctions + + group ipv6OverGeoNwAltsteps { + + /** + * @desc IPv6 default. + */ + altstep a_ipv6Default() runs on ItsIpv6OverGeoNetworking { + var GeoNetworkingInd v_geoNwInd; + + [] geoNetworkingPort.receive ( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwBroadcastPacketWithNextHeaderAndPayload( + ?, + ?, + e_ipv6, + ?// FIXME Check that we have an IPv6Payload mw_octetstringPayload + ) + ) + ) + ) { + log("*** " & testcasename() & ": INFO: Ignoring unsupported IPv6 packet ***"); + repeat; + } + [] geoNetworkingPort.receive ( + mw_geoNwInd( + mw_geoNwPdu( + mw_geoNwBroadcastPacketWithNextHeaderAndPayload( + ?, + ?, + e_ipv6, + ? + ) + ) + ) + ) -> value v_geoNwInd { + if (match( + v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.srcPosVector, + ( + mw_longPosVectorPosition(f_getPosition(c_compNodeA)), + mw_longPosVectorPosition(f_getPosition(c_compNodeB)) + ) + )) { + log("*** " & testcasename() & ": INFO: Ignoring rebroadcasted IPv6 packet ***"); + repeat; + } + else { + log("*** " & testcasename() & ": ERROR: Received an unexpected message ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + } + [] ipv6OverGeoNetworkingPort.receive( + mw_ipv6OverGeoNwInd( + ?, + ?, + c_macBroadcastAddr, + ? // Refine rtAdv + ) + ) { + log("*** " & testcasename() & ": INFO: Ignoring Router Advertisement ***"); + repeat; + } + + } // end a_ipv6Default + + } // end ipv6OverGeoNwAltsteps + + group preambles { + + /** + * @desc Preamble for IPv6 neighbour nodes + */ + function f_prIpv6Neighbour() runs on ItsIpv6OverGeoNetworking { + f_prNeighbour(); + activate(a_ipv6Default()); + } + + /** + * @desc Preamble to configure the GVLs, either manual or via RA + * @param p_gvls The GVLs to configure + * @param p_validLifetimes The specific invalidation timer for the GVLs + */ + function f_prConfigureGVL( + in GvlIdxList p_gvls, + in template (omit) UInt32List p_validLifetimes := omit + ) runs on ItsIpv6OverGeoNetworking + return FncRetCode { + var integer i; + var charstring v_str := ""; + var UInt32 v_validLifetime := c_validLifetime30s; + + if (lengthof(vc_gvlTable)=(i+1)) { + v_validLifetime := valueof(p_validLifetimes[i]); + } + f_sendGeoBroadcastWithRtAdv(vc_gvlTable[i], c_compNodeA, v_validLifetime); + } + f_sleep(PX_T_BUILD_CONFIG); + } + f_acUpdateInterfaces(); + + return e_success; + } + + } // end preambles + + group postambles { + + /** + * @desc Postamble for neighbour nodes + */ + function f_poIpv6Neighbour() runs on ItsIpv6OverGeoNetworking { + f_poNeighbour(); + } + } // end postambles + + group testAdapter { + + /** + * @desc Retrieve IUT's interface names and associate them with predefined GVLs + */ + function f_acUpdateInterfaces() runs on ItsIpv6OverGeoNetworking { + + var AcGn6Response v_response; + var AcGn6InterfaceInfoList v_interfaceInfoList; + var integer i, j, k; + + acPort.send(m_acGetInterfaceInfos); + tc_ac.start; + alt { + [] acPort.receive(mw_acInterfaceInfos) -> value v_response { + tc_ac.stop; + + v_interfaceInfoList := valueof(v_response.interfaceInfoList); + // Go through interfaceInfos + for(i:=0; i < sizeof(v_interfaceInfoList); i:=i+1) { + // Go through IPv6 addresses configured for this interface + for(j:=0; j < sizeof(v_interfaceInfoList[i].ipv6AddressList); j:=j+1) { + // Compare IPv6 address to recorded GVL prefixes + for(k:=0; k < sizeof(vc_gvlTable); k:=k+1) { + if(f_isIpv6AddressCorrespondingToPrefix( + v_interfaceInfoList[i].ipv6AddressList[j], + vc_gvlTable[k].prefix, + vc_gvlTable[k].prefixLength)) { + // interface i is associated to GVL k + vc_gvlTable[k].interface := v_interfaceInfoList[i].interfaceName; + break; + } + } + if(k >= sizeof(vc_gvlTable)) { + // GVL already found + break; + } + } + } + } + [] acPort.receive { + tc_ac.stop; + log("*** " & testcasename() & ": ERROR: Received unexpected message ***"); + f_selfOrClientSyncAndVerdict("error", e_error); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Timeout while waiting for adapter control event result ***"); + f_selfOrClientSyncAndVerdict("error", e_timeout); + } + } + } + + } // end group testAdapter + + group sendFunctions { + + /** + * @desc Send a GeoBroadcast containing an IPv6 Router Advertisement + * @param p_gvl Name of the GVL for which the RA is sent + * @param p_compName Name of the component sending this packet + */ + function f_sendGeoBroadcastWithRtAdv( + in template (value) GvlTableEntry p_gvl, + in charstring p_compName, + in UInt32 p_validLifetime := c_validLifetime30s + ) runs on ItsIpv6OverGeoNetworking { + var bitstring v_ipv6Payload; + var AddressTableEntry v_nodeAddresses := f_getAddresses(p_compName); + var LongPosVector v_nodeLongPosVector := f_getPosition(p_compName); + + v_ipv6Payload := encvalue( + m_ipv6Packet( + v_nodeAddresses.lla, + c_allNodesMca, + c_icmpHdr, + m_rtAdvWithOptions( + m_rtAdvOpt_prefixOpt( + p_gvl.prefixLength, + c_lFlag1, + c_aFlag1, + p_validLifetime, + c_preferredLifetime30s, + valueof(p_gvl.prefix) + ) + ) + ) + ); + + f_sendGeoNetMessageWithPayload( + m_geoNwReq_linkLayerBroadcast( + m_geoNwPdu( + m_geoNwBroadcastPacket( + v_nodeLongPosVector, + vc_localSeqNumber, + f_getGeoBroadcastArea(valueof(p_gvl.area)) + ) + ) + ), + bit2oct(v_ipv6Payload) + ); + } + + } //end group sendFunctions + + group miscellaneous { + + /** + * @desc Add GVL information in the GVL table + * @param p_gvlKey Name of the GVL + * @param p_prefix IPv6 prefix associated with the GVL + * @param p_prefixLength Prefix length + * @param p_area Name of the GeoArea associated with the GVL + * @param p_interface Name of IUT's virtual interface associated with the GVL + */ + function f_addGvl( + in charstring p_gvlKey, + in Oct16 p_prefix, + in UInt8 p_prefixLength, + in charstring p_area, + in charstring p_interface + ) runs on ItsIpv6OverGeoNetworking { + vc_gvlTable[lengthof(vc_gvlTable)] := { + key := p_gvlKey, + prefix := p_prefix, + prefixLength := p_prefixLength, + area := p_area, + interface := p_interface + }; + } // end f_addGvl + + /** + * @desc Gets the Geographical Virtual link entry associated to an area + * @param p_gvlName Name of the GVL + */ + function f_getGvl(in charstring p_gvlName) runs on ItsIpv6OverGeoNetworking return GvlTableEntry { + var GvlTableEntry v_return; + var integer i := 0; + + for (i:=0; i 64) { + log("*** " & testcasename() & ": ERROR: Wrong prefixLen (max 64 bits) ***"); + return int2oct(0, 8); + } + + //Fill v_prefixReady with existing Prefix + for (i:=0; i 64) { + log("*** " & testcasename() & ": ERROR: Wrong prefixLen ***"); + return '00000000000000000000000000000000'O; + } + + // compute interface ID + v_interfaceIdReady := f_createUniqueInterfaceId(f_getAddresses(p_compName).macAddress); + + return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & v_interfaceIdReady; + + } // end f_computeGlobalAddress + + /** + * @desc Compute Home Agent anycast address for a prefix + * @param p_prefix Prefix for which the address is computed + * @param p_prefixLen Length of the prefix + * @return Home Agent anycast address + */ + function f_computeHomeAgentAnycastAddress( + in Oct16 p_prefix, + in UInt8 p_prefixLen + ) return Ipv6Address { + var Oct8 v_haAnycast := 'FDFFFFFFFFFFFFFE'O; + + if (p_prefixLen != 64) { + log("*** " & testcasename() & ": ERROR: Wrong prefixLen ***"); + return '00000000000000000000000000000000'O; + } + + return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & v_haAnycast; + } // end f_computeHomeAgentAnycastAddress + + /** + * @desc Computes global-scoped unicast-prefix-based multicast Ipv6 address + * @param p_prefix Prefix for which the address is computed + * @param p_prefixLen Length of the prefix in bits (max 64) + * @param p_groupId Group ID + * @return Global-scoped unicast-prefix-based multicast Ipv6 address + */ + function f_computeGlobalScopedUnicastPrefixBasedMulticastIpv6Address( + in Oct16 p_prefix, + in UInt8 p_prefixLen, + in UInt32 p_groupId + ) return Ipv6Address { + var Oct3 v_leftPart := 'FF3E00'O; + + if (p_prefixLen>64) { + log("*** " & testcasename() & ": ERROR: Wrong prefixLen, max 64 bits allowed ***"); + return int2oct(0, 16); + } + + return v_leftPart & int2oct(p_prefixLen, 1) & f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & int2oct(p_groupId, 4); + } + + /** + * @desc Computes geographic anycast Ipv6 address + * @param p_prefix Prefix for which the address is computed + * @param p_prefixLen Length of the prefix in bits (max 64) + * @return Geographic anycast Ipv6 address + */ + function f_computeGeographicAnycastIpv6Address( + in Oct16 p_prefix, + in UInt8 p_prefixLen + ) return Ipv6Address { + var Bit64 v_interfaceIdentifierField := '11111101'B & int2bit(1, 49) & c_itsGn6aslGeoAnycastID; + + if (p_prefixLen>64) { + log("*** " & testcasename() & ": ERROR: Wrong prefixLen, max 64 bits allowed ***"); + return int2oct(0, 16); + } + + return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & bit2oct(v_interfaceIdentifierField); + } + + /** + * @desc Gets a predefined prefix + * @param p_index Index of the predefined prefix + * @return IPv6 prefix + * @see PX_GN6_PREFIX_1 + * @see PX_GN6_PREFIX_2 + * @see PX_GN6_PREFIX_3 + */ + function f_getPrefix(in integer p_index) return Oct16 { + + select (p_index) { + case (1) { + return PX_GN6_PREFIX_1; + } + case (2) { + return PX_GN6_PREFIX_2; + } + case (3) { + return PX_GN6_PREFIX_3; + } + } + + return int2oct(0, 16); + + } // end f_getPrefix + + /** + * @desc Gets the length of a predefined prefix + * @param p_index Index of the predefined prefix + * @return length of a prefix + * @see PX_GN6_PREFIX_LENGTH_1 + * @see PX_GN6_PREFIX_LENGTH_2 + * @see PX_GN6_PREFIX_LENGTH_3 + */ + function f_getPrefixLength(in integer p_index) return UInt8 { + + select (p_index) { + case (1) { + return PX_GN6_PREFIX_LENGTH_1; + } + case (2) { + return PX_GN6_PREFIX_LENGTH_2; + } + case (3) { + return PX_GN6_PREFIX_LENGTH_3; + } + } + + return 64; + + } // end f_getPrefixLength + + /** + * @desc Checks whether an IPv6 address belongs to an IPv6 prefix + * @param p_ipv6Address IPv6 address to be checked + * @param p_prefix Prefix + * @param p_prefixLength Length of the prefix + * @return Boolean - True if IPv6 address belongs to prefix, False otherwise + */ + function f_isIpv6AddressCorrespondingToPrefix(Ipv6Address p_ipv6Address, Ipv6Address p_prefix, UInt8 p_prefixLength) + return boolean { + + var bitstring v_ipv6Address := oct2bit(p_ipv6Address); + var bitstring v_prefix := oct2bit(p_prefix); + var integer i; + + for(i:=0; i < p_prefixLength; i:=i+1) { + if(v_ipv6Address[i] != v_prefix[i]) { + return false; + } + } + + return true; + } // end f_isIpv6AddressCorrespondingToPrefix + + /** + * @desc Calculate ICMPv6 checksum on pseudo header according RFC 4443 - Clause 2.3 + * @param p_sourceAddress Source address, + * @param p_destinationAddress Destination address + * @param p_payloadLength Upper-Layer Packet Length + * @param p_payload Upper-Layer payload + * @param p_nextHdr Next header value (e.g. 0x3a for ICMPv6) + */ + function f_computeIPv6CheckSum( + in template (value) Ipv6Address p_sourceAddress, + in template (value) Ipv6Address p_destinationAddress, + in template (value) integer p_payloadLength, + in template (value) GnRawPayload p_payload, + in template (value) UInt8 p_nextHdr + ) return Oct2 { + var Oct2 v_checksum := 'FFFF'O; + + log("*** " & testcasename() & ": INFO: calling fx_computeIPv6CheckSum() ***"); + v_checksum := fx_computeIPv6CheckSum(valueof(p_sourceAddress), valueof(p_destinationAddress), valueof(p_payloadLength), valueof(p_payload), valueof(p_nextHdr)); + + return v_checksum; + } + + } // end group miscellaneous + + group externalFunctions { + + /** + * @desc Calculate ICMPv6 checksum on pseudo header according RFC 4443 - Clause 2.3 + * @param p_sourceAddress Source address, + * @param p_destinationAddress Destination address + * @param p_payloadLength Upper-Layer Packet Length + * @param p_payload Upper-Layer payload + * @param p_nextHdr Next header value (e.g. 0x3a for ICMPv6) + * @return The checksum value + *
+         * Pseudo header is defined by RFC 2460 - Clause 8.1
+         *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         *  |                                                               |
+         *  +                                                               +
+         *  |                                                               |
+         *  +                         Source Address                        +
+         *  |                                                               |
+         *  +                                                               +
+         *  |                                                               |
+         *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         *  |                                                               |
+         *  +                                                               +
+         *  |                                                               |
+         *  +                      Destination Address                      +
+         *  |                                                               |
+         *  +                                                               +
+         *  |                                                               |
+         *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         *  |                   Upper-Layer Packet Length                   |
+         *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         *  |                      zero                     |  Next Header  |
+         *  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+         * 
+ */ + external function fx_computeIPv6CheckSum( + in template (value) Ipv6Address p_sourceAddress, + in template (value) Ipv6Address p_destinationAddress, + in template (value) integer p_payloadLength, + in template (value) GnRawPayload p_payload, + in template (value) UInt8 p_nextHdr + ) return Oct2; + + } // End of group externalFunctions + +} // end LibItsIpv6OverGeoNetworking_Functions \ No newline at end of file diff --git a/lib_system/LibItsIpv6OverGeoNetworking_TestSystem.ttcn b/lib_system/LibItsIpv6OverGeoNetworking_TestSystem.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..e044549b1fab2e970acd90d0f94d7eb096e5d111 --- /dev/null +++ b/lib_system/LibItsIpv6OverGeoNetworking_TestSystem.ttcn @@ -0,0 +1,74 @@ +/** + * @author ETSI / STF405 + * @version $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/Ipv6OverGeoNetworking/LibItsIpv6OverGeoNetworking_TestSystem.ttcn $ + * $Id: LibItsIpv6OverGeoNetworking_TestSystem.ttcn 1318 2017-01-26 10:20:53Z filatov $ + * @desc Test System module for ITS Ipv6OverGeoNetworking + * @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 LibItsIpv6OverGeoNetworking_TestSystem { + + // LibCommon + import from LibCommon_Time {modulepar all}; + import from LibCommon_Sync all; + + // LibIts + import from LibItsGeoNetworking_TestSystem all; + import from LibItsIpv6OverGeoNetworking_TypesAndValues all; + import from LibItsExternal_TypesAndValues all; + + group componentDefinitions { + + /** + * @desc ITS System Adapter + */ + type component ItsIpv6OverGeoNetworkingSystem extends ItsGeoNetworkingSystem { + + // NT2 ports + port IPv6OverGeoNetworkingPort ipv6OverGeoNetworkingPort; + + } // end component ItsAdapter + + } // End of group componentDefinitions + + group interfacePorts { + + group networkAndTransportPorts { + + group nt2Ports { + + /** + * @desc NT2 IPv6 over GeoNetworking Port (IPv6/GeoNetworking/G5) + */ + type port IPv6OverGeoNetworkingPort message { + in IPv6OverGeoNetworkingInd; + out IPv6OverGeoNetworkingReq; + } // end IPv6OverGeoNetworkingPort + + } // End of group nt2Ports + + } // End of group networkAndTransportPorts + + } // End of group interfacePorts + + /** + * @desc Test component for ITS Network and Transport layer + */ + type component ItsIpv6OverGeoNetworking extends ItsGeoNetworking { + + // NT2 ports + port IPv6OverGeoNetworkingPort ipv6OverGeoNetworkingPort; + + // timers + + //variables for Gn6 + var GvlTable vc_gvlTable := {}; + var AddressTable vc_addressTable := {}; + + + } // End of component Ipv6OverGeoNetworking + +} // End of module LibItsIpv6OverGeoNetworking_TestSystem diff --git a/lib_system/module.mk b/lib_system/module.mk new file mode 100644 index 0000000000000000000000000000000000000000..9a343e8d9b365fc791dd7214a1213389d19b13e8 --- /dev/null +++ b/lib_system/module.mk @@ -0,0 +1,4 @@ +sources := \ +LibItsIpv6OverGeoNetworking_Functions.ttcn \ +LibItsIpv6OverGeoNetworking_TestSystem.ttcn \ + diff --git a/module.mk b/module.mk new file mode 100644 index 0000000000000000000000000000000000000000..364a772823a4513b3d392253a0a8569e02afaaf9 --- /dev/null +++ b/module.mk @@ -0,0 +1,24 @@ +sources := \ +ItsIpv6OverGeoNetworking_TestCases.ttcn \ +ItsIpv6OverGeoNetworking_TestControl.ttcn + +modules := lib \ + lib_system \ + ../LibCommon \ + ../LibIts \ + ../AtsGeoNetworking/lib \ + ../AtsGeoNetworking/lib_system \ + ../AtsSecurity/lib \ + ../AtsSecurity/lib_system \ + ../../ccsrc/Ports/LibIts_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/GeoNetworking \ + ../../ccsrc/Protocols/UpperTester \ + ../../ccsrc/Protocols/Security \