Compare Revisions

The credentials to download the source code are:
 Username: svnusers
 Password: svnusers

Ignore whitespace Rev 1828 → Rev 1829

/trunk/unittests/codec/ttcn/test_CommonCodec.ttcn3
1,74 → 1,76
module test_CommonCodec /*language "TTCN-3:2009 Advanced Parameterization"*/ {
import from LibItsSecurity_TestSystem all;
type component TCType extends ItsSecurityBaseComponent { }
 
type component TCType { }
type record TestRecord {
bitstring bs optional
}
 
type record TestRecord {
bitstring bs optional
}
function test_decodePDU<PDUType>(in template PDUType p_pdu, in template (present) octetstring p_expEncMsg) runs on TCType {
var PDUType v_decMsg;
var bitstring v_encMsg;
var integer v_res := 0;
 
function test_decodePDU<PDUType>(in template PDUType p_pdu, in template (present) octetstring p_expEncMsg) runs on TCType {
var PDUType v_decMsg;
var bitstring v_encMsg;
var integer v_res := 0;
v_res := decvalue(oct2bit(valueof(p_expEncMsg)), v_decMsg);
select (v_res) {
case (0) {
if(match(v_decMsg, p_pdu)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
case (1) {
setverdict(fail, "Decoding failed.");
}
case (2) {
setverdict(fail, "Not enough bits.");
}
} // End of 'select' statement
} // End of function test_decodePDU<PDUType>
 
v_res := decvalue(oct2bit(p_expEncMsg), v_decMsg);
select (v_res) {
case (0) {
if(match(v_decMsg, p_pdu)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
case (1) {
setverdict(fail, "Decoding failed.");
}
case (2) {
setverdict(fail, "Not enough bits.");
}
} // End of 'select' statement
} // End of function test_decodePDU<PDUType>
 
function test_PDU<PDUType>(in PDUType p_pdu, in boolean p_decode:=true, in template (omit) bitstring p_expEncMsg:=omit) runs on TCType {
var PDUType v_decMsg;
var bitstring v_encMsg;
var integer v_res := 0;
var TestRecord v_tr := { bs := p_expEncMsg }
v_encMsg := encvalue(p_pdu);
log("Encoded message: ", v_encMsg);
if (v_encMsg == null) {
setverdict(fail, "Encoding failed!");
stop;
}
if (ispresent(v_tr.bs)) {
if (not match(v_encMsg, p_expEncMsg)) {
setverdict(fail, "Encoding failed, not the expected result!");
stop;
}
}
setverdict(pass, "Encoding passed.");
if (p_decode == true) {
v_res := decvalue(v_encMsg, v_decMsg);
select (v_res) {
case (0) {
if(match(v_decMsg, p_pdu)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
case (1) {
setverdict(fail, "Decoding failed.");
}
case (2) {
setverdict(fail, "Not enough bits.");
}
}
}
} // End of function test_PDU<PDUType>
function test_PDU<PDUType>(in PDUType p_pdu, in boolean p_decode:=true, in template (omit) bitstring p_expEncMsg:=omit) runs on TCType {
var PDUType v_decMsg;
var bitstring v_encMsg;
var integer v_res := 0;
var TestRecord v_tr := { bs := p_expEncMsg }
v_encMsg := encvalue(p_pdu);
log("Encoded message: ", bit2oct(v_encMsg));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
if (ispresent(v_tr.bs)) {
if (not match(v_encMsg, p_expEncMsg)) {
setverdict(fail, "Encoding failed, not the expected result!");
stop;
}
}
setverdict(pass, "Encoding passed.");
if (p_decode == true) {
v_res := decvalue(v_encMsg, v_decMsg);
select (v_res) {
case (0) {
if(match(v_decMsg, p_pdu)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
case (1) {
setverdict(fail, "Decoding failed.");
}
case (2) {
setverdict(fail, "Not enough bits.");
}
}
}
} // End of function test_PDU<PDUType>
}
/trunk/unittests/codec/ttcn/test_LibItsBtp_TypesAndValues.ttcn
5,535 → 5,341
import from LibItsBtp_Templates all;
import from LibItsBtp_TypesAndValues all;
group LibItsBtp_DummyTemplates {
 
template (value) UtEvent m_utEventBtpA := {
utBtpEvent := {
btpA := {
destinationPort := 1234,
sourcePort := 5678
group LibItsBtp_testCases {
group LibItsBtp_DummyTemplates {
template (value) UtEvent m_utEventBtpA := {
utBtpEvent := {
btpA := {
destinationPort := 1234,
sourcePort := 5678
}
}
}
}
 
template (value) UtEvent m_utEventBtpB := {
utBtpEvent := {
btpB := {
destinationPort := 123,
destinationPortInfo := 432
template (value) UtEvent m_utEventBtpB := {
utBtpEvent := {
btpB := {
destinationPort := 123,
destinationPortInfo := 432
}
}
}
}
 
template (value) UtEvent m_utEventBtpPayload := {
utBtpEvent := {
template (value) UtEvent m_utEventBtpPayload := {
utBtpEvent := {
payload := {
decodedPayload := omit,
rawPayload := 'f005ba11'O
} // End of 'payload' field
}
}
template BtpInd m_btpInd(template (present) BtpPacket p_btpPkt) := {
msgIn := p_btpPkt
}
template (value) BtpPacket m_btpA_Without_Payload (
template (value) BtpPortId p_destPort,
template (value) BtpPortId p_sourcePort
):= {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := omit
}
template BtpPacket m_btpA_With_Payload (
in template (value) BtpPortId p_destPort,
in template (value) BtpPortId p_sourcePort,
in template DecodedBtpPayload p_decodedPayload,
in template (value) octetstring p_rawPayload
) := {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := omit,
rawPayload := 'f005ba11'O
} // End of 'payload' field
decodedPayload := p_decodedPayload,
rawPayload := p_rawPayload
}
}
}
 
template BtpInd m_btpInd(template (present) BtpPacket p_btpPkt) := {
msgIn := p_btpPkt
}
 
template (value) BtpPacket m_btpA_Without_Payload (
template (value) BtpPortId p_destPort,
template (value) BtpPortId p_sourcePort
):= {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
template BtpPacket mw_btpA_With_Payload (
in template (present) BtpPortId p_destPort,
in template (present) BtpPortId p_sourcePort,
in template DecodedBtpPayload p_decodedPayload,
in template (present) octetstring p_rawPayload
) := {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := p_decodedPayload,
rawPayload := p_rawPayload
}
}
template (value) BtpPacket m_btpB_Without_Payload (
template (value) BtpPortId p_destPort,
template (value) BtpPortId p_destinationPortInfo
):= {
header := {
btpBHeader := {
destinationPort := p_destPort,
destinationPortInfo := p_destinationPortInfo
}
},
payload := omit
}
} // End of group LibItsBtp_DummyTemplates
group testAcPrimitives {
} // End of group testAcPrimitives
group testBtpPrimitiveMessages {
// /**
// * @desc validate BtpReq/BTP type A
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_BtpReq_A() runs on TCType system TCType {
// test_PDU<BtpReq>(
// m_btpReq( m_btpA_Without_Payload (1234, 5678)),
// true,
// oct2bit('4b000a34000732000404d2162e'O));
// }
//
// /**
// * @desc validate BtpReq/BTP type A with payload
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_BtpReq_A_With_Payload() runs on TCType system TCType {
// test_PDU<BtpReq>(
// m_btpReq(
// m_btpAWithPorts (
// 1234,
// 5678,
// {
// decodedPayload := omit,
// rawPayload := 'ca5caded'O
// } // End of 'payload' field
// )),
// true,
// oct2bit('4b000e34000b32000404d2162eca5caded'O));
// }
//
// /**
// * @desc validate BtpReq/BTP type A with payload
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_BtpReq_A_With_DenmPayload() runs on TCType system TCType {
// test_PDU<BtpReq>(
// m_btpReq(
// m_btpAWithPorts (
// 1234,
// 5678,
// {
// decodedPayload := {
// denmPacket := {
// header := {
// protocolVersion := 0,
// messageID := 1,
// generationTime := 1319187879132
// },
// denm := {
// management := {
// actionID := {
// stationID := 2339,
// sequenceNo := 29
// },
// dataVersion := 0,
// expiryTime := 1319187938835,
// frequency := omit,
// reliability := 0,
// isNegation := false
// },
// situation := {
// trafficFlowEffect := omit,
// situation := { cause := 103, subCause := 0 },
// linkedCause := omit,
// severity := informative,
// eventCharact := omit,
// vehicleCommonParameters := omit,
// profile := omit
// },
// location := {
// eventPosition := {
// eventPositionCurrentDefinition := {
// refPosition := {
// longitude := { hemisphere := east, degree := 0 },
// latitude := { hemisphere := north, degree := 0 },
// elevation := 0,
// heading := 0,
// streetName := omit,
// positionConfidence := 0,
// elevationConfidence := 0,
// roadSegmentID := omit
// },
// eventSpeed := 0
// }
// },
// locationRef := {
// trace := {
// traceID := 0,
// waypoints := {
// { ptLat := { hemisphere := south, degree := 0 },
// ptLong := { hemisphere := west, degree := 0 },
// ptAlt := 0
// }
// }
// }
// },
// relevanceArea := {
// geoAreaCenterLatitude := { hemisphere := south, degree := 0 },
// geoAreaCenterLongitude := { hemisphere := west, degree := 0 },
// shape := {circle := { radius := 0 } },
// directionalityFilter := noFilter,
// disseminationAreaSize := omit
// }
// }
// } // End of 'denm' field
// } // End of 'denmPacket' field
// }, // End of 'decodedPayload' field
// rawPayload := '0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O
// } // End of 'payload' field
// )),
// true,
// oct2bit('4b004e34004b32000404d2162e0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O));
// }
//
/**
* @desc validate BtpReq/BTP type B
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_B() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq( m_btpB_Without_Payload (4321, 8765)),
true,
oct2bit('10E1223D'O));
}
/**
* @desc validate BtpReq/BTP type B with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_B_With_Payload() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq(
m_btpBWithPorts (
4321,
8765,
{
decodedPayload := omit,
rawPayload := 'F1A7F007ED'O
} // End of 'payload' field
)),
true,
oct2bit('10E1223DF1A7F007ED'O));
}
/**
* @desc validate BtpInd/BTP type A
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_A() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd( m_btpA_Without_Payload (4321, 8765)),
true,
oct2bit('10E1223D'O));
}
/**
* @desc validate BtpInd/BTP type A with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_A_With_Payload() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd(
m_btpAWithPorts (
4321,
8765,
{
decodedPayload := omit,
rawPayload := 'F1A7F007ED'O
} // End of 'payload' field
)),
true,
oct2bit('10E1223DF1A7F007ED'O));
}
testcase tc_BtpInd_A_With_CamPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) },
'10E1223D01020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF80'O
);
}
testcase tc_BtpInd_A_With_TrunkatedCamPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) },
'10E1223D000c32000410e1223d00000133256c5b1e40000248d6c0000000000000000009c4080000003ffe83e80004000000000000007ffd7ffe00'O
);
if (getverdict() == fail) {
setverdict(pass);
} else {
setverdict(fail);
}
},
payload := omit
}
 
template BtpPacket m_btpA_With_Payload (
in template (value) BtpPortId p_destPort,
in template (value) BtpPortId p_sourcePort,
in template DecodedBtpPayload p_decodedPayload,
in template (value) octetstring p_rawPayload
) := {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := p_decodedPayload,
rawPayload := p_rawPayload
}
}
 
template (value) BtpPacket m_btpB_Without_Payload (
template (value) BtpPortId p_destPort,
template (value) BtpPortId p_destinationPortInfo
):= {
header := {
btpBHeader := {
destinationPort := p_destPort,
destinationPortInfo := p_destinationPortInfo
}
},
payload := omit
}
 
template BtpPacket mw_btpA_With_Payload (
in template (present) BtpPortId p_destPort,
in template (present) BtpPortId p_sourcePort,
in template DecodedBtpPayload p_decodedPayload,
in template (present) octetstring p_rawPayload
) := {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := p_decodedPayload,
rawPayload := p_rawPayload
}
}
 
template BtpPacket mw_btpA_With_CamPayload (
template (present) BtpPortId p_destPort,
template (present) BtpPortId p_sourcePort
):= {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := {
camPacket := {
header := {
protocolVersion := 0,
messageID := 0,
generationTime := 1319182818078
},
cam := {
stationID := 2339,
stationCharacteristics := {
mobileItsStation := true,
privateItsStation := false,
physicalRelevantItsStation := true
},
referencePosition := {
longitude := { hemisphere := east, degree := 0 },
latitude := { hemisphere := north, degree := 0 },
elevation := 0,
heading := 0,
streetName := omit,
positionConfidence := 0,
elevationConfidence := 0,
roadSegmentID := omit
},
camParameters := {
vehicleCommonParameters := {
vehicleType := 1,
stationLength := 0,
stationLengthConfidence := omit,
stationWidth := 0,
stationWidthConfidence := omit,
vehicleSpeed := 0,
vehicleSpeedConfidence := 0,
longAcceleration := 0,
longAccelerationConfidence := 0,
accelerationControl := ''B,
yawRate := { yawDirection := right, yawRateValue := 0 },
yawRateConfidence := 0,
exteriorLights := ''B,
turnAdvice := omit,
distanceToStopLine := omit,
occupancy := omit,
doorOpen := ''B,
posConfidenceEllipse := { semiMajorConfidence := 0, semiMinorConfidence := 0, semiMajorOrientation := 0 },
curvature := 0,
curvatureChange := 0,
curvatureConfidence := 15,
crashStatus := omit,
headingConfidence := 0,
dangerousGoods := omit
},
profileDependent := {
basicVehicle := { }
}
}
} // End of 'cam' field
} // End of 'camPacket' field
}, // End of 'decodedPayload' field
rawPayload := ?
} // End of 'payload' field
} // End of template mw_btpA_With_CamPayload
 
template BtpPacket mw_btpA_With_DenmPayload (
template (present) BtpPortId p_destPort,
template (present) BtpPortId p_sourcePort
):= {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := {
decodedPayload := {
denmPacket := {
header := {
protocolVersion := 0,
messageID := 1,
generationTime := 1319187879132
},
denm := {
management := {
actionID := {
stationID := 2339,
sequenceNo := 29
},
dataVersion := 0,
expiryTime := 1319187938835,
frequency := omit,
reliability := 0,
isNegation := false
},
situation := {
trafficFlowEffect := omit,
situation := { cause := 103, subCause := 0 },
linkedCause := omit,
severity := informative,
eventCharact := omit,
vehicleCommonParameters := omit,
profile := omit
},
location := {
eventPosition := {
eventPositionCurrentDefinition := {
refPosition := {
longitude := { hemisphere := east, degree := 0 },
latitude := { hemisphere := north, degree := 0 },
elevation := 0,
heading := 0,
streetName := omit,
positionConfidence := 0,
elevationConfidence := 0,
roadSegmentID := omit
},
eventSpeed := 0
}
},
locationRef := {
trace := {
traceID := 0,
waypoints := {
{ ptLat := { hemisphere := south, degree := 0 },
ptLong := { hemisphere := west, degree := 0 },
ptAlt := 0
}
}
}
},
relevanceArea := {
geoAreaCenterLatitude := { hemisphere := south, degree := 0 },
geoAreaCenterLongitude := { hemisphere := west, degree := 0 },
shape := {circle := { radius := 0 } },
directionalityFilter := noFilter,
disseminationAreaSize := omit
}
}
} // End of 'denm' field
} // End of 'denmPacket' field
}, // End of 'decodedPayload' field
rawPayload := ?
} // End of 'payload' field
} // End of template mw_btpA_With_DenmPayload
 
template BtpPacket mw_btpA_Without_Payload (
template (present) BtpPortId p_destPort,
template (present) BtpPortId p_sourcePort
):= {
header := {
btpAHeader := {
destinationPort := p_destPort,
sourcePort := p_sourcePort
}
},
payload := omit
}
 
} // End of group LibItsBtp_DummyTemplates
 
group testAcPrimitives {
} // End of group testAcPrimitives
 
group testBtpPrimitiveMessages {
 
/**
* @desc validate BtpReq/BTP type A
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_A() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq( m_btpA_Without_Payload (1234, 5678)),
true,
oct2bit('4b000a34000732000404d2162e'O));
}
 
/**
* @desc validate BtpReq/BTP type A with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_A_With_Payload() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq(
m_btpAWithPorts (
1234,
5678,
{
decodedPayload := omit,
rawPayload := 'ca5caded'O
} // End of 'payload' field
)),
true,
oct2bit('4b000e34000b32000404d2162eca5caded'O));
}
 
/**
* @desc validate BtpReq/BTP type A with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_A_With_DenmPayload() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq(
m_btpAWithPorts (
1234,
5678,
{
decodedPayload := {
denmPacket := {
header := {
protocolVersion := 0,
messageID := 1,
generationTime := 1319187879132
},
denm := {
management := {
actionID := {
stationID := 2339,
sequenceNo := 29
},
dataVersion := 0,
expiryTime := 1319187938835,
frequency := omit,
reliability := 0,
isNegation := false
},
situation := {
trafficFlowEffect := omit,
situation := { cause := 103, subCause := 0 },
linkedCause := omit,
severity := informative,
eventCharact := omit,
vehicleCommonParameters := omit,
profile := omit
},
location := {
eventPosition := {
eventPositionCurrentDefinition := {
refPosition := {
longitude := { hemisphere := east, degree := 0 },
latitude := { hemisphere := north, degree := 0 },
elevation := 0,
heading := 0,
streetName := omit,
positionConfidence := 0,
elevationConfidence := 0,
roadSegmentID := omit
},
eventSpeed := 0
}
},
locationRef := {
trace := {
traceID := 0,
waypoints := {
{ ptLat := { hemisphere := south, degree := 0 },
ptLong := { hemisphere := west, degree := 0 },
ptAlt := 0
}
}
}
},
relevanceArea := {
geoAreaCenterLatitude := { hemisphere := south, degree := 0 },
geoAreaCenterLongitude := { hemisphere := west, degree := 0 },
shape := {circle := { radius := 0 } },
directionalityFilter := noFilter,
disseminationAreaSize := omit
}
}
} // End of 'denm' field
} // End of 'denmPacket' field
}, // End of 'decodedPayload' field
rawPayload := '0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O
} // End of 'payload' field
)),
true,
oct2bit('4b004e34004b32000404d2162e0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000'O));
}
 
/**
* @desc validate BtpReq/BTP type B
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_B() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq( m_btpB_Without_Payload (4321, 8765)),
true,
oct2bit('4b000a34000733000410e1223d'O));
}
 
/**
* @desc validate BtpReq/BTP type B with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpReq_B_With_Payload() runs on TCType system TCType {
test_PDU<BtpReq>(
m_btpReq(
m_btpBWithPorts (
4321,
8765,
{
decodedPayload := omit,
rawPayload := 'f1a7f007ed'O
} // End of 'payload' field
)),
true,
oct2bit('4b000f34000c33000410e1223df1a7f007ed'O));
}
 
/**
* @desc validate BtpInd/BTP type A
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_A() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd( m_btpA_Without_Payload (4321, 8765)),
true,
oct2bit('4a000a34000732000410e1223d'O));
}
 
/**
* @desc validate BtpInd/BTP type A with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_A_With_Payload() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd(
m_btpAWithPorts (
4321,
8765,
{
decodedPayload := omit,
rawPayload := 'f1a7f007ed'O
} // End of 'payload' field
)),
true,
oct2bit('4a000f34000c32000410e1223df1a7f007ed'O));
}
 
testcase tc_BtpInd_A_With_CamPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_CamPayload(4321, 8765) },
'4a003d34000c32000410e1223d00000133256c5b1e40000248d6c0000000000000000009c40000002060080000003ffe83e80004000000000000007ffd7ffe00'O
);
}
 
testcase tc_BtpInd_A_With_TrunkatedCamPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_CamPayload(4321, 8765) },
'4a003834000c32000410e1223d00000133256c5b1e40000248d6c0000000000000000009c4080000003ffe83e80004000000000000007ffd7ffe00'O
);
}
testcase tc_BtpInd_A_With_DenmPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_Payload(4321, 8765, ?, ?) },
'10E1223D000c32000410e1223d00000133256c5b1e40000248d6c0000000000000000009c40000002060080000003ffe83e80004000000000000007ffd7ffe00'O
);
}
} // End of group testBtpPrimitiveMessages
group LibItsBtp_testCases {
if (getverdict() == fail) {
setverdict(pass);
} else {
setverdict(fail);
testcase tc_BTP_A() runs on TCType system TCType {
test_PDU<BtpPacket>(m_btpA (BtpPayload:{decodedPayload := omit, rawPayload := '0102030405'O } ), true, oct2bit('000000000102030405'O));
}
}
 
testcase tc_BtpInd_A_With_DenmPayload() runs on TCType system TCType {
test_decodePDU<BtpInd>(
{ msgIn := mw_btpA_With_DenmPayload(4321, 8765) },
'4a004e34000c32000410e1223d0001013325b994dc400001246003a0002664b74fc2600067002d80000000000000000013880000007ffd00a0000000400000000013880085a80000001000000000000000ff00080000013325b9950b'O
);
}
 
 
/**
* @desc validate BtpInd/BTP type B
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_B() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd( m_btpB_Without_Payload (4321, 8765)),
true,
oct2bit('4a000a34000733000410e1223d'O));
}
 
/**
* @desc validate BtpInd/BTP type B with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_BtpInd_B_With_Payload() runs on TCType system TCType {
test_PDU<BtpInd>(
m_btpInd(
m_btpBWithPorts (
4321,
8765,
{
decodedPayload := omit,
rawPayload := 'de1ec7ab1e'O
} // End of 'payload' field
)),
true,
oct2bit('4a000f34000c33000410e1223dde1ec7ab1e'O));
}
 
} // End of group testBtpPrimitiveMessages
 
// testcase tc_BTP_A() runs on TCType system TCType {
// test_PDU<BtpPacket>(m_btpA (65535, 65535, '0102030405'O), true, oct2bit('FFFFFFFF0102030405'O));
// }
//
// testcase tc_BTP_B() runs on TCType system TCType {
// test_PDU<BtpPacket>(m_btpB (65535, 65535, '0102030405'O), true, oct2bit('FFFFFFFF0102030405'O));
// }
} // End of group LibItsBtp_testCases
group testUtEvent {
group testUtEvent {
 
testcase tc_UtBtpInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_btpInitialize, false);
}
 
testcase tc_UtEvent_A() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpA, false);
}
 
testcase tc_UtEvent_B() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpB, false);
}
 
testcase tc_UtEvent_Payload() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpPayload, false);
}
 
} // End of group testUtEvent
 
testcase tc_UtBtpInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_btpInitialize, false);
}
testcase tc_UtEvent_A() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpA, false);
}
testcase tc_UtEvent_B() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpB, false);
}
testcase tc_UtEvent_Payload() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventBtpPayload, false);
}
} // End of group testUtEvent
} // End of group LibItsBtp_testCases
} // End of module test_LibItsBtp_TypesAndValues
/trunk/unittests/codec/ttcn/test_LibItsCam_TypesAndValues.ttcn
1,342 → 1,496
module test_LibItsCam_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
import from test_CommonCodec all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all
with {
encode "LibItsCam_asn1"
}
import from DENM_PDU_Descriptions language "ASN.1:1997" all
with {
encode "LibItsDenm_asn1"
}
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates all;
import from LibItsCam_TypesAndValues all;
import from LibItsCam_Functions all;
import from LibItsCommon_Functions all;
group testUtEvent {
testcase tc_UtCamInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_camInitialize, false);
}
testcase tc_changeHeading() runs on TCType system TCType {
test_PDU<UtEvent>(m_changeHeading(5), false);
}
testcase tc_changePosition() runs on TCType system TCType {
test_PDU<UtEvent>(m_changePosition(6), false);
}
testcase tc_changeSpeed() runs on TCType system TCType {
test_PDU<UtEvent>(m_changeSpeed(2), false);
}
testcase tc_setCrashSignal() runs on TCType system TCType {
test_PDU<UtEvent>(m_setCrashSignal(c_activated), false);
}
testcase tc_setDangerousGoodsStatus() runs on TCType system TCType {
test_PDU<UtEvent>(m_setDangerousGoodsStatus(8191), false);
}
testcase tc_setLengthWidthPrecision() runs on TCType system TCType {
test_PDU<UtEvent>(m_setLengthWidthPrecision(c_precisely), false);
}
testcase tc_setDistanceToStopLine() runs on TCType system TCType {
test_PDU<UtEvent>(m_setDistanceToStopLine(65535), false);
}
testcase tc_setTurnAdvice() runs on TCType system TCType {
test_PDU<UtEvent>(m_setTurnAdvice({ f_bitPositionRandom(7), 65535 }), false);
}
testcase tc_changeCurvature() runs on TCType system TCType {
test_PDU<UtEvent>(m_changeCurvature(-1023), false);
}
testcase tc_setOccupancy() runs on TCType system TCType {
test_PDU<UtEvent>(m_setOccupancy(255), false);
}
testcase tc_setDoorStatus() runs on TCType system TCType {
test_PDU<UtEvent>(m_setDoorStatus(c_driverDoor), false);
}
testcase tc_setLightBarStatus() runs on TCType system TCType {
test_PDU<UtEvent>(m_setLightBarStatus(unavailable), false);
}
testcase tc_setSireneStatus() runs on TCType system TCType {
test_PDU<UtEvent>(m_setSireneStatus(engaged), false);
}
testcase tc_setTrafficLightPriority() runs on TCType system TCType {
test_PDU<UtEvent>(m_setTrafficLightPriority(7), false);
}
testcase tc_setScheduleDeviation() runs on TCType system TCType {
test_PDU<UtEvent>(m_setScheduleDeviation(-900), false);
}
testcase tc_setPtLineDescription() runs on TCType system TCType {
test_PDU<UtEvent>(m_setPtLineDescription(PTLineDescription:{"CourseOfJourney", "LineRef", "RouteRef"}), false);
}
testcase tc_setExteriorLightsStatus() runs on TCType system TCType {
test_PDU<UtEvent>(m_setExteriorLightsStatus(c_lowBeamHeadlightsOn), false);
}
testcase tc_checkLdmBasic() runs on TCType system TCType {
test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
28147497,
42949,
{ true, true, true },
{
longitude := {hemisphere := east, degree := 0},
latitude := {hemisphere := north, degree := 0},
elevation := 0,
heading := omit,
streetName := omit,
positionConfidence := omit,
elevationConfidence := omit,
roadSegmentID :=0
}
)), false);
}
testcase tc_checkLdmFull_BasicVehicle() runs on TCType system TCType {
test_PDU<UtEvent>(m_checkLdm(m_camMsg_valid_With_Parameters(
28147495,
42946,
{ true, true, true },
{
longitude := {hemisphere := east, degree := 0},
latitude := {hemisphere := north, degree := 0},
elevation := 1530,
heading := 95,
streetName := "Street name",
positionConfidence := 15,
elevationConfidence := 14,
roadSegmentID :=0
}, // End of ReferencePosition
{
vehicleType := 3,
stationLength := 1456,
stationLengthConfidence := 9,
stationWidth := 125,
stationWidthConfidence := 11,
vehicleSpeed := 55,
vehicleSpeedConfidence := 13,
longAcceleration := -500,
longAccelerationConfidence := 12,
accelerationControl := '001000'B,
yawRate := {
yawDirection := right,
yawRateValue := 16584
},
yawRateConfidence := 11,
exteriorLights := '00100000'B,
turnAdvice := {
direction := '00000100'B,
distance := 4556
},
distanceToStopLine := 150,
occupancy := 57,
doorOpen := '0001'B,
posConfidenceEllipse := {
semiMajorConfidence := 7,
semiMinorConfidence := 9,
semiMajorOrientation := 11
},
curvature := -156,
curvatureChange := 53,
curvatureConfidence := 10,
crashStatus := false,
headingConfidence := 9,
dangerousGoods := 799
}, // End of VehicleCommonParameters
m_profileParameters_BasicVehicle
)), false);
}
 
testcase tc_checkLdmFull_PublicVehicle() runs on TCType system TCType {
test_PDU<UtEvent>(m_checkLdm(m_camMsg_valid_With_Parameters(
1307531915453,
111111,
{ true, true, true },
{
longitude := {
hemisphere := east,
degree := 0
},
latitude := {
hemisphere := north,
degree := 0
},
elevation := 0,
heading := 0,
streetName := omit,
positionConfidence := omit,
elevationConfidence := omit,
roadSegmentID := omit
}, // End of ReferencePosition
{
vehicleType := 0,
stationLength := 0,
stationLengthConfidence := 0,
stationWidth := 0,
stationWidthConfidence := 0,
vehicleSpeed := 0,
vehicleSpeedConfidence := 0,
longAcceleration := 0,
longAccelerationConfidence := 0,
accelerationControl := '000000'B,
yawRate := {
yawDirection := right,
yawRateValue := 0
},
yawRateConfidence := 0,
exteriorLights := '00000000'B,
turnAdvice := omit,
distanceToStopLine := omit,
occupancy := omit,
doorOpen := omit,
posConfidenceEllipse := {
semiMajorConfidence := 0,
semiMinorConfidence := 0,
semiMajorOrientation := 0
},
curvature := 0,
curvatureChange := omit,
curvatureConfidence := 0,
crashStatus := omit,
headingConfidence := 0,
dangerousGoods := omit
}, // End of VehicleCommonParameters
m_profileParameters_BasicVehicle
)), false);
}
 
testcase tc_checkLdmFull_Paris() runs on TCType system TCType {
test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
5434534,
5424,
{ true, false, true },
{
longitude := {hemisphere := east, degree := 200000000},
latitude := {hemisphere := north, degree := 480000000},
elevation := 910,
heading := 7200,
streetName := "Montmartre",
positionConfidence := 5,
elevationConfidence := 7,
roadSegmentID := 1234567
}
)), false);
}
 
testcase tc_checkLdmFull_LaPaz() runs on TCType system TCType {
test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
6546424,
35445334,
{ false, false, false },
{
longitude := {hemisphere := west, degree := 220000000},
latitude := {hemisphere := south, degree := 270000000},
elevation := 36600,
heading := 21600,
streetName := "El Alto",
positionConfidence := omit,
elevationConfidence := omit,
roadSegmentID := 3546345
}
)), false);
}
 
template (value) CamPdu m_camMsg_valid_With_Parameters(
TimeStamp p_generationTime,
StationID p_stationId,
CoopAwareness.stationCharacteristics p_stationCharacteristics,
template (value) ReferencePosition p_referencePosition,
template (value) VehicleCommonParameters p_vehicleCommonParameters,
template (value) ProfileParameters p_profileDependent
) := {
header := {
protocolVersion := 0,
messageID := 0,
generationTime := p_generationTime
},
cam := {
stationID := p_stationId,
stationCharacteristics := p_stationCharacteristics,
referencePosition := p_referencePosition,
camParameters := {
vehicleCommonParameters := p_vehicleCommonParameters,
profileDependent := p_profileDependent
}
}
}
 
template (value) ProfileParameters m_profileParameters_BasicVehicle := {
basicVehicle := {
}
// emergencyVehicle := {
// lightBarInUse := 2,
// sireneInUse := 3,
// emergencyResponseType := 1
// }
// publicTransportVehicle := {
// publicVehicleType := 3,
// pTLineDescription := {
// courseOfJourney := "Course Of Journey",
// lineRef := 10,
// routeRef := "Route Ref"
// },
// ScheduleDeviation scheduleDeviation optional,
// TrafficLightPriority trafficLightPriority optional
// } // End of PublicTransportVehicle
} // End of template m_profileParameters_BasicVehicle
 
template (value) ProfileParameters m_profileParameters_EmergencyVehicle := {
emergencyVehicle := {
lightBarInUse := enabled,
sireneInUse := engaged,
emergencyResponseType := rightOfWay
}
} // End of template m_profileParameters_EmergencyVehicle
 
template (value) ProfileParameters m_profileParameters_PublicTransportVehicle := {
publicTransportVehicle := {
publicVehicleType := 3,
pTLineDescription := {
courseOfJourney := "Course Of Journey",
lineRef := "Line Ref",
routeRef := "Route Ref"
},
scheduleDeviation := -200,
trafficLightPriority := 7
}
} // End of template m_profileParameters_PublicTransportVehicle
 
} // End of group testUtEvent
 
group testCamPrimitiveMessages {
 
testcase tc_CamReq() runs on TCType system TCType {
test_PDU<CamReq>(
m_camReq(
m_camMsg_irs(
fx_getCurrentTime(),
f_getTsStationId(),
f_getTesterStationCharacteristics(),
m_tsPosition
)
),
false);
}
 
} // End of group testCamPrimitiveMessages
// LibIts
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997"all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
// AtsCam
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates all;
import from LibItsCam_TypesAndValues all;
import from LibItsCam_Functions all;
import from LibItsCommon_Functions all;
import from test_CommonCodec all;
group LibItsCam_testCases {
group camTemplates {
template (value) CAM m_camMsg(
StationID p_stationId,
GenerationDeltaTime p_generationTime
) := {
header := {
protocolVersion := 1,
messageID := 2,
stationID := p_stationId
},
cam := {
generationDeltaTime := p_generationTime,
camParameters := {
basicContainer := {
stationType := c_stationType_passengerCar,
referencePosition := {
latitude := f_integer2Latitude(f_getTsLatitude()),
longitude := f_integer2Longitude(f_getTsLongitude()),
positionConfidenceEllipse := {
semiMajorConfidence := c_semiAxisLengthOneCentimeter,
semiMinorConfidence := c_semiAxisLengthOneCentimeter,
semiMajorOrientation := c_headingValue_wgs84North
},
altitude := {
altitudeValue := c_altitudeValue_seaLevel,
altitudeConfidence := unavailable
}
}
},
highFrequencyContainer := {
basicVehicleContainerHighFrequency := {
heading := {
headingValue := c_headingValue_wgs84North, //0
headingConfidence := 10
},
speed := {
speedValue := 45,
speedConfidence := 5
},
driveDirection := forward,
vehicleLength := {
vehicleLengthValue := 50,
vehicleLengthConfidenceIndication := noTrailerPresent
},
vehicleWidth := 21,
longitudinalAcceleration := {
longitudinalAccelerationValue := c_longitudinalAccelerationValue_unavailable,
longitudinalAccelerationConfidence := c_accelerationConfidence_unavailable
},
curvature := {
curvatureValue := c_curvatureValue_straight,
curvatureConfidence := unavailable
},
curvatureCalculationMode := yawRateUsed,
yawRate := {
yawRateValue := c_yawRateValue_straight,
yawRateConfidence := unavailable
},
accelerationControl := omit,
lanePosition := omit,
steeringWheelAngle := omit,
lateralAcceleration := omit,
verticalAcceleration := omit,
performanceClass := omit,
cenDsrcTollingZone := omit
}
},
lowFrequencyContainer := omit,
specialVehicleContainer := omit
}
}
};
} // End of group camTemplates
group testUtEvent {
testcase tc_UtCamInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_camInitialize, false);
}
testcase tc_changeHeading() runs on TCType system TCType {
test_PDU<UtCamTrigger>(m_changeHeading(5), false);
}
testcase tc_changePosition() runs on TCType system TCType {
test_PDU<UtCamTrigger>(
m_changePosition(
UtChangePosition: {
latitude := 49845,
longitude := 631,
elevation := 512
}
),
false);
}
testcase tc_changeSpeed() runs on TCType system TCType {
test_PDU<UtCamTrigger>(m_changeSpeed(2), false);
}
// testcase tc_setCrashSignal() runs on TCType system TCType {
// test_PDU<UtCamTrigger>(m_setCrashSignal(c_activated), false);
// }
//
// testcase tc_setDangerousGoodsStatus() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setDangerousGoodsStatus(8191), false);
// }
//
// testcase tc_setLengthWidthPrecision() runs on TCType system TCType {
// test_PDU<UtCamTrigger>(m_setLengthWidthPrecision(c_precisely), false);
// }
//
// testcase tc_setDistanceToStopLine() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setDistanceToStopLine(65535), false);
// }
//
// testcase tc_setTurnAdvice() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setTurnAdvice({ f_bitPositionRandom(7), 65535 }), false);
// }
//
// testcase tc_changeCurvature() runs on TCType system TCType {
// test_PDU<UtEvent>(m_changeCurvature(-1023), false);
// }
//
// testcase tc_setOccupancy() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setOccupancy(255), false);
// }
//
// testcase tc_setDoorStatus() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setDoorStatus(c_driverDoor), false);
// }
//
// testcase tc_setLightBarStatus() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setLightBarStatus(unavailable), false);
// }
//
// testcase tc_setSireneStatus() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setSireneStatus(engaged), false);
// }
//
// testcase tc_setTrafficLightPriority() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setTrafficLightPriority(7), false);
// }
//
// testcase tc_setScheduleDeviation() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setScheduleDeviation(-900), false);
// }
//
// testcase tc_setPtLineDescription() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setPtLineDescription(PTLineDescription:{"CourseOfJourney", "LineRef", "RouteRef"}), false);
// }
//
// testcase tc_setExteriorLightsStatus() runs on TCType system TCType {
// test_PDU<UtEvent>(m_setExteriorLightsStatus(c_lowBeamHeadlightsOn), false);
// }
//
// testcase tc_checkLdmBasic() runs on TCType system TCType {
// test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
// 28147497,
// 42949,
// { true, true, true },
// {
// longitude := {hemisphere := east, degree := 0},
// latitude := {hemisphere := north, degree := 0},
// elevation := 0,
// heading := omit,
// streetName := omit,
// positionConfidence := omit,
// elevationConfidence := omit,
// roadSegmentID :=0
// }
// )), false);
// }
// testcase tc_checkLdmFull_BasicVehicle() runs on TCType system TCType {
// test_PDU<UtEvent>(m_checkLdm(m_camMsg_valid_With_Parameters(
// 28147495,
// 42946,
// { true, true, true },
// {
// longitude := {hemisphere := east, degree := 0},
// latitude := {hemisphere := north, degree := 0},
// elevation := 1530,
// heading := 95,
// streetName := "Street name",
// positionConfidence := 15,
// elevationConfidence := 14,
// roadSegmentID :=0
// }, // End of ReferencePosition
// {
// vehicleType := 3,
// stationLength := 1456,
// stationLengthConfidence := 9,
// stationWidth := 125,
// stationWidthConfidence := 11,
// vehicleSpeed := 55,
// vehicleSpeedConfidence := 13,
// longAcceleration := -500,
// longAccelerationConfidence := 12,
// accelerationControl := '001000'B,
// yawRate := {
// yawDirection := right,
// yawRateValue := 16584
// },
// yawRateConfidence := 11,
// exteriorLights := '00100000'B,
// turnAdvice := {
// direction := '00000100'B,
// distance := 4556
// },
// distanceToStopLine := 150,
// occupancy := 57,
// doorOpen := '0001'B,
// posConfidenceEllipse := {
// semiMajorConfidence := 7,
// semiMinorConfidence := 9,
// semiMajorOrientation := 11
// },
// curvature := -156,
// curvatureChange := 53,
// curvatureConfidence := 10,
// crashStatus := false,
// headingConfidence := 9,
// dangerousGoods := 799
// }, // End of VehicleCommonParameters
// m_profileParameters_BasicVehicle
// )), false);
// }
//
// testcase tc_checkLdmFull_PublicVehicle() runs on TCType system TCType {
// test_PDU<UtEvent>(m_checkLdm(m_camMsg_valid_With_Parameters(
// 1307531915453,
// 111111,
// { true, true, true },
// {
// longitude := {
// hemisphere := east,
// degree := 0
// },
// latitude := {
// hemisphere := north,
// degree := 0
// },
// elevation := 0,
// heading := 0,
// streetName := omit,
// positionConfidence := omit,
// elevationConfidence := omit,
// roadSegmentID := omit
// }, // End of ReferencePosition
// {
// vehicleType := 0,
// stationLength := 0,
// stationLengthConfidence := 0,
// stationWidth := 0,
// stationWidthConfidence := 0,
// vehicleSpeed := 0,
// vehicleSpeedConfidence := 0,
// longAcceleration := 0,
// longAccelerationConfidence := 0,
// accelerationControl := '000000'B,
// yawRate := {
// yawDirection := right,
// yawRateValue := 0
// },
// yawRateConfidence := 0,
// exteriorLights := '00000000'B,
// turnAdvice := omit,
// distanceToStopLine := omit,
// occupancy := omit,
// doorOpen := omit,
// posConfidenceEllipse := {
// semiMajorConfidence := 0,
// semiMinorConfidence := 0,
// semiMajorOrientation := 0
// },
// curvature := 0,
// curvatureChange := omit,
// curvatureConfidence := 0,
// crashStatus := omit,
// headingConfidence := 0,
// dangerousGoods := omit
// }, // End of VehicleCommonParameters
// m_profileParameters_BasicVehicle
// )), false);
// }
//
// testcase tc_checkLdmFull_Paris() runs on TCType system TCType {
// test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
// 5434534,
// 5424,
// { true, false, true },
// {
// longitude := {hemisphere := east, degree := 200000000},
// latitude := {hemisphere := north, degree := 480000000},
// elevation := 910,
// heading := 7200,
// streetName := "Montmartre",
// positionConfidence := 5,
// elevationConfidence := 7,
// roadSegmentID := 1234567
// }
// )), false);
// }
//
// testcase tc_checkLdmFull_LaPaz() runs on TCType system TCType {
// test_PDU<UtEvent>(m_checkLdm(m_camMsg_irs (
// 6546424,
// 35445334,
// { false, false, false },
// {
// longitude := {hemisphere := west, degree := 220000000},
// latitude := {hemisphere := south, degree := 270000000},
// elevation := 36600,
// heading := 21600,
// streetName := "El Alto",
// positionConfidence := omit,
// elevationConfidence := omit,
// roadSegmentID := 3546345
// }
// )), false);
// }
//
// template (value) CAM m_camMsg_valid_With_Parameters(
// StationID p_stationId,
// GenerationDeltaTime p_generationTime,
// template (value) ReferencePosition p_referencePosition
// ) := {
// header := {
// protocolVersion := 1,
// messageID := 2,
// stationID := p_stationId
// },
// cam := {
// generationDeltaTime := p_generationTime,
// camParameters := {
// basicContainer := {
// stationType := c_stationType_passengerCar,
// referencePosition := p_referencePosition
// },
// highFrequencyContainer := {
// basicVehicleContainerHighFrequency := {
// heading := {
// headingValue := c_headingValue_wgs84North, //0
// headingConfidence := 10
// },
// speed := {
// speedValue := 45,
// speedConfidence := 5
// },
// driveDirection := forward,
// vehicleLength := {
// vehicleLengthValue := 50,
// vehicleLengthConfidenceIndication := noTrailerPresent
// },
// vehicleWidth := 21,
// longitudinalAcceleration := {
// longitudinalAccelerationValue := c_longitudinalAccelerationValue_unavailable,
// longitudinalAccelerationConfidence := c_accelerationConfidence_unavailable
// },
// curvature := {
// curvatureValue := c_curvatureValue_straight,
// curvatureConfidence := unavailable
// },
// curvatureCalculationMode := yawRateUsed,
// yawRate := {
// yawRateValue := c_yawRateValue_straight,
// yawRateConfidence := unavailable
// },
// accelerationControl := omit,
// steeringWheelAngle := omit,
// lateralAcceleration := omit,
// verticalAcceleration := omit,
// performanceClass := omit
// }
// },
// lowFrequencyContainer := {
// basicVehicleContainerLowFrequency := {
// vehicleRole := default_,
// exteriorLights := c_exteriorLights_daytimeRunningLightsOn,
// pathHistory := {}
// }
// },
// specialVehicleContainer := omit
// }
// }
// }
//
// template (value) ProfileParameters m_profileParameters_BasicVehicle := {
// basicVehicle := {
// }
//// emergencyVehicle := {
//// lightBarInUse := 2,
//// sireneInUse := 3,
//// emergencyResponseType := 1
//// }
//// publicTransportVehicle := {
//// publicVehicleType := 3,
//// pTLineDescription := {
//// courseOfJourney := "Course Of Journey",
//// lineRef := 10,
//// routeRef := "Route Ref"
//// },
//// ScheduleDeviation scheduleDeviation optional,
//// TrafficLightPriority trafficLightPriority optional
//// } // End of PublicTransportVehicle
// } // End of template m_profileParameters_BasicVehicle
//
// template (value) ProfileParameters m_profileParameters_EmergencyVehicle := {
// emergencyVehicle := {
// lightBarInUse := enabled,
// sireneInUse := engaged,
// emergencyResponseType := rightOfWay
// }
// } // End of template m_profileParameters_EmergencyVehicle
//
// template (value) ProfileParameters m_profileParameters_PublicTransportVehicle := {
// publicTransportVehicle := {
// publicVehicleType := 3,
// pTLineDescription := {
// courseOfJourney := "Course Of Journey",
// lineRef := "Line Ref",
// routeRef := "Route Ref"
// },
// scheduleDeviation := -200,
// trafficLightPriority := 7
// }
// } // End of template m_profileParameters_PublicTransportVehicle
//
} // End of group testUtEvent
group testCamPrimitiveMessages {
testcase tc_CamReq() runs on TCType system TCType {
log("v_camReq=", m_camReq(
m_camMsg(
f_getTsStationId(),
35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
)
));
log("v_camReq=", bit2oct(encvalue(m_camReq(
m_camMsg(
f_getTsStationId(),
35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
)
))));
test_PDU<CamReq>(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000 // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
)
),
true,
oct2bit('01020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF80'O)
);
}
testcase tc_encodeCamTemplate() runs on TCType system TCType {
var template (value) CamReq v_camReq := m_camReq(
m_camMsg_vehicle_HF_BV(
f_getTsStationId(),
f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
m_tsPosition
)
);
log("v_camReq=", v_camReq);
log("v_camReq=", bit2oct(encvalue(v_camReq)));
}
} // End of group testCamPrimitiveMessages
} // End of group LibItsCam_testCases
}
/trunk/unittests/codec/ttcn/test_LibItsDenm_TypesAndValues.ttcn
1,141 → 1,67
module test_LibItsDenm_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
import from test_CommonCodec all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all
with {
encode "LibItsDenm_asn1"
}
// LibIts
import from CAM_PDU_Descriptions language "ASN.1:1997"all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
// AtsCam
import from LibItsDenm_TestSystem all;
import from LibItsDenm_Templates all;
import from LibItsDenm_TypesAndValues all;
import from LibItsCommon_TypesAndValues all;
import from LibItsDenm_Functions all;
import from LibItsCommon_Functions all;
 
group testUtEvent {
testcase tc_UtDenmInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_denmInitialize, false);
}
import from test_CommonCodec all;
group LibItsDenm_testCases {
testcase tc_eventSituation() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEvent(m_situation(c_causeVehicleProblem, c_subCauseUnknown)), false);
}
testcase tc_eventCancellation() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventCancellation(m_situation(c_causeSlowVehicle, c_subCauseUnknown), { f_getTsStationId(), 170 }), false);
}
testcase tc_eventNegation() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventNegation(m_situation(c_causeWrongWayDriving, c_subCauseUnknown), { f_getTsStationId(), 170 }), false);
}
testcase tc_eventTrafficFlowEffect() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventTrafficFlowEffect(m_situation(c_causeExtremWeatherCondition, c_subCauseUnknown), c_tfeFreeTrafficFlow), false);
}
testcase tc_eventLinkedCause() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventLinkedCause(m_situation(c_causeAccident, c_subCauseUnknown), m_situation(c_causeExtremWeatherCondition, c_subCauseUnknown)), false);
}
testcase tc_eventExpirationTime() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventExpirationTime(m_situation(c_causeVehicleProblem, c_subCauseUnknown), 281474976710655), false);
}
testcase tc_eventExpirationTimeFrequency() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventExpirationTimeFrequency(m_situation(c_causeVehicleProblem, c_subCauseUnknown), 281474976710655, 255), false);
}
testcase tc_eventCharact() runs on TCType system TCType {
test_PDU<UtEvent>(m_utEventCharact(m_situation(c_causeVehicleProblem, c_subCauseUnknown), m_eventCharact), false);
}
testcase tc_checkDenmEvent() runs on TCType system TCType {
var template (value) UtCheck v_utMsg := { m_utEvent(m_situation(c_causeVehicleProblem, c_subCauseUnknown)) };
test_PDU<UtCheck>(v_utMsg, false);
}
testcase tc_checkDenmEventNegation() runs on TCType system TCType {
var template (value) UtCheck v_utMsg := { m_utEventNegation(m_situation(c_causeWrongWayDriving, c_subCauseUnknown), { f_getTsStationId(), 170 }) };
test_PDU<UtCheck>(v_utMsg, false);
}
testcase tc_checkDenmEventCancellation() runs on TCType system TCType {
var template (value) UtCheck v_utMsg := { m_utEventCancellation(m_situation(c_causeVehicleProblem, c_subCauseBrakeDownVehicle), { f_getTsStationId(), 170 }) };
test_PDU<UtCheck>(v_utMsg, false);
}
} // End of group testUtEvent
 
 
group testDenmPrimitiveMessages {
 
template (value) DenmInd m_denmInd(template (value) DenmPdu p_denMsg) := {
msgIn := p_denMsg,
receptionTime := 1234587
}
 
testcase tc_DenmReq() runs on TCType system TCType {
test_PDU<DenmReq>(
m_denmReq(
m_denmPdu(
f_getCurrentTime(),
m_denmWithCause(
0,
m_situation(c_causeVehicleProblem, c_subCauseUnknown),
m_eventPosition(m_tsPosition),
f_getTsStationId()))),
false);
}
 
testcase tc_DenmReqOutdated() runs on TCType system TCType {
test_PDU<DenmReq>(
m_denmReq(
m_denmPdu(
f_getCurrentTime(),
m_denmWithCause(
0,
m_situation(c_causeSlowVehicle, c_subCauseUnknown),
m_eventPosition(m_tsPosition),
f_getTsStationId()))),
false);
}
 
testcase tc_DenmInd() runs on TCType system TCType {
test_PDU<DenmInd>(
m_denmInd(
m_denmPdu(
f_getCurrentTime(),
m_denmWithCause(
0,
m_situation(c_causeSlowVehicle, c_subCauseUnknown),
m_eventPosition(m_tsPosition),
f_getTsStationId()))),
false);
}
testcase tc_test() runs on TCType system TCType {
var DenmPdu v_decMsg;
var integer v_res := 0;
v_res := decvalue(oct2bit('00010133a6bf49d07302172f800000002674d823d200391f20000000001ff01000400010802317d1109404000884400400000000000004000000007ffd7fe0000001f81abe34a1eade9e30026e100008ebbb265cda7765c8000000002008c00046bc387a'O), v_decMsg);
select (v_res) {
case (0) {
log(v_decMsg);
setverdict(pass);
group testUtEvent {
testcase tc_UtDenmInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_denmInitialize, false);
}
case (1) {
setverdict(fail, "Decoding failed.");
testcase tc_eventSituation() runs on TCType system TCType {
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
test_PDU<UtDenmTrigger>(
m_utTriggerEvent(
v_situation,
m_denmLocation_zeroDelta
),
false
);
}
case (2) {
setverdict(fail, "Not enough bits.");
} // End of group testUtEvent
group testDenmPrimitiveMessages {
testcase tc_DenmReq() runs on TCType system TCType {
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
test_PDU<DenmReq>(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
)
),
true,
oct2bit('01010001B207C0000D903800000000006072000000188593E91B2B9BDF918C000400400061A80000B6000037FFFDFFFF63390100'O)
);
}
}
// var DenmPdu bla := { header := { protocolVersion := 0, messageID := 1, generationTime := 1321352514000 }, denm := { management := { actionID := { stationID := 2551232892, sequenceNo := 0 }, dataVersion := 0, expiryTime := 1321352634000, frequency := 1, reliability := 100, isNegation := false }, situation := { trafficFlowEffect := 1, situation := { cause := 0, subCause := 0 }, linkedCause := { cause := 0, subCause := 0 }, severity := informative, eventCharact := { eventmobility := false, causeType := itsStation, relevance := physicallyRelevant, timeCriticality := false }, vehicleCommonParameters := { vehicleType := 1, stationLength := 1, stationLengthConfidence := 0, stationWidth := 1, stationWidthConfidence := 0, vehicleSpeed := 38, vehicleSpeedConfidence := 1, longAcceleration := 1, longAccelerationConfidence := 1, accelerationControl := '010000000'B, yawRate := { yawDirection := right, yawRateValue := 1 }, yawRateConfidence := 1, exteriorLights := '10000000'B, turnAdvice := { direction := '00000000'B, distance := 0 }, distanceToStopLine := 0, occupancy := 0, doorOpen := '00000000'B, posConfidenceEllipse := { semiMajorConfidence := 0, semiMinorConfidence := 0, semiMajorOrientation := 0 }, curvature := 0, curvatureChange := 0, curvatureConfidence := 0, crashStatus := false, headingConfidence := 0, dangerousGoods := 0 }, profile := {basicVehicle := { }} }, location := { eventPosition := {eventPositionCurrentDefinition := { refPosition := { longitude := { hemisphere := east, degree := 56084116 }, latitude := { hemisphere := north, degree := 514714083 }, elevation := -47, heading := 0, streetName := "undefined", positionConfidence := 0, elevationConfidence := 0, roadSegmentID := 0 }, eventSpeed := 38 }}, locationRef := {trace := { traceID := 0, waypoints := {} }}, relevanceArea := omit } } };
}
} // End of group testDenmPrimitiveMessages
} // End of group testDenmPrimitiveMessages
} // End of group LibItsDenm_testCases
}
/trunk/unittests/codec/ttcn/test_LibItsExternalFunctions.ttcn3
1,128 → 1,783
module test_LibItsExternalFunctions {
import from LibCommon_BasicTypesAndValues {
type UInt8
};
import from LibItsIpv6OverGeoNetworking_TypesAndValues {
type Ipv6Address, RouterAdvertisementMsg
};
// LibCommon
import from LibCommon_BasicTypesAndValues {type UInt8;}
// LibIts
import from LibItsIpv6OverGeoNetworking_TypesAndValues {
type Ipv6Address, RouterAdvertisementMsg;
}
import from LibItsIpv6OverGeoNetworking_Functions all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Functions all;
import from test_CommonCodec all;
template (value) UInt8 m_ICMPv6_protocoId := 58; // = 0x3a: ICMPv6 protocol ID
group testValues_01 {
group externalFunction_testCases {
template (value) Ipv6Address m_src_01 := 'fe80000000000000020086fffe0580da'O; // fe80::200:86ff:fe05:80da
group testValues_01 {
template (value) Ipv6Address m_src_01 := 'fe80000000000000020086fffe0580da'O; // fe80::200:86ff:fe05:80da
template (value) Ipv6Address m_dst_01 := 'fe80000000000000026097fffe0769ea'O; // fe80::260:97ff:fe07:69ea
template (value) octetstring m_ipv6Payload_01 := '8700000000000000fe80000000000000026097fffe0769ea01010000860580da'O;
// template (value) octetstring m_ipv6Payload_01 := '870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'O;
/*template (value) RouterAdvertisementMsg m_ipv6Payload := {
icmpType := c_rtAdvMsg,
icmpCode := 0,
checksum := '68bd'O,
curHopLimit := ,
managedConfigFlag,
otherConfigFlag,
homeAgentFlag,
reserved,
routerLifetime,
reachableTime,
retransTimer,
rtAdvOptions := omit
}*/
template (value) integer m_payloadLength_01 := 32;
template octetstring mw_checksum_01 := '68bd'O;
} // End of group testValues_01
template (value) Ipv6Address m_dst_01 := 'fe80000000000000026097fffe0769ea'O; // fe80::260:97ff:fe07:69ea
group testValues_02 {
template (value) Ipv6Address m_src_02 := '2001ffff000000000000000000000002'O;
template (value) Ipv6Address m_dst_02 := '2001ffff000000000000000000000001'O;
template (value) octetstring m_ipv6Payload_02 := '80000000636801004a43ec45d23f0b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
// template (value) octetstring m_ipv6Payload_02 := '8000dc4b636801004a43ec45d23f0b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
template (value) integer m_payloadLength_02 := 64;
template octetstring mw_checksum_02 := 'dc4b'O;
} // End of group testValues_02
template (value) octetstring m_ipv6Payload_01 := '8700000000000000fe80000000000000026097fffe0769ea01010000860580da'O;
// template (value) octetstring m_ipv6Payload_01 := '870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'O;
/*template (value) RouterAdvertisementMsg m_ipv6Payload := {
icmpType := c_rtAdvMsg,
icmpCode := 0,
checksum := '68bd'O,
curHopLimit := ,
managedConfigFlag,
otherConfigFlag,
homeAgentFlag,
reserved,
routerLifetime,
reachableTime,
retransTimer,
rtAdvOptions := omit
}*/
template (value) integer m_payloadLength_01 := 32;
template octetstring mw_checksum_01 := '68bd'O;
} // End of group testValues_01
group testValues_03 {
template (value) Ipv6Address m_src_03 := '2001ffff000000000000000000000001'O; // 2001:ffff::1
group testValues_02 {
template (value) Ipv6Address m_dst_03 := '2001ffff000000000000000000000002'O; // 2001:ffff::2
template (value) octetstring m_ipv6Payload_03 := '8100000072680500b043ec45f3500b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
// template (value) octetstring m_ipv6Payload_03 := '8100413a72680500b043ec45f3500b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
template (value) integer m_payloadLength_03 := 64;
template octetstring mw_checksum_03 := '413a'O;
} // End of group testValues_03
template (value) Ipv6Address m_src_02 := '2001ffff000000000000000000000002'O;
template (value) Ipv6Address m_dst_02 := '2001ffff000000000000000000000001'O;
template (value) octetstring m_ipv6Payload_02 := '80000000636801004a43ec45d23f0b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
// template (value) octetstring m_ipv6Payload_02 := '8000dc4b636801004a43ec45d23f0b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
template (value) integer m_payloadLength_02 := 64;
template octetstring mw_checksum_02 := 'dc4b'O;
} // End of group testValues_02
group testValues_03 {
template (value) Ipv6Address m_src_03 := '2001ffff000000000000000000000001'O; // 2001:ffff::1
 
template (value) Ipv6Address m_dst_03 := '2001ffff000000000000000000000002'O; // 2001:ffff::2
template (value) octetstring m_ipv6Payload_03 := '8100000072680500b043ec45f3500b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
// template (value) octetstring m_ipv6Payload_03 := '8100413a72680500b043ec45f3500b0008090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'O;
template (value) integer m_payloadLength_03 := 64;
template octetstring mw_checksum_03 := '413a'O;
} // End of group testValues_03
group externalFunctions {
testcase tc_computeIPv6Checksum_01() runs on TCType system TCType {
var octetstring v_checksum;
group externalFunctionsGN {
v_checksum := f_computeIPv6CheckSum(
m_src_01,
m_dst_01,
m_payloadLength_01,
m_ipv6Payload_01,
m_ICMPv6_protocoId);
testcase tc_computeIPv6Checksum_01() runs on TCType system TCType {
var octetstring v_checksum;
v_checksum := f_computeIPv6CheckSum(
m_src_01,
m_dst_01,
m_payloadLength_01,
m_ipv6Payload_01,
m_ICMPv6_protocoId);
if (match(v_checksum, mw_checksum_01) == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
if (match(v_checksum, mw_checksum_01) == true) {
setverdict(pass);
} else {
setverdict(fail);
testcase tc_computeIPv6Checksum_02() runs on TCType system TCType {
var octetstring v_checksum;
v_checksum := f_computeIPv6CheckSum(
m_src_02,
m_dst_02,
m_payloadLength_02,
m_ipv6Payload_02,
m_ICMPv6_protocoId);
if (match(v_checksum, mw_checksum_02) == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
}
testcase tc_computeIPv6Checksum_03() runs on TCType system TCType {
var octetstring v_checksum;
v_checksum := f_computeIPv6CheckSum(
m_src_03,
m_dst_03,
m_payloadLength_03,
m_ipv6Payload_03,
m_ICMPv6_protocoId);
if (match(v_checksum, mw_checksum_03) == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
} // End of group externalFunctionsGN
testcase tc_computeIPv6Checksum_02() runs on TCType system TCType {
var octetstring v_checksum;
group externalFunctionsSec {
v_checksum := f_computeIPv6CheckSum(
m_src_02,
m_dst_02,
m_payloadLength_02,
m_ipv6Payload_02,
m_ICMPv6_protocoId);
testcase tc_generateKeyPair_01() runs on TCType system TCType {
var boolean v_result;
var octetstring/*UInt64*/ v_privateKey;
var octetstring v_publicKeyX;
var octetstring v_publicKeyY;
v_result := fx_generateKeyPair(v_privateKey, v_publicKeyX, v_publicKeyY);
log("v_result = ", v_result);
log("privateKey = ", v_privateKey);
log("publicKeyX = ", v_publicKeyX);
log("publicKeyY = ", v_publicKeyY);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
if (match(v_checksum, mw_checksum_02) == true) {
testcase tc_hashWithSha256_01() runs on TCType system TCType {
var octetstring v_data;
var octetstring v_hash := ''O;
v_data := 'DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF'O;
v_hash := f_hashWithSha256(v_data);
log("v_hash = ", v_hash);
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_signWithEcdsaNistp256WithSha256_01() runs on TCType system TCType {
var boolean v_result;
var octetstring v_toBeSignedSecuredMessage;
var octetstring/*UInt64*/ v_privateKey;
var octetstring v_publicKeyX;
var octetstring v_publicKeyY;
var octetstring v_hash, v_sign;
fx_generateKeyPair(v_privateKey, v_publicKeyX, v_publicKeyY);
log("privateKey = ", v_privateKey);
log("publicKeyX = ", v_publicKeyX);
log("publicKeyY = ", v_publicKeyY);
v_toBeSignedSecuredMessage := '0203811D80020209010727A031EE3F372C01008091000004EA807A2D6CC220D563C6C74047C764407AF5F21240C403A40697294A94CF3CF0846C8DF447DA62EAC49DBA51EEC4AF7C8B1E0BCC67822626B2112E2FC56BE4C1010100044F0CBC2A8AF10F5476AE4180828D9C62D82215E0EDCBDCAB74AA49C1B6D260455E949EA97B9A98F64BDA55FA2441F4BE82BB45DB1B4F9B194B5471A6058F6E8602202006C04080C04081240153C13EED5A391AED0303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000EBEECFB8A931E5FBA5138808836CEC66EE5C99095693DDFE235076B91C8E2B0013DEAEB76EC813F6C205333E0050434FE7F29F2980C352B7FB1578CE2AA6F394000000004E526ED10203000004D20000162E002F2200200010800000000100BC21A4FEDECABEEF0001E240000012F8000002A38037269401'O;
v_hash := f_hashWithSha256(v_toBeSignedSecuredMessage);
log("length v_hash = ", lengthof(v_hash));
log("v_hash = ", v_hash);
v_sign := fx_signWithEcdsaNistp256WithSha256(v_toBeSignedSecuredMessage, v_privateKey);
log("length v_sign = ", lengthof(v_sign));
log("v_sign = ", v_sign);
log(substr(v_sign, 2, 32));
log(substr(v_sign, 34, 32));
v_result := fx_verifyWithEcdsaNistp256WithSha256(v_toBeSignedSecuredMessage, v_sign, v_publicKeyX, v_publicKeyY);
log("v_result = ", v_result);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
} // End of group externalFunctionsSec
testcase tc_computeIPv6Checksum_03() runs on TCType system TCType {
var octetstring v_checksum;
group externalFunctionsGeodesic {
v_checksum := f_computeIPv6CheckSum(
m_src_03,
m_dst_03,
m_payloadLength_03,
m_ipv6Payload_03,
m_ICMPv6_protocoId);
testcase tc_dms2dd() runs on TCType system TCType {
if (48.857253 != f_dms2dd(48, 51, 26.1108, "N")) { // Latitude Paris
setverdict(fail);
}
if (2.294489 != f_dms2dd(2, 17, 40.16, "E")) { // Longitude Paris
setverdict(fail);
}
if (42.560225 != f_dms2dd(42, 33, 36.81, "N")) { // Latitude Ackley, Iowa
setverdict(fail);
}
if (-93.057803 != f_dms2dd(93, 3, 28.09, "W")) { // Longitude Ackley, Iowa
setverdict(fail);
}
if (-33.962156 != f_dms2dd(33, 57, 43.76, "S")) { // Latitude Port Elisabeth, South Africa
setverdict(fail);
}
if (25.623722 != f_dms2dd(25, 37, 25.40, "E")) { // Longitude , Port ElisabethSouth Africa
setverdict(fail);
}
if (35.674131 != f_dms2dd(35, 40, 26.87, "N")) { // Latitude Tokyo
setverdict(fail);
}
if (139.770375 != f_dms2dd(139, 46, 13.35, "E")) { // Longitude Tokyo
setverdict(fail);
}
if (-37.823108 != f_dms2dd(37, 49, 23.19, "S")) { // Latitude Melbourne
setverdict(fail);
}
if (144.977039 != f_dms2dd(144, 58, 37.34, "E")) { // Longitude Melbourne
setverdict(fail);
}
if (-54.657792 != f_dms2dd(54, 39, 28.05, "S")) { // Latitude Faro San Diego
setverdict(fail);
}
if (65.119572 != f_dms2dd(65, 7, 10.46, "E")) { // Longitude Faro San Diego
setverdict(fail);
}
if (42.0 != f_dms2dd(42, 0, 0.0, "N")) { // Longitude Faro San Diego
setverdict(fail);
}
if (0.0 != f_dms2dd(37, 49, 23.29, "A")) { // Latitude
setverdict(fail);
}
else {
setverdict(pass);
}
}
if (match(v_checksum, mw_checksum_03) == true) {
setverdict(pass);
} else {
setverdict(fail);
testcase tc_isValidPolygonalRegion_01() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_polygonalArea;
v_result := f_isValidPolygonalRegion(v_polygonalArea);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
}
}
testcase tc_isValidPolygonalRegion_02() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_polygonalArea;
v_polygonalArea := {};
v_result := f_isValidPolygonalRegion(v_polygonalArea);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isValidPolygonalRegion_03() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_polygonalArea;
v_polygonalArea := {
{ // Darmstadt, Germany
latitude := 498716540,
longitude := 8638208
},
{
latitude := 498685550,
longitude := 8641105
},
{
latitude := 492040400,
longitude := 8647560
}
};
v_result := f_isValidPolygonalRegion(v_polygonalArea);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsidePolygonalRegion_01() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_polygonalArea;
var ThreeDLocation v_location;
v_polygonalArea := {
{ // Sisteron, France
latitude := f_ddlat2int(f_dms2dd(44, 11, 56.91, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 56, 33.28, "E"))
},
{ // Nice, France
latitude := 437101728,
longitude := 7261953
},
{ // Marseille, france
latitude := f_ddlat2int(f_dms2dd(43, 17, 39.40, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 21, 29.19, "E"))
},
{ // Cevennes National Park, france
latitude := f_ddlat2int(f_dms2dd(44, 19, 23.34, "N")),
longitude := f_ddlon2int(f_dms2dd(3, 35, 39.21, "E"))
}
};
v_location := { // Location outside: Brest, France
latitude := f_ddlat2int(f_dms2dd(48, 23, 35.91, "N")),
longitude := f_ddlon2int(f_dms2dd(4, 29, 16.65, "W")),
elevation := '0000'O
};
v_result := f_isLocationInsidePolygonalRegion(v_polygonalArea, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Forcalquier, France
latitude := f_ddlat2int(f_dms2dd(43, 57, 47.40, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 46, 47.42, "E")),
elevation := '0000'O
};
v_result := f_isLocationInsidePolygonalRegion(v_polygonalArea, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsidePolygonalRegion_03() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_polygonalArea;
var ThreeDLocation v_location;
v_polygonalArea := { // Florida, Usa
{ // Upper left corner
latitude := 310002130,
longitude := -87584839
},
{
latitude := 310096290,
longitude := -85003052
},
{
latitude := 307267260,
longitude := -84838257
},
{
latitude := 305849620,
longitude := -82168579
},
{
latitude := 307361700,
longitude := -81476441
},
{ // Upper right corner
latitude := 290023750,
longitude := -80795288
},
{
latitude := 268965980,
longitude := -79938355
},
{
latitude := 258137380,
longitude := -80059204
},
{
latitude := 249302800,
longitude := -80454712
},
{
latitude := 244011350,
longitude := -81817017
},
{
latitude := 247009270,
longitude := -81959839
},
{
latitude := 249502030,
longitude := -81124878
},
{
latitude := 260015000,
longitude := -82014771
},
{
latitude := 278332470,
longitude := -83014527
},
{
latitude := 288389000,
longitude := -82871704
},
{
latitude := 299872930,
longitude := -84091187
},
{
latitude := 295390530,
longitude := -85134888
},
{
latitude := 302723520,
longitude := -86475220
},
{
latitude := 302818390,
longitude := -87628784
}
};
v_location := { // Location inside: Forcalquier, France
latitude := 308211200,
longitude := -87255249,
elevation := '0000'O
};
v_result := f_isLocationInsidePolygonalRegion(v_polygonalArea, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location outside: Forcalquier, France
latitude := 439599330,
longitude := 5780711,
elevation := '0000'O
};
v_result := f_isLocationInsidePolygonalRegion(v_polygonalArea, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsideRectangularRegion_01() runs on TCType system TCType {
var boolean v_result;
var RectangularRegions v_rectangularAreas;
var ThreeDLocation v_location;
v_rectangularAreas :=
{
{ // Wyoming, USA
{ // Upper left corner
latitude := f_ddlat2int(f_dms2dd(45, 0, 0.0, "N")),
longitude := f_ddlon2int(f_dms2dd(111, 0, 0.0, "W"))
},
{ // Lower right corner
latitude := f_ddlat2int(f_dms2dd(41, 0, 0.0, "N")),
longitude := f_ddlon2int(f_dms2dd(104, 0, 0.0, "W"))
}
}
};
v_location := { // Location outside: Kimball Muni/robert E Arraj Field, Nebraska
latitude := f_ddlat2int(f_dms2dd(41, 11, 17.0, "N")),
longitude := f_ddlon2int(f_dms2dd(103, 40, 38.6, "W")),
elevation := '0000'O
}
v_result := f_isLocationInsideRectangularRegion(v_rectangularAreas, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Bridger Creek Airport, Wyoming
latitude := f_ddlat2int(f_dms2dd(43, 20, 25.85, "N")),
longitude := f_ddlon2int(f_dms2dd(107, 41, 13.29, "W")),
elevation := '0000'O
}
v_result := f_isLocationInsideRectangularRegion(v_rectangularAreas, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsideCircularRegion_01() runs on TCType system TCType {
var boolean v_result;
var CircularRegion v_circularArea;
var ThreeDLocation v_location;
v_circularArea :=
{
{ // Center: Heathrow Airport, Great Britain
latitude := f_ddlat2int(f_dms2dd(51, 28, 20.57, "N")),
longitude := f_ddlon2int(f_dms2dd(0, 27, 3.38, "W"))
},
2000 // Radius in meters: 2 Km
};
v_location := { // Location outside: Sheffield Town Hall, Great Britain
latitude := f_ddlat2int(f_dms2dd(53, 22, 49.38, "N")),
longitude := f_ddlon2int(f_dms2dd(1, 28, 12.12, "W")),
elevation := '0000'O
}
v_result := f_isLocationInsideCircularRegion(v_circularArea, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Harlington Baptist Church, Great Britain
latitude := f_ddlat2int(f_dms2dd(51, 29, 12.73, "N")),
longitude := f_ddlon2int(f_dms2dd(0, 26, 7.6, "W")),
elevation := '0000'O
}
v_result := f_isLocationInsideCircularRegion(v_circularArea, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsideIdentifiedRegion_01() runs on TCType system TCType {
var boolean v_result;
var IdentifiedRegion v_area;
var ThreeDLocation v_location;
v_area := {
region_dictionary := e_iso_3166_1, // ISO 3166-1
region_identifier := 250, // France
local_region := 83 // Var
}
v_location := { // Location ouside: Harlington Baptist Church, Great Britain
latitude := f_ddlat2int(f_dms2dd(51, 29, 12.73, "N")),
longitude := f_ddlon2int(f_dms2dd(0, 26, 7.6, "W")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Les oliviers de la mairie, place Villeneuve Bargemon, Marseille, France
latitude := f_ddlat2int(f_dms2dd(43, 17, 48.57, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 22, 9.61, "E")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Cattedrale St Leonce e battistero, Frejus, France
latitude := f_ddlat2int(f_dms2dd(43, 25, 58.13, "N")),
longitude := f_ddlon2int(f_dms2dd(6, 44, 11.18, "E")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsideIdentifiedRegion_02() runs on TCType system TCType {
var boolean v_result;
var IdentifiedRegion v_area;
var ThreeDLocation v_location;
v_area := {
region_dictionary := e_iso_3166_1, // ISO 3166-1
region_identifier := 1024, // Unknown country code
local_region := 0
}
v_location := { // Location outside: Les oliviers de la mairie, place Villeneuve Bargemon, Marseille, France
latitude := f_ddlat2int(f_dms2dd(43, 17, 48.57, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 22, 9.61, "E")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isLocationInsideIdentifiedRegion_03() runs on TCType system TCType {
var boolean v_result;
var IdentifiedRegion v_area;
var ThreeDLocation v_location;
v_area := {
region_dictionary := e_un_stats, // UN states
region_identifier := 250, // France code in UN
local_region := 0
}
v_location := { // Location inside: Les oliviers de la mairie, place Villeneuve Bargemon, Marseille, France
latitude := f_ddlat2int(f_dms2dd(43, 17, 48.57, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 22, 9.61, "E")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
v_location := { // Location inside: Les oliviers de la mairie, place Villeneuve Bargemon, Marseille, France
latitude := f_ddlat2int(f_dms2dd(43, 17, 48.57, "N")),
longitude := f_ddlon2int(f_dms2dd(5, 22, 9.61, "E")),
elevation := '0000'O
}
v_result := f_isLocationInsideIdentifiedRegion(v_area, v_location);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
testcase tc_isPolygonalRegionInside_01() runs on TCType system TCType {
var boolean v_result;
var PolygonalRegion v_parent, v_region;
v_parent := {
}
v_region := {
}
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_parent := {
{ // Forteza, Brasil
latitude := f_ddlat2int(f_dms2dd(3, 51, 51.317, "S")),
longitude := f_ddlon2int(f_dms2dd(38, 23, 10.429, "W"))
},
{ // Sao Paulo, Brasil
latitude := f_ddlat2int(f_dms2dd(23, 43, 30.042, "S")),
longitude := f_ddlon2int(f_dms2dd(46, 30, 58.007, "W"))
},
{ // Douradina, Brasil
latitude := f_ddlat2int(f_dms2dd(21, 59, 1.685, "S")),
longitude := f_ddlon2int(f_dms2dd(54, 38, 45.585, "W"))
},
{ // Sorriso, Brasil
latitude := f_ddlat2int(f_dms2dd(12, 58, 59.332, "S")),
longitude := f_ddlon2int(f_dms2dd(55, 5, 13.476, "W"))
}
};
v_region := {
};
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_region := { // Part of the region inside
{ // Goias, Brasil
latitude := f_ddlat2int(f_dms2dd(13, 9, 15.754, "S")),
longitude := f_ddlon2int(f_dms2dd(49, 38, 10.429, "W"))
},
{ // Araguaiana, Brasil
latitude := f_ddlat2int(f_dms2dd(15, 9, 25.105, "S")),
longitude := f_ddlon2int(f_dms2dd(51, 31, 33.164, "W"))
},
{ // Espirito Santo, Brasil
latitude := f_ddlat2int(f_dms2dd(20, 52, 45.635, "S")),
longitude := f_ddlon2int(f_dms2dd(40, 48, 11.601, "W"))
}
}
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_region := { // Region inside
{ // Goias, Brasil
latitude := f_ddlat2int(f_dms2dd(13, 9, 15.754, "S")),
longitude := f_ddlon2int(f_dms2dd(49, 38, 10.429, "W"))
},
{ // Araguaiana, Brasil
latitude := f_ddlat2int(f_dms2dd(15, 9, 25.105, "S")),
longitude := f_ddlon2int(f_dms2dd(51, 31, 33.164, "W"))
},
{ // Piaui, Brasil
latitude := f_ddlat2int(f_dms2dd(10, 8, 30.954, "S")),
longitude := f_ddlon2int(f_dms2dd(45, 21, 45.175, "W"))
}
}
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
v_region := { // Region Outside
{ // Naramjos, Peru
latitude := f_ddlat2int(f_dms2dd(5, 44, 49.827, "S")),
longitude := f_ddlon2int(f_dms2dd(77, 30, 50.537, "W"))
},
{ // Tarapoto, Peru
latitude := f_ddlat2int(f_dms2dd(6, 30, 3.237, "S")),
longitude := f_ddlon2int(f_dms2dd(76, 20, 18.603, "W"))
},
{ // Cajamarca, Peru
latitude := f_ddlat2int(f_dms2dd(7, 10, 37.923, "S")),
longitude := f_ddlon2int(f_dms2dd(78, 30, 49.658, "W"))
}
}
v_result := f_isPolygonalRegionInside(v_parent, v_region);
if (v_result == false) {
setverdict(pass);
} else {
setverdict(fail);
}
v_result := f_isPolygonalRegionInside(v_region, v_region);
if (v_result == true) {
setverdict(pass);
} else {
setverdict(fail);
}
}
} // End of group externalFunctionsGeodesic
} // End of group externalFunctions
} // End of group externalFunction_testCases
} // End of module test_LibItsExternalFunctions
/trunk/unittests/codec/ttcn/test_LibItsGeoNetworking_TypesAndValues.ttcn
1,20 → 1,50
module test_LibItsGeoNetworking_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
 
// LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_DataStrings all;
import from LibItsGeoNetworking_TestSystem all;
// LibIts
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997"all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_Functions all;
// LibItsExternal
import from LibItsExternal_TypesAndValues all;
// LibItsCam
import from LibItsCam_TypesAndValues all;
import from LibItsCam_TestSystem all;
import from LibItsCam_Templates {
template m_camReq;
group camTemplateFunctions
};
// LibItsDenm
import from LibItsDenm_Templates all;
import from LibItsDenm_TestSystem all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Functions all;
import from LibItsGeoNetworking_Pixits {
modulepar PX_GN_UPPER_LAYER
};
import from LibItsGeoNetworking_Pics {
modulepar PICS_GN_LOCAL_ADDR_CONF_METHOD
};
import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
import from LibItsIpv6OverGeoNetworking_Templates all;
import from LibItsExternal_TypesAndValues all;
import from LibItsGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_Pixits all;
import from LibItsGeoNetworking_Pics all;
// import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
// import from LibItsIpv6OverGeoNetworking_Templates all;
// import from LibItsExternal_TypesAndValues all;
 
import from test_CommonCodec all;
22,574 → 52,354
template all
};
 
/**
* @desc Send template for GeoNetworking packet (GeonetworkingPort Primitive)
* @param p_geoNwMsg GeoNetworking packet to be sent
*/
template GeoNetworkingReq mw_geoNwReq_linkLayerBroadcast(
template GeoNetworkingPacket p_geoNwMsg
) := {
msgOut := p_geoNwMsg,
macDestinationAddress := c_llBroadcast
}
 
group LibItsGeoNetworking_DummyTemplates {
 
template CommonHeader mw_commonHeaderWithHopLimitAndLength (
in template (present) LongPosVector p_senderLongPosVec,
in template (present) NextHeader p_nextHeader,
in template (present) HeaderTST p_headerTypeSubType,
in template (present) UInt8 p_hopLimit,
in template (value) integer p_plLength
) modifies mw_commonHeaderWithHopLimit := {
plLength := p_plLength
group LibItsGeoNetworking_testCases {
group LibItsGeoNetworking_DummyTemplates {
/**
* @desc Dummy template for GN_Address
*/
template (value) GN_Address m_dummyGnAddrIut := {
typeOfAddress := e_manual,
stationType := e_roadSideUnit,
stationCountryCode := 33,
mid := 'a4fedecabeef'O
}
/**
* @desc Dummy template for long position vector
*/
template (value) LongPosVector m_dummyLongPosVectorIut := {
gnAddr := m_dummyGnAddrIut,
timestamp := 123456,
latitude := 4856,
longitude := 675,
pai := '1'B,
speed := 55,
heading := 9876
}
template Header mw_shbHeaderWithLength (in integer p_plLength):= {
shbHeader := {
commonHeader := mw_commonHeaderWithHopLimitAndLength(
?, // SE PV
?, // NH
m_shbHeaderType, // HT + HST
1, // HL
p_plLength // plLength
)
template (value) GN_Address m_dummyGnAddrNodeA := {
typeOfAddress := e_manual,
stationType := e_pedestrian,
stationCountryCode := 49,
mid := 'a4fdea5ea5ed'O
}
}
 
/**
* @desc Dummy template for GN_Address
*/
template (value) GN_Address m_dummyGnAddrIut := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationCountryCode := 33,
mid := 'a4fedecabeef'O
}
template (value) GN_Address m_dummyGnAddrIutSopvSepv := {
typeOfAddress := e_initial,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_bike
}
},
stationSubType := e_public,
stationCountryCode := 0,
mid := '000000000001'O
}
 
/**
* @desc Dummy template for long position vector
*/
template (value) LongPosVector m_dummyLongPosVectorIut := {
gnAddr := m_dummyGnAddrIut,
timestamp := 123456,
latitude := 4856,
longitude := 675,
speed := 55,
heading := 9876,
altitude := 526,
timeAccuracy := 6,
posAccuracy := 2,
speedAccuracy := 2,
headingAccuracy := 2,
altitudeAccuracy := 0
}
template (value) LongPosVector m_dummyLongPosVectorIutSopvSepv := {
gnAddr := m_dummyGnAddrIutSopvSepv,
timestamp := 3794543552,
latitude := 490666666,
longitude := 81166666,
speed := 0,
heading := 0,
altitude := 0,
timeAccuracy := 0,
posAccuracy := 0,
speedAccuracy := 0,
headingAccuracy := 0,
altitudeAccuracy := 0
}
 
 
template (value) GN_Address m_dummyGnAddrNodeA := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_bus
}
},
stationSubType := e_private,
stationCountryCode := 49,
mid := 'a4fdea5ea5ed'O
}
 
template (value) GN_Address m_dummyGnAddrNodeB := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationCountryCode := 50,
mid := 'a40102030405'O
}
 
template (value) GN_Address m_dummyGnAddrNodeC := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_car
}
},
stationSubType := e_private,
stationCountryCode := 42,
mid := 'deadbabebeef'O
}
 
template (value) LongPosVector m_dummyLongPosVectorNodeA := {
gnAddr := m_dummyGnAddrNodeA,
timestamp := 875,
latitude := 265,
longitude := 789,
speed := 80,
heading := 548,
altitude := 12,
timeAccuracy := 5,
posAccuracy := 1,
speedAccuracy := 3,
headingAccuracy := 1,
altitudeAccuracy := 2
}
 
template (value) LongPosVector m_dummyLongPosVectorNodeB := {
gnAddr := m_dummyGnAddrNodeB,
timestamp := 4585,
latitude := 126,
longitude := 123,
speed := 45,
heading := 125,
altitude := 25,
timeAccuracy := 4,
posAccuracy := 2,
speedAccuracy := 0,
headingAccuracy := 2,
altitudeAccuracy := 1
}
 
template (value) LongPosVector m_dummyLongPosVectorNodeC := {
gnAddr := m_dummyGnAddrNodeC,
timestamp := 23644,
latitude := 23754,
longitude := 49645,
speed := 110,
heading := 23,
altitude := 18,
timeAccuracy := 3,
posAccuracy := 1,
speedAccuracy := 2,
headingAccuracy := 1,
altitudeAccuracy := 1
}
 
template (value) Area m_dummyArea1 := {
geoAreaPosLatitude := 298376,
geoAreaPosLongitude := 32745,
distanceA := 1234,
distanceB := 5678,
angle := 9123
}
 
template (value) Area m_dummyArea2 := {
geoAreaPosLatitude := 873548,
geoAreaPosLongitude := 2837,
distanceA := 8765,
distanceB := 4321,
angle := 4567
}
 
template (value) GeoBroadcastArea m_dummyGeoBroadcastArea1 := {
geoBroadcastSubType := e_geoBroadcastRect,
geoBroadcastArea := m_dummyArea1
}
 
template (value) GeoBroadcastArea m_dummyGeoBroadcastArea2 := {
geoBroadcastSubType := e_geoBroadcastElip,
geoBroadcastArea := m_dummyArea2
}
 
template (value) GeoAnycastArea m_dummyGeoAnycastArea1 := {
geoAnycastSubType := e_geoAnycastCircle,
geoAnycastArea := m_dummyArea1
}
 
template (value) GeoAnycastArea m_dummyGeoAnycastArea2 := {
geoAnycastSubType := e_geoAnycastRect,
geoAnycastArea := m_dummyArea2
}
 
template (value) AcGnPrimitive m_startBeaconingRoadSide := {
startBeaconing := {
beaconHeader := {
commonHeader := {
version := 0,
nextHeader := e_any,
headerTST := {
beaconHdr := {
headerType := e_beacon,
headerSubType := 0
}
},
reserved := 0,
flags := '00000000'B,
plLength := 0,
trafficClass := {
reserved := 0,
relevance := 0,
reliability := e_veryHigh,
latency := e_veryLow
},
hopLimit := 10,
senderPosVector := {
gnAddr := {
typeOfAddress := e_initial,
stationType := {
roadsideStation := {
stationType := e_roadsideStation,
rsKind := e_ordinary
}
},
stationSubType := e_private,
stationCountryCode := 0,
mid := 'DEADBEEF0003'O
},
timestamp := 0,
latitude := 399990000,
longitude := 100000000,
speed := 1000,
heading := 0,
altitude := 20,
timeAccuracy := 0,
posAccuracy := 0,
speedAccuracy := 0,
headingAccuracy := 0,
altitudeAccuracy := 0
}
}
}
template (value) GN_Address m_dummyGnAddrNodeB := {
typeOfAddress := e_manual,
stationType := e_specialVehicle,
stationCountryCode := 50,
mid := 'a40102030405'O
}
}
template (value) AcGnPrimitive m_startBeaconingRoadSide_NEC := {
startBeaconing := {
beaconHeader := {
commonHeader := {
version := 1,
nextHeader := e_any,
headerTST := {
beaconHdr := {
headerType := e_beacon,
headerSubType := 0
}
},
reserved := 0,
flags := '00000000'B,
plLength := 0,
trafficClass := {
reserved := 0,
relevance := 0,
reliability := e_veryHigh,
latency := e_veryLow
},
hopLimit := 10,
senderPosVector := {
gnAddr := {
typeOfAddress := e_initial,
stationType := {
roadsideStation := {
stationType := e_roadsideStation,
rsKind := e_ordinary
}
},
stationSubType := e_private,
stationCountryCode := 0,
mid := 'DEADBEEF0002'O
},
timestamp := 3373012264,
latitude := 20000,
longitude := 0,
speed := 0,
heading := 0,
altitude := 0,
timeAccuracy := 0,
posAccuracy := 0,
speedAccuracy := 0,
headingAccuracy := 0,
altitudeAccuracy := 0
}
}
}
template (value) GN_Address m_dummyGnAddrNodeC := {
typeOfAddress := e_manual,
stationType := e_moped,
stationCountryCode := 42,
mid := 'deadbabebeef'O
}
}
template (value) AcGnPrimitive m_startBeaconingRoadSide_NEC_1 := {
startBeaconing := {
beaconHeader := {
commonHeader := {
version := 1,
nextHeader := e_any,
headerTST := {
beaconHdr := {
headerType := e_beacon,
headerSubType := 0
}
},
reserved := 0,
flags := '00000000'B,
plLength := 0,
trafficClass := {
reserved := 0,
relevance := 0,
reliability := e_veryHigh,
latency := e_veryLow
},
hopLimit := 10,
senderPosVector := {
gnAddr := {
typeOfAddress := e_initial,
stationType := {
roadsideStation := {
stationType := e_roadsideStation,
rsKind := e_ordinary
}
},
stationSubType := e_private,
stationCountryCode := 0,
mid := 'DEADBEEF0003'O
},
timestamp := 3374720650,
latitude := -10000,
longitude := 0,
speed := 0,
heading := 0,
altitude := 0,
timeAccuracy := 0,
posAccuracy := 0,
speedAccuracy := 0,
headingAccuracy := 0,
altitudeAccuracy := 0
}
}
}
template (value) LongPosVector m_dummyLongPosVectorNodeA := {
gnAddr := m_dummyGnAddrNodeA,
timestamp := 875,
latitude := 265,
longitude := 789,
pai := '0'B,
speed := 80,
heading := 548
}
}
/**
* @desc Send template for GeoUnicast header
* @param p_sourceLongPosVec Long position vector of source
* @param p_destinationLongPosVec Long position vector of destination
* @param p_senderLongPosVec Long position vector of sender
* @param p_seqNumber Sequence number of GeoUnicast packet
*/
template (value) Header m_geoUnicastHeaderBtp(
in template (value) LongPosVector p_sourceLongPosVec,
in template (value) ShortPosVector p_destinationLongPosVec,
in template (value) LongPosVector p_senderLongPosVec,
in template (value) UInt16 p_seqNumber
) := {
geoUnicastHeader := {
commonHeader := m_commonHeader(
e_btpA,
m_geoUnicastHeaderType,
m_trafficClass,
c_defaultHopLimit,
p_senderLongPosVec
),
seqNumber := p_seqNumber,
lifetime := m_defaultLifetime,
reserved := c_uInt8Zero,
srcPosVector := p_sourceLongPosVec,
dstPosVector := p_destinationLongPosVec
template (value) LongPosVector m_dummyLongPosVectorNodeB := {
gnAddr := m_dummyGnAddrNodeB,
timestamp := 4585,
latitude := 126,
longitude := 123,
pai := '0'B,
speed := 45,
heading := 125
}
}
/**
* @desc Receive template for Beacon common header
* @param p_trafficClass Packet's traffic class
* @param p_hopLimit Maximum number of hops
* @param p_senderLongPosVec Long position vector of sender
*/
template CommonHeader mw_commonHeaderBeacon_NEC (
in template (present) TrafficClass p_trafficClass,
in template (present) UInt8 p_hopLimit,
in template (present) LongPosVector p_senderLongPosVec
) := {
version := 1,
nextHeader := e_any,
headerTST := {
beaconHdr := {
headerType := e_beacon,
headerSubType := 0
}
},
reserved := c_uInt8Zero,
flags := c_8ZeroBits,
plLength := 0,
trafficClass := p_trafficClass,
hopLimit := p_hopLimit,
senderPosVector := p_senderLongPosVec
}
/**
* @desc Receive template for Beacon header
* @param p_trafficClass Packet's traffic class
* @param p_hopLimit Maximum number of hops
* @param p_senderLongPosVec Long position vector of sender
*/
template Header mw_beaconHeader_NEC (
in template (present) TrafficClass p_trafficClass,
in template (present) UInt8 p_hopLimit,
in template (present) LongPosVector p_senderLongPosVec
) := {
beaconHeader := {
commonHeader := mw_commonHeaderBeacon_NEC(
p_trafficClass,
p_hopLimit,
p_senderLongPosVec
)
template (value) LongPosVector m_dummyLongPosVectorNodeC := {
gnAddr := m_dummyGnAddrNodeC,
timestamp := 23644,
latitude := 23754,
longitude := 49645,
pai := '0'B,
speed := 110,
heading := 23
}
}
/**
* @desc Send template for GeoNetworking PDU with payload
* @param p_header Header value of GeoNetworking message
* @param p_payload Payload
* @param p_rawPayload Raw payload
* @see m_geoNwPdu
*/
template (value) GeoNetworkingPacket m_geoNwPduWithPayload_ipv6(
in template (value) Header p_header,
in template (value) Ipv6Packet p_ipv6Packet,
in template (value) octetstring p_rawPayload
) modifies m_geoNwPdu := {
payload := {
decodedPayload := {
ipv6Packet := p_ipv6Packet
}, // End of 'decodedPayload' field
rawPayload := p_rawPayload
} // End of 'payload' field
}
/**
* @desc Send template for GeoNetworking PDU with payload
* @param p_header Header value of GeoNetworking message
* @param p_payload Payload
* @param p_rawPayload Raw payload
* @see m_geoNwPdu
*/
template GeoNetworkingPacket mw_geoNwPduWithPayload_ipv6(
in template (present) Header p_header,
in template (present) Ipv6Packet p_ipv6Packet,
in template (present) octetstring p_rawPayload
) modifies mw_geoNwPdu := {
payload := {
decodedPayload := {
ipv6Packet := p_ipv6Packet
}, // End of 'decodedPayload' field
rawPayload := p_rawPayload
} // End of 'payload' field
}
} // End of group LibItsGeoNetworking_DummyTemplates
 
group LibItsGeoNetworking_testCases {
 
group testAcPrimitives {
 
/**
*
* @desc validate StartBeaconing primitive
* @verdict Pass on success, Fail otherwise
*/
testcase tc_startBeaconing() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startBeaconing(
m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader),
true,
oct2bit('010027050024001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e6248'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) Area m_dummyArea1 := {
geoAreaPosLatitude := 298376,
geoAreaPosLongitude := 32745,
distanceA := 1234,
distanceB := 5678,
angle := 9123
}
 
/**
*
* @desc validate StartBeaconing primitive for roadside equipment
* @verdict Pass on success, Fail otherwise
*/
testcase tc_startBeaconingRoadside() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startBeaconingRoadSide,
true,
oct2bit('010027050024001000000000000a4c00deadbeef00030000000017d75cf005f5e10003e8000000140000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) Area m_dummyArea2 := {
geoAreaPosLatitude := 873548,
geoAreaPosLongitude := 2837,
distanceA := 8765,
distanceB := 4321,
angle := 4567
}
testcase tc_startBeaconingRoadside_NEC() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startBeaconingRoadSide_NEC,
true,
oct2bit('010027050024101000000000000a4c00deadbeef0002c90c152800004e20000000000000000000000000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) GeoBroadcastArea m_dummyGeoBroadcastArea1 := {
geoBroadcastSubType := e_geoBroadcastRect,
geoBroadcastArea := m_dummyArea1
}
testcase tc_startBeaconingRoadside_NEC_1() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startBeaconingRoadSide_NEC_1,
true,
oct2bit('010027050024101000000000000a4c00deadbeef0003c926268affffd8f0000000000000000000000000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) GeoBroadcastArea m_dummyGeoBroadcastArea2 := {
geoBroadcastSubType := e_geoBroadcastElip,
geoBroadcastArea := m_dummyArea2
}
 
/**
* @desc validate StartPassBeaconing primitive
* @verdict Pass on success, Fail otherwise
*/
testcase tc_startPassBeaconing() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startPassBeaconing(
m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader),
true,
oct2bit('010027070024001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e6248'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) GeoAnycastArea m_dummyGeoAnycastArea1 := {
geoAnycastSubType := e_geoAnycastCircle,
geoAnycastArea := m_dummyArea1
}
 
template (value) GeoAnycastArea m_dummyGeoAnycastArea2 := {
geoAnycastSubType := e_geoAnycastRect,
geoAnycastArea := m_dummyArea2
}
/**
* @desc validate StartBeaconingMultipleNeighbour primitive
* @verdict Pass on success, Fail otherwise
* @desc Send template for GeoUnicast header
* @param p_sourceLongPosVec Long position vector of source
* @param p_destinationLongPosVec Long position vector of destination
* @param p_senderLongPosVec Long position vector of sender
* @param p_seqNumber Sequence number of GeoUnicast packet
*/
testcase tc_startBeaconingMultipleNeighbour() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
m_startBeaconingMultipleNeighbour(
m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader,
3),
true,
oct2bit('01002b090028001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e624800000003'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
template (value) ExtendedHeader m_geoUnicastHeaderBtp(
in template (value) LongPosVector p_sourceLongPosVec,
in template (value) ShortPosVector p_dstPosVector,
in template (value) UInt16 p_seqNumber
) := {
geoUnicastHeader := {
seqNumber := p_seqNumber,
reserved := c_uInt8Zero,
srcPosVector := p_sourceLongPosVec,
dstPosVector := p_dstPosVector
}
}
} // End of group LibItsGeoNetworking_DummyTemplates
group camTemplates {
template (value) CAM m_camMsg(
StationID p_stationId,
GenerationDeltaTime p_generationTime
) := {
header := {
protocolVersion := 1,
messageID := 2,
stationID := p_stationId
},
cam := {
generationDeltaTime := p_generationTime,
camParameters := {
basicContainer := {
stationType := c_stationType_passengerCar,
referencePosition := {
latitude := f_integer2Latitude(f_getTsLatitude()),
longitude := f_integer2Longitude(f_getTsLongitude()),
positionConfidenceEllipse := {
semiMajorConfidence := c_semiAxisLengthOneCentimeter,
semiMinorConfidence := c_semiAxisLengthOneCentimeter,
semiMajorOrientation := c_headingValue_wgs84North
},
altitude := {
altitudeValue := c_altitudeValue_seaLevel,
altitudeConfidence := unavailable
}
}
},
highFrequencyContainer := {
basicVehicleContainerHighFrequency := {
heading := {
headingValue := c_headingValue_wgs84North, //0
headingConfidence := 10
},
speed := {
speedValue := 45,
speedConfidence := 5
},
driveDirection := forward,
vehicleLength := {
vehicleLengthValue := 50,
vehicleLengthConfidenceIndication := noTrailerPresent
},
vehicleWidth := 21,
longitudinalAcceleration := {
longitudinalAccelerationValue := c_longitudinalAccelerationValue_unavailable,
longitudinalAccelerationConfidence := c_accelerationConfidence_unavailable
},
curvature := {
curvatureValue := c_curvatureValue_straight,
curvatureConfidence := unavailable
},
curvatureCalculationMode := yawRateUsed,
yawRate := {
yawRateValue := c_yawRateValue_straight,
yawRateConfidence := unavailable
},
accelerationControl := omit,
lanePosition := omit,
steeringWheelAngle := omit,
lateralAcceleration := omit,
verticalAcceleration := omit,
performanceClass := omit,
cenDsrcTollingZone := omit
}
},
lowFrequencyContainer := omit,
specialVehicleContainer := omit
}
}
};
} // End of group camTemplates
group securityTemplates {
template (value) Oct32 m_devicePrivateKey := '3aa27835bfe11dc6711b7c471fd3994b3ee94bcf59bcb0cade6abffe7c2f6530'O;
template (value) Certificate m_deviceCertificate := {
version := 2,
signer_info := m_signerInfo_digest('0727A031EE3F372C'O),
subject_info := m_subject_info_authorization_ticket,
subject_attributes := {
m_subject_attribute_verification_key(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'cd2904aee519278f5c1d0c89810d2b846b7796ba244944d2a15fa5665bc2d1c2'O,
'ec0dd4f97c194c7c3e92b7e9af4c25b43b1c8de9bba8261c2b8454ec51b42e8e'O
)
)
),
m_subject_attribute_encryption_key(
m_publicKey_aesccm(
m_aesccm(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'ad4334139b7659360d46b423e01971aae009bd15a77c9144e67312ff7c6f7d93'O,
'01068089afad1f25941e2e1ab230eebf8bf022dadd201e64311d62868d2a3ec0'O
)
)
)
),
m_subject_attribute_assurance_level(
m_subjectAssurance(
'001'B,
'00'B
)
),
m_subject_attribute_its_aid_list(
{
16512,
16513
}
)
},
validity_restrictions := {
m_validity_restriction_time_start_and_end(
1405173485,
1513691885
)
},
signature_ := m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
'54c524c932ac1d7fb2cf3c7e5a6f9d0e46092d84eab0fa7240c47b202eb1566d'O
),
'98f54758fb46e4f3254aedfa59dda07c1e49f19b2dee2ab6922a7526d32f9842'O
)
)
} // End of template m_deviceCertificate
} // End of group securityTemplates
group testAcPrimitives {
 
// /**
// *
// * @desc validate StartBeaconing primitive
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_startBeaconing() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startBeaconing(
// m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader),
// true,
// oct2bit('010027050024001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e6248'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
//
// /**
// *
// * @desc validate StartBeaconing primitive for roadside equipment
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_startBeaconingRoadside() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startBeaconingRoadSide,
// true,
// oct2bit('010027050024001000000000000a4c00deadbeef00030000000017d75cf005f5e10003e8000000140000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
// testcase tc_startBeaconingRoadside_NEC() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startBeaconingRoadSide_NEC,
// true,
// oct2bit('010027050024101000000000000a4c00deadbeef0002c90c152800004e20000000000000000000000000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
// testcase tc_startBeaconingRoadside_NEC_1() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startBeaconingRoadSide_NEC_1,
// true,
// oct2bit('010027050024101000000000000a4c00deadbeef0003c926268affffd8f0000000000000000000000000'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
//
// /**
// * @desc validate StartPassBeaconing primitive
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_startPassBeaconing() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startPassBeaconing(
// m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader),
// true,
// oct2bit('010027070024001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e6248'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
//
// /**
// * @desc validate StartBeaconingMultipleNeighbour primitive
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_startBeaconingMultipleNeighbour() runs on TCType system TCType {
// test_PDU<AcGnPrimitive>(
// m_startBeaconingMultipleNeighbour(
// m_beaconHeader(m_dummyLongPosVectorIut).beaconHeader,
// 3),
// true,
// oct2bit('01002b090028001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e624800000003'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
//
/**
* @desc validate StopBeaconing primitive
* @verdict Pass on success, Fail otherwise
*/
testcase tc_stopBeaconing() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(m_stopBeaconing, true, oct2bit('010003060000'O));
test_PDU<AcGnPrimitive>(m_stopBeaconing, true, oct2bit('0001'O));
}
 
/**
597,7 → 407,7
* @verdict Pass on success, Fail otherwise
*/
testcase tc_stopPassBeaconing() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(m_stopPassBeaconing, true, oct2bit('010003080000'O));
test_PDU<AcGnPrimitive>(m_stopPassBeaconing, true, oct2bit('0003'O));
}
 
/**
605,7 → 415,7
* @verdict Pass on success, Fail otherwise
*/
testcase tc_stopBeaconingMultipleNeighbour() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(m_stopBeaconingMultipleNeighbour, true, oct2bit('0100030a0000'O));
test_PDU<AcGnPrimitive>(m_stopBeaconingMultipleNeighbour, true, oct2bit('0005'O));
}
 
/**
613,36 → 423,229
* @verdict Pass on success, Fail otherwise
*/
testcase tc_getLongPosVector() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(m_getLongPosVector(m_dummyGnAddrIut), true, oct2bit('01000b0b00089421a4fedecabeef'O)); // Check log for TC_GEONW_FDV_COH_BV_01 TC to retrieve the frame
test_PDU<AcGnPrimitive>(m_getLongPosVector(m_dummyGnAddrIut), true, oct2bit('0006BC21A4FEDECABEEF'O)); // Check log for TC_GEONW_FDV_COH_BV_01 TC to retrieve the frame
}
 
// /**
// * @desc validate AcGnResponse
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_longPosVector() runs on TCType system TCType {
// test_decodePDU<AcGnResponse>(mw_getLongPosVectorAny(m_dummyGnAddrIut), '0300270c00249421a4fedecabeef000030aa000030aa000030aa000030aa000030aa000030aa000030aa'O); // Check log for TC_GEONW_FDV_COH_BV_01 TC to retrieve the frame
// }
//
// /**
// * @desc validate AcGnResponse with a NULL LongPosVector
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_longPosVectorWithNullLongPosVector() runs on TCType system TCType {
// test_decodePDU<AcGnResponse>(mw_getLongPosVectorAny(m_dummyGnAddrIut), '03000b0c00088400000000000001FFFFFFFFFFFF'O); // Check log for TC_GEONW_PON_LPV_BV_01 TC to retrieve the frame
// }
//
/**
* @desc validate AcGnResponse
* @desc validate AcEnableSecurity
* @verdict Pass on success, Fail otherwise
*/
testcase tc_longPosVector() runs on TCType system TCType {
test_decodePDU<AcGnResponse>(mw_getLongPosVectorAny(m_dummyGnAddrIut), '0300270c00249421a4fedecabeef000030aa000030aa000030aa000030aa000030aa000030aa000030aa'O); // Check log for TC_GEONW_FDV_COH_BV_01 TC to retrieve the frame
testcase tc_enableSecurity() runs on TCType system TCType {
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessageDigest;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessageCertificate;
if (f_loadCertificates("dummy") == true) {
setverdict(fail);
stop;
}
// Setup certificates memory cache
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build the beacon template
v_toBeSignedSecuredMessageDigest := f_buildSecuredMessagePayloadToBeSigned();
v_toBeSignedSecuredMessageCertificate := f_buildSecuredMessagePayloadToBeSigned(true);
test_PDU<AcGnPrimitive>(
AcGnPrimitive:{ acEnableSecurity := m_enableSecurity(
"TA_CERT_A"
) },
false
);
}
 
/**
* @desc validate AcGnResponse with a NULL LongPosVector
* @desc validate AcDisableSecurity
* @verdict Pass on success, Fail otherwise
*/
testcase tc_longPosVectorWithNullLongPosVector() runs on TCType system TCType {
test_decodePDU<AcGnResponse>(mw_getLongPosVectorAny(m_dummyGnAddrIut), '03000b0c00088400000000000001FFFFFFFFFFFF'O); // Check log for TC_GEONW_PON_LPV_BV_01 TC to retrieve the frame
testcase tc_disableSecurity() runs on TCType system TCType {
test_PDU<AcGnPrimitive>(
AcGnPrimitive:{ acDisableSecurity := m_disableSecurity },
false
);
}
 
} // End of group testAcPrimitives
group testDeviceSigning {
/**
* @desc This function build and sign the SecureMessage part covered by the signature process
* @param p_securedMessage The signed SecureMessage part
* @param p_unsecuredPayload The unsigned payload (e.g. a beacon)
* @param p_threeDLocation The ThreeDLocation value
* @param p_headerFileds Additional HeaderFields
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_buildGnSecuredOtherMessageWithDeviceCertificate(
out template (value) SecuredMessage p_securedMessage,
in octetstring p_signedPayload,
in ThreeDLocation p_threeDLocation,
in template (value) Certificate p_deviceCertificate,
in Oct32 p_devicePrivateKey,
in template (omit) HeaderFields p_hearderFields := omit
) return boolean {
// Local variables
var octetstring v_secPayload, v_signature;
var Oct32 v_hash;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
// log("f_buildGnSecuredOtherMessageWithDeviceCertificate: p_unsecuredPayload: ", p_unsecuredPayload);
// Create SecuredMessage payload to be signed
v_toBeSignedSecuredMessage := m_toBeSignedSecuredMessage(
{ // Field HeaderFields
m_header_field_signer_info(
m_signerInfo_certificate(
p_deviceCertificate
) // End of template m_signerInfo_certificate
), // End of template m_header_field_signer_info
m_header_field_generation_time(1000 * f_getCurrentTime()), // In us
m_header_field_generation_location(
p_threeDLocation
)
}, // End of field HeaderFields
m_payload_signed(
p_signedPayload
),
e_signature
);
v_secPayload := bit2oct(encvalue(v_toBeSignedSecuredMessage));
// log("f_buildGnSecuredOtherMessageWithDeviceCertificate:ithDeviceCertificate v_toBeSignedSecuredMessage: ", v_secPayload);
// Calculate the hash of the SecuredMessage payload to be signed
v_hash := f_hashWithSha256(v_secPayload);
// log("f_buildGnSecuredOtherMessageWithDeviceCertificate: v_hash: ", v_hash);
// Signed payload
v_signature := fx_signWithEcdsaNistp256WithSha256(
v_hash,
p_devicePrivateKey
);
// log("f_buildGnSecuredOtherMessageWithDeviceCertificate: v_signature: ", v_signature);
p_securedMessage := m_securedMessage( // See Clause 7.3 Generic security profile for other signed messages
v_toBeSignedSecuredMessage.header_fields,
v_toBeSignedSecuredMessage.payload_field,
{
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_y_coordinate_only(
substr(v_signature, 2, 32)
),
substr(v_signature, 34, 32)
)
)
)
}
); // End of template md_securedMessage_profileOther
return true;
} // End of function f_buildGnSecuredOtherMessageWithDeviceCertificate
testcase tc_checkDeviceSignature() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwBeaconPacket( // Non secured GN beacon
m_dummyLongPosVectorIut
)
)
);
f_buildGnSecuredOtherMessageWithDeviceCertificate(
v_securedMessageBeacon,
v_gnPayload,
m_threeDLocation(
1234,
5678,
'002F'O
),
m_deviceCertificate,
m_devicePrivateKey
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwBeaconPacket(
m_dummyLongPosVectorIut
),
v_securedMessageBeacon
) // End of template m_geoNwBeaconPacket
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
log("Secured beacon: ", v_encMsg);
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_securedMessageBeacon, m_deviceCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
} // End of group testSecurityFunctions
group testGeoNetPrimitiveMessages {
 
/**
* @desc validate GeoNetworkingReq/Beacon
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Beacon() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d003c27003300100000000f000a9421a4fedecabeef0001e240000012f8000002a300372694020e624844454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A0010800000000100BC21A4FEDECABEEF0001E240000012F8000002A380372694FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
649,383 → 652,1411
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwBeaconPacket(
m_dummyLongPosVectorIut
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_beaconHeader(
m_dummyLongPosVectorIut
))),
false,
oct2bit(v_buffer));
v_header := m_beaconHeader(
m_dummyLongPosVectorIut
v_gnReq,
true,
oct2bit(v_buffer)
);
v_header.beaconHeader.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
}
/**
* @desc validate secured GeoNetworkingReq/Beacon with certificate digest in header fields
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredBeacon_digest() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwBeaconPacket( // Non secured GN beacon
m_dummyLongPosVectorIut
)
),
v_buffer
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwBeaconPacket(
m_dummyLongPosVectorIut
),
v_securedMessageBeacon
) // End of template m_geoNwBeaconPacket
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
log("Secured beacon: ", v_encMsg);
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Beacon from Hitachi GeoN daemon
* @desc validate secured GeoNetworkingReq/Beacon with certificate in header fields
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Beacon_Hitachi() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader(?, ?, ?)), 'ffffffffffff'O),
'4c002d270024001000000000000a9421a4fedecabeef0001e240000012f8000002a300372694020e6248ffffffffffff'O
testcase tc_GeoNetReq_SecuredBeacon_certificate() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwBeaconPacket( // Non secured GN beacon
m_dummyLongPosVectorIut
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwBeaconPacket(
m_dummyLongPosVectorIut
),
v_securedMessageBeacon
) // End of template m_geoNwBeaconPacket
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
log("Secured beacon: ", v_encMsg);
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
/**
* @desc validate GeoNetworkingReq/Beacon from NEC GeoN daemon
* @desc validate secured GeoNetworkingReq/Beacon
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Beacon_NEC() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader_NEC(?, ?, ?)), 'ffffffffffff'O),
'4c002d270024101000000000000100000000000000013d4d060500000000000000000000000000000000FFFFFFFFFFFF'O
testcase tc_GeoNetReq_SecuredBeacon_WithAdditionalHeaders() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
log("vc_signingPrivateKey=", vc_signingPrivateKey);
log("vc_encryptPrivateKey=", vc_encryptPrivateKey);
log("vc_aaCertificate=", vc_aaCertificate);
log("vc_atCertificate=", vc_atCertificate);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwBeaconPacket( // Non secured GN beacon
m_dummyLongPosVectorIut
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
),
{
{
type_ := e_request_unrecognized_certificate,
headerField := {
digests := { '00CAFE'O }
}
}
}
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwBeaconPacket(
m_dummyLongPosVectorIut
),
v_securedMessageBeacon
) // End of template m_geoNwBeaconPacket
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
log("Secured beacon: ", v_encMsg);
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
/**
* @desc validate GeoNetworkingReq/Anycast
* @desc validate secured digest GeoNetworkingReq/LsRequest
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Anycast() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006c27006300300000000f000a9432a40102030405000011e90000007e0000007b002d007d001942091de62b009432a40102030405000011e90000007e0000007b002d007d0019420900048d8800007fe904d2162e23a3000044454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_LsRequestPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A0060800000000A0030390000BC21A4FEDECABEEF0001E240000012F8000002A380372694BC21A4FEDECABEEFFFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwLsRequestPacket(
m_dummyLongPosVectorIut,
12345,
m_dummyGnAddrIut
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoAnycastHeader(
m_dummyLongPosVectorNodeB,
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_geoAnycastHeader(
m_dummyLongPosVectorNodeB,
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1);
v_header.geoAnycastHeader.commonHeader.plLength := 15;
oct2bit(v_buffer)
);
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
/**
* @desc validate GeoNetworkingReq/Anycast with hop limit
* @desc validate secured digest GeoNetworkingReq/LsRequest
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Anycast_With_HopLimit() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006c27006300310000000f0005942adeadbabebeef00005c5c00005cca0000c1ed006e001700123145029a2b00a431a4fdea5ea5ed0000036b000001090000031500500224000c5166000d544c00000b15223d10e111d7000044454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredDigestLsRequestPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwLsRequestPacket(
m_dummyLongPosVectorIut,
12345,
m_dummyGnAddrIut
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwLsRequestPacket(
m_dummyLongPosVectorIut,
12345,
m_dummyGnAddrIut
), // End of template m_geoNwLsRequestPacket
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("Secured beacon: ", v_encMsg);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/LsReply
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_LsReplyPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A0061800000000A0030390000BC21A4FEDECABEEF0001E240000012F8000002A3803726948431A4FDEA5EA5ED0000036B0000010900000315FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwLsReplyPacket(
m_dummyLongPosVectorIut,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorNodeA),
12345
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoAnycastHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeC,
666,
m_dummyGeoAnycastArea2,
c_defaultHopLimit / 2))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_geoAnycastHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeC,
666,
m_dummyGeoAnycastArea2,
c_defaultHopLimit / 2);
v_header.geoAnycastHeader.commonHeader.plLength := 15;
oct2bit(v_buffer)
);
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
 
/**
* @desc validate GeoNetworkingReq/Unicast
* @desc validate secured GeoNetworkingReq/LsReply
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Unicast() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d007027006700200000000f000a942adeadbabebeef00005c5c00005cca0000c1ed006e00170012314506162b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef0001e240000012f8000002a344454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredLsReplyPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// test_PDU<GeoNetworkingReq>(
// m_geoNwReq_linkLayerBroadcast(
// m_geoNwPdu(
// m_geoUnicastHeader(
// m_dummyLongPosVectorNodeA,
// f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
// m_dummyLongPosVectorNodeC,
// 1558))),
// false,
// oct2bit(v_buffer));
v_header := m_geoUnicastHeader(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
1558);
v_header.geoUnicastHeader.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwLsReplyPacket(
m_dummyLongPosVectorIut,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorNodeA),
12345
)
),
v_buffer
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwLsReplyPacket(
m_dummyLongPosVectorIut,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorNodeA),
12345
), // End of template m_geoNwLsReplyPacket
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("Secured beacon: ", v_encMsg);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Unicast with hop limit
* @desc validate GeoNetworkingReq/NwShb
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Unicast_With_HopLimit() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d007027006700200000000f0001942adeadbabebeef00005c5c00005cca0000c1ed006e001700123145029a2b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef0001e240000012f8000002a344454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_NwShbPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A00508000000F0A00BC21A4FEDECABEEF0001E240000012F8000002A3803726940000000044454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwShbPacket(
m_dummyLongPosVectorIut
)));
test_PDU<GeoNetworkingReq>(
v_gnReq,
false
);
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_buffer
);
}
/**
* @desc validate GeoNetworkingReq/NwShb with a CAM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_NwShbPacketWithBtpPayloadCam() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A10508000002E0A00BC21A4FEDECABEEF0001E240000012F8000002A380372694000000000000000001020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF80FFFFFFFFFFFF'O;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwShbPacket(
m_dummyLongPosVectorIut
)));
v_gnReq.msgOut.gnPacket.packet.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
)
);
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoUnicastHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
666,
1))),
false,
oct2bit(v_buffer));
v_header := m_geoUnicastHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
666,
1);
v_header.geoUnicastHeader.commonHeader.plLength := 15;
v_gnReq,
false
);
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 46;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
/**
* @desc validate GeoNetworkingReq/Unicast with payload
* @desc validate GeoNetworkingReq/NwShb with a DENM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Unicast_With_BtpPayload() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006827005f012000000007000a942adeadbabebeef00005c5c00005cca0000c1ed006e00170012314506162b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef0001e240000012f8000002a35041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_NwShbPacketWithBtpPayloadDenm() runs on TCType system TCType {
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A2050800000380A00BC21A4FEDECABEEF0001E240000012F8000002A380372694000000000000000001010001B207C0000D903800000000006072000000188593E91B2B9BDF918C000400400061A80000B6000037FFFDFFFF63390100FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_btpA) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA");
if (PX_GN_UPPER_LAYER != e_btpB) {
log("PX_GN_UPPER_LAYER shall be set to e_btpB");
setverdict(inconc);
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwShbPacket(
m_dummyLongPosVectorIut
)));
v_gnReq.msgOut.gnPacket.packet.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
)
)
)
)
);
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload(
m_geoUnicastHeaderBtp(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
1558
),
{
decodedPayload := omit,
rawPayload := char2oct("PAYLOAD")
} // End of 'payload' field
v_gnReq,
false
);
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 56;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_buffer
);
}
/**
* @desc validate secured GeoNetworkingReq/NwShb
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredNwShbPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwShbPacket(
m_dummyLongPosVectorIut
)
),
false,
oct2bit(v_buffer));
v_header := m_geoUnicastHeaderBtp(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
1558);
v_header.geoUnicastHeader.commonHeader.plLength := 7;
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwShbPacket(
m_dummyLongPosVectorIut
), // End of template m_geoNwLsReplyPacket
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload(
v_header,
{
decodedPayload := {
btpPacket := m_btpA_With_Payload(
20545,
22860,
omit,
'4F4144'O
)
},
rawPayload := char2oct("PAYLOAD")
} // End of 'payload' field
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate secured with digest GeoNetworkingReq/NwShb with a CAM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredDigestNwShbPacketWithBtpPayloadCam() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
),
v_buffer
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload)
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 46;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
testcase tc_GeoNetReq_Unicast_With_BtpAWithPayload() runs on TCType system TCType {
if (PX_GN_UPPER_LAYER != e_btpA) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA");
/**
* @desc validate secured with digest GeoNetworkingReq/NwShb with a CAM payload and one additional header field
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredDigestNwShbPacketWithBtpPayloadCam_withMoreHeaders_1() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduWithPayload(
mw_geoUnicastHeader(?, ?, ?),
{
decodedPayload := {
btpPacket := mw_btpA_With_Payload(
3751,
3751,
omit,
'0EA70EA75041594C4F41445F31'O
)
},
rawPayload := '0EA70EA70EA70EA75041594C4F41445F31'O
} // End of 'payload' field
),
'deadbeef0000'O),
'4c007227006f01200000001104004c00001e4f40d37e0000000017d7840005f5e10003e80000001400000002ee004c00001e4f40d37e0000000017d7840005f5e10003e80000001400001400deadbeef00013837b5f317d7f93005f5e1000ea70ea70ea70ea75041594c4f41445f31deadbeef0000'O);
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
{
m_header_field_unrecognised_certificate(
f_HashedId3FromHashedId8(
vc_aaCertificate.signer_info.signerInfo.digest
)
)
}
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 45;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
/**
* @desc validate GeoNetworkingReq/Unicast with IPv6 header
* @desc validate secured with digest GeoNetworkingReq/NwShb with a CAM payload and two additional header field
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Unicast_With_IPv6Header() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var Header v_header := null;
var octetstring v_buffer := '4d00b12700a8032000000050000a942adeadbabebeef00005c5c00005cca0000c1ed006e00170012314506162b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef0001e240000012f8000002a360000000002806ff2001061804000000000000005199cc70200106180001800000000000000000058c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredDigestNwShbPacketWithBtpPayloadCam_withMoreHeaders_2() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload_ipv6(
m_geoUnicastHeader(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
1558),
m_ipv6Packet( // payload length = 40
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
),
''O
)
),
false,
oct2bit(v_buffer));
v_ipv6Packet := m_ipv6Packet( // payload length = 40
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
);
v_ipv6Packet.ipv6Hdr.payloadLength := 40;
v_header := m_geoUnicastHeader(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeC,
1558);
v_header.geoUnicastHeader.commonHeader.plLength := 80;
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
{
m_header_field_generation_location(
vc_location
),
m_header_field_unrecognised_certificate(
f_HashedId3FromHashedId8(
vc_aaCertificate.signer_info.signerInfo.digest
)
)
}
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 45;
test_decodePDU<GeoNetworkingReq>(
mw_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload_ipv6(
v_header,
v_ipv6Packet,
'60000000002806FF2001061804000000000000005199CC70200106180001800000000000000000058C9B00506AE7073600000000A0021630299C00000204058C0402080A00DD1A390000000001030302'O
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate secured with digest GeoNetworkingReq/NwShb with a CAM payload and three additional header field
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredDigestNwShbPacketWithBtpPayloadCam_withMoreHeaders_3() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
),
v_buffer
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
{
m_header_field_signer_info(
m_signerInfo_certificate(
vc_aaCertificate
)),
m_header_field_generation_location(
vc_location
),
m_header_field_unrecognised_certificate(
f_HashedId3FromHashedId8(
vc_aaCertificate.signer_info.signerInfo.digest
)
)
}
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 45;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
testcase tc_GeoNetInd_UnicastWithBtpAPayload() runs on TCType system TCType {
if (PX_GN_UPPER_LAYER != e_btpA) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA");
/**
* @desc validate secured with certificate GeoNetworkingReq/NwShb with a CAM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredCertificateNwShbPacketWithBtpPayloadCam() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduWithPayload(
mw_geoUnicastHeader(?, ?, ?),
{
decodedPayload := {
btpPacket := mw_btpA_Without_Payload(
3751,
3751
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 46;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate secured with certificate chain GeoNetworkingReq/NwShb with a CAM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredCertCertificateNwShbPacketWithBtpPayloadCam() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_camReq(
m_camMsg(
f_getTsStationId(),
35000
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredCam(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_chain
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 46;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate secured with digest GeoNetworkingReq/NwShb with a DENM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredDigestNwShbPacketWithBtpPayloadDenm() runs on TCType system TCType {
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_btpB) {
log("PX_GN_UPPER_LAYER shall be set to e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwShbPacket(
m_dummyLongPosVectorIut
);
// Add DENM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
},
rawPayload := '0EA70EA7'O
} // End of 'payload' field
),
'deadbeef0000'O
),
'4c006527006201200000000404004c00001e4f40d37e0000000017d7840005f5e10003e800000014000000021b004c00001e4f40d37e0000000017d7840005f5e10003e80000001400001400deadbeef00022a32332e17d7d22005f5e1000ea70ea7deadbeef0000'O);
)
)
)
)
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Encode it
v_gnPayload := bit2oct( // Create GN payload
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredDenm(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
log("v_gnReq= ", v_gnReq);
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 56;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Broadcast with payload
* @desc validate GeoNetworkingReq/TSB ExtendedHeader
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_Broadcast() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006c27006300410000000f000aa431a4fdea5ea5ed0000036b000001090000031500500224000c516697592b00a431a4fdea5ea5ed0000036b000001090000031500500224000c516600048d8800007fe904d2162e23a3000044454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_TsbHeaderPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_payload := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
var octetstring v_buffer := '01002B0A0051800000480A00269400008431A4FDEA5EA5ED0000036B000001090000031500500224CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECAFFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
1033,461 → 2064,1382
stop;
}
v_geoNetworkingPacket := m_geoNwPacketWithOctetstringPayload(
m_commonHeader(
PX_GN_UPPER_LAYER,
m_tsbHeaderType,
m_trafficClass,
c_defaultHopLimit
),
m_tsbHeader(
9876,
m_dummyLongPosVectorNodeA
),
v_payload
);
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_geoNetworkingPacket.packet
));
log("v_gnReq :", v_gnReq);
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoBroadcastHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeA,
38745,
m_dummyGeoBroadcastArea1))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_geoBroadcastHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeA,
38745,
m_dummyGeoBroadcastArea1);
v_header.geoBroadcastHeader.commonHeader.plLength := 15;
oct2bit(v_buffer)
);
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := lengthof(v_payload);
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
testcase tc_GeoNetReq_Broadcast_With_Payload() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006427005b004200000007000aa431a4fdea5ea5ed0000036b000001090000031500500224000c516697592b00a431a4fdea5ea5ed0000036b000001090000031500500224000c5166000d544c00000b15223d10e111d700005041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
/**
* @desc validate secured GeoNetworkingReq/TSB ExtendedHeader
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredTsbHeaderPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_gnPayload, v_encMsg;
var octetstring v_payload := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_geoNetworkingPacket := m_geoNwPacketWithOctetstringPayload(
m_commonHeader(
PX_GN_UPPER_LAYER,
m_tsbHeaderType,
m_trafficClass,
c_defaultHopLimit
),
m_tsbHeader(
9876,
m_dummyLongPosVectorNodeA
),
v_payload
);
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_geoNetworkingPacket.packet
));
v_gnPayload := bit2oct( // Create GN payload
encvalue(
v_gnReq.msgOut.gnPacket.packet
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnReq.msgOut.gnPacket.packet,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := lengthof(v_payload);
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Anycast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_AnycastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_buffer := '01002B0A00308000000F0A001DE60000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A3000044454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload(
m_geoBroadcastHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeA,
38745,
m_dummyGeoBroadcastArea2
),
{
decodedPayload := omit,
rawPayload := char2oct("PAYLOAD")
} // End of 'payload' field
)
),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_geoBroadcastHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeA,
38745,
m_dummyGeoBroadcastArea2);
v_header.geoBroadcastHeader.commonHeader.plLength := 7;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPduWithPayload(
v_header,
{
decodedPayload := omit,
rawPayload := char2oct("PAYLOAD")
} // End of 'payload' field
)
),
v_gnReq,
v_buffer
);
}
testcase tc_geoBroadcastWithSopvSepv() runs on TCType system TCType {
if (PICS_GN_LOCAL_ADDR_CONF_METHOD != e_manual) {
log("PICS_GN_LOCAL_ADDR_CONF_METHOD shall be set to e_manual");
setverdict(inconc);
stop;
}
/**
* @desc validate secured GeoNetworkingReq/Anycast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredAnycastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduWithPayload(
mw_geoBroadcastHeader(
mw_longPosVectorPosition_withDelta(m_dummyLongPosVectorIutSopvSepv), // SOPV
mw_longPosVectorPosition_withDelta(m_dummyLongPosVectorIutSopvSepv), // SEPV
34154 // sequence number
),
{
decodedPayload := omit,
rawPayload := '5041594C4F4144'O
} // End of 'payload' field
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1
),
'FFFFFFFFFFFF'O
),
'4c006427005b004200000007000aa431a4fdea5ea5ed0000036b000001090000031500500224000c516697592b00a431a4fdea5ea5ed0000036b000001090000031500500224000c5166000d544c00000b15223d10e111d700005041594c4f4144ffffffffffff'O
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/LsRequest
* @desc validate GeoNetworkingReq/Anycast with hop limit
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_LsRequest() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d006427005b00600000000f000a9432a40102030405000011e90000007e0000007b002d007d0019420901f32b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef44454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_AnycastPacketWithHopLimit() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var ExtendedHeader v_header := null;
var octetstring v_buffer := '01002B0A00308000000F05001DE60000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A3000044454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1,
c_defaultHopLimit / 2
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_lsRequestHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeB,
499,
m_dummyGnAddrIut))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_lsRequestHeader(
m_dummyLongPosVectorNodeA,
m_dummyLongPosVectorNodeB,
499,
m_dummyGnAddrIut);
v_header.lsRequestHeader.commonHeader.plLength := 15;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
/**
* @desc validate GeoNetworkingReq/LsReply
* @desc validate secured GeoNetworkingReq/Anycast with hop limit
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_LsReply() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d007027006700610000000f000aa431a4fdea5ea5ed0000036b000001090000031500500224000c5166ec762b00a431a4fdea5ea5ed0000036b000001090000031500500224000c51669421a4fedecabeef0001e240000012f8000002a344454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredAnycastPacketWithHopLimit() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1,
c_defaultHopLimit / 2
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwAnycastPacket(
m_dummyLongPosVectorNodeB,
7654,
m_dummyGeoAnycastArea1,
c_defaultHopLimit / 2
),
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Unicast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_UnicastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var ExtendedHeader v_header := null;
var octetstring v_buffer := '01002B0A00208000000F0A001DE60000A832A40102030405000011E90000007E0000007B002D007DBC21A4FEDECABEEF0001E240000012F8000002A344454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_lsReplyHeader(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeA,
60534))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_lsReplyHeader(
m_dummyLongPosVectorNodeA,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
m_dummyLongPosVectorNodeA,
60534);
v_header.lsReplyHeader.commonHeader.plLength := 15;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
}
/**
* @desc validate GeoNetworkingReq/TSB Header
* @desc validate secured GeoNetworkingReq/Anycast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_TsbHeader() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d005c27005300510000000f000aa431a4fdea5ea5ed0000036b000001090000031500500224000c516626942b00a431a4fdea5ea5ed0000036b000001090000031500500224000c516644454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredDigestUnicastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654
),
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
log("SecuredMsg=", v_encMsg);
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Unicast with hop limit
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_UnicastPacketWithHopLimit() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var ExtendedHeader v_header := null;
var octetstring v_buffer := '01002B0A00208000000F01001DE60000A832A40102030405000011E90000007E0000007B002D007DBC21A4FEDECABEEF0001E240000012F8000002A344454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654,
1
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_tsbHeader(
m_dummyLongPosVectorNodeA,
9876,
m_dummyLongPosVectorNodeA))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_tsbHeader(
m_dummyLongPosVectorNodeA,
9876,
m_dummyLongPosVectorNodeA);
v_header.tsbHeader.commonHeader.plLength := 15;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
/**
* @desc validate GeoNetworkingReq/TSB Header with hop limit
* @desc validate secured GeoNetworkingReq/Anycast with hop limit
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_TsbHeader_With_HopLimit() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d005c27005300510000000f004da431a4fdea5ea5ed0000036b000001090000031500500224000c5166223c2b00a431a4fdea5ea5ed0000036b000001090000031500500224000c516644454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredUnicastPacketWithHopLimit() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654,
1
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwUnicastPacket(
m_dummyLongPosVectorNodeB,
f_longPosVector2ShortPosVector(m_dummyLongPosVectorIut),
7654,
1
),
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Broadcast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_BroadcastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var ExtendedHeader v_header := null;
var octetstring v_buffer := '01002B0A00418000000F0A000D800000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A3000044454641554C545F5041594C4F4144FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
)));
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_tsbHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
8764,
m_dummyLongPosVectorNodeA,
77))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_tsbHeaderWithHopLimit(
m_dummyLongPosVectorNodeA,
8764,
m_dummyLongPosVectorNodeA,
77);
v_header.tsbHeader.commonHeader.plLength := 15;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
 
/**
* @desc validate GeoNetworkingReq/SHB Header
* @desc validate secured GeoNetworkingReq/Broadcast
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_ShbHeader() runs on TCType system TCType {
var Header v_header := null;
var octetstring v_buffer := '4d003c27003300500000000f000a942adeadbabebeef00005c5c00005cca0000c1ed006e00170012314544454641554c545f5041594c4f4144ffffffffffff'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
testcase tc_GeoNetReq_SecuredBroadcastPacket() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var octetstring v_gnPayload, v_encMsg;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnPayload := bit2oct( // Create GN payload
encvalue(
m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
)
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
),
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 15;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate GeoNetworkingReq/Broadcast with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_BroadcastPacketWithBtpPayload() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_payload := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
var octetstring v_buffer := '01002B0A0041800000480A000D800000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A30000CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECAFFFFFFFFFFFF'O;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
v_gnNonSecuredPacket := m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
);
v_geoNetworkingPacket := m_geoNwPacketWithOctetstringPayload(
v_gnNonSecuredPacket.commonHeader,
v_gnNonSecuredPacket.extendedHeader,
v_payload
);
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_geoNetworkingPacket.packet
));
log("v_gnReq :", v_gnReq);
test_PDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_shbHeader(
m_dummyLongPosVectorNodeC))),
v_gnReq,
false,
oct2bit(v_buffer));
v_header := m_shbHeader(
m_dummyLongPosVectorNodeC);
v_header.shbHeader.commonHeader.plLength := 15;
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := lengthof(v_payload);
test_decodePDU<GeoNetworkingReq>(
m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_header
)
),
v_gnReq,
v_buffer
);
}
 
testcase tc_GeoNetInd_ShbHeaderWithBtpPayload() runs on TCType system TCType {
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
/**
* @desc validate GeoNetworkingReq/Broadcast with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_BroadcastPacketWithPayloadDenm() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var GeoNetworkingPacket v_geoNetworkingPacket;
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
var octetstring v_buffer := '01002B0A2041800000380A000D800000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A300000000000001010001B207C0000D903800000000006072000000188593E91B2B9BDF918C000400400061A80000B6000037FFFDFFFF63390100FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_btpB) {
log("PX_GN_UPPER_LAYER shall be set to e_btpB");
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduAnyPayload(mw_shbHeader),
'ffffffffffff'O
),
'4c003727003401500000000404014c00001e4f40d37e0000000017d7840005f5e10003e80000001400000ea70ea7000000000000ffffffffffff'O);
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
)));
v_gnReq.msgOut.gnPacket.packet.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
)
)
)
)
);
log("v_gnReq :", v_gnReq);
test_PDU<GeoNetworkingReq>(
v_gnReq,
false,
oct2bit(v_buffer));
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 56;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_buffer
);
}
 
testcase tc_GeoNetInd_ShbHeaderWithBtpPayloadCam() runs on TCType system TCType {
/**
* @desc validate secured GeoNetworkingReq/Broadcast with payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredBroadcastPacketWithBtpPayload() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_gnPayload, v_encMsg;
var octetstring v_payload := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduWithPayload(
mw_shbHeaderWithLength(58),
{
decodedPayload := {
btpPacket := mw_btpA_With_CamPayload(4321, 8765)
}, // End of 'decodedPayload' field
rawPayload := '10E1223D00000133256C5B1E40000248D6C0000000000000000009C40000002060080000003FFE83E80004000000000000007FFD7FFE00FFFFFF'O
}
),
'ffffffffffff'O
),
'4c006727006401500000003A04014c00001e4f40d37e0000000017d7840005f5e10003e800000014000010e1223d00000133256c5b1e40000248d6c0000000000000000009c40000002060080000003ffe83e80004000000000000007ffd7ffe00ffffffffffff'O);
// 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// 0 1 2
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
);
v_geoNetworkingPacket := m_geoNwPacketWithOctetstringPayload(
v_gnNonSecuredPacket.commonHeader,
v_gnNonSecuredPacket.extendedHeader,
v_payload
);
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwPdu(
v_geoNetworkingPacket.packet
));
v_gnPayload := bit2oct( // Create GN payload
encvalue(
v_gnReq.msgOut.gnPacket.packet
)
);
f_buildGnSecuredOtherMessage(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnReq.msgOut.gnPacket.packet,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg=", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := lengthof(v_payload);
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
testcase tc_GeoNetInd_ShbHeaderWithBtpPayloadTrunkatedCam() runs on TCType system TCType {
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
/**
* @desc validate secured digest GeoNetworkingReq/Broadcast with DENM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredDigestBroadcastPacketWithBtpDenm() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
var octetstring v_buffer := '01002B0A2041800000390A000D800000A832A40102030405000011E90000007E0000007B002D007D00048D8800007FE904D2162E23A300000000000001010001B207C0000D903800000000006072000000188593E91B2B9BDF918BC00400400000C35000C16C0010E0000800018CE00000FFFFFFFFFFFF'O;
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_btpB) {
log("PX_GN_UPPER_LAYER shall be set to e_btpB");
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPduWithPayload(
mw_shbHeaderWithLength(50),
{
decodedPayload := {
btpPacket := mw_btpA_With_CamPayload(4321, 8765)
}, // End of 'decodedPayload' field
rawPayload := ''O
}
),
'ffffffffffff'O
),
'4c005F27005C01500000003204014c00001e4f40d37e0000000017d7840005f5e10003e800000014000010e1223d00000133256c5b1e40000248d6c009c40000002060080000003ffe83e80004000000000000007ffd7ffe00ffffffffffff'O);
// 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// 0 1 2
if (getverdict() == fail) {
setverdict(pass);
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add DENM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredDenm(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate_digest_with_sha256,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 56;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
/**
* @desc validate secured dcertificate GeoNetworkingReq/Broadcast with DENM payload
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetReq_SecuredCertificateBroadcastPacketWithBtpDenm() runs on TCType system TCType {
var GeoNetworkingReq v_gnReq;
var GnNonSecuredPacket v_gnNonSecuredPacket;
var GeoNetworkingPacket v_geoNetworkingPacket;
var octetstring v_gnPayload, v_encMsg;
var template (value) SituationContainer v_situation := m_situation(c_causeVehicleBreakdown, c_subCauseCode_Unavailable);
var template (value) ToBeSignedSecuredMessage v_toBeSignedSecuredMessage;
var template (value) SecuredMessage v_securedMessageBeacon;
if (PX_GN_UPPER_LAYER != e_btpB) {
log("PX_GN_UPPER_LAYER shall be set to e_btpB");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
// Build signed SecuredMessage
v_gnNonSecuredPacket := m_geoNwBroadcastPacket(
m_dummyLongPosVectorNodeB,
3456,
m_dummyGeoBroadcastArea1
);
log("v_gnNonSecuredPacket= ", v_gnNonSecuredPacket);
// Add CAM payload
v_gnNonSecuredPacket.payload := f_adaptPayload_m(
bit2oct(
encvalue(
m_denmReq(
m_denmPdu(
m_denm(
m_denmMgmtCon(
m_tsActionId
),
v_situation,
m_denmLocation_zeroDelta
)
)
)
)
)
);
log("v_gnNonSecuredPacket.payload= ", v_gnNonSecuredPacket.payload);
// Encode it
v_gnPayload := bit2oct(
encvalue(
v_gnNonSecuredPacket
)
);
log("v_gnPayload= ", v_gnPayload);
f_buildGnSecuredDenm(
v_securedMessageBeacon,
m_payload_signed(v_gnPayload),
e_certificate,
m_threeDLocation(
1234,
5678,
'002F'O
)
);
log("v_securedMessageBeacon= ", v_securedMessageBeacon);
// Build secured Gn packet
v_gnReq := m_geoNwReq_linkLayerBroadcast(
m_geoNwSecPdu(
v_gnNonSecuredPacket,
v_securedMessageBeacon
) // End of template m_geoNwSecPdu
); // End of template m_geoNwReq_linkLayerBroadcast
// Encode it
v_encMsg := bit2oct(encvalue(v_gnReq));
log("v_encMsg= ", v_encMsg);
if (not isbound(v_encMsg)) {
setverdict(fail, "Encoding failed!");
stop;
}
setverdict(pass, "Encoding passed.");
// Decode it
v_gnReq.msgOut.gnPacket.packet.commonHeader.plLength := 56;
test_decodePDU<GeoNetworkingReq>(
v_gnReq,
v_encMsg
);
log("v_gnReq: ", v_gnReq);
if (decvalue(oct2bit(v_encMsg), v_gnReq) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnReq.msgOut.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
/**
* @desc validate GeoNetworkingInd/Beacon
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetInd_Beacon() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader(?, 255, ?)), 'ffffffffffff'O), '4c002d27002400100000000000ffcc2aabcdefabcde24a27877900007eca000030aa000030aa000030aaFFFFFFFFFFFF'O);
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPdu(
mw_geoNwBeaconPacket(
?
)
),
'FFFFFFFFFFFF'O
),
'01002B0A0010800000000100BC21A4FEDECABEEF0001E240000012F8000002A380372694FFFFFFFFFFFF'O
);
}
 
/**
* @desc validate GeoNetworkingInd/Beacon with a LsRequest frame
* @verdict Fail on success, Pass otherwise
* @desc validate secured GeoNetworkingInd/Beacon
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetInd_Beacon_With_LsRequest_Frame() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader(?, 255, ?)), 'ffffffffffff'O), '4c005527004c00600000000000ff0042deadbeef00015484751042540000075400000010000000000000004233000042deadbeef000254847510425400000754000000100000000000000042deadbabebeefFFFFFFFFFFFF'O);
testcase tc_GeoNetInd_SecuredBeacon() runs on TCType system TCType {
var GeoNetworkingInd v_gnInd;
var octetstring v_decMsg := '02002B0A021E8001963A7C716A20569D00000134D2197F537003000004D20000162E002F01200010800000000100BC21A4FEDECABEEF0001E240000012F8000002A38037269443010002E0EF081A49ABA0570F5EDCAACD65C8509EBFD4132CEB8E80904E1EAC489C12D17672C967428FFF851304CC83D914EE73AD12892F2BC55B092CBFF59147643DBBFFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd(
mw_geoNwSecPdu(
mdw_securedMessage,
mw_geoNwBeaconPacket(
?
)
)
),
v_decMsg
);
// Check signature
if (decvalue(oct2bit(v_decMsg), v_gnInd) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnInd.msgIn.gnPacket.securedMsg,vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
 
/**
* @desc validate GeoNetworkingInd/LsRequest
* @desc validate GeoNetworkingInd/LsReply
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetInd_LsRequest() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_lsRequestHeader(66, m_dummyGnAddrNodeC.mid)), 'ffffffffffff'O), '4c005527004c00600000000000ff0042deadbeef00015484751042540000075400000010000000000000004233000042deadbeef000254847510425400000754000000100000000000000042deadbabebeefFFFFFFFFFFFF'O);
if (getverdict() == fail) {
setverdict(pass); // The 'test_decodePDU' call shall fail
testcase tc_GeoNetInd_LsRequestPacket() runs on TCType system TCType {
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPdu(
mw_geoNwLsRequestPacket(
12345,
?
)
),
'FFFFFFFFFFFF'O
),
'01002B0A0060800000000A0030390000BC21A4FEDECABEEF0001E240000012F8000002A380372694BC21A4FEDECABEEFFFFFFFFFFFFF'O
);
}
/**
* @desc validate secured GeoNetworkingInd/LsReply
* @verdict Pass on success, Fail otherwise
*/
testcase tc_GeoNetInd_SecuredLsRequestPacket() runs on TCType system TCType {
var GeoNetworkingInd v_gnInd;
var octetstring v_decMsg := '02002B0A021E8001963A7C716A20569D00000134D261A4425003000004D20000162E002F012C0060800000000A0030390000BC21A4FEDECABEEF0001E240000012F8000002A380372694BC21A4FEDECABEEF43010002B48FF2B34AEDAFC616F54EB204C556E5E7877A8F4A3AD14B38E06272D593FFF8C2C1E6A0F5F22A72AE235E8898920D9B4ADAE83178F30E282F796823EE139CA0FFFFFFFFFFFF'O;
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwSecPdu(
mdw_securedMessage,
mw_geoNwLsRequestPacket(
12345,
?
)
),
'FFFFFFFFFFFF'O
),
v_decMsg
);
// Check signature
if (decvalue(oct2bit(v_decMsg), v_gnInd) == 0) {
if (f_verifyGnSecuredMessageSignatureWithCertificate(v_gnInd.msgIn.gnPacket.securedMsg, vc_atCertificate) == true) {
setverdict(pass, "Signature check succeed.");
} else {
setverdict(fail, "Signature check failed.");
}
} else {
setverdict(fail, "Decoding failed.");
}
}
testcase tc_GeoNetInd_ShbHeaderPacket() runs on TCType system TCType {
if (PX_GN_UPPER_LAYER != e_any) {
log("PX_GN_UPPER_LAYER shall be set to e_any");
stop;
}
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(
mw_geoNwPdu(
mw_geoNwShbPacket(
?,
?
)
),
'FFFFFFFFFFFF'O
),
'01002B0A00508000000F0A00BC21A4FEDECABEEF0001E240000012F8000002A3803726940000000044454641554C545F5041594C4F4144FFFFFFFFFFFF'O
);
}
testcase tc_GeoNetInd_SecuredDigest() runs on TCType system TCType {
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd(
mw_geoNwSecPdu(
mdw_securedMessage,
mw_geoNwAnyPacket_withPayload(
?
))),
'02002b0a0201168001b893358ab25faf640000000148c57ff5ec05000254005210508000002e0a00bc21a4fedecabeeff6c53234000012f8000002a3803726940000000007d1000001020001b20788b80059f48d95cdefc8c5e0020020002461a83c000004805a100c4528399d4c387fff80430100020000f9a888a78d9053507a828711deef7f38d470736fc07bbb7f4bf044ed0d80325b6d55af32e9aeaa69b281132ce3f596ef5eaf4281aa8c4f0398ab126d3f90b855ffffffffffff'O
);
}
 
testcase tc_GeoNetInd_TestingTech() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader(?, ?, ?)), 'ffffffffffff'O),
'4c002d27002a001000000000000a4c00deadbeef00024e0c0aa717d7d22005f5e10003e8000000140000ffffffffffff'O
testcase tc_GeoNetInd_SecuredCertificate_DENM() runs on TCType system TCType {
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd(
mw_geoNwSecPdu(
mdw_securedMessage,
mw_geoNwAnyPacket_withPayload(
?
))),
'02002b0a020181198002020901b893358ab25faf64010080950000045fe633945b4c1a08d904dfb35fb19ef2967e2c739725d5c0e868d8682743f9390369985c3af3aa54e489c4a7d0381cfd9dfb6d71bb6e6059061f16dafd05da46010100042c560cb703294825e40d5d850ab4fef24e5b0dee3e12a4ce0747c4f31db1b147a1cbc5690f3929a5e7263e92c07db2e606d4da72ebe2732e4bd61c58aae807630220210ac040800100c04081010024015411aa6d5a391aed0303181db9cf7c052616001db9566e0526872a1d53f0d0052783500000570941dabbc94fd3607250d96fd1bef305f92113b8eef39772232c0fcdb951e4dcc6d99b8c8ca94a0ac14a7a46707b83a80820adca58b6f1e3fea7fe6e0752ba0220210ac040800100c0408101002401540086ed5a391aed0303181db9cf7c052616001db9566e0526872a1d53f0d00527835000009ba18503dfc211994cfd1a1ecf71f306da9e6980ac2fb091d0797d9b155a20864930abcb59b4feda7a59c3c78cdafce8e804f6fe8cab94afcc84bf568d46497d0000000148c5afcc2d05000254005210508000002e0a00bc21a4fedecabeeff6f50875000012f8000002a380372694000000000000000001020001b20788b80059f48d95cdefc8c5e0020020002461a83c000004805a100c4528399d4c387fff804301000200005cb251c659b90920b87fa55ca4e831a986b77c0f145a45b8e49674ee0dcf68b505c5c5bd546da38f379edc6bc8b96acf4736e47412065005665af7aed2a39012'O
);
}
 
testcase tc_GeoNetInd_Kapsch() runs on TCType system TCType {
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_beaconHeader(?, ?, ?)), 'ffffffffffff'O),
'4c002d27002a0010000000000001169012014cd592dc0000000000000000000000000000000000000000ffffffffffff'O
testcase tc_GeoNetInd_SecuredCertificate_CAM() runs on TCType system TCType {
if ((PX_GN_UPPER_LAYER != e_btpA) and (PX_GN_UPPER_LAYER != e_btpB)) {
log("PX_GN_UPPER_LAYER shall be set to e_btpA or e_btpB");
setverdict(inconc);
stop;
}
// Load certificates & keys
if (f_loadCertificates("cfg01") == false) {
setverdict(fail);
stop;
}
f_setGenerationLocation(
f_getTsLatitude(),
f_getTsLongitude()
);
test_decodePDU<GeoNetworkingInd>(
mw_geoNwInd(
mw_geoNwSecPdu(
mdw_securedMessage,
mw_geoNwAnyPacket_withPayload(
?
))),
'02002B0A020181198002020901B893358AB25FAF64010080950000045FE633945B4C1A08D904DFB35FB19EF2967E2C739725D5C0E868D8682743F9390369985C3AF3AA54E489C4A7D0381CFD9DFB6D71BB6E6059061F16DAFD05DA46010100042C560CB703294825E40D5D850AB4FEF24E5B0DEE3E12A4CE0747C4F31DB1B147A1CBC5690F3929A5E7263E92C07DB2E606D4DA72EBE2732E4BD61C58AAE807630220210AC040800100C04081010024015411AA6D5A391AED0303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000570941DABBC94FD3607250D96FD1BEF305F92113B8EEF39772232C0FCDB951E4DCC6D99B8C8CA94A0AC14A7A46707B83A80820ADCA58B6F1E3FEA7FE6E0752BA000001358CEAA7398005000254005210508000002E0A00BC21A4FEDECABEEF535AEF38000012F8000002A3803726940000000007D1000001020001B20788B80059F48D95CDEFC8C5E0020020002461A83C000004805A100C4528399D4C387FFF804301000247C9F3161E20F8B61857117967DA83EA4A1667A27B0462F2B07197C3F82FC816F336F1C803BD1B3E62B1B7D3141921485049DEA8ECD22E7F2D27077E98AA74EC010002B4A06C592A8B49CBBCC35D864A427C7A020CB2E535B043DD06828ED9310859A9B90847545A7845CAF565D430C8187A784E9DB4495A16D694E5FAA67C30785550'O
);
}
 
} // End of testGeoNetPrimitiveMessages
group testUtEvent {
 
testcase tc_UtGnInitialize() runs on TCType system TCType {
test_PDU<UtInitialize>(m_gnInitialize, false);
}
 
testcase tc_geoUnicast() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoUnicastMessage(m_dummyGnAddrIut), false);
testcase tc_UtInitializeResult() runs on TCType system TCType {
test_decodePDU<UtInitializeResult>(UtInitializeResult:true, '0101'O);
}
 
testcase tc_geoUnicastWithLifetime() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoUnicastMessageWithLifetime(m_dummyGnAddrIut, 1000), false);
}
 
testcase tc_geoUnicastWithPayload() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoUnicastMessageWithPayload(m_dummyGnAddrIut, char2oct("PAYLOAD_1")), false);
}
 
testcase tc_geoBroadcast() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoBroadcastMessage({e_geoCircle, {2147483647, 2147483647, 65535, 65535, 65535}}), false);
}
 
testcase tc_geoBroadcastWithPayload() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoBroadcastMessageWithPayload({e_geoCircle, {2147483647, 2147483647, 65535, 65535, 65535}}, char2oct("PAYLOAD")), false);
}
 
testcase tc_geoAnycast() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoAnycastMessage({e_geoCircle, {2147483647, 2147483647, 65535, 65535, 65535}}), false);
}
 
testcase tc_geoAnycastWithPayload() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateGeoAnycastMessageWithPayload({e_geoCircle, {2147483647, 2147483647, 65535, 65535, 65535}}, char2oct("PAYLOAD")), false);
}
 
testcase tc_shb() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateShbMessage, false);
}
 
testcase tc_shbWithPayload() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateShbMessageWithPayload(char2oct("PAYLOAD")), false);
}
 
testcase tc_tsb() runs on TCType system TCType {
test_PDU<UtEvent>(m_generateTsbMessage, false);
}
 
testcase tc_changePosition() runs on TCType system TCType {
test_PDU<UtEvent>(m_changePosition, false);
}
} // End of group testUtEvent
 
/trunk/unittests/codec/ttcn/test_LibItsIpv6OverGeoNetworking_TypesAndValues.ttcn3
1,520 → 1,520
module test_LibItsIpv6OverGeoNetworking_TypesAndValues /*language "TTCN-3:2009 Advanced Parameterization"*/ {
import from LibCommon_BasicTypesAndValues all;
import from LibItsCommon_TypesAndValues all;
import from LibItsIpv6OverGeoNetworking_TestSystem all;
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Pixits {
modulepar PX_GN_UPPER_LAYER
};
import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
import from LibItsIpv6OverGeoNetworking_Templates all;
import from LibItsExternal_TypesAndValues all;
import from test_CommonCodec all;
 
group LibItsGeoNetworking_DummyTemplates {
template (value) GN_Address m_dummyGnAddrNodeA := {
typeOfAddress := e_manual,
stationType := {
vehicleStation := {
stationType := e_vehicleStation,
vsKind := e_bus
}
},
stationSubType := e_private,
stationCountryCode := 49,
mid := 'a4fdea5ea5ed'O
}
template (value) LongPosVector m_dummyLongPosVectorNodeA := {
gnAddr := m_dummyGnAddrNodeA,
timestamp := 875,
latitude := 265,
longitude := 789,
speed := 80,
heading := 548,
altitude := 12,
timeAccuracy := 5,
posAccuracy := 1,
speedAccuracy := 3,
headingAccuracy := 1,
altitudeAccuracy := 2
}
template (value) Area m_dummyArea1 := {
geoAreaPosLatitude := 298376,
geoAreaPosLongitude := 32745,
distanceA := 1234,
distanceB := 5678,
angle := 9123
}
template (value) GeoBroadcastArea m_dummyGeoBroadcastArea1 := {
geoBroadcastSubType := e_geoBroadcastRect,
geoBroadcastArea := m_dummyArea1
}
} // End of group LibItsGeoNetworking_DummyTemplates
group LibItsIpv6OverGeoNetworking_DummyTemplates {
 
template (value) IPv6OverGeoNetworkingInd m_ipv6OverGeoNwInd(
charstring p_interface,
MacAddress p_srcMacAddr,
MacAddress p_dstMacAddr,
Ipv6Packet p_ipv6Packet
) := {
interface := p_interface,
macSourceAddress := p_srcMacAddr,
macDestinationAddress := p_dstMacAddr,
ipv6Packet := p_ipv6Packet
}
 
template (value) AcGn6InterfaceInfoList m_trueAcInterfaceInfoList := {
{
interfaceName := "lo",
ipv6AddressList := {
'00000000000000000000000000000001'O
}
},
{
interfaceName := "eth1",
ipv6AddressList := {
'FE8000000000000002D012FFFEF1ED0E'O
}
},
{
interfaceName := "wlan0",
ipv6AddressList := {
'200106603013F0050000000000000001'O,
'FE80000000000000021BB1FFFEB18AA3'O
}
},
{
interfaceName := "tun0",
ipv6AddressList := {
'200106603013F0071400001BB1B18AA3'O,
'FE800000000000001400001BB1B18AA3'O
}
}
} // End of temlate m_trueAcInterfaceInfoList
 
template (value) AcGn6InterfaceInfoList m_dummyAcInterfaceInfoList := {
{
interfaceName := "Interface #0",
ipv6AddressList := {
'1001061804000000000000005199cc70'O,
'1001061804000000000000005199cc71'O,
'1001061804000000000000005199cc72'O
}
},
{
interfaceName := "Interface #1",
ipv6AddressList := {
'2001061804000000000000005199cc70'O,
'2001061804000000000000005199cc71'O,
'2001061804000000000000005199cc72'O
}
},
{
interfaceName := "Interface #2",
ipv6AddressList := {
'3001061804000000000000005199cc70'O,
'3001061804000000000000005199cc71'O,
'3001061804000000000000005199cc72'O
}
}
}
template AcGn6Response m_dummyAcInterfaceInfos (template (present) AcGn6InterfaceInfoList p_interfaceInfoList) := {
interfaceInfoList := p_interfaceInfoList
}
template (value) AcGn6Primitive m_dummyAcGetInterfaceInfos := {
getInterfaceInfos := 3
}
} // End of group LibItsIpv6OverGeoNetworking_DummyTemplates
group ipv6_DummyTemplates { // See http://www.zytrax.com/tech/protocols/ipv6-formats.html
template (value) MacAddress m_srcMacAddress_01 := '0000860580da'O;
template (value) MacAddress m_dstMacAddress_01 := '0060970769ea'O;
template (value) Ipv6Address m_src_01 := 'fe80000000000000020086fffe0580da'O;
template (value) Ipv6Address m_dst_01 := 'fe80000000000000026097fffe0769ea'O;
template (value) MacAddress m_srcMacAddress_02 := '0000860580da'O;
template (value) MacAddress m_dstMacAddress_02 := '0060970769ea'O;
template (value) Ipv6Address m_src_02 := 'fe80000000000000020086fffe0580da'O;
template (value) Ipv6Address m_dst_02 := 'fe80000000000000026097fffe0769ea'O;
template (value) MacAddress m_srcMacAddress_03 := '0000860580da'O;
template (value) MacAddress m_dstMacAddress_03 := '0060970769ea'O;
template (value) Ipv6Address m_src_03 := 'fe80000000000000020086fffe0580da'O;
template (value) Ipv6Address m_dst_03 := 'fe80000000000000026097fffe0769ea'O;
template RtAdvOptions m_rtAdvOpt_srcLinkLayerAddr_03 := {
srcLinkLayerAddr := {
icmpType := c_srcLinkLayerAddress,
optionLength := 8,
linkLayerAddr := '00000000860580da'O
},
prefixInfoList := omit,
otherOption := omit
}
template (value) MacAddress m_srcMacAddress_04 := '0060970769ea'O;
template (value) MacAddress m_dstMacAddress_04 := '333300000001'O;
template (value) Ipv6Address m_src_04 := 'fe80000000000000026097fffe0769ea'O;
template (value) Ipv6Address m_dst_04 := 'ff020000000000000000000000000001'O;
template SrcLinkLayerAddress m_srcLinkLayerAddr_04 := {
icmpType := c_srcLinkLayerAddress,
optionLength := 8,
linkLayerAddr := '00000060970769ea'O
}
template RtAdvOptions m_rtAdvOpt_prefixOpt_04 (
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,
in template (value) SrcLinkLayerAddress p_srcLinkLayerAddr
):={
srcLinkLayerAddr := p_srcLinkLayerAddr,
prefixInfoList := {
m_prefixInfo(
p_prefixLength,
p_lFlag,
p_aFlag,
p_validLifetime,
p_preferredLifetime,
p_prefix
)
},
otherOption := omit
}
} // End of group ipv6_DummyTemplates
group testAcPrimitives {
/**
*
* @desc validate AcGn6Primitive primitive
* @verdict Pass on success, Fail otherwise
*/
testcase tc_ipv6GetInterfaceInfo() runs on TCType system TCType {
test_PDU<AcGn6Primitive>(
m_dummyAcGetInterfaceInfos,
true,
oct2bit('02000400000003'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
}
 
/**
* @desc validate AcGn6Response
* @verdict Pass on success, Fail otherwise
*/
testcase tc_ipv6InterfaceInfoList() runs on TCType system TCType {
test_PDU<AcGn6Response>(
m_dummyAcInterfaceInfos(m_dummyAcInterfaceInfoList),
true,
oct2bit('0400be6700bb030c496e74657266616365202330031001061804000000000000005199cc701001061804000000000000005199cc711001061804000000000000005199cc720c496e74657266616365202331032001061804000000000000005199cc702001061804000000000000005199cc712001061804000000000000005199cc720c496e74657266616365202332033001061804000000000000005199cc703001061804000000000000005199cc713001061804000000000000005199cc72'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
)
}
testcase tc_ipv6InterfaceInfoList2() runs on TCType system TCType {
test_decodePDU<AcGn6Response>(
m_dummyAcInterfaceInfos(m_trueAcInterfaceInfoList),
'04007804026c6f0100000000000000000000000000000001046574683101fe8000000000000002d012fffef1ed0e05776c616e3002200106603013f0050000000000000001fe80000000000000021bb1fffeb18aa30474756e3002200106603013f0071400001bb1b18aa3fe800000000000001400001bb1b18aa3'O
)
}
} // End of group testAcPrimitives
group ipv6 {
testcase tc_geoNetReq_icmpv6_noAdvOptions() runs on TCType system TCType {
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #0",
m_srcMacAddress_01,
m_dstMacAddress_01,
m_ipv6Packet(
m_src_01,
m_dst_01,
c_noNextHdr,
omit
)
),
true,
oct2bit('4f00410c496e746572666163652023300000860580da0060970769ea6000000000003bfffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea'O) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
)
}
testcase tc_geoNetReq_icmpv6_withAdvOptions_prefixOpt() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var octetstring v_buffer := '4f00710c496e746572666163652023310000860580da0060970769ea6000000000303afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea8600273dff00ffffffffffff00000000030400c00000001e0000001e000000002001061804000000000000005199cc70'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_02,
m_dstMacAddress_02,
m_ipv6Packet(
m_src_02,
m_dst_02,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_prefixOpt(
0,
c_lFlag1,
c_aFlag1,
c_validLifetime30s,
c_preferredLifetime30s,
'2001061804000000000000005199cc70'O
)
)
)
),
false,
oct2bit(v_buffer)
);
v_ipv6Packet := m_ipv6Packet(
m_src_02,
m_dst_02,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_prefixOpt(
0,
c_lFlag1,
c_aFlag1,
c_validLifetime30s,
c_preferredLifetime30s,
'2001061804000000000000005199cc70'O
)
)
);
v_ipv6Packet.ipv6Hdr.payloadLength := 48;
v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '273d'O;
test_decodePDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_02,
m_dstMacAddress_02,
v_ipv6Packet
),
v_buffer
);
}
testcase tc_geoNetReq_icmpv6_withAdvOptions_linkLayerAddr() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var octetstring v_buffer := '4f005b0c496e746572666163652023310000860580da0060970769ea60000000001a3afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea86006b8eff00ffffffffffff00000000010800000000860580da'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_03,
m_dstMacAddress_03,
m_ipv6Packet(
m_src_03,
m_dst_03,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_srcLinkLayerAddr_03
)
)
),
false,
oct2bit(v_buffer) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
v_ipv6Packet := m_ipv6Packet(
m_src_03,
m_dst_03,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_srcLinkLayerAddr_03
)
);
v_ipv6Packet.ipv6Hdr.payloadLength := 26;
v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '6B8E'O;
test_decodePDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_03,
m_dstMacAddress_03,
v_ipv6Packet
),
v_buffer
);
}
testcase tc_geoNetReq_icmpv6_withAdvOptions_prefixOpt_linkLayerAddr() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var octetstring v_buffer := '4f007b0c496e746572666163652023310060970769ea33330000000160000000003a3afffe80000000000000026097fffe0769eaff02000000000000000000000000000186001221ff00ffffffffffff00000000010800000060970769ea030440c00036ee800036ee80000000003ffe0507000000010000000000000000'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_04,
m_dstMacAddress_04,
m_ipv6Packet(
m_src_04,
m_dst_04,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_prefixOpt_04(
64,
c_lFlag1,
c_aFlag1,
3600000,
3600000,
'3ffe0507000000010000000000000000'O,
m_srcLinkLayerAddr_04
)
)
)
),
false,
oct2bit(v_buffer) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
);
v_ipv6Packet := m_ipv6Packet(
m_src_04,
m_dst_04,
c_icmpHdr,
m_rtAdvWithOptions(
m_rtAdvOpt_prefixOpt_04(
64,
c_lFlag1,
c_aFlag1,
3600000,
3600000,
'3ffe0507000000010000000000000000'O,
m_srcLinkLayerAddr_04
)
)
);
v_ipv6Packet.ipv6Hdr.payloadLength := 58;
v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '1221'O;
test_decodePDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #1",
m_srcMacAddress_04,
m_dstMacAddress_04,
v_ipv6Packet
),
v_buffer
);
}
} // End of group ipv6
group testIpv6OverGeoNetPrimitiveMessages {
/**
* @desc validate IPv6OverGeoNetworkingReq
* @verdict Pass on success, Fail otherwise
*/
testcase tc_ipv6OverGeoNetReq() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var octetstring v_buffer := '4f00690c496e7465726661636520233000508d4938ea00b0d0c7c19d60000000002806ff2001061804000000000000005199cc70200106180001800000000000000000058c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #0",
'00508d4938ea'O,
'00b0d0c7c19d'O,
m_ipv6Packet(
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O } ) ),
false,
oct2bit(v_buffer));
v_ipv6Packet := m_ipv6Packet(
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
);
v_ipv6Packet.ipv6Hdr.payloadLength := 40; // payload length = 40
test_decodePDU<IPv6OverGeoNetworkingReq>(
m_ipv6OverGeoNwReq(
"Interface #0",
'00508d4938ea'O,
'00b0d0c7c19d'O,
v_ipv6Packet
),
v_buffer
);
}
testcase tc_ipv6OverGeoNetInd() runs on TCType system TCType {
var Ipv6Packet v_ipv6Packet := null;
var octetstring v_buffer := '4e00690c496e7465726661636520233000b0d0c7c19d00508d4938ea60000000002806ff2001061804000000000000005199cc70200106180001800000000000000000058c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
if (PX_GN_UPPER_LAYER != e_ipv6) {
log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
setverdict(inconc);
stop;
}
test_PDU<IPv6OverGeoNetworkingInd>(
m_ipv6OverGeoNwInd(
"Interface #0",
'00b0d0c7c19d'O,
'00508d4938ea'O, // On purpose: IUT must use this value
m_ipv6Packet( // payload length = 40
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O } ) ),
false,
oct2bit(v_buffer)
);
v_ipv6Packet := m_ipv6Packet(
'2001061804000000000000005199cc70'O,
'20010618000180000000000000000005'O,
6,
{ octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
);
v_ipv6Packet.ipv6Hdr.payloadLength := 40; // payload length = 40
test_decodePDU<IPv6OverGeoNetworkingInd>(
m_ipv6OverGeoNwReq(
"Interface #0",
'00b0d0c7c19d'O,
'00508d4938ea'O, // On purpose: IUT must use this value
v_ipv6Packet
),
v_buffer
);
}
}
 
// import from LibCommon_BasicTypesAndValues all;
// import from LibItsCommon_TypesAndValues all;
// import from LibItsIpv6OverGeoNetworking_TestSystem all;
// import from LibItsGeoNetworking_TypesAndValues all;
// import from LibItsGeoNetworking_Templates all;
// import from LibItsGeoNetworking_Pixits {
// modulepar PX_GN_UPPER_LAYER
// };
// import from LibItsIpv6OverGeoNetworking_TypesAndValues all;
// import from LibItsIpv6OverGeoNetworking_Templates all;
// import from LibItsExternal_TypesAndValues all;
// import from test_CommonCodec all;
//
// group LibItsGeoNetworking_DummyTemplates {
//
// template (value) GN_Address m_dummyGnAddrNodeA := {
// typeOfAddress := e_manual,
// stationType := {
// vehicleStation := {
// stationType := e_vehicleStation,
// vsKind := e_bus
// }
// },
// stationSubType := e_private,
// stationCountryCode := 49,
// mid := 'a4fdea5ea5ed'O
// }
//
// template (value) LongPosVector m_dummyLongPosVectorNodeA := {
// gnAddr := m_dummyGnAddrNodeA,
// timestamp := 875,
// latitude := 265,
// longitude := 789,
// speed := 80,
// heading := 548,
// altitude := 12,
// timeAccuracy := 5,
// posAccuracy := 1,
// speedAccuracy := 3,
// headingAccuracy := 1,
// altitudeAccuracy := 2
// }
//
// template (value) Area m_dummyArea1 := {
// geoAreaPosLatitude := 298376,
// geoAreaPosLongitude := 32745,
// distanceA := 1234,
// distanceB := 5678,
// angle := 9123
// }
//
// template (value) GeoBroadcastArea m_dummyGeoBroadcastArea1 := {
// geoBroadcastSubType := e_geoBroadcastRect,
// geoBroadcastArea := m_dummyArea1
// }
//
// } // End of group LibItsGeoNetworking_DummyTemplates
//
// group LibItsIpv6OverGeoNetworking_DummyTemplates {
//
// template (value) IPv6OverGeoNetworkingInd m_ipv6OverGeoNwInd(
// charstring p_interface,
// MacAddress p_srcMacAddr,
// MacAddress p_dstMacAddr,
// Ipv6Packet p_ipv6Packet
// ) := {
// interface := p_interface,
// macSourceAddress := p_srcMacAddr,
// macDestinationAddress := p_dstMacAddr,
// ipv6Packet := p_ipv6Packet
// }
//
// template (value) AcGn6InterfaceInfoList m_trueAcInterfaceInfoList := {
// {
// interfaceName := "lo",
// ipv6AddressList := {
// '00000000000000000000000000000001'O
// }
// },
// {
// interfaceName := "eth1",
// ipv6AddressList := {
// 'FE8000000000000002D012FFFEF1ED0E'O
// }
// },
// {
// interfaceName := "wlan0",
// ipv6AddressList := {
// '200106603013F0050000000000000001'O,
// 'FE80000000000000021BB1FFFEB18AA3'O
// }
// },
// {
// interfaceName := "tun0",
// ipv6AddressList := {
// '200106603013F0071400001BB1B18AA3'O,
// 'FE800000000000001400001BB1B18AA3'O
// }
// }
// } // End of temlate m_trueAcInterfaceInfoList
//
// template (value) AcGn6InterfaceInfoList m_dummyAcInterfaceInfoList := {
// {
// interfaceName := "Interface #0",
// ipv6AddressList := {
// '1001061804000000000000005199cc70'O,
// '1001061804000000000000005199cc71'O,
// '1001061804000000000000005199cc72'O
// }
// },
// {
// interfaceName := "Interface #1",
// ipv6AddressList := {
// '2001061804000000000000005199cc70'O,
// '2001061804000000000000005199cc71'O,
// '2001061804000000000000005199cc72'O
// }
// },
// {
// interfaceName := "Interface #2",
// ipv6AddressList := {
// '3001061804000000000000005199cc70'O,
// '3001061804000000000000005199cc71'O,
// '3001061804000000000000005199cc72'O
// }
// }
// }
//
// template AcGn6Response m_dummyAcInterfaceInfos (template (present) AcGn6InterfaceInfoList p_interfaceInfoList) := {
// interfaceInfoList := p_interfaceInfoList
// }
//
// template (value) AcGn6Primitive m_dummyAcGetInterfaceInfos := {
// getInterfaceInfos := 3
// }
//
// } // End of group LibItsIpv6OverGeoNetworking_DummyTemplates
//
// group ipv6_DummyTemplates { // See http://www.zytrax.com/tech/protocols/ipv6-formats.html
//
// template (value) MacAddress m_srcMacAddress_01 := '0000860580da'O;
// template (value) MacAddress m_dstMacAddress_01 := '0060970769ea'O;
// template (value) Ipv6Address m_src_01 := 'fe80000000000000020086fffe0580da'O;
// template (value) Ipv6Address m_dst_01 := 'fe80000000000000026097fffe0769ea'O;
//
// template (value) MacAddress m_srcMacAddress_02 := '0000860580da'O;
// template (value) MacAddress m_dstMacAddress_02 := '0060970769ea'O;
// template (value) Ipv6Address m_src_02 := 'fe80000000000000020086fffe0580da'O;
// template (value) Ipv6Address m_dst_02 := 'fe80000000000000026097fffe0769ea'O;
//
// template (value) MacAddress m_srcMacAddress_03 := '0000860580da'O;
// template (value) MacAddress m_dstMacAddress_03 := '0060970769ea'O;
// template (value) Ipv6Address m_src_03 := 'fe80000000000000020086fffe0580da'O;
// template (value) Ipv6Address m_dst_03 := 'fe80000000000000026097fffe0769ea'O;
// template RtAdvOptions m_rtAdvOpt_srcLinkLayerAddr_03 := {
// srcLinkLayerAddr := {
// icmpType := c_srcLinkLayerAddress,
// optionLength := 8,
// linkLayerAddr := '00000000860580da'O
// },
// prefixInfoList := omit,
// otherOption := omit
// }
//
// template (value) MacAddress m_srcMacAddress_04 := '0060970769ea'O;
// template (value) MacAddress m_dstMacAddress_04 := '333300000001'O;
// template (value) Ipv6Address m_src_04 := 'fe80000000000000026097fffe0769ea'O;
// template (value) Ipv6Address m_dst_04 := 'ff020000000000000000000000000001'O;
// template SrcLinkLayerAddress m_srcLinkLayerAddr_04 := {
// icmpType := c_srcLinkLayerAddress,
// optionLength := 8,
// linkLayerAddr := '00000060970769ea'O
// }
// template RtAdvOptions m_rtAdvOpt_prefixOpt_04 (
// 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,
// in template (value) SrcLinkLayerAddress p_srcLinkLayerAddr
// ):={
// srcLinkLayerAddr := p_srcLinkLayerAddr,
// prefixInfoList := {
// m_prefixInfo(
// p_prefixLength,
// p_lFlag,
// p_aFlag,
// p_validLifetime,
// p_preferredLifetime,
// p_prefix
// )
// },
// otherOption := omit
// }
// } // End of group ipv6_DummyTemplates
//
// group testAcPrimitives {
//
// /**
// *
// * @desc validate AcGn6Primitive primitive
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_ipv6GetInterfaceInfo() runs on TCType system TCType {
// test_PDU<AcGn6Primitive>(
// m_dummyAcGetInterfaceInfos,
// true,
// oct2bit('02000400000003'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// }
//
// /**
// * @desc validate AcGn6Response
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_ipv6InterfaceInfoList() runs on TCType system TCType {
// test_PDU<AcGn6Response>(
// m_dummyAcInterfaceInfos(m_dummyAcInterfaceInfoList),
// true,
// oct2bit('0400be6700bb030c496e74657266616365202330031001061804000000000000005199cc701001061804000000000000005199cc711001061804000000000000005199cc720c496e74657266616365202331032001061804000000000000005199cc702001061804000000000000005199cc712001061804000000000000005199cc720c496e74657266616365202332033001061804000000000000005199cc703001061804000000000000005199cc713001061804000000000000005199cc72'O) // Check for 'LibItsGeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// )
// }
//
// testcase tc_ipv6InterfaceInfoList2() runs on TCType system TCType {
// test_decodePDU<AcGn6Response>(
// m_dummyAcInterfaceInfos(m_trueAcInterfaceInfoList),
// '04007804026c6f0100000000000000000000000000000001046574683101fe8000000000000002d012fffef1ed0e05776c616e3002200106603013f0050000000000000001fe80000000000000021bb1fffeb18aa30474756e3002200106603013f0071400001bb1b18aa3fe800000000000001400001bb1b18aa3'O
// )
// }
//
// } // End of group testAcPrimitives
//
// group ipv6 {
//
// testcase tc_geoNetReq_icmpv6_noAdvOptions() runs on TCType system TCType {
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
// test_PDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #0",
// m_srcMacAddress_01,
// m_dstMacAddress_01,
// m_ipv6Packet(
// m_src_01,
// m_dst_01,
// c_noNextHdr,
// omit
// )
// ),
// true,
// oct2bit('4f00410c496e746572666163652023300000860580da0060970769ea6000000000003bfffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea'O) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// )
// }
//
// testcase tc_geoNetReq_icmpv6_withAdvOptions_prefixOpt() runs on TCType system TCType {
// var Ipv6Packet v_ipv6Packet := null;
// var octetstring v_buffer := '4f00710c496e746572666163652023310000860580da0060970769ea6000000000303afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea8600273dff00ffffffffffff00000000030400c00000001e0000001e000000002001061804000000000000005199cc70'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
//
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
//
// test_PDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_02,
// m_dstMacAddress_02,
// m_ipv6Packet(
// m_src_02,
// m_dst_02,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_prefixOpt(
// 0,
// c_lFlag1,
// c_aFlag1,
// c_validLifetime30s,
// c_preferredLifetime30s,
// '2001061804000000000000005199cc70'O
// )
// )
// )
// ),
// false,
// oct2bit(v_buffer)
// );
// v_ipv6Packet := m_ipv6Packet(
// m_src_02,
// m_dst_02,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_prefixOpt(
// 0,
// c_lFlag1,
// c_aFlag1,
// c_validLifetime30s,
// c_preferredLifetime30s,
// '2001061804000000000000005199cc70'O
// )
// )
// );
// v_ipv6Packet.ipv6Hdr.payloadLength := 48;
// v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '273d'O;
// test_decodePDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_02,
// m_dstMacAddress_02,
// v_ipv6Packet
// ),
// v_buffer
// );
// }
//
// testcase tc_geoNetReq_icmpv6_withAdvOptions_linkLayerAddr() runs on TCType system TCType {
// var Ipv6Packet v_ipv6Packet := null;
// var octetstring v_buffer := '4f005b0c496e746572666163652023310000860580da0060970769ea60000000001a3afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea86006b8eff00ffffffffffff00000000010800000000860580da'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
//
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
// test_PDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_03,
// m_dstMacAddress_03,
// m_ipv6Packet(
// m_src_03,
// m_dst_03,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_srcLinkLayerAddr_03
// )
// )
// ),
// false,
// oct2bit(v_buffer) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// v_ipv6Packet := m_ipv6Packet(
// m_src_03,
// m_dst_03,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_srcLinkLayerAddr_03
// )
// );
// v_ipv6Packet.ipv6Hdr.payloadLength := 26;
// v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '6B8E'O;
// test_decodePDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_03,
// m_dstMacAddress_03,
// v_ipv6Packet
// ),
// v_buffer
// );
// }
//
// testcase tc_geoNetReq_icmpv6_withAdvOptions_prefixOpt_linkLayerAddr() runs on TCType system TCType {
// var Ipv6Packet v_ipv6Packet := null;
// var octetstring v_buffer := '4f007b0c496e746572666163652023310060970769ea33330000000160000000003a3afffe80000000000000026097fffe0769eaff02000000000000000000000000000186001221ff00ffffffffffff00000000010800000060970769ea030440c00036ee800036ee80000000003ffe0507000000010000000000000000'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
//
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
// test_PDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_04,
// m_dstMacAddress_04,
// m_ipv6Packet(
// m_src_04,
// m_dst_04,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_prefixOpt_04(
// 64,
// c_lFlag1,
// c_aFlag1,
// 3600000,
// 3600000,
// '3ffe0507000000010000000000000000'O,
// m_srcLinkLayerAddr_04
// )
// )
// )
// ),
// false,
// oct2bit(v_buffer) // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
// );
// v_ipv6Packet := m_ipv6Packet(
// m_src_04,
// m_dst_04,
// c_icmpHdr,
// m_rtAdvWithOptions(
// m_rtAdvOpt_prefixOpt_04(
// 64,
// c_lFlag1,
// c_aFlag1,
// 3600000,
// 3600000,
// '3ffe0507000000010000000000000000'O,
// m_srcLinkLayerAddr_04
// )
// )
// );
// v_ipv6Packet.ipv6Hdr.payloadLength := 58;
// v_ipv6Packet.ipv6Payload.routerAdvMsg.checksum := '1221'O;
// test_decodePDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #1",
// m_srcMacAddress_04,
// m_dstMacAddress_04,
// v_ipv6Packet
// ),
// v_buffer
// );
// }
// } // End of group ipv6
//
// group testIpv6OverGeoNetPrimitiveMessages {
//
// /**
// * @desc validate IPv6OverGeoNetworkingReq
// * @verdict Pass on success, Fail otherwise
// */
// testcase tc_ipv6OverGeoNetReq() runs on TCType system TCType {
// var Ipv6Packet v_ipv6Packet := null;
// var octetstring v_buffer := '4f00690c496e7465726661636520233000508d4938ea00b0d0c7c19d60000000002806ff2001061804000000000000005199cc70200106180001800000000000000000058c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
//
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
// test_PDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #0",
// '00508d4938ea'O,
// '00b0d0c7c19d'O,
// m_ipv6Packet(
// '2001061804000000000000005199cc70'O,
// '20010618000180000000000000000005'O,
// 6,
// { octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O } ) ),
// false,
// oct2bit(v_buffer));
// v_ipv6Packet := m_ipv6Packet(
// '2001061804000000000000005199cc70'O,
// '20010618000180000000000000000005'O,
// 6,
// { octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
// );
// v_ipv6Packet.ipv6Hdr.payloadLength := 40; // payload length = 40
// test_decodePDU<IPv6OverGeoNetworkingReq>(
// m_ipv6OverGeoNwReq(
// "Interface #0",
// '00508d4938ea'O,
// '00b0d0c7c19d'O,
// v_ipv6Packet
// ),
// v_buffer
// );
// }
//
// testcase tc_ipv6OverGeoNetInd() runs on TCType system TCType {
// var Ipv6Packet v_ipv6Packet := null;
// var octetstring v_buffer := '4e00690c496e7465726661636520233000b0d0c7c19d00508d4938ea60000000002806ff2001061804000000000000005199cc70200106180001800000000000000000058c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O; // Check for 'LibItsIPv6GeoNetworking_TypesAndValues.encode:' output in codec traces to get the dump
//
// if (PX_GN_UPPER_LAYER != e_ipv6) {
// log("PX_GN_UPPER_LAYER shall be set to e_ipv6");
// setverdict(inconc);
// stop;
// }
// test_PDU<IPv6OverGeoNetworkingInd>(
// m_ipv6OverGeoNwInd(
// "Interface #0",
// '00b0d0c7c19d'O,
// '00508d4938ea'O, // On purpose: IUT must use this value
// m_ipv6Packet( // payload length = 40
// '2001061804000000000000005199cc70'O,
// '20010618000180000000000000000005'O,
// 6,
// { octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O } ) ),
// false,
// oct2bit(v_buffer)
// );
// v_ipv6Packet := m_ipv6Packet(
// '2001061804000000000000005199cc70'O,
// '20010618000180000000000000000005'O,
// 6,
// { octetstringMsg := '8c9b00506ae7073600000000a0021630299c00000204058c0402080a00dd1a390000000001030302'O }
// );
// v_ipv6Packet.ipv6Hdr.payloadLength := 40; // payload length = 40
// test_decodePDU<IPv6OverGeoNetworkingInd>(
// m_ipv6OverGeoNwReq(
// "Interface #0",
// '00b0d0c7c19d'O,
// '00508d4938ea'O, // On purpose: IUT must use this value
// v_ipv6Packet
// ),
// v_buffer
// );
// }
//
// }
//
} // End of module test_LibItsIpv6OverGeoNetworking_TypesAndValues
/trunk/unittests/codec/ttcn/test_LibItsSecurity_TypesAndValues.ttcn3
0,0 → 1,1298
module test_LibItsSecurity_TypesAndValues {
// LibCommon
import from LibItsCommon_Functions {function f_getCurrentTime;}
import from LibCommon_DataStrings all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates {template all;}
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
// TestUnits
import from test_CommonCodec all;
group LibItsSecurity_testCases {
group securityAcPrimitives {
/**
* @desc Validate Security AcPrimitive
*/
testcase tc_acEnableSecurity() runs on TCType system TCType {
var ToBeSignedSecuredMessage v_toBeSignedSecuredMessageDigest, v_toBeSignedSecuredMessageCertificate;
f_loadCertificates("cfg01");
vc_location := {
22345,
54321,
'0000'O
};
v_toBeSignedSecuredMessageDigest := f_buildSecuredMessagePayloadToBeSigned();
v_toBeSignedSecuredMessageCertificate := f_buildSecuredMessagePayloadToBeSigned(true);
test_PDU<AcEnableSecurity>(
m_enableSecurity(
"TA_CERT_A"
),
true,
oct2bit('54415F434552545F41'O)
);
}
} // End of group securityAcPrimitives
group basicFormatElements {
/**
* @desc Validate PublicKey/EccPoint
* @verdict Pass on success, Fail otherwise
*/
testcase tc_PublicKey_eccPoint_01() runs on TCType system TCType {
test_PDU<PublicKey>(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
);
} // End of testcase tc_PublicKey_eccPoint_01
/**
* @desc Validate PublicKey/EccPoint
* @verdict Pass on success, Fail otherwise
*/
testcase tc_PublicKey_eccPoint_02() runs on TCType system TCType {
test_PDU<PublicKey>(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
)
)
);
} // End of testcase tc_PublicKey_eccPoint_02
/**
* @desc Validate PublicKey/EccPoint
* @verdict Pass on success, Fail otherwise
*/
testcase tc_PublicKey_aesccm_01() runs on TCType system TCType {
test_PDU<PublicKey>(
m_publicKey_aesccm(
m_aesccm(
m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
)
);
} // End of testcase tc_PublicKey_aesccm_01
/**
* @desc Validate PublicKey/EccPoint
* @verdict Pass on success, Fail otherwise
*/
testcase tc_PublicKey_aesccm_02() runs on TCType system TCType {
test_PDU<PublicKey>(
m_publicKey_aesccm(
m_aesccm(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
)
)
)
);
} // End of testcase tc_PublicKey_aesccm_02
/**
* @desc Validate EcdsaSignature
* @remark The EccPointType of R shall be set to x_coordinate_only
* @verdict Pass on success, Fail otherwise
*/
testcase tc_EcdsaSignature_01() runs on TCType system TCType {
test_PDU<EcdsaSignature>(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
);
} // End of testcase tc_EcdsaSignature_01
testcase tc_Duration_01() runs on TCType system TCType {
test_PDU<Duration>(
m_duration_in_seconds(
456
)
);
} // End of testcase tc_Duration_01
/**
* @desc Validate Time64WithStandardDeviation
* @verdict Pass on success, Fail otherwise
*/
testcase tc_Time64WithStandardDeviation_01() runs on TCType system TCType {
test_PDU<Time64WithStandardDeviation>(
m_time64WithStandardDeviation(
oct2int('FACEB00C'O),
128
)
);
} // End of testcase tc_Time64WithStandardDeviation_01
/**
* @desc Validate TwoDLocation
* @verdict Pass on success, Fail otherwise
*/
testcase tc_TwoDLocation_01() runs on TCType system TCType {
test_PDU<TwoDLocation>(
m_twoDLocation(
22345,
54321
)
);
} // End of testcase tc_TwoDLocation_01
/**
* @desc Validate ThreeDLocation
* @verdict Pass on success, Fail otherwise
*/
testcase tc_ThreeDLocation_01() runs on TCType system TCType {
test_PDU<ThreeDLocation>(
m_threeDLocation(
12345,
54321,
int2oct(1024, 2)
)
);
} // End of testcase tc_ThreeDLocation_01
testcase tc_EncryptionParameters_01() runs on TCType system TCType {
test_PDU<EncryptionParameters>(
m_encryptionParameters_aes_128_ccm(
'010203040506070808080808'O
)
);
} // End of testcase tc_EncryptionParameters_01
testcase tc_GeographicRegion_01() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_circle(
m_twoDLocation(
22345,
54321
),
2550
)
);
} // End of testcase tc_EncryptionParameters_01
testcase tc_GeographicRegion_02() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_rectangle(
m_twoDLocation(
22345,
54321
),
m_twoDLocation(
2*22345,
2*54321
)
)
);
} // End of testcase tc_EncryptionParameters_02
testcase tc_GeographicRegion_03() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_polygonial(
{
m_twoDLocation(
22345,
54321
),
m_twoDLocation(
2*22345,
2*54321
)
}
)
);
} // End of testcase tc_EncryptionParameters_03
template (value) IdentifiedRegion m_identifiedRegion_01 := {
region_dictionary := e_un_stats,
region_identifier := 3,
local_region := 10
} // End of template m_identifiedRegion_01
template (value) IdentifiedRegion m_identifiedRegion_02 := {
region_dictionary := e_iso_3166_1,
region_identifier := 4567,
local_region := 78
} // End of template m_identifiedRegion_01
template (value) IdentifiedRegion m_identifiedRegion_03 := {
region_dictionary := e_iso_3166_1,
region_identifier := 2,
local_region := 2184
} // End of template m_identifiedRegion_03
template (value) IdentifiedRegion m_identifiedRegion_04 := {
region_dictionary := e_iso_3166_1,
region_identifier := 2,
local_region := 9 * 2184
} // End of template m_identifiedRegion_04
testcase tc_GeographicRegion_04() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_identifiedRegion(
m_identifiedRegion_01
)
);
} // End of testcase tc_GeographicRegion_04
testcase tc_GeographicRegion_05() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_identifiedRegion(
m_identifiedRegion_02
)
);
} // End of testcase tc_GeographicRegion_05
testcase tc_GeographicRegion_06() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_identifiedRegion(
m_identifiedRegion_03
)
);
} // End of testcase tc_GeographicRegion_06
testcase tc_GeographicRegion_07() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_identifiedRegion(
m_identifiedRegion_04
)
);
} // End of testcase tc_GeographicRegion_07
testcase tc_GeographicRegion_08() runs on TCType system TCType {
test_PDU<GeographicRegion>(
m_geographicRegion_nonce
);
} // End of testcase tc_GeographicRegion_08
} // End of group basicFormatElements
group securityHeader {
testcase tc_Payload_01() runs on TCType system TCType {
test_PDU<SecPayload>(
m_payload_signed_external
);
} // End of testcase tc_Payload_01
testcase tc_Payload_02() runs on TCType system TCType {
test_PDU<SecPayload>(
m_payload_unsecured('DEEDBEEF'O)
);
} // End of testcase tc_Payload_02
testcase tc_Payload_03() runs on TCType system TCType {
test_PDU<SecPayload>(
m_payload_signed('DEEDBEEF'O)
);
} // End of testcase tc_Payload_03
testcase tc_Payload_04() runs on TCType system TCType {
test_PDU<SecPayload>(
m_payload_encrypted('DEEDBEEF'O)
);
} // End of testcase tc_Payload_04
testcase tc_Payload_05() runs on TCType system TCType {
test_PDU<SecPayload>(
m_payload_signed_and_encrypted('DEEDBEEF'O)
);
} // End of testcase tc_Payload_05
testcase tc_HeaderField_01() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_generation_time(
123456789
)
);
} // End of testcase tc_HeaderField_01
testcase tc_HeaderField_02() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_generation_time_with_standard_deviation(
m_time64WithStandardDeviation(
oct2int('FACEB00C'O),
128
)
)
);
} // End of testcase tc_HeaderField_02
testcase tc_HeaderField_03() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_expiry_time(
3600
)
);
} // End of testcase tc_HeaderField_03
testcase tc_HeaderField_04() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_generation_location(
m_threeDLocation(
-12345,
-54321,
int2oct(1024, 2)
)
)
);
} // End of testcase tc_HeaderField_04
testcase tc_HeaderField_05() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_unrecognised_certificate(
'060708'O
)
);
} // End of testcase tc_HeaderField_05
testcase tc_HeaderField_06() runs on TCType system TCType {
test_PDU<HeaderField>(
mw_header_field_its_aid(16512)
);
} // End of testcase tc_HeaderField_06
testcase tc_HeaderField_07() runs on TCType system TCType {
test_PDU<HeaderField>(
mw_header_field_its_aid(16513)
);
} // End of testcase tc_HeaderField_07
testcase tc_HeaderField_08() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_its_aid(
12345
)
);
} // End of testcase tc_HeaderField_08
testcase tc_HeaderField_09() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_signer_info(
m_signerInfo_self
)
);
} // End of testcase tc_HeaderField_09
testcase tc_HeaderField_10() runs on TCType system TCType {
test_PDU<HeaderField>(
m_header_field_enc_params(
m_encryptionParameters_aes_128_ccm(
'010203040506070808080808'O
)
)
);
} // End of testcase tc_HeaderField_10
testcase tc_TrailerField_01() runs on TCType system TCType {
test_PDU<TrailerField>(
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
)
);
} // End of testcase tc_TrailerField_01
testcase tc_SecuredMessage_01() runs on TCType system TCType {
test_PDU<SecuredMessage>(
m_secureMessage_dummy
);
} // End of testcase tc_SecuredMessage_01
template (value) SecuredMessage m_secureMessageCAMs_01
modifies m_secureMessage_dummy := {
header_fields := {
m_header_field_signer_info(
m_signerInfo_digest('0102030405060708'O)
),
m_header_field_signer_info(
m_signerInfo_digest('1020304050607080'O)
)
},
payload_field := m_payload_signed('DEEDBEEF01'O),
trailer_fields := {
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
)
}
} // End of template tc_SecuredMessage_01
template (value) SecuredMessage m_secureMessage_02
modifies m_secureMessage_dummy := {
header_fields := {
m_header_field_signer_info(
m_signerInfo_digest('0102030405060708'O)
),
m_header_field_signer_info(
m_signerInfo_digest('1020304050607080'O)
)
},
payload_field := m_payload_signed('DEEDBEEF01'O),
trailer_fields := {
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
),
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
),
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
)
}
} // End of template m_secureMessage_02
template (value) SecuredMessage m_secureMessageCAMs
modifies m_secureMessage_dummy := {
header_fields := {
m_header_field_signer_info(
m_signerInfo_digest('0102030405060708'O)
),
m_header_field_generation_time(1000 * f_getCurrentTime()),
m_header_field_its_aid_CAM
},
payload_field := m_payload_signed('DEEDBEEF01'O),
trailer_fields := {
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
),
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
),
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
)
}
} // End of template m_secureMessageCAMs
template (value) SecuredMessage m_secureMessageDENMs
modifies m_secureMessage_dummy := {
header_fields := {
m_header_field_signer_info(
m_signerInfo_digest('0102030405060708'O)
),
m_header_field_generation_time(1000 * f_getCurrentTime()),
m_header_field_generation_location(
m_threeDLocation(
12345,
54321,
int2oct(1024, 2)
)
),
m_header_field_its_aid_DENM
},
payload_field := m_payload_signed('DEEDBEEF01'O),
trailer_fields := {
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
),
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
),
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
)
}
} // End of template m_secureMessageDENMs
template (value) SecuredMessage m_secureMessageOthers
modifies m_secureMessage_dummy := {
header_fields := {
m_header_field_signer_info(
m_signerInfo_digest('0102030405060708'O)
),
m_header_field_generation_time(1000 * f_getCurrentTime()),
m_header_field_generation_location(
m_threeDLocation(
12345,
54321,
int2oct(1024, 2)
)
)
},
payload_field := m_payload_signed('DEEDBEEF01'O),
trailer_fields := {
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
),
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
)
)
),
m_trailer_field_signature(
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O,
'00008A08AE40EC69030C056E48152F7A14F72BA4F305C2E6AA31997ABE93E7FD'O
),
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O
)
)
)
}
} // End of template m_secureMessageOthers
testcase tc_SecuredMessage_02() runs on TCType system TCType {
test_PDU<SecuredMessage>(
m_secureMessage_02
);
} // End of testcase tc_SecuredMessage_02
testcase tc_SecuredMessage_03() runs on TCType system TCType {
test_PDU<SecuredMessage>(
m_secureMessageCAMs
);
if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs) == true) {
setverdict(pass, "Basic");
}
if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_digest)) == true) {
setverdict(pass, "With digest");
}
if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_CAMs(mw_header_field_signer_info_certificate)) == false) {
setverdict(pass, "With certificate mismatch");
}
if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_DENMs) == true) {
setverdict(fail, "Shall not match with DENM template");
stop;
}
if (match(valueof(m_secureMessageCAMs), mdw_securedMessage_Others) == true) {
setverdict(fail, "Shall not match with Other template");
stop;
}
} // End of testcase tc_SecuredMessage_03
testcase tc_SecuredMessage_04() runs on TCType system TCType {
test_PDU<SecuredMessage>(
m_secureMessageDENMs
);
if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs) == true) {
setverdict(pass, "Basic");
}
if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_digest)) == true) {
setverdict(pass, "With digest");
}
if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_DENMs(mw_header_field_signer_info_certificate)) == false) {
setverdict(pass, "With certificate mismatch");
}
if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_CAMs) == true) {
setverdict(fail, "Shall not match with CAM template");
stop;
}
if (match(valueof(m_secureMessageDENMs), mdw_securedMessage_Others) == true) {
setverdict(fail, "Shall not match with Other template");
stop;
}
} // End of testcase tc_SecuredMessage_04
testcase tc_SecuredMessage_05() runs on TCType system TCType {
test_PDU<SecuredMessage>(
m_secureMessageOthers
);
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others) == true) {
setverdict(pass, "Basic");
}
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_digest)) == true) {
setverdict(pass, "With digest");
}
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_Others(mw_header_field_signer_info_certificate)) == false) {
setverdict(pass, "With certificate mismatch");
}
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) {
setverdict(fail, "Shall not match with CAM template");
stop;
}
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_CAMs) == true) {
setverdict(fail, "Shall not match with CAM template");
stop;
}
if (match(valueof(m_secureMessageOthers), mdw_securedMessage_DENMs) == true) {
setverdict(fail, "Shall not match with DENM template");
stop;
}
} // End of testcase tc_SecuredMessage_05
} // End of group securityHeader
group certificates {
testcase tc_SubjectInfo_01() runs on TCType system TCType {
test_PDU<SubjectInfo>(
m_subject_info_root_ca('DEADBEEF'O)
);
} // End of testcase tc_SubjectInfo_01
testcase tc_SubjectInfo_02() runs on TCType system TCType {
test_PDU<SubjectInfo>(
m_subject_info_revocation('DE5EA5ED'O)
);
} // End of testcase tc_SubjectInfo_02
testcase tc_SubjectAttribute_01() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_verification_key(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
)
)
)
);
} // End of testcase tc_SubjectAttribute_01
testcase tc_SubjectAttribute_02() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_encryption_key(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
)
)
)
);
} // End of testcase tc_SubjectAttribute_02
testcase tc_SubjectAttribute_03() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_reconstruction_value(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'D89D70110B4AB76904CBD27578420F0814380A5E4183F42AE602BE903EE606F8'O,
'639D5CB825989E92F0A77B31EF65DE5B3505C75FD7B12BA64DBA89897DCB4043'O
)
)
);
} // End of testcase tc_SubjectAttribute_03
testcase tc_SubjectAttribute_04() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_assurance_level(
m_subjectAssurance(
'101'B,
'11'B
)
)
);
} // End of testcase tc_SubjectAttribute_04
testcase tc_SubjectAttribute_05() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_its_aid_list(
{
9 * 2184,
7 * 2184,
5 * 2184,
3 * 2184,
2184
}
)
);
} // End of testcase tc_SubjectAttribute_05
testcase tc_SubjectAttribute_06() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_its_aid_ssp_list(
{
{
9 * 2184,
m_sspTest
},
{
7 * 2184,
m_sspTest
},
{
5 * 2184,
m_sspTest
},
{
3 * 2184,
m_sspTest
},
{
2184,
m_sspTest
}
}
),
true,
oct2bit('2115C04CC80100BBB80100AAA801009998010088880100'O)
);
} // End of testcase tc_SubjectAttribute_06
testcase tc_SubjectAttribute_07() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_its_aid_ssp_list(
{
{
16512,
{
version := '00'O,
sspContainer := omit
}
},
{
16513,
{
version := '00'O,
sspContainer := omit
}
}
}
),
true,
oct2bit('210AC040800100C040810100'O)
);
} // End of testcase tc_SubjectAttribute_07
testcase tc_SubjectAttribute_08() runs on TCType system TCType {
test_PDU<SubjectAttribute>(
m_subject_attribute_its_aid_ssp_list(
{
{
16512,
m_sspDENM_vehicle
},
{
16513,
m_sspDENM_vehicle
}
}
),
true,
oct2bit('2110C04080040101F8DFC04081040101F8DF'O)
);
} // End of testcase tc_SubjectAttribute_08
testcase tc_SubjectAssurance_01() runs on TCType system TCType {
test_PDU<SubjectAssurance>(
m_subjectAssurance(
'101'B,
'11'B
)
);
} // End of testcase tc_SubjectAssurance_01
testcase tc_ValidityRestriction_01() runs on TCType system TCType {
test_PDU<ValidityRestriction>(
m_validity_restriction_time_end(
12345
)
);
} // End of testcase tc_ValidityRestriction_01
testcase tc_ValidityRestriction_02() runs on TCType system TCType {
test_PDU<ValidityRestriction>(
m_validity_restriction_time_start_and_end(
12345,
12378
)
);
} // End of testcase tc_ValidityRestriction_02
testcase tc_ValidityRestriction_03() runs on TCType system TCType {
test_PDU<ValidityRestriction>(
m_validity_restriction_time_start_and_duration(
12345,
m_duration_in_seconds(
456
)
)
);
} // End of testcase tc_ValidityRestriction_03
testcase tc_ValidityRestriction_04() runs on TCType system TCType {
test_PDU<ValidityRestriction>(
m_validity_restriction_region(
m_geographicRegion_identifiedRegion(
m_identifiedRegion_02
)
)
);
} // End of testcase tc_ValidityRestriction_04
/**
* @desc Root certificate self signed
* @verdict
*/
testcase tc_Certificate_01() runs on TCType system TCType {
test_PDU<Certificate>(
m_certificate(
m_signerInfo_self,
m_subject_info_root_ca('455453495f506c7567746573745f526f6f74'O), // ETSI_Plugtest_Root
{
m_subject_attribute_verification_key(
m_publicKey_eccPoint(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'63eb5c4ea82bc6a6b27e5857a075dce18f0e3cdc01d42896418b23f68872e41a'O,
'd04f5dfcdc2be224986e15147840ff21f709dcb6503a416207e1b8e1ce395c2a'O
)
)
),
m_subject_attribute_verification_key(
m_publicKey_aesccm(
m_aesccm(
m_eccPointecdsa_nistp256_with_sha256_uncompressed(
'4dff56b92fcf680ee694ee58473f9f7d37516c3708f108a5185c185c5f159f02'O,
'f47aa5d2514f593245dd6575613114182dc83ec67ac2a7b6726421d94c55184b'O
)
)
)
)
}, // End of field subject_attributes
{
}, // End of field validity_restrictions
m_signature(
m_ecdsaSignature(
m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
'd06ff2baf762e9618cac21bd110f271ea2a7c91355dca14753fc9a0dded1ab34'O
),
'71db2dd2ba840126e2904297f34386ccdfe86a0ebe0e585748517a5da49808b4'O
)
)
) // End of template m_certificate
);
} // End of testcase tc_Certificate_01
template (value) octetstring m_rootCertificate := '02000412455453495f506c7567746573745f526f6f748091000004a0ce08d329fd7be6b5af8fde7dad64e57fa5ff54dfaf9ec42b7443193c1f9d9d48e3c03250e59f895b17ca1e68cd8f5f1e9b1b06eddd0b98dfde91e88fa1199501010004e82c1957b1da51b5a00f29e51db151b30bd6ef29bd0c2f3e8e5cf457826f8660e59e4783e9b4b2a5b455263183ea88b18ae7e2d90ec805260213978014d1b2bf02202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d0052783500000a83ef7af9f3509189db625cd2e30eaefaf4f5b604d36389ece4f06b37a3923cf13ce5734485e25e360a7cf386eee795debbe9c61586de56b4fbd46d704109956'O;
template (value) octetstring m_aaCertificate := '02016da94961ba3e28810210455453495f506c7567746573745f41418091000004c368a797aa7943e4176aa5004d37eec5e12b92fea6b9630a9e197a10702f0f495c775d0e12bdbb21eb18648409443072ff2a383d51b5f7a5a7dca88434b5bb8801010004b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac113b244be4855cbb05cc7302903d043fe36d5abaa1b331b8c4de3e74c212cfac11302202006c04080c0408124011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d00527835000004c004618e92921341bcded2f15c58f50aa3590e59a3a798fe1a3b2364d66d8823b855859920f3e7f96e66f85ce90cee26ac71cb2ee9fbeecb64747ce19c50804'O;
template (value) octetstring m_atCertificate := '0201ebdb26e96a88ea1b01008095000004ceb7c449075ce00c1e7e1f997d443194dcf904f01f6149d4287bdcdb3bad251aa882d59fe8747108e2980c663353967a152c5b27cd83e055f93bc9b9da265859010100044d1c988453d69cae826f8a14f46d672d000b777c606a05b1b622a11f356fb2facba1fa6f2fb2ba44d47765dc6062966ded39161a5222799af887508767b657ec0220210ac040800100c04081010024011464b4031a5617030303181db9cf7c052616001db9566e0526872a1d53f0d005278350000050804677f295dbd99a64aaec8d100f07efd14234a6152012fd1371c32ff1e4479543df14c2de7d744c8526ed330bca75f05e30361a25c11dd2c83bbdf495f81f'O;
testcase tc_Certificate_02() runs on TCType system TCType {
test_decodePDU<Certificate>(
mw_certificate_dummy,
m_rootCertificate
);
} // End of testcase tc_Certificate_02
testcase tc_Certificate_03() runs on TCType system TCType {
test_decodePDU<Certificate>(
mw_certificate_dummy,
m_aaCertificate
);
} // End of testcase tc_Certificate_03
testcase tc_Certificate_04() runs on TCType system TCType {
test_decodePDU<Certificate>(
mw_certificate_dummy,
m_atCertificate
);
} // End of testcase tc_Certificate_04
testcase tc_Certificate_05() runs on TCType system TCType {
var Certificate v_ca;
var Certificate v_aa;
var Certificate v_at;
var bitstring v_encMsg;
var integer v_res;
var HashedId8 v_hashedId8;
var HashedId3 v_hashedId3;
// AT certificate
v_res := decvalue(oct2bit(m_atCertificate), v_at);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// AA certificate
v_res := decvalue(oct2bit(m_aaCertificate), v_aa);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// CA certificate
v_res := decvalue(oct2bit(m_rootCertificate), v_ca);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// AT-AA certificates
v_hashedId8 := f_calculateDigestFromCertificate(v_aa);
if (v_hashedId8 != v_at.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// AA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
log("ca v_hashedId8=", v_hashedId8);
log("aa digest=", v_aa.signer_info.signerInfo.digest);
if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// CA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
if (v_hashedId8 != '6DA94961BA3E2881'O) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('6DA94961BA3E2881'O)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
setverdict(pass, "All Digests match.");
} // End of testcase tc_Certificate_05
testcase tc_Certificate_06() runs on TCType system TCType {
const octetstring c_rootCertificate := '02000412455453495F506C7567746573745F526F6F748091000004D901D55569384486DD3304FCFD89A970011A66A5F18BC2BB1D492E2BF19B56C3EEEAE3795D67E398081AD6A7E276147F97902C87811B565E302928141AF3EF61010100043B3D45D5DB2F9540BA3EB2644F5920DCB365FDA9F572817DC1FE1EBBB54CD8B51CFF642167EB4492F953655F80007E51569369F3A95EC045CF4D4743E80E1C6602202006C04080C0408124011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000FEEBD0AEC2ACB4C20553000190C8874894239446A6949C5421D67C297EC8D2E1DCB4316C5E01B59D6965AE7007F6694821498215D1FB4D3A48BB56F6C21F4D85'O;
const octetstring c_aaCertificate := '0201BCEC64124B3681F70210455453495F506C7567746573745F41418091000004B47B1576C9752B022B81CC89319D1F60F833F5F8CBF47EC8DC1E5557E5628BAEDD779C0CBD524911A21EDD6DEAE510BBA782D0F023D4A0AC6FCC239BF8CF0A98010100046EE4A2877E59CE258EDDEEA154F9491D6894E13D491128E1BF414CBE66E43EBD6EE4A2877E59CE258EDDEEA154F9491D6894E13D491128E1BF414CBE66E43EBD02202006C04080C0408124011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D005278350000001F386CA0B4B468A83154547AF33ED3B62B706B3A2F39AA00F00C55C13056CC5C6D037B0E51BB41DBC2B6A999CF04012FE34D3C12E32B8AACCF43F690B6613D4'O;
const octetstring c_atCertificate := '02016280AF8B397B202A01008095000004AD05720B46FD03AD21544B3F05924E45924F3D2D82C63259B3646309D00A40705B8A36BAA5E14172E38BDE9E1E974130D042A996B90E5BAE6765665452A17A65010100042EF8A6DD5E650B7A31A628B471380E1C2D73E1A33586D08590F667D95123F53CEE26883D1B3C066A388D43DA5A9396FB75C73309A0D50D0A6BF43C315ED42B9E0220210AC040800100C04081010024011464B4031A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D005278350000049EC38CE35F28DE07D3CC922C6DED74EF8514F422D076C0282E8BDFB95564A6C885BE5C7259AC3EAB497D6D9BB7EB4FA84005616A4E0FE4374513F1A9CFD55B7'O;
var Certificate v_ca;
var Certificate v_aa;
var Certificate v_at;
var bitstring v_encMsg;
var integer v_res;
var HashedId8 v_hashedId8;
var HashedId3 v_hashedId3;
// AT certificate
v_res := decvalue(oct2bit(c_atCertificate), v_at);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// AA certificate
v_res := decvalue(oct2bit(c_aaCertificate), v_aa);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// CA certificate
v_res := decvalue(oct2bit(c_rootCertificate), v_ca);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// AT-AA certificates
v_hashedId8 := f_calculateDigestFromCertificate(v_aa);
if (v_hashedId8 != v_at.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// AA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// CA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
if (v_hashedId8 != 'bcec64124b3681f7'O) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('bcec64124b3681f7'O)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
setverdict(pass, "All Digests match.");
} // End of testcase tc_Certificate_06
testcase tc_Certificate_07() runs on TCType system TCType {
const octetstring c_rootCertificate := '02000412455453495F506C7567746573745F526F6F748091000004B0280BAABCD2C785974EB25239B6933AA1AF70C2D75190B7B7B53D1E573788F4B41F81BCFF61C8C73D0FCCD602A894C63BF21221E83F015FF1BBD86C92FFE384010100040DC17DEF569DB90C3E4E26B103343E341B328FCFC62B7D169FE9DDD8B7C11448E228BA6A15BB433C03DCAD1F26CAF0FD5773CE25B6C02B82D4AB83CAF70547B902202006C04080C040812401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D00527835000005D052E72F7B299EEB17D20EA1017B490EBA59641ADCE278D8D096D2FA2F91D87A215199038D7717A3F398669ACEAB375B0374585A06D72E4161AD5BB3ADEE400'O;
const octetstring c_aaCertificate := '0201071464374303551A0210455453495F506C7567746573745F41418091000004445C581921F79D72A55107984375641C446DFD2A74EB524DB4E00D6C3ADCE038217319C66433EE802632B2EA3B40552541711A092DE2CA59CB7AA8FD8E8EB819010100043B29698A6F21AD6BF17E5E397B85D404846BA7E5B813BF0CFE761649127B40653B29698A6F21AD6BF17E5E397B85D404846BA7E5B813BF0CFE761649127B406502202006C04080C040812401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000CC73A819EE49906B5A27F9EECF94BA74599A834A6A8DCBE0D6F2D1EC3BB79B622596F07B5D0C777CB4478E8D3F34854F69859EF5D0F0C976800BD57571B13A71'O;
const octetstring c_atCertificate := '020130734784EEE700B70100809500000478A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF5201010004CF9EDB415860E74350607D809CD1D1EF0CD072E08DED4537F8E27D9583331910EC79523076F5B530926F0CD35EF48E668BCE3A8FB23930BFCFE438745799D8CD0220210AC040800100C0408101002401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O;
var Certificate v_ca;
var Certificate v_aa;
var Certificate v_at;
var bitstring v_encMsg;
var integer v_res;
var HashedId8 v_hashedId8;
var HashedId3 v_hashedId3;
// AT certificate
v_res := decvalue(oct2bit(c_atCertificate), v_at);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
v_hashedId8 := f_calculateDigestFromCertificate(v_at);
log("AT hashedId8=", v_hashedId8);
// AA certificate
v_res := decvalue(oct2bit(c_aaCertificate), v_aa);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// CA certificate
v_res := decvalue(oct2bit(c_rootCertificate), v_ca);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
// AT-AA certificates
v_hashedId8 := f_calculateDigestFromCertificate(v_aa);
if (v_hashedId8 != v_at.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_at.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// AA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
if (v_hashedId8 != v_aa.signer_info.signerInfo.digest) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(v_aa.signer_info.signerInfo.digest)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
// CA-CA certificate
v_hashedId8 := f_calculateDigestFromCertificate(v_ca);
if (v_hashedId8 != '071464374303551a'O) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8('071464374303551a'O)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
setverdict(pass, "All Digests match.");
} // End of testcase tc_Certificate_07
testcase tc_Certificate_V2X_Pilot_PKI_08() runs on TCType system TCType {
const octetstring c_rootCertificate := '010100040d50696c6f74504b495f526f6f74808900000410c1b6c130e84711b558e69ce0fbc17de6b9a6c42bb7e1b962ef4cd5b07dadf8d214c65d8b7bd24acce01edfe5f186a94217de25e454763f5d83a1161860d6fc010100049b7d10065669dfe403ceb43e2a57b8061c86b9b8a0adf2ece2fefd5a09872525b89f1d8732a4d761e68446c23fb845cd5c8172d3067b9c61cdefbd6923c1fbc002e00b0105a4ec0110ec21010300000008610502f11fc54ca9d198de0177dd571f12e5945a771e20ceda080a00fbfc0d00b0b38f6ac60c18f2cd79d90c2afe45bd76349e0454817e184f92bf87d7c9b4'O;
const octetstring c_rootCertId := '83CA2168B784FC6C'O;
const octetstring c_rootCrlCertificate := '010102b98efc434cffbe83ca2168b784fc6c000000010000002308e8352a08e8352a08faaa2a0000000058ed8b300faccc408d68408da414c251f1f922927c3bfa1d35d4cdbec5e2294e7145eb6b673153c7f2311e3ab79183850aee7395b773c628dfbd5fab283695db'O;
var Certificate v_decMsg;
var HashedId8 v_hashedId8;
var integer v_res;
// CA certificate
v_res := decvalue(oct2bit(c_rootCertificate), v_decMsg);
if (v_res != 0) {
setverdict(fail, "Decoding failed.");
stop;
}
log("v_rootCertificate: ", v_decMsg);
v_hashedId8 := f_calculateDigestFromCertificate(v_decMsg);
if (v_hashedId8 != c_rootCertId) {
setverdict(fail, "Digest does not match.");
stop;
} else {
setverdict(pass, "Digest match.");
}
if (substr(v_hashedId8, lengthof(v_hashedId8) - 3, 3) != f_HashedId3FromHashedId8(c_rootCertId)) {
setverdict(fail, "HashedId3 digest does not match.");
stop;
} else {
setverdict(pass, "HashedId3 digest match.");
}
log("v_hashedId8: ", v_hashedId8);
// CA CRL certificate
// v_res := decvalue(oct2bit(c_rootCrlCertificate), v_decMsg);
// if (v_res != 0) {
// setverdict(fail, "Decoding failed.");
// stop;
// }
// log("c_rootCrlCertificate: ", v_decMsg);
setverdict(pass, "All Digests match.");
} // End of testcase tc_Certificate_08
} // End of group certificates
group profileCertificates {
/**
* @desc Validate 'verify signature' external function
*/
testcase tc_profileCertificates_01() runs on TCType system TCType {
var boolean v_result;
v_result := f_verifyWithEcdsaNistp256WithSha256(
'020130734784EEE700B70100809500000478A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF5201010004CF9EDB415860E74350607D809CD1D1EF0CD072E08DED4537F8E27D9583331910EC79523076F5B530926F0CD35EF48E668BCE3A8FB23930BFCFE438745799D8CD0220210AC040800100C0408101002401146B4B831A5617030303181DB9CF7C052616001DB9566E0526872A1D53F0D0052783500000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O,
'0000DD8EE9C52CD6AA87C565781D9C299C7057C6322E0815C4428411CDCE2374293EE9E24B5462CA603DC69278A47707191D1F9A6F0EB166C88569F70451C55EEED4'O,
'78A4897E6AC66EF68AE98839F05038D926661D0130EDD65B1EA733824FA4E606'O,
'B223240C3CF3697EF2C1EC2F3E5D35875D120C5A27E4DDB7C87E01C236A7CF52'O
);
if (v_result == true) {
setverdict(pass, "Certificate verification match");
} else {
setverdict(fail, "Certificate verification mismatch");
}
} // End of testcase tc_profileCertificates_01
/**
* @desc Verify AT certificate signature
*/
testcase tc_profileCertificates_02() runs on TCType system TCType {
var boolean v_result;
f_loadCertificates("cfg01");
v_result := f_verifyCertificateSignatureWithIssuingCertificate(
vc_atCertificate,
vc_aaCertificate
);
if (v_result == true) {
setverdict(pass, "Certificate verification match");
} else {
setverdict(fail, "Certificate verification mismatch");
}
} // End of testcase tc_profileCertificates_02
} // End of group profileCertificates
} // End of group test_LibItsSecurity_TypesAndValues
} // End of module test_LibItsSecurity_TypesAndValues
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+URL Id
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: unittests/codec/ttcn/test_all.ttcn3
===================================================================
--- unittests/codec/ttcn/test_all.ttcn3 (revision 1828)
+++ unittests/codec/ttcn/test_all.ttcn3 (revision 1829)
@@ -16,4 +16,6 @@
import from test_LibItsExternalFunctions all;
+ import from test_LibItsSecurity_TypesAndValues all;
+
} // End of module test_all
\ No newline at end of file