aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/utils/NetconfConstant.kt
blob: 3b3b0c0257b77e7bc8f94152c08bbd732dc0add9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright © 2017-2019 AT&T, Bell Canada
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor.utils

enum class NetconfDatastore(val datastore: String) {
    RUNNING("running"),
    CANDIDATE("candidate");
}

enum class ModifyAction(val action: String) {
    MERGE("merge"),
    REPLACE("replace"),
    NONE("none")
}

object RpcStatus {
    const val SUCCESS = "success"
    const val FAILURE = "failure"
}

object RpcMessageUtils {
    const val OPEN = "<"
    const val CLOSE = ">"
    const val EQUAL = "="

    const val HASH = "#"
    const val HASH_CHAR = '#'

    const val LF_CHAR = '\n'
    const val NEW_LINE = "\n"

    const val QUOTE = "\""
    const val QUOTE_SPACE = "\" "

    const val TAG_CLOSE = "/>"
    const val END_OF_RPC_OPEN_TAG = "\">"
    const val END_PATTERN = "]]>]]>"

    const val HELLO = "hello"
    const val RPC_REPLY = "rpc-reply"
    const val RPC_ERROR = "rpc-error"

    const val RPC_OPEN = "<rpc "
    const val RPC_CLOSE = "</rpc>"
    const val WITH_DEFAULT_OPEN = "<with-defaults "
    const val WITH_DEFAULT_CLOSE = "</with-defaults>"
    const val DEFAULT_OPERATION_OPEN = "<default-operation>"
    const val DEFAULT_OPERATION_CLOSE = "</default-operation>"
    const val SUBTREE_FILTER_OPEN = "<filter type=\"subtree\">"
    const val SUBTREE_FILTER_CLOSE = "</filter>"
    const val TARGET_OPEN = "<target>"
    const val TARGET_CLOSE = "</target>"
    const val SOURCE_OPEN = "<source>"
    const val SOURCE_CLOSE = "</source>"
    const val CONFIG_OPEN = "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
    const val CONFIG_CLOSE = "</config>"
    const val MSGLEN_REGEX_PATTERN = "\n#\\d+\n"

    const val NUMBER_BETWEEN_QUOTES_MATCHER = "\"+([0-9]+)+\""

    const val XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
    const val NETCONF_BASE_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\""
    const val NETCONF_WITH_DEFAULTS_NAMESPACE = "xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
    const val SUBSCRIPTION_SUBTREE_FILTER_OPEN =
        "<filter xmlns:base10=\"urn:ietf:params:xml:ns:netconf:base:1.0\" base10:type=\"subtree\">"

    const val INTERLEAVE_CAPABILITY_STRING = "urn:ietf:params:netconf:capability:interleave:1.0"

    const val CAPABILITY_REGEX = "capability>\\s*(.*?)\\s*capability>"

    const val SESSION_ID_REGEX = "session-id>\\s*(.*?)\\s*session-id>"

    const val MESSAGE_ID_STRING = "message-id"

    const val NETCONF_10_CAPABILITY = "urn:ietf:params:netconf:base:1.0"
    const val NETCONF_11_CAPABILITY = "urn:ietf:params:netconf:base:1.1"
}