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 |
Khen Nursimulu | 2e6f595 | 2017-02-21 15:14:20 -0500 | [diff] [blame] | 32 | YANG_MESSAGE_DEFINITIONS_FILE = 'yang_message_defs.py' |
Khen Nursimulu | 3676b7c | 2017-01-31 13:48:38 -0500 | [diff] [blame] | 33 | |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 34 | # Generated YANG schemas to ignore as not used by Netconf client |
Khen Nursimulu | 2e6f595 | 2017-02-21 15:14:20 -0500 | [diff] [blame] | 35 | SCHEMAS_TO_IGNORE = ['http.yang', 'yang_options.yang', 'descriptor.yang'] |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 36 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 37 | # Datastores |
| 38 | RUNNING = "running" |
| 39 | CANDIDATE = "candidate" |
| 40 | STARTUP = "startup" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 41 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 42 | # RPC - base netconf |
| 43 | GET = "get" |
| 44 | GET_CONFIG = "get-config" |
| 45 | COPY_CONFIG = "copy-config" |
| 46 | EDIT_CONFIG = "edit-config" |
| 47 | DELETE_CONFIG = "delete-config" |
| 48 | LOCK = "lock" |
| 49 | UNLOCK = "unlock" |
| 50 | CLOSE_SESSION = "close-session" |
| 51 | KILL_SESSION = "kill-session" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 52 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 53 | # Operations |
| 54 | OPERATION = "operation" |
| 55 | DEFAULT_OPERATION = "default-operation" |
| 56 | MERGE = "merge" |
| 57 | REPLACE = "replace" |
| 58 | CREATE = "create" |
| 59 | DELETE = "delete" |
| 60 | NONE = "none" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 61 | |
| 62 | # Netconf namespaces |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 63 | NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0" |
| 64 | NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1" |
| 65 | NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring" |
| 66 | NETCONF_WRITABLE = "urn:ietf:params:netconf:capability:writable-running:1.0" |
Khen Nursimulu | 2e6f595 | 2017-02-21 15:14:20 -0500 | [diff] [blame] | 67 | NETCONF_CANDIDATE = "urn:ietf:params:netconf:capability:candidate:1.0" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 68 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 69 | # XML |
| 70 | XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>""" |
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 | # Capability xpath |
| 73 | CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability" |
| 74 | RPC_XPATH = "/nc:rpc" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 75 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 76 | NC_SOURCE = "nc:source" |
| 77 | SOURCE = "source" |
| 78 | TARGET = "target" |
| 79 | CONFIG = "config" |
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 | TEST_OPTION = "test-option" |
| 82 | TEST_THEN_SET = "test-then-set" |
| 83 | SET = "set" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 84 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 85 | ERROR_OPTION = "error-option" |
| 86 | STOP_ON_ERROR = "stop-on-error" |
| 87 | CONTINUE_ON_ERROR = "continue-on-error" |
| 88 | ROLLBACK_ON_ERROR = "rollback-on-error" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 89 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 90 | # tags |
| 91 | NC = "nc" |
| 92 | VOLTHA = 'voltha' |
| 93 | HEALTH = 'health' |
| 94 | NCM = "ncm" |
| 95 | RPC = "rpc" |
| 96 | RPC_REPLY = "rpc-reply" |
| 97 | RPC_ERROR = "rpc-error" |
| 98 | CAPABILITY = "capability" |
| 99 | CAPABILITIES = "capabilities" |
| 100 | HELLO = "hello" |
| 101 | URL = "url" |
| 102 | NC_FILTER = "nc:filter" |
| 103 | FILTER = "filter" |
| 104 | SUBTREE = "subtree" |
| 105 | XPATH = "xpath" |
| 106 | OK = "ok" |
| 107 | SESSION_ID = "session-id" |
| 108 | MESSAGE_ID = "message-id" |
| 109 | XMLNS = "xmlns" |
| 110 | DELIMITER = "]]>]]>" |
Khen Nursimulu | 2e6f595 | 2017-02-21 15:14:20 -0500 | [diff] [blame] | 111 | DELIMITER_1_1 = "##" |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 112 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 113 | NS_MAP = { |
| 114 | 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0', |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 115 | 'voltha': 'urn:opencord:params:xml:ns:voltha:voltha', |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 116 | 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring', |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 117 | 'health': 'urn:opencord:params:xml:ns:voltha:health' |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 118 | } |