Move OmsPortHelper annotation keys to OpticalAnnotations
Change-Id: I80ad924a8dfde61ac2fbc1d9836d3f145bfc48dc
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/OpticalAnnotations.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/OpticalAnnotations.java
index 9e9fd25..b53b3d2 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/OpticalAnnotations.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/OpticalAnnotations.java
@@ -26,12 +26,32 @@
private OpticalAnnotations() {}
/**
+ * Annotation key for mininum frequency in Hz.
+ * Value is expected to be an integer.
+ */
+ public static final String MIN_FREQ_HZ = "minFrequency";
+
+ /**
+ * Annotation key for maximum frequency in Hz.
+ * Value is expected be an integer.
+ */
+ public static final String MAX_FREQ_HZ = "maxFrequency";
+
+ /**
+ * Annotation key for grid in Hz.
+ * Value is expected to be an integer.
+ */
+ public static final String GRID_HZ = "grid";
+
+ /**
* Annotation key for optical port's target power.
+ * Value is expected to be an integer.
*/
public static final String TARGET_POWER = "targetPower";
/**
* Annotation key for optical port's current power.
+ * Value is expected to be an integer.
*/
public static final String CURRENT_POWER = "currentPower";
@@ -42,6 +62,7 @@
/**
* Annotation key for optical port's neighbor's PortNumber#toString().
+ * Value is expected to be an integer.
*/
public static final String NEIGHBOR_PORT = "neighborPort";
}
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/device/OmsPortHelper.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/device/OmsPortHelper.java
index 2d83aa2..109b2ed 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/device/OmsPortHelper.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/device/OmsPortHelper.java
@@ -29,6 +29,7 @@
import org.onosproject.net.device.DefaultPortDescription;
import org.onosproject.net.device.PortDescription;
import org.onosproject.net.optical.OmsPort;
+import org.onosproject.net.optical.OpticalAnnotations;
import org.onosproject.net.optical.impl.DefaultOmsPort;
import org.slf4j.Logger;
@@ -43,20 +44,6 @@
private static final Logger log = getLogger(OmsPortHelper.class);
- // Annotation keys
- /**
- * minFrequency in Hz.
- */
- private static final String MIN_FREQ_HZ = "minFrequency";
- /**
- * maxFrequency in Hz.
- */
- private static final String MAX_FREQ_HZ = "maxFrequency";
- /**
- * grid in Hz.
- */
- private static final String GRID_HZ = "grid";
-
/**
* Creates OMS port description based on the supplied information.
*
@@ -78,9 +65,9 @@
Builder builder = DefaultAnnotations.builder();
builder.putAll(annotations);
- builder.set(MIN_FREQ_HZ, String.valueOf(minFrequency.asHz()));
- builder.set(MAX_FREQ_HZ, String.valueOf(maxFrequency.asHz()));
- builder.set(GRID_HZ, String.valueOf(grid.asHz()));
+ builder.set(OpticalAnnotations.MIN_FREQ_HZ, String.valueOf(minFrequency.asHz()));
+ builder.set(OpticalAnnotations.MAX_FREQ_HZ, String.valueOf(maxFrequency.asHz()));
+ builder.set(OpticalAnnotations.GRID_HZ, String.valueOf(grid.asHz()));
long portSpeed = 0;
return new DefaultPortDescription(number, isEnabled, Port.Type.OMS, portSpeed, builder.build());
@@ -133,9 +120,9 @@
try {
Annotations an = port.annotations();
- Frequency minFrequency = Frequency.ofHz(Long.parseLong(an.value(MIN_FREQ_HZ)));
- Frequency maxFrequency = Frequency.ofHz(Long.parseLong(an.value(MAX_FREQ_HZ)));
- Frequency grid = Frequency.ofHz(Long.parseLong(an.value(GRID_HZ)));
+ Frequency minFrequency = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.MIN_FREQ_HZ)));
+ Frequency maxFrequency = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.MAX_FREQ_HZ)));
+ Frequency grid = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.GRID_HZ)));
return Optional.of(new DefaultOmsPort(port, minFrequency, maxFrequency, grid));
@@ -153,7 +140,10 @@
* @return filtered view of given {@link Annotations}
*/
public static Annotations stripHandledAnnotations(Annotations input) {
- return new FilteredAnnotation(input, ImmutableSet.of(MIN_FREQ_HZ, MAX_FREQ_HZ, GRID_HZ));
+ return new FilteredAnnotation(input, ImmutableSet.of(
+ OpticalAnnotations.MIN_FREQ_HZ,
+ OpticalAnnotations.MAX_FREQ_HZ,
+ OpticalAnnotations.GRID_HZ));
}
// not meant to be instantiated