Gaurav Agrawal
Committed by Gerrit Code Review

[ONOS-4694] YANG management system outline and YMSM/YDT interfaces

Change-Id: I050ed98ba18edc2c2cea2abafeee6d8c9061b579
Showing 29 changed files with 1312 additions and 1 deletions
......@@ -13,7 +13,9 @@
~ 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.
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
......@@ -72,6 +74,7 @@
<module>xosclient</module>
<module>scalablegateway</module>
<module>bmv2-demo</module>
<module>yms</module>
</modules>
......
BUNDLES = [
'//apps/yms/api:onos-apps-yms-api',
'//apps/yms/app:onos-apps-yms-app',
]
onos_app(
title = 'YANG Management System App',
category = 'Utility',
url = 'http://onosproject.org',
included_bundles = BUNDLES,
)
COMPILE_DEPS = [
'//lib:CORE_DEPS',
]
osgi_jar_with_tests(
deps = COMPILE_DEPS,
)
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015-present 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>onos-yms</artifactId>
<groupId>org.onosproject</groupId>
<version>1.7.0-SNAPSHOT</version>
</parent>
<artifactId>onos-app-yms-api</artifactId>
<packaging>bundle</packaging>
<url>http://onosproject.org</url>
<description>YANG Management System API</description>
</project>
/*
* Copyright 2016-present 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.
*/
/**
* Provides interfaces to YANG management system. YANG management system
* is a core of YANG in ONOS.
*
* In NBI, it acts as a broker in between the protocol and application,
* here there is a separate protocol implementation, which does the conversion
* of protocol representation to abstract data tree. The protocol
* implementation takes care of the protocol specific actions for
* e.g. RESTCONF handling the entity-tag / timestamp related operations.
*
* In SBI, driver or provider uses YANG codec handler as a utility to translate
* the request information in java(YANG utils generated) to protocol specific
* format and vice versa.
*/
package org.onosproject.yms;
/*
* Copyright 2016-present 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.yms.ych;
/**
* Abstraction of an entity which provides interfaces to YANG codec handler.
*
* In SBI, the provider or driver uses YANG management system as a CODEC
* utility. These providers/drivers use the YANG codec utility to register
* the device schema. YANG utils is used to generate the java files
* corresponding to the device schema. Provider or driver use these classes
* to seamlessly manage the device as java objects. While sending the request
* to device, drivers use the utility to translate the objects to protocol
* specific data representation and then send to the device.
* Protocol or driver use the same instance of the codec utility across multiple
* translation request.
* Protocol or driver should not use the same instance of utility concurrently.
*/
public interface YangCodecHandler {
//TODO
}
/*
* Copyright 2016-present 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.
*/
/**
* In SBI, the provider or driver uses YANG management system as a CODEC
* utility. These providers/drivers use the YANG codec utility to register
* the device schema. YANG utils is used to generate the java files
* corresponding to the device schema. Provider or driver use these classes
* to seamlessly manage the device as java objects. While sending the request
* to device, drivers use the utility to translate the objects to protocol
* specific data representation and then send to the device.
* Protocol or driver use the same instance of the codec utility across multiple
* translation request.
* Protocol or driver should not use the same instance of utility concurrently.
*/
package org.onosproject.yms.ych;
/*
* Copyright 2016-present 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.yms.ydt;
import org.onosproject.yms.ymsm.YmsOperationType;
/**
* Abstraction of an entity which represent YANG data tree. This is used
* for exchanging information between YANG management system and NBI protocol.
*/
public interface Ydt {
/**
* Returns the root context information available in YDT node. This root
* node is a logical container of a protocol which holds the complete data
* tree. After building YANG data tree, root node can be obtained from this.
*
* @return root YDT context which is logical container of a protocol which
* is holder of the complete tree
*/
YdtContext getRootNode();
/**
* Returns YANG management system operation type. It represents type of
* root level operation for the request. This is used by protocols to
* specify the root level operation associated with the request.
*
* @return YANG management system operation type
*/
YmsOperationType getYmsOperationType();
}
/*
* Copyright 2016-present 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.yms.ydt;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Abstraction of an entity which provides interfaces to build and obtain YANG
* data tree which is data (sub)instance representation, abstract of protocol.
*
* NBI protocols need to translate the protocol operation request, into a
* protocol independent abstract tree called the YANG data tree (YDT). In order
* to enable the protocol in building these abstract data tree, YANG
* management system provides a utility called the YANG data tree builder.
*/
public interface YdtBuilder
extends Ydt {
/**
* Sets root node tag attributes. This is used by protocol
* to specify tag attributes associated with root resource.
*
* @param attributeTag map of root tags attribute values indexed by root
* tag name.
*/
void setRootTagAttributeMap(Map<String, String> attributeTag);
/**
* Returns map of tag attribute list associated with root resource.
*
* @return linked hash map of tag name with value
*/
Map<String, String> getRootTagAttributeMap();
/**
* Adds a last child to YANG data tree, this method is to be used by
* protocols which are unaware of the nature (single/multiple) of node and
* also unaware of the operation type at every node(Example: RESTCONF).
*
* Add child is used to add module/sub-module nodes also. Request may
* contain revision number corresponding to Module/sub-module in that
* case YMS expect revision number to be appended to module/sub-module
* name in the below mentioned format.
* module-or-submodule-name ['@' date-arg]
* date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
* Example: testModule@2016-10-27.
*
* If the revision date is not specified YMS first search for
* registered module/sub-module without revision date, if still can't obtain
* then uses registered module/sub-module with latest revision date.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
*/
void addChild(String name, String namespace);
/**
* Adds a last child to YANG data tree, this method is to be used by
* protocols which are aware of the nature (single/multiple) of node.
*
* Add child is used to add module/sub-module nodes also. Request may
* contain revision number corresponding to Module/sub-module in that
* case YMS expect revision number to be appended to module/sub-module
* name in the below mentioned format.
* module-or-submodule-name ['@' date-arg]
* date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
* Example: testModule@2016-10-27.
*
* If the revision date is not specified YMS first search for
* registered module/sub-module without revision date, if still can't obtain
* then uses registered module/sub-module with latest revision date.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
* @param ydtType type of YDT node to be added
*/
void addChild(String name, String namespace, YdtType ydtType);
/**
* Adds a last child to YANG data tree, this method is to be used by
* protocols which are unaware of the nature (single/multiple) of node.
* This is an overloaded method with operation type. This method can
* optionally
* be used when protocol doesn't want to specify operation type by
* keeping it null.
*
* Add child is used to add module/sub-module nodes also. Request may
* contain revision number corresponding to Module/sub-module in that
* case YMS expect revision number to be appended to module/sub-module
* name in the below mentioned format.
* module-or-submodule-name ['@' date-arg]
* date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
* Example: testModule@2016-10-27.
*
* If the revision date is not specified YMS first search for
* registered module/sub-module without revision date, if still can't obtain
* then uses registered module/sub-module with latest revision date.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
* @param opType type of requested operation over a node
*/
void addChild(String name, String namespace,
YdtContextOperationType opType);
/**
* Adds a last child to YANG data tree, this method is to be used by
* protocols which are aware of the nature (single/multiple) of node.
* This is an overloaded method with operation type. This method can
* optionally
* be used when protocol doesn't want to specify operation type by
* keeping it null.
*
* Add child is used to add module/sub-module nodes also. Request may
* contain revision number corresponding to Module/sub-module in that
* case YMS expect revision number to be appended to module/sub-module
* name in the below mentioned format.
* module-or-submodule-name ['@' date-arg]
* date-arg = 4DIGIT "-" 2DIGIT "-" 2DIGIT
* Example: testModule@2016-10-27.
*
* If the revision date is not specified YMS first search for
* registered module/sub-module without revision date, if still can't obtain
* then uses registered module/sub-module with latest revision date.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
* @param ydtType type of YDT node to be added
* @param opType type of requested operation over a node
*/
void addChild(String name, String namespace, YdtType ydtType,
YdtContextOperationType opType);
/**
* Adds a last leaf with value to YANG data tree. Protocols unaware of
* nature
* of leaf (single/multiple) will use it to add both single instance and
* multi instance node. Protocols aware of nature of node will use it for
* single instance value node addition.
* Value of leaf can be null which indicates selection node in get
* operation.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
* @param value value of the child
*/
void addLeaf(String name, String namespace, String value);
/**
* Adds a last leaf with list of values to YANG data tree. This method is
* used by protocols which knows the nature (single/multiple) of node for
* multi instance node addition.
* Value of leaf can be null which indicates selection node in get
* operation.
*
* @param name name of child to be added
* @param namespace namespace of child to be added, if it's null, parent's
* namespace will be applied to child
* @param valueSet list of value of the child
*/
void addLeaf(String name, String namespace, Set<String> valueSet);
/**
* Adds YANG list's keys value in the order defined in list's key statement.
* All the keys must be present any missing key or invalid key will result
* in exception.
*
* @param keysValueList values of the keys in URI in the same order
* as defined in YANG file
*/
void addKeyLeafs(List<String> keysValueList);
/**
* Traverses up in YANG data tree to the parent node, it is to be used when
* protocol is using context type "current" and wanted to traverse up the
* tree.
*/
void traverseToParent();
/**
* Returns the current context information available in YDT node.
*
* @return current YDT context
*/
YdtContext getCurNode();
/**
* Sets default operation type. This operation type is taken if operation
* type is not explicitly specified in request. If default operation type
* is not set, merge will be taken as default operation type.
*
* @param ydtContextOperationType default edit operation type
*/
void setDefaultEditOperationType(
YdtContextOperationType ydtContextOperationType);
}
/*
* Copyright 2016-present 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.yms.ydt;
import java.util.Set;
/**
* Abstraction of an entity which represents YANG data tree context
* information. This context information will be used protocol to obtain
* the information associated with YDT node. This is used when protocol is
* walking the data tree in both visitor and listener mechanism.
*/
public interface YdtContext {
/**
* Returns the node name.
*
* @return node name
*/
String getName();
/**
* Returns the node namespace.
*
* @return node namespace
*/
String getNamespace();
/**
* Returns the YDT node extended context information corresponding to YDT
* node.
*
* @param <T> specifies YMS operation specific extended information
* associated with YDT context. It will be
* YdtContextOperationType in case extended information type
* is EDIT_REQUEST and will be YdtContextResponseInfo in case
* extended information type is RESPONSE.
* @return YdtContextOperationType YDT node operation type
*/
<T> T getYdtContextExtendedInfo();
/**
* Returns YANG data tree extended information type. This is used to
* identify the type of extended information applicable for YDT node.
*
* @return type of extended information
*/
YdtExtendedInfoType getYdtExtendedInfoType();
/**
* Returns the type of YDT entity. This type will be used by protocols to
* identify the nature of node and can implement it accordingly.
*
* @return YDT entity type
*/
YdtType getYdtType();
/**
* Returns the context of parent node.
*
* @return context of parent node
*/
YdtContext getParent();
/**
* Returns the context of first child.
*
* @return context of first child
*/
YdtContext getFirstChild();
/**
* Returns the context of last child.
*
* @return context of last child
*/
YdtContext getLastChild();
/**
* Returns the context of next sibling.
*
* @return context of next sibling
*/
YdtContext getNextSibling();
/**
* Returns the context of previous sibling.
*
* @return context of previous sibling
*/
YdtContext getPreviousSibling();
/**
* Returns value of node, this is only valid for single instance leaf
* node, to obtain the nature of the node protocols need to use
* getYdtType().
*
* @return value of node
*/
String getValue();
/**
* Returns set of values of a node, this is only valid for multi instance
* leaf node, to obtain the nature of the node protocols need to use
* getYdtType().
*
* @return value of YDT leaf
*/
Set<String> getValueSet();
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Represents type of YANG data tree node operation.
*
* This is used by protocols to specify edit operation associate with the node.
* YMS data validation and data handling will vary based on the edit operation
* type, for an instance, default leafs if not present in data should be added
* if edit operation type is create and shouldn't be added if operation type is
* delete.
* Edit operation type is mapped to "operation type" of YANG utils generated
* classes by YMS.
*
* In case of SBI driver/provider creates JAVA object (of YANG utils generated
* classes) and specifies the edit operation type in "operation type" field.
* YMS map this operation type to "edit operation type" of YDT, which will be
* further encoded in corresponding data format.
*
* This is only applicable if YANG root level interaction type is EDIT_CONFIG.
* If edit operation type is not specified when root interaction type is
* EDIT_CONFIG then default operation type will be selected.
* By default "default operation type" is "merge" unless explicitly specified
* by protocol.
*/
/*
* Edit operation type mapping with RESTCONF and NETCONF as example:
* +----------+----------------------------+------------+
* | RESTCONF | NETCONF | EditOpType |
* +----------+----------------------------+------------+
* | OPTIONS | none | NA |
* | HEAD | none | NA |
* | GET | <get-config>, <get> | NA |
* | POST | (operation="create") | CREATE |
* | PUT | (operation="replace") | REPLACE |
* | PATCH | (operation="merge") | MERGE |
* | DELETE | (operation="delete") | DELETE |
* | none | (operation="remove") | REMOVE |
* +----------+----------------------------+------------+
* Note: Additionally RESTCONF must use API resource to figure out whether
* request contains data resource or it's for data model specific operation.
* +--rw restconf
* +--rw data
* +--rw operations
* Edit operation type is only applicable for data resource.
*
* Additionally protocols has to use operation type NONE to specify the URI
* path.
*/
public enum YdtContextOperationType {
/**
* Type of YANG data tree action for below action:
* The configuration data identified by the element
* containing this attribute is added to the configuration if
* and only if the configuration data does not already exist in
* the configuration datastore. If the configuration data
* exists, an error is returned.
*/
CREATE,
/**
* Type of YANG data tree action for below action:
* The configuration data identified by the element
* containing this attribute is deleted from the configuration
* if and only if the configuration data currently exists in
* the configuration datastore. If the configuration data does
* not exist, an error is returned".
*/
DELETE,
/**
* Type of YANG data tree action for below action:
* The configuration data identified by the element
* containing this attribute is merged with the configuration
* at the corresponding level in the configuration datastore.
*/
MERGE,
/**
* Type of YANG data tree action for below action:
* The configuration data identified by the element
* containing this attribute replaces any related configuration
* in the configuration datastore. If no such configuration
* data exists in the configuration datastore, it is created.
*/
REPLACE,
/**
* Type of YANG data tree action for below action:
* The configuration data identified by the element
* containing this attribute is deleted from the configuration
* if the configuration data currently exists in the
* configuration datastore. If the configuration data does not
* exist, the "remove" operation is silently ignored by the
* server.
*/
REMOVE,
/**
* The node is used as a containment node to reach the child node,
* There is no change in the data store for the values of this node in the
* edit request.
*/
NONE
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Represents YANG context response information. It contains YDT node specific
* information for operation response like error information, particular node
* operation result etc.
*/
public interface YdtContextResponseInfo {
//TODO
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Represents type of YANG data tree node operation.
*/
public enum YdtExtendedInfoType {
/**
* It specifies operation type edit request for YDT node. It is used to
* identify the YMS operation specific extended information associated
* with YDT context.
*/
EDIT_REQUEST,
/**
* It specifies operation type RESPONSE for YDT node. It is used to
* identify the YMS operation specific extended information associated
* with YDT context.
*/
RESPONSE
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Abstraction of an entity which provide call back methods which are called
* by YDT walker while walking the YANG data tree.
*
* In a response to execute operation YMS returns the YMS operation results
* with root YDT node. Now, protocols needs to walk through the YDT node and
* constructs the corresponding data format string. Protocol can opt to use
* listener or visitor based walking mechanism.
*
* This interface needs to be implemented by protocol implementing listener's
* based call backs while YDT walk.
*/
public interface YdtListener {
/**
* YANG data tree node's entry, it will be called during a node entry.
* All the related information about the node can be obtain from the YDT
* context.
*
* @param ydtContext YANG data tree context
*/
void enterYdtNode(YdtContext ydtContext);
/**
* YANG data tree node's exit, it will be called during a node exit.
* All the related information about the node can be obtain from the YDT
* context.
*
* @param ydtContext YANG data tree context
*/
void exitYdtNode(YdtContext ydtContext);
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Represents YANG management system results. Protocols sends request to
* YANG management system for execution. YMS returns response in form of
* YANG data tree response
*/
public interface YdtResponse extends Ydt {
/**
* Returns YANG management system operation result. This status of the
* operation execution is returned
*
* @return YMS operation result
*/
YmsOperationExecutionStatus getYmsOperationResult();
/*
* TODO: Applications layer error reporting to protocols.
*/
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Represents type of node in YANG data tree. Protocols based on input data
* format provide this information to YMS during YDT building. YMS use this
* information to carry out the validation against the schema information
* obtained as a part of application registration. Also as a part of response
* YMS encode this information in YDT node, protocol may use this information
* while construction the data format string.
*
* Protocols unaware of node type like NETCONF, may opt not to provide this
* information.
*/
public enum YdtType {
/**
* Single instance node.
*/
SINGLE_INSTANCE_NODE,
/**
* Multi instance node.
*/
MULTI_INSTANCE_NODE,
/**
* Single instance leaf node.
*/
SINGLE_INSTANCE_LEAF_VALUE_NODE,
/**
* Multi instance leaf node.
*/
MULTI_INSTANCE_LEAF_VALUE_NODE
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Abstraction of an entity which provides interfaces for YDT walk.
*
* When YANG management system gets data from application to be returned
* to protocol for any protocol operation or as a part of notification, YANG
* management system encodes this data in a YANG data tree and sends the same
* to protocol.
* Protocols can use the YANG data tree walker utility to have their
* callbacks to be invoked as per the YANG data tree walking.
* By this way protocols can encode the data from abstract YANG data tree
* into a protocol specific representation.
*
* YDT walker provides entry and exit callbacks for each node in YANG data
* tree.
*/
public interface YdtWalker {
/**
* Walks the YANG data tree. Protocols implements YDT listener service
* and walks YDT tree with input as implemented object. YDT walker provides
* call backs to implemented methods.
*
* @param ydtListener YDT listener implemented by the protocol
* @param rootNode root node of YDT
*/
void walk(YdtListener ydtListener, YdtContext rootNode);
}
/*
* Copyright 2016-present 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.yms.ydt;
/**
* Abstraction of an entity which represents YANG management system operation
* result. Once the protocol translates the request information into a abstract
* YANG data tree, it uses YANG management system as a broker to get the
* operation executed in ONOS. Protocols uses a request Yang management
* system to delegate the operation request.
*
* YANG management system is responsible to split the protocol operation
* across application(s) which needs to participate, and collate the
* response(s) from application(s) and return an effective result of the
* operation request. The result of the operation request is returned in
* YMS operation result.
*/
public interface YmsOperationExecutionStatus {
// TODO
}
/*
* Copyright 2016-present 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.
*/
/**
* Provides interfaces to build and obtain YANG data tree which is data
* (sub)instance representation, abstract of protocol.
*
* NBI protocol implementation takes care of the protocol specific
* operations. They are abstracted from the intricacies of understanding
* the application identification or handling the interaction with
* applications.
*
* NBI protocols need to handle the encoding and decoding of data to the
* protocol specific format. They are unaware of the YANG of applications,
* i.e. protocols are unaware of the data structure / organization in
* applications.
*
* They need to translate the protocol operation request, into a protocol
* independent abstract tree called the YANG data tree (YDT). In order to
* enable the protocol in building these abstract data tree, YANG
* management system provides a utility called the YANG data tree builder.
*
* Using the YANG data tree utility API's protocols are expected to walk
* the data received in request and pass the information during the walk.
* YANG data tree builder, identifies the application which supports the
* request and validates it against the schema defined in YANG, and
* constructs the abstract YANG data tree.
*/
package org.onosproject.yms.ydt;
/*
* Copyright 2016-present 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.yms.ymsm;
/**
* Represents type of root level operation for the request.
*
* This is used by protocols to specify the root level operation associated
* with the request. YMS data validation and data handling will vary based
* on the edit operation type, for an instance YANG specified "mandatory"
* leafs needn't be present for QUERY_CONFIG and QUERY, but they may be
* mandatory to be present in request for EDIT_CONFIG type. The validation
* and handling is further dependent on edit operation type.
*
* In SBI, driver/provider must provide this information to YMS which needs
* to encode this information in corresponding data format.
*
* YmsOperationType MUST be specified by protocol.
*/
/*
* Yang interaction type with RESTCONF and NETCONF as example:
* +--------------+-------------------+-------------+
* | RESTCONF | NETCONF | EditOpType |
* +--------------+-------------------+-------------+
* | OPTIONS | NA | NA |
* | HEAD | NA | NA |
* | GET | <get> | QUERY |
* | none | <get-config> | QUERY_CONFIG|
* | POST (data) | <edit-config> | EDIT_CONFIG |
* | PUT | <edit-config> | EDIT_CONFIG |
* | PATCH | <edit-config> | EDIT_CONFIG |
* | DELETE | <edit-config> | EDIT_CONFIG |
* | POST (op) | <rpc> | RPC |
* +--------------+-------------------+-------------+
*
* Note: Additionally RESTCONF must use API resource to figure out whether
* request contains data resource or it's for data model specific operation.
* +--rw restconf
* +--rw data
* +--rw operations
*/
public enum YmsOperationType {
/**
* The YANG based request is to edit a config node / subtree in the data
* store.
*/
EDIT_CONFIG,
/**
* The YANG based request is to query a config node / subtree in the data
* store.
*/
QUERY_CONFIG,
/**
* The YANG based request is to query a node / subtree in the data store.
*/
QUERY,
/**
* The YANG based request is to execute an RPC defined in YANG.
*/
RPC,
/**
* The YANG based request is to execute an RPC defined in YANG.
*/
NOTIFICATION
}
/*
* Copyright 2016-present 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.
*/
/**
* Provides interfaces to YANG application management system manager. YMSM is
* manager of the YANG Core.
*
* In NBI, it acts as a broker in between the protocol and application,
* here there is a separate protocol implementation, which does the conversion
* of protocol representation to abstract data tree. The protocol
* implementation takes care of the protocol specific actions for
* e.g. RESTCONF handling the entity-tag / timestamp related operations.
*
* In SBI, driver or provider uses YANG codec handler as a utility to translate
* the request information in java(YANG utils generated) to protocol specific
* format and vice versa.
*/
package org.onosproject.yms.ymsm;
/*
* Copyright 2016-present 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.yms.ynh;
/**
* Abstraction of an entity which provides interfaces to YANG notification
* service. YNH handles notification from the application/core and provide
* it to the protocols.
* <p>
* NBI Protocols which can support notification delivery for application(s)
* needs to add themselves as a listeners with YANG notification service.
* Protocols can use YANG notification service to check if a received
* notification should be filtered against any of their protocol specific
* filtering mechanism.
*/
public interface YangNotificationService {
//TODO
}
/*
* Copyright 2016-present 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.
*/
/**
* Provides interfaces to YANG notification handler. YNH handles notification
* from the application and provide it to the protocols.
*/
/**
* Provides interfaces to YANG notification service.
*
* NBI Protocols which can support notification delivery for application(s)
* needs to add themselves as a listeners with YANG notification service.
* Protocols can use YANG notification service to check if a received
* notification should be filtered against any of their protocol specific
* filtering mechanism.
*/
package org.onosproject.yms.ynh;
COMPILE_DEPS = [
'//lib:CORE_DEPS',
'//apps/yms/api:onos-apps-yms-api',
]
osgi_jar_with_tests(
deps = COMPILE_DEPS,
)
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015-present 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.
-->
<app name="org.onosproject.yms" origin="ON.Lab" version="${project.version}"
category="Utility" url="http://onosproject.org" title="YMS App"
featuresRepo="mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features"
features="${project.artifactId}">
<description>${project.description}</description>
<artifact>mvn:${project.groupId}/${project.artifactId}/${project.version}</artifact>
<artifact>mvn:${project.groupId}/onos-app-yms-api/${project.version}</artifact>
</app>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright 2015-present 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.
-->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
<feature name="${project.artifactId}" version="${project.version}"
description="${project.description}">
<feature>onos-api</feature>
<bundle>mvn:${project.groupId}/onos-app-yms-api/${project.version}</bundle>
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
</feature>
</features>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015-present 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>onos-yms</artifactId>
<groupId>org.onosproject</groupId>
<version>1.7.0-SNAPSHOT</version>
</parent>
<artifactId>onos-app-yms</artifactId>
<packaging>bundle</packaging>
<url>http://onosproject.org</url>
<description>YANG management system application</description>
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-app-yms-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015-present 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-apps</artifactId>
<version>1.7.0-SNAPSHOT</version>
</parent>
<artifactId>onos-yms</artifactId>
<packaging>pom</packaging>
<description>ONOS YANG management system</description>
<modules>
<module>api</module>
<module>app</module>
</modules>
</project>