Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 3 | # Copyright 2017 the original author or authors. |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
| 18 | class Constants: |
| 19 | |
| 20 | SSH_SUBSYSTEM = "netconf" |
| 21 | |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 22 | # Send message max size |
| 23 | MAXSSHBUF = 1024 * 1024 |
| 24 | |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 25 | # Secure credentials directories |
| 26 | # TODO: In a production environment these locations require better |
| 27 | # protection. For now the user_passwords file is just a plain text file. |
| 28 | KEYS_DIRECTORY = 'security/keys' |
| 29 | CERTS_DIRECTORY = 'security/certificates' |
| 30 | CLIENT_CRED_DIRECTORY = 'security/client_credentials' |
| 31 | |
| 32 | # Datastores |
| 33 | RUNNING = "running" |
| 34 | CANDIDATE = "candidate" |
| 35 | STARTUP = "startup" |
| 36 | |
| 37 | # RPC - base netconf |
| 38 | GET = "get" |
| 39 | GET_CONFIG = "get-config" |
| 40 | COPY_CONFIG = "copy-config" |
| 41 | EDIT_CONFIG = "edit-config" |
| 42 | DELETE_CONFIG = "delete-config" |
| 43 | LOCK = "lock" |
| 44 | UNLOCK = "unlock" |
| 45 | CLOSE_SESSION = "close-session" |
| 46 | KILL_SESSION = "kill-session" |
| 47 | |
| 48 | # Operations |
| 49 | OPERATION = "operation" |
| 50 | DEFAULT_OPERATION = "default-operation" |
| 51 | MERGE = "merge" |
| 52 | REPLACE = "replace" |
| 53 | CREATE = "create" |
| 54 | DELETE = "delete" |
| 55 | NONE = "none" |
| 56 | |
| 57 | # Netconf namespaces |
| 58 | NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0" |
| 59 | NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1" |
Khen Nursimulu | a497274 | 2016-12-23 17:15:20 -0500 | [diff] [blame] | 60 | NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 61 | |
| 62 | # XML |
| 63 | XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>""" |
| 64 | |
| 65 | # Capability xpath |
| 66 | CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability" |
| 67 | RPC_XPATH = "/nc:rpc" |
| 68 | |
| 69 | NC_SOURCE="nc:source" |
| 70 | SOURCE = "source" |
| 71 | TARGET = "target" |
| 72 | CONFIG = "config" |
| 73 | |
| 74 | |
| 75 | TEST_OPTION = "test-option" |
| 76 | TEST_THEN_SET = "test-then-set" |
| 77 | SET = "set" |
| 78 | |
| 79 | ERROR_OPTION = "error-option" |
| 80 | STOP_ON_ERROR = "stop-on-error" |
| 81 | CONTINUE_ON_ERROR = "continue-on-error" |
| 82 | ROLLBACK_ON_ERROR = "rollback-on-error" |
| 83 | |
| 84 | #tags |
| 85 | NC = "nc" |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 86 | VOLTHA = 'voltha' |
| 87 | NCM = "ncm" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 88 | RPC = "rpc" |
| 89 | RPC_REPLY = "rpc-reply" |
| 90 | RPC_ERROR = "rpc-error" |
| 91 | CAPABILITY = "capability" |
| 92 | CAPABILITIES = "capabilities" |
| 93 | HELLO = "hello" |
| 94 | URL = "url" |
| 95 | NC_FILTER="nc:filter" |
| 96 | FILTER = "filter" |
| 97 | SUBTREE = "subtree" |
| 98 | XPATH = "xpath" |
| 99 | OK = "ok" |
| 100 | SESSION_ID = "session-id" |
| 101 | MESSAGE_ID = "message-id" |
| 102 | XMLNS = "xmlns" |
| 103 | DELIMITER = "]]>]]>" |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 104 | |
| 105 | NS_MAP = { |
| 106 | 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0', |
| 107 | 'voltha': 'urn:opencord:params:xml:ns:voltha:ietf-voltha', |
| 108 | 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring' |
| 109 | } |
| 110 | |
| 111 | |