Khen Nursimulu | a7b842a | 2016-12-03 23:28:42 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # Copyright 2016 the original author or authors. |
| 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 | |
| 22 | # Secure credentials directories |
| 23 | # TODO: In a production environment these locations require better |
| 24 | # protection. For now the user_passwords file is just a plain text file. |
| 25 | KEYS_DIRECTORY = 'security/keys' |
| 26 | CERTS_DIRECTORY = 'security/certificates' |
| 27 | CLIENT_CRED_DIRECTORY = 'security/client_credentials' |
| 28 | |
| 29 | # Datastores |
| 30 | RUNNING = "running" |
| 31 | CANDIDATE = "candidate" |
| 32 | STARTUP = "startup" |
| 33 | |
| 34 | # RPC - base netconf |
| 35 | GET = "get" |
| 36 | GET_CONFIG = "get-config" |
| 37 | COPY_CONFIG = "copy-config" |
| 38 | EDIT_CONFIG = "edit-config" |
| 39 | DELETE_CONFIG = "delete-config" |
| 40 | LOCK = "lock" |
| 41 | UNLOCK = "unlock" |
| 42 | CLOSE_SESSION = "close-session" |
| 43 | KILL_SESSION = "kill-session" |
| 44 | |
| 45 | # Operations |
| 46 | OPERATION = "operation" |
| 47 | DEFAULT_OPERATION = "default-operation" |
| 48 | MERGE = "merge" |
| 49 | REPLACE = "replace" |
| 50 | CREATE = "create" |
| 51 | DELETE = "delete" |
| 52 | NONE = "none" |
| 53 | |
| 54 | # Netconf namespaces |
| 55 | NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0" |
| 56 | NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1" |
| 57 | |
| 58 | # XML |
| 59 | XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>""" |
| 60 | |
| 61 | # Capability xpath |
| 62 | CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability" |
| 63 | RPC_XPATH = "/nc:rpc" |
| 64 | |
| 65 | NC_SOURCE="nc:source" |
| 66 | SOURCE = "source" |
| 67 | TARGET = "target" |
| 68 | CONFIG = "config" |
| 69 | |
| 70 | |
| 71 | TEST_OPTION = "test-option" |
| 72 | TEST_THEN_SET = "test-then-set" |
| 73 | SET = "set" |
| 74 | |
| 75 | ERROR_OPTION = "error-option" |
| 76 | STOP_ON_ERROR = "stop-on-error" |
| 77 | CONTINUE_ON_ERROR = "continue-on-error" |
| 78 | ROLLBACK_ON_ERROR = "rollback-on-error" |
| 79 | |
| 80 | #tags |
| 81 | NC = "nc" |
| 82 | RPC = "rpc" |
| 83 | RPC_REPLY = "rpc-reply" |
| 84 | RPC_ERROR = "rpc-error" |
| 85 | CAPABILITY = "capability" |
| 86 | CAPABILITIES = "capabilities" |
| 87 | HELLO = "hello" |
| 88 | URL = "url" |
| 89 | NC_FILTER="nc:filter" |
| 90 | FILTER = "filter" |
| 91 | SUBTREE = "subtree" |
| 92 | XPATH = "xpath" |
| 93 | OK = "ok" |
| 94 | SESSION_ID = "session-id" |
| 95 | MESSAGE_ID = "message-id" |
| 96 | XMLNS = "xmlns" |
| 97 | DELIMITER = "]]>]]>" |