Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / netconf-executor / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / netconf / executor / utils / NetconfConstant.kt
1 /*
2  * Copyright © 2017-2019 AT&T, Bell Canada
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.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils
17
18 enum class NetconfDatastore(val datastore: String) {
19     RUNNING("running"),
20     CANDIDATE("candidate");
21 }
22
23 enum class ModifyAction(val action: String) {
24     MERGE("merge"),
25     REPLACE("replace"),
26     NONE("none")
27 }
28
29 object RpcStatus {
30     const val SUCCESS = "success"
31     const val FAILURE = "failure"
32 }
33
34 object RpcMessageUtils {
35     const val OPEN = "<"
36     const val CLOSE = ">"
37     const val EQUAL = "="
38
39     const val HASH = "#"
40     const val HASH_CHAR = '#'
41
42     const val LF_CHAR = '\n'
43     const val NEW_LINE = "\n"
44
45     const val QUOTE = "\""
46     const val QUOTE_SPACE = "\" "
47
48     const val TAG_CLOSE = "/>"
49     const val END_OF_RPC_OPEN_TAG = "\">"
50     const val END_PATTERN = "]]>]]>"
51
52     const val HELLO = "hello"
53     const val RPC_REPLY = "rpc-reply"
54     const val RPC_ERROR = "rpc-error"
55
56     const val RPC_OPEN = "<rpc "
57     const val RPC_CLOSE = "</rpc>"
58     const val WITH_DEFAULT_OPEN = "<with-defaults "
59     const val WITH_DEFAULT_CLOSE = "</with-defaults>"
60     const val DEFAULT_OPERATION_OPEN = "<default-operation>"
61     const val DEFAULT_OPERATION_CLOSE = "</default-operation>"
62     const val SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">"
63     const val SUBTREE_FILTER_CLOSE = "</filter>"
64     const val TARGET_OPEN = "<target>"
65     const val TARGET_CLOSE = "</target>"
66     const val SOURCE_OPEN = "<source>"
67     const val SOURCE_CLOSE = "</source>"
68     const val CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
69     const val CONFIG_CLOSE = "</config>"
70     const val MSGLEN_REGEX_PATTERN = "\n#\\d+\n"
71
72     const val NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\""
73
74     const val XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
75     const val NETCONF_BASE_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\""
76     const val NETCONF_WITH_DEFAULTS_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
77     const val SUBSCRIPTION_SUBTREE_FILTER_OPEN =
78         "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">"
79
80     const val INTERLEAVE_CAPABILITY_STRING = "urn:ietf:params:netconf:capability:interleave:1.0"
81
82     const val CAPABILITY_REGEX = "capability>\\s*(.*?)\\s*capability>"
83
84     const val SESSION_ID_REGEX = "session-id>\\s*(.*?)\\s*session-id>"
85
86     const val MESSAGE_ID_STRING = "message-id"
87
88     const val NETCONF_10_CAPABILITY = "urn:ietf:params:netconf:base:1.0"
89     const val NETCONF_11_CAPABILITY = "urn:ietf:params:netconf:base:1.1"
90 }