Committed by
Gerrit Code Review
Add support for OTU ports in TributarySlotQuery
Change-Id: Ia0ea4913bf8d0ea0437f082e2fa0787fcf792dcc
Showing
1 changed file
with
26 additions
and
3 deletions
... | @@ -18,6 +18,8 @@ package org.onosproject.driver.query; | ... | @@ -18,6 +18,8 @@ package org.onosproject.driver.query; |
18 | import org.onlab.util.GuavaCollectors; | 18 | import org.onlab.util.GuavaCollectors; |
19 | import org.onosproject.net.OchPort; | 19 | import org.onosproject.net.OchPort; |
20 | import org.onosproject.net.OduSignalType; | 20 | import org.onosproject.net.OduSignalType; |
21 | +import org.onosproject.net.OtuPort; | ||
22 | +import org.onosproject.net.OtuSignalType; | ||
21 | import org.onosproject.net.Port; | 23 | import org.onosproject.net.Port; |
22 | import org.onosproject.net.PortNumber; | 24 | import org.onosproject.net.PortNumber; |
23 | import org.onosproject.net.TributarySlot; | 25 | import org.onosproject.net.TributarySlot; |
... | @@ -62,17 +64,38 @@ public class DefaultTributarySlotQuery extends AbstractHandlerBehaviour implemen | ... | @@ -62,17 +64,38 @@ public class DefaultTributarySlotQuery extends AbstractHandlerBehaviour implemen |
62 | DeviceService deviceService = this.handler().get(DeviceService.class); | 64 | DeviceService deviceService = this.handler().get(DeviceService.class); |
63 | Port p = deviceService.getPort(this.data().deviceId(), port); | 65 | Port p = deviceService.getPort(this.data().deviceId(), port); |
64 | 66 | ||
65 | - if (!(p instanceof OchPort)) { | 67 | + switch (p.type()) { |
68 | + case OCH: | ||
69 | + return queryOchTributarySlots((OchPort) p); | ||
70 | + case OTU: | ||
71 | + return queryOtuTributarySlots((OtuPort) p); | ||
72 | + default: | ||
66 | return Collections.emptySet(); | 73 | return Collections.emptySet(); |
67 | } | 74 | } |
68 | - OduSignalType signalType = ((OchPort) p).signalType(); | 75 | + } |
76 | + | ||
77 | + private Set<TributarySlot> queryOchTributarySlots(OchPort ochPort) { | ||
78 | + OduSignalType signalType = ochPort.signalType(); | ||
69 | switch (signalType) { | 79 | switch (signalType) { |
70 | case ODU2: | 80 | case ODU2: |
71 | return ENTIRE_ODU2_TRIBUTARY_SLOTS; | 81 | return ENTIRE_ODU2_TRIBUTARY_SLOTS; |
72 | case ODU4: | 82 | case ODU4: |
73 | return ENTIRE_ODU4_TRIBUTARY_SLOTS; | 83 | return ENTIRE_ODU4_TRIBUTARY_SLOTS; |
74 | default: | 84 | default: |
75 | - log.error("Unsupported signal type {}", signalType); | 85 | + log.error("Unsupported signal type {} for {}", signalType, ochPort); |
86 | + return Collections.emptySet(); | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + private Set<TributarySlot> queryOtuTributarySlots(OtuPort otuPort) { | ||
91 | + OtuSignalType signalType = otuPort.signalType(); | ||
92 | + switch (signalType) { | ||
93 | + case OTU2: | ||
94 | + return ENTIRE_ODU2_TRIBUTARY_SLOTS; | ||
95 | + case OTU4: | ||
96 | + return ENTIRE_ODU4_TRIBUTARY_SLOTS; | ||
97 | + default: | ||
98 | + log.error("Unsupported signal type {} for {}", signalType, otuPort); | ||
76 | return Collections.emptySet(); | 99 | return Collections.emptySet(); |
77 | } | 100 | } |
78 | } | 101 | } | ... | ... |
-
Please register or login to post a comment