-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create test_ciena.py * add ciena * remove unnecessary
- Loading branch information
Showing
7 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
# supported devices config, add new device (eg: 'device name':'device label'). | ||
supported_devices_cfg = {'junos':'Juniper', | ||
'csr':'Cisco CSR1000v', | ||
'nexus':'Cisco Nexus', | ||
'iosxr':'Cisco IOS XR', | ||
'iosxe':'Cisco IOS XE', | ||
'huawei':'Huawei', | ||
'huaweiyang':'Huawei', | ||
'alu':'Alcatel Lucent', | ||
'h3c':'H3C', | ||
'hpcomware':'HP Comware', | ||
'sros':'Nokia SR OS', | ||
'default':'Server or anything not in above'} | ||
supported_devices_cfg = { | ||
"alu": "Alcatel Lucent", | ||
"ciena": "Ciena", | ||
"csr": "Cisco CSR1000v", | ||
"h3c": "H3C", | ||
"hpcomware": "HP Comware", | ||
"huawei": "Huawei", | ||
"huaweiyang": "Huawei", | ||
"iosxe": "Cisco IOS XE", | ||
"iosxr": "Cisco IOS XR", | ||
"junos": "Juniper", | ||
"nexus": "Cisco Nexus", | ||
"sros": "Nokia SR OS", | ||
"default": "Server or anything not in above", | ||
} | ||
|
||
|
||
def get_supported_devices(): | ||
return tuple(supported_devices_cfg.keys()) | ||
|
||
|
||
def get_supported_device_labels(): | ||
return supported_devices_cfg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from .default import DefaultDeviceHandler | ||
from ncclient.xml_ import BASE_NS_1_0 | ||
|
||
|
||
class CienaDeviceHandler(DefaultDeviceHandler): | ||
""" | ||
Ciena handler for device specific information. | ||
""" | ||
|
||
def __init__(self, device_params): | ||
super(CienaDeviceHandler, self).__init__(device_params) | ||
|
||
def get_xml_base_namespace_dict(self): | ||
return {None: BASE_NS_1_0} | ||
|
||
def get_xml_extra_prefix_kwargs(self): | ||
d = {} | ||
d.update(self.get_xml_base_namespace_dict()) | ||
return {"nsmap": d} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import unittest | ||
from ncclient.devices.ciena import * | ||
from ncclient.xml_ import * | ||
|
||
|
||
class TestCienaDevice(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.obj = CienaDeviceHandler({'name': 'ciena'}) | ||
|
||
def test_get_xml_base_namespace_dict(self): | ||
expected = {None: BASE_NS_1_0} | ||
self.assertDictEqual(expected, self.obj.get_xml_base_namespace_dict()) | ||
|
||
def test_get_xml_extra_prefix_kwargs(self): | ||
expected = dict() | ||
expected["nsmap"] = self.obj.get_xml_base_namespace_dict() | ||
self.assertDictEqual(expected, self.obj.get_xml_extra_prefix_kwargs()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters