Commit 0a965eb9 authored by berge's avatar berge
Browse files

Merged revision(s) 1839-1901 from branches/STF484_VALIDATION

parent c89d62ed
......@@ -8,6 +8,7 @@
*/
package org.etsi.its.adapter.layers;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
......@@ -121,6 +122,9 @@ public class BtpLayer extends Layer {
byte[] payload = new byte[payloadLength];
System.arraycopy(message, 4, payload, 0, payloadLength);
lowerInfo.put(BTP_DSTPORT, dstPort);
lowerInfo.put(BTP_DSTPORTINFO, srcPort);
super.receive(payload, lowerInfo);
}
}
......@@ -79,7 +79,16 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
* Parameter name for destination area's angle
*/
public static final String GN_ANGLE = "GnAngle";
/**
* Parameter name for traffic class
*/
public static final String GN_TRAFFICCLASS = "GnTrafficClass";
/**
* Parameter name for packet's lifetime
*/
public static final String GN_LIFETIME = "GnLifetime";
/**
* GeoNetworking header type for unknown messages
......@@ -295,15 +304,20 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
public void receive(byte[] message, Map<String, Object> lowerInfo) {
// System.out.println(">>> GnLayer.receive: " + ByteHelper.byteArrayToString(message));
byte[] basicHdr = new byte[4]; // TODO To be removed
byte[] basicHdr = new byte[4];
System.arraycopy(message, 4, basicHdr, 0, 4);
byte[] versionNh = new byte[1];
System.arraycopy(basicHdr, 0, versionNh, 0, 1);
int nextHeader = (int)(versionNh[0] & (byte)0x0F);
byte nextHeader = (byte)(versionNh[0] & (byte)0x0F);
int lt_multiplier = (int)(basicHdr[2] & (byte)0xFC) >> 2;
int lt_base = (int)(basicHdr[2] & (byte)0x03);
int lifetime = computeGnLifeTime(lt_multiplier, lt_base);
if (!management.isSecuredModeSet()) { // Secure mode disabled
byte[] commonHdr = new byte[8];
System.arraycopy(message, 4, commonHdr, 0, 8);
nextHeader = (byte)((commonHdr[0] & (byte)0xF0) >> 4);
int trafficClass = (int)(commonHdr[2]);
byte[] htHst = new byte[1];
System.arraycopy(commonHdr, 1, htHst, 0, 1);
......@@ -343,6 +357,10 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
byte[] payload = new byte[payloadLength];
System.arraycopy(message, message.length - payloadLength, payload, 0, payloadLength);
lowerInfo.put(GN_NEXTHEADER, nextHeader);
lowerInfo.put(GN_TYPE, headerType);
lowerInfo.put(GN_SUBTYPE, headerSubType);
lowerInfo.put(GN_LIFETIME, lifetime);
lowerInfo.put(GN_TRAFFICCLASS, trafficClass);
super.receive(payload, lowerInfo);
}
}
......@@ -395,6 +413,8 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
byte[] commonHdr = new byte[8];
System.arraycopy(message, offset, commonHdr, 0, 8);
// System.out.println("GnLayer.receive: commonHdr: " + ByteHelper.byteArrayToString(commonHdr));
nextHeader = (byte)((commonHdr[0] & (byte)0xF0) >> 4);
int trafficClass = (int)(commonHdr[2]);
byte[] htHst = new byte[1];
System.arraycopy(commonHdr, 1, htHst, 0, 1);
......@@ -432,9 +452,11 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
if(payloadLength > 0) {
byte[] payload = new byte[payloadLength];
System.arraycopy(message, message.length - payloadLength - 68, payload, 0, payloadLength);
// System.out.println("GnLayer.receive: payload: " + ByteHelper.byteArrayToString(payload));
lowerInfo.put(GN_NEXTHEADER, nextHeader);
// System.out.println("GnLayer.receive: call super.receive: " + ByteHelper.byteArrayToString(payload));
lowerInfo.put(GN_TYPE, headerType);
lowerInfo.put(GN_SUBTYPE, headerSubType);
lowerInfo.put(GN_LIFETIME, lifetime);
lowerInfo.put(GN_TRAFFICCLASS, trafficClass);
super.receive(payload, lowerInfo);
}
}
......@@ -443,6 +465,19 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
} // End of method receive
/**
* Computes GN lifetime value
* @param lt_multiplier GN LT multiplier
* @param lt_base GN LT base
* @return GN lifetime value in ms
*/
private int computeGnLifeTime(int lt_multiplier, int lt_base) {
final int[] base = {50, 1000, 10000, 100000};
return base[lt_base] * lt_multiplier;
}
/**
* Builds encoded Basic Header
* @return Encoded Basic Header
*/
......
......@@ -9,7 +9,9 @@
package org.etsi.its.adapter.ports;
import java.util.HashMap;
import java.util.Map;
import org.etsi.common.ByteHelper;
import org.etsi.its.adapter.layers.BtpLayer;
import org.etsi.its.adapter.layers.GnLayer;
......@@ -18,7 +20,7 @@ import org.etsi.its.adapter.layers.GnLayer;
*/
public class CamPort extends ProtocolPort {
/**
/**
* Constructor
* @param portName Name of the port
* @param componentName Name of the component owning this port instance
......@@ -29,6 +31,25 @@ public class CamPort extends ProtocolPort {
super(portName, componentName, lowerStackDesc, linkLayerAddress);
}
/* (non-Javadoc)
* @see org.etsi.its.adapter.ports.ProtocolPort#receive(byte[], java.util.Map)
*/
@Override
public void receive(byte[] message, Map<String, Object> lowerInfo) {
// Encode with CAM indication header
byte[] msgInd = ByteHelper.concat(
message,
(byte[])lowerInfo.get(GnLayer.GN_NEXTHEADER),
(byte[])lowerInfo.get(GnLayer.GN_TYPE),
(byte[])lowerInfo.get(GnLayer.GN_SUBTYPE),
(byte[])lowerInfo.get(GnLayer.GN_LIFETIME),
(byte[])lowerInfo.get(GnLayer.GN_TRAFFICCLASS),
(byte[])lowerInfo.get(BtpLayer.BTP_DSTPORT),
(byte[])lowerInfo.get(BtpLayer.BTP_DSTPORTINFO));
super.receive(msgInd, lowerInfo);
}
/* (non-Javadoc)
* @see org.etsi.its.adapter.ports.IPort#send(byte[])
*/
......
......@@ -9,7 +9,9 @@
package org.etsi.its.adapter.ports;
import java.util.HashMap;
import java.util.Map;
import org.etsi.common.ByteHelper;
import org.etsi.its.adapter.layers.BtpLayer;
import org.etsi.its.adapter.layers.GnLayer;
......@@ -29,6 +31,25 @@ public class DenmPort extends ProtocolPort {
super(portName, componentName, lowerStackDesc, linkLayerAddress);
}
/* (non-Javadoc)
* @see org.etsi.its.adapter.ports.ProtocolPort#receive(byte[], java.util.Map)
*/
@Override
public void receive(byte[] message, Map<String, Object> lowerInfo) {
// Encode with CAM indication header
byte[] msgInd = ByteHelper.concat(
message,
(byte[])lowerInfo.get(GnLayer.GN_NEXTHEADER),
(byte[])lowerInfo.get(GnLayer.GN_TYPE),
(byte[])lowerInfo.get(GnLayer.GN_SUBTYPE),
(byte[])lowerInfo.get(GnLayer.GN_LIFETIME),
(byte[])lowerInfo.get(GnLayer.GN_TRAFFICCLASS),
(byte[])lowerInfo.get(BtpLayer.BTP_DSTPORT),
(byte[])lowerInfo.get(BtpLayer.BTP_DSTPORTINFO));
super.receive(msgInd, lowerInfo);
}
/* (non-Javadoc)
* @see org.etsi.its.adapter.ports.IPort#send(byte[])
*/
......
......@@ -64,6 +64,7 @@ public class CodecFactory {
org.etsi.ttcn.codec.its.geonetworking.Plugin.init();
org.etsi.ttcn.codec.its.btp.Plugin.init();
org.etsi.ttcn.codec.its.security.Plugin.init();
org.etsi.ttcn.codec.its.facilities.Plugin.init();
}
}
......
/**
* @author ETSI / STF462 / Alexandre Berge
* @version $URL$
* $Id$
*/
package org.etsi.ttcn.codec.its.facilities;
import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Record;
import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;
public class FacilitiesInd extends Record {
public FacilitiesInd(MainCodec mainCodec) {
super(mainCodec);
}
@Override
protected void preDecode(CodecBuffer buf, Type decodingHypothesis) {
int msgLen = buf.getNbBits() - 8 - 8 - 8 - 32 - 8 - 16 - 16;
int offset = 0;
messageBuffer = buf.getBuffer(offset, msgLen); offset += msgLen;
gnNh = buf.getBuffer(offset, 8); offset += 8;
gnHt = buf.getBuffer(offset, 8); offset += 8;
gnHst = buf.getBuffer(offset, 8); offset += 8;
gnLifetime = buf.getBuffer(offset, 32); offset += 32;
gnTc = buf.getBuffer(offset, 8); offset += 8;
btpDestinationPort = buf.getBuffer(offset, 16); offset += 16;
btpInfo = buf.getBuffer(offset, 16); offset += 16;
}
@Override
protected void preDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {
if(fieldName.equals("gnNextHeader")) {
buf.overwriteWith(gnNh);
}
else if(fieldName.equals("gnHeaderType")) {
buf.overwriteWith(gnHt);
}
else if(fieldName.equals("gnHeaderSubtype")) {
buf.overwriteWith(gnHst);
}
else if(fieldName.equals("gnLifetime")) {
buf.overwriteWith(gnLifetime);
}
else if(fieldName.equals("gnTrafficClass")) {
buf.overwriteWith(gnTc);
}
else if(fieldName.equals("btpDestinationPort")) {
buf.overwriteWith(btpDestinationPort);
}
else if(fieldName.equals("btpInfo")) {
buf.overwriteWith(btpInfo);
}
else {
buf.overwriteWith(messageBuffer);
}
}
@Override
protected void postDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {
}
@Override
public CodecBuffer encode(Value value) {
return super.encode(value);
}
private CodecBuffer messageBuffer = null;
private CodecBuffer gnNh = null;
private CodecBuffer gnHt = null;
private CodecBuffer gnHst = null;
private CodecBuffer gnLifetime = null;
private CodecBuffer gnTc = null;
private CodecBuffer btpDestinationPort = null;
private CodecBuffer btpInfo = null;
}
/**
* @author ETSI / STF484 / Alexandre Berge
* @version $URL$
* $Id$
*/
package org.etsi.ttcn.codec.its.facilities;
import org.etsi.ttcn.tci.TciTypeClass;
import org.etsi.ttcn.codec.CodecFactory;
public class Plugin {
public static void init() {
CodecFactory cf = CodecFactory.getInstance();
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "CamInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "DenmInd", FacilitiesInd.class);
}
}
\ No newline at end of file
......@@ -96,6 +96,7 @@ public class UtDenmTrigger extends UtRecord implements IMarkerCallback {
validityDuration(0x80),
repetitionDuration(0x40),
transmissionInterval(0x04),
repetitionInterval(0x02),
/* DenmUpdate */
//validityDuration(0x80),
......@@ -104,6 +105,7 @@ public class UtDenmTrigger extends UtRecord implements IMarkerCallback {
relevanceTrafficDirection(0x10),
trafficClass(0x08),
//transmissionInterval(0x04),
//repetitionInterval(0x02),
/* Reserved */
reserved(0x00);
......
This diff is collapsed.
......@@ -16,34 +16,27 @@ module ItsCam_TestControl {
// Test Execution
control {
execute(TC_CAM_MSD_FMT_BV_01());
if ( PICS_LOWFREQUENCYCONTAINER ) {
if(PICS_CAM_GENERATION) {
execute(TC_CAM_MSD_FMT_BV_01());
execute(TC_CAM_MSD_FMT_BV_02());
execute(TC_CAM_MSD_FMT_BV_03());
}
if ( PICS_SPECIALVEHICLECONTAINER ) {
execute(TC_CAM_MSD_FMT_BV_04());
execute(TC_CAM_MSD_FMT_BV_05());
}
execute(TC_CAM_MSD_INA_BV_01_01());
execute(TC_CAM_MSD_INA_BV_01_02());
execute(TC_CAM_MSD_INA_BV_01_03());
execute(TC_CAM_MSD_INA_BV_01_04());
execute(TC_CAM_MSD_INA_BV_01_05());
execute(TC_CAM_MSD_INA_BV_01_06());
execute(TC_CAM_MSD_INA_BV_01_07());
execute(TC_CAM_MSD_INA_BV_01_08());
execute(TC_CAM_MSD_INA_BV_01_09());
execute(TC_CAM_MSD_INA_BV_01_10());
execute(TC_CAM_MSD_INA_BV_01_11());
execute(TC_CAM_MSD_INA_BV_01_12());
execute(TC_CAM_MSD_INA_BV_01_13());
execute(TC_CAM_MSD_INA_BV_01_14());
execute(TC_CAM_MSD_INA_BV_01_15());
if (PICS_LOWFREQUENCYCONTAINER) {
execute(TC_CAM_MSD_INA_BV_01_01());
execute(TC_CAM_MSD_INA_BV_01_02());
execute(TC_CAM_MSD_INA_BV_01_03());
execute(TC_CAM_MSD_INA_BV_01_04());
execute(TC_CAM_MSD_INA_BV_01_05());
execute(TC_CAM_MSD_INA_BV_01_06());
execute(TC_CAM_MSD_INA_BV_01_07());
execute(TC_CAM_MSD_INA_BV_01_08());
execute(TC_CAM_MSD_INA_BV_01_09());
execute(TC_CAM_MSD_INA_BV_01_10());
execute(TC_CAM_MSD_INA_BV_01_11());
execute(TC_CAM_MSD_INA_BV_01_12());
execute(TC_CAM_MSD_INA_BV_01_13());
execute(TC_CAM_MSD_INA_BV_01_14());
execute(TC_CAM_MSD_INA_BV_01_15());
execute(TC_CAM_MSD_INA_BV_01_16());
execute(TC_CAM_MSD_INA_BV_01_17());
execute(TC_CAM_MSD_INA_BV_01_18());
......@@ -60,14 +53,11 @@ module ItsCam_TestControl {
execute(TC_CAM_MSD_INA_BV_01_29());
execute(TC_CAM_MSD_INA_BV_01_30());
execute(TC_CAM_MSD_INA_BV_01_31());
}
execute(TC_CAM_MSD_INA_BV_01_32());
execute(TC_CAM_MSD_INA_BV_01_33());
execute(TC_CAM_MSD_INA_BV_01_34());
execute(TC_CAM_MSD_INA_BV_01_35());
if (PICS_SPECIALVEHICLECONTAINER) {
execute(TC_CAM_MSD_INA_BV_01_32());
execute(TC_CAM_MSD_INA_BV_01_33());
execute(TC_CAM_MSD_INA_BV_01_34());
execute(TC_CAM_MSD_INA_BV_01_35());
if (PICS_PUBLICTRANS) {
execute(TC_CAM_MSD_INA_BV_02());
}
......@@ -89,17 +79,25 @@ module ItsCam_TestControl {
if (PICS_SAFETY_CAR) {
execute(TC_CAM_MSD_INA_BV_08());
}
}
execute(TC_CAM_MSD_GFQ_TI_01());
execute(TC_CAM_MSD_GFQ_TI_02());
execute(TC_CAM_MSD_GFQ_TI_03());
execute(TC_CAM_MSD_GFQ_BV_04());
execute(TC_CAM_MSD_GFQ_BV_05());
execute(TC_CAM_MSD_GFQ_BV_06());
execute(TC_CAM_MSD_GFQ_TI_07());
execute(TC_CAM_MSD_GFQ_TI_08());
execute(TC_CAM_MSD_PAR_BV_01());
execute(TC_CAM_MSD_PAR_BV_02());
execute(TC_CAM_MSD_PAR_BV_03());
}
execute(TC_CAM_MSD_GFQ_BV_01());
execute(TC_CAM_MSD_GFQ_BV_02());
execute(TC_CAM_MSD_GFQ_BV_03());
execute(TC_CAM_MSD_GFQ_BV_04());
execute(TC_CAM_MSD_GFQ_BV_05());
execute(TC_CAM_MSD_GFQ_BV_06());
execute(TC_CAM_MSD_GFQ_BV_07());
execute(TC_CAM_MSP_BV_01());
if(PICS_CAM_RECEPTION) {
execute(TC_CAM_MSP_BV_01());
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -10,58 +10,94 @@ module ItsDenm_TestControl {
// ATS DENM
import from ItsDenm_TestCases {testcase all};
// LibIts
import from LibItsDenm_Pics all;
// Test Execution
control {
execute(TC_DEN_MSGF_BV_01());
execute(TC_DEN_MSGF_BV_02());
if(PICS_DENM_GENERATION) {
execute(TC_DEN_MSGF_BV_01());
execute(TC_DEN_MSGF_BV_02());
execute(TC_DEN_EVGN_BV_01());
execute(TC_DEN_EVGN_BV_02());
execute(TC_DEN_EVGN_BV_03());
execute(TC_DEN_EVGN_BV_04());
execute(TC_DEN_EVGN_BV_05());
execute(TC_DEN_EVGN_BV_07());
execute(TC_DEN_EVGN_BV_08());
execute(TC_DEN_EVGN_BV_10());
}
if(PICS_DENM_UPDATE) {
execute(TC_DEN_EVUP_BV_01());
execute(TC_DEN_EVUP_BV_02());
execute(TC_DEN_EVUP_BV_03());
execute(TC_DEN_EVUP_BO_04());
}
execute(TC_DEN_EVGN_BV_01());
execute(TC_DEN_EVGN_BV_02());
execute(TC_DEN_EVGN_BV_03());
execute(TC_DEN_EVGN_BV_04());
execute(TC_DEN_EVGN_BV_05());
execute(TC_DEN_EVGN_BV_07());
execute(TC_DEN_EVGN_BV_08());
if(PICS_DENM_CANCELLATION) {
execute(TC_DEN_EVTR_BV_01());
execute(TC_DEN_EVTR_BV_04());
execute(TC_DEN_EVTR_BV_08());
}
execute(TC_DEN_EVUP_BV_01());
execute(TC_DEN_EVUP_BV_02());
execute(TC_DEN_EVUP_BV_03());
execute(TC_DEN_EVUP_BV_04());
if(PICS_DENM_NEGATION) {
execute(TC_DEN_EVTR_BV_02());
execute(TC_DEN_EVTR_BV_03());
execute(TC_DEN_EVTR_BV_05());
}
execute(TC_DEN_EVTR_BV_01());
execute(TC_DEN_EVTR_BV_02());
execute(TC_DEN_EVTR_BV_03());
execute(TC_DEN_EVTR_BV_04());
execute(TC_DEN_EVTR_BV_05());
execute(TC_DEN_EVTR_BV_06());
execute(TC_DEN_EVTR_BV_07());
if(PICS_DENM_NEGATION or PICS_DENM_CANCELLATION) {
execute(TC_DEN_EVTR_BO_06());
execute(TC_DEN_EVTR_BO_07());
}
execute(TC_DEN_EVRP_BV_01());
execute(TC_DEN_EVRP_BV_02());
execute(TC_DEN_EVRP_BV_03());
execute(TC_DEN_EVRP_BV_04());
execute(TC_DEN_EVRP_BV_05());
execute(TC_DEN_EVRP_BV_06());
if(PICS_DENM_REPETITION) {
execute(TC_DEN_EVRP_TI_01());
execute(TC_DEN_EVRP_BV_02());
execute(TC_DEN_EVRP_BV_03());
execute(TC_DEN_EVRP_BV_04());
execute(TC_DEN_EVRP_BV_05());
execute(TC_DEN_EVRP_BV_06());
execute(TC_DEN_EVRP_BV_08());
execute(TC_DEN_EVRP_BV_09());
execute(TC_DEN_EVRP_BV_10());
execute(TC_DEN_EVRP_BV_11());
}
if(PICS_DENM_GENERATION) {
execute(TC_DEN_PAR_BV_01());
execute(TC_DEN_PAR_BV_02());
}
execute(TC_DEN_MSRV_BV_01());
execute(TC_DEN_MSRV_BV_02());
execute(TC_DEN_MSRV_BV_03());
execute(TC_DEN_MSRV_BV_04());
execute(TC_DEN_MSRV_BV_05());
execute(TC_DEN_MSRV_BV_06());
execute(TC_DEN_MSRV_BV_07());
if(PICS_DENM_RECEPTION) {
execute(TC_DEN_MSRV_BV_01());
execute(TC_DEN_MSRV_BV_02());
execute(TC_DEN_MSRV_BO_03());
execute(TC_DEN_MSRV_BO_04());
execute(TC_DEN_MSRV_BO_05());
execute(TC_DEN_MSRV_BO_06());
execute(TC_DEN_MSRV_BV_07());
if(PICS_IMPACT_REDUCTION) {
execute(TC_DEN_MSRV_BV_10());
}
}
execute(TC_DEN_KAFW_BV_01());
execute(TC_DEN_KAFW_BV_02());
execute(TC_DEN_KAFW_BV_03());
execute(TC_DEN_KAFW_BV_04());
execute(TC_DEN_KAFW_BV_05());
execute(TC_DEN_KAFW_BV_06());
execute(TC_DEN_KAFW_BV_07());
execute(TC_DEN_KAFW_BV_08());
execute(TC_DEN_KAFW_BV_09());
execute(TC_DEN_KAFW_BV_10());
if(PICS_DENM_KAF) {
execute(TC_DEN_KAFW_BV_01());
execute(TC_DEN_KAFW_BV_02());
execute(TC_DEN_KAFW_TI_03());
execute(TC_DEN_KAFW_BV_04());
execute(TC_DEN_KAFW_BV_05());
execute(TC_DEN_KAFW_BV_06());
execute(TC_DEN_KAFW_BV_07());
execute(TC_DEN_KAFW_BV_08());
execute(TC_DEN_KAFW_BV_09());
execute(TC_DEN_KAFW_BV_10());
}
}
} // end ItsDenm_TestControl
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -26,7 +26,7 @@ module ItsMapSpat_TestCases {
import from ITS_Container language "ASN.1:1997" all;
import from DSRC language "ASN.1:1997" all;
import from EU language "ASN.1:1997" all;
import from REG_D language "ASN.1:1997" all;
group MapSpatMessageDissemination {
......@@ -53,7 +53,7 @@ module ItsMapSpat_TestCases {
*
* @version 0.0.1