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 | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 34 | # Generated YANG schemas to ignore as not used by Netconf client |
| 35 | SCHEMAS_TO_IGNORE =['http.yang', 'yang_options.yang', 'descriptor.yang'] |
| 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 | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 67 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 68 | # XML |
| 69 | XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>""" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 70 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 71 | # Capability xpath |
| 72 | CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability" |
| 73 | RPC_XPATH = "/nc:rpc" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 74 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 75 | NC_SOURCE = "nc:source" |
| 76 | SOURCE = "source" |
| 77 | TARGET = "target" |
| 78 | CONFIG = "config" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 79 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 80 | TEST_OPTION = "test-option" |
| 81 | TEST_THEN_SET = "test-then-set" |
| 82 | SET = "set" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 83 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 84 | ERROR_OPTION = "error-option" |
| 85 | STOP_ON_ERROR = "stop-on-error" |
| 86 | CONTINUE_ON_ERROR = "continue-on-error" |
| 87 | ROLLBACK_ON_ERROR = "rollback-on-error" |
Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 88 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 89 | # tags |
| 90 | NC = "nc" |
| 91 | VOLTHA = 'voltha' |
| 92 | HEALTH = 'health' |
| 93 | NCM = "ncm" |
| 94 | RPC = "rpc" |
| 95 | RPC_REPLY = "rpc-reply" |
| 96 | RPC_ERROR = "rpc-error" |
| 97 | CAPABILITY = "capability" |
| 98 | CAPABILITIES = "capabilities" |
| 99 | HELLO = "hello" |
| 100 | URL = "url" |
| 101 | NC_FILTER = "nc:filter" |
| 102 | FILTER = "filter" |
| 103 | SUBTREE = "subtree" |
| 104 | XPATH = "xpath" |
| 105 | OK = "ok" |
| 106 | SESSION_ID = "session-id" |
| 107 | MESSAGE_ID = "message-id" |
| 108 | XMLNS = "xmlns" |
| 109 | DELIMITER = "]]>]]>" |
Khen Nursimulu | c9ef7c1 | 2017-01-04 20:40:53 -0500 | [diff] [blame] | 110 | |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 111 | NS_MAP = { |
| 112 | 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0', |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 113 | 'voltha': 'urn:opencord:params:xml:ns:voltha:voltha', |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 114 | 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring', |
Khen Nursimulu | 0b9aed1 | 2017-02-06 15:33:46 -0500 | [diff] [blame] | 115 | 'health': 'urn:opencord:params:xml:ns:voltha:health' |
Khen Nursimulu | 8ffb893 | 2017-01-26 13:40:49 -0500 | [diff] [blame] | 116 | } |