mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 18:02:05 +02:00
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
This commit is contained in:
parent
a2413b5f58
commit
ccf40c722b
@ -517,13 +517,20 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
|
|||||||
String portName = text.substring(i + 1);
|
String portName = text.substring(i + 1);
|
||||||
DeviceId deviceId = deviceId(text.substring(0, i));
|
DeviceId deviceId = deviceId(text.substring(0, i));
|
||||||
|
|
||||||
long portNum = 0L;
|
|
||||||
for (Port port : deviceService.getPorts(deviceId)) {
|
for (Port port : deviceService.getPorts(deviceId)) {
|
||||||
PortNumber pn = port.number();
|
PortNumber pn = port.number();
|
||||||
if (pn.name().equals(portName)) {
|
if (pn.name().equals(portName)) {
|
||||||
return new ConnectPoint(deviceId, pn);
|
return new ConnectPoint(deviceId, pn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long portNum;
|
||||||
|
try {
|
||||||
|
portNum = Long.parseLong(portName);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
portNum = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return new ConnectPoint(deviceId, portNumber(portNum, portName));
|
return new ConnectPoint(deviceId, portNumber(portNum, portName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user