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

Add get_static_rp_config method and test #219

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions napalm_base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,26 @@ def get_firewall_policies(self):
"""
raise NotImplementedError

def get_static_rp_config(self):
"""
Returns a dictionary of VRFs and their configured static PIM RPs, where unset keywords
are type None.

Example:

{
u'default': [{
u'acl': None,
u'bsr_override': None,
u'hashmask': None,
u'mcast_subnet': '224.0.0.0/4',
u'priority': None,
u'rp_addr': '192.0.2.1'
}]
}
"""
raise NotImplementedError

def compliance_report(self, validation_file='validate.yml'):
"""
Return a compliance report.
Expand Down
22 changes: 22 additions & 0 deletions napalm_base/test/getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,3 +514,25 @@ def test_get_firewall_policies(self, test_case):
for policy_term in policy_details:
assert helpers.test_model(models.firewall_policies, policy_term)
return get_firewall_policies

@wrap_test_cases
def test_get_static_rp_config(self, test_case):
"""Test get_static_rp_config method."""
get_static_rp_config = self.device.get_static_rp_config()
assert isinstance(get_static_rp_config, dict)
if len(get_static_rp_config) > 0:
for vrf, rp_list in get_static_rp_config.items():
assert isinstance(vrf, text_type)
for rp in rp_list:
assert isinstance(rp['acl'], text_type) if rp['acl'] is not None else True
assert rp['bsr_override'] is True if rp['bsr_override'] is not None else True
assert isinstance(rp['hashmask'],
int) if rp['hashmask'] is not None else True
assert isinstance(rp['mcast_subnet'],
text_type) if rp['mcast_subnet'] is not None else True
assert isinstance(rp['priority'],
int) if rp['priority'] is not None else True
assert isinstance(rp['rp_addr'],
text_type) if rp['rp_addr'] is not None else True

return get_static_rp_config