Committed by
Gerrit Code Review
YMS broker and Notification handler
Change-Id: Ic3659b2c2ad26ea2db1f03725b4883f19db2cc41
Showing
21 changed files
with
856 additions
and
41 deletions
This diff is collapsed. Click to expand it.
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ych; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Abstraction of an entity which has the composite protocol request. | ||
| 21 | + * | ||
| 22 | + * Protocols like RESTCONF, have split the schema specific information across | ||
| 23 | + * different components in the protocol encoding. | ||
| 24 | + * | ||
| 25 | + * There is a resource identifier, which is part of the RESTCONF request URL. | ||
| 26 | + * and there is the information about the resource being operated on in the | ||
| 27 | + * request, this is part of the request body. | ||
| 28 | + */ | ||
| 29 | +public interface YangCompositeEncoding { | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Retrieves the resource identifier on which the operation is being | ||
| 33 | + * performed. | ||
| 34 | + * | ||
| 35 | + * @return the string representation of the resource being identified | ||
| 36 | + */ | ||
| 37 | + String getResourceIdentifier(); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * Retrieves the representation format of the resource identifier. | ||
| 41 | + * | ||
| 42 | + * @return the type of the resource identifier | ||
| 43 | + */ | ||
| 44 | + YangResourceIdentifierType getResourceIdentifierType(); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Retrieves the resource information in the protocol encoding format. | ||
| 48 | + * | ||
| 49 | + * @return the resource information in the protocol encoding format | ||
| 50 | + */ | ||
| 51 | + String getResourceInformation(); | ||
| 52 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ych; | ||
| 18 | + | ||
| 19 | +import org.onosproject.yms.ydt.YdtBuilder; | ||
| 20 | +import org.onosproject.yms.ydt.YmsOperationType; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * Abstraction of an entity which overrides the default codec. | ||
| 24 | + * | ||
| 25 | + * YANG has it extension framework which allows vendor / implementation | ||
| 26 | + * specific operation or extensions. The default CODECs will fail to handle | ||
| 27 | + * such protocol requests. In such scenarios, the providers can register | ||
| 28 | + * their specific CODEC's with the YANG codec utility to translate the protocol | ||
| 29 | + * specific data to abstract YANG data tree, from which it can be translate into | ||
| 30 | + * the YANG modelled java objects for the provider / driver to operate on the | ||
| 31 | + * device. | ||
| 32 | + */ | ||
| 33 | + | ||
| 34 | +public interface YangDataTreeCodec { | ||
| 35 | + /** | ||
| 36 | + * When the YMS need to encode simple protocol operation request, | ||
| 37 | + * it will translate the YANG objects into an abstract YANG data tree and | ||
| 38 | + * invoke this registered encode method. Protocol CODEC implementation | ||
| 39 | + * needs to ensure the overridden method can handle any specific | ||
| 40 | + * extension or representation of protocol data. | ||
| 41 | + * The operation type will be set in YANG data tree builder. | ||
| 42 | + * | ||
| 43 | + * @param ydtBuilder Abstract YANG data tree contains the operation | ||
| 44 | + * request | ||
| 45 | + * @param protocolOperation protocol operation being performed | ||
| 46 | + * @return protocol specific string representation. | ||
| 47 | + */ | ||
| 48 | + String encodeYdtToProtocolFormat(YdtBuilder ydtBuilder, | ||
| 49 | + YmsOperationType protocolOperation); | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * When the YMS need to encode composite protocol operation request, it | ||
| 53 | + * will translate the YANG objects into an abstract YANG data | ||
| 54 | + * tree and invoke this registered encode method. Protocol CODEC | ||
| 55 | + * implementation needs to ensure the overridden method can handle any | ||
| 56 | + * specific extension or representation of protocol data. | ||
| 57 | + * The Initial chain of node in the YDT will have the operation type set | ||
| 58 | + * to NONE to specify it is a resource identifier. The Resource | ||
| 59 | + * information is maintained as a subtree to the resource identifier node. | ||
| 60 | + * | ||
| 61 | + * @param ydtBuilder Abstract YANG data tree contains the operation | ||
| 62 | + * request | ||
| 63 | + * @param protocolOperation protocol operation being performed | ||
| 64 | + * @return composite response containing the requested operation | ||
| 65 | + * information | ||
| 66 | + */ | ||
| 67 | + YangCompositeEncoding encodeYdtToCompositeProtocolFormat( | ||
| 68 | + YdtBuilder ydtBuilder, YmsOperationType protocolOperation); | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * When YMS decode simple protocol operation request it uses the | ||
| 72 | + * registered decode method to translate the protocol data into a | ||
| 73 | + * abstract YANG data tree. Then translate the abstract YANG data | ||
| 74 | + * tree into the YANG modeled Java objects. | ||
| 75 | + * The CODEC implementation are unaware of the schema against which they | ||
| 76 | + * are performing the codec operation, so YMS will send the schema | ||
| 77 | + * registry on which the YANG data tree needs to operate, so the code | ||
| 78 | + * implementation needs to pass this schema registry to the get a YDT | ||
| 79 | + * builder. | ||
| 80 | + * | ||
| 81 | + * @param protocolData input string containing the simple | ||
| 82 | + * protocol data which needs to be decoded | ||
| 83 | + * @param schemaRegistryForYdt Schema registry based on which the YANG | ||
| 84 | + * data tree will be built | ||
| 85 | + * @param protocolOperation protocol operation being performed | ||
| 86 | + * @return decoded operation request in YANG data tree | ||
| 87 | + */ | ||
| 88 | + YdtBuilder decodeProtocolDataToYdt(String protocolData, | ||
| 89 | + Object schemaRegistryForYdt, | ||
| 90 | + YmsOperationType protocolOperation); | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * When YMS decode composite protocol operation request it uses the | ||
| 94 | + * registered decode method to translate the protocol data into a | ||
| 95 | + * abstract YANG data tree. Then translate the abstract YANG data | ||
| 96 | + * tree into the YANG modeled Java objects. | ||
| 97 | + * The CODEC implementation are unaware of the schema against which they | ||
| 98 | + * are performing the codec operation, so YMS will send the schema | ||
| 99 | + * registry on which the YANG data tree needs to operate, so the code | ||
| 100 | + * implementation needs to pass this schema registry to the get a YDT | ||
| 101 | + * builder. | ||
| 102 | + * | ||
| 103 | + * @param protocolData composite input string containing the | ||
| 104 | + * protocol data which needs to be decoded | ||
| 105 | + * @param schemaRegistryForYdt Schema registry based on which the YANG | ||
| 106 | + * data tree will be built | ||
| 107 | + * @param protocolOperation protocol operation being performed | ||
| 108 | + * @return decoded operation request in YANG data tree | ||
| 109 | + */ | ||
| 110 | + YdtBuilder decodeCompositeProtocolDataToYdt( | ||
| 111 | + YangCompositeEncoding protocolData, Object schemaRegistryForYdt, | ||
| 112 | + YmsOperationType protocolOperation); | ||
| 113 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ych; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Represents the protocol data representation. | ||
| 21 | + */ | ||
| 22 | +public enum YangProtocolEncodingFormat { | ||
| 23 | + /** | ||
| 24 | + * XML protocol encoding. | ||
| 25 | + */ | ||
| 26 | + XML_ENCODING, | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * JSON protocol encoding. | ||
| 30 | + */ | ||
| 31 | + JSON_ENCODING | ||
| 32 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ych; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Represents the protocol data representation. | ||
| 21 | + */ | ||
| 22 | +public enum YangResourceIdentifierType { | ||
| 23 | + /** | ||
| 24 | + * Uniform Resource Identifier. | ||
| 25 | + */ | ||
| 26 | + URI | ||
| 27 | +} |
| ... | @@ -16,8 +16,6 @@ | ... | @@ -16,8 +16,6 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.yms.ydt; | 17 | package org.onosproject.yms.ydt; |
| 18 | 18 | ||
| 19 | -import org.onosproject.yms.ymsm.YmsOperationType; | ||
| 20 | - | ||
| 21 | /** | 19 | /** |
| 22 | * Abstraction of an entity which represent YANG data tree. This is used | 20 | * Abstraction of an entity which represent YANG data tree. This is used |
| 23 | * for exchanging information between YANG management system and NBI protocol. | 21 | * for exchanging information between YANG management system and NBI protocol. | ... | ... |
| ... | @@ -183,14 +183,26 @@ public interface YdtBuilder | ... | @@ -183,14 +183,26 @@ public interface YdtBuilder |
| 183 | void addLeaf(String name, String namespace, Set<String> valueSet); | 183 | void addLeaf(String name, String namespace, Set<String> valueSet); |
| 184 | 184 | ||
| 185 | /** | 185 | /** |
| 186 | - * Adds YANG list's keys value in the order defined in list's key statement. | 186 | + * Adds an instance of a child list node, or adds a child leaf list with |
| 187 | - * All the keys must be present any missing key or invalid key will result | 187 | + * multiple instance. |
| 188 | - * in exception. | 188 | + * In case the name and namespace identifies the child list node, then |
| 189 | + * the values for all the key leaves must be passed in the same order of | ||
| 190 | + * schema. Then the effective YANG data tree will be like adding a list | ||
| 191 | + * node, followed by adding the key leaves as the child to the list node. | ||
| 192 | + * After this operation, the call to getCurNode will return the list node. | ||
| 193 | + * In case the name and namespace identifies the child leaf-list, then | ||
| 194 | + * the values identifies the instance of leaf list. | ||
| 195 | + * After this operation, the call to getCurNode will return the leaf-list | ||
| 196 | + * node. | ||
| 189 | * | 197 | * |
| 190 | - * @param keysValueList values of the keys in URI in the same order | 198 | + * @param name name of child to be added |
| 199 | + * @param namespace namespace of child to be added, if it's null, parent's | ||
| 200 | + * namespace will be applied to child | ||
| 201 | + * @param valueList values of the keys in URI in the same order | ||
| 191 | * as defined in YANG file | 202 | * as defined in YANG file |
| 192 | */ | 203 | */ |
| 193 | - void addKeyLeafs(List<String> keysValueList); | 204 | + void addMultiInstanceChild(String name, String namespace, |
| 205 | + List<String> valueList); | ||
| 194 | 206 | ||
| 195 | /** | 207 | /** |
| 196 | * Traverses up in YANG data tree to the parent node, it is to be used when | 208 | * Traverses up in YANG data tree to the parent node, it is to be used when | ... | ... |
| ... | @@ -22,5 +22,11 @@ package org.onosproject.yms.ydt; | ... | @@ -22,5 +22,11 @@ package org.onosproject.yms.ydt; |
| 22 | * operation result etc. | 22 | * operation result etc. |
| 23 | */ | 23 | */ |
| 24 | public interface YdtContextResponseInfo { | 24 | public interface YdtContextResponseInfo { |
| 25 | - //TODO | 25 | + |
| 26 | + /** | ||
| 27 | + * Retrieve the context specific error information. | ||
| 28 | + * | ||
| 29 | + * @return context specific error information | ||
| 30 | + */ | ||
| 31 | + YdtErrorInfo getYdtErrorInfo(); | ||
| 26 | } | 32 | } | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ydt; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Abstraction of an entity which contains context specific error info. | ||
| 21 | + */ | ||
| 22 | +public interface YdtErrorInfo { | ||
| 23 | + /** | ||
| 24 | + * Retrieves the application specific error tag corresponding to the | ||
| 25 | + * error context in operation. | ||
| 26 | + * | ||
| 27 | + * @return application specific error tag corresponding to the error | ||
| 28 | + * context in operation | ||
| 29 | + */ | ||
| 30 | + String getErrorAppTag(); | ||
| 31 | + | ||
| 32 | + /** | ||
| 33 | + * Retrieves the error message corresponding to the error context in | ||
| 34 | + * operation. | ||
| 35 | + * | ||
| 36 | + * @return the error message corresponding to the error context in operation | ||
| 37 | + */ | ||
| 38 | + String getErrorMessage(); | ||
| 39 | +} |
| ... | @@ -26,9 +26,22 @@ package org.onosproject.yms.ydt; | ... | @@ -26,9 +26,22 @@ package org.onosproject.yms.ydt; |
| 26 | * YANG management system is responsible to split the protocol operation | 26 | * YANG management system is responsible to split the protocol operation |
| 27 | * across application(s) which needs to participate, and collate the | 27 | * across application(s) which needs to participate, and collate the |
| 28 | * response(s) from application(s) and return an effective result of the | 28 | * response(s) from application(s) and return an effective result of the |
| 29 | - * operation request. The result of the operation request is returned in | 29 | + * operation request. The status of the operation execution is returned. |
| 30 | - * YMS operation result. | ||
| 31 | */ | 30 | */ |
| 32 | -public interface YmsOperationExecutionStatus { | 31 | +public enum YmsOperationExecutionStatus { |
| 33 | - // TODO | 32 | + |
| 33 | + /** | ||
| 34 | + * Successful execution of the operation. | ||
| 35 | + */ | ||
| 36 | + EXECUTION_SUCCESS, | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Exception in execution of the operation. | ||
| 40 | + */ | ||
| 41 | + EXECUTION_EXCEPTION, | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Error in execution of the operation. | ||
| 45 | + */ | ||
| 46 | + ERROR_EXCEPTION | ||
| 34 | } | 47 | } | ... | ... |
| ... | @@ -14,7 +14,7 @@ | ... | @@ -14,7 +14,7 @@ |
| 14 | * limitations under the License. | 14 | * limitations under the License. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | -package org.onosproject.yms.ymsm; | 17 | +package org.onosproject.yms.ydt; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * Represents type of root level operation for the request. | 20 | * Represents type of root level operation for the request. |
| ... | @@ -59,23 +59,43 @@ public enum YmsOperationType { | ... | @@ -59,23 +59,43 @@ public enum YmsOperationType { |
| 59 | * The YANG based request is to edit a config node / subtree in the data | 59 | * The YANG based request is to edit a config node / subtree in the data |
| 60 | * store. | 60 | * store. |
| 61 | */ | 61 | */ |
| 62 | - EDIT_CONFIG, | 62 | + EDIT_CONFIG_REQUEST, |
| 63 | 63 | ||
| 64 | /** | 64 | /** |
| 65 | * The YANG based request is to query a config node / subtree in the data | 65 | * The YANG based request is to query a config node / subtree in the data |
| 66 | * store. | 66 | * store. |
| 67 | */ | 67 | */ |
| 68 | - QUERY_CONFIG, | 68 | + QUERY_CONFIG_REQUEST, |
| 69 | 69 | ||
| 70 | /** | 70 | /** |
| 71 | * The YANG based request is to query a node / subtree in the data store. | 71 | * The YANG based request is to query a node / subtree in the data store. |
| 72 | */ | 72 | */ |
| 73 | - QUERY, | 73 | + QUERY_REQUEST, |
| 74 | 74 | ||
| 75 | /** | 75 | /** |
| 76 | * The YANG based request is to execute an RPC defined in YANG. | 76 | * The YANG based request is to execute an RPC defined in YANG. |
| 77 | */ | 77 | */ |
| 78 | - RPC, | 78 | + RPC_REQUEST, |
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * The YANG based response is for edit operation. | ||
| 82 | + */ | ||
| 83 | + EDIT_CONFIG_REPLY, | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * The YANG based response is for query config operation. | ||
| 87 | + */ | ||
| 88 | + QUERY_CONFIG_REPLY, | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * The YANG based response is for query operation. | ||
| 92 | + */ | ||
| 93 | + QUERY_REPLY, | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * The YANG based response is for a RPC operation. | ||
| 97 | + */ | ||
| 98 | + RPC_REPLY, | ||
| 79 | 99 | ||
| 80 | /** | 100 | /** |
| 81 | * The YANG based request is to execute an RPC defined in YANG. | 101 | * The YANG based request is to execute an RPC defined in YANG. | ... | ... |
| ... | @@ -19,10 +19,14 @@ package org.onosproject.yms.ymsm; | ... | @@ -19,10 +19,14 @@ package org.onosproject.yms.ymsm; |
| 19 | import java.util.List; | 19 | import java.util.List; |
| 20 | 20 | ||
| 21 | import org.onosproject.yms.ych.YangCodecHandler; | 21 | import org.onosproject.yms.ych.YangCodecHandler; |
| 22 | +import org.onosproject.yms.ych.YangDataTreeCodec; | ||
| 23 | +import org.onosproject.yms.ych.YangProtocolEncodingFormat; | ||
| 22 | import org.onosproject.yms.ydt.YdtBuilder; | 24 | import org.onosproject.yms.ydt.YdtBuilder; |
| 23 | import org.onosproject.yms.ydt.YdtResponse; | 25 | import org.onosproject.yms.ydt.YdtResponse; |
| 24 | import org.onosproject.yms.ydt.YdtWalker; | 26 | import org.onosproject.yms.ydt.YdtWalker; |
| 27 | +import org.onosproject.yms.ydt.YmsOperationType; | ||
| 25 | import org.onosproject.yms.ynh.YangNotificationService; | 28 | import org.onosproject.yms.ynh.YangNotificationService; |
| 29 | +import org.onosproject.yms.ysr.YangModuleLibrary; | ||
| 26 | 30 | ||
| 27 | /** | 31 | /** |
| 28 | * Abstraction of an entity which provides interfaces to YANG management | 32 | * Abstraction of an entity which provides interfaces to YANG management |
| ... | @@ -178,13 +182,6 @@ public interface YmsService { | ... | @@ -178,13 +182,6 @@ public interface YmsService { |
| 178 | * Depending on the operation type set in the YANG builder tree, the | 182 | * Depending on the operation type set in the YANG builder tree, the |
| 179 | * application(s) get / set / operation interface is invoked. | 183 | * application(s) get / set / operation interface is invoked. |
| 180 | * These interface are part to the YANG modelled service interface. | 184 | * These interface are part to the YANG modelled service interface. |
| 181 | - * | ||
| 182 | - * @param operationRequest operation request that was constructed | ||
| 183 | - * by NBI protocol using YANG data tree | ||
| 184 | - * builder. This operation request contains | ||
| 185 | - * operation request that needs to be | ||
| 186 | - * executed on the applicable application(s) | ||
| 187 | - * @return returns the result of the operation execution. | ||
| 188 | * Depending on the operation type, the YANG response data tree can have | 185 | * Depending on the operation type, the YANG response data tree can have |
| 189 | * the following information. | 186 | * the following information. |
| 190 | * | 187 | * |
| ... | @@ -213,10 +210,18 @@ public interface YmsService { | ... | @@ -213,10 +210,18 @@ public interface YmsService { |
| 213 | * will contain the application's RPC reply schema specific . | 210 | * will contain the application's RPC reply schema specific . |
| 214 | * NBI protocol to use a Yang data tree walker to construct the | 211 | * NBI protocol to use a Yang data tree walker to construct the |
| 215 | * protocol specific reply. | 212 | * protocol specific reply. |
| 213 | + * | ||
| 214 | + * @param operationRequest operation request that was constructed | ||
| 215 | + * by NBI protocol using YANG data tree | ||
| 216 | + * builder. This operation request contains | ||
| 217 | + * operation request that needs to be | ||
| 218 | + * executed on the applicable application(s) | ||
| 219 | + * @return returns the result of the operation execution. | ||
| 216 | */ | 220 | */ |
| 217 | YdtResponse executeOperation(YdtBuilder operationRequest); | 221 | YdtResponse executeOperation(YdtBuilder operationRequest); |
| 218 | 222 | ||
| 219 | - // TODO execute operation which directly take data format string as input. | 223 | + /* TODO add execute operation which directly take data format string as |
| 224 | + input.*/ | ||
| 220 | 225 | ||
| 221 | /** | 226 | /** |
| 222 | * Returns YANG notification service. | 227 | * Returns YANG notification service. |
| ... | @@ -287,6 +292,46 @@ public interface YmsService { | ... | @@ -287,6 +292,46 @@ public interface YmsService { |
| 287 | void unRegisterService(Object appManager, Class<?> yangService); | 292 | void unRegisterService(Object appManager, Class<?> yangService); |
| 288 | 293 | ||
| 289 | /** | 294 | /** |
| 295 | + * Protocols like RESTCONF, share the list of YANG modules it support. | ||
| 296 | + * using ietf-yang-library | ||
| 297 | + * | ||
| 298 | + * Retrieves the YANG module library supported by the server. | ||
| 299 | + * | ||
| 300 | + * @return YANG module library supported by the server | ||
| 301 | + */ | ||
| 302 | + YangModuleLibrary getYangModuleLibrary(); | ||
| 303 | + | ||
| 304 | + /** | ||
| 305 | + * Protocols like RESTCONF, use the definitions within the YANG modules | ||
| 306 | + * advertised by the server are used to construct an RPC operation or | ||
| 307 | + * data resource identifier. | ||
| 308 | + * | ||
| 309 | + * Schema Resource: | ||
| 310 | + * The server can optionally support retrieval of the YANG modules it | ||
| 311 | + * supports. | ||
| 312 | + * | ||
| 313 | + * @param moduleName YANG module name. | ||
| 314 | + * @param moduleNamespace namespace in which the module is defined. | ||
| 315 | + * @return YANG file contents of the requested YANG module. | ||
| 316 | + */ | ||
| 317 | + String getYangFile(String moduleName, String moduleNamespace); | ||
| 318 | + | ||
| 319 | + /** | ||
| 320 | + * Register protocol specific default CODEC. This is can be used by 1st | ||
| 321 | + * protocol | ||
| 322 | + * to support a protocol format CODEC. This CODEC will be used in both | ||
| 323 | + * NBI and SBI. | ||
| 324 | + * | ||
| 325 | + * @param defaultCodec default codec to be used for a particular protocol | ||
| 326 | + * data format | ||
| 327 | + * @param dataFormat data format to which encoding to be done. | ||
| 328 | + * Currently XML and | ||
| 329 | + * JSON formats are supported. | ||
| 330 | + */ | ||
| 331 | + void registerDefaultCodec(YangDataTreeCodec defaultCodec, | ||
| 332 | + YangProtocolEncodingFormat dataFormat); | ||
| 333 | + | ||
| 334 | + /** | ||
| 290 | * Returns YANG codec handler utility. | 335 | * Returns YANG codec handler utility. |
| 291 | * | 336 | * |
| 292 | * In SBI, the provider or driver uses YANG management system as a CODEC | 337 | * In SBI, the provider or driver uses YANG management system as a CODEC |
| ... | @@ -294,11 +339,14 @@ public interface YmsService { | ... | @@ -294,11 +339,14 @@ public interface YmsService { |
| 294 | * the device schema. YANG utils is used to generate the java files | 339 | * the device schema. YANG utils is used to generate the java files |
| 295 | * corresponding to the device schema. Provider or driver use these classes | 340 | * corresponding to the device schema. Provider or driver use these classes |
| 296 | * to seamlessly manage the device as java objects. While sending the | 341 | * to seamlessly manage the device as java objects. While sending the |
| 297 | - * request to device, drivers use the utility to translate the objects to | 342 | + * request |
| 298 | - * protocol specific data representation and then send to the device. | 343 | + * to device, drivers use the utility to translate the objects to protocol |
| 344 | + * specific data representation and then send to the device. | ||
| 299 | * Protocol or driver use the same instance of the codec utility across | 345 | * Protocol or driver use the same instance of the codec utility across |
| 300 | - * multiple translation request. Protocol or driver should not use the same | 346 | + * multiple |
| 301 | - * instance of utility concurrently. | 347 | + * translation request. |
| 348 | + * Protocol or driver should not use the same instance of utility | ||
| 349 | + * concurrently. | ||
| 302 | * | 350 | * |
| 303 | * @return YANG codec utility | 351 | * @return YANG codec utility |
| 304 | */ | 352 | */ | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2015-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ynh; | ||
| 18 | + | ||
| 19 | +import org.onosproject.yms.ydt.YdtContext; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * Represents YANG notification which is a subject of YANG based event. | ||
| 23 | + * | ||
| 24 | + * YMS add themselves as a listener to applications. Application sends | ||
| 25 | + * their notification in YANG utils generated notification. YMS obtains | ||
| 26 | + * the module/sub-module schema tree in which this notification is contained | ||
| 27 | + * and then convert this data to an abstract tree notation (YDT) with root | ||
| 28 | + * node as the logical node with name "yangnotification" it contains | ||
| 29 | + * module/sub-module node in which notification is contained. | ||
| 30 | + * It sends the same to all the protocol who has added them as a listener | ||
| 31 | + * as a YANG notification. | ||
| 32 | + * | ||
| 33 | + * This class represents YANG notification which contains the | ||
| 34 | + * notification context in abstract tree notation. | ||
| 35 | + */ | ||
| 36 | +public class YangNotification { | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * YANG notification in form of abstract tree notation (YDT) | ||
| 40 | + * Root node of notification root context will be logical node with | ||
| 41 | + * name as "yangnotification", it contains module/sub-module node | ||
| 42 | + * in which notification is contained. | ||
| 43 | + */ | ||
| 44 | + YdtContext notificationRootContext; | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Creates an instance of YANG notification subject. | ||
| 48 | + * | ||
| 49 | + * @param notificationContext logical root node with name as | ||
| 50 | + * "yangnotification" | ||
| 51 | + */ | ||
| 52 | + public YangNotification(YdtContext notificationContext) { | ||
| 53 | + this.notificationRootContext = notificationContext; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * Assign the YANG modeled notification data. | ||
| 58 | + * | ||
| 59 | + * @param notificationRootContext YANG data tree containing the data for | ||
| 60 | + * the notification | ||
| 61 | + */ | ||
| 62 | + public void setNotificationRootContext(YdtContext notificationRootContext) { | ||
| 63 | + this.notificationRootContext = notificationRootContext; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * Returns YANG notification data. | ||
| 68 | + * | ||
| 69 | + * @return YANG data tree containing the data for the notification | ||
| 70 | + */ | ||
| 71 | + public YdtContext getNotificationRootContext() { | ||
| 72 | + return notificationRootContext; | ||
| 73 | + } | ||
| 74 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.yms.ynh; | ||
| 17 | + | ||
| 18 | +import org.onosproject.event.AbstractEvent; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Represents YANG notification event. | ||
| 22 | + * | ||
| 23 | + * YANG notification handler listens for the notification from the application. | ||
| 24 | + * It convert the received notification in YANG notification events. | ||
| 25 | + * | ||
| 26 | + * YangNotificationEvent represents event generated by YANG management system | ||
| 27 | + * in response to the YANG defined application notification. The applications | ||
| 28 | + * notification information is in abstract YANG data tree. | ||
| 29 | + */ | ||
| 30 | +public class YangNotificationEvent | ||
| 31 | + extends AbstractEvent<YangNotificationEvent.Type, YangNotification> { | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Event type is the notification as defined in the YANG file. | ||
| 35 | + */ | ||
| 36 | + public enum Type { | ||
| 37 | + /** | ||
| 38 | + * Indicates a YANG notification. | ||
| 39 | + */ | ||
| 40 | + YANG_NOTIFICATION | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * YANG notification information shared to NBI protocol in YANG data tree | ||
| 45 | + * using the registered callback. | ||
| 46 | + * | ||
| 47 | + * @param subject notification information in YANG data tree. | ||
| 48 | + */ | ||
| 49 | + public YangNotificationEvent(YangNotification subject) { | ||
| 50 | + super(Type.YANG_NOTIFICATION, subject); | ||
| 51 | + } | ||
| 52 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.yms.ynh; | ||
| 17 | + | ||
| 18 | +import org.onosproject.event.EventListener; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Abstraction of listener for YANG notification handler events. | ||
| 22 | + * NBI protocols/interfaces supporting YANG notification needs to implement | ||
| 23 | + * YANG notification listener and add themselves as a listener to YANG | ||
| 24 | + * notification event. | ||
| 25 | + */ | ||
| 26 | +public interface YangNotificationListener | ||
| 27 | + extends EventListener<YangNotificationEvent> { | ||
| 28 | +} |
| ... | @@ -16,17 +16,86 @@ | ... | @@ -16,17 +16,86 @@ |
| 16 | 16 | ||
| 17 | package org.onosproject.yms.ynh; | 17 | package org.onosproject.yms.ynh; |
| 18 | 18 | ||
| 19 | +import org.onosproject.event.ListenerService; | ||
| 20 | + | ||
| 19 | /** | 21 | /** |
| 20 | * Abstraction of an entity which provides interfaces to YANG notification | 22 | * Abstraction of an entity which provides interfaces to YANG notification |
| 21 | - * service. YNH handles notification from the application/core and provide | 23 | + * service. YANG notification handler receives the event notifications from |
| 22 | - * it to the protocols. | 24 | + * application/core and provide it to the protocols. |
| 23 | - * <p> | 25 | + * |
| 24 | * NBI Protocols which can support notification delivery for application(s) | 26 | * NBI Protocols which can support notification delivery for application(s) |
| 25 | * needs to add themselves as a listeners with YANG notification service. | 27 | * needs to add themselves as a listeners with YANG notification service. |
| 26 | - * Protocols can use YANG notification service to check if a received | 28 | + * Also based on registered schema YMS add themselves as a listener to |
| 29 | + * applications. Application sends their notification in YANG utils generated | ||
| 30 | + * notification. YMS obtains the module/sub-module schema tree in which this | ||
| 31 | + * notification is contained and then convert this data to an abstract tree | ||
| 32 | + * notation (YDT) with root node as the module/sub-module node in which | ||
| 33 | + * notification is contained. It sends the same to all the protocol who has | ||
| 34 | + * added them as a listener as a YANG notification. | ||
| 35 | + * | ||
| 36 | + * Also Protocols can use YANG notification service to check if a received | ||
| 27 | * notification should be filtered against any of their protocol specific | 37 | * notification should be filtered against any of their protocol specific |
| 28 | * filtering mechanism. | 38 | * filtering mechanism. |
| 29 | */ | 39 | */ |
| 30 | -public interface YangNotificationService { | 40 | +public interface YangNotificationService |
| 31 | - //TODO | 41 | + extends ListenerService<YangNotificationEvent, |
| 42 | + YangNotificationListener> { | ||
| 43 | + | ||
| 44 | + /* | ||
| 45 | + * Example of a use case of notification filtering. | ||
| 46 | + * The following example illustrates how to select fault events which | ||
| 47 | + * have severities of critical, major, or minor. The filtering criteria | ||
| 48 | + * evaluation is as follows: | ||
| 49 | + * | ||
| 50 | + * ((fault & severity=critical) | (fault & severity=major) | (fault & | ||
| 51 | + * severity=minor)) | ||
| 52 | + * | ||
| 53 | + * <netconf:rpc netconf:message-id="101" | ||
| 54 | + * xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"> | ||
| 55 | + * <create-subscription | ||
| 56 | + * xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> | ||
| 57 | + * <filter netconf:type="subtree"> | ||
| 58 | + * <event xmlns="http://example.com/event/1.0"> | ||
| 59 | + * <eventClass>fault</eventClass> | ||
| 60 | + * <severity>critical</severity> | ||
| 61 | + * </event> | ||
| 62 | + * <event xmlns="http://example.com/event/1.0"> | ||
| 63 | + * <eventClass>fault</eventClass> | ||
| 64 | + * <severity>major</severity> | ||
| 65 | + * </event> | ||
| 66 | + * <event xmlns="http://example.com/event/1.0"> | ||
| 67 | + * <eventClass>fault</eventClass> | ||
| 68 | + * <severity>minor</severity> | ||
| 69 | + * </event> | ||
| 70 | + * </filter> | ||
| 71 | + * </create-subscription> | ||
| 72 | + * </netconf:rpc> | ||
| 73 | + */ | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * Protocols have their own mechanism to support notification filtering | ||
| 77 | + * or notification subscription. Depending on the protocol specification, | ||
| 78 | + * the filtering is implemented in the protocol. | ||
| 79 | + * The Protocol implementations are abstracted of the Schema, there are | ||
| 80 | + * scenarios in which they need to check if the received notification | ||
| 81 | + * is of interest as per the schema filtering / subscription. | ||
| 82 | + * In such scenario, protocols can create a filtering / subscription YANG | ||
| 83 | + * data tree and use the notification service to filter the notification | ||
| 84 | + * subject against their filter. | ||
| 85 | + * | ||
| 86 | + * Filters the notification subject YANG data tree, with the specified | ||
| 87 | + * filter of the NBI protocol. If the filter does not match for the | ||
| 88 | + * passed notification subject, null will be returned. | ||
| 89 | + * Otherwise, the part of the subject matching the filter will be returned. | ||
| 90 | + * | ||
| 91 | + * @param notificationSubject YANG notification subject reported by YANG | ||
| 92 | + * notification service. | ||
| 93 | + * @param notificationFilter Protocols data model specific notification | ||
| 94 | + * filter represented in YANG data tree. | ||
| 95 | + * @return filtered notification which passes the data model specific | ||
| 96 | + * notification filter. | ||
| 97 | + */ | ||
| 98 | + YangNotification getFilteredSubject(YangNotification notificationSubject, | ||
| 99 | + YangNotification notificationFilter); | ||
| 100 | + | ||
| 32 | } | 101 | } | ... | ... |
| ... | @@ -17,14 +17,11 @@ | ... | @@ -17,14 +17,11 @@ |
| 17 | /** | 17 | /** |
| 18 | * Provides interfaces to YANG notification handler. YNH handles notification | 18 | * Provides interfaces to YANG notification handler. YNH handles notification |
| 19 | * from the application and provide it to the protocols. | 19 | * from the application and provide it to the protocols. |
| 20 | - */ | ||
| 21 | - | ||
| 22 | -/** | ||
| 23 | - * Provides interfaces to YANG notification service. | ||
| 24 | * | 20 | * |
| 25 | * NBI Protocols which can support notification delivery for application(s) | 21 | * NBI Protocols which can support notification delivery for application(s) |
| 26 | - * needs to add themselves as a listeners with YANG notification service. | 22 | + * need to add themselves as a listeners with YANG notification service. |
| 27 | - * Protocols can use YANG notification service to check if a received | 23 | + * |
| 24 | + * Also protocols can use YANG notification service to check if a received | ||
| 28 | * notification should be filtered against any of their protocol specific | 25 | * notification should be filtered against any of their protocol specific |
| 29 | * filtering mechanism. | 26 | * filtering mechanism. |
| 30 | */ | 27 | */ | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +package org.onosproject.yms.ysr; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * Abstraction of an entity which provides YANG module identifiers. | ||
| 21 | + * Reference RFC 7895 | ||
| 22 | + * YANG library provides information about all the YANG modules | ||
| 23 | + * used by a network management server | ||
| 24 | + */ | ||
| 25 | +public interface YangModuleIdentifier { | ||
| 26 | + /** | ||
| 27 | + * retrieves the name of the YANG module. | ||
| 28 | + * | ||
| 29 | + * @return the name of the YANG module | ||
| 30 | + */ | ||
| 31 | + String getModuleName(); | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Retrieves revision of the YANG module. | ||
| 35 | + * | ||
| 36 | + * Reference RFC 7895 | ||
| 37 | + * Each YANG module and submodule within the library has a | ||
| 38 | + * revision. This is derived from the most recent revision statement | ||
| 39 | + * within the module or submodule. If no such revision statement | ||
| 40 | + * exists, the module's or submodule's revision is the zero-length | ||
| 41 | + * string. | ||
| 42 | + * | ||
| 43 | + * @return revision of the YANG module | ||
| 44 | + */ | ||
| 45 | + String getRevision(); | ||
| 46 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.yms.ysr; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * Abstraction of an entity which provides YANG module information. | ||
| 22 | + * | ||
| 23 | + * Reference RFC 7895 | ||
| 24 | + * The following information is needed by a client application (for each | ||
| 25 | + * YANG module in the library) to fully utilize the YANG data modeling | ||
| 26 | + * language: | ||
| 27 | + * | ||
| 28 | + * o name: The name of the YANG module. | ||
| 29 | + * | ||
| 30 | + * o revision: Each YANG module and submodule within the library has a | ||
| 31 | + * revision. This is derived from the most recent revision statement | ||
| 32 | + * within the module or submodule. If no such revision statement | ||
| 33 | + * exists, the module's or submodule's revision is the zero-length | ||
| 34 | + * string. | ||
| 35 | + * | ||
| 36 | + * o submodule list: The name and revision of each submodule used by | ||
| 37 | + * the module MUST be identified. | ||
| 38 | + * | ||
| 39 | + * o feature list: The name of each YANG feature supported by the | ||
| 40 | + * server MUST be identified. | ||
| 41 | + * | ||
| 42 | + * o deviation list: The name of each YANG module used for deviation | ||
| 43 | + * statements MUST be identified. | ||
| 44 | + */ | ||
| 45 | +public interface YangModuleInformation { | ||
| 46 | + /** | ||
| 47 | + * Retrieves the YANG modules identifier. | ||
| 48 | + * | ||
| 49 | + * @return YANG modules identifier | ||
| 50 | + */ | ||
| 51 | + YangModuleIdentifier getModuleIdentifier(); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * Retrieves the YANG modules namespace. | ||
| 55 | + * The XML namespace identifier for this module. | ||
| 56 | + * | ||
| 57 | + * @return YANG modules namespace | ||
| 58 | + */ | ||
| 59 | + String getNamespace(); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * Reference RFC 7895 | ||
| 63 | + * Retrieves the list of YANG feature names from this module that are | ||
| 64 | + * supported by the server, regardless of whether they are | ||
| 65 | + * defined in the module or any included submodule. | ||
| 66 | + * | ||
| 67 | + * @return list of YANG features | ||
| 68 | + */ | ||
| 69 | + List<String> getFeatureList(); | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * Retrieves the list of submodules in the module. | ||
| 73 | + * The name and revision of each submodule used by | ||
| 74 | + * the module MUST be identified. | ||
| 75 | + * | ||
| 76 | + * Each entry represents one submodule within the | ||
| 77 | + * parent module. | ||
| 78 | + * | ||
| 79 | + * @return list of submodules in the module | ||
| 80 | + */ | ||
| 81 | + List<YangModuleIdentifier> getSubModuleIdentifier(); | ||
| 82 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +package org.onosproject.yms.ysr; | ||
| 17 | + | ||
| 18 | +/*- | ||
| 19 | + * Abstraction of an entity which provides the servers YANG library information. | ||
| 20 | + * | ||
| 21 | + * Reference RFC 7895 | ||
| 22 | + * The "ietf-yang-library" module provides information about the YANG | ||
| 23 | + * library used by a server. This module is defined using YANG version | ||
| 24 | + * 1, but it supports the description of YANG modules written in any | ||
| 25 | + * revision of YANG. | ||
| 26 | + * | ||
| 27 | + * Following is the YANG Tree Diagram for the "ietf-yang-library" | ||
| 28 | + * module: | ||
| 29 | + * | ||
| 30 | + * +--ro modules-state | ||
| 31 | + * +--ro module-set-id string | ||
| 32 | + * +--ro module* [name revision] | ||
| 33 | + * +--ro name yang:yang-identifier | ||
| 34 | + * +--ro revision union | ||
| 35 | + * +--ro schema? inet:uri | ||
| 36 | + * +--ro namespace inet:uri | ||
| 37 | + * +--ro feature* yang:yang-identifier | ||
| 38 | + * +--ro deviation* [name revision] | ||
| 39 | + * | +--ro name yang:yang-identifier | ||
| 40 | + * | +--ro revision union | ||
| 41 | + * +--ro conformance-type enumeration | ||
| 42 | + * +--ro submodule* [name revision] | ||
| 43 | + * +--ro name yang:yang-identifier | ||
| 44 | + * +--ro revision union | ||
| 45 | + * +--ro schema? inet:uri | ||
| 46 | + */ | ||
| 47 | + | ||
| 48 | +import java.util.List; | ||
| 49 | + | ||
| 50 | +public interface YangModuleLibrary { | ||
| 51 | + /** | ||
| 52 | + * Retrieves the current module set id of the YANG library. | ||
| 53 | + * | ||
| 54 | + * Reference RFC7895. | ||
| 55 | + * modules-state/module-set-id | ||
| 56 | + * | ||
| 57 | + * This mandatory leaf contains a unique implementation-specific | ||
| 58 | + * identifier representing the current set of modules and submodules on | ||
| 59 | + * a specific server. The value of this leaf MUST change whenever the | ||
| 60 | + * set of modules and submodules in the YANG library changes. There is | ||
| 61 | + * no requirement that the same set always results in the same "module- | ||
| 62 | + * set-id" value. | ||
| 63 | + * | ||
| 64 | + * @return module set id of the YANG library | ||
| 65 | + */ | ||
| 66 | + String getModuleSetId(); | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * Retrieves the current list of YANG modules supported in the server. | ||
| 70 | + * | ||
| 71 | + * Reference RFC 7895. | ||
| 72 | + * modules-state/module | ||
| 73 | + * | ||
| 74 | + * This mandatory list contains one entry for each YANG data model | ||
| 75 | + * module supported by the server. There MUST be an entry in this list | ||
| 76 | + * for each revision of each YANG module that is used by the server. It | ||
| 77 | + * is possible for multiple revisions of the same module to be imported, | ||
| 78 | + * in addition to an entry for the revision that is implemented by the | ||
| 79 | + * server. | ||
| 80 | + * | ||
| 81 | + * @return the current list of YANG modules supported in the server | ||
| 82 | + */ | ||
| 83 | + List<YangModuleInformation> getYangModuleList(); | ||
| 84 | +} |
| 1 | +/* | ||
| 2 | + * Copyright 2016-present Open Networking Laboratory | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * YANG schema registry (YSR) is responsible to maintain all the applications | ||
| 19 | + * schemas defined in YANG. The YANG data tree builder depends on the schema | ||
| 20 | + * registry to validate the tree building according to schema. | ||
| 21 | + * YANG codec handler using the schema registry to maintain device schema. | ||
| 22 | + */ | ||
| 23 | +package org.onosproject.yms.ysr; |
-
Please register or login to post a comment