Commit b5cfb26e authored by garciay's avatar garciay

ITS-CMS5 Plugtest validation

Add Evcsn
parent 32c3e6d9
......@@ -269,10 +269,11 @@ public class PcapMultiplexer implements Runnable {
int r = pcap.compile(bpfFilter, filter, optimize, netmask);
if (r != Pcap.OK) {
TERFactory.getInstance().logError("Filter error: " + pcap.getErr());
}
r = pcap. setFilter(bpfFilter);
if (r != Pcap.OK) {
TERFactory.getInstance().logError("Filter error: " + pcap.getErr());
} else {
r = pcap. setFilter(bpfFilter);
if (r != Pcap.OK) {
TERFactory.getInstance().logError("Filter error: " + pcap.getErr());
}
}
}
......
......@@ -370,6 +370,7 @@ public class SecurityHelper {
(p_headerfields[signerInfoTypeIndex] != 0x89) && // SPATEM
(p_headerfields[signerInfoTypeIndex] != 0x8a) && // MAPEM
(p_headerfields[signerInfoTypeIndex] != 0x8b) && // IVIM
(p_headerfields[signerInfoTypeIndex] != 0x8d) && // EVCSN TODO Use the correct value
(p_headerfields[signerInfoTypeIndex] != 0x8c) // SREM/SSEM
) {
if (p_enforceSecurityCheck) {
......
......@@ -32,7 +32,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
private static final int SourcePort = 7943;
private static final int ItsAid = 5;
private static final int InterfaceID = 2;
private static final int TxPowerDbm = -31; // Max value: -33dBm, RSU: -30dBm, Lab: -10dBm
private static final int TxPowerDbm = -32; // Max value: -33dBm, RSU: -30dBm, Lab: -10dBm
private static String pcapFilter = null;
/**
......@@ -62,9 +62,9 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
try {
itsApplication.connect(1000);
itsApplication.registerBlocking();
itsApplication.setFacilityModuleStatus(FacilityModule.BSM, false);
itsApplication.setFacilityModuleStatus(FacilityModule.CAM, false);
itsApplication. gnBindBlocking(BTPType.NONE, 65535);
// itsApplication.setFacilityModuleStatus(FacilityModule.BSM, false);
// itsApplication.setFacilityModuleStatus(FacilityModule.CAM, false);
// itsApplication. gnBindBlocking(BTPType.NONE, 65535);
} catch (TimeoutException e) {
e.printStackTrace();
} catch (InterruptedException e) {
......@@ -106,19 +106,25 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
}
if(ClientsToMacs.isEmpty()) {
pcapFilter = "udp dst port " + SourcePort + " and ";
pcapFilter =
"udp dst port " + SourcePort +
// " and not ether[0x56:4]==0x04e54800 and not ether[0x56:4]==0x04f02122 and not ether[0x56:4]==0xa60e3f16 and not ether[0x56:4]==0x04e54800 and not ether[0x56:4]==0x92232f44 and not ether[0x56:4]==0x4a74556d" +
" and not ether[0x56:4]==0x4a74556d" +
" and ";
} else {
TERFactory.getInstance().logDebug("CommsigniaLayer.register: Another Client !");
pcapFilter = pcapFilter + " and ";
}
// Update Filter
String strMacAddress = String.format("%02x", localMacAddress[0]);
for(int i=1; i < localMacAddress.length; i++) {
strMacAddress += String.format(":%02x", localMacAddress[i]);
}
String strMacAddress = String.format("%02x%02x%02x%02x", localMacAddress[0], localMacAddress[1], localMacAddress[2], localMacAddress[3]);
// String strMacAddress = String.format("%02x", localMacAddress[0]);
// for(int i=1; i < localMacAddress.length; i++) {
// strMacAddress += String.format(":%02x", localMacAddress[i]);
// }
//udp dst port 7493 && wlan src 8b:ad:f0:0d:01:02
pcapFilter = pcapFilter + "not wlan src " + strMacAddress;
pcapFilter = pcapFilter + "not ether[0x56:4]==0x" + strMacAddress;
// Reset filter
System.out.println("Reset PCAP filter: " + pcapFilter);
PcapMultiplexer.getInstance().resetFilter(pcapFilter);
// Register client
ClientsToMacs.put(this.toString(), localMacAddress);
......@@ -143,7 +149,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
byteBuffer.position(
20 + // IP Layer: 45 00 01 1f 13 8c 00 00 80 11 6b 0b ac 11 0f 26 ff ff ff ff
8 + // UDP Layer: 75 30 1f 07 01 0b a6 cd
29 + // C2P Layer: 12 00 00 33 41 00 00 03 5c ac 00 02 0c 02 35 a4 e9 01 6b 49 d2 01 3f ff 00 00 7f ff 16
34 + // C2P Layer: 12 00 00 33 41 00 00 03 5c ac 00 02 0c 02 35 a4 e9 01 6b 49 d2 01 3f ff 00 00 7f ff 16
4 // IEEE 802.11L Layer: 88 00 00 00 00
);
......@@ -159,7 +165,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
byteBuffer.position(byteBuffer.position() + 10);
// Skip LLC header
byteBuffer.position(byteBuffer.position() + 8);
byteBuffer.position(byteBuffer.position() + 6);
// Extract FrameType info
byte[] rawFrameType = new byte[2];
......@@ -254,7 +260,7 @@ public class CommsigniaLayer extends Layer implements IEthernetSpecific {
if(ClientsToMacs.isEmpty()) {
if (itsApplication != null) {
try {
itsApplication.gnCloseBlocking(BTPType.NONE, 65535);
// itsApplication.gnCloseBlocking(BTPType.NONE, 65535);
itsApplication.deregisterBlocking();
} catch (ClientException e) {
// TODO Auto-generated catch block
......
......@@ -717,6 +717,9 @@ public class GnLayer extends Layer implements Runnable, IEthernetSpecific {
case 2008:
its_aid = 140;
break;
case 2010:
its_aid = 100; // FIXME Use the correct value
break;
} // End of 'switch' statement
if (its_aid == 36) { // CAM
headersField = ByteHelper.concat(
......
......@@ -35,16 +35,13 @@ public class MainCodec extends ICodec {
@Override
public Value decode(CodecBuffer buf, Type decodingHypothesis) {
// TERFactory.getInstance().logDebug(">>> MainCodec.decode: " + decodingHypothesis.getName());
ByteHelper.dump(">>> MainCodec.decode: ", buf.getBytes());
// ByteHelper.dump(">>> MainCodec.decode: ", buf.getBytes());
CodecFactory cf = CodecFactory.getInstance();
try {
TciCDProvided extCodec = cf.getExternalCodec(decodingHypothesis.getTypeEncoding());
if(extCodec != null) {
Value v = extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
if (v != null) {
return v;//extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
} // else continue
return extCodec.decode(new TriMessageImpl(buf.getBytes()), decodingHypothesis);
}
ICodec codec = cf.getCodec(
this,
......@@ -67,6 +64,8 @@ public class MainCodec extends ICodec {
@Override
public CodecBuffer encode(Value value) {
//TERFactory.getInstance().logDebug(">>> MainCodec.encode: " + value);
//System.out.println(">>> MainCodec.encode: " + value);
CodecFactory cf = CodecFactory.getInstance();
TciCDProvided extCodec = cf.getExternalCodec(value.getValueEncoding());
......
......@@ -16,6 +16,7 @@ public class DecodedBtpPayload extends Union {
mainCodec.setHint("mapemPacket", "mapemPacket");
mainCodec.setHint("spatemPacket", "spatemPacket");
mainCodec.setHint("ivimPacket", "ivimPacket");
mainCodec.setHint("evcsnPacket", "evcsnPacket");
mainCodec.setHint("sremPacket", "sremPacket");
mainCodec.setHint("ssemPacket", "ssemPacket");
}
......
......@@ -15,9 +15,10 @@ public class Plugin {
CodecFactory cf = CodecFactory.getInstance();
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "CamInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "DenmInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "IvimInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "MapemInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "SpatemInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "IvimInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "EvcsnInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "SremInd", FacilitiesInd.class);
cf.setCodec(TciTypeClass.RECORD, "LibIts_Interface", "SsemInd", FacilitiesInd.class);
}
......
......@@ -150,7 +150,11 @@ public class ItsExternalFunctionsProvider implements IItsExternalFunctionsProvid
//TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider", "fx_getDSecond");
ZonedDateTime t = ZonedDateTime.now(ZoneOffset.UTC);
now = _tcicdWrapper.setInteger(new Integer(t.getSecond() + Math.round(t.getNano() / 1000)));
int i = new Integer(t.getSecond() + Math.round(t.getNano() / 1000));
if (i > 65535) {
i = 65535;
}
now = _tcicdWrapper.setInteger(i);
//TERFactory.getInstance().logDebug("ItsExternalFunctionsProvider", "fx_getDSecond", String.format("%4d", _tcicdWrapper.getBigInteger(now)));
return now;
......
......@@ -41,6 +41,8 @@ public class BuiltInCodec implements TciCDProvided {
_encodingName = "MAPEM_SPATEM_ETSI";
} else if (encodingName.equals("LibItsIvim_asn1")) {
_encodingName = "IVIM_PDU_Descriptions";
} else if (encodingName.equals("LibItsEvcsn_asn1")) {
_encodingName = "EVCSN_PDU_Descriptions";
} else if (encodingName.equals("LibItsSremSsem_asn1")) {
_encodingName = "SREM_SSEM_ETSI";
} else if (encodingName.equals("LibItsCALMmsap_asn1")) {
......
package org.etsi.its.tool.elvior;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;
import org.etsi.ttcn.tri.TriMessage;
/**
*
* Note that "Enable Internal Codec" field shall be set to true
*
*/
public class LibItsEvcsn_asn1 extends LibIts_asn1 {
/**
* Constructor
*/
public LibItsEvcsn_asn1() {
_logger.entering("LibItsEvcsn_asn1", "LibItsEvcsn_asn1");
_encodingName = "EVCSN_PDU_Descriptions";
}
@Override
public Value decode(final TriMessage message, final Type decodingHypothesis) {
_logger.entering("LibItsEvcsn_asn1", "decode", decodingHypothesis.getName());
if (decodingHypothesis.getName().endsWith("evcsnPacket")) {
Type type = getTypeForName("EVCSN_PDU_Descriptions.EvcsnPdu");
return super.decode(message, type);
}
return super.decode(message, decodingHypothesis);
}
} // End of class LibItsEvcsn_asn1
......@@ -58,51 +58,60 @@ public class LibIts_asn1 implements TciCDProvided {
TriMessageEx msg = TriProvider.getInstance().getTriFactory().createMessageEx();
msg.setEncodedMessage(message.getEncodedMessage());
//if (_logger.isLoggable(Level.ALL)) ByteHelper.dump("LibIts_asn1.decode: ", msg.getEncodedMessage());
//ByteHelper.dump("LibIts_asn1.decode: ", msg.getEncodedMessage());
String type = "";
System.out.println("decode: " + String.format("%s.%s: %02x", decodingHypothesis.getTypeEncoding(), decodingHypothesis.getName(), message.getEncodedMessage()[1]));
if (decodingHypothesis.getTypeEncoding().equals("per-basic-unaligned:1997")) {
switch (message.getEncodedMessage()[1]) { // messageID INTEGER{ denm(1), cam(2), poi(3), spatem(4), mapem(5), ivim(6), ev-rsr(7), tistpgtransaction(8), srem(9), ssem(10), evcsn(11) } (0..255), -- Mantis #7209, #7005
case (byte)0x01:
if (decodingHypothesis.getName().equals("DENM")) {
type = String.format("%s.%s", "DENM_PDU_Descriptions", decodingHypothesis.getName());
type = "DENM_PDU_Descriptions.DENM";
}
break;
case (byte)0x02:
if (decodingHypothesis.getName().equals("CAM")) {
type = String.format("%s.%s", "CAM_PDU_Descriptions", decodingHypothesis.getName());
type = "CAM_PDU_Descriptions.CAM";
}
break;
case (byte)0x05:
if (decodingHypothesis.getName().equals("MAPEM")) {
type = String.format("%s.%s", "MAPEM_PDU_Descriptions", decodingHypothesis.getName());
type = "MAPEM_PDU_Descriptions.MAPEM";
}
break;
case (byte)0x04:
if (decodingHypothesis.getName().equals("SPATEM")) {
type = String.format("%s.%s", "SPATEM_PDU_Descriptions", decodingHypothesis.getName());
type = "SPATEM_PDU_Descriptions.SPATEM";
}
break;
case (byte)0x06:
if (decodingHypothesis.getName().equals("IVIM")) {
type = String.format("%s.%s", "IVIM_PDU_Descriptions", decodingHypothesis.getName());
type = "IVIM_PDU_Descriptions.IVIM";
}
break;
case (byte)0x07:
if (decodingHypothesis.getName().equals("EvcsnPdu")) {
type = "EVCSN_PDU_Descriptions.EvcsnPdu";
}
break;
case (byte)0x09:
if (decodingHypothesis.getName().equals("SREM")) {
type = String.format("%s.%s", "SREM_PDU_Descriptions", decodingHypothesis.getName());
type = "SREM_PDU_Descriptions.SREM";
}
break;
case (byte)0x0a:
if (decodingHypothesis.getName().equals("SSEM")) {
type = String.format("%s.%s", "SSEM_PDU_Descriptions", decodingHypothesis.getName());
type = "SSEM_PDU_Descriptions.SSEM";
}
break;
default:
// Nothing to do
System.out.println("Default: " + String.format("%s.%s", decodingHypothesis.getTypeEncoding(), decodingHypothesis.getName()));
} // End of 'switch' statement
} else {
type = String.format("%s.%s", _encodingName, decodingHypothesis.getName());
}
//_logger.info("Type: " + type);
//System.out.println("Type: " + type);
if (type.isEmpty()) {
return null; // Abort decoding
}
......
# Debug level - Authorized values: OFF, ALL, INFO, SEVERE
DEBUG_ENABLED=OFF
ASN.1Codecs=CAM,DENM,CDD,MAPEM_SPATEM,IVIM,SREM_SSEM
ASN.1Codecs=CAM,DENM,CDD,MAPEM_SPATEM,IVIM,EVSCN,SREM_SSEM
CAM=LibItsCam_asn1,org.etsi.its.tool.elvior.LibItsCam_asn1
DENM=LibItsDenm_asn1,org.etsi.its.tool.elvior.LibItsDenm_asn1
CDD=LibItsContainer_asn1,org.etsi.its.tool.elvior.LibItsContainer_asn1
MAPEM_SPATEM=LibItsMapemSpatem_asn1,org.etsi.its.tool.elvior.LibItsMapemSpatem_asn1
IVIM=LibItsIvim_asn1,org.etsi.its.tool.elvior.LibItsIvim_asn1
EVSCN=LibItsEvcsn_asn1,org.etsi.its.tool.elvior.LibItsEvcsn_asn1
SREM_SSEM=LibItsSremSsem_asn1,org.etsi.its.tool.elvior.LibItsSremSsem_asn1
......@@ -41,6 +41,7 @@ public class Its_CodecProvider implements CodecProvider {
cf.setExternalCodec("LibItsDenm_asn1", cs.getCodec("LibItsDenm_asn1"));
cf.setExternalCodec("LibItsMapemSpatem_asn1", cs.getCodec("LibItsMapemSpatem_asn1"));
cf.setExternalCodec("LibItsIvim_asn1", cs.getCodec("LibItsIvim_asn1"));
cf.setExternalCodec("LibItsEvcsn_asn1", cs.getCodec("LibItsEvcsn_asn1"));
cf.setExternalCodec("LibItsSremSsem_asn1", cs.getCodec("LibItsSremSsem_asn1"));
//TODO: add V2G external codecs (xsd)
//TODO: Yann add CALM external codecs (ASN.1)
......
......@@ -133,6 +133,8 @@ public class TciCDWrapper implements ITciCDWrapper {
originalType = _tciFactory.getTypeForName("MAPEM_PDU_Descriptions.SPATEM");
} else if (type.endsWith("ivimPacket")) {
originalType = _tciFactory.getTypeForName("IVIM_PDU_Descriptions.IVIM");
} else if (type.endsWith("evcsnPacket")) {
originalType = _tciFactory.getTypeForName("EVCSN_PDU_Descriptions.EvcsnPdu");
} else if (type.endsWith("sremPacket")) {
originalType = _tciFactory.getTypeForName("SREM_PDU_Descriptions.SREM");
} else if (type.endsWith("ssemPacket")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment