Minor fixes
Change-Id: Ie125d0234b689d44e69cb5282c8444db5e052221
diff --git a/netconf/capabilities.py b/netconf/capabilities.py
index 94d0836..1cd2ffc 100755
--- a/netconf/capabilities.py
+++ b/netconf/capabilities.py
@@ -37,13 +37,9 @@
self.server_caps.add(C.NETCONF_BASE_10)
self.server_caps.add(C.NETCONF_BASE_11)
self.server_caps.add(C.NETCONF_MONITORING)
+ self.server_caps.add(C.NETCONF_WRITABLE)
for schema in schemas:
self.server_caps.add(''.join([URN_PREFIX, schema]))
- self.server_caps.add(''.join([
- URN_PREFIX,
- schema,
- ':writable-running'])
- )
self.voltha_schemas.add(schema)
def set_schema_dir(self, schema_dir):
diff --git a/netconf/constants.py b/netconf/constants.py
index 704e1f8..9733327 100644
--- a/netconf/constants.py
+++ b/netconf/constants.py
@@ -29,10 +29,10 @@
CLIENT_CRED_DIRECTORY = 'security/client_credentials'
# YANG message definition file - generated file
- YANG_MESSAGE_DEFINITIONS_FILE='yang_message_defs.py'
+ YANG_MESSAGE_DEFINITIONS_FILE = 'yang_message_defs.py'
# Generated YANG schemas to ignore as not used by Netconf client
- SCHEMAS_TO_IGNORE =['http.yang', 'yang_options.yang', 'descriptor.yang']
+ SCHEMAS_TO_IGNORE = ['http.yang', 'yang_options.yang', 'descriptor.yang']
# Datastores
RUNNING = "running"
@@ -64,6 +64,7 @@
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"
+ NETCONF_CANDIDATE = "urn:ietf:params:netconf:capability:candidate:1.0"
# XML
XML_HEADER = """<?xml version="1.0" encoding="utf-8"?>"""
@@ -107,7 +108,7 @@
MESSAGE_ID = "message-id"
XMLNS = "xmlns"
DELIMITER = "]]>]]>"
- DELIMITER_1_1 ="##"
+ DELIMITER_1_1 = "##"
NS_MAP = {
'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0',
diff --git a/netconf/nc_rpc/base/close_session.py b/netconf/nc_rpc/base/close_session.py
index 05b56b4..3702a14 100644
--- a/netconf/nc_rpc/base/close_session.py
+++ b/netconf/nc_rpc/base/close_session.py
@@ -22,8 +22,8 @@
log = structlog.get_logger()
-class CloseSession(Rpc):
+class CloseSession(Rpc):
def __init__(self, request, request_xml, grpc_client, session,
capabilities):
super(CloseSession, self).__init__(request, request_xml, grpc_client,
@@ -36,12 +36,22 @@
return self.rpc_response
self.rpc_response.node = etree.Element("ok")
+
+ # Set the close session flag
+ self.rpc_response.close_session = True
return self.rpc_response
-
def _validate_parameters(self):
- for child in self.rpc_method.getchildren():
- # There cannot be parameters to a close session request
- self.rpc_response.is_error = True
- self.rpc_response.node = ncerror.BadMsg(self.rpc_request)
- return
\ No newline at end of file
+
+ if self.request:
+ try:
+ if self.request['command'] != 'close-session':
+ self.rpc_response.is_error = True
+ self.rpc_response.node = ncerror.BadMsg(self.request_xml)
+ return
+
+ except Exception as e:
+ self.rpc_response.is_error = True
+ self.rpc_response.node = ncerror.ServerException(
+ self.request_xml)
+ return