HIGUCHI Yuta
Committed by Yuta HIGUCHI

ONOS-4416 Remove OduCltPort out of core.

Change-Id: I04324a72e48af84afdbfa32b84c8e57f39411000
Showing 22 changed files with 455 additions and 52 deletions
...@@ -30,7 +30,6 @@ import org.onosproject.net.ConnectPoint; ...@@ -30,7 +30,6 @@ import org.onosproject.net.ConnectPoint;
30 import org.onosproject.net.Device; 30 import org.onosproject.net.Device;
31 import org.onosproject.net.Host; 31 import org.onosproject.net.Host;
32 import org.onosproject.net.Link; 32 import org.onosproject.net.Link;
33 -import org.onosproject.net.OduCltPort;
34 import org.onosproject.net.OduSignalType; 33 import org.onosproject.net.OduSignalType;
35 import org.onosproject.net.Path; 34 import org.onosproject.net.Path;
36 import org.onosproject.net.Port; 35 import org.onosproject.net.Port;
...@@ -46,6 +45,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent; ...@@ -46,6 +45,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
46 import org.onosproject.net.intent.OpticalConnectivityIntent; 45 import org.onosproject.net.intent.OpticalConnectivityIntent;
47 import org.onosproject.net.intent.PointToPointIntent; 46 import org.onosproject.net.intent.PointToPointIntent;
48 import org.onosproject.net.optical.OchPort; 47 import org.onosproject.net.optical.OchPort;
48 +import org.onosproject.net.optical.OduCltPort;
49 import org.onosproject.net.topology.LinkWeight; 49 import org.onosproject.net.topology.LinkWeight;
50 import org.onosproject.net.topology.PathService; 50 import org.onosproject.net.topology.PathService;
51 import org.onosproject.net.topology.TopologyEdge; 51 import org.onosproject.net.topology.TopologyEdge;
......
...@@ -21,7 +21,6 @@ import org.apache.karaf.shell.commands.Option; ...@@ -21,7 +21,6 @@ import org.apache.karaf.shell.commands.Option;
21 import org.onosproject.net.CltSignalType; 21 import org.onosproject.net.CltSignalType;
22 import org.onosproject.net.ConnectPoint; 22 import org.onosproject.net.ConnectPoint;
23 import org.onosproject.net.Device; 23 import org.onosproject.net.Device;
24 -import org.onosproject.net.OduCltPort;
25 import org.onosproject.net.DeviceId; 24 import org.onosproject.net.DeviceId;
26 import org.onosproject.net.OduSignalType; 25 import org.onosproject.net.OduSignalType;
27 import org.onosproject.net.Port; 26 import org.onosproject.net.Port;
...@@ -32,6 +31,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent; ...@@ -32,6 +31,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
32 import org.onosproject.net.intent.OpticalConnectivityIntent; 31 import org.onosproject.net.intent.OpticalConnectivityIntent;
33 import org.onosproject.net.intent.OpticalOduIntent; 32 import org.onosproject.net.intent.OpticalOduIntent;
34 import org.onosproject.net.optical.OchPort; 33 import org.onosproject.net.optical.OchPort;
34 +import org.onosproject.net.optical.OduCltPort;
35 35
36 import java.util.List; 36 import java.util.List;
37 37
......
...@@ -25,12 +25,12 @@ import org.apache.karaf.shell.commands.Option; ...@@ -25,12 +25,12 @@ import org.apache.karaf.shell.commands.Option;
25 import org.onlab.util.Frequency; 25 import org.onlab.util.Frequency;
26 import org.onosproject.utils.Comparators; 26 import org.onosproject.utils.Comparators;
27 import org.onosproject.net.Device; 27 import org.onosproject.net.Device;
28 -import org.onosproject.net.OduCltPort;
29 import org.onosproject.net.OtuPort; 28 import org.onosproject.net.OtuPort;
30 import org.onosproject.net.Port; 29 import org.onosproject.net.Port;
31 import org.onosproject.net.PortNumber; 30 import org.onosproject.net.PortNumber;
32 import org.onosproject.net.device.DeviceService; 31 import org.onosproject.net.device.DeviceService;
33 import org.onosproject.net.optical.OchPort; 32 import org.onosproject.net.optical.OchPort;
33 +import org.onosproject.net.optical.OduCltPort;
34 import org.onosproject.net.optical.OmsPort; 34 import org.onosproject.net.optical.OmsPort;
35 import org.onosproject.net.optical.OpticalDevice; 35 import org.onosproject.net.optical.OpticalDevice;
36 import java.util.ArrayList; 36 import java.util.ArrayList;
...@@ -187,9 +187,22 @@ public class DevicePortsListCommand extends DevicesListCommand { ...@@ -187,9 +187,22 @@ public class DevicePortsListCommand extends DevicesListCommand {
187 print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations); 187 print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations);
188 break; 188 break;
189 case ODUCLT: 189 case ODUCLT:
190 - print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType, 190 + if (port instanceof org.onosproject.net.OduCltPort) {
191 - ((OduCltPort) port).signalType().toString(), annotations); 191 + // old OduCltPort model
192 - break; 192 + org.onosproject.net.OduCltPort oPort = (org.onosproject.net.OduCltPort) port;
193 + print("WARN: OduCltPort in old model");
194 + print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType,
195 + oPort.signalType().toString(), annotations);
196 + break;
197 + }
198 + if (port instanceof OduCltPort) {
199 + print(FMT_ODUCLT_OTU, portName, portIsEnabled, portType,
200 + ((OduCltPort) port).signalType().toString(), annotations);
201 + break;
202 + }
203 + print("WARN: OduCltPort but not on OpticalDevice or ill-formed");
204 + print(FMT, portName, portIsEnabled, portType, port.portSpeed(), annotations);
205 + break;
193 case OMS: 206 case OMS:
194 if (port instanceof org.onosproject.net.OmsPort) { 207 if (port instanceof org.onosproject.net.OmsPort) {
195 org.onosproject.net.OmsPort oms = (org.onosproject.net.OmsPort) port; 208 org.onosproject.net.OmsPort oms = (org.onosproject.net.OmsPort) port;
......
...@@ -24,8 +24,10 @@ import static com.google.common.base.Preconditions.checkNotNull; ...@@ -24,8 +24,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
24 * Implementation of ODU client port (Optical channel Data Unit). 24 * Implementation of ODU client port (Optical channel Data Unit).
25 * Also referred to as a T-port or wide band port. 25 * Also referred to as a T-port or wide band port.
26 * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" 26 * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)"
27 + *
28 + * @deprecated in Goldeneye (1.6.0)
27 */ 29 */
28 - 30 +@Deprecated
29 public class OduCltPort extends DefaultPort { 31 public class OduCltPort extends DefaultPort {
30 32
31 private final CltSignalType signalType; 33 private final CltSignalType signalType;
......
...@@ -23,7 +23,10 @@ import org.onosproject.net.SparseAnnotations; ...@@ -23,7 +23,10 @@ import org.onosproject.net.SparseAnnotations;
23 23
24 /** 24 /**
25 * Default implementation of immutable ODU client port description. 25 * Default implementation of immutable ODU client port description.
26 + *
27 + * @deprecated in Goldeneye (1.6.0)
26 */ 28 */
29 +@Deprecated
27 public class OduCltPortDescription extends DefaultPortDescription { 30 public class OduCltPortDescription extends DefaultPortDescription {
28 31
29 private final CltSignalType signalType; 32 private final CltSignalType signalType;
......
1 +/*
2 + * Copyright 2016-present 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.optical;
17 +
18 +import org.onosproject.net.CltSignalType;
19 +import org.onosproject.net.Port;
20 +
21 +import com.google.common.annotations.Beta;
22 +
23 +/**
24 + * ODU client port (Optical channel Data Unit).
25 + * Also referred to as a T-port or wide band port.
26 + * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)"
27 + */
28 +@Beta
29 +public interface OduCltPort extends Port {
30 +
31 + /**
32 + * Returns ODU client signal type.
33 + *
34 + * @return ODU client signal type
35 + */
36 + CltSignalType signalType();
37 +}
...@@ -28,9 +28,11 @@ import org.onosproject.net.device.DeviceService; ...@@ -28,9 +28,11 @@ import org.onosproject.net.device.DeviceService;
28 import org.onosproject.net.driver.AbstractBehaviour; 28 import org.onosproject.net.driver.AbstractBehaviour;
29 import org.onosproject.net.driver.DriverData; 29 import org.onosproject.net.driver.DriverData;
30 import org.onosproject.net.optical.OchPort; 30 import org.onosproject.net.optical.OchPort;
31 +import org.onosproject.net.optical.OduCltPort;
31 import org.onosproject.net.optical.OmsPort; 32 import org.onosproject.net.optical.OmsPort;
32 import org.onosproject.net.optical.OpticalDevice; 33 import org.onosproject.net.optical.OpticalDevice;
33 import org.onosproject.net.optical.device.port.OchPortMapper; 34 import org.onosproject.net.optical.device.port.OchPortMapper;
35 +import org.onosproject.net.optical.device.port.OduCltPortMapper;
34 import org.onosproject.net.optical.device.port.OmsPortMapper; 36 import org.onosproject.net.optical.device.port.OmsPortMapper;
35 import org.onosproject.net.optical.device.port.PortMapper; 37 import org.onosproject.net.optical.device.port.PortMapper;
36 import org.onosproject.net.optical.utils.ForwardingDevice; 38 import org.onosproject.net.optical.utils.ForwardingDevice;
...@@ -63,6 +65,7 @@ public class DefaultOpticalDevice ...@@ -63,6 +65,7 @@ public class DefaultOpticalDevice
63 = ImmutableMap.<Class<? extends Port>, PortMapper<? extends Port>>builder() 65 = ImmutableMap.<Class<? extends Port>, PortMapper<? extends Port>>builder()
64 .put(OchPort.class, new OchPortMapper()) 66 .put(OchPort.class, new OchPortMapper())
65 .put(OmsPort.class, new OmsPortMapper()) 67 .put(OmsPort.class, new OmsPortMapper())
68 + .put(OduCltPort.class, new OduCltPortMapper())
66 // TODO add other optical port type here 69 // TODO add other optical port type here
67 .build(); 70 .build();
68 71
......
1 +/*
2 + * Copyright 2016-present 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.optical.device;
17 +
18 +import static org.slf4j.LoggerFactory.getLogger;
19 +
20 +import java.util.Optional;
21 +
22 +import org.onosproject.net.Annotations;
23 +import org.onosproject.net.CltSignalType;
24 +import org.onosproject.net.DefaultAnnotations;
25 +import org.onosproject.net.Port;
26 +import org.onosproject.net.PortNumber;
27 +import org.onosproject.net.SparseAnnotations;
28 +import org.onosproject.net.DefaultAnnotations.Builder;
29 +import org.onosproject.net.device.DefaultPortDescription;
30 +import org.onosproject.net.device.PortDescription;
31 +import org.onosproject.net.optical.OduCltPort;
32 +import org.onosproject.net.optical.impl.DefaultOduCltPort;
33 +import org.slf4j.Logger;
34 +
35 +import com.google.common.annotations.Beta;
36 +
37 +/**
38 + * ODU client port related helpers.
39 + */
40 +@Beta
41 +public final class OduCltPortHelper {
42 +
43 + private static final Logger log = getLogger(OduCltPortHelper.class);
44 +
45 + // Annotation keys
46 + /**
47 + * {@link CltSignalType} as String.
48 + */
49 + private static final String SIGNAL_TYPE = "signalType";
50 +
51 + /**
52 + * Creates ODU client port description based on the supplied information.
53 + *
54 + * @param number port number
55 + * @param isEnabled port enabled state
56 + * @param signalType ODU client signal type
57 + */
58 + public static PortDescription oduCltPortDescription(PortNumber number,
59 + boolean isEnabled,
60 + CltSignalType signalType) {
61 + return oduCltPortDescription(number, isEnabled, signalType, DefaultAnnotations.EMPTY);
62 + }
63 +
64 + /**
65 + * Creates ODU client port description based on the supplied information.
66 + *
67 + * @param number port number
68 + * @param isEnabled port enabled state
69 + * @param signalType ODU client signal type
70 + * @param annotations key/value annotations map
71 + */
72 + public static PortDescription oduCltPortDescription(PortNumber number,
73 + boolean isEnabled,
74 + CltSignalType signalType,
75 + SparseAnnotations annotations) {
76 + Builder builder = DefaultAnnotations.builder();
77 + builder.putAll(annotations);
78 +
79 + builder.set(SIGNAL_TYPE, signalType.toString());
80 +
81 + long portSpeed = signalType.bitRate();
82 + return new DefaultPortDescription(number,
83 + isEnabled,
84 + Port.Type.ODUCLT,
85 + portSpeed,
86 + builder.build());
87 + }
88 +
89 + /**
90 + * Creates ODU client port description based on the supplied information.
91 + *
92 + * @param base PortDescription to get basic information from
93 + * @param signalType ODU client signal type
94 + * @param annotations key/value annotations map
95 + */
96 + public static PortDescription oduCltPortDescription(PortDescription base,
97 + CltSignalType signalType,
98 + SparseAnnotations annotations) {
99 + return oduCltPortDescription(base.portNumber(), base.isEnabled(), signalType, annotations);
100 + }
101 +
102 + public static Optional<OduCltPort> asOduCltPort(Port port) {
103 + if (port instanceof OduCltPort) {
104 + return Optional.of((OduCltPort) port);
105 + }
106 +
107 + try {
108 + Annotations an = port.annotations();
109 +
110 + CltSignalType signalType = Enum.valueOf(CltSignalType.class,
111 + an.value(SIGNAL_TYPE));
112 +
113 +
114 + // Note: ODU specific annotations is not filtered-out here.
115 + // DefaultOduCltPort should filter them, if necessary.
116 + return Optional.of(new DefaultOduCltPort(port, signalType));
117 +
118 + } catch (NullPointerException | IllegalArgumentException e) {
119 +
120 + log.warn("{} was not well-formed OduClt port.", port, e);
121 + return Optional.empty();
122 + }
123 + }
124 +
125 + // not meant to be instantiated
126 + private OduCltPortHelper() {}
127 +}
1 +/*
2 + * Copyright 2016-present 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.optical.device.port;
17 +
18 +import java.util.Optional;
19 +
20 +import org.onosproject.net.Port;
21 +import org.onosproject.net.optical.OduCltPort;
22 +import org.onosproject.net.optical.device.OduCltPortHelper;
23 +import org.onosproject.net.optical.impl.DefaultOduCltPort;
24 +
25 +import com.google.common.annotations.Beta;
26 +
27 +/**
28 + * {@link PortMapper} to handler {@link OduCltPort} translation.
29 + */
30 +@Beta
31 +public class OduCltPortMapper extends AbstractPortMapper<OduCltPort> {
32 +
33 + @Override
34 + public boolean is(Port port) {
35 + return port != null &&
36 + port.type() == Port.Type.ODUCLT &&
37 + super.is(port);
38 + }
39 +
40 + @Override
41 + public Optional<OduCltPort> as(Port port) {
42 + if (port instanceof OduCltPort) {
43 + return Optional.of((OduCltPort) port);
44 + }
45 + return super.as(port);
46 + }
47 +
48 + @Override
49 + protected Optional<OduCltPort> mapPort(Port port) {
50 + if (port instanceof OduCltPort) {
51 + return Optional.of((OduCltPort) port);
52 + } else if (port instanceof org.onosproject.net.OduCltPort) {
53 + // TODO remove after deprecation of old OduCltPort is complete
54 +
55 + // translate to new OduCltPort
56 + org.onosproject.net.OduCltPort old = (org.onosproject.net.OduCltPort) port;
57 + return Optional.of(new DefaultOduCltPort(old,
58 + old.signalType()));
59 + }
60 +
61 + return OduCltPortHelper.asOduCltPort(port);
62 + }
63 +
64 +}
1 +/*
2 + * Copyright 2016-present 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.optical.impl;
17 +
18 +import static com.google.common.base.Preconditions.checkNotNull;
19 +
20 +import java.util.Objects;
21 +
22 +import org.onosproject.net.CltSignalType;
23 +import org.onosproject.net.Port;
24 +import org.onosproject.net.optical.OduCltPort;
25 +import org.onosproject.net.optical.utils.ForwardingPort;
26 +
27 +import com.google.common.annotations.Beta;
28 +
29 +/**
30 + * Implementation of ODU client port (Optical channel Data Unit).
31 + * Also referred to as a T-port or wide band port.
32 + * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)"
33 + */
34 +@Beta
35 +public class DefaultOduCltPort extends ForwardingPort implements OduCltPort {
36 +
37 + private final CltSignalType signalType;
38 +
39 + /**
40 + * Creates an ODU client port.
41 + *
42 + * @param delegate Port
43 + * @param signalType ODU client signal type
44 + */
45 + public DefaultOduCltPort(Port delegate, CltSignalType signalType) {
46 + super(delegate);
47 + this.signalType = checkNotNull(signalType);
48 + }
49 +
50 + @Override
51 + public Type type() {
52 + return Type.ODUCLT;
53 + }
54 +
55 + @Override
56 + public long portSpeed() {
57 + return signalType().bitRate();
58 + }
59 +
60 + @Override
61 + public CltSignalType signalType() {
62 + return signalType;
63 + }
64 +
65 + @Override
66 + public int hashCode() {
67 + return Objects.hash(super.hashCode(),
68 + signalType());
69 + }
70 +
71 + @Override
72 + public boolean equals(Object obj) {
73 + if (this == obj) {
74 + return true;
75 + }
76 +
77 + if (obj != null && getClass() == obj.getClass()) {
78 + final DefaultOduCltPort that = (DefaultOduCltPort) obj;
79 + return super.toEqualsBuilder(that)
80 + .append(this.signalType(), that.signalType())
81 + .isEquals();
82 + }
83 + return false;
84 + }
85 +
86 + @Override
87 + public String toString() {
88 + return super.toStringHelper()
89 + .add("signalType", signalType())
90 + .toString();
91 + }
92 +
93 +}
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
16 package org.onosproject.net.device.impl; 16 package org.onosproject.net.device.impl;
17 17
18 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription; 18 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription;
19 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
19 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription; 20 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription;
20 import static org.slf4j.LoggerFactory.getLogger; 21 import static org.slf4j.LoggerFactory.getLogger;
21 import static com.google.common.base.Preconditions.checkNotNull; 22 import static com.google.common.base.Preconditions.checkNotNull;
...@@ -25,7 +26,6 @@ import org.onosproject.net.config.basics.OpticalPortConfig; ...@@ -25,7 +26,6 @@ import org.onosproject.net.config.basics.OpticalPortConfig;
25 import org.onosproject.net.AnnotationKeys; 26 import org.onosproject.net.AnnotationKeys;
26 import org.onosproject.net.DefaultAnnotations; 27 import org.onosproject.net.DefaultAnnotations;
27 import org.onosproject.net.OtuPort; 28 import org.onosproject.net.OtuPort;
28 -import org.onosproject.net.OduCltPort;
29 import org.onosproject.net.Port; 29 import org.onosproject.net.Port;
30 import org.onosproject.net.PortNumber; 30 import org.onosproject.net.PortNumber;
31 import org.onosproject.net.SparseAnnotations; 31 import org.onosproject.net.SparseAnnotations;
...@@ -36,6 +36,7 @@ import org.onosproject.net.device.OmsPortDescription; ...@@ -36,6 +36,7 @@ import org.onosproject.net.device.OmsPortDescription;
36 import org.onosproject.net.device.OtuPortDescription; 36 import org.onosproject.net.device.OtuPortDescription;
37 import org.onosproject.net.device.PortDescription; 37 import org.onosproject.net.device.PortDescription;
38 import org.onosproject.net.optical.OchPort; 38 import org.onosproject.net.optical.OchPort;
39 +import org.onosproject.net.optical.OduCltPort;
39 import org.onosproject.net.optical.OmsPort; 40 import org.onosproject.net.optical.OmsPort;
40 import org.onosproject.net.optical.OpticalDevice; 41 import org.onosproject.net.optical.OpticalDevice;
41 import org.slf4j.Logger; 42 import org.slf4j.Logger;
...@@ -121,8 +122,12 @@ public final class OpticalPortOperator implements ConfigOperator { ...@@ -121,8 +122,12 @@ public final class OpticalPortOperator implements ConfigOperator {
121 } 122 }
122 return descr; 123 return descr;
123 case ODUCLT: 124 case ODUCLT:
124 - OduCltPortDescription odu = (OduCltPortDescription) descr; 125 + if (descr instanceof OduCltPortDescription) {
125 - return new OduCltPortDescription(port, odu.isEnabled(), odu.signalType(), sa); 126 + // TODO This block can go away once deprecation is complete.
127 + OduCltPortDescription odu = (OduCltPortDescription) descr;
128 + return oduCltPortDescription(port, odu.isEnabled(), odu.signalType(), sa);
129 + }
130 + return descr;
126 case PACKET: 131 case PACKET:
127 case FIBER: 132 case FIBER:
128 case COPPER: 133 case COPPER:
...@@ -223,8 +228,19 @@ public final class OpticalPortOperator implements ConfigOperator { ...@@ -223,8 +228,19 @@ public final class OpticalPortOperator implements ConfigOperator {
223 return new DefaultPortDescription(ptn, isup, port.type(), port.portSpeed(), an); 228 return new DefaultPortDescription(ptn, isup, port.type(), port.portSpeed(), an);
224 229
225 case ODUCLT: 230 case ODUCLT:
226 - OduCltPort odu = (OduCltPort) port; 231 + if (port instanceof org.onosproject.net.OduCltPort) {
227 - return new OduCltPortDescription(ptn, isup, odu.signalType(), an); 232 + // remove if-block once deprecation is complete
233 + org.onosproject.net.OduCltPort odu = (org.onosproject.net.OduCltPort) port;
234 + return oduCltPortDescription(ptn, isup, odu.signalType(), an);
235 + }
236 + if (port.element().is(OpticalDevice.class)) {
237 + OpticalDevice optDevice = port.element().as(OpticalDevice.class);
238 + if (optDevice.portIs(port, OduCltPort.class)) {
239 + OduCltPort odu = (OduCltPort) port;
240 + return oduCltPortDescription(ptn, isup, odu.signalType(), an);
241 + }
242 + }
243 + return new DefaultPortDescription(ptn, isup, port.type(), port.portSpeed(), an);
228 case OTU: 244 case OTU:
229 OtuPort otu = (OtuPort) port; 245 OtuPort otu = (OtuPort) port;
230 return new OtuPortDescription(ptn, isup, otu.signalType(), an); 246 return new OtuPortDescription(ptn, isup, otu.signalType(), an);
......
...@@ -32,7 +32,6 @@ import org.onosproject.core.CoreService; ...@@ -32,7 +32,6 @@ import org.onosproject.core.CoreService;
32 import org.onosproject.net.AnnotationKeys; 32 import org.onosproject.net.AnnotationKeys;
33 import org.onosproject.net.CltSignalType; 33 import org.onosproject.net.CltSignalType;
34 import org.onosproject.net.ConnectPoint; 34 import org.onosproject.net.ConnectPoint;
35 -import org.onosproject.net.OduCltPort;
36 import org.onosproject.net.OduSignalId; 35 import org.onosproject.net.OduSignalId;
37 import org.onosproject.net.OduSignalType; 36 import org.onosproject.net.OduSignalType;
38 import org.onosproject.net.OduSignalUtils; 37 import org.onosproject.net.OduSignalUtils;
...@@ -60,6 +59,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent; ...@@ -60,6 +59,7 @@ import org.onosproject.net.intent.OpticalCircuitIntent;
60 import org.onosproject.net.intent.OpticalConnectivityIntent; 59 import org.onosproject.net.intent.OpticalConnectivityIntent;
61 import org.onosproject.net.intent.impl.IntentCompilationException; 60 import org.onosproject.net.intent.impl.IntentCompilationException;
62 import org.onosproject.net.optical.OchPort; 61 import org.onosproject.net.optical.OchPort;
62 +import org.onosproject.net.optical.OduCltPort;
63 import org.onosproject.net.intent.IntentSetMultimap; 63 import org.onosproject.net.intent.IntentSetMultimap;
64 import org.onosproject.net.resource.ResourceAllocation; 64 import org.onosproject.net.resource.ResourceAllocation;
65 import org.onosproject.net.resource.Resource; 65 import org.onosproject.net.resource.Resource;
......
...@@ -27,7 +27,6 @@ import org.onosproject.net.ConnectPoint; ...@@ -27,7 +27,6 @@ import org.onosproject.net.ConnectPoint;
27 import org.onosproject.net.DeviceId; 27 import org.onosproject.net.DeviceId;
28 import org.onosproject.net.Link; 28 import org.onosproject.net.Link;
29 import org.onosproject.net.LinkKey; 29 import org.onosproject.net.LinkKey;
30 -import org.onosproject.net.OduCltPort;
31 import org.onosproject.net.OduSignalId; 30 import org.onosproject.net.OduSignalId;
32 import org.onosproject.net.OduSignalType; 31 import org.onosproject.net.OduSignalType;
33 import org.onosproject.net.OduSignalUtils; 32 import org.onosproject.net.OduSignalUtils;
...@@ -50,6 +49,7 @@ import org.onosproject.net.intent.IntentCompiler; ...@@ -50,6 +49,7 @@ import org.onosproject.net.intent.IntentCompiler;
50 import org.onosproject.net.intent.IntentExtensionService; 49 import org.onosproject.net.intent.IntentExtensionService;
51 import org.onosproject.net.intent.OpticalOduIntent; 50 import org.onosproject.net.intent.OpticalOduIntent;
52 import org.onosproject.net.intent.impl.IntentCompilationException; 51 import org.onosproject.net.intent.impl.IntentCompilationException;
52 +import org.onosproject.net.optical.OduCltPort;
53 import org.onosproject.net.resource.Resource; 53 import org.onosproject.net.resource.Resource;
54 import org.onosproject.net.resource.ResourceService; 54 import org.onosproject.net.resource.ResourceService;
55 import org.onosproject.net.resource.ResourceAllocation; 55 import org.onosproject.net.resource.ResourceAllocation;
...@@ -77,6 +77,7 @@ import java.util.stream.Stream; ...@@ -77,6 +77,7 @@ import java.util.stream.Stream;
77 77
78 import static com.google.common.base.Preconditions.checkArgument; 78 import static com.google.common.base.Preconditions.checkArgument;
79 import static org.onosproject.net.LinkKey.linkKey; 79 import static org.onosproject.net.LinkKey.linkKey;
80 +import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
80 81
81 /** 82 /**
82 * An intent compiler for {@link org.onosproject.net.intent.OpticalOduIntent}. 83 * An intent compiler for {@link org.onosproject.net.intent.OpticalOduIntent}.
...@@ -105,6 +106,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent ...@@ -105,6 +106,7 @@ public class OpticalOduIntentCompiler implements IntentCompiler<OpticalOduIntent
105 106
106 @Activate 107 @Activate
107 public void activate() { 108 public void activate() {
109 + deviceService = opticalView(deviceService);
108 appId = coreService.registerApplication("org.onosproject.net.intent"); 110 appId = coreService.registerApplication("org.onosproject.net.intent");
109 intentManager.registerCompiler(OpticalOduIntent.class, this); 111 intentManager.registerCompiler(OpticalOduIntent.class, this);
110 } 112 }
......
...@@ -35,7 +35,6 @@ import org.onosproject.net.DefaultPort; ...@@ -35,7 +35,6 @@ import org.onosproject.net.DefaultPort;
35 import org.onosproject.net.Device; 35 import org.onosproject.net.Device;
36 import org.onosproject.net.DeviceId; 36 import org.onosproject.net.DeviceId;
37 import org.onosproject.net.OchSignal; 37 import org.onosproject.net.OchSignal;
38 -import org.onosproject.net.OduCltPort;
39 import org.onosproject.net.OduSignalId; 38 import org.onosproject.net.OduSignalId;
40 import org.onosproject.net.OduSignalType; 39 import org.onosproject.net.OduSignalType;
41 import org.onosproject.net.OduSignalUtils; 40 import org.onosproject.net.OduSignalUtils;
...@@ -58,7 +57,9 @@ import org.onosproject.net.intent.Key; ...@@ -58,7 +57,9 @@ import org.onosproject.net.intent.Key;
58 import org.onosproject.net.intent.MockIdGenerator; 57 import org.onosproject.net.intent.MockIdGenerator;
59 import org.onosproject.net.intent.OpticalCircuitIntent; 58 import org.onosproject.net.intent.OpticalCircuitIntent;
60 import org.onosproject.net.optical.OchPort; 59 import org.onosproject.net.optical.OchPort;
60 +import org.onosproject.net.optical.OduCltPort;
61 import org.onosproject.net.optical.impl.DefaultOchPort; 61 import org.onosproject.net.optical.impl.DefaultOchPort;
62 +import org.onosproject.net.optical.impl.DefaultOduCltPort;
62 import org.onosproject.net.provider.ProviderId; 63 import org.onosproject.net.provider.ProviderId;
63 import org.onosproject.net.intent.IntentSetMultimap; 64 import org.onosproject.net.intent.IntentSetMultimap;
64 import org.onosproject.net.behaviour.TributarySlotQuery; 65 import org.onosproject.net.behaviour.TributarySlotQuery;
...@@ -124,9 +125,11 @@ public class OpticalCircuitIntentCompilerTest { ...@@ -124,9 +125,11 @@ public class OpticalCircuitIntentCompilerTest {
124 125
125 // OduClt ports with signalType=1GBE 126 // OduClt ports with signalType=1GBE
126 private static final OduCltPort D1P1 = 127 private static final OduCltPort D1P1 =
127 - new OduCltPort(device1, PortNumber.portNumber(1), true, CltSignalType.CLT_1GBE, annotations1); 128 + new DefaultOduCltPort(new DefaultPort(device1, PortNumber.portNumber(1), true, annotations1),
129 + CltSignalType.CLT_1GBE);
128 private static final OduCltPort D2P1 = 130 private static final OduCltPort D2P1 =
129 - new OduCltPort(device2, PortNumber.portNumber(1), true, CltSignalType.CLT_1GBE, annotations1); 131 + new DefaultOduCltPort(new DefaultPort(device2, PortNumber.portNumber(1), true, annotations1),
132 + CltSignalType.CLT_1GBE);
130 133
131 // Och ports with signalType=ODU2 134 // Och ports with signalType=ODU2
132 private static final OchPort D1P2 = 135 private static final OchPort D1P2 =
...@@ -140,9 +143,11 @@ public class OpticalCircuitIntentCompilerTest { ...@@ -140,9 +143,11 @@ public class OpticalCircuitIntentCompilerTest {
140 143
141 // OduClt ports with signalType=10GBE 144 // OduClt ports with signalType=10GBE
142 private static final OduCltPort D1P3 = 145 private static final OduCltPort D1P3 =
143 - new OduCltPort(device1, PortNumber.portNumber(3), true, CltSignalType.CLT_10GBE, annotations1); 146 + new DefaultOduCltPort(new DefaultPort(device1, PortNumber.portNumber(3), true, annotations1),
147 + CltSignalType.CLT_10GBE);
144 private static final OduCltPort D2P3 = 148 private static final OduCltPort D2P3 =
145 - new OduCltPort(device2, PortNumber.portNumber(3), true, CltSignalType.CLT_10GBE, annotations1); 149 + new DefaultOduCltPort(new DefaultPort(device2, PortNumber.portNumber(3), true, annotations1),
150 + CltSignalType.CLT_10GBE);
146 151
147 152
148 private OpticalCircuitIntent intent; 153 private OpticalCircuitIntent intent;
......
...@@ -23,6 +23,7 @@ import org.onosproject.TestApplicationId; ...@@ -23,6 +23,7 @@ import org.onosproject.TestApplicationId;
23 import org.onosproject.core.ApplicationId; 23 import org.onosproject.core.ApplicationId;
24 import org.onosproject.core.CoreService; 24 import org.onosproject.core.CoreService;
25 import org.onosproject.core.IdGenerator; 25 import org.onosproject.core.IdGenerator;
26 +import org.onosproject.net.AbstractProjectableModel;
26 import org.onosproject.net.Annotations; 27 import org.onosproject.net.Annotations;
27 import org.onosproject.net.DefaultAnnotations; 28 import org.onosproject.net.DefaultAnnotations;
28 import org.onosproject.net.CltSignalType; 29 import org.onosproject.net.CltSignalType;
...@@ -30,10 +31,10 @@ import org.onosproject.net.ConnectPoint; ...@@ -30,10 +31,10 @@ import org.onosproject.net.ConnectPoint;
30 import org.onosproject.net.DefaultDevice; 31 import org.onosproject.net.DefaultDevice;
31 import org.onosproject.net.DefaultLink; 32 import org.onosproject.net.DefaultLink;
32 import org.onosproject.net.DefaultPath; 33 import org.onosproject.net.DefaultPath;
34 +import org.onosproject.net.DefaultPort;
33 import org.onosproject.net.Device; 35 import org.onosproject.net.Device;
34 import org.onosproject.net.DeviceId; 36 import org.onosproject.net.DeviceId;
35 import org.onosproject.net.Link; 37 import org.onosproject.net.Link;
36 -import org.onosproject.net.OduCltPort;
37 import org.onosproject.net.OduSignalId; 38 import org.onosproject.net.OduSignalId;
38 import org.onosproject.net.OduSignalType; 39 import org.onosproject.net.OduSignalType;
39 import org.onosproject.net.OduSignalUtils; 40 import org.onosproject.net.OduSignalUtils;
...@@ -56,11 +57,15 @@ import org.onosproject.net.intent.IntentExtensionService; ...@@ -56,11 +57,15 @@ import org.onosproject.net.intent.IntentExtensionService;
56 import org.onosproject.net.intent.Key; 57 import org.onosproject.net.intent.Key;
57 import org.onosproject.net.intent.MockIdGenerator; 58 import org.onosproject.net.intent.MockIdGenerator;
58 import org.onosproject.net.intent.OpticalOduIntent; 59 import org.onosproject.net.intent.OpticalOduIntent;
60 +import org.onosproject.net.optical.OduCltPort;
61 +import org.onosproject.net.optical.impl.DefaultOduCltPort;
59 import org.onosproject.net.provider.ProviderId; 62 import org.onosproject.net.provider.ProviderId;
60 import org.onosproject.net.topology.LinkWeight; 63 import org.onosproject.net.topology.LinkWeight;
61 import org.onosproject.net.topology.Topology; 64 import org.onosproject.net.topology.Topology;
62 import org.onosproject.net.topology.TopologyServiceAdapter; 65 import org.onosproject.net.topology.TopologyServiceAdapter;
63 import org.onosproject.net.device.DeviceServiceAdapter; 66 import org.onosproject.net.device.DeviceServiceAdapter;
67 +import org.onosproject.net.driver.DriverService;
68 +import org.onosproject.net.driver.DriverServiceAdapter;
64 69
65 import com.google.common.collect.ImmutableList; 70 import com.google.common.collect.ImmutableList;
66 import com.google.common.collect.Sets; 71 import com.google.common.collect.Sets;
...@@ -116,9 +121,11 @@ public class OpticalOduIntentCompilerTest { ...@@ -116,9 +121,11 @@ public class OpticalOduIntentCompilerTest {
116 121
117 // OduClt ports with signalType=1GBE 122 // OduClt ports with signalType=1GBE
118 private static final OduCltPort D1P1 = 123 private static final OduCltPort D1P1 =
119 - new OduCltPort(device1, PortNumber.portNumber(1), true, CltSignalType.CLT_1GBE, annotations1); 124 + new DefaultOduCltPort(new DefaultPort(device1, PortNumber.portNumber(1), true, annotations1),
125 + CltSignalType.CLT_1GBE);
120 private static final OduCltPort D3P2 = 126 private static final OduCltPort D3P2 =
121 - new OduCltPort(device3, PortNumber.portNumber(2), true, CltSignalType.CLT_1GBE, annotations1); 127 + new DefaultOduCltPort(new DefaultPort(device3, PortNumber.portNumber(2), true, annotations1),
128 + CltSignalType.CLT_1GBE);
122 129
123 // Otu ports with signalType=ODU2 130 // Otu ports with signalType=ODU2
124 private static final OtuPort D1P2 = 131 private static final OtuPort D1P2 =
...@@ -132,9 +139,11 @@ public class OpticalOduIntentCompilerTest { ...@@ -132,9 +139,11 @@ public class OpticalOduIntentCompilerTest {
132 139
133 // OduClt ports with signalType=10GBE 140 // OduClt ports with signalType=10GBE
134 private static final OduCltPort D1P3 = 141 private static final OduCltPort D1P3 =
135 - new OduCltPort(device1, PortNumber.portNumber(3), true, CltSignalType.CLT_10GBE, annotations1); 142 + new DefaultOduCltPort(new DefaultPort(device1, PortNumber.portNumber(3), true, annotations1),
143 + CltSignalType.CLT_10GBE);
136 private static final OduCltPort D3P3 = 144 private static final OduCltPort D3P3 =
137 - new OduCltPort(device3, PortNumber.portNumber(3), true, CltSignalType.CLT_10GBE, annotations1); 145 + new DefaultOduCltPort(new DefaultPort(device3, PortNumber.portNumber(3), true, annotations1),
146 + CltSignalType.CLT_10GBE);
138 147
139 // OduCltPort ConnectPoints 148 // OduCltPort ConnectPoints
140 private final ConnectPoint d1p1 = new ConnectPoint(device1.id(), D1P1.number()); 149 private final ConnectPoint d1p1 = new ConnectPoint(device1.id(), D1P1.number());
...@@ -204,11 +213,11 @@ public class OpticalOduIntentCompilerTest { ...@@ -204,11 +213,11 @@ public class OpticalOduIntentCompilerTest {
204 if (deviceId.equals(deviceId(DEV1))) { 213 if (deviceId.equals(deviceId(DEV1))) {
205 switch (portNumber.toString()) { 214 switch (portNumber.toString()) {
206 case "1": 215 case "1":
207 - return (Port) D1P1; 216 + return D1P1;
208 case "2": 217 case "2":
209 - return (Port) D1P2; 218 + return D1P2;
210 case "3": 219 case "3":
211 - return (Port) D1P3; 220 + return D1P3;
212 default: 221 default:
213 return null; 222 return null;
214 } 223 }
...@@ -216,9 +225,9 @@ public class OpticalOduIntentCompilerTest { ...@@ -216,9 +225,9 @@ public class OpticalOduIntentCompilerTest {
216 if (deviceId.equals(deviceId(DEV2))) { 225 if (deviceId.equals(deviceId(DEV2))) {
217 switch (portNumber.toString()) { 226 switch (portNumber.toString()) {
218 case "1": 227 case "1":
219 - return (Port) D2P1; 228 + return D2P1;
220 case "2": 229 case "2":
221 - return (Port) D2P2; 230 + return D2P2;
222 default: 231 default:
223 return null; 232 return null;
224 } 233 }
...@@ -226,11 +235,11 @@ public class OpticalOduIntentCompilerTest { ...@@ -226,11 +235,11 @@ public class OpticalOduIntentCompilerTest {
226 if (deviceId.equals(deviceId(DEV3))) { 235 if (deviceId.equals(deviceId(DEV3))) {
227 switch (portNumber.toString()) { 236 switch (portNumber.toString()) {
228 case "1": 237 case "1":
229 - return (Port) D3P1; 238 + return D3P1;
230 case "2": 239 case "2":
231 - return (Port) D3P2; 240 + return D3P2;
232 case "3": 241 case "3":
233 - return (Port) D3P3; 242 + return D3P3;
234 default: 243 default:
235 return null; 244 return null;
236 } 245 }
...@@ -239,8 +248,15 @@ public class OpticalOduIntentCompilerTest { ...@@ -239,8 +248,15 @@ public class OpticalOduIntentCompilerTest {
239 } 248 }
240 } 249 }
241 250
251 + private static class MockDriverService extends DriverServiceAdapter
252 + implements DriverService {
253 + // TODO override to return appropriate driver,
254 + // with DefaultOpticalDevice support, etc.
255 + }
256 +
242 @Before 257 @Before
243 public void setUp() { 258 public void setUp() {
259 + AbstractProjectableModel.setDriverService(null, new MockDriverService());
244 sut = new OpticalOduIntentCompiler(); 260 sut = new OpticalOduIntentCompiler();
245 coreService = createMock(CoreService.class); 261 coreService = createMock(CoreService.class);
246 expect(coreService.registerApplication("org.onosproject.net.intent")) 262 expect(coreService.registerApplication("org.onosproject.net.intent"))
......
...@@ -18,6 +18,7 @@ package org.onosproject.store.device.impl; ...@@ -18,6 +18,7 @@ package org.onosproject.store.device.impl;
18 import static com.google.common.base.Preconditions.checkNotNull; 18 import static com.google.common.base.Preconditions.checkNotNull;
19 import static org.onosproject.net.DefaultAnnotations.union; 19 import static org.onosproject.net.DefaultAnnotations.union;
20 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription; 20 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription;
21 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
21 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription; 22 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription;
22 23
23 import java.util.Collections; 24 import java.util.Collections;
...@@ -140,11 +141,20 @@ class DeviceDescriptions { ...@@ -140,11 +141,20 @@ class DeviceDescriptions {
140 } 141 }
141 break; 142 break;
142 case ODUCLT: 143 case ODUCLT:
143 - OduCltPortDescription ocDesc = (OduCltPortDescription) (newDesc.value()); 144 + if (newDesc.value() instanceof OduCltPortDescription) {
144 - newOne = new Timestamped<>( 145 + // remove if-block after deprecation is complete
145 - new OduCltPortDescription( 146 + OduCltPortDescription ocDesc = (OduCltPortDescription) (newDesc.value());
146 - ocDesc, ocDesc.signalType(), merged), 147 + newOne = new Timestamped<>(
147 - newDesc.timestamp()); 148 + oduCltPortDescription(ocDesc,
149 + ocDesc.signalType(),
150 + merged),
151 + newDesc.timestamp());
152 + } else {
153 + // same as default case
154 + newOne = new Timestamped<>(
155 + new DefaultPortDescription(newDesc.value(), merged),
156 + newDesc.timestamp());
157 + }
148 break; 158 break;
149 case OTU: 159 case OTU:
150 OtuPortDescription otuDesc = (OtuPortDescription) (newDesc.value()); 160 OtuPortDescription otuDesc = (OtuPortDescription) (newDesc.value());
......
...@@ -549,8 +549,14 @@ public class ECDeviceStore ...@@ -549,8 +549,14 @@ public class ECDeviceStore
549 return new DefaultPort(device, number, isEnabled, description.type(), 549 return new DefaultPort(device, number, isEnabled, description.type(),
550 description.portSpeed(), annotations); 550 description.portSpeed(), annotations);
551 case ODUCLT: 551 case ODUCLT:
552 - OduCltPortDescription oduDesc = (OduCltPortDescription) description; 552 + if (description instanceof OduCltPortDescription) {
553 - return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations); 553 + // remove if-block once deprecation is complete
554 + OduCltPortDescription oduDesc = (OduCltPortDescription) description;
555 + return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations);
556 + }
557 + // same as default
558 + return new DefaultPort(device, number, isEnabled, description.type(),
559 + description.portSpeed(), annotations);
554 default: 560 default:
555 return new DefaultPort(device, number, isEnabled, description.type(), 561 return new DefaultPort(device, number, isEnabled, description.type(),
556 description.portSpeed(), annotations); 562 description.portSpeed(), annotations);
......
...@@ -1107,8 +1107,14 @@ public class GossipDeviceStore ...@@ -1107,8 +1107,14 @@ public class GossipDeviceStore
1107 return new DefaultPort(device, number, isEnabled, description.type(), 1107 return new DefaultPort(device, number, isEnabled, description.type(),
1108 description.portSpeed(), annotations); 1108 description.portSpeed(), annotations);
1109 case ODUCLT: 1109 case ODUCLT:
1110 - OduCltPortDescription oduDesc = (OduCltPortDescription) description; 1110 + if (description instanceof OduCltPortDescription) {
1111 - return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations); 1111 + // remove if-block once deprecation is complete
1112 + OduCltPortDescription oduDesc = (OduCltPortDescription) description;
1113 + return new OduCltPort(device, number, isEnabled, oduDesc.signalType(), annotations);
1114 + }
1115 + // same as default
1116 + return new DefaultPort(device, number, isEnabled, description.type(),
1117 + description.portSpeed(), annotations);
1112 case OTU: 1118 case OTU:
1113 OtuPortDescription otuDesc = (OtuPortDescription) description; 1119 OtuPortDescription otuDesc = (OtuPortDescription) description;
1114 return new OtuPort(device, number, isEnabled, otuDesc.signalType(), annotations); 1120 return new OtuPort(device, number, isEnabled, otuDesc.signalType(), annotations);
......
...@@ -27,7 +27,6 @@ import org.onosproject.net.DefaultAnnotations; ...@@ -27,7 +27,6 @@ import org.onosproject.net.DefaultAnnotations;
27 import org.onosproject.net.DeviceId; 27 import org.onosproject.net.DeviceId;
28 import org.onosproject.net.PortNumber; 28 import org.onosproject.net.PortNumber;
29 import org.onosproject.net.behaviour.PortDiscovery; 29 import org.onosproject.net.behaviour.PortDiscovery;
30 -import org.onosproject.net.device.OduCltPortDescription;
31 import org.onosproject.net.device.PortDescription; 30 import org.onosproject.net.device.PortDescription;
32 import org.onosproject.net.driver.AbstractHandlerBehaviour; 31 import org.onosproject.net.driver.AbstractHandlerBehaviour;
33 import org.onosproject.net.driver.DriverHandler; 32 import org.onosproject.net.driver.DriverHandler;
...@@ -37,6 +36,7 @@ import java.util.ArrayList; ...@@ -37,6 +36,7 @@ import java.util.ArrayList;
37 import java.util.List; 36 import java.util.List;
38 37
39 import static com.google.common.base.Preconditions.checkNotNull; 38 import static com.google.common.base.Preconditions.checkNotNull;
39 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
40 40
41 /** 41 /**
42 * Discovers the ports from a Ciena WaveServer Rest device. 42 * Discovers the ports from a Ciena WaveServer Rest device.
...@@ -114,7 +114,7 @@ public class PortDiscoveryCienaWaveserverImpl extends AbstractHandlerBehaviour ...@@ -114,7 +114,7 @@ public class PortDiscoveryCienaWaveserverImpl extends AbstractHandlerBehaviour
114 sub.getString(SPEED).replace(GBPS, EMPTY_STRING) 114 sub.getString(SPEED).replace(GBPS, EMPTY_STRING)
115 .replace(" ", EMPTY_STRING))) == speed100GbpsinMbps ? 115 .replace(" ", EMPTY_STRING))) == speed100GbpsinMbps ?
116 CltSignalType.CLT_100GBE : null; 116 CltSignalType.CLT_100GBE : null;
117 - ports.add(new OduCltPortDescription(PortNumber.portNumber(sub.getLong(PORT_ID)), 117 + ports.add(oduCltPortDescription(PortNumber.portNumber(sub.getLong(PORT_ID)),
118 sub.getString(ADMIN_STATE).equals(ENABLED), 118 sub.getString(ADMIN_STATE).equals(ENABLED),
119 cltType, annotations.build())); 119 cltType, annotations.build()));
120 } 120 }
......
...@@ -32,12 +32,12 @@ import org.onosproject.net.OduSignalType; ...@@ -32,12 +32,12 @@ import org.onosproject.net.OduSignalType;
32 import org.onosproject.net.PortNumber; 32 import org.onosproject.net.PortNumber;
33 import org.onosproject.net.SparseAnnotations; 33 import org.onosproject.net.SparseAnnotations;
34 import org.onosproject.net.behaviour.ControllerInfo; 34 import org.onosproject.net.behaviour.ControllerInfo;
35 -import org.onosproject.net.device.OduCltPortDescription;
36 import org.onosproject.net.device.PortDescription; 35 import org.onosproject.net.device.PortDescription;
37 import org.slf4j.Logger; 36 import org.slf4j.Logger;
38 import org.slf4j.LoggerFactory; 37 import org.slf4j.LoggerFactory;
39 38
40 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription; 39 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription;
40 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
41 41
42 import java.io.InputStream; 42 import java.io.InputStream;
43 import java.io.StringWriter; 43 import java.io.StringWriter;
...@@ -119,7 +119,7 @@ public final class XmlConfigParser { ...@@ -119,7 +119,7 @@ public final class XmlConfigParser {
119 return ochPortDescription(portNumber, enabled, signalType, isTunable, lambda, annotations); 119 return ochPortDescription(portNumber, enabled, signalType, isTunable, lambda, annotations);
120 } 120 }
121 121
122 - private static OduCltPortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) { 122 + private static PortDescription parseT100OduPort(HierarchicalConfiguration cfg, long count) {
123 PortNumber portNumber = PortNumber.portNumber(count); 123 PortNumber portNumber = PortNumber.portNumber(count);
124 HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet"); 124 HierarchicalConfiguration ethernetConfig = cfg.configurationAt("ethernet");
125 boolean enabled = ethernetConfig.getString("administrative-state").equals("up"); 125 boolean enabled = ethernetConfig.getString("administrative-state").equals("up");
...@@ -129,7 +129,7 @@ public final class XmlConfigParser { ...@@ -129,7 +129,7 @@ public final class XmlConfigParser {
129 DefaultAnnotations annotations = DefaultAnnotations.builder(). 129 DefaultAnnotations annotations = DefaultAnnotations.builder().
130 set(AnnotationKeys.PORT_NAME, cfg.getString("name")). 130 set(AnnotationKeys.PORT_NAME, cfg.getString("name")).
131 build(); 131 build();
132 - return new OduCltPortDescription(portNumber, enabled, signalType, annotations); 132 + return oduCltPortDescription(portNumber, enabled, signalType, annotations);
133 } 133 }
134 134
135 protected static String parseSwitchId(HierarchicalConfiguration cfg) { 135 protected static String parseSwitchId(HierarchicalConfiguration cfg) {
......
...@@ -22,6 +22,7 @@ import static org.onosproject.net.DeviceId.deviceId; ...@@ -22,6 +22,7 @@ import static org.onosproject.net.DeviceId.deviceId;
22 import static org.onosproject.net.Port.Type.COPPER; 22 import static org.onosproject.net.Port.Type.COPPER;
23 import static org.onosproject.net.Port.Type.FIBER; 23 import static org.onosproject.net.Port.Type.FIBER;
24 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription; 24 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription;
25 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
25 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription; 26 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription;
26 import static org.onosproject.openflow.controller.Dpid.dpid; 27 import static org.onosproject.openflow.controller.Dpid.dpid;
27 import static org.onosproject.openflow.controller.Dpid.uri; 28 import static org.onosproject.openflow.controller.Dpid.uri;
...@@ -67,7 +68,6 @@ import org.onosproject.net.device.DeviceDescription; ...@@ -67,7 +68,6 @@ import org.onosproject.net.device.DeviceDescription;
67 import org.onosproject.net.device.DeviceProvider; 68 import org.onosproject.net.device.DeviceProvider;
68 import org.onosproject.net.device.DeviceProviderRegistry; 69 import org.onosproject.net.device.DeviceProviderRegistry;
69 import org.onosproject.net.device.DeviceProviderService; 70 import org.onosproject.net.device.DeviceProviderService;
70 -import org.onosproject.net.device.OduCltPortDescription;
71 import org.onosproject.net.device.OtuPortDescription; 71 import org.onosproject.net.device.OtuPortDescription;
72 import org.onosproject.net.device.PortDescription; 72 import org.onosproject.net.device.PortDescription;
73 import org.onosproject.net.device.PortStatistics; 73 import org.onosproject.net.device.PortStatistics;
...@@ -523,7 +523,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr ...@@ -523,7 +523,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
523 } 523 }
524 524
525 SparseAnnotations annotations = buildOduCltAnnotation(port); 525 SparseAnnotations annotations = buildOduCltAnnotation(port);
526 - return new OduCltPortDescription(portNo, enabled, sigType, annotations); 526 + return oduCltPortDescription(portNo, enabled, sigType, annotations);
527 } 527 }
528 528
529 private SparseAnnotations buildOduCltAnnotation(OFPortDesc port) { 529 private SparseAnnotations buildOduCltAnnotation(OFPortDesc port) {
......
...@@ -39,7 +39,6 @@ import org.onosproject.net.HostLocation; ...@@ -39,7 +39,6 @@ import org.onosproject.net.HostLocation;
39 import org.onosproject.net.Link; 39 import org.onosproject.net.Link;
40 import org.onosproject.net.MastershipRole; 40 import org.onosproject.net.MastershipRole;
41 import org.onosproject.net.OchSignal; 41 import org.onosproject.net.OchSignal;
42 -import org.onosproject.net.OduCltPort;
43 import org.onosproject.net.OduSignalType; 42 import org.onosproject.net.OduSignalType;
44 import org.onosproject.net.Port; 43 import org.onosproject.net.Port;
45 import org.onosproject.net.PortNumber; 44 import org.onosproject.net.PortNumber;
...@@ -53,7 +52,6 @@ import org.onosproject.net.device.DeviceProvider; ...@@ -53,7 +52,6 @@ import org.onosproject.net.device.DeviceProvider;
53 import org.onosproject.net.device.DeviceProviderRegistry; 52 import org.onosproject.net.device.DeviceProviderRegistry;
54 import org.onosproject.net.device.DeviceProviderService; 53 import org.onosproject.net.device.DeviceProviderService;
55 import org.onosproject.net.device.DeviceService; 54 import org.onosproject.net.device.DeviceService;
56 -import org.onosproject.net.device.OduCltPortDescription;
57 import org.onosproject.net.device.PortDescription; 55 import org.onosproject.net.device.PortDescription;
58 import org.onosproject.net.host.DefaultHostDescription; 56 import org.onosproject.net.host.DefaultHostDescription;
59 import org.onosproject.net.host.HostProvider; 57 import org.onosproject.net.host.HostProvider;
...@@ -64,6 +62,7 @@ import org.onosproject.net.link.LinkProvider; ...@@ -64,6 +62,7 @@ import org.onosproject.net.link.LinkProvider;
64 import org.onosproject.net.link.LinkProviderRegistry; 62 import org.onosproject.net.link.LinkProviderRegistry;
65 import org.onosproject.net.link.LinkProviderService; 63 import org.onosproject.net.link.LinkProviderService;
66 import org.onosproject.net.optical.OchPort; 64 import org.onosproject.net.optical.OchPort;
65 +import org.onosproject.net.optical.OduCltPort;
67 import org.onosproject.net.optical.OmsPort; 66 import org.onosproject.net.optical.OmsPort;
68 import org.onosproject.net.provider.ProviderId; 67 import org.onosproject.net.provider.ProviderId;
69 import org.slf4j.Logger; 68 import org.slf4j.Logger;
...@@ -87,6 +86,7 @@ import static org.onosproject.net.PortNumber.portNumber; ...@@ -87,6 +86,7 @@ import static org.onosproject.net.PortNumber.portNumber;
87 import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED; 86 import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
88 import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED; 87 import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED;
89 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription; 88 import static org.onosproject.net.optical.device.OchPortHelper.ochPortDescription;
89 +import static org.onosproject.net.optical.device.OduCltPortHelper.oduCltPortDescription;
90 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription; 90 import static org.onosproject.net.optical.device.OmsPortHelper.omsPortDescription;
91 import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView; 91 import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
92 92
...@@ -265,7 +265,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider { ...@@ -265,7 +265,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
265 case ODUCLT: 265 case ODUCLT:
266 annotations = annotations(node.get("annotations")); 266 annotations = annotations(node.get("annotations"));
267 OduCltPort oduCltPort = (OduCltPort) deviceService.getPort(deviceId, port); 267 OduCltPort oduCltPort = (OduCltPort) deviceService.getPort(deviceId, port);
268 - return new OduCltPortDescription(port, node.path("enabled").asBoolean(true), 268 + return oduCltPortDescription(port, node.path("enabled").asBoolean(true),
269 oduCltPort.signalType(), annotations); 269 oduCltPort.signalType(), annotations);
270 case OCH: 270 case OCH:
271 annotations = annotations(node.get("annotations")); 271 annotations = annotations(node.get("annotations"));
...@@ -487,7 +487,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider { ...@@ -487,7 +487,7 @@ class ConfigProvider implements DeviceProvider, LinkProvider, HostProvider {
487 ochp.number(), ochp.isEnabled(), ochp.signalType(), ochp.isTunable(), ochp.lambda()); 487 ochp.number(), ochp.isEnabled(), ochp.signalType(), ochp.isTunable(), ochp.lambda());
488 case ODUCLT: 488 case ODUCLT:
489 OduCltPort odup = (OduCltPort) p; 489 OduCltPort odup = (OduCltPort) p;
490 - return new OduCltPortDescription( 490 + return oduCltPortDescription(
491 odup.number(), odup.isEnabled(), odup.signalType()); 491 odup.number(), odup.isEnabled(), odup.signalType());
492 default: 492 default:
493 return new DefaultPortDescription(p.number(), p.isEnabled(), p.type(), p.portSpeed()); 493 return new DefaultPortDescription(p.number(), p.isEnabled(), p.type(), p.portSpeed());
......