add prefix-list to ios_bgp af-mode (#62705)

* adding prefix-list to ios_bgp

* adding prefix-list to ios_bgp

* Fix copy-paste bug in test

* Adding neigbor 10.10.20.20 to global neighbor pool

* Added prefix_list_in and _out to documentation

* Rewrite bgp prefix_list test

* Bugfix in yaml data

* More test, assert neighbor 10.10.20.20
pull/65675/head
Ola Nyström 5 years ago committed by Sumit Jaiswal
parent 88008badb1
commit 8165ce6144

@ -184,3 +184,13 @@ class AFNeighbors(CliProvider):
cmd = 'neighbor %s maximum-prefix %s' % (item['neighbor'], item['maximum_prefix'])
if not config or cmd not in config:
return cmd
def _render_prefix_list_in(self, item, config=None):
cmd = 'neighbor %s prefix-list %s in' % (item['neighbor'], item['prefix_list_in'])
if not config or cmd not in config:
return cmd
def _render_prefix_list_out(self, item, config=None):
cmd = 'neighbor %s prefix-list %s out' % (item['neighbor'], item['prefix_list_out'])
if not config or cmd not in config:
return cmd

@ -222,6 +222,12 @@ options:
- Maximum number of prefixes to accept from this peer.
- The range is from 1 to 2147483647.
type: int
prefix_list_in:
description:
- Name of ip prefix-list to apply to incoming prefixes.
prefix_list_out:
description:
- Name of ip prefix-list to apply to outgoing prefixes.
operation:
description:
- Specifies the operation to be performed on the BGP process configured on the device.
@ -388,7 +394,9 @@ def main():
'next_hop_self': dict(type='bool'),
'route_reflector_client': dict(type='bool'),
'route_server_client': dict(type='bool'),
'maximum_prefix': dict(type='int')
'maximum_prefix': dict(type='int'),
'prefix_list_in': dict(),
'prefix_list_out': dict()
}
address_family_spec = {

@ -142,6 +142,11 @@
remote_as: 64511
description: EBGP_NBR_1
local_as: 64497
- neighbor: 10.10.20.20
remote_as: 65012
description: BGP_NBR_2
ebgp_multihop: 100
register: result
- assert:
@ -150,6 +155,8 @@
- "'neighbor 203.0.113.10 remote-as 64511' in result.commands"
- "'neighbor 203.0.113.10 description EBGP_NBR_1' in result.commands"
- "'neighbor 203.0.113.10 local-as 64497' in result.commands"
- "'neighbor 10.10.20.20 remote-as 65012' in result.commands"
- "'neighbor 10.10.20.20 description BGP_NBR_2' in result.commands"
- "'no neighbor 192.0.2.10' in result.commands"
- name: Configure BGP neighbors with operation replace (idempotent)
@ -236,6 +243,11 @@
- neighbor: 192.0.2.15
activate: yes
route_reflector_client: True
- neighbor: 10.10.20.20
activate: yes
prefix_list_in: incoming-prefixes
prefix_list_out: outgoing-prefixes
register: result
- assert:
@ -248,6 +260,9 @@
- "'neighbor 203.0.113.10 advertisement-interval 120' in result.commands"
- "'neighbor 192.0.2.15 activate' in result.commands"
- "'neighbor 192.0.2.15 route-reflector-client' in result.commands"
- "'neighbor 10.10.20.20 activate' in result.commands"
- "'neighbor 10.10.20.20 prefix-list incoming-prefixes in' in result.commands"
- "'neighbor 10.10.20.20 prefix-list outgoing-prefixes out' in result.commands"
- name: Configure BGP neighbors under address family mode (idempotent)
ios_bgp: *af_nbr

Loading…
Cancel
Save