Committed by
Gerrit Code Review
Make device store aware of optical ports (ONOS-1794).
Change-Id: Ia70855e391e22e1ab22bae73deb38fe9dbb90884
Showing
1 changed file
with
28 additions
and
5 deletions
... | @@ -45,6 +45,9 @@ import org.onosproject.net.Device; | ... | @@ -45,6 +45,9 @@ import org.onosproject.net.Device; |
45 | import org.onosproject.net.Device.Type; | 45 | import org.onosproject.net.Device.Type; |
46 | import org.onosproject.net.DeviceId; | 46 | import org.onosproject.net.DeviceId; |
47 | import org.onosproject.net.MastershipRole; | 47 | import org.onosproject.net.MastershipRole; |
48 | +import org.onosproject.net.OchPort; | ||
49 | +import org.onosproject.net.OduCltPort; | ||
50 | +import org.onosproject.net.OmsPort; | ||
48 | import org.onosproject.net.Port; | 51 | import org.onosproject.net.Port; |
49 | import org.onosproject.net.PortNumber; | 52 | import org.onosproject.net.PortNumber; |
50 | import org.onosproject.net.device.DeviceClockService; | 53 | import org.onosproject.net.device.DeviceClockService; |
... | @@ -52,6 +55,9 @@ import org.onosproject.net.device.DeviceDescription; | ... | @@ -52,6 +55,9 @@ import org.onosproject.net.device.DeviceDescription; |
52 | import org.onosproject.net.device.DeviceEvent; | 55 | import org.onosproject.net.device.DeviceEvent; |
53 | import org.onosproject.net.device.DeviceStore; | 56 | import org.onosproject.net.device.DeviceStore; |
54 | import org.onosproject.net.device.DeviceStoreDelegate; | 57 | import org.onosproject.net.device.DeviceStoreDelegate; |
58 | +import org.onosproject.net.device.OchPortDescription; | ||
59 | +import org.onosproject.net.device.OduCltPortDescription; | ||
60 | +import org.onosproject.net.device.OmsPortDescription; | ||
55 | import org.onosproject.net.device.PortDescription; | 61 | import org.onosproject.net.device.PortDescription; |
56 | import org.onosproject.net.device.PortStatistics; | 62 | import org.onosproject.net.device.PortStatistics; |
57 | import org.onosproject.net.provider.ProviderId; | 63 | import org.onosproject.net.provider.ProviderId; |
... | @@ -211,7 +217,7 @@ public class GossipDeviceStore | ... | @@ -211,7 +217,7 @@ public class GossipDeviceStore |
211 | 217 | ||
212 | // start anti-entropy thread | 218 | // start anti-entropy thread |
213 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), | 219 | backgroundExecutor.scheduleAtFixedRate(new SendAdvertisementTask(), |
214 | - initialDelaySec, periodSec, TimeUnit.SECONDS); | 220 | + initialDelaySec, periodSec, TimeUnit.SECONDS); |
215 | 221 | ||
216 | log.info("Started"); | 222 | log.info("Started"); |
217 | } | 223 | } |
... | @@ -1017,10 +1023,27 @@ public class GossipDeviceStore | ... | @@ -1017,10 +1023,27 @@ public class GossipDeviceStore |
1017 | } | 1023 | } |
1018 | } | 1024 | } |
1019 | 1025 | ||
1020 | - return portDesc == null ? | 1026 | + if (portDesc == null) { |
1021 | - new DefaultPort(device, number, false, annotations) : | 1027 | + return new DefaultPort(device, number, false, annotations); |
1022 | - new DefaultPort(device, number, isEnabled, portDesc.value().type(), | 1028 | + } |
1023 | - portDesc.value().portSpeed(), annotations); | 1029 | + |
1030 | + switch (portDesc.value().type()) { | ||
1031 | + case OMS: | ||
1032 | + OmsPortDescription omsPortDesc = (OmsPortDescription) portDesc.value(); | ||
1033 | + return new OmsPort(device, number, isEnabled, omsPortDesc.minFrequency(), | ||
1034 | + omsPortDesc.maxFrequency(), omsPortDesc.grid()); | ||
1035 | + case OCH: | ||
1036 | + OchPortDescription ochPortDesc = (OchPortDescription) portDesc.value(); | ||
1037 | + return new OchPort(device, number, isEnabled, ochPortDesc.signalType(), | ||
1038 | + ochPortDesc.isTunable(), ochPortDesc.gridType(), ochPortDesc.channelSpacing(), | ||
1039 | + ochPortDesc.spacingMultiplier(), ochPortDesc.slotGranularity(), annotations); | ||
1040 | + case ODUCLT: | ||
1041 | + OduCltPortDescription oduCltPortDesc = (OduCltPortDescription) portDesc.value(); | ||
1042 | + return new OduCltPort(device, number, isEnabled, oduCltPortDesc.signalType(), annotations); | ||
1043 | + default: | ||
1044 | + return new DefaultPort(device, number, isEnabled, portDesc.value().type(), | ||
1045 | + portDesc.value().portSpeed(), annotations); | ||
1046 | + } | ||
1024 | } | 1047 | } |
1025 | 1048 | ||
1026 | /** | 1049 | /** | ... | ... |
-
Please register or login to post a comment