Some small cleanups
Change-Id: I96a6c02ace5babc49a066e70f222f55d51bab6b3
diff --git a/netconf/security/client_credentials/client_keys b/netconf/security/client_credentials/client_keys
index c2d9c96..ceff017 100644
--- a/netconf/security/client_credentials/client_keys
+++ b/netconf/security/client_credentials/client_keys
@@ -1,3 +1,3 @@
-vagrant:id_rsa
-voltha:id_rsa
-user:id_rsa
\ No newline at end of file
+vagrant:id_rsa.pub
+voltha:id_rsa.pub
+user:id_rsa.pub
\ No newline at end of file
diff --git a/netconf/security/client_credentials/id_rsa b/netconf/security/client_credentials/id_rsa
index 935df1f..a1260c9 100644
--- a/netconf/security/client_credentials/id_rsa
+++ b/netconf/security/client_credentials/id_rsa
@@ -1,27 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
-MIIEogIBAAKCAQEAwc4vhwcIUr+vPOlA0e52QepFcTieYt1lln17qOtQ8lw/Fg4e
-7UEo3huCJZWZKQ49tA5nCrGeCprPHNqZeLbbL8qBM9JbCnj/cZ0Z3vOXEXoYJGwM
-PklAEp3q9Wt5jN0aL71BPjTDFr5chLTC52MWtxlfJwYsF5sKnLvRQabDTT7Bfdvj
-PgYBcwZ7c5bp00wdc4xAZLd7nMCWFadO10p+EGfg3DvqJkgoA9WN5u7wHLZlG38a
-Ai1cls8UrsiwWie62CcOAEPZmvo1GEAb8+K06DsW6A1DBlMv80DCebvBg8XLYJh/
-22eAiVxNcJWpEecp6LkqD4V/4rgfONSuOeN7DwIDAQABAoIBAFKArrThpoZreXMJ
-rQFxbUBUNamkO7DEpSlyU8EuI7B42pZN/pZrhbU/qqDLVX8nw9axxuXDhQ7opkCX
-QnwkA50NrQDdjMohhkTcZxYFRos3Ga3vnSqqzi7esRY24XC48xvdijesCFzXPtVz
-igEsqo/ZqisXso99/f+I6OT00/E+hzDCPXn0VzWhNE5g2oDd6OMcn4y5SQ/OQfDl
-bx0sA2H+3bJCkGYAwt/ebMYxStNYx7eJFggq06O+aCKoilrI9U/kkN++qbjkp+p1
-p7FrKypHXu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Rd
+3JE9ARUj0ygy6dhIg/UElHwzFFd1opJ/iTrYv6rLNd0HFGtHzGDlBzGx6kLtEt/9
+zzPv4cS4Hd0Cyq6FOxAq3wKBgDtSHVe+If9hKTgo79C4rzHkAtUUGv+yvql2g4ls
+UYPGY3W6NXUjXeBzo0QdnToTB2+Nq2o9lKXBcsknU8W/OTmUT5NoZ6rycw7Qq5Z/
+CPVW2NeyLx5bediDa3FDLmb5DC6HnhKxQQN1QG07cVyWoPLnRsqNjZa+yHYIRg5B
+RF4xAoGBAJVRLsi8ObZAkrpnat1FNSSCnFbckvDYzIRT+VkJHErB+faNHjwnYHZH
+cqD6RMB4ZD1tKoQte9jO/R9I5fE1lr5QxIaYC9DYDWKT8T4qBgDo8yR7rP67fQ4z
++Eqxtt0ZjaGhxJzkGRA2aUdnex4FEs77CgxYOuXUb8KQjLPtCnZd
-----END RSA PRIVATE KEY-----
diff --git a/netconf/security/client_credentials/id_rsa.pub b/netconf/security/client_credentials/id_rsa.pub
index ef0da9f..e744803 100644
--- a/netconf/security/client_credentials/id_rsa.pub
+++ b/netconf/security/client_credentials/id_rsa.pub
@@ -1 +1 @@
-ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBzi+HBwhSv6886UDR7nZB6kVxOJ5i3WWWfXuo61DyXD8WDh7tQSjeG4IllZkpDj20DmcKsZ4Kms8c2pl4ttsvyoEz0lsKeP9xnRne85cRehgkbAw+SUASner1a3mM3RovvUE+NMMWvlyEtMLnYxa3GV8nBiwXmwqcu9FBpsNNPsF92+M+BgFzBntzlunTTB1zjEBkt3ucwJYVp07XSn4QZ+DcO+omSCgD1Y3m7vActmUbfxoCLVyWzxSuyLBaJ7rYJw4AQ9ma+jUYQBvz4rToOxboDUMGUy/zQMJ5u8GDxctgmH/bZ4CJXE1wlakR5ynouSoPhX/iuB841K4543sP vagrant@voltha
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0Ix05mz647U81wNYl2uPPm0+Waoemr1QK/RxGuizXgC+mcxH924aVuQl61hf9cX+P6BYk8zN9tNdO+QHwbdxf7qjJHXzILdq3slAihNHuiYo+W++sDgeLErfFTyFOCbJVcuneF6ow7pFvF/UzwDijTa+par0S7fTZ2RkO+No17itXLOFPBaGOgTgSproEydR7xuur9ikD688ADx0hUXHKLO8TGfpvnK4WwZC5u247LVgO6kPMRD2BHihWUnwWebHNWpyz5Y9U1l8Y3Re96oMhYGI3ID5ZGS2AYaTVBL+Bfq+UrzWQRu1eAWbaI3XHhSSgNEw+l1yEM3mI4OMRfYgX knursimu@ONM-KNURSIMU-01
diff --git a/netconf/session/nc_protocol_handler.py b/netconf/session/nc_protocol_handler.py
index 79cfb06..7062250 100644
--- a/netconf/session/nc_protocol_handler.py
+++ b/netconf/session/nc_protocol_handler.py
@@ -23,7 +23,7 @@
from netconf.constants import Constants as C
from netconf.nc_common.utils import qmap, ns, elm
import netconf.nc_common.error as ncerror
-from netconf.nc_common.error import BadMsg, NotImpl, ServerException, Error
+from netconf.nc_rpc.rpc_response import RpcResponse
log = structlog.get_logger()
@@ -181,6 +181,7 @@
response=response)
if not response.is_error:
self.send_rpc_reply(response.node, rpc)
+ # self.send_rpc_reply(self.get_mock_volthainstance(), rpc)
else:
self.send_message(response.node.get_xml_reply())
@@ -235,371 +236,142 @@
self.connected.callback(None)
log.info('closing-client')
+
# Example of a properly formatted Yang-XML message
- def get_instance(self):
- xml_string = """
- <data>
- <Voltha xmlns="urn:opencord:params:xml:ns:voltha:ietf-voltha">
- <instances>
- <log_level>INFO</log_level>
- <device_types>
- <adapter>simulated_onu</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>simulated_onu</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <device_types>
- <adapter>tibit_onu</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>tibit_onu</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <device_types>
- <adapter>maple_olt</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>maple_olt</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <device_types>
- <adapter>tibit_olt</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>tibit_olt</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <device_types>
- <adapter>broadcom_onu</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>broadcom_onu</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <device_types>
- <adapter>simulated_olt</adapter>
- <accepts_bulk_flow_update>True</accepts_bulk_flow_update>
- <id>simulated_olt</id>
- <accepts_add_remove_flow_updates>False</accepts_add_remove_flow_updates>
- </device_types>
- <logical_devices>
- <datapath_id>1</datapath_id>
- <root_device_id>simulated_olt_1</root_device_id>
- <switch_features>
- <auxiliary_id>0</auxiliary_id>
- <n_tables>2</n_tables>
- <datapath_id>0</datapath_id>
- <capabilities>15</capabilities>
- <n_buffers>256</n_buffers>
- </switch_features>
- <flows/>
- <id>simulated1</id>
- <flow_groups/>
- <ports>
- <device_port_no>2</device_port_no>
- <root_port>False</root_port>
- <device_id>simulated_onu_1</device_id>
- <id>onu1</id>
- <ofp_port>
- <hw_addr>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>1</item>
- </hw_addr>
- <curr_speed>32</curr_speed>
- <curr>4128</curr>
- <name>onu1</name>
- <supported>0</supported>
- <state>4</state>
- <max_speed>32</max_speed>
- <advertised>4128</advertised>
- <peer>4128</peer>
- <config>0</config>
- <port_no>1</port_no>
- </ofp_port>
- </ports>
- <ports>
- <device_port_no>2</device_port_no>
- <root_port>False</root_port>
- <device_id>simulated_onu_2</device_id>
- <id>onu2</id>
- <ofp_port>
- <hw_addr>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>2</item>
- </hw_addr>
- <curr_speed>32</curr_speed>
- <curr>4128</curr>
- <name>onu2</name>
- <supported>0</supported>
- <state>4</state>
- <max_speed>32</max_speed>
- <advertised>4128</advertised>
- <peer>4128</peer>
- <config>0</config>
- <port_no>2</port_no>
- </ofp_port>
- </ports>
- <ports>
- <device_port_no>2</device_port_no>
- <root_port>True</root_port>
- <device_id>simulated_olt_1</device_id>
- <id>olt1</id>
- <ofp_port>
- <hw_addr>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>0</item>
- <item>129</item>
- </hw_addr>
- <curr_speed>32</curr_speed>
- <curr>4128</curr>
- <name>olt1</name>
- <supported>0</supported>
- <state>4</state>
- <max_speed>32</max_speed>
- <advertised>4128</advertised>
- <peer>4128</peer>
- <config>0</config>
- <port_no>129</port_no>
- </ofp_port>
- </ports>
- <desc>
- <dp_desc>n/a</dp_desc>
- <sw_desc>simualted pon</sw_desc>
- <hw_desc>simualted pon</hw_desc>
- <serial_num>985c4449d50a441ca843401e2f44e682</serial_num>
- <mfr_desc>cord porject</mfr_desc>
- </desc>
- </logical_devices>
- <devices>
- <item>
- <vendor>simulated</vendor>
- <parent_port_no>0</parent_port_no>
- <software_version>1.0</software_version>
- <connect_status>UNKNOWN</connect_status>
- <type>simulated_olt</type>
- <adapter>simulated_olt</adapter>
- <vlan>0</vlan>
- <hardware_version>n/a</hardware_version>
- <flows>
- <items/>
- </flows>
- <ports>
- <item>
- <peers>
- <item>
- <port_no>1</port_no>
- <device_id>simulated_onu_1</device_id>
- </item>
- <item>
- <port_no>1</port_no>
- <device_id>simulated_onu_2</device_id>
- </item>
- </peers>
- <label>pon</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>PON_OLT</type>
- <port_no>1</port_no>
- <device_id>simulated_olt_1</device_id>
- </item>
- <item>
- <peers/>
- <label>eth</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>ETHERNET_NNI</type>
- <port_no>2</port_no>
- <device_id>simulated_olt_1</device_id>
- </item>
- </ports>
- <parent_id/>
- <oper_status>DISCOVERED</oper_status>
- <flow_groups>
- <items/>
- </flow_groups>
- <admin_state>UNKNOWN</admin_state>
- <serial_number>19addcd7305d4d4fa90300cb8e4ab9a6</serial_number>
- <model>n/a</model>
- <root>True</root>
- <id>simulated_olt_1</id>
- <firmware_version>n/a</firmware_version>
- </item>
- <item>
- <vendor>simulated</vendor>
- <parent_port_no>1</parent_port_no>
- <software_version>1.0</software_version>
- <connect_status>UNKNOWN</connect_status>
- <root>False</root>
- <adapter>simulated_onu</adapter>
- <vlan>101</vlan>
- <hardware_version>n/a</hardware_version>
- <flows>
- <items/>
- </flows>
- <ports>
- <item>
- <peers/>
- <label>eth</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>ETHERNET_UNI</type>
- <port_no>2</port_no>
- <device_id>simulated_onu_1</device_id>
- </item>
- <item>
- <peers>
- <item>
- <port_no>1</port_no>
- <device_id>simulated_olt_1</device_id>
- </item>
- </peers>
- <label>pon</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>PON_ONU</type>
- <port_no>1</port_no>
- <device_id>simulated_onu_1</device_id>
- </item>
- </ports>
- <parent_id>simulated_olt_1</parent_id>
- <oper_status>DISCOVERED</oper_status>
- <flow_groups>
- <items/>
- </flow_groups>
- <admin_state>UNKNOWN</admin_state>
- <serial_number>8ce6514e1b324d349038d9a80af04772</serial_number>
- <model>n/a</model>
- <type>simulated_onu</type>
- <id>simulated_onu_1</id>
- <firmware_version>n/a</firmware_version>
- </item>
- <item>
- <vendor>simulated</vendor>
- <parent_port_no>1</parent_port_no>
- <software_version>1.0</software_version>
- <connect_status>UNKNOWN</connect_status>
- <root>False</root>
- <adapter>simulated_onu</adapter>
- <vlan>102</vlan>
- <hardware_version>n/a</hardware_version>
- <flows>
- <items/>
- </flows>
- <ports>
- <item>
- <peers/>
- <label>eth</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>ETHERNET_UNI</type>
- <port_no>2</port_no>
- <device_id>simulated_onu_2</device_id>
- </item>
- <item>
- <peers>
- <item>
- <port_no>1</port_no>
- <device_id>simulated_olt_1</device_id>
- </item>
- </peers>
- <label>pon</label>
- <oper_status>UNKNOWN</oper_status>
- <admin_state>UNKNOWN</admin_state>
- <type>PON_ONU</type>
- <port_no>1</port_no>
- <device_id>simulated_onu_2</device_id>
- </item>
- </ports>
- <parent_id>simulated_olt_1</parent_id>
- <oper_status>DISCOVERED</oper_status>
- <flow_groups>
- <items/>
- </flow_groups>
- <admin_state>UNKNOWN</admin_state>
- <serial_number>0dfbb5af422044639c0660b518c06519</serial_number>
- <model>n/a</model>
- <type>simulated_onu</type>
- <id>simulated_onu_2</id>
- <firmware_version>n/a</firmware_version>
- </item>
- </devices>
- <instance_id>compose_voltha_1</instance_id>
- <version>0.9.0</version>
- <health>
- <state>HEALTHY</state>
- </health>
- <device_groups>
- <item>
- <logical_devices/>
- <id>1</id>
- <devices/>
- </item>
- </device_groups>
- <adapters>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Voltha project</vendor>
- <id>simulated_onu</id>
- <logical_device_ids/>
- </item>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Tibit Communications Inc.</vendor>
- <id>tibit_onu</id>
- <logical_device_ids/>
- </item>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Voltha project</vendor>
- <id>maple_olt</id>
- <logical_device_ids/>
- </item>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Tibit Communications Inc.</vendor>
- <id>tibit_olt</id>
- <logical_device_ids/>
- </item>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Voltha project</vendor>
- <id>broadcom_onu</id>
- <logical_device_ids/>
- </item>
- <item>
- <config>
- <log_level>INFO</log_level>
- </config>
- <version>0.1</version>
- <vendor>Voltha project</vendor>
- <id>simulated_olt</id>
- <logical_device_ids/>
- </item>
- </adapters>
- </instances>
- </Voltha>
- </data>
- """
- return etree.fromstring(xml_string)
\ No newline at end of file
+ def get_mock_volthainstance(self):
+ res = {'log_level': 'INFO',
+ 'device_types': [
+ {'adapter': u'broadcom_onu',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'broadcom_onu',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'maple_olt',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'maple_olt',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'ponsim_olt',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'ponsim_olt',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'ponsim_onu',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'ponsim_onu',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'simulated_olt',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'simulated_olt',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'simulated_onu',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'simulated_onu',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'tibit_olt',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'tibit_olt',
+ 'accepts_add_remove_flow_updates': False
+ },
+ {'adapter': u'tibit_onu',
+ 'accepts_bulk_flow_update': True,
+ 'id': u'tibit_onu',
+ 'accepts_add_remove_flow_updates': False}
+ ],
+ 'logical_devices': [],
+ 'devices': [],
+ 'instance_id': u'compose_voltha_1',
+ 'version': u'0.9.0',
+ 'health': {'state': 'HEALTHY'},
+ 'device_groups': [],
+ 'adapters': [
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Voltha project',
+ 'id': u'broadcom_onu',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Voltha project',
+ 'id': u'maple_olt',
+ 'logical_device_ids': []},
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.4',
+ 'vendor': u'Voltha project',
+ 'id': u'ponsim_olt',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.4',
+ 'vendor': u'Voltha project',
+ 'id': u'ponsim_onu',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Voltha project',
+ 'id': u'simulated_olt',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Voltha project',
+ 'id': u'simulated_onu',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Tibit Communications Inc.',
+ 'id': u'tibit_olt',
+ 'logical_device_ids': []
+ },
+ {'config': {'log_level': 'INFO'},
+ 'version': u'0.1',
+ 'vendor': u'Tibit Communications Inc.',
+ 'id': u'tibit_onu',
+ 'logical_device_ids': []
+ }
+ ]
+ }
+ devices_array = []
+ flow_items = []
+ for i in xrange(1, 10):
+ flow_items.append({
+ 'items': {
+ 'id': str(i),
+ 'table_id': 'table_id_' + str(i),
+ 'flags': i,
+ 'instructions' : [
+ {'type' : i, 'goto_table': 'table_id_' + str(i) },
+ {'type': i, 'meter': i},
+ {'type': i,
+ 'actions': {'actions': [
+ {'type': 11,
+ 'output': {
+ 'port': i,
+ 'max_len': i}
+ }
+ ]}
+ }
+ ]
+ }
+ }
+ )
+ for i in xrange(1, 10):
+ devices_array.append({
+ 'id': str(i),
+ 'type': 'type_' + str(i),
+ 'vlan': i,
+ 'flows': flow_items
+ })
+ res['devices'] = devices_array
+ xml = dicttoxml.dicttoxml(res, attr_type=True)
+ root = etree.fromstring(xml)
+ # print etree.tounicode(root, pretty_print=True)
+ request = {'class': 'VolthaInstance'}
+ top = RpcResponse().build_yang_response(root, request)
+ return top
\ No newline at end of file