optical configs:
o add integral node to serializer
o add linc-oe 'speed' config field
Change-Id: Ifc0ee8959e3589f3c2372f28fc10780a99278572
diff --git a/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java b/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java
index 4478ead..d0ad5c3 100644
--- a/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/config/basics/OpticalPortConfig.java
@@ -24,6 +24,9 @@
public static final String STATIC_PORT = "staticPort";
public static final String STATIC_LAMBDA = "staticLambda";
+ // **Linc-OE : remove if it's not needed after all.**
+ public static final String SPEED = "speed";
+
/**
* Returns the Enum value representing the type of port.
*
@@ -75,7 +78,8 @@
/**
* Returns the output lambda configured for this port. The lambda value is
- * expressed as a frequency value.
+ * expressed as a frequency value. If the port type doesn't have a notion of
+ * lambdas, this returns an empty Optional.
*
* @return an Optional that may contain a frequency value.
*/
@@ -88,6 +92,20 @@
}
/**
+ * Returns the port speed configured for this port. If the port doesn't have
+ * a notion of speed, this returns an empty Optional.
+ *
+ * @return a port speed value whose default is 0.
+ */
+ public Optional<Integer> speed() {
+ JsonNode s = node.path(SPEED);
+ if (s.isMissingNode()) {
+ return Optional.empty();
+ }
+ return Optional.of(s.asInt());
+ }
+
+ /**
* Sets the port type, or updates it if it's already set. A null argument removes
* this field.
*
@@ -144,4 +162,14 @@
return (OpticalPortConfig) setOrClear(STATIC_LAMBDA, index);
}
+ /**
+ * Sets the port speed, or updates it if already set. A null argument
+ * removes this field.
+ *
+ * @param bw the port bandwidth
+ * @return this OpticalPortConfig instance
+ */
+ public OpticalPortConfig speed(Integer bw) {
+ return (OpticalPortConfig) setOrClear(SPEED, bw);
+ }
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/config/impl/DistributedNetworkConfigStore.java b/core/store/dist/src/main/java/org/onosproject/store/config/impl/DistributedNetworkConfigStore.java
index 5ef4045..b33f32a 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/config/impl/DistributedNetworkConfigStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/config/impl/DistributedNetworkConfigStore.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.BooleanNode;
import com.fasterxml.jackson.databind.node.DoubleNode;
+import com.fasterxml.jackson.databind.node.IntNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.LongNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -90,7 +91,7 @@
.register(ConfigKey.class, ObjectNode.class, ArrayNode.class,
JsonNodeFactory.class, LinkedHashMap.class,
TextNode.class, BooleanNode.class,
- LongNode.class, DoubleNode.class, ShortNode.class);
+ LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class);
configs = storageService.<ConfigKey, ObjectNode>consistentMapBuilder()
.withSerializer(Serializer.using(kryoBuilder.build()))