This commit consists of:
1) Dockerizing the netconf server
2) Update proto2yang to support module imports
3) Provide a set of yang modules derived from the proto files in voltha.
These files as well as the slight mmodifications to the proto files are
provided in the experiments/netconf/proto2yang directory
4) Code to automatically pull proto files from voltha into the netconf server,
compiles them and produce the yang equivalent files.
5) Add a getvoltha netconf API to provide voltha state information (basic at
this time). There is potential to make this generic once we experiment
with additional APIs
Change-Id: I94f3a1f871b8025ad675d5f9b9b626d1be8b8d36
diff --git a/netconf/capabilities.py b/netconf/capabilities.py
index 86873f8..f7c2c5a 100755
--- a/netconf/capabilities.py
+++ b/netconf/capabilities.py
@@ -19,9 +19,143 @@
class Capabilities:
def __init__(self):
- self.server_caps = (C.NETCONF_BASE_10, C.NETCONF_BASE_11)
+ self.server_caps = self._get_server_capabilities()
self.client_caps = set()
def add_client_capability(self, cap):
self.client_caps.add(cap)
+ #TODO: This will be automatically generated from the voltha proto files
+ def _get_server_capabilities(self):
+ return (
+ C.NETCONF_BASE_10,
+ C.NETCONF_BASE_11,
+ "urn:opencord:params:xml:ns:voltha:ietf-voltha",
+ "urn:opencord:params:xml:ns:voltha:ietf-openflow_13",
+ "urn:opencord:params:xml:ns:voltha:ietf-meta",
+ "urn:opencord:params:xml:ns:voltha:ietf-logical_device",
+ "urn:opencord:params:xml:ns:voltha:ietf-health",
+ "urn:opencord:params:xml:ns:voltha:ietf-device",
+ "urn:opencord:params:xml:ns:voltha:ietf-empty",
+ "urn:opencord:params:xml:ns:voltha:ietf-common",
+ "urn:opencord:params:xml:ns:voltha:ietf-any",
+ "urn:opencord:params:xml:ns:voltha:ietf-adapter"
+ )
+
+ #TODO: A schema exchange will also need to happen
+
+ description = """
+
+ Option 1: Client already have the yang model for voltha and adapters:
+ <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <capabilities>
+ <capability>
+ urn:ietf:params:netconf:base:1.1
+ </capability>
+ <capability>
+ urn:cord:voltha:1.0
+ </capability>
+ <capability>
+ urn:cord:voltha:adpater_x:1.0
+ </capability>
+
+
+ Option 2: NETCONF-MONITORING - schema exchanges
+
+ server expose capabilities
+
+ <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <capabilities>
+ <capability>
+ urn:ietf:params:netconf:base:1.1
+ </capability>
+ <capability>
+ urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&revision=2010-10-04
+ </capability>
+
+ client request schemas
+
+ <rpc message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.1">
+ <get>
+ <filter type="subtree">
+ <netconf-state xmlns=
+ "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+ <schemas/>
+ </netconf-state>
+ </filter>
+ </get>
+ </rpc>
+
+ server sends back schemas
+
+ <rpc-reply message-id="101"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.1">
+ <data>
+ <netconf-state
+ xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+ <schemas>
+ <schema>
+ <identifier>voltha</identifier>
+ <version>1.0</version>
+ <format>yang</format>
+ <namespace>urn:cord:voltha</namespace>
+ <location>NETCONF</location>
+ </schema>
+ <schema>
+ <identifier>adapter_x</identifier>
+ <version>x_release</version>
+ <format>yang</format>
+ <namespace>urn:cord:voltha:adapter_x</namespace>
+ <location>NETCONF</location>
+ </schema>
+ </schemas>
+ </netconf-state>
+ </data>
+ </rpc-reply>
+
+
+ client requests each schema instance
+
+ <rpc message-id="102"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.1">
+ <get-schema
+ xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+ <identifer>voltha</identifer>
+ <version>1.0</version>
+ </get-schema>
+ </rpc>
+
+ <rpc-reply message-id="102"
+ xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <data
+ xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
+ module voltha {
+ //default format (yang) returned
+ //voltha version 0.1 yang module
+ //contents here ...
+ }
+ </data>
+ </rpc-reply>
+
+
+ GETTING DATA
+
+ Use filter:
+ 1) namespace filter
+ <filter type="subtree">
+ <top xmlns="http://example.com/schema/1.2/config"/>
+ </filter>
+
+ 2) <filter type="subtree">
+ <adapters xmlns="urn:cord:voltha:adapter_x">
+ <adapter>
+ <id>uuid</id>
+ <config/>
+ </adapter>
+ </adapters>
+ </filter>
+
+ /voltha/adapters/<adapter>/[<id>, <vendor>, <version>, <config>, <additonal_desc>]
+
+ """
\ No newline at end of file