Committed by
Gerrit Code Review
Add OTN device and ports
Change-Id: I18f3376d1466077e95d7324a27a660302f0123b3
Showing
21 changed files
with
315 additions
and
13 deletions
... | @@ -28,6 +28,7 @@ import org.onosproject.net.Device; | ... | @@ -28,6 +28,7 @@ import org.onosproject.net.Device; |
28 | import org.onosproject.net.OchPort; | 28 | import org.onosproject.net.OchPort; |
29 | import org.onosproject.net.OduCltPort; | 29 | import org.onosproject.net.OduCltPort; |
30 | import org.onosproject.net.OmsPort; | 30 | import org.onosproject.net.OmsPort; |
31 | +import org.onosproject.net.OtuPort; | ||
31 | import org.onosproject.net.Port; | 32 | import org.onosproject.net.Port; |
32 | import org.onosproject.net.PortNumber; | 33 | import org.onosproject.net.PortNumber; |
33 | import org.onosproject.net.device.DeviceService; | 34 | import org.onosproject.net.device.DeviceService; |
... | @@ -47,7 +48,7 @@ public class DevicePortsListCommand extends DevicesListCommand { | ... | @@ -47,7 +48,7 @@ public class DevicePortsListCommand extends DevicesListCommand { |
47 | 48 | ||
48 | private static final String FMT = " port=%s, state=%s, type=%s, speed=%s %s"; | 49 | private static final String FMT = " port=%s, state=%s, type=%s, speed=%s %s"; |
49 | private static final String FMT_OCH = " port=%s, state=%s, type=%s, signalType=%s, isTunable=%s %s"; | 50 | private static final String FMT_OCH = " port=%s, state=%s, type=%s, signalType=%s, isTunable=%s %s"; |
50 | - private static final String FMT_ODUCLT = " port=%s, state=%s, type=%s, signalType=%s %s"; | 51 | + private static final String FMT_ODUCLT_OTU = " port=%s, state=%s, type=%s, signalType=%s %s"; |
51 | private static final String FMT_OMS = " port=%s, state=%s, type=%s, Freqs= %s / %s / %s GHz, totalChannels=%s %s"; | 52 | private static final String FMT_OMS = " port=%s, state=%s, type=%s, Freqs= %s / %s / %s GHz, totalChannels=%s %s"; |
52 | 53 | ||
53 | @Option(name = "-e", aliases = "--enabled", description = "Show only enabled ports", | 54 | @Option(name = "-e", aliases = "--enabled", description = "Show only enabled ports", |
... | @@ -158,7 +159,7 @@ public class DevicePortsListCommand extends DevicesListCommand { | ... | @@ -158,7 +159,7 @@ public class DevicePortsListCommand extends DevicesListCommand { |
158 | ((OchPort) port).isTunable() ? "yes" : "no", annotations); | 159 | ((OchPort) port).isTunable() ? "yes" : "no", annotations); |
159 | break; | 160 | break; |
160 | case ODUCLT: | 161 | case ODUCLT: |
161 | - print(FMT_ODUCLT, portName, portIsEnabled, portType, | 162 | + print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType, |
162 | ((OduCltPort) port).signalType().toString(), annotations); | 163 | ((OduCltPort) port).signalType().toString(), annotations); |
163 | break; | 164 | break; |
164 | case OMS: | 165 | case OMS: |
... | @@ -168,6 +169,10 @@ public class DevicePortsListCommand extends DevicesListCommand { | ... | @@ -168,6 +169,10 @@ public class DevicePortsListCommand extends DevicesListCommand { |
168 | ((OmsPort) port).grid().asHz() / Frequency.ofGHz(1).asHz(), | 169 | ((OmsPort) port).grid().asHz() / Frequency.ofGHz(1).asHz(), |
169 | ((OmsPort) port).totalChannels(), annotations); | 170 | ((OmsPort) port).totalChannels(), annotations); |
170 | break; | 171 | break; |
172 | + case OTU: | ||
173 | + print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType, | ||
174 | + ((OtuPort) port).signalType().toString(), annotations); | ||
175 | + break; | ||
171 | default: | 176 | default: |
172 | print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations); | 177 | print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations); |
173 | break; | 178 | break; | ... | ... |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net; | ||
17 | + | ||
18 | +import java.util.Objects; | ||
19 | + | ||
20 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | + | ||
22 | +/** | ||
23 | + * Implementation of OTU port (Optical channel Transport Unit). | ||
24 | + */ | ||
25 | + | ||
26 | +public class OtuPort extends DefaultPort { | ||
27 | + | ||
28 | + private final OtuSignalType signalType; | ||
29 | + | ||
30 | + /** | ||
31 | + * Creates an OTU port in the specified network element. | ||
32 | + * | ||
33 | + * @param element parent network element | ||
34 | + * @param number port number | ||
35 | + * @param isEnabled port enabled state | ||
36 | + * @param signalType OTU signal type | ||
37 | + * @param annotations optional key/value annotations | ||
38 | + */ | ||
39 | + public OtuPort(Element element, PortNumber number, boolean isEnabled, | ||
40 | + OtuSignalType signalType, Annotations... annotations) { | ||
41 | + super(element, number, isEnabled, Type.OTU, 0, annotations); | ||
42 | + this.signalType = signalType; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * Returns OTU signal type. | ||
47 | + * | ||
48 | + * @return OTU signal type | ||
49 | + */ | ||
50 | + public OtuSignalType signalType() { | ||
51 | + return signalType; | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public int hashCode() { | ||
56 | + return Objects.hash(number(), isEnabled(), type(), signalType, annotations()); | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public boolean equals(Object obj) { | ||
61 | + if (this == obj) { | ||
62 | + return true; | ||
63 | + } | ||
64 | + if (obj instanceof OtuPort) { | ||
65 | + final OtuPort other = (OtuPort) obj; | ||
66 | + return Objects.equals(this.element().id(), other.element().id()) && | ||
67 | + Objects.equals(this.number(), other.number()) && | ||
68 | + Objects.equals(this.isEnabled(), other.isEnabled()) && | ||
69 | + Objects.equals(this.signalType, other.signalType) && | ||
70 | + Objects.equals(this.annotations(), other.annotations()); | ||
71 | + } | ||
72 | + return false; | ||
73 | + } | ||
74 | + | ||
75 | + | ||
76 | + @Override | ||
77 | + public String toString() { | ||
78 | + return toStringHelper(this) | ||
79 | + .add("element", element().id()) | ||
80 | + .add("number", number()) | ||
81 | + .add("isEnabled", isEnabled()) | ||
82 | + .add("type", type()) | ||
83 | + .add("signalType", signalType) | ||
84 | + .toString(); | ||
85 | + } | ||
86 | + | ||
87 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | + | ||
17 | +package org.onosproject.net; | ||
18 | + | ||
19 | +/** | ||
20 | + * Represents OTU (Optical channel Transport Unit) signal type. | ||
21 | + * | ||
22 | + * <p> | ||
23 | + * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" and | ||
24 | + * Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0". | ||
25 | + * </p> | ||
26 | + */ | ||
27 | +public enum OtuSignalType { | ||
28 | + OTU1, | ||
29 | + OTU2, | ||
30 | + OTU3, | ||
31 | + OTU4 | ||
32 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -58,7 +58,12 @@ public interface Port extends Annotated { | ... | @@ -58,7 +58,12 @@ public interface Port extends Annotated { |
58 | /** | 58 | /** |
59 | * Signifies virtual port. | 59 | * Signifies virtual port. |
60 | */ | 60 | */ |
61 | - VIRTUAL | 61 | + VIRTUAL, |
62 | + | ||
63 | + /** | ||
64 | + * Signifies optical fiber-based OTN port. | ||
65 | + */ | ||
66 | + OTU | ||
62 | } | 67 | } |
63 | 68 | ||
64 | /** | 69 | /** | ... | ... |
1 | +/* | ||
2 | + * Copyright 2016 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.net.device; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | + | ||
20 | +import org.onosproject.net.OtuSignalType; | ||
21 | +import org.onosproject.net.Port; | ||
22 | +import org.onosproject.net.PortNumber; | ||
23 | +import org.onosproject.net.SparseAnnotations; | ||
24 | + | ||
25 | +/** | ||
26 | + * Default implementation of immutable OTU port description. | ||
27 | + */ | ||
28 | +public class OtuPortDescription extends DefaultPortDescription { | ||
29 | + | ||
30 | + private final OtuSignalType signalType; | ||
31 | + | ||
32 | + /** | ||
33 | + * Creates OTU port description based on the supplied information. | ||
34 | + * | ||
35 | + * @param number port number | ||
36 | + * @param isEnabled port enabled state | ||
37 | + * @param signalType OTU signal type | ||
38 | + * @param annotations optional key/value annotations map | ||
39 | + */ | ||
40 | + public OtuPortDescription(PortNumber number, boolean isEnabled, OtuSignalType signalType, | ||
41 | + SparseAnnotations... annotations) { | ||
42 | + super(number, isEnabled, Port.Type.OTU, 0, annotations); | ||
43 | + this.signalType = signalType; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Creates OTU port description based on the supplied information. | ||
48 | + * | ||
49 | + * @param base PortDescription to get basic information from | ||
50 | + * @param signalType OTU signal type | ||
51 | + * @param annotations optional key/value annotations map | ||
52 | + */ | ||
53 | + public OtuPortDescription(PortDescription base, OtuSignalType signalType, | ||
54 | + SparseAnnotations annotations) { | ||
55 | + super(base, annotations); | ||
56 | + this.signalType = signalType; | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Returns OTU signal type. | ||
61 | + * | ||
62 | + * @return OTU signal type | ||
63 | + */ | ||
64 | + public OtuSignalType signalType() { | ||
65 | + return signalType; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
69 | + public String toString() { | ||
70 | + return MoreObjects.toStringHelper(getClass()) | ||
71 | + .add("number", portNumber()) | ||
72 | + .add("isEnabled", isEnabled()) | ||
73 | + .add("type", type()) | ||
74 | + .add("signalType", signalType) | ||
75 | + .toString(); | ||
76 | + } | ||
77 | + | ||
78 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -352,7 +352,8 @@ public class DeviceManager | ... | @@ -352,7 +352,8 @@ public class DeviceManager |
352 | final Device device = getDevice(deviceId); | 352 | final Device device = getDevice(deviceId); |
353 | 353 | ||
354 | List<PortDescription> descs = ports.stream().map( | 354 | List<PortDescription> descs = ports.stream().map( |
355 | - port -> (!(Device.Type.ROADM.equals(device.type()))) ? | 355 | + port -> (!(Device.Type.ROADM.equals(device.type()) || |
356 | + (Device.Type.OTN.equals(device.type())))) ? | ||
356 | new DefaultPortDescription(port.number(), false, | 357 | new DefaultPortDescription(port.number(), false, |
357 | port.type(), port.portSpeed()) : | 358 | port.type(), port.portSpeed()) : |
358 | OpticalPortOperator.descriptionOf(port, false) | 359 | OpticalPortOperator.descriptionOf(port, false) |
... | @@ -439,7 +440,8 @@ public class DeviceManager | ... | @@ -439,7 +440,8 @@ public class DeviceManager |
439 | return; | 440 | return; |
440 | } | 441 | } |
441 | Device device = nullIsNotFound(getDevice(deviceId), "Device not found"); | 442 | Device device = nullIsNotFound(getDevice(deviceId), "Device not found"); |
442 | - if ((Device.Type.ROADM.equals(device.type()))) { | 443 | + if ((Device.Type.ROADM.equals(device.type())) || |
444 | + (Device.Type.OTN.equals(device.type()))) { | ||
443 | Port port = getPort(deviceId, portDescription.portNumber()); | 445 | Port port = getPort(deviceId, portDescription.portNumber()); |
444 | portDescription = OpticalPortOperator.descriptionOf(port, portDescription.isEnabled()); | 446 | portDescription = OpticalPortOperator.descriptionOf(port, portDescription.isEnabled()); |
445 | } | 447 | } | ... | ... |
... | @@ -23,6 +23,7 @@ import org.onosproject.net.config.basics.OpticalPortConfig; | ... | @@ -23,6 +23,7 @@ import org.onosproject.net.config.basics.OpticalPortConfig; |
23 | import org.onosproject.net.AnnotationKeys; | 23 | import org.onosproject.net.AnnotationKeys; |
24 | import org.onosproject.net.DefaultAnnotations; | 24 | import org.onosproject.net.DefaultAnnotations; |
25 | import org.onosproject.net.OchPort; | 25 | import org.onosproject.net.OchPort; |
26 | +import org.onosproject.net.OtuPort; | ||
26 | import org.onosproject.net.OduCltPort; | 27 | import org.onosproject.net.OduCltPort; |
27 | import org.onosproject.net.OmsPort; | 28 | import org.onosproject.net.OmsPort; |
28 | import org.onosproject.net.Port; | 29 | import org.onosproject.net.Port; |
... | @@ -32,6 +33,7 @@ import org.onosproject.net.device.DefaultPortDescription; | ... | @@ -32,6 +33,7 @@ import org.onosproject.net.device.DefaultPortDescription; |
32 | import org.onosproject.net.device.OchPortDescription; | 33 | import org.onosproject.net.device.OchPortDescription; |
33 | import org.onosproject.net.device.OduCltPortDescription; | 34 | import org.onosproject.net.device.OduCltPortDescription; |
34 | import org.onosproject.net.device.OmsPortDescription; | 35 | import org.onosproject.net.device.OmsPortDescription; |
36 | +import org.onosproject.net.device.OtuPortDescription; | ||
35 | import org.onosproject.net.device.PortDescription; | 37 | import org.onosproject.net.device.PortDescription; |
36 | import org.slf4j.Logger; | 38 | import org.slf4j.Logger; |
37 | 39 | ||
... | @@ -115,6 +117,9 @@ public final class OpticalPortOperator implements ConfigOperator { | ... | @@ -115,6 +117,9 @@ public final class OpticalPortOperator implements ConfigOperator { |
115 | case COPPER: | 117 | case COPPER: |
116 | return new DefaultPortDescription(port, descr.isEnabled(), descr.type(), | 118 | return new DefaultPortDescription(port, descr.isEnabled(), descr.type(), |
117 | descr.portSpeed(), sa); | 119 | descr.portSpeed(), sa); |
120 | + case OTU: | ||
121 | + OtuPortDescription otu = (OtuPortDescription) descr; | ||
122 | + return new OtuPortDescription(port, otu.isEnabled(), otu.signalType(), sa); | ||
118 | default: | 123 | default: |
119 | log.warn("Unsupported optical port type {} - can't update", descr.type()); | 124 | log.warn("Unsupported optical port type {} - can't update", descr.type()); |
120 | return descr; | 125 | return descr; |
... | @@ -183,6 +188,9 @@ public final class OpticalPortOperator implements ConfigOperator { | ... | @@ -183,6 +188,9 @@ public final class OpticalPortOperator implements ConfigOperator { |
183 | case ODUCLT: | 188 | case ODUCLT: |
184 | OduCltPort odu = (OduCltPort) port; | 189 | OduCltPort odu = (OduCltPort) port; |
185 | return new OduCltPortDescription(ptn, isup, odu.signalType(), an); | 190 | return new OduCltPortDescription(ptn, isup, odu.signalType(), an); |
191 | + case OTU: | ||
192 | + OtuPort otu = (OtuPort) port; | ||
193 | + return new OtuPortDescription(ptn, isup, otu.signalType(), an); | ||
186 | default: | 194 | default: |
187 | return new DefaultPortDescription(ptn, isup, port.type(), port.portSpeed(), an); | 195 | return new DefaultPortDescription(ptn, isup, port.type(), port.portSpeed(), an); |
188 | } | 196 | } | ... | ... |
... | @@ -34,11 +34,13 @@ import java.net.URI; | ... | @@ -34,11 +34,13 @@ import java.net.URI; |
34 | import static org.junit.Assert.assertEquals; | 34 | import static org.junit.Assert.assertEquals; |
35 | import static org.onosproject.net.Device.Type.ROADM; | 35 | import static org.onosproject.net.Device.Type.ROADM; |
36 | import static org.onosproject.net.Device.Type.SWITCH; | 36 | import static org.onosproject.net.Device.Type.SWITCH; |
37 | +import static org.onosproject.net.Device.Type.OTN; | ||
37 | 38 | ||
38 | public class BasicDeviceOperatorTest { | 39 | public class BasicDeviceOperatorTest { |
39 | 40 | ||
40 | private static final String NAME1 = "of:foo"; | 41 | private static final String NAME1 = "of:foo"; |
41 | private static final String NAME2 = "of:bar"; | 42 | private static final String NAME2 = "of:bar"; |
43 | + private static final String NAME3 = "of:otn"; | ||
42 | private static final String OWNER = "somebody"; | 44 | private static final String OWNER = "somebody"; |
43 | private static final URI DURI = URI.create(NAME1); | 45 | private static final URI DURI = URI.create(NAME1); |
44 | private static final String MFR = "whitebox"; | 46 | private static final String MFR = "whitebox"; |
... | @@ -64,6 +66,7 @@ public class BasicDeviceOperatorTest { | ... | @@ -64,6 +66,7 @@ public class BasicDeviceOperatorTest { |
64 | 66 | ||
65 | private static final BasicDeviceConfig SW_BDC = new BasicDeviceConfig(); | 67 | private static final BasicDeviceConfig SW_BDC = new BasicDeviceConfig(); |
66 | private static final BasicDeviceConfig RD_BDC = new BasicDeviceConfig(); | 68 | private static final BasicDeviceConfig RD_BDC = new BasicDeviceConfig(); |
69 | + private static final BasicDeviceConfig OT_BDC = new BasicDeviceConfig(); | ||
67 | 70 | ||
68 | @Before | 71 | @Before |
69 | public void setUp() { | 72 | public void setUp() { |
... | @@ -72,6 +75,8 @@ public class BasicDeviceOperatorTest { | ... | @@ -72,6 +75,8 @@ public class BasicDeviceOperatorTest { |
72 | RD_BDC.init(DeviceId.deviceId(NAME2), NAME2, JsonNodeFactory.instance.objectNode(), mapper, delegate); | 75 | RD_BDC.init(DeviceId.deviceId(NAME2), NAME2, JsonNodeFactory.instance.objectNode(), mapper, delegate); |
73 | RD_BDC.type(ROADM).manufacturer(MANUFACTURER).hwVersion(HW_VERSION) | 76 | RD_BDC.type(ROADM).manufacturer(MANUFACTURER).hwVersion(HW_VERSION) |
74 | .swVersion(SW_VERSION).serial(SERIAL).managementAddress(MANAGEMENT_ADDRESS).driver(DRIVER).owner(OWNER); | 77 | .swVersion(SW_VERSION).serial(SERIAL).managementAddress(MANAGEMENT_ADDRESS).driver(DRIVER).owner(OWNER); |
78 | + OT_BDC.init(DeviceId.deviceId(NAME3), NAME3, JsonNodeFactory.instance.objectNode(), mapper, delegate); | ||
79 | + OT_BDC.type(OTN); | ||
75 | } | 80 | } |
76 | 81 | ||
77 | @Test | 82 | @Test |
... | @@ -92,5 +97,9 @@ public class BasicDeviceOperatorTest { | ... | @@ -92,5 +97,9 @@ public class BasicDeviceOperatorTest { |
92 | assertEquals("Wrong serial", SERIAL, desc.serialNumber()); | 97 | assertEquals("Wrong serial", SERIAL, desc.serialNumber()); |
93 | assertEquals("Wrong management Address", MANAGEMENT_ADDRESS, | 98 | assertEquals("Wrong management Address", MANAGEMENT_ADDRESS, |
94 | desc.annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS)); | 99 | desc.annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS)); |
100 | + | ||
101 | + // override Device type | ||
102 | + desc = BasicDeviceOperator.combine(OT_BDC, DEV1); | ||
103 | + assertEquals(OTN, desc.type()); | ||
95 | } | 104 | } |
96 | } | 105 | } | ... | ... |
... | @@ -31,6 +31,7 @@ import org.onosproject.net.device.DeviceDescription; | ... | @@ -31,6 +31,7 @@ import org.onosproject.net.device.DeviceDescription; |
31 | import org.onosproject.net.device.OchPortDescription; | 31 | import org.onosproject.net.device.OchPortDescription; |
32 | import org.onosproject.net.device.OduCltPortDescription; | 32 | import org.onosproject.net.device.OduCltPortDescription; |
33 | import org.onosproject.net.device.OmsPortDescription; | 33 | import org.onosproject.net.device.OmsPortDescription; |
34 | +import org.onosproject.net.device.OtuPortDescription; | ||
34 | import org.onosproject.net.device.PortDescription; | 35 | import org.onosproject.net.device.PortDescription; |
35 | import org.onosproject.store.Timestamp; | 36 | import org.onosproject.store.Timestamp; |
36 | import org.onosproject.store.impl.Timestamped; | 37 | import org.onosproject.store.impl.Timestamped; |
... | @@ -123,6 +124,13 @@ class DeviceDescriptions { | ... | @@ -123,6 +124,13 @@ class DeviceDescriptions { |
123 | ocDesc, ocDesc.signalType(), merged), | 124 | ocDesc, ocDesc.signalType(), merged), |
124 | newDesc.timestamp()); | 125 | newDesc.timestamp()); |
125 | break; | 126 | break; |
127 | + case OTU: | ||
128 | + OtuPortDescription otuDesc = (OtuPortDescription) (newDesc.value()); | ||
129 | + newOne = new Timestamped<>( | ||
130 | + new OtuPortDescription( | ||
131 | + otuDesc, otuDesc.signalType(), merged), | ||
132 | + newDesc.timestamp()); | ||
133 | + break; | ||
126 | default: | 134 | default: |
127 | newOne = new Timestamped<>( | 135 | newOne = new Timestamped<>( |
128 | new DefaultPortDescription(newDesc.value(), merged), | 136 | new DefaultPortDescription(newDesc.value(), merged), | ... | ... |
... | @@ -48,6 +48,7 @@ import org.onosproject.net.MastershipRole; | ... | @@ -48,6 +48,7 @@ import org.onosproject.net.MastershipRole; |
48 | import org.onosproject.net.OchPort; | 48 | import org.onosproject.net.OchPort; |
49 | import org.onosproject.net.OduCltPort; | 49 | import org.onosproject.net.OduCltPort; |
50 | import org.onosproject.net.OmsPort; | 50 | import org.onosproject.net.OmsPort; |
51 | +import org.onosproject.net.OtuPort; | ||
51 | import org.onosproject.net.Port; | 52 | import org.onosproject.net.Port; |
52 | import org.onosproject.net.PortNumber; | 53 | import org.onosproject.net.PortNumber; |
53 | import org.onosproject.net.device.DefaultPortStatistics; | 54 | import org.onosproject.net.device.DefaultPortStatistics; |
... | @@ -59,6 +60,7 @@ import org.onosproject.net.device.DeviceStoreDelegate; | ... | @@ -59,6 +60,7 @@ import org.onosproject.net.device.DeviceStoreDelegate; |
59 | import org.onosproject.net.device.OchPortDescription; | 60 | import org.onosproject.net.device.OchPortDescription; |
60 | import org.onosproject.net.device.OduCltPortDescription; | 61 | import org.onosproject.net.device.OduCltPortDescription; |
61 | import org.onosproject.net.device.OmsPortDescription; | 62 | import org.onosproject.net.device.OmsPortDescription; |
63 | +import org.onosproject.net.device.OtuPortDescription; | ||
62 | import org.onosproject.net.device.PortDescription; | 64 | import org.onosproject.net.device.PortDescription; |
63 | import org.onosproject.net.device.PortStatistics; | 65 | import org.onosproject.net.device.PortStatistics; |
64 | import org.onosproject.net.provider.ProviderId; | 66 | import org.onosproject.net.provider.ProviderId; |
... | @@ -1095,6 +1097,9 @@ public class GossipDeviceStore | ... | @@ -1095,6 +1097,9 @@ public class GossipDeviceStore |
1095 | case ODUCLT: | 1097 | case ODUCLT: |
1096 | OduCltPortDescription oduDesc = (OduCltPortDescription) description; | 1098 | OduCltPortDescription oduDesc = (OduCltPortDescription) description; |
1097 | return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations); | 1099 | return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations); |
1100 | + case OTU: | ||
1101 | + OtuPortDescription otuDesc = (OtuPortDescription) description; | ||
1102 | + return new OtuPort(device, number, isEnabled, otuDesc.signalType(), annotations); | ||
1098 | default: | 1103 | default: |
1099 | return new DefaultPort(device, number, isEnabled, description.type(), | 1104 | return new DefaultPort(device, number, isEnabled, description.type(), |
1100 | description.portSpeed(), annotations); | 1105 | description.portSpeed(), annotations); | ... | ... |
... | @@ -77,6 +77,8 @@ import org.onosproject.net.OduCltPort; | ... | @@ -77,6 +77,8 @@ import org.onosproject.net.OduCltPort; |
77 | import org.onosproject.net.OduSignalId; | 77 | import org.onosproject.net.OduSignalId; |
78 | import org.onosproject.net.OduSignalType; | 78 | import org.onosproject.net.OduSignalType; |
79 | import org.onosproject.net.OmsPort; | 79 | import org.onosproject.net.OmsPort; |
80 | +import org.onosproject.net.OtuPort; | ||
81 | +import org.onosproject.net.OtuSignalType; | ||
80 | import org.onosproject.net.Port; | 82 | import org.onosproject.net.Port; |
81 | import org.onosproject.net.PortNumber; | 83 | import org.onosproject.net.PortNumber; |
82 | import org.onosproject.net.TributarySlot; | 84 | import org.onosproject.net.TributarySlot; |
... | @@ -85,6 +87,7 @@ import org.onosproject.net.device.DefaultPortDescription; | ... | @@ -85,6 +87,7 @@ import org.onosproject.net.device.DefaultPortDescription; |
85 | import org.onosproject.net.device.DefaultPortStatistics; | 87 | import org.onosproject.net.device.DefaultPortStatistics; |
86 | import org.onosproject.net.device.OchPortDescription; | 88 | import org.onosproject.net.device.OchPortDescription; |
87 | import org.onosproject.net.device.OduCltPortDescription; | 89 | import org.onosproject.net.device.OduCltPortDescription; |
90 | +import org.onosproject.net.device.OtuPortDescription; | ||
88 | import org.onosproject.net.device.OmsPortDescription; | 91 | import org.onosproject.net.device.OmsPortDescription; |
89 | import org.onosproject.net.device.PortStatistics; | 92 | import org.onosproject.net.device.PortStatistics; |
90 | import org.onosproject.net.flow.CompletedBatchOperation; | 93 | import org.onosproject.net.flow.CompletedBatchOperation; |
... | @@ -511,6 +514,9 @@ public final class KryoNamespaces { | ... | @@ -511,6 +514,9 @@ public final class KryoNamespaces { |
511 | .register(OchPortDescription.class) | 514 | .register(OchPortDescription.class) |
512 | .register(OmsPortDescription.class) | 515 | .register(OmsPortDescription.class) |
513 | .register(TributarySlot.class) | 516 | .register(TributarySlot.class) |
517 | + .register(OtuPort.class) | ||
518 | + .register(OtuSignalType.class) | ||
519 | + .register(OtuPortDescription.class) | ||
514 | .register( | 520 | .register( |
515 | MplsIntent.class, | 521 | MplsIntent.class, |
516 | MplsPathIntent.class, | 522 | MplsPathIntent.class, | ... | ... |
... | @@ -52,6 +52,8 @@ import org.onosproject.net.OchPort; | ... | @@ -52,6 +52,8 @@ import org.onosproject.net.OchPort; |
52 | import org.onosproject.net.OchSignal; | 52 | import org.onosproject.net.OchSignal; |
53 | import org.onosproject.net.OduCltPort; | 53 | import org.onosproject.net.OduCltPort; |
54 | import org.onosproject.net.OmsPort; | 54 | import org.onosproject.net.OmsPort; |
55 | +import org.onosproject.net.OtuPort; | ||
56 | +import org.onosproject.net.OtuSignalType; | ||
55 | import org.onosproject.net.PortNumber; | 57 | import org.onosproject.net.PortNumber; |
56 | import org.onosproject.net.OduSignalType; | 58 | import org.onosproject.net.OduSignalType; |
57 | import org.onosproject.net.SparseAnnotations; | 59 | import org.onosproject.net.SparseAnnotations; |
... | @@ -225,6 +227,11 @@ public class KryoSerializerTest { | ... | @@ -225,6 +227,11 @@ public class KryoSerializerTest { |
225 | } | 227 | } |
226 | 228 | ||
227 | @Test | 229 | @Test |
230 | + public void testOtuPort() { | ||
231 | + testSerializedEquals(new OtuPort(DEV1, P1, true, OtuSignalType.OTU2)); | ||
232 | + testSerializedEquals(new OtuPort(DEV1, P1, true, OtuSignalType.OTU2, A1_2)); | ||
233 | + } | ||
234 | + @Test | ||
228 | public void testDeviceId() { | 235 | public void testDeviceId() { |
229 | testSerializedEquals(DID1); | 236 | testSerializedEquals(DID1); |
230 | } | 237 | } | ... | ... |
... | @@ -186,7 +186,7 @@ public class LldpLinkProvider extends AbstractProvider implements LinkProvider { | ... | @@ -186,7 +186,7 @@ public class LldpLinkProvider extends AbstractProvider implements LinkProvider { |
186 | private ApplicationId appId; | 186 | private ApplicationId appId; |
187 | 187 | ||
188 | static final SuppressionRules DEFAULT_RULES | 188 | static final SuppressionRules DEFAULT_RULES |
189 | - = new SuppressionRules(EnumSet.of(Device.Type.ROADM, Device.Type.FIBER_SWITCH), | 189 | + = new SuppressionRules(EnumSet.of(Device.Type.ROADM, Device.Type.FIBER_SWITCH, Device.Type.OTN), |
190 | ImmutableMap.of(NO_LLDP, SuppressionRules.ANY_VALUE)); | 190 | ImmutableMap.of(NO_LLDP, SuppressionRules.ANY_VALUE)); |
191 | 191 | ||
192 | private SuppressionRules rules = LldpLinkProvider.DEFAULT_RULES; | 192 | private SuppressionRules rules = LldpLinkProvider.DEFAULT_RULES; | ... | ... |
... | @@ -51,7 +51,7 @@ public class SuppressionRulesTest { | ... | @@ -51,7 +51,7 @@ public class SuppressionRulesTest { |
51 | 51 | ||
52 | @Before | 52 | @Before |
53 | public void setUp() throws Exception { | 53 | public void setUp() throws Exception { |
54 | - rules = new SuppressionRules(ImmutableSet.of(Device.Type.ROADM), | 54 | + rules = new SuppressionRules(ImmutableSet.of(Device.Type.ROADM, Device.Type.OTN), |
55 | ImmutableMap.of("no-lldp", SuppressionRules.ANY_VALUE, | 55 | ImmutableMap.of("no-lldp", SuppressionRules.ANY_VALUE, |
56 | "sendLLDP", "false")); | 56 | "sendLLDP", "false")); |
57 | } | 57 | } | ... | ... |
... | @@ -54,6 +54,7 @@ import org.onosproject.net.GridType; | ... | @@ -54,6 +54,7 @@ import org.onosproject.net.GridType; |
54 | import org.onosproject.net.MastershipRole; | 54 | import org.onosproject.net.MastershipRole; |
55 | import org.onosproject.net.OchSignal; | 55 | import org.onosproject.net.OchSignal; |
56 | import org.onosproject.net.OduSignalType; | 56 | import org.onosproject.net.OduSignalType; |
57 | +import org.onosproject.net.OtuSignalType; | ||
57 | import org.onosproject.net.Port; | 58 | import org.onosproject.net.Port; |
58 | import org.onosproject.net.PortNumber; | 59 | import org.onosproject.net.PortNumber; |
59 | import org.onosproject.net.SparseAnnotations; | 60 | import org.onosproject.net.SparseAnnotations; |
... | @@ -67,6 +68,7 @@ import org.onosproject.net.device.DeviceProviderService; | ... | @@ -67,6 +68,7 @@ import org.onosproject.net.device.DeviceProviderService; |
67 | import org.onosproject.net.device.OchPortDescription; | 68 | import org.onosproject.net.device.OchPortDescription; |
68 | import org.onosproject.net.device.OduCltPortDescription; | 69 | import org.onosproject.net.device.OduCltPortDescription; |
69 | import org.onosproject.net.device.OmsPortDescription; | 70 | import org.onosproject.net.device.OmsPortDescription; |
71 | +import org.onosproject.net.device.OtuPortDescription; | ||
70 | import org.onosproject.net.device.PortDescription; | 72 | import org.onosproject.net.device.PortDescription; |
71 | import org.onosproject.net.device.PortStatistics; | 73 | import org.onosproject.net.device.PortStatistics; |
72 | import org.onosproject.net.provider.AbstractProvider; | 74 | import org.onosproject.net.provider.AbstractProvider; |
... | @@ -492,13 +494,15 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -492,13 +494,15 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
492 | */ | 494 | */ |
493 | private List<PortDescription> buildPortDescriptions(OpenFlowSwitch sw) { | 495 | private List<PortDescription> buildPortDescriptions(OpenFlowSwitch sw) { |
494 | final List<PortDescription> portDescs = new ArrayList<>(sw.getPorts().size()); | 496 | final List<PortDescription> portDescs = new ArrayList<>(sw.getPorts().size()); |
495 | - if (!(Device.Type.ROADM.equals(sw.deviceType()))) { | 497 | + if (!((Device.Type.ROADM.equals(sw.deviceType())) || |
498 | + (Device.Type.OTN.equals(sw.deviceType())))) { | ||
496 | sw.getPorts().forEach(port -> portDescs.add(buildPortDescription(port))); | 499 | sw.getPorts().forEach(port -> portDescs.add(buildPortDescription(port))); |
497 | } | 500 | } |
498 | 501 | ||
499 | OpenFlowOpticalSwitch opsw; | 502 | OpenFlowOpticalSwitch opsw; |
500 | switch (sw.deviceType()) { | 503 | switch (sw.deviceType()) { |
501 | case ROADM: | 504 | case ROADM: |
505 | + case OTN: | ||
502 | opsw = (OpenFlowOpticalSwitch) sw; | 506 | opsw = (OpenFlowOpticalSwitch) sw; |
503 | List<OFPortDesc> ports = opsw.getPorts(); | 507 | List<OFPortDesc> ports = opsw.getPorts(); |
504 | LOG.debug("SW ID {} , ETH- ODU CLT Ports {}", opsw.getId(), ports); | 508 | LOG.debug("SW ID {} , ETH- ODU CLT Ports {}", opsw.getId(), ports); |
... | @@ -578,6 +582,24 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -578,6 +582,24 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
578 | return buildPortDescription(ptype, (OFExpPort) port); | 582 | return buildPortDescription(ptype, (OFExpPort) port); |
579 | } | 583 | } |
580 | 584 | ||
585 | + private boolean matchingOtuPortSignalTypes(OFPortOpticalTransportSignalType sigType, | ||
586 | + OduSignalType oduSignalType) { | ||
587 | + switch (sigType) { | ||
588 | + case OTU2: | ||
589 | + if (oduSignalType == OduSignalType.ODU2) { | ||
590 | + return true; | ||
591 | + } | ||
592 | + break; | ||
593 | + case OTU4: | ||
594 | + if (oduSignalType == OduSignalType.ODU4) { | ||
595 | + return true; | ||
596 | + } | ||
597 | + break; | ||
598 | + default: | ||
599 | + break; | ||
600 | + } | ||
601 | + return false; | ||
602 | + } | ||
581 | /** | 603 | /** |
582 | * Build a portDescription from a given a port description describing some | 604 | * Build a portDescription from a given a port description describing some |
583 | * Optical port. | 605 | * Optical port. |
... | @@ -622,7 +644,24 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -622,7 +644,24 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
622 | break; | 644 | break; |
623 | case OTU2: | 645 | case OTU2: |
624 | case OTU4: | 646 | case OTU4: |
625 | - LOG.error("Signal tpye OTU2/4 not supported yet ", port.toString()); | 647 | + entry = firstProp.getFeatures().get(0).getValue().get(0); |
648 | + layerClass = entry.getLayerClass(); | ||
649 | + if (!OFPortOpticalTransportLayerClass.ODU.equals(layerClass)) { | ||
650 | + LOG.error("Unsupported layer Class {} ", layerClass); | ||
651 | + return null; | ||
652 | + } | ||
653 | + | ||
654 | + // convert to ONOS OduSignalType | ||
655 | + OduSignalType oduSignalTypeOtuPort = OpenFlowDeviceValueMapper. | ||
656 | + lookupOduSignalType((byte) entry.getSignalType()); | ||
657 | + if (!matchingOtuPortSignalTypes(sigType, oduSignalTypeOtuPort)) { | ||
658 | + LOG.error("Wrong oduSignalType {} for OTU Port sigType {} ", oduSignalTypeOtuPort, sigType); | ||
659 | + return null; | ||
660 | + } | ||
661 | + OtuSignalType otuSignalType = | ||
662 | + ((sigType == OFPortOpticalTransportSignalType.OTU2) ? OtuSignalType.OTU2 : | ||
663 | + OtuSignalType.OTU4); | ||
664 | + portDes = new OtuPortDescription(portNo, enabled, otuSignalType, annotations); | ||
626 | break; | 665 | break; |
627 | default: | 666 | default: |
628 | break; | 667 | break; | ... | ... |
... | @@ -611,12 +611,14 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { | ... | @@ -611,12 +611,14 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { |
611 | private void sendAllDevices() { | 611 | private void sendAllDevices() { |
612 | // Send optical first, others later for layered rendering | 612 | // Send optical first, others later for layered rendering |
613 | for (Device device : deviceService.getDevices()) { | 613 | for (Device device : deviceService.getDevices()) { |
614 | - if (device.type() == Device.Type.ROADM) { | 614 | + if ((device.type() == Device.Type.ROADM) || |
615 | + (device.type() == Device.Type.OTN)) { | ||
615 | sendMessage(deviceMessage(new DeviceEvent(DEVICE_ADDED, device))); | 616 | sendMessage(deviceMessage(new DeviceEvent(DEVICE_ADDED, device))); |
616 | } | 617 | } |
617 | } | 618 | } |
618 | for (Device device : deviceService.getDevices()) { | 619 | for (Device device : deviceService.getDevices()) { |
619 | - if (device.type() != Device.Type.ROADM) { | 620 | + if ((device.type() != Device.Type.ROADM) && |
621 | + (device.type() != Device.Type.OTN)) { | ||
620 | sendMessage(deviceMessage(new DeviceEvent(DEVICE_ADDED, device))); | 622 | sendMessage(deviceMessage(new DeviceEvent(DEVICE_ADDED, device))); |
621 | } | 623 | } |
622 | } | 624 | } | ... | ... |
... | @@ -131,6 +131,7 @@ | ... | @@ -131,6 +131,7 @@ |
131 | icon(grp, 'router', [250, 0]); | 131 | icon(grp, 'router', [250, 0]); |
132 | icon(grp, 'bgpSpeaker', [300, 0]); | 132 | icon(grp, 'bgpSpeaker', [300, 0]); |
133 | icon(grp, 'uiAttached', [350, 0]); | 133 | icon(grp, 'uiAttached', [350, 0]); |
134 | + icon(grp, 'otn', [400, 0]); | ||
134 | 135 | ||
135 | icon(grp, 'chain', [ 0, 60]); | 136 | icon(grp, 'chain', [ 0, 60]); |
136 | icon(grp, 'crown', [ 50, 60]); | 137 | icon(grp, 'crown', [ 50, 60]); | ... | ... |
... | @@ -88,6 +88,11 @@ | ... | @@ -88,6 +88,11 @@ |
88 | "M52,40l-12,0,0-8-18,13,18,13,0-8,12,0zM52,74l-12,0,0-8-18,13," + | 88 | "M52,40l-12,0,0-8-18,13,18,13,0-8,12,0zM52,74l-12,0,0-8-18,13," + |
89 | "18,13,0-8,12,0z", | 89 | "18,13,0-8,12,0z", |
90 | 90 | ||
91 | + otn: "M10,35l25-25h40l25,25v40l-25,25h-40l-25-25zM58,26l12,0,0" + | ||
92 | + "-8,18,13-18,13,0-8-12,0zM58,60l12,0,0-8,18,13-18,13,0-8-12,0z" + | ||
93 | + "M52,40l-12,0,0-8-18,13,18,13,0-8,12,0zM52,74l-12,0,0-8-18,13," + | ||
94 | + "18,13,0-8,12,0z", | ||
95 | + | ||
91 | endstation: "M10,15a5,5,0,0,1,5-5h65a5,5,0,0,1,5,5v80a5,5,0,0,1" + | 96 | endstation: "M10,15a5,5,0,0,1,5-5h65a5,5,0,0,1,5,5v80a5,5,0,0,1" + |
92 | "-5,5h-65a5,5,0,0,1-5-5zM87.5,14l11,11a3,10,0,0,1,2,10v40a3,10," + | 97 | "-5,5h-65a5,5,0,0,1-5-5zM87.5,14l11,11a3,10,0,0,1,2,10v40a3,10," + |
93 | "0,0,1,-2,10l-11,11zM17,19a2,2,0,0,1,2-2h56a2,2,0,0,1,2,2v26a2," + | 98 | "0,0,1,-2,10l-11,11zM17,19a2,2,0,0,1,2-2h56a2,2,0,0,1,2,2v26a2," + | ... | ... |
... | @@ -49,6 +49,7 @@ | ... | @@ -49,6 +49,7 @@ |
49 | 49 | ||
50 | devIcon_SWITCH: 'switch', | 50 | devIcon_SWITCH: 'switch', |
51 | devIcon_ROADM: 'roadm', | 51 | devIcon_ROADM: 'roadm', |
52 | + devIcon_OTN: 'otn', | ||
52 | deviceTable: 'switch', | 53 | deviceTable: 'switch', |
53 | flowTable: 'flowTable', | 54 | flowTable: 'flowTable', |
54 | portTable: 'portTable', | 55 | portTable: 'portTable', | ... | ... |
-
Please register or login to post a comment