[ONOS-5088] YANG SBI Broker Implementation.
Change-Id: Ibe87e095a4c209c54e3e90aceca0ec9097c5ede0
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java
index 7e2d77c..d644443 100644
--- a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCodecHandler.java
@@ -16,14 +16,14 @@
package org.onosproject.yms.ych;
+import org.onosproject.yms.ydt.YmsOperationType;
+
import java.util.List;
import java.util.Map;
-import org.onosproject.yms.ydt.YmsOperationType;
-
/**
* Abstraction of an entity which provides interfaces to YANG codec handler.
- *
+ * <p>
* In SBI, the provider or driver uses YANG management system as a CODEC
* utility. Providers/drivers register the device schema with YANG management
* system. YANG utils is used to generate the java files corresponding to the
@@ -45,7 +45,7 @@
* @param yangModule YANG utils generated class corresponding to SBI
* device schema module
*/
- void addDeviceSchema(Class yangModule);
+ void addDeviceSchema(Class<?> yangModule);
/**
@@ -55,7 +55,7 @@
* the driver / provider need to provide the list of application(s) module
* object. Each module object contains the request information
* corresponding to that application.
- *
+ * <p>
* The protocols can have a logical root node which acts as a container
* of applications module node. For example in NETCONF, it could be
* data/filter/config, etc. Protocols needs to pass this parameter in the
@@ -68,7 +68,7 @@
* tags that can be attached to the root node, for example in NETCONF,
* the tag type="subtree" can be specified. In such scenarios the
* required tags should be sent as a parameter.
- *
+ * <p>
* The provider / driver would require to operate on multiple schema
* nodes in a single request, for example it may be require to configure
* a tunnel and associate a QOS to this tunnel, in this scenario, it
@@ -79,6 +79,7 @@
* If the request to be generated needs to be a wild card for no
* application(s), then this parameter needs to be null. For example a
* "empty filter" request in NETCONF get request.
+ * <p>
* If the request to be generated needs to be a wild card for all
* application(s), then the driver / provider should not invoke this API,
* as there is no encoding of application related information for the
@@ -113,13 +114,13 @@
* composite operation API is used. The application module object
* containing the request information has both the resource identifier
* part and the resource information part.
- *
+ * <p>
* The protocols can have a logical root node which acts as a container
* of applications module node. For example in RESTCONF, it could be
* RootResource/data, etc. There is no validation done on the value
* of this parameter. It is upto the protocol to use it. It is a
* mandatory parameter and protocols must pass this parameter.
- *
+ * <p>
* The resource to be operated upon in the device is identified in a
* module's schema object. This modules object should contain the
* information about the resource on which the operation needs to be
@@ -179,6 +180,7 @@
* using native JAVA objects. Drivers use this Decode method to translate
* the received protocol specific composite data to YANG modeled Java
* objects.
+ * <p>
* If the response received is not in line with the schema, for example,
* there is some error info, etc, then the decode operation will throw an
* exception and decode operation will fail.
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCompositeEncoding.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCompositeEncoding.java
index 0ad945d..ab58314 100644
--- a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCompositeEncoding.java
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangCompositeEncoding.java
@@ -18,10 +18,10 @@
/**
* Abstraction of an entity which has the composite protocol request.
- *
+ * <p>
* Protocols like RESTCONF, have split the schema specific information across
* different components in the protocol encoding.
- *
+ * <p>
* There is a resource identifier, which is part of the RESTCONF request URL.
* and there is the information about the resource being operated on in the
* request, this is part of the request body.
@@ -49,4 +49,25 @@
* @return the resource information in the protocol encoding format
*/
String getResourceInformation();
+
+ /**
+ * Sets resource identifier.
+ *
+ * @param resourceId resource identifier
+ */
+ void setResourceIdentifier(String resourceId);
+
+ /**
+ * Sets the resource information.
+ *
+ * @param resourceInfo resource information
+ */
+ void setResourceInformation(String resourceInfo);
+
+ /**
+ * Sets the resource identifier type.
+ *
+ * @param idType resource identifier
+ */
+ void setResourceIdentifierType(YangResourceIdentifierType idType);
}
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangDataTreeCodec.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangDataTreeCodec.java
index 246ba32..9a0ad49 100644
--- a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangDataTreeCodec.java
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangDataTreeCodec.java
@@ -21,7 +21,7 @@
/**
* Abstraction of an entity which overrides the default codec.
- *
+ * <p>
* YANG has it extension framework which allows vendor / implementation
* specific operation or extensions. The default CODECs will fail to handle
* such protocol requests. In such scenarios, the providers can register
@@ -40,13 +40,11 @@
* extension or representation of protocol data.
* The operation type will be set in YANG data tree builder.
*
- * @param ydtBuilder Abstract YANG data tree contains the operation
- * request
- * @param protocolOperation protocol operation being performed
+ * @param ydtBuilder Abstract YANG data tree contains the operation
+ * request
* @return protocol specific string representation.
*/
- String encodeYdtToProtocolFormat(YdtBuilder ydtBuilder,
- YmsOperationType protocolOperation);
+ String encodeYdtToProtocolFormat(YdtBuilder ydtBuilder);
/**
* When the YMS need to encode composite protocol operation request, it
@@ -54,24 +52,25 @@
* tree and invoke this registered encode method. Protocol CODEC
* implementation needs to ensure the overridden method can handle any
* specific extension or representation of protocol data.
+ * <p>
* The Initial chain of node in the YDT will have the operation type set
* to NONE to specify it is a resource identifier. The Resource
* information is maintained as a subtree to the resource identifier node.
*
- * @param ydtBuilder Abstract YANG data tree contains the operation
- * request
- * @param protocolOperation protocol operation being performed
+ * @param ydtBuilder Abstract YANG data tree contains the operation
+ * request
* @return composite response containing the requested operation
* information
*/
YangCompositeEncoding encodeYdtToCompositeProtocolFormat(
- YdtBuilder ydtBuilder, YmsOperationType protocolOperation);
+ YdtBuilder ydtBuilder);
/**
* When YMS decode simple protocol operation request it uses the
* registered decode method to translate the protocol data into a
* abstract YANG data tree. Then translate the abstract YANG data
* tree into the YANG modeled Java objects.
+ * <p>
* The CODEC implementation are unaware of the schema against which they
* are performing the codec operation, so YMS will send the schema
* registry on which the YANG data tree needs to operate, so the code
@@ -94,6 +93,7 @@
* registered decode method to translate the protocol data into a
* abstract YANG data tree. Then translate the abstract YANG data
* tree into the YANG modeled Java objects.
+ * <p>
* The CODEC implementation are unaware of the schema against which they
* are performing the codec operation, so YMS will send the schema
* registry on which the YANG data tree needs to operate, so the code
diff --git a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangProtocolEncodingFormat.java b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangProtocolEncodingFormat.java
index 0917d30..b8e37d3 100644
--- a/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangProtocolEncodingFormat.java
+++ b/apps/yms/api/src/main/java/org/onosproject/yms/ych/YangProtocolEncodingFormat.java
@@ -23,10 +23,10 @@
/**
* XML protocol encoding.
*/
- XML_ENCODING,
+ XML,
/**
* JSON protocol encoding.
*/
- JSON_ENCODING
+ JSON
}