Remove the 'ietf' prefix in front of the YANG modules
Change-Id: Ib932f6fb0f81b5731a9080234552d650245482a8
diff --git a/netconf/capabilities.py b/netconf/capabilities.py
index b033131..94d0836 100755
--- a/netconf/capabilities.py
+++ b/netconf/capabilities.py
@@ -33,7 +33,6 @@
self.client_caps.add(cap)
def set_server_capabilities(self, schemas):
- # prefix = "urn:ietf:params:netconf:capability:"
# first add the basic capabilities
self.server_caps.add(C.NETCONF_BASE_10)
self.server_caps.add(C.NETCONF_BASE_11)
diff --git a/netconf/constants.py b/netconf/constants.py
index 8e6bf92..b45363f 100644
--- a/netconf/constants.py
+++ b/netconf/constants.py
@@ -31,6 +31,9 @@
# YANG message definition file - generated file
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']
+
# Datastores
RUNNING = "running"
CANDIDATE = "candidate"
@@ -107,7 +110,7 @@
NS_MAP = {
'nc': 'urn:ietf:params:xml:ns:netconf:base:1.0',
- 'voltha': 'urn:opencord:params:xml:ns:voltha:ietf-voltha',
+ 'voltha': 'urn:opencord:params:xml:ns:voltha:voltha',
'ncm': 'urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring',
- 'health': 'urn:opencord:params:xml:ns:voltha:ietf-health'
+ 'health': 'urn:opencord:params:xml:ns:voltha:health'
}
diff --git a/netconf/grpc_client/grpc_client.py b/netconf/grpc_client/grpc_client.py
index 341f180..cc52a27 100644
--- a/netconf/grpc_client/grpc_client.py
+++ b/netconf/grpc_client/grpc_client.py
@@ -45,6 +45,7 @@
import base64
import math
import collections
+from netconf.constants import Constants as C
_INT64_TYPES = frozenset([descriptor.FieldDescriptor.CPPTYPE_INT64,
descriptor.FieldDescriptor.CPPTYPE_UINT64])
@@ -284,11 +285,8 @@
for fname in [f for f in os.listdir(self.work_dir)
if f.endswith('.yang')]:
- # Special case : since ietf-http, ietf-annotations,
- # ietf-yang_options are not used for yang schema then do not add
- # them to the set
- if fname not in ['ietf-http.yang', 'ietf-yang_options.yang',
- 'ietf-descriptor.yang']:
+ # Filter out schemas which are not required
+ if fname not in C.SCHEMAS_TO_IGNORE:
self.yang_schemas.add(fname[:-len('.yang')])
log.info('yang-schemas', schemas=self.yang_schemas)
diff --git a/netconf/nc_rpc/ext/get_schema.py b/netconf/nc_rpc/ext/get_schema.py
index a90906e..ff5f511 100644
--- a/netconf/nc_rpc/ext/get_schema.py
+++ b/netconf/nc_rpc/ext/get_schema.py
@@ -57,7 +57,7 @@
def _validate_parameters(self):
log.info('validate-parameters', session=self.session.session_id)
- # Validate the GET command
+ # Validate the GET-SCHEMA command
if self.request:
try:
if self.request['command'] != 'get-schema' or \
@@ -101,7 +101,7 @@
def create_xml_response(self, content):
ns = {}
- ns['xmlns'] = "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"
+ ns['xmlns'] = C.NS_MAP['ncm']
elem = etree.Element('data', attrib=ns)
elem.text = unicode(content, "utf-8")
diff --git a/netconf/nc_rpc/rpc_response.py b/netconf/nc_rpc/rpc_response.py
index 3b2deba..19e01e2 100644
--- a/netconf/nc_rpc/rpc_response.py
+++ b/netconf/nc_rpc/rpc_response.py
@@ -78,7 +78,7 @@
'<data>',
'<',
request['class'],
- ' xmlns="urn:opencord:params:xml:ns:voltha:ietf-voltha">',
+ ' xmlns="urn:opencord:params:xml:ns:voltha:voltha">',
voltha_xml_string,
'</',
request['class'],
@@ -88,7 +88,7 @@
else: # custom_rpc
body = ''.join([
'<rpc-reply',
- ' xmlns="urn:opencord:params:xml:ns:voltha:ietf-voltha">',
+ ' xmlns="urn:opencord:params:xml:ns:voltha:voltha">',
voltha_xml_string,
'</rpc-reply>',
])
diff --git a/netconf/protoc_plugins/proto2yang.py b/netconf/protoc_plugins/proto2yang.py
index e9bf614..5d101af 100755
--- a/netconf/protoc_plugins/proto2yang.py
+++ b/netconf/protoc_plugins/proto2yang.py
@@ -26,7 +26,7 @@
$ python -m grpc.tools.protoc -I.
--plugin=protoc-gen-custom=./proto2yang.py --custom_out=. <proto file>.proto
- - the above will produce a ietf-<proto file>.yang file formatted for yang
+ - the above will produce a <proto file>.yang file formatted for yang
- two examples of proto that can be used in the same directory are
yang.proto and addressbook.proto
@@ -75,7 +75,7 @@
""")
template_yang = env.from_string("""
-module ietf-{{ module.name }} {
+module {{ module.name }} {
{% macro set_module_prefix(type) %}
{% set found = [] %}
@@ -129,11 +129,11 @@
{% endmacro %}
- namespace "urn:opencord:params:xml:ns:voltha:ietf-{{ module.name }}";
+ namespace "urn:opencord:params:xml:ns:voltha:{{ module.name }}";
prefix {{ module.name }};
{% for imp in module.imports %}
- import ietf-{{ imp.name }} { prefix {{ imp.name }} ; }
+ import {{ imp.name }} { prefix {{ imp.name }} ; }
{% endfor %}
organization "CORD";
@@ -892,7 +892,7 @@
all_proto_data.append(
{
- 'file_name': '{}-{}'.format('ietf', proto_file.name.split(
+ 'file_name': '{}'.format(proto_file.name.split(
'/')[-1].replace('.proto', '.yang')),
'module': yang_data
}