blob: 8445d3c2bc6a7c82f34e921ef04d346522fae10a [file] [log] [blame]
Gaurav Agrawalb102b012016-08-02 12:52:48 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Gaurav Agrawalb102b012016-08-02 12:52:48 +05303 *
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
17package org.onosproject.yms.ydt;
18
19/**
20 * Represents type of YANG data tree node operation.
21 *
22 * This is used by protocols to specify edit operation associate with the node.
23 * YMS data validation and data handling will vary based on the edit operation
24 * type, for an instance, default leafs if not present in data should be added
25 * if edit operation type is create and shouldn't be added if operation type is
26 * delete.
27 * Edit operation type is mapped to "operation type" of YANG utils generated
28 * classes by YMS.
29 *
30 * In case of SBI driver/provider creates JAVA object (of YANG utils generated
31 * classes) and specifies the edit operation type in "operation type" field.
32 * YMS map this operation type to "edit operation type" of YDT, which will be
33 * further encoded in corresponding data format.
34 *
35 * This is only applicable if YANG root level interaction type is EDIT_CONFIG.
36 * If edit operation type is not specified when root interaction type is
37 * EDIT_CONFIG then default operation type will be selected.
38 * By default "default operation type" is "merge" unless explicitly specified
39 * by protocol.
40 */
41
42/*
43 * Edit operation type mapping with RESTCONF and NETCONF as example:
44 * +----------+----------------------------+------------+
45 * | RESTCONF | NETCONF | EditOpType |
46 * +----------+----------------------------+------------+
47 * | OPTIONS | none | NA |
48 * | HEAD | none | NA |
49 * | GET | <get-config>, <get> | NA |
50 * | POST | (operation="create") | CREATE |
51 * | PUT | (operation="replace") | REPLACE |
52 * | PATCH | (operation="merge") | MERGE |
53 * | DELETE | (operation="delete") | DELETE |
54 * | none | (operation="remove") | REMOVE |
55 * +----------+----------------------------+------------+
56 * Note: Additionally RESTCONF must use API resource to figure out whether
57 * request contains data resource or it's for data model specific operation.
58 * +--rw restconf
59 * +--rw data
60 * +--rw operations
61 * Edit operation type is only applicable for data resource.
62 *
63 * Additionally protocols has to use operation type NONE to specify the URI
64 * path.
65 */
66public enum YdtContextOperationType {
67
68 /**
69 * Type of YANG data tree action for below action:
70 * The configuration data identified by the element
71 * containing this attribute is added to the configuration if
72 * and only if the configuration data does not already exist in
73 * the configuration datastore. If the configuration data
74 * exists, an error is returned.
75 */
76 CREATE,
77
78 /**
79 * Type of YANG data tree action for below action:
80 * The configuration data identified by the element
81 * containing this attribute is deleted from the configuration
82 * if and only if the configuration data currently exists in
83 * the configuration datastore. If the configuration data does
84 * not exist, an error is returned".
85 */
86 DELETE,
87
88 /**
89 * Type of YANG data tree action for below action:
90 * The configuration data identified by the element
91 * containing this attribute is merged with the configuration
92 * at the corresponding level in the configuration datastore.
93 */
94 MERGE,
95
96 /**
97 * Type of YANG data tree action for below action:
98 * The configuration data identified by the element
99 * containing this attribute replaces any related configuration
100 * in the configuration datastore. If no such configuration
101 * data exists in the configuration datastore, it is created.
102 */
103 REPLACE,
104
105 /**
106 * Type of YANG data tree action for below action:
107 * The configuration data identified by the element
108 * containing this attribute is deleted from the configuration
109 * if the configuration data currently exists in the
110 * configuration datastore. If the configuration data does not
111 * exist, the "remove" operation is silently ignored by the
112 * server.
113 */
114 REMOVE,
115
116 /**
117 * The node is used as a containment node to reach the child node,
118 * There is no change in the data store for the values of this node in the
119 * edit request.
120 */
121 NONE
122}
123