Pull out enums from OchPort
The following enums are pulled out - SignalType (renamed to OduSignalType) - GridType - ChannelSpacing Change-Id: Id30e582df9c3c2c5e239df57499ffe9436dd6237
Showing
7 changed files
with
141 additions
and
60 deletions
1 | +/* | ||
2 | + * Copyright 2015 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 org.onlab.util.Frequency; | ||
19 | + | ||
20 | +/** | ||
21 | + * Represents interval frequency between two neighboring wavelengths. | ||
22 | + */ | ||
23 | +public enum ChannelSpacing { | ||
24 | + CHL_100GHZ(100), // 100 GHz | ||
25 | + CHL_50GHZ(50), // 50 GHz | ||
26 | + CHL_25GHZ(25), // 25 GHz | ||
27 | + CHL_12P5GHZ(12.5), // 12.5 GHz | ||
28 | + CHL_6P25GHZ(6.5); // 6.25 GHz | ||
29 | + | ||
30 | + private final Frequency frequency; | ||
31 | + | ||
32 | + /** | ||
33 | + * Creates an instance with the specified interval in GHz. | ||
34 | + * | ||
35 | + * @param value interval of neighboring wavelengths in GHz. | ||
36 | + */ | ||
37 | + ChannelSpacing(double value) { | ||
38 | + this.frequency = Frequency.ofGHz(value); | ||
39 | + } | ||
40 | + | ||
41 | + public Frequency frequency() { | ||
42 | + return frequency; | ||
43 | + } | ||
44 | +} |
1 | +/* | ||
2 | + * Copyright 2015 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 | +/** | ||
19 | + * Represents type of wavelength grid. | ||
20 | + * | ||
21 | + * <p> | ||
22 | + * See Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0". | ||
23 | + * </p> | ||
24 | + */ | ||
25 | +public enum GridType { | ||
26 | + RES, // ?? | ||
27 | + DWDM, // Dense Wavelength Division Multiplexing | ||
28 | + CWDM, // Coarse WDM | ||
29 | + FLEX // Flex Grid | ||
30 | +} |
... | @@ -31,41 +31,7 @@ public class OchPort extends DefaultPort { | ... | @@ -31,41 +31,7 @@ public class OchPort extends DefaultPort { |
31 | public static final Frequency CENTER_FREQUENCY = Frequency.ofTHz(193.1); | 31 | public static final Frequency CENTER_FREQUENCY = Frequency.ofTHz(193.1); |
32 | public static final Frequency FLEX_GRID_SLOT = Frequency.ofGHz(12.5); | 32 | public static final Frequency FLEX_GRID_SLOT = Frequency.ofGHz(12.5); |
33 | 33 | ||
34 | - public enum SignalType { | 34 | + private final OduSignalType signalType; |
35 | - ODU0, | ||
36 | - ODU1, | ||
37 | - ODU2, | ||
38 | - ODU2e, | ||
39 | - ODU3, | ||
40 | - ODU4 | ||
41 | - } | ||
42 | - | ||
43 | - public enum GridType { | ||
44 | - RES, // ?? | ||
45 | - DWDM, // Dense Wavelength Division Multiplexing | ||
46 | - CWDM, // Coarse WDM | ||
47 | - FLEX // Flex Grid | ||
48 | - } | ||
49 | - | ||
50 | - public enum ChannelSpacing { | ||
51 | - CHL_100GHZ(100), // 100 GHz | ||
52 | - CHL_50GHZ(50), // 50 GHz | ||
53 | - CHL_25GHZ(25), // 25 GHz | ||
54 | - CHL_12P5GHZ(12.5), // 12.5 GHz | ||
55 | - CHL_6P25GHZ(6.5); // 6.25 GHz | ||
56 | - | ||
57 | - private final Frequency frequency; | ||
58 | - | ||
59 | - ChannelSpacing(double value) { | ||
60 | - this.frequency = Frequency.ofGHz(value); | ||
61 | - } | ||
62 | - | ||
63 | - public Frequency frequency() { | ||
64 | - return frequency; | ||
65 | - } | ||
66 | - } | ||
67 | - | ||
68 | - private final SignalType signalType; | ||
69 | private final boolean isTunable; | 35 | private final boolean isTunable; |
70 | private final GridType gridType; | 36 | private final GridType gridType; |
71 | private final ChannelSpacing channelSpacing; | 37 | private final ChannelSpacing channelSpacing; |
... | @@ -89,7 +55,7 @@ public class OchPort extends DefaultPort { | ... | @@ -89,7 +55,7 @@ public class OchPort extends DefaultPort { |
89 | * @param slotGranularity slot width granularity | 55 | * @param slotGranularity slot width granularity |
90 | * @param annotations optional key/value annotations | 56 | * @param annotations optional key/value annotations |
91 | */ | 57 | */ |
92 | - public OchPort(Element element, PortNumber number, boolean isEnabled, SignalType signalType, | 58 | + public OchPort(Element element, PortNumber number, boolean isEnabled, OduSignalType signalType, |
93 | boolean isTunable, GridType gridType, ChannelSpacing channelSpacing, | 59 | boolean isTunable, GridType gridType, ChannelSpacing channelSpacing, |
94 | int spacingMultiplier, int slotGranularity, Annotations... annotations) { | 60 | int spacingMultiplier, int slotGranularity, Annotations... annotations) { |
95 | super(element, number, isEnabled, Type.OCH, 0, annotations); | 61 | super(element, number, isEnabled, Type.OCH, 0, annotations); |
... | @@ -106,7 +72,7 @@ public class OchPort extends DefaultPort { | ... | @@ -106,7 +72,7 @@ public class OchPort extends DefaultPort { |
106 | * | 72 | * |
107 | * @return ODU signal type | 73 | * @return ODU signal type |
108 | */ | 74 | */ |
109 | - public SignalType signalType() { | 75 | + public OduSignalType signalType() { |
110 | return signalType; | 76 | return signalType; |
111 | } | 77 | } |
112 | 78 | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 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 | +/** | ||
19 | + * Represents ODU (Optical channel Data Unit) signal type. | ||
20 | + * | ||
21 | + * <p> | ||
22 | + * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" and | ||
23 | + * Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0". | ||
24 | + * </p> | ||
25 | + */ | ||
26 | +public enum OduSignalType { | ||
27 | + ODU0, | ||
28 | + ODU1, | ||
29 | + ODU2, | ||
30 | + ODU2e, | ||
31 | + ODU3, | ||
32 | + ODU4 | ||
33 | +} |
... | @@ -16,9 +16,11 @@ | ... | @@ -16,9 +16,11 @@ |
16 | package org.onosproject.net.device; | 16 | package org.onosproject.net.device; |
17 | 17 | ||
18 | import com.google.common.base.MoreObjects; | 18 | import com.google.common.base.MoreObjects; |
19 | -import org.onosproject.net.OchPort; | 19 | +import org.onosproject.net.ChannelSpacing; |
20 | +import org.onosproject.net.GridType; | ||
20 | import org.onosproject.net.Port; | 21 | import org.onosproject.net.Port; |
21 | import org.onosproject.net.PortNumber; | 22 | import org.onosproject.net.PortNumber; |
23 | +import org.onosproject.net.OduSignalType; | ||
22 | import org.onosproject.net.SparseAnnotations; | 24 | import org.onosproject.net.SparseAnnotations; |
23 | 25 | ||
24 | /** | 26 | /** |
... | @@ -26,10 +28,10 @@ import org.onosproject.net.SparseAnnotations; | ... | @@ -26,10 +28,10 @@ import org.onosproject.net.SparseAnnotations; |
26 | */ | 28 | */ |
27 | public class OchPortDescription extends DefaultPortDescription { | 29 | public class OchPortDescription extends DefaultPortDescription { |
28 | 30 | ||
29 | - private final OchPort.SignalType signalType; | 31 | + private final OduSignalType signalType; |
30 | private final boolean isTunable; | 32 | private final boolean isTunable; |
31 | - private final OchPort.GridType gridType; | 33 | + private final GridType gridType; |
32 | - private final OchPort.ChannelSpacing channelSpacing; | 34 | + private final ChannelSpacing channelSpacing; |
33 | // Frequency = 193.1 THz + spacingMultiplier * channelSpacing | 35 | // Frequency = 193.1 THz + spacingMultiplier * channelSpacing |
34 | private final int spacingMultiplier; | 36 | private final int spacingMultiplier; |
35 | // Slot width = slotGranularity * 12.5 GHz | 37 | // Slot width = slotGranularity * 12.5 GHz |
... | @@ -48,9 +50,9 @@ public class OchPortDescription extends DefaultPortDescription { | ... | @@ -48,9 +50,9 @@ public class OchPortDescription extends DefaultPortDescription { |
48 | * @param slotGranularity slow width granularity | 50 | * @param slotGranularity slow width granularity |
49 | * @param annotations optional key/value annotations map | 51 | * @param annotations optional key/value annotations map |
50 | */ | 52 | */ |
51 | - public OchPortDescription(PortNumber number, boolean isEnabled, OchPort.SignalType signalType, | 53 | + public OchPortDescription(PortNumber number, boolean isEnabled, OduSignalType signalType, |
52 | - boolean isTunable, OchPort.GridType gridType, | 54 | + boolean isTunable, GridType gridType, |
53 | - OchPort.ChannelSpacing channelSpacing, | 55 | + ChannelSpacing channelSpacing, |
54 | int spacingMultiplier, int slotGranularity, SparseAnnotations... annotations) { | 56 | int spacingMultiplier, int slotGranularity, SparseAnnotations... annotations) { |
55 | super(number, isEnabled, Port.Type.OCH, 0, annotations); | 57 | super(number, isEnabled, Port.Type.OCH, 0, annotations); |
56 | this.signalType = signalType; | 58 | this.signalType = signalType; |
... | @@ -73,8 +75,8 @@ public class OchPortDescription extends DefaultPortDescription { | ... | @@ -73,8 +75,8 @@ public class OchPortDescription extends DefaultPortDescription { |
73 | * @param slotGranularity slot width granularity | 75 | * @param slotGranularity slot width granularity |
74 | * @param annotations optional key/value annotations map | 76 | * @param annotations optional key/value annotations map |
75 | */ | 77 | */ |
76 | - public OchPortDescription(PortDescription base, OchPort.SignalType signalType, boolean isTunable, | 78 | + public OchPortDescription(PortDescription base, OduSignalType signalType, boolean isTunable, |
77 | - OchPort.GridType gridType, OchPort.ChannelSpacing channelSpacing, | 79 | + GridType gridType, ChannelSpacing channelSpacing, |
78 | int spacingMultiplier, int slotGranularity, SparseAnnotations annotations) { | 80 | int spacingMultiplier, int slotGranularity, SparseAnnotations annotations) { |
79 | super(base, annotations); | 81 | super(base, annotations); |
80 | this.signalType = signalType; | 82 | this.signalType = signalType; |
... | @@ -90,7 +92,7 @@ public class OchPortDescription extends DefaultPortDescription { | ... | @@ -90,7 +92,7 @@ public class OchPortDescription extends DefaultPortDescription { |
90 | * | 92 | * |
91 | * @return ODU signal type | 93 | * @return ODU signal type |
92 | */ | 94 | */ |
93 | - public OchPort.SignalType signalType() { | 95 | + public OduSignalType signalType() { |
94 | return signalType; | 96 | return signalType; |
95 | } | 97 | } |
96 | 98 | ||
... | @@ -108,7 +110,7 @@ public class OchPortDescription extends DefaultPortDescription { | ... | @@ -108,7 +110,7 @@ public class OchPortDescription extends DefaultPortDescription { |
108 | * | 110 | * |
109 | * @return grid type | 111 | * @return grid type |
110 | */ | 112 | */ |
111 | - public OchPort.GridType gridType() { | 113 | + public GridType gridType() { |
112 | return gridType; | 114 | return gridType; |
113 | } | 115 | } |
114 | 116 | ||
... | @@ -117,7 +119,7 @@ public class OchPortDescription extends DefaultPortDescription { | ... | @@ -117,7 +119,7 @@ public class OchPortDescription extends DefaultPortDescription { |
117 | * | 119 | * |
118 | * @return channel spacing | 120 | * @return channel spacing |
119 | */ | 121 | */ |
120 | - public OchPort.ChannelSpacing channelSpacing() { | 122 | + public ChannelSpacing channelSpacing() { |
121 | return channelSpacing; | 123 | return channelSpacing; |
122 | } | 124 | } |
123 | 125 | ... | ... |
... | @@ -43,6 +43,7 @@ import org.onosproject.core.DefaultGroupId; | ... | @@ -43,6 +43,7 @@ import org.onosproject.core.DefaultGroupId; |
43 | import org.onosproject.core.Version; | 43 | import org.onosproject.core.Version; |
44 | import org.onosproject.mastership.MastershipTerm; | 44 | import org.onosproject.mastership.MastershipTerm; |
45 | import org.onosproject.net.Annotations; | 45 | import org.onosproject.net.Annotations; |
46 | +import org.onosproject.net.ChannelSpacing; | ||
46 | import org.onosproject.net.ConnectPoint; | 47 | import org.onosproject.net.ConnectPoint; |
47 | import org.onosproject.net.DefaultAnnotations; | 48 | import org.onosproject.net.DefaultAnnotations; |
48 | import org.onosproject.net.DefaultDevice; | 49 | import org.onosproject.net.DefaultDevice; |
... | @@ -53,6 +54,7 @@ import org.onosproject.net.DefaultPort; | ... | @@ -53,6 +54,7 @@ import org.onosproject.net.DefaultPort; |
53 | import org.onosproject.net.Device; | 54 | import org.onosproject.net.Device; |
54 | import org.onosproject.net.DeviceId; | 55 | import org.onosproject.net.DeviceId; |
55 | import org.onosproject.net.Element; | 56 | import org.onosproject.net.Element; |
57 | +import org.onosproject.net.GridType; | ||
56 | import org.onosproject.net.HostId; | 58 | import org.onosproject.net.HostId; |
57 | import org.onosproject.net.HostLocation; | 59 | import org.onosproject.net.HostLocation; |
58 | import org.onosproject.net.Link; | 60 | import org.onosproject.net.Link; |
... | @@ -62,6 +64,7 @@ import org.onosproject.net.OduCltPort; | ... | @@ -62,6 +64,7 @@ import org.onosproject.net.OduCltPort; |
62 | import org.onosproject.net.OmsPort; | 64 | import org.onosproject.net.OmsPort; |
63 | import org.onosproject.net.Port; | 65 | import org.onosproject.net.Port; |
64 | import org.onosproject.net.PortNumber; | 66 | import org.onosproject.net.PortNumber; |
67 | +import org.onosproject.net.OduSignalType; | ||
65 | import org.onosproject.net.device.DefaultDeviceDescription; | 68 | import org.onosproject.net.device.DefaultDeviceDescription; |
66 | import org.onosproject.net.device.DefaultPortDescription; | 69 | import org.onosproject.net.device.DefaultPortDescription; |
67 | import org.onosproject.net.flow.CompletedBatchOperation; | 70 | import org.onosproject.net.flow.CompletedBatchOperation; |
... | @@ -376,9 +379,9 @@ public final class KryoNamespaces { | ... | @@ -376,9 +379,9 @@ public final class KryoNamespaces { |
376 | .register(Annotations.class) | 379 | .register(Annotations.class) |
377 | .register(OmsPort.class) | 380 | .register(OmsPort.class) |
378 | .register(OchPort.class) | 381 | .register(OchPort.class) |
379 | - .register(OchPort.SignalType.class) | 382 | + .register(OduSignalType.class) |
380 | - .register(OchPort.GridType.class) | 383 | + .register(GridType.class) |
381 | - .register(OchPort.ChannelSpacing.class) | 384 | + .register(ChannelSpacing.class) |
382 | .register(OduCltPort.class) | 385 | .register(OduCltPort.class) |
383 | .register(OduCltPort.SignalType.class) | 386 | .register(OduCltPort.SignalType.class) |
384 | .register( | 387 | .register( | ... | ... |
... | @@ -30,6 +30,7 @@ import org.onosproject.cluster.RoleInfo; | ... | @@ -30,6 +30,7 @@ import org.onosproject.cluster.RoleInfo; |
30 | import org.onosproject.core.DefaultGroupId; | 30 | import org.onosproject.core.DefaultGroupId; |
31 | import org.onosproject.mastership.MastershipTerm; | 31 | import org.onosproject.mastership.MastershipTerm; |
32 | import org.onosproject.net.Annotations; | 32 | import org.onosproject.net.Annotations; |
33 | +import org.onosproject.net.ChannelSpacing; | ||
33 | import org.onosproject.net.ConnectPoint; | 34 | import org.onosproject.net.ConnectPoint; |
34 | import org.onosproject.net.DefaultAnnotations; | 35 | import org.onosproject.net.DefaultAnnotations; |
35 | import org.onosproject.net.DefaultDevice; | 36 | import org.onosproject.net.DefaultDevice; |
... | @@ -37,6 +38,7 @@ import org.onosproject.net.DefaultLink; | ... | @@ -37,6 +38,7 @@ import org.onosproject.net.DefaultLink; |
37 | import org.onosproject.net.DefaultPort; | 38 | import org.onosproject.net.DefaultPort; |
38 | import org.onosproject.net.Device; | 39 | import org.onosproject.net.Device; |
39 | import org.onosproject.net.DeviceId; | 40 | import org.onosproject.net.DeviceId; |
41 | +import org.onosproject.net.GridType; | ||
40 | import org.onosproject.net.HostLocation; | 42 | import org.onosproject.net.HostLocation; |
41 | import org.onosproject.net.Link; | 43 | import org.onosproject.net.Link; |
42 | import org.onosproject.net.Link.Type; | 44 | import org.onosproject.net.Link.Type; |
... | @@ -45,6 +47,7 @@ import org.onosproject.net.OchPort; | ... | @@ -45,6 +47,7 @@ import org.onosproject.net.OchPort; |
45 | import org.onosproject.net.OduCltPort; | 47 | import org.onosproject.net.OduCltPort; |
46 | import org.onosproject.net.OmsPort; | 48 | import org.onosproject.net.OmsPort; |
47 | import org.onosproject.net.PortNumber; | 49 | import org.onosproject.net.PortNumber; |
50 | +import org.onosproject.net.OduSignalType; | ||
48 | import org.onosproject.net.SparseAnnotations; | 51 | import org.onosproject.net.SparseAnnotations; |
49 | import org.onosproject.net.flow.DefaultFlowRule; | 52 | import org.onosproject.net.flow.DefaultFlowRule; |
50 | import org.onosproject.net.flow.DefaultTrafficSelector; | 53 | import org.onosproject.net.flow.DefaultTrafficSelector; |
... | @@ -190,10 +193,10 @@ public class KryoSerializerTest { | ... | @@ -190,10 +193,10 @@ public class KryoSerializerTest { |
190 | 193 | ||
191 | @Test | 194 | @Test |
192 | public void testOchPort() { | 195 | public void testOchPort() { |
193 | - testSerializedEquals(new OchPort(DEV1, P1, true, OchPort.SignalType.ODU0, false, OchPort.GridType.DWDM, | 196 | + testSerializedEquals(new OchPort(DEV1, P1, true, OduSignalType.ODU0, false, GridType.DWDM, |
194 | - OchPort.ChannelSpacing.CHL_100GHZ, -8, 4)); | 197 | + ChannelSpacing.CHL_100GHZ, -8, 4)); |
195 | - testSerializedEquals(new OchPort(DEV1, P1, true, OchPort.SignalType.ODU0, false, OchPort.GridType.DWDM, | 198 | + testSerializedEquals(new OchPort(DEV1, P1, true, OduSignalType.ODU0, false, GridType.DWDM, |
196 | - OchPort.ChannelSpacing.CHL_100GHZ, -8, 4, A1_2)); | 199 | + ChannelSpacing.CHL_100GHZ, -8, 4, A1_2)); |
197 | } | 200 | } |
198 | 201 | ||
199 | @Test | 202 | @Test |
... | @@ -323,10 +326,10 @@ public class KryoSerializerTest { | ... | @@ -323,10 +326,10 @@ public class KryoSerializerTest { |
323 | @Test | 326 | @Test |
324 | public void testDefaultLinkResourceRequest() { | 327 | public void testDefaultLinkResourceRequest() { |
325 | testSerializable(DefaultLinkResourceRequest.builder(IntentId.valueOf(2501), ImmutableList.of()) | 328 | testSerializable(DefaultLinkResourceRequest.builder(IntentId.valueOf(2501), ImmutableList.of()) |
326 | - .addLambdaRequest() | 329 | + .addLambdaRequest() |
327 | - .addBandwidthRequest(32.195) | 330 | + .addBandwidthRequest(32.195) |
328 | - .build() | 331 | + .build() |
329 | - ); | 332 | + ); |
330 | } | 333 | } |
331 | 334 | ||
332 | @Test | 335 | @Test | ... | ... |
-
Please register or login to post a comment