2 * Copyright © 2017-2018 AT&T Intellectual Property.
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.apps.blueprintsprocessor.functions.netconf.executor.utils
18 import java.util.regex.Pattern;
26 const val HASH_CHAR = '#'
28 const val LF_CHAR = '\n'
29 const val NEW_LINE = "\n"
31 const val QUOTE = "\""
32 const val QUOTE_SPACE = "\" "
34 const val TAG_CLOSE = "/>"
35 const val END_OF_RPC_OPEN_TAG = "\">"
36 const val END_PATTERN = "]]>]]>"
38 const val HELLO = "hello"
39 const val RPC_REPLY = "rpc-reply"
40 const val RPC_ERROR = "rpc-error"
42 const val RPC_OPEN = "<rpc "
43 const val RPC_CLOSE = "</rpc>"
44 const val WITH_DEFAULT_OPEN = "<with-defaults "
45 const val WITH_DEFAULT_CLOSE = "</with-defaults>"
46 const val DEFAULT_OPERATION_OPEN = "<default-operation>"
47 const val DEFAULT_OPERATION_CLOSE = "</default-operation>"
48 const val SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">"
49 const val SUBTREE_FILTER_CLOSE = "</filter>"
50 const val TARGET_OPEN = "<target>"
51 const val TARGET_CLOSE = "</target>"
52 const val SOURCE_OPEN = "<source>"
53 const val SOURCE_CLOSE = "</source>"
54 const val CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
55 const val CONFIG_CLOSE = "</config>"
56 const val MSGLEN_REGEX_PATTERN = "\n#\\d+\n"
59 const val NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\""
61 const val XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
62 const val NETCONF_BASE_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\""
63 const val NETCONF_WITH_DEFAULTS_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
64 const val SUBSCRIPTION_SUBTREE_FILTER_OPEN = "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">"
66 const val INTERLEAVE_CAPABILITY_STRING = "urn:ietf:params:netconf:capability:interleave:1.0"
68 const val CAPABILITY_REGEX = "capability>\\s*(.*?)\\s*capability>"
71 const val SESSION_ID_REGEX = "session-id>\\s*(.*?)\\s*session-id>"
74 const val MESSAGE_ID_STRING = "message-id"
77 const val NETCONF_10_CAPABILITY = "urn:ietf:params:netconf:base:1.0"
78 const val NETCONF_11_CAPABILITY = "urn:ietf:params:netconf:base:1.1"