Commit 22399a1e authored by tepelmann's avatar tepelmann
Browse files

Modified GN type system.

First part of GN6 test case modification.
parent 61bbbec7
......@@ -23,13 +23,7 @@ module LibItsGeoNetworking_Pics {
*/
modulepar GN_Address PICS_GN_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationType := e_passengerCar,
stationCountryCode := c_uInt10Zero,
mid := c_6ZeroBytes
};
......@@ -39,13 +33,13 @@ module LibItsGeoNetworking_Pics {
* @see ETSI TS 102 871-1 v1.1.1 A.40/2
*/
modulepar TypeOfAddress PICS_GN_LOCAL_ADDR_CONF_METHOD := e_initial;
/**
* @desc Type of ITS Station
* @see ETSI TS 102 871-1 v1.1.1 A.40/4
*/
modulepar StationTypeIdentifier PICS_GN_STATION_TYPE := e_vehicleStation;
// /**
// * @desc Type of ITS Station
// * @see ETSI TS 102 871-1 v1.1.1 A.40/4
// */
// modulepar StationTypeIdentifier PICS_GN_STATION_TYPE := e_vehicleStation;
//
/**
* @desc Minimum update frequency of local position vector (LPV) in ms
* @see ETSI TS 102 871-1 v1.1.1 A.40/5
......
......@@ -23,13 +23,7 @@ module LibItsGeoNetworking_Pixits {
*/
modulepar GN_Address PX_TS_NODE_A_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationType := e_passengerCar,
stationCountryCode := c_uInt10Zero,
mid := c_6ZeroBytes
};
......@@ -39,13 +33,7 @@ module LibItsGeoNetworking_Pixits {
*/
modulepar GN_Address PX_TS_NODE_B_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationType := e_passengerCar,
stationCountryCode := c_uInt10Zero,
mid := c_6ZeroBytes
};
......@@ -55,13 +43,7 @@ module LibItsGeoNetworking_Pixits {
*/
modulepar GN_Address PX_TS_NODE_C_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationType := e_passengerCar,
stationCountryCode := c_uInt10Zero,
mid := c_6ZeroBytes
};
......@@ -71,13 +53,7 @@ module LibItsGeoNetworking_Pixits {
*/
modulepar GN_Address PX_TS_NODE_D_LOCAL_GN_ADDR := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationType := e_passengerCar,
stationCountryCode := c_uInt10Zero,
mid := c_6ZeroBytes
};
......
......@@ -126,16 +126,16 @@ module LibItsGeoNetworking_TestSystem {
* @desc NT2 GeoNetworking Indication Primitive
*/
type record GeoNetworkingInd {
GeoNetworkingPacket msgIn,
MacAddress macDestinationAddress
GeoNetworkingPdu msgIn,
MacAddress macDestinationAddress
}
/**
* @desc NT2 GeoNetworking Request Primitive
*/
type record GeoNetworkingReq {
GeoNetworkingPacket msgOut,
MacAddress macDestinationAddress
GeoNetworkingPdu msgOut,
MacAddress macDestinationAddress
}
} // end nt2Primitives
......
......@@ -12,11 +12,14 @@ module LibItsIpv6OverGeoNetworking_Functions {
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;
......@@ -56,9 +59,9 @@ module LibItsIpv6OverGeoNetworking_Functions {
f_computeSquareArea(f_getPosition(c_compIut), float2int(2.3 * v_distance)));
// Create GVLs
f_addGvl(c_automaticGvl1, f_getPrefix(1), f_getPrefixLength(1), c_gvlArea1, "");
f_addGvl(c_automaticGvl2, f_getPrefix(2), f_getPrefixLength(2), c_gvlArea2, "");
f_addGvl(c_automaticGvl3, f_getPrefix(3), f_getPrefixLength(3), c_gvlArea3, "");
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
......@@ -83,19 +86,21 @@ module LibItsIpv6OverGeoNetworking_Functions {
* @desc IPv6 default.
*/
altstep a_ipv6Default() runs on ItsIpv6OverGeoNetworking {
var GeoNetworkingInd v_geoNwInd;
[] geoNetworkingPort.receive (
mw_geoNwInd(
mw_geoNwPduWithPayload(
mw_geoBroadcastHeaderWithNextHeader(?, ?, ?, e_ipv6),
mw_ipv6Payload(
mw_ipv6Packet(
?,
?,
?,
mw_octetstringPayload(?)
)
)
//TODO handle payload -> former mw_geoNwPduWithPayload
mw_geoNwPdu(
mw_geoNwBroadcastPacketWithNextHeader(?, ?, e_ipv6)//,
// mw_ipv6Payload(
// mw_ipv6Packet(
// ?,
// ?,
// ?,
// mw_octetstringPayload(?)
// )
// )
)
)
) {
......@@ -105,23 +110,29 @@ module LibItsIpv6OverGeoNetworking_Functions {
[] geoNetworkingPort.receive (
mw_geoNwInd(
mw_geoNwPduWithPayload(
mw_geoBroadcastHeaderWithNextHeader(
(
mw_longPosVectorPosition_withDelta(f_getPosition(c_compNodeA)),
mw_longPosVectorPosition_withDelta(f_getPosition(c_compNodeB))
),
?,
?,
e_ipv6),
mw_ipv6Payload(
?
)
//TODO handle payload -> former mw_geoNwPduWithPayload
mw_geoNwPdu(
mw_geoNwBroadcastPacketWithNextHeader(?, ?, e_ipv6)//,
// mw_ipv6Payload(
// ?
// )
)
)
) {
log("*** a_ipv6Default: INFO: Ignoring rebroadcasted IPv6 packet ***");
repeat;
) -> value v_geoNwInd {
if (match(
v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.srcPosVector,
(
mw_longPosVectorPosition_withDelta(f_getPosition(c_compNodeA)),
mw_longPosVectorPosition_withDelta(f_getPosition(c_compNodeB))
)
)) {
log("*** a_ipv6Default: INFO: Ignoring rebroadcasted IPv6 packet ***");
repeat;
}
else {
log("*** a_ipv6Default: ERROR: Received an unexpected message ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
}
[] ipv6OverGeoNetworkingPort.receive(
......@@ -142,25 +153,57 @@ module LibItsIpv6OverGeoNetworking_Functions {
group preambles {
/**
* @desc Preamble for IPv6 neighbour nodes
*/
function f_prIpv6Neighbour() runs on ItsIpv6OverGeoNetworking {
f_prNeighbour();
activate(a_ipv6Default());
}
activate(a_ipv6Default());
}
/**
* @desc Preamble to configure the GVLs, either manual or via RA
* @param p_nbrOfGvls The number of Gvls to configure
*/
function f_prConfigureGVL(in GvlIdxList p_gvls) runs on ItsIpv6OverGeoNetworking
return FncRetCode {
var integer i;
var charstring v_str := "";
if (lengthof(vc_gvlTable)<lengthof(p_gvls)) {
return e_error;
}
if (PX_CONFIG_MANUAL_GVL) {
// Manually configure GVL
for (i:=0; i<lengthof(p_gvls); i:=i+1) {
v_str := v_str & "Prefix=" & oct2str(vc_gvlTable[i].prefix) & "/" & int2str(vc_gvlTable[i].prefixLength) & " "
& "Area=" & vc_gvlTable[i].area & c_CRLF;
}
action("Please configure manual SGVLs: " & c_CRLF & v_str & c_CRLF);
f_sleep(PX_TWAIT);
}
else {
for (i:=0; i<lengthof(p_gvls); i:=i+1) {
f_sendGeoBroadcastWithRtAdv(vc_gvlTable[i], c_compNodeA);
}
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();
}
f_poNeighbour();
}
} // end postambles
group testAdapter {
......@@ -234,30 +277,30 @@ module LibItsIpv6OverGeoNetworking_Functions {
f_sendGeoNetMessage(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload(
m_geoBroadcastHeader(
v_nodeLongPosVector,
//TODO handle payload -> former m_geoNwPduWithPayload
m_geoNwPdu(
m_geoNwBroadcastPacket(
v_nodeLongPosVector,
vc_localSeqNumber,
f_getGeoBroadcastArea(valueof(p_gvl.area))
),
m_ipv6Payload(
m_ipv6Packet(
v_nodeAddresses.lla,
c_allNodesMca,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_prefixOpt(
p_gvl.prefixLength,
c_lFlag1,
c_aFlag1,
c_validLifetime30s,
c_preferredLifetime30s,
p_gvl.prefix
)
)
)
)
)//,
// m_ipv6Payload(
// m_ipv6Packet(
// v_nodeAddresses.lla,
// c_allNodesMca,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_prefixOpt(
// p_gvl.prefixLength,
// c_lFlag1,
// c_aFlag1,
// c_validLifetime30s,
// c_preferredLifetime30s,
// p_gvl.prefix
// )
// )
// )
// )
)
)
);
......@@ -311,11 +354,11 @@ module LibItsIpv6OverGeoNetworking_Functions {
/**
* @desc Gets interface name of one of IUT's GVL
* @param p_gvlName Name of the GVL
* @param p_gvlIdx Index of the GVL
* @return Name of the GVL interface
*/
function f_getGvlInterface(in charstring p_gvlName) runs on ItsIpv6OverGeoNetworking return charstring {
return f_getGvl(p_gvlName).interface
function f_getGvlInterface(in integer p_gvlIdx) runs on ItsIpv6OverGeoNetworking return charstring {
return vc_gvlTable[p_gvlIdx].interface
} // end f_getGvlInterface
/**
......@@ -388,7 +431,7 @@ module LibItsIpv6OverGeoNetworking_Functions {
function f_addAddresses(
inout AddressTable p_addressTable,
in charstring p_componentName
) runs on ItsIpv6OverGeoNetworking {
) runs on ItsIpv6OverGeoNetworking {
const UInt8 c_uniIdLen := 64;
var AddressTableEntry v_addressTableEntry;
var MacAddress v_macAddr;
......@@ -443,7 +486,32 @@ module LibItsIpv6OverGeoNetworking_Functions {
return v_return;
} // end f_getAddresses
/**
* @desc Compute 64 bits prefix
* @param p_prefixBits Prefix
* @param p_prefixLen Prefix Length
* @return Prefix
*/
function f_compute64BitsPrefix(
in Bit128 p_prefixBits,
in UInt8 p_prefixLen
) return Oct8 {
var integer i;
var Bit64 v_prefixReadyBits := int2bit(0, 64);
if (p_prefixLen > 64) {
log("*** f_computePrefix: ERROR: Wrong prefixLen (max 64 bits) ***");
return int2oct(0, 8);
}
//Fill v_prefixReady with existing Prefix
for (i:=0; i<p_prefixLen; i:=i+1) {
v_prefixReadyBits[i] := p_prefixBits[i];
}
return bit2oct(v_prefixReadyBits);
}
/**
* @desc Compute global address based on prefix and MAC address
* @param p_compName Component name
......@@ -457,29 +525,17 @@ module LibItsIpv6OverGeoNetworking_Functions {
in UInt8 p_prefixLen
) runs on ItsIpv6OverGeoNetworking
return Ipv6Address {
var Oct8 v_prefixReady := int2oct(0,8);
var Oct8 v_interfaceIdReady := int2oct(0,8);
var Bit128 v_prefixBits := oct2bit(p_prefix);
var Bit64 v_prefixReadyBits := int2bit(0, 64);
var integer i;
if (p_prefixLen > 64) {
log("*** f_computeGlobalAddress: ERROR: Wrong prefixLen ***");
return '00000000000000000000000000000000'O;
}
else {
//Fill v_prefixReady with existing Prefix
for (i:=0; i<p_prefixLen; i:=i+1) {
v_prefixReadyBits[i] := v_prefixBits[i];
}
v_prefixReady := bit2oct(v_prefixReadyBits);
}
// compute interface ID
v_interfaceIdReady := f_createUniqueInterfaceId(f_getAddresses(p_compName).macAddress);
return v_prefixReady & v_interfaceIdReady;
return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & v_interfaceIdReady;
} // end f_computeGlobalAddress
......@@ -493,58 +549,57 @@ module LibItsIpv6OverGeoNetworking_Functions {
in Oct16 p_prefix,
in UInt8 p_prefixLen
) return Ipv6Address {
var UInt8 i;
const UInt8 c_uniIdLen := 64;
var Bit128 v_prefixBits := oct2bit(p_prefix);
var Bit64 v_prefixReadyBits := oct2bit('0000000000000000'O);
var Oct8 v_prefixReady := int2oct(0,8);
var Oct8 v_haAnycast := 'FDFFFFFFFFFFFFFE'O;
if (p_prefixLen != 64) {
log("*** f_computeHomeAgentAnycastAddress: ERROR: Wrong prefixLen ***");
return '00000000000000000000000000000000'O;
}
else {
//Fill v_prefixReady with existing Prefix
for (i:=0; i<p_prefixLen; i:=i+1) {
v_prefixReadyBits[i] := v_prefixBits[i];
}
v_prefixReady := bit2oct(v_prefixReadyBits);
return v_prefixReady & v_haAnycast;
}
return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & v_haAnycast;
} // end f_computeHomeAgentAnycastAddress
/**
* @desc Derives the traffic class from the IPv6 TrafficClass field
* @param p_trafficClass The traffic class value in the IPv6 packet
* @return The traffic class based on the definition in ETSI TS 102 636-6-1 Table 1
*/
function f_getTrafficClassFromIpv6Packet(in UInt8 p_trafficClass) return TrafficClass {
var TrafficClass v_trafficClass;
v_trafficClass.reserved := 0;
v_trafficClass.relevance := 0;
* @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_trafficClass<64) {
v_trafficClass.reliability := e_low;
v_trafficClass.latency := e_high
}
else if (p_trafficClass>63 and p_trafficClass<128) {
v_trafficClass.reliability := e_low;
v_trafficClass.latency := e_medium
if (p_prefixLen>64) {
log("*** f_computeGlobalScopedUnicastPrefixBasedMulticastIpv6Address: ERROR: Wrong prefixLen, max 64 bits allowed ***");
return int2oct(0, 16);
}
else if (p_trafficClass>127 and p_trafficClass<193) {
v_trafficClass.reliability := e_low;
v_trafficClass.latency := e_low
}
else {
v_trafficClass.reliability := e_low;
v_trafficClass.latency := e_veryLow
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("*** f_computeGeographicAnycastIpv6Address: ERROR: Wrong prefixLen, max 64 bits allowed ***");
return int2oct(0, 16);
}
return v_trafficClass;
} // end f_getTrafficClassFromPriority
return f_compute64BitsPrefix(oct2bit(p_prefix), p_prefixLen) & bit2oct(v_interfaceIdentifierField);
}
/**
* @desc Gets a predefined prefix
......
......@@ -11,6 +11,11 @@ module LibItsIpv6OverGeoNetworking_Pixits {
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.
*/
......@@ -53,5 +58,5 @@ module LibItsIpv6OverGeoNetworking_Pixits {
* @desc Name of IUT's virtual interface associated with TVL
*/
modulepar charstring PX_GN6_TVL_INTERFACE_NAME := "tvl0";
}
\ No newline at end of file
......@@ -74,7 +74,7 @@ module LibItsIpv6OverGeoNetworking_Templates {
* @desc Receive template for GN6 payload of type IPv6
* @param p_ipv6Packet Expected IPv6 packet to be received as GN6 payload
*/
template Payload mw_ipv6Payload(in template (present) Ipv6Packet p_ipv6Packet) := {
template (present) Payload mw_ipv6Payload(in template (present) Ipv6Packet p_ipv6Packet) := {
decodedPayload := {ipv6Packet := p_ipv6Packet},
rawPayload := ?
}
......
......@@ -62,10 +62,15 @@ module LibItsIpv6OverGeoNetworking_TypesAndValues {
group ipv6OverGeoConfigurationValues {
const charstring c_manualGvl := "GVL1";
const charstring c_automaticGvl1 := "GVL1";
const charstring c_automaticGvl2 := "GVL2";
const charstring c_automaticGvl3 := "GVL3";
type record of integer GvlIdxList;
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";
......@@ -162,6 +167,9 @@ module LibItsIpv6OverGeoNetworking_TypesAndValues {
const Ipv6Address c_allRoutersMca := c_llaMcaPrefix & c_12ZeroBytes & c_allRoutersMcaPostfix ;
//Unspecified
const Ipv6Address c_unspecified := '00000000000000000000000000000000'O;
//geographic
const Bit7 c_itsGn6aslGeoAnycastID := '1111101'B; //TODO TDB by IANA
}//end group ipv6Address
/**
......