nxos_bgp_neighbor: Fix regex &report warnings (#28888)

* Fix over-detection of log-neighbor-as

* Report nxos warnings

* Update nxos_bgp_neighbor unit tests to test remove-private-as
This commit is contained in:
Nathaniel Case 2017-09-01 15:17:42 -04:00 committed by GitHub
commit 8bfdbd0f73
3 changed files with 25 additions and 18 deletions

View file

@ -7,6 +7,8 @@ router bgp 65535
vrf test2
address-family ipv4 unicast
timers bgp 1 10
neighbor 3.3.3.4
remove-private-as all
neighbor 3.3.3.5
address-family ipv4 unicast
maximum-prefix 30 30

View file

@ -42,10 +42,17 @@ class TestNxosBgpNeighborModule(TestNxosModule):
self.mock_get_config.stop()
def load_fixtures(self, commands=None, device=''):
self.get_config.return_value = load_fixture('', 'nxos_bgp_config.cfg')
self.load_config.return_value = None
self.get_config.return_value = load_fixture('nxos_bgp', 'config.cfg')
self.load_config.return_value = []
def test_nxos_bgp_neighbor(self):
set_module_args(dict(asn=65535, neighbor='3.3.3.3', description='some words'))
result = self.execute_module(changed=True)
self.assertEqual(result['commands'], ['router bgp 65535', 'neighbor 3.3.3.3', 'description some words'])
self.execute_module(changed=True, commands=['router bgp 65535', 'neighbor 3.3.3.3', 'description some words'])
def test_nxos_bgp_neighbor_remove_private_as(self):
set_module_args(dict(asn=65535, neighbor='3.3.3.4', remove_private_as='all'))
self.execute_module(changed=False, commands=[])
def test_nxos_bgp_neighbor_remove_private_as_changed(self):
set_module_args(dict(asn=65535, neighbor='3.3.3.4', remove_private_as='replace-as'))
self.execute_module(changed=True, commands=['router bgp 65535', 'neighbor 3.3.3.4', 'remove-private-as replace-as'])