Implementing net config subsystem and revising its interfaces.
Added a few basic configs for device, host and links.
Added initial REST API.
Added CLI.
Tests remain to be added.
Change-Id: Ic7bba4b5ad7d553c51d69f6459b3bff146970323
diff --git a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index adea3af..e306954 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -17,7 +17,11 @@
/**
* Collection of keys for annotation.
- * Definitions of annotation keys needs to be here to avoid scattering.
+ * <p>
+ * Number of the annotation keys have been deprecated as the use of annotations
+ * is being phased out and instead network configuration subsystem is being
+ * phased-in for majority of model meta-data.
+ * </p>
*/
public final class AnnotationKeys {
@@ -26,22 +30,34 @@
/**
* Annotation key for instance name.
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String NAME = "name";
/**
* Annotation key for instance type (e.g. host type).
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String TYPE = "type";
/**
* Annotation key for latitude (e.g. latitude of device).
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String LATITUDE = "latitude";
/**
* Annotation key for longitute (e.g. longitude of device).
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String LONGITUDE = "longitude";
/**
@@ -51,7 +67,10 @@
/**
* Annotation key for the device driver name.
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String DRIVER = "driver";
/**
@@ -61,13 +80,19 @@
/**
* Annotation key for latency.
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String LATENCY = "latency";
/**
* Annotation key for bandwidth.
* The value for this key is interpreted as Mbps.
+ *
+ * @deprecated since Cardinal
*/
+ @Deprecated
public static final String BANDWIDTH = "bandwidth";
/**
diff --git a/core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java b/core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
index 82caf08..d3249ba 100644
--- a/core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
+++ b/core/api/src/main/java/org/onosproject/rest/AbstractWebResource.java
@@ -16,6 +16,7 @@
package org.onosproject.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.onlab.rest.BaseResource;
import org.onosproject.codec.CodecContext;
@@ -27,9 +28,11 @@
*/
public class AbstractWebResource extends BaseResource implements CodecContext {
+ private final ObjectMapper mapper = new ObjectMapper();
+
@Override
public ObjectMapper mapper() {
- return new ObjectMapper();
+ return mapper;
}
/**
@@ -65,4 +68,31 @@
return get(serviceClass);
}
+ /**
+ * Creates and returns a new child object within the specified parent and
+ * bound to the given key.
+ *
+ * @param parent parent object
+ * @param key key for the new child object
+ * @return child object
+ */
+ public ObjectNode newObject(ObjectNode parent, String key) {
+ ObjectNode node = mapper.createObjectNode();
+ parent.set(key, node);
+ return node;
+ }
+
+ /**
+ * Creates and returns a new child array within the specified parent and
+ * bound to the given key.
+ *
+ * @param parent parent object
+ * @param key key for the new child array
+ * @return child array
+ */
+ public ArrayNode newArray(ObjectNode parent, String key) {
+ ArrayNode node = mapper.createArrayNode();
+ parent.set(key, node);
+ return node;
+ }
}