jiangrui
Committed by Gerrit Code Review

ONOS-3237 Change OvsdbNodeId value ovsdb:ip:port to ovsdb:ip.

Change-Id: I6c13d740c2d0f4ce4efe73fe0ce5fa3d50a65c0c
......@@ -114,16 +114,15 @@ public class OvsdbBridgeConfig extends AbstractHandlerBehaviour
.collect(Collectors.toSet());
}
// OvsdbNodeId(IP:port) is used in the adaptor while DeviceId(ovsdb:IP:port)
// OvsdbNodeId(IP) is used in the adaptor while DeviceId(ovsdb:IP)
// is used in the core. So DeviceId need be changed to OvsdbNodeId.
private OvsdbNodeId changeDeviceIdToNodeId(DeviceId deviceId) {
int lastColon = deviceId.toString().lastIndexOf(":");
int fistColon = deviceId.toString().indexOf(":");
String ip = deviceId.toString().substring(fistColon + 1, lastColon);
String port = deviceId.toString().substring(lastColon + 1);
IpAddress ipAddress = IpAddress.valueOf(ip);
long portL = Long.parseLong(port);
return new OvsdbNodeId(ipAddress, portL);
String[] splits = deviceId.toString().split(":");
if (splits == null || splits.length < 1) {
return null;
}
IpAddress ipAddress = IpAddress.valueOf(splits[0]);
return new OvsdbNodeId(ipAddress, 0);
}
// Used for getting OvsdbClientService.
......
......@@ -16,7 +16,6 @@
package org.onosproject.driver.ovsdb;
import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -102,16 +101,15 @@ public class OvsdbTunnelConfig extends AbstractHandlerBehaviour
.collect(Collectors.toSet());
}
// OvsdbNodeId(IP:port) is used in the adaptor while DeviceId(ovsdb:IP:port)
// OvsdbNodeId(IP) is used in the adaptor while DeviceId(ovsdb:IP)
// is used in the core. So DeviceId need be changed to OvsdbNodeId.
private OvsdbNodeId changeDeviceIdToNodeId(DeviceId deviceId) {
int lastColon = deviceId.toString().lastIndexOf(":");
int fistColon = deviceId.toString().indexOf(":");
String ip = deviceId.toString().substring(fistColon + 1, lastColon);
String port = deviceId.toString().substring(lastColon + 1);
IpAddress ipAddress = IpAddress.valueOf(ip);
long portL = Long.parseLong(port);
return new OvsdbNodeId(ipAddress, portL);
String[] splits = deviceId.toString().split(":");
if (splits == null || splits.length < 1) {
return null;
}
IpAddress ipAddress = IpAddress.valueOf(splits[0]);
return new OvsdbNodeId(ipAddress, 0);
}
private OvsdbClientService getOvsdbNode(DriverHandler handler) {
......
......@@ -39,7 +39,7 @@ public final class OvsdbNodeId {
public OvsdbNodeId(IpAddress ipAddress, long port) {
checkNotNull(ipAddress, "ipAddress is not null");
this.ipAddress = ipAddress.toString();
this.nodeId = ipAddress + ":" + port;
this.nodeId = ipAddress.toString();
}
@Override
......