Pull out enums from OchPort

The following enums are pulled out
- SignalType (renamed to OduSignalType)
- GridType
- ChannelSpacing

Change-Id: Id30e582df9c3c2c5e239df57499ffe9436dd6237
diff --git a/core/api/src/main/java/org/onosproject/net/ChannelSpacing.java b/core/api/src/main/java/org/onosproject/net/ChannelSpacing.java
new file mode 100644
index 0000000..4da9d6b
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/ChannelSpacing.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net;
+
+import org.onlab.util.Frequency;
+
+/**
+ * Represents interval frequency between two neighboring wavelengths.
+ */
+public enum ChannelSpacing {
+    CHL_100GHZ(100),        // 100 GHz
+    CHL_50GHZ(50),          // 50 GHz
+    CHL_25GHZ(25),          // 25 GHz
+    CHL_12P5GHZ(12.5),      // 12.5 GHz
+    CHL_6P25GHZ(6.5);       // 6.25 GHz
+
+    private final Frequency frequency;
+
+    /**
+     * Creates an instance with the specified interval in GHz.
+     *
+     * @param value interval of neighboring wavelengths in GHz.
+     */
+    ChannelSpacing(double value) {
+        this.frequency = Frequency.ofGHz(value);
+    }
+
+    public Frequency frequency() {
+        return frequency;
+    }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/GridType.java b/core/api/src/main/java/org/onosproject/net/GridType.java
new file mode 100644
index 0000000..099b847
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/GridType.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net;
+
+/**
+ * Represents type of wavelength grid.
+ *
+ * <p>
+ * See Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0".
+ * </p>
+ */
+public enum GridType {
+    RES,                // ??
+    DWDM,               // Dense Wavelength Division Multiplexing
+    CWDM,               // Coarse WDM
+    FLEX                // Flex Grid
+}
diff --git a/core/api/src/main/java/org/onosproject/net/OchPort.java b/core/api/src/main/java/org/onosproject/net/OchPort.java
index cdf0dd3..50e9b36 100644
--- a/core/api/src/main/java/org/onosproject/net/OchPort.java
+++ b/core/api/src/main/java/org/onosproject/net/OchPort.java
@@ -31,41 +31,7 @@
     public static final Frequency CENTER_FREQUENCY = Frequency.ofTHz(193.1);
     public static final Frequency FLEX_GRID_SLOT = Frequency.ofGHz(12.5);
 
-    public enum SignalType {
-        ODU0,
-        ODU1,
-        ODU2,
-        ODU2e,
-        ODU3,
-        ODU4
-    }
-
-    public enum GridType {
-        RES,                // ??
-        DWDM,               // Dense Wavelength Division Multiplexing
-        CWDM,               // Coarse WDM
-        FLEX                // Flex Grid
-    }
-
-    public enum ChannelSpacing {
-        CHL_100GHZ(100),        // 100 GHz
-        CHL_50GHZ(50),          // 50 GHz
-        CHL_25GHZ(25),          // 25 GHz
-        CHL_12P5GHZ(12.5),      // 12.5 GHz
-        CHL_6P25GHZ(6.5);       // 6.25 GHz
-
-        private final Frequency frequency;
-
-        ChannelSpacing(double value) {
-            this.frequency = Frequency.ofGHz(value);
-        }
-
-        public Frequency frequency() {
-            return frequency;
-        }
-    }
-
-    private final SignalType signalType;
+    private final OduSignalType signalType;
     private final boolean isTunable;
     private final GridType gridType;
     private final ChannelSpacing channelSpacing;
@@ -89,7 +55,7 @@
      * @param slotGranularity       slot width granularity
      * @param annotations           optional key/value annotations
      */
-    public OchPort(Element element, PortNumber number, boolean isEnabled, SignalType signalType,
+    public OchPort(Element element, PortNumber number, boolean isEnabled, OduSignalType signalType,
                    boolean isTunable, GridType gridType, ChannelSpacing channelSpacing,
                    int spacingMultiplier, int slotGranularity, Annotations... annotations) {
         super(element, number, isEnabled, Type.OCH, 0, annotations);
@@ -106,7 +72,7 @@
      *
      * @return ODU signal type
      */
-    public SignalType signalType() {
+    public OduSignalType signalType() {
         return signalType;
     }
 
diff --git a/core/api/src/main/java/org/onosproject/net/OduSignalType.java b/core/api/src/main/java/org/onosproject/net/OduSignalType.java
new file mode 100644
index 0000000..014c893
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/OduSignalType.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net;
+
+/**
+ * Represents ODU (Optical channel Data Unit) signal type.
+ *
+ * <p>
+ * See ITU G.709 "Interfaces for the Optical Transport Network (OTN)" and
+ * Open Networking Foundation "Optical Transport Protocol Extensions Version 1.0".
+ * </p>
+ */
+public enum OduSignalType {
+    ODU0,
+    ODU1,
+    ODU2,
+    ODU2e,
+    ODU3,
+    ODU4
+}
diff --git a/core/api/src/main/java/org/onosproject/net/device/OchPortDescription.java b/core/api/src/main/java/org/onosproject/net/device/OchPortDescription.java
index c13a004..be15af0 100644
--- a/core/api/src/main/java/org/onosproject/net/device/OchPortDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/device/OchPortDescription.java
@@ -16,9 +16,11 @@
 package org.onosproject.net.device;
 
 import com.google.common.base.MoreObjects;
-import org.onosproject.net.OchPort;
+import org.onosproject.net.ChannelSpacing;
+import org.onosproject.net.GridType;
 import org.onosproject.net.Port;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.OduSignalType;
 import org.onosproject.net.SparseAnnotations;
 
 /**
@@ -26,10 +28,10 @@
  */
 public class OchPortDescription extends DefaultPortDescription {
 
-    private final OchPort.SignalType signalType;
+    private final OduSignalType signalType;
     private final boolean isTunable;
-    private final OchPort.GridType gridType;
-    private final OchPort.ChannelSpacing channelSpacing;
+    private final GridType gridType;
+    private final ChannelSpacing channelSpacing;
     // Frequency = 193.1 THz + spacingMultiplier * channelSpacing
     private final int spacingMultiplier;
     // Slot width = slotGranularity * 12.5 GHz
@@ -48,9 +50,9 @@
      * @param slotGranularity   slow width granularity
      * @param annotations       optional key/value annotations map
      */
-    public OchPortDescription(PortNumber number, boolean isEnabled, OchPort.SignalType signalType,
-                              boolean isTunable, OchPort.GridType gridType,
-                              OchPort.ChannelSpacing channelSpacing,
+    public OchPortDescription(PortNumber number, boolean isEnabled, OduSignalType signalType,
+                              boolean isTunable, GridType gridType,
+                                      ChannelSpacing channelSpacing,
                               int spacingMultiplier, int slotGranularity, SparseAnnotations... annotations) {
         super(number, isEnabled, Port.Type.OCH, 0, annotations);
         this.signalType = signalType;
@@ -73,8 +75,8 @@
      * @param slotGranularity   slot width granularity
      * @param annotations       optional key/value annotations map
      */
-    public OchPortDescription(PortDescription base, OchPort.SignalType signalType, boolean isTunable,
-                              OchPort.GridType gridType, OchPort.ChannelSpacing channelSpacing,
+    public OchPortDescription(PortDescription base, OduSignalType signalType, boolean isTunable,
+                              GridType gridType, ChannelSpacing channelSpacing,
                               int spacingMultiplier, int slotGranularity, SparseAnnotations annotations) {
         super(base, annotations);
         this.signalType = signalType;
@@ -90,7 +92,7 @@
      *
      * @return ODU signal type
      */
-    public OchPort.SignalType signalType() {
+    public OduSignalType signalType() {
         return signalType;
     }
 
@@ -108,7 +110,7 @@
      *
      * @return grid type
      */
-    public OchPort.GridType gridType() {
+    public GridType gridType() {
         return gridType;
     }
 
@@ -117,7 +119,7 @@
      *
      * @return channel spacing
      */
-    public OchPort.ChannelSpacing channelSpacing() {
+    public ChannelSpacing channelSpacing() {
         return channelSpacing;
     }
 
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
index 034bcaf..d047135 100644
--- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
+++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/KryoNamespaces.java
@@ -43,6 +43,7 @@
 import org.onosproject.core.Version;
 import org.onosproject.mastership.MastershipTerm;
 import org.onosproject.net.Annotations;
+import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultAnnotations;
 import org.onosproject.net.DefaultDevice;
@@ -53,6 +54,7 @@
 import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.Element;
+import org.onosproject.net.GridType;
 import org.onosproject.net.HostId;
 import org.onosproject.net.HostLocation;
 import org.onosproject.net.Link;
@@ -62,6 +64,7 @@
 import org.onosproject.net.OmsPort;
 import org.onosproject.net.Port;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.OduSignalType;
 import org.onosproject.net.device.DefaultDeviceDescription;
 import org.onosproject.net.device.DefaultPortDescription;
 import org.onosproject.net.flow.CompletedBatchOperation;
@@ -376,9 +379,9 @@
             .register(Annotations.class)
             .register(OmsPort.class)
             .register(OchPort.class)
-            .register(OchPort.SignalType.class)
-            .register(OchPort.GridType.class)
-            .register(OchPort.ChannelSpacing.class)
+            .register(OduSignalType.class)
+            .register(GridType.class)
+            .register(ChannelSpacing.class)
             .register(OduCltPort.class)
             .register(OduCltPort.SignalType.class)
             .register(
diff --git a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
index c07448f..388532a 100644
--- a/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
+++ b/core/store/serializers/src/test/java/org/onosproject/store/serializers/KryoSerializerTest.java
@@ -30,6 +30,7 @@
 import org.onosproject.core.DefaultGroupId;
 import org.onosproject.mastership.MastershipTerm;
 import org.onosproject.net.Annotations;
+import org.onosproject.net.ChannelSpacing;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DefaultAnnotations;
 import org.onosproject.net.DefaultDevice;
@@ -37,6 +38,7 @@
 import org.onosproject.net.DefaultPort;
 import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
+import org.onosproject.net.GridType;
 import org.onosproject.net.HostLocation;
 import org.onosproject.net.Link;
 import org.onosproject.net.Link.Type;
@@ -45,6 +47,7 @@
 import org.onosproject.net.OduCltPort;
 import org.onosproject.net.OmsPort;
 import org.onosproject.net.PortNumber;
+import org.onosproject.net.OduSignalType;
 import org.onosproject.net.SparseAnnotations;
 import org.onosproject.net.flow.DefaultFlowRule;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -190,10 +193,10 @@
 
     @Test
     public void testOchPort() {
-        testSerializedEquals(new OchPort(DEV1, P1, true, OchPort.SignalType.ODU0, false, OchPort.GridType.DWDM,
-                OchPort.ChannelSpacing.CHL_100GHZ, -8, 4));
-        testSerializedEquals(new OchPort(DEV1, P1, true, OchPort.SignalType.ODU0, false, OchPort.GridType.DWDM,
-                OchPort.ChannelSpacing.CHL_100GHZ, -8, 4, A1_2));
+        testSerializedEquals(new OchPort(DEV1, P1, true, OduSignalType.ODU0, false, GridType.DWDM,
+                ChannelSpacing.CHL_100GHZ, -8, 4));
+        testSerializedEquals(new OchPort(DEV1, P1, true, OduSignalType.ODU0, false, GridType.DWDM,
+                ChannelSpacing.CHL_100GHZ, -8, 4, A1_2));
     }
 
     @Test
@@ -323,10 +326,10 @@
     @Test
     public void testDefaultLinkResourceRequest() {
         testSerializable(DefaultLinkResourceRequest.builder(IntentId.valueOf(2501), ImmutableList.of())
-                       .addLambdaRequest()
-                       .addBandwidthRequest(32.195)
-                       .build()
-                       );
+                        .addLambdaRequest()
+                        .addBandwidthRequest(32.195)
+                        .build()
+        );
     }
 
     @Test