The commit consists of:
1) Support metadata (e.g. get-depth) for rpc request.
2) Support parameters in rpc requests
3) Generate the code for netconf rpc to Voltha grpc mapping
4) Initial Support custom rpc requests (those defined in the voltha YANG schemas).
Change-Id: I24dc7fd75b5f71d0d8591637579672b25fda57ec
diff --git a/netconf/constants.py b/netconf/constants.py
index 332ec16..976ddff 100644
--- a/netconf/constants.py
+++ b/netconf/constants.py
@@ -16,96 +16,95 @@
#
class Constants:
+ SSH_SUBSYSTEM = "netconf"
- SSH_SUBSYSTEM = "netconf"
+ # Send message max size
+ MAXSSHBUF = 1024 * 1024
- # Send message max size
- MAXSSHBUF = 1024 * 1024
+ # Secure credentials directories
+ # TODO: In a production environment these locations require better
+ # protection. For now the user_passwords file is just a plain text file.
+ KEYS_DIRECTORY = 'security/keys'
+ CERTS_DIRECTORY = 'security/certificates'
+ CLIENT_CRED_DIRECTORY = 'security/client_credentials'
- # Secure credentials directories
- # TODO: In a production environment these locations require better
- # protection. For now the user_passwords file is just a plain text file.
- KEYS_DIRECTORY = 'security/keys'
- CERTS_DIRECTORY = 'security/certificates'
- CLIENT_CRED_DIRECTORY = 'security/client_credentials'
+ # Datastores
+ RUNNING = "running"
+ CANDIDATE = "candidate"
+ STARTUP = "startup"
- # Datastores
- RUNNING = "running"
- CANDIDATE = "candidate"
- STARTUP = "startup"
+ # RPC - base netconf
+ GET = "get"
+ GET_CONFIG = "get-config"
+ COPY_CONFIG = "copy-config"
+ EDIT_CONFIG = "edit-config"
+ DELETE_CONFIG = "delete-config"
+ LOCK = "lock"
+ UNLOCK = "unlock"
+ CLOSE_SESSION = "close-session"
+ KILL_SESSION = "kill-session"
- # RPC - base netconf
- GET = "get"
- GET_CONFIG = "get-config"
- COPY_CONFIG = "copy-config"
- EDIT_CONFIG = "edit-config"
- DELETE_CONFIG = "delete-config"
- LOCK = "lock"
- UNLOCK = "unlock"
- CLOSE_SESSION = "close-session"
- KILL_SESSION = "kill-session"
-
- # Operations
- OPERATION = "operation"
- DEFAULT_OPERATION = "default-operation"
- MERGE = "merge"
- REPLACE = "replace"
- CREATE = "create"
- DELETE = "delete"
- NONE = "none"
+ # Operations
+ OPERATION = "operation"
+ DEFAULT_OPERATION = "default-operation"
+ MERGE = "merge"
+ REPLACE = "replace"
+ CREATE = "create"
+ DELETE = "delete"
+ NONE = "none"
# Netconf namespaces
- NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0"
- NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1"
- NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"
+ NETCONF_BASE_10 = "urn:ietf:params:netconf:base:1.0"
+ NETCONF_BASE_11 = "urn:ietf:params:netconf:base:1.1"
+ NETCONF_MONITORING = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"
+ NETCONF_WRITABLE = "urn:ietf:params:netconf:capability:writable-running:1.0"
- # XML
- XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>"""
+ # XML
+ XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>"""
- # Capability xpath
- CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability"
- RPC_XPATH = "/nc:rpc"
+ # Capability xpath
+ CAPABILITY_XPATH = "//nc:hello/nc:capabilities/nc:capability"
+ RPC_XPATH = "/nc:rpc"
- NC_SOURCE="nc:source"
- SOURCE = "source"
- TARGET = "target"
- CONFIG = "config"
-
+ NC_SOURCE = "nc:source"
+ SOURCE = "source"
+ TARGET = "target"
+ CONFIG = "config"
- TEST_OPTION = "test-option"
- TEST_THEN_SET = "test-then-set"
- SET = "set"
+ TEST_OPTION = "test-option"
+ TEST_THEN_SET = "test-then-set"
+ SET = "set"
- ERROR_OPTION = "error-option"
- STOP_ON_ERROR = "stop-on-error"
- CONTINUE_ON_ERROR = "continue-on-error"
- ROLLBACK_ON_ERROR = "rollback-on-error"
+ ERROR_OPTION = "error-option"
+ STOP_ON_ERROR = "stop-on-error"
+ CONTINUE_ON_ERROR = "continue-on-error"
+ ROLLBACK_ON_ERROR = "rollback-on-error"
- #tags
- NC = "nc"
- VOLTHA = 'voltha'
- NCM = "ncm"
- RPC = "rpc"
- RPC_REPLY = "rpc-reply"
- RPC_ERROR = "rpc-error"
- CAPABILITY = "capability"
- CAPABILITIES = "capabilities"
- HELLO = "hello"
- URL = "url"
- NC_FILTER="nc:filter"
- FILTER = "filter"
- SUBTREE = "subtree"
- XPATH = "xpath"
- OK = "ok"
- SESSION_ID = "session-id"
- MESSAGE_ID = "message-id"
- XMLNS = "xmlns"
- DELIMITER = "]]>]]>"
+ # tags
+ NC = "nc"
+ VOLTHA = 'voltha'
+ HEALTH = 'health'
+ NCM = "ncm"
+ RPC = "rpc"
+ RPC_REPLY = "rpc-reply"
+ RPC_ERROR = "rpc-error"
+ CAPABILITY = "capability"
+ CAPABILITIES = "capabilities"
+ HELLO = "hello"
+ URL = "url"
+ NC_FILTER = "nc:filter"
+ FILTER = "filter"
+ SUBTREE = "subtree"
+ XPATH = "xpath"
+ OK = "ok"
+ SESSION_ID = "session-id"
+ MESSAGE_ID = "message-id"
+ XMLNS = "xmlns"
+ DELIMITER = "]]>]]>"
- NS_MAP = {
- 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0',
- 'voltha': 'urn:opencord:params:xml:ns:voltha:ietf-voltha',
- 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring'
- }
-
-
+ NS_MAP = {
+ 'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0',
+ 'voltha': 'urn:opencord:params:xml:ns:voltha:ietf-voltha',
+ 'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring',
+ 'health': 'urn:opencord:params:xml:ns:voltha:ietf-health'
+ }