Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

Added a new method for ISIS adjacency #307

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
55 changes: 55 additions & 0 deletions napalm_base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1547,3 +1547,58 @@ def compliance_report(self, validation_file='validate.yml'):
report file. See https://napalm.readthedocs.io/en/latest/validate/index.html.
"""
return validate.compliance_report(self, validation_file=validation_file)

def get_isis_adjacencies(self):
"""
Returns a dictionary with ISIS instances.
The keys of the main dictionary represent the name of the ISIS instance.
Each ISIS instance consists of the ISIS adjacencies.

* system-id (string)

The adjacency dictionary contains the following ISIS attributes as keys:

* interface_name (string)
* circuit_type (string)
* network_type (string)
* neighbor_state (string)
* ietf_nsf_flag (int)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ietf_nsf_flag will change type to bool and not int


Example::

{
'instance1':{
'0168.0000.0001':{
'ietf_nsf_flag': True,
'circuit_type':'ISIS_LEVELS_2',
'interface_name':'GigabitEthernet0/0/0/1',
'network_type':'ISIS_MEDIA_CLASS_P2P',
'neighbor_state':'ISIS_ADJ_UP_STATE'
},
'0168.0000.0002':{
'ietf_nsf_flag': True,
'circuit_type':'ISIS_LEVELS_2',
'interface_name':'GigabitEthernet0/0/0/2',
'network_type':'ISIS_MEDIA_CLASS_P2P',
'neighbor_state':'ISIS_ADJ_UP_STATE'
}
},
'instance2':{
'0168.0000.0003':{
'ietf_nsf_flag': False,
'circuit_type':'ISIS_LEVELS_2',
'interface_name':'GigabitEthernet0/0/0/3',
'network_type':'ISIS_MEDIA_CLASS_P2P',
'neighbor_state':'ISIS_ADJ_UP_STATE'
},
'0168.0000.0004':{
'ietf_nsf_flag': False,
'circuit_type':'ISIS_LEVELS_2',
'interface_name':'GigabitEthernet0/0/0/4',
'network_type':'ISIS_MEDIA_CLASS_P2P',
'neighbor_state':'ISIS_ADJ_UP_STATE'
}
}
}
"""
raise NotImplementedError
17 changes: 17 additions & 0 deletions napalm_base/test/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,20 @@ def test_get_network_instances(self):
self._test_model(models.network_instance_interfaces, network_instance['interfaces'])

self.assertTrue(result)

def test_get_isis_adjacencies(self):
"""Test get_isis_adjacency."""
try:
get_isis_adjacencies = self.device.get_isis_adjacencies()
except NotImplementedError:
raise SkipTest()

result = isinstance(get_isis_adjacencies, dict)
for instance_name, instance in get_isis_adjacencies.items():
result = result and isinstance(instance_name, dict)
for neighbor, isis_adjacency_attributes in instance.items():
result = result and \
self._test_model(models.isis_adjacency_attributes,
isis_adjacency_attributes)

self.assertTrue(result)
8 changes: 8 additions & 0 deletions napalm_base/test/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,11 @@
'dst_zone': text_type,
'action': text_type
}

isis_adjacency_attributes = {
'interface_name': text_type,
'circuit_type': text_type,
'ietf_nsf_flag': bool,
'network_type': text_type,
'neighbor_state': text_type
}