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: |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 19 | SSH_SUBSYSTEM = "netconf" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 20 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 21 | # Send message max size |
| 22 | MAXSSHBUF = 1024 * 1024 |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 23 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 24 | # Secure credentials directories |
| 25 | # TODO: In a production environment these locations require better |
| 26 | # protection. For now the user_passwords file is just a plain text file. |
| 27 | KEYS_DIRECTORY = 'security/keys' |
| 28 | CERTS_DIRECTORY = 'security/certificates' |
| 29 | CLIENT_CRED_DIRECTORY = 'security/client_credentials' |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 30 | |
Khen Nursimulu | 3676b7c | 2017-01-31 13:48:38 -0500 | [diff] [blame] | 31 | # YANG message definition file - generated file |
| 32 | YANG_MESSAGE_DEFINITIONS_FILE='yang_message_defs.py' |
| 33 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 34 | # Datastores |
| 35 | RUNNING = "running" |
| 36 | CANDIDATE = "candidate" |
| 37 | STARTUP = "startup" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 38 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 39 | # RPC - base netconf |
| 40 | GET = "get" |
| 41 | GET_CONFIG = "get-config" |
| 42 | COPY_CONFIG = "copy-config" |
| 43 | EDIT_CONFIG = "edit-config" |
| 44 | DELETE_CONFIG = "delete-config" |
| 45 | LOCK = "lock" |
| 46 | UNLOCK = "unlock" |
| 47 | CLOSE_SESSION = "close-session" |
| 48 | KILL_SESSION = "kill-session" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 49 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 50 | # Operations |
| 51 | OPERATION = "operation" |
| 52 | DEFAULT_OPERATION = "default-operation" |
| 53 | MERGE = "merge" |
| 54 | REPLACE = "replace" |
| 55 | CREATE = "create" |
| 56 | DELETE = "delete" |
| 57 | NONE = "none" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 58 | |
| 59 | # Netconf namespaces |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 60 | NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0" |
| 61 | NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1" |
| 62 | NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" |
| 63 | NETCONF_WRITABLE = "urn:ietf:params:netconf:capability:writable-running:1.0" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 64 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 65 | # XML |
| 66 | XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>""" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 67 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 68 | # Capability xpath |
| 69 | CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability" |
| 70 | RPC_XPATH = "/nc:rpc" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 71 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 72 | NC_SOURCE = "nc:source" |
| 73 | SOURCE = "source" |
| 74 | TARGET = "target" |
| 75 | CONFIG = "config" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 76 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 77 | TEST_OPTION = "test-option" |
| 78 | TEST_THEN_SET = "test-then-set" |
| 79 | SET = "set" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 80 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 81 | ERROR_OPTION = "error-option" |
| 82 | STOP_ON_ERROR = "stop-on-error" |
| 83 | CONTINUE_ON_ERROR = "continue-on-error" |
| 84 | ROLLBACK_ON_ERROR = "rollback-on-error" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 85 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 86 | # tags |
| 87 | NC = "nc" |
| 88 | VOLTHA = 'voltha' |
| 89 | HEALTH = 'health' |
| 90 | NCM = "ncm" |
| 91 | RPC = "rpc" |
| 92 | RPC_REPLY = "rpc-reply" |
| 93 | RPC_ERROR = "rpc-error" |
| 94 | CAPABILITY = "capability" |
| 95 | CAPABILITIES = "capabilities" |
| 96 | HELLO = "hello" |
| 97 | URL = "url" |
| 98 | NC_FILTER = "nc:filter" |
| 99 | FILTER = "filter" |
| 100 | SUBTREE = "subtree" |
| 101 | XPATH = "xpath" |
| 102 | OK = "ok" |
| 103 | SESSION_ID = "session-id" |
| 104 | MESSAGE_ID = "message-id" |
| 105 | XMLNS = "xmlns" |
| 106 | DELIMITER = "]]>]]>" |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 107 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 108 | NS_MAP = { |
| 109 | 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0', |
| 110 | 'voltha': 'urn:opencord:params:xml:ns:voltha:ietf-voltha', |
| 111 | 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring', |
| 112 | 'health': 'urn:opencord:params:xml:ns:voltha:ietf-health' |
| 113 | } |