Browse Source

Some minor bugfixes for bugs encountered at the Third International Testival in Dortmund on the 12th of November 2015

Marc Mültin 10 năm trước cách đây
mục cha
commit
91b153fb98

+ 4 - 4
RISE-V2G-EVCC/EVCCConfig.properties

@@ -14,10 +14,10 @@
 
 # Network interface
 #------------------
-#
-# The network interface index of the network interface on which to communicate with the SECC via a 
+# 
+# The network interface name like en3 or eth1 of the network interface on which to communicate with the SECC via a 
 # link-local IPv6 address
-NetworkInterfaceIndex = 1
+NetworkInterface = en3
 
 
 # Security
@@ -28,7 +28,7 @@ NetworkInterfaceIndex = 1
 # - false
 # If this value is set to 'false', TCP will be used on transport layer
 # If no correct value is provided here, 'false' will be chosen
-TLSSecurity = true
+TLSSecurity = false
 
 
 # Contract certificate update timespan

+ 1 - 1
RISE-V2G-EVCC/src/main/java/org/eclipse/risev2g/evcc/states/WaitForServiceDiscoveryRes.java

@@ -122,7 +122,7 @@ public class WaitForServiceDiscoveryRes extends ClientState {
 			}
 			
 			// Optionally, other value added services can be checked for here ...
-		} 
+		} else return false;
 		
 		return (getCommSessionContext().getServiceDetailsToBeRequested().size() > 0) ? true : false;
 	}

+ 0 - 1
RISE-V2G-EVCC/src/main/java/org/eclipse/risev2g/evcc/states/WaitForSessionSetupRes.java

@@ -58,7 +58,6 @@ public class WaitForSessionSetupRes extends ClientState {
 								  sessionSetupRes.getResponseCode().toString() + "' is " +
 								  "neither OK_NEW_SESSION_ESTABLISHED nor OK_OLD_SESSION_JOINED");
 				return new TerminateSession("Positive response code invalid in state WaitForSessionSetupRes");
-				
 			}
 			
 			ServiceDiscoveryReqType serviceDiscoveryReq = new ServiceDiscoveryReqType();

+ 3 - 1
RISE-V2G-EVCC/src/main/java/org/eclipse/risev2g/evcc/states/WaitForSupportedAppProtocolRes.java

@@ -71,7 +71,9 @@ public class WaitForSupportedAppProtocolRes extends ClientState {
 						getCommSessionContext().generateSessionIDFromValue(sessionID)
 				);
 			} else {
-				return new TerminateSession("No supported appProtocol found (positive response code received, but no valid schemaID)");
+				return new TerminateSession("No supported appProtocol found (positive response code received, " + 
+											"but no valid schemaID. Received schema ID is: " + 
+											supportedAppProtocolRes.getSchemaID());
 			}
 			
 			return getSendMessage(sessionSetupReq, V2GMessages.SESSION_SETUP_RES, (int) Math.min(

+ 3 - 3
RISE-V2G-SECC/SECCConfig.properties

@@ -15,9 +15,9 @@
 # Network interface
 #------------------
 #
-# The network interface index of the network interface on which to communicate with the EVCC via a 
+# The network interface name like en3 or eth1 of the network interface on which to communicate with the EVCC via a 
 # link-local IPv6 address
-NetworkInterfaceIndex = 1
+NetworkInterface = en3
 
 
 # Supported energy transfer modes
@@ -31,7 +31,7 @@ NetworkInterfaceIndex = 1
 # - DC_extended
 # - DC_combo_core
 # - DC_unique
-SupportedEnergyTransferModes = AC_three_phase_core, AC_single_phase_core, DC_core, DC_extended
+SupportedEnergyTransferModes = AC_three_phase_core, AC_single_phase_core, DC_core, DC_extended, DC_combo_core
 
 
 # Is charging a free service?

+ 12 - 9
RISE-V2G-SECC/src/main/java/org/eclipse/risev2g/secc/states/WaitForAuthorizationReq.java

@@ -71,15 +71,18 @@ public class WaitForAuthorizationReq extends ServerState {
 			return false;
 		}
 		
-		// Verify signature
-		HashMap<String, byte[]> verifyXMLSigRefElements = new HashMap<String, byte[]>();
-		verifyXMLSigRefElements.put(authorizationReq.getId(), SecurityUtils.generateDigest(authorizationReq, false));
-		ECPublicKey ecPublicKey = (ECPublicKey) SecurityUtils.getCertificate(
-				getCommSessionContext().getContractSignatureCertChain().getCertificate())
-				.getPublicKey();
-		if (!SecurityUtils.verifySignature(signature, verifyXMLSigRefElements, ecPublicKey)) {
-			authorizationRes.setResponseCode(ResponseCodeType.FAILED_SIGNATURE_ERROR);
-			return false;
+		// Only try to verify the signature in case we use a TLS connection
+		if (getCommSessionContext().isTlsConnection()) {
+			// Verify signature
+			HashMap<String, byte[]> verifyXMLSigRefElements = new HashMap<String, byte[]>();
+			verifyXMLSigRefElements.put(authorizationReq.getId(), SecurityUtils.generateDigest(authorizationReq, false));
+			ECPublicKey ecPublicKey = (ECPublicKey) SecurityUtils.getCertificate(
+					getCommSessionContext().getContractSignatureCertChain().getCertificate())
+					.getPublicKey();
+			if (!SecurityUtils.verifySignature(signature, verifyXMLSigRefElements, ecPublicKey)) {
+				authorizationRes.setResponseCode(ResponseCodeType.FAILED_SIGNATURE_ERROR);
+				return false;
+			}
 		}
 		
 		return true;

+ 6 - 2
RISE-V2G-SECC/src/main/java/org/eclipse/risev2g/secc/states/WaitForChargingStatusReq.java

@@ -35,10 +35,14 @@ public class WaitForChargingStatusReq extends ServerState {
 			chargingStatusRes.setEVSEID(getCommSessionContext().getACEvseController().getEvseID());
 			chargingStatusRes.setSAScheduleTupleID(getCommSessionContext().getChosenSAScheduleTuple());
 			
-			// TODO check if a renegotiation is wanted or not
+			/*
+			 * TODO check if a renegotiation is wanted or not
+			 * Change EVSENotificationType to NONE if you want more than one charge loop iteration, 
+			 * but then make sure the EV is stopping the charge loop
+			 */
 			chargingStatusRes.setACEVSEStatus(
 					((IACEVSEController) getCommSessionContext().getACEvseController())
-					.getACEVSEStatus(EVSENotificationType.STOP_CHARGING)
+					.getACEVSEStatus(EVSENotificationType.STOP_CHARGING)  
 					);
 			
 			// Optionally indicate that the EVCC is required to send a MeteringReceiptReq message 

+ 5 - 1
RISE-V2G-SECC/src/main/java/org/eclipse/risev2g/secc/states/WaitForServiceDetailReq.java

@@ -55,7 +55,11 @@ public class WaitForServiceDetailReq extends ServerState {
 				// Optionally, further service details parameters can be provided (if previously offered)
 				
 				serviceDetailRes.setServiceID(serviceDetailReq.getServiceID());
-				serviceDetailRes.setServiceParameterList(serviceParameterList);
+				
+				// The ServiceParameterList itself is optional, but if you send it, it shall not be empty
+				if (serviceParameterList.getParameterSet().size() > 0) {
+					serviceDetailRes.setServiceParameterList(serviceParameterList);
+				}
 				
 				((ForkState) getCommSessionContext().getStates().get(V2GMessages.FORK))
 					.getAllowedRequests().add(V2GMessages.SERVICE_DETAIL_REQ);

+ 5 - 1
RISE-V2G-SECC/src/main/java/org/eclipse/risev2g/secc/states/WaitForServiceDiscoveryReq.java

@@ -43,7 +43,11 @@ public class WaitForServiceDiscoveryReq extends ServerState {
 			
 			serviceDiscoveryRes.setPaymentOptionList(getCommSessionContext().getPaymentOptions());
 			serviceDiscoveryRes.setChargeService(getChargeService()); 
-			serviceDiscoveryRes.setServiceList(offeredVASList);
+			
+			// The ServiceList itself is optional, but if you send it, it shall not be empty
+			if (offeredVASList.getService().size() > 0) {
+				serviceDiscoveryRes.setServiceList(offeredVASList);
+			}
 			
 			/*
 			 * When processing PaymentServiceSelectionReq the SECC needs to check if the service

+ 1 - 1
RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/enumerations/GlobalValues.java

@@ -52,7 +52,7 @@ public enum GlobalValues {
 	 */
 	V2GTP_HEADER_MAX_PAYLOAD_LENGTH((long) Integer.MAX_VALUE * 2, GlobalTypes.PAYLOAD_LENGTH),
 	
-	// Protocol versions (1 = IS compliant), see Table 109
+	// Protocol versions (1 = IS compliant), see Table 9
 	V2GTP_VERSION_1_IS(ByteUtils.toByteFromHexString("01"), GlobalTypes.PROTOCOL_VERSION),
 	
 	// Schema information

+ 0 - 1
RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/ByteUtils.java

@@ -142,7 +142,6 @@ public final class ByteUtils {
 			char valueChar = (value) ? '1' : '0';
 			byteArrayString.append(valueChar);
 		}
-		byteArrayString.append(" ");
 		
 		return byteArrayString.toString();
 	}

+ 6 - 12
RISE-V2G-Shared/src/main/java/org/eclipse/risev2g/shared/utils/MiscUtils.java

@@ -48,12 +48,12 @@ public final class MiscUtils {
 	 * @return The link-local address given as a String
 	 */
 	public static Inet6Address getLinkLocalAddress() {
-		int networkInterfaceConfig = (int) getPropertyValue("NetworkInterfaceIndex");
+		String networkInterfaceConfig = getPropertyValue("NetworkInterface").toString();
 		
 		NetworkInterface nif = null;
 		
 		try {
-			nif = NetworkInterface.getByIndex(networkInterfaceConfig);
+			nif = NetworkInterface.getByName(networkInterfaceConfig);
 			Enumeration<InetAddress> inetAddresses = nif.getInetAddresses();
 			
 			while (inetAddresses.hasMoreElements()) {
@@ -79,12 +79,12 @@ public final class MiscUtils {
 	
 	
 	public static byte[] getMacAddress() {
-		int networkInterfaceConfig = (int) getPropertyValue("NetworkInterfaceIndex");
+		String networkInterfaceConfig = getPropertyValue("NetworkInterface").toString();
 		NetworkInterface nif = null;
 		byte[] macAddress = null;
 		
 		try {
-			nif = NetworkInterface.getByIndex(networkInterfaceConfig);
+			nif = NetworkInterface.getByName(networkInterfaceConfig);
 			macAddress = nif.getHardwareAddress();
 		} catch (SocketException e) {
 			getLogger().error("Failed to retrieve local mac address (SocketException)", e);
@@ -125,14 +125,8 @@ public final class MiscUtils {
 		}
 		
 		switch (propertyName) {
-		case "NetworkInterfaceIndex": // EV + EVSE property
-			try {
-				returnValue = Integer.parseInt(propertyValue);
-			} catch (NumberFormatException e) {
-				getLogger().warn("NetworkInterface index value '" + propertyValue + "' not supported. " + 
-								 "Trying index value 0", e);
-				returnValue = 0;
-			}
+		case "NetworkInterface": // EV + EVSE property
+			returnValue = propertyValue;
 			break;
 		case "SessionID": // EV property
 			try {