Sho SHIMIZU
Committed by Gerrit Code Review

Fix bug that inconsistency happens in long value and name in PortNumber

The case is like the underlying name is "2", but long value is 0.

This fix relates to ONOS-2082.

Change-Id: I702ed91563296d38980dc6895fafb18aecaa26f8
......@@ -517,13 +517,20 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
String portName = text.substring(i + 1);
DeviceId deviceId = deviceId(text.substring(0, i));
long portNum = 0L;
for (Port port : deviceService.getPorts(deviceId)) {
PortNumber pn = port.number();
if (pn.name().equals(portName)) {
return new ConnectPoint(deviceId, pn);
}
}
long portNum;
try {
portNum = Long.parseLong(portName);
} catch (NumberFormatException e) {
portNum = 0;
}
return new ConnectPoint(deviceId, portNumber(portNum, portName));
}
......