Committed by
Brian O'Connor
Fix port speed
According to OF 1.3 spec, the unit of current speed should be kbps instead of mbps Change-Id: I68f30f551afd6c8a8030e0a817ff009595113a84
Showing
1 changed file
with
4 additions
and
1 deletions
... | @@ -120,6 +120,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -120,6 +120,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
120 | 120 | ||
121 | private static final Logger LOG = getLogger(OpenFlowDeviceProvider.class); | 121 | private static final Logger LOG = getLogger(OpenFlowDeviceProvider.class); |
122 | 122 | ||
123 | + //TODO consider renaming KBPS and MBPS (as they are used to convert by division) | ||
124 | + private static final long KBPS = 1_000; | ||
123 | private static final long MBPS = 1_000 * 1_000; | 125 | private static final long MBPS = 1_000 * 1_000; |
124 | private static final Frequency FREQ100 = Frequency.ofGHz(100); | 126 | private static final Frequency FREQ100 = Frequency.ofGHz(100); |
125 | private static final Frequency FREQ193_1 = Frequency.ofTHz(193.1); | 127 | private static final Frequency FREQ193_1 = Frequency.ofTHz(193.1); |
... | @@ -669,7 +671,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -669,7 +671,8 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
669 | 671 | ||
670 | private long portSpeed(OFPortDesc port) { | 672 | private long portSpeed(OFPortDesc port) { |
671 | if (port.getVersion() == OFVersion.OF_13) { | 673 | if (port.getVersion() == OFVersion.OF_13) { |
672 | - return port.getCurrSpeed() / MBPS; | 674 | + // Note: getCurrSpeed() returns a value in kbps (this also applies to OF_11 and OF_12) |
675 | + return port.getCurrSpeed() / KBPS; | ||
673 | } | 676 | } |
674 | 677 | ||
675 | PortSpeed portSpeed = PortSpeed.SPEED_NONE; | 678 | PortSpeed portSpeed = PortSpeed.SPEED_NONE; | ... | ... |
-
Please register or login to post a comment