2 * Copyright © 2017-2019 AT&T, Bell Canada
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils
18 enum class NetconfDatastore(val datastore: String) {
20 CANDIDATE("candidate");
23 enum class ModifyAction(val action: String) {
30 const val SUCCESS = "success"
31 const val FAILURE = "failure"
34 object RpcMessageUtils {
40 const val HASH_CHAR = '#'
42 const val LF_CHAR = '\n'
43 const val NEW_LINE = "\n"
45 const val QUOTE = "\""
46 const val QUOTE_SPACE = "\" "
48 const val TAG_CLOSE = "/>"
49 const val END_OF_RPC_OPEN_TAG = "\">"
50 const val END_PATTERN = "]]>]]>"
52 const val HELLO = "hello"
53 const val RPC_REPLY = "rpc-reply"
54 const val RPC_ERROR = "rpc-error"
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"
72 const val NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\""
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\">"
80 const val INTERLEAVE_CAPABILITY_STRING = "urn:ietf:params:netconf:capability:interleave:1.0"
82 const val CAPABILITY_REGEX = "capability>\\s*(.*?)\\s*capability>"
84 const val SESSION_ID_REGEX = "session-id>\\s*(.*?)\\s*session-id>"
86 const val MESSAGE_ID_STRING = "message-id"
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"