Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ target/
.pypirc

.DS_Store

.idea/
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _build_root(self):
model = ''
os_version = ''
sys_obj_id = self.snmp_handler.get_property('SNMPv2-MIB', 'sysObjectID', 0)
model_search = re.search('^(?P<vendor>\w+)-\S+jnxProductName(?P<model>\S+)', sys_obj_id)
model_search = re.search('^(?P<vendor>\w+)-\S+jnxProduct(?:Name)?(?P<model>\S+)', sys_obj_id)
if model_search:
vendor = model_search.groupdict()['vendor'].capitalize()
model = model_search.groupdict()['model']
Expand Down
28 changes: 28 additions & 0 deletions tests/networking/juniper/autoload/test_juniper_snmp_autoload.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ def test_build_root(self):
call('SNMPv2-MIB', 'sysLocation', '0')]
self._snmp_handler.get_property.assert_has_calls(calls)

def test_build_root2(self):
vendor = 'Test_Vendor'
model = 'Tets_Model'
version = '12.1R6.5'
contact_name = Mock()
system_name = Mock()
location = Mock()
self._snmp_handler.get_property.side_effect = [
"{0}-testjnxProduct{1}".format(vendor, model),
"TEst JUNOS {} #/test".format(version),
contact_name,
system_name,
location
]

self._autoload_operations_instance._build_root()

self.assertIs(self._autoload_operations_instance.resource.contact_name, contact_name)
self.assertIs(self._autoload_operations_instance.resource.system_name, system_name)
self.assertIs(self._autoload_operations_instance.resource.location, location)
self.assertEqual(self._resource.os_version, version)
self.assertEqual(self._resource.vendor, vendor.capitalize())
self.assertEqual(self._resource.model, model)
calls = [call('SNMPv2-MIB', 'sysObjectID', 0), call('SNMPv2-MIB', 'sysDescr', '0'),
call('SNMPv2-MIB', 'sysContact', '0'), call('SNMPv2-MIB', 'sysName', '0'),
call('SNMPv2-MIB', 'sysLocation', '0')]
self._snmp_handler.get_property.assert_has_calls(calls)

def test_get_content_indexes(self):
index1 = 1
index2 = 2
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.10
4.0.11