Skip to content

Commit

Permalink
Refactor(eos_cli_config_gen): Improve schema for redistributes_routes…
Browse files Browse the repository at this point in the history
… under address_family_ipv4_multicast, address_family_ipv6 and vrfs for router_bgp (#4359)
  • Loading branch information
MaheshGSLAB authored Oct 2, 2024
1 parent e287ff1 commit 7ac0708
Show file tree
Hide file tree
Showing 24 changed files with 2,448 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,17 @@ router bgp 65101
network 2001:db8:100::/40
network 2001:db8:200::/40 route-map RM-BAR-MATCH
bgp redistribute-internal
redistribute attached-host
redistribute bgp leaked route-map RM-REDISTRIBUTE-BGP
redistribute connected rcf Address_Family_IPV6_Connected()
redistribute dhcp
redistribute dynamic
redistribute isis
redistribute ospfv3
redistribute ospfv3 match external include leaked
redistribute ospfv3 match internal include leaked route-map RM-REDISTRIBUTE-OSPF-INTERNAL
redistribute ospfv3 match nssa-external 1
redistribute static route-map RM-IPV6-STATIC-TO-BGP
redistribute user
session tracker ST1
recovery delay 666 seconds
session tracker ST2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ ASN Notation: asplain

| VLAN Aware Bundle | Route-Distinguisher | Both Route-Target | Import Route Target | Export Route-Target | Redistribute | VLANs |
| ----------------- | ------------------- | ----------------- | ------------------- | ------------------- | ------------ | ----- |
| B-ELAN-201 | 192.168.255.3:20201 | 20201:20201 | - | - | learned<br>no host-routes | 201 |
| TENANT_A_PROJECT01 | 192.168.255.3:11 | 11:11<br>remote 2:11 | - | - | learned<br>igmp<br>no connected | 110 |
| B-ELAN-201 | 192.168.255.3:20201 | 20201:20201 | - | - | learned<br>no host-route | 201 |
| TENANT_A_PROJECT01 | 192.168.255.3:11 | 11:11<br>remote 2:11 | - | - | learned<br>igmp<br>no static | 110 |
| TENANT_A_PROJECT02 | 192.168.255.3:12 | 12:12 | remote 2:12 | remote 2:12 | learned | 112 |

#### Router BGP VLANs
Expand Down Expand Up @@ -248,7 +248,7 @@ router bgp 65101
rd 192.168.255.3:20201
route-target both 20201:20201
redistribute learned
no redistribute host-routes
no redistribute host-route
vlan 201
!
vlan-aware-bundle TENANT_A_PROJECT01
Expand All @@ -257,7 +257,7 @@ router bgp 65101
route-target import export evpn domain remote 2:11
redistribute igmp
redistribute learned
no redistribute connected
no redistribute static
vlan 110
!
vlan-aware-bundle TENANT_A_PROJECT02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,24 @@ router bgp 65101
neighbor TEST_PEER_GRP next-hop address-family ipv6 originate
neighbor TEST_PEER_GRP activate
!
address-family ipv4 multicast
redistribute attached-host route-map AFIPV4M_ATTACHED_HOST
redistribute connected route-map AFIPV4M_CONNECTED
redistribute isis level-1-2 include leaked route-map AFIPV4M_ISIS
redistribute ospf match internal route-map AFIPV4M_OSPF_INTERNAL
redistribute ospf match external route-map AFIPV4M_OSPF_EXTERNAL
redistribute ospf match nssa-external route-map AFIPV4M_OSPF_NSSA
redistribute ospfv3 route-map AFIPV4M_OSPFV3
redistribute static route-map AFIPV4M_STATIC
!
address-family ipv6
redistribute bgp leaked route-map RM-REDISTRIBUTE-BGP
redistribute connected rcf Address_Family_IPV6_Connected()
redistribute ospfv3 match internal include leaked route-map RM-REDISTRIBUTE-OSPF-INTERNAL
redistribute ospfv3 match external include leaked
redistribute ospfv3 match nssa-external 1
redistribute static route-map RM-IPV6-STATIC-TO-BGP
!
vrf TENANT_A_PROJECT01
rd 192.168.255.3:11
route-target import evpn 11:11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ASN Notation: asplain

| VRF | Route-Distinguisher | Redistribute |
| --- | ------------------- | ------------ |
| Tenant_A | 10.50.64.15:30001 | ospf<br>ospfv3<br>ospfv3<br>connected |
| Tenant_A | 10.50.64.15:30001 | ospf<br>ospfv3<br>connected |
| Tenant_B | 10.50.64.15:30002 | - |

#### Router BGP Device Configuration
Expand Down Expand Up @@ -240,10 +240,14 @@ router bgp 65100
neighbor IPV4-UNDERLAY activate
neighbor IPV4-UNDERLAY-MLAG activate
redistribute attached-host
redistribute connected
redistribute isis rcf Router_BGP_Isis()
redistribute ospf match external
redistribute ospf match internal
redistribute ospf match external
redistribute ospf match nssa-external 2
redistribute ospfv3 match internal
redistribute ospfv3 match external
redistribute ospfv3 match nssa-external 2
!
address-family ipv6
neighbor IPV6-UNDERLAY route-map RM-HIDE-AS-PATH in
Expand All @@ -252,6 +256,16 @@ router bgp 65100
neighbor IPV6-UNDERLAY-MLAG activate
neighbor TEST_RCF rcf in Address_Family_IPV6_In()
neighbor TEST_RCF rcf out Address_Family_IPV6_Out()
redistribute attached-host route-map RM-Address_Family_IPV6_Attached-Host
redistribute bgp leaked
redistribute connected route-map RM-Address_Family_IPV6_Connected
redistribute dhcp route-map RM-Address_Family_IPV6_DHCP
redistribute dynamic rcf RCF_Address_Family_IPV6_Dynamic()
redistribute isis include leaked route-map RM-Address_Family_IPV6_ISIS
redistribute ospfv3 include leaked route-map RM-REDISTRIBUTE-OSPFV3
redistribute ospfv3 match external include leaked route-map RM-REDISTRIBUTE-OSPFV3-EXTERNAL
redistribute static include leaked rcf RCF_IPV6_STATIC_TO_BGP{}
redistribute user rcf RCF_Address_Family_IPV6_User()
!
vrf Tenant_A
rd 10.50.64.15:30001
Expand All @@ -264,7 +278,7 @@ router bgp 65100
route-target export evpn rcf RT_EXPORT_AF_RCF()
redistribute connected
redistribute ospf match external include leaked
redistribute ospfv3 match internal
redistribute ospfv3
redistribute ospfv3 match nssa-external
!
vrf Tenant_B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ ASN Notation: asplain

| VRF | Route-Distinguisher | Redistribute |
| --- | ------------------- | ------------ |
| VRF01 | - | - |
| VRF02 | - | - |
| VRF01 | - | user<br>static<br>rip<br>ospf<br>ospfv3<br>isis<br>connected<br>bgp<br>attached_host |
| VRF02 | - | dynamic<br>user<br>static<br>rip<br>ospf<br>ospfv3<br>isis<br>connected<br>bgp<br>attached_host |
| VRF03 | - | dynamic |

#### Router BGP Device Configuration
Expand Down Expand Up @@ -87,6 +87,15 @@ router bgp 65001
!
vrf VRF01
no bgp redistribute-internal
redistribute attached-host route-map RM_VRF_ATTACHED-HOST
redistribute bgp leaked route-map RM_VRF_BGP
redistribute connected include leaked rcf RCF_VRF_CONNECTED()
redistribute isis level-2 rcf RCF_VRF_ISIS()
redistribute ospf match nssa-external route-map RM_VRF_OSPFV3
redistribute ospfv3 match internal include leaked route-map RM_VRF_OSPF
redistribute rip route-map RM_VRF_RIP
redistribute static route-map RM_VRF_STATIC
redistribute user rcf RCF_VRF_USER()
!
address-family flow-spec ipv4
bgp missing-policy direction in action permit
Expand Down Expand Up @@ -160,6 +169,16 @@ router bgp 65001
redistribute static route-map VRF_AFIPV6MULTI_RM_STATIC
!
vrf VRF02
redistribute attached-host
redistribute bgp leaked
redistribute connected
redistribute dynamic
redistribute isis level-2 route-map RM_VRF_ISIS
redistribute ospf include leaked
redistribute ospfv3 match external
redistribute rip
redistribute static
redistribute user
!
address-family ipv4
bgp additional-paths send backup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,17 @@ router bgp 65101
network 2001:db8:100::/40
network 2001:db8:200::/40 route-map RM-BAR-MATCH
bgp redistribute-internal
redistribute attached-host
redistribute bgp leaked route-map RM-REDISTRIBUTE-BGP
redistribute connected rcf Address_Family_IPV6_Connected()
redistribute dhcp
redistribute dynamic
redistribute isis
redistribute ospfv3
redistribute ospfv3 match external include leaked
redistribute ospfv3 match internal include leaked route-map RM-REDISTRIBUTE-OSPF-INTERNAL
redistribute ospfv3 match nssa-external 1
redistribute static route-map RM-IPV6-STATIC-TO-BGP
redistribute user
session tracker ST1
recovery delay 666 seconds
session tracker ST2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ router bgp 65101
rd 192.168.255.3:20201
route-target both 20201:20201
redistribute learned
no redistribute host-routes
no redistribute host-route
vlan 201
!
vlan-aware-bundle TENANT_A_PROJECT01
Expand All @@ -80,7 +80,7 @@ router bgp 65101
route-target import export evpn domain remote 2:11
redistribute igmp
redistribute learned
no redistribute connected
no redistribute static
vlan 110
!
vlan-aware-bundle TENANT_A_PROJECT02
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ router bgp 65101
neighbor TEST_PEER_GRP next-hop address-family ipv6 originate
neighbor TEST_PEER_GRP activate
!
address-family ipv4 multicast
redistribute attached-host route-map AFIPV4M_ATTACHED_HOST
redistribute connected route-map AFIPV4M_CONNECTED
redistribute isis level-1-2 include leaked route-map AFIPV4M_ISIS
redistribute ospf match internal route-map AFIPV4M_OSPF_INTERNAL
redistribute ospf match external route-map AFIPV4M_OSPF_EXTERNAL
redistribute ospf match nssa-external route-map AFIPV4M_OSPF_NSSA
redistribute ospfv3 route-map AFIPV4M_OSPFV3
redistribute static route-map AFIPV4M_STATIC
!
address-family ipv6
redistribute bgp leaked route-map RM-REDISTRIBUTE-BGP
redistribute connected rcf Address_Family_IPV6_Connected()
redistribute ospfv3 match internal include leaked route-map RM-REDISTRIBUTE-OSPF-INTERNAL
redistribute ospfv3 match external include leaked
redistribute ospfv3 match nssa-external 1
redistribute static route-map RM-IPV6-STATIC-TO-BGP
!
vrf TENANT_A_PROJECT01
rd 192.168.255.3:11
route-target import evpn 11:11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ router bgp 65100
neighbor IPV4-UNDERLAY activate
neighbor IPV4-UNDERLAY-MLAG activate
redistribute attached-host
redistribute connected
redistribute isis rcf Router_BGP_Isis()
redistribute ospf match external
redistribute ospf match internal
redistribute ospf match external
redistribute ospf match nssa-external 2
redistribute ospfv3 match internal
redistribute ospfv3 match external
redistribute ospfv3 match nssa-external 2
!
address-family ipv6
neighbor IPV6-UNDERLAY route-map RM-HIDE-AS-PATH in
Expand All @@ -108,6 +112,16 @@ router bgp 65100
neighbor IPV6-UNDERLAY-MLAG activate
neighbor TEST_RCF rcf in Address_Family_IPV6_In()
neighbor TEST_RCF rcf out Address_Family_IPV6_Out()
redistribute attached-host route-map RM-Address_Family_IPV6_Attached-Host
redistribute bgp leaked
redistribute connected route-map RM-Address_Family_IPV6_Connected
redistribute dhcp route-map RM-Address_Family_IPV6_DHCP
redistribute dynamic rcf RCF_Address_Family_IPV6_Dynamic()
redistribute isis include leaked route-map RM-Address_Family_IPV6_ISIS
redistribute ospfv3 include leaked route-map RM-REDISTRIBUTE-OSPFV3
redistribute ospfv3 match external include leaked route-map RM-REDISTRIBUTE-OSPFV3-EXTERNAL
redistribute static include leaked rcf RCF_IPV6_STATIC_TO_BGP{}
redistribute user rcf RCF_Address_Family_IPV6_User()
!
vrf Tenant_A
rd 10.50.64.15:30001
Expand All @@ -120,7 +134,7 @@ router bgp 65100
route-target export evpn rcf RT_EXPORT_AF_RCF()
redistribute connected
redistribute ospf match external include leaked
redistribute ospfv3 match internal
redistribute ospfv3
redistribute ospfv3 match nssa-external
!
vrf Tenant_B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ router bgp 65001
!
vrf VRF01
no bgp redistribute-internal
redistribute attached-host route-map RM_VRF_ATTACHED-HOST
redistribute bgp leaked route-map RM_VRF_BGP
redistribute connected include leaked rcf RCF_VRF_CONNECTED()
redistribute isis level-2 rcf RCF_VRF_ISIS()
redistribute ospf match nssa-external route-map RM_VRF_OSPFV3
redistribute ospfv3 match internal include leaked route-map RM_VRF_OSPF
redistribute rip route-map RM_VRF_RIP
redistribute static route-map RM_VRF_STATIC
redistribute user rcf RCF_VRF_USER()
!
address-family flow-spec ipv4
bgp missing-policy direction in action permit
Expand Down Expand Up @@ -105,6 +114,16 @@ router bgp 65001
redistribute static route-map VRF_AFIPV6MULTI_RM_STATIC
!
vrf VRF02
redistribute attached-host
redistribute bgp leaked
redistribute connected
redistribute dynamic
redistribute isis level-2 route-map RM_VRF_ISIS
redistribute ospf include leaked
redistribute ospfv3 match external
redistribute rip
redistribute static
redistribute user
!
address-family ipv4
bgp additional-paths send backup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,38 @@ router_bgp:
- ip_address: 2001:db8::2
rcf_in: Address_Family_IPV6_In()
rcf_out: Address_Family_IPV6_Out()
redistribute_routes:
- source_protocol: ospfv3
include_leaked: true
ospf_route_type: external
- source_protocol: ospfv3
ospf_route_type: internal
route_map: RM-REDISTRIBUTE-OSPF-INTERNAL
include_leaked: true
- source_protocol: ospfv3
ospf_route_type: nssa-external 1
- source_protocol: static
redistribute:
ospfv3:
enabled: true
match_external:
enabled: true
include_leaked: true
match_internal:
enabled: true
route_map: RM-REDISTRIBUTE-OSPF-INTERNAL
include_leaked: true
match_nssa_external:
enabled: true
nssa_type: 1
static:
enabled: true
route_map: RM-IPV6-STATIC-TO-BGP
- source_protocol: bgp
bgp:
enabled: true
route_map: RM-REDISTRIBUTE-BGP
# this should not do anything as leaked is generated when source protocol is bgp
include_leaked: true
- source_protocol: connected
connected:
enabled: true
rcf: Address_Family_IPV6_Connected()
attached_host:
enabled: true
dhcp:
enabled: true
dynamic:
enabled: true
user:
enabled: true
isis:
enabled: true
neighbors:
- ip_address: 192.0.3.1
remote_as: 65432
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ router_bgp:
rib_in_pre_policy_retain:
enabled: true
all: false
redistribute_routes:
- source_protocol: connected
- source_protocol: static
redistribute:
connected:
enabled: true
static:
enabled: true
rcf: Router_BGP_Static()
- source_protocol: isis
isis:
enabled: true
route_map: Router_BGP_Isis
- name: TENANT_A_PROJECT02
router_id: 192.168.255.3
Expand All @@ -124,5 +127,6 @@ router_bgp:
neighbors:
- ip_address: 10.255.251.1
peer_group: MLAG-IPv4-UNDERLAY-PEER
redistribute_routes:
- source_protocol: connected
redistribute:
connected:
enabled: true
Loading

0 comments on commit 7ac0708

Please sign in to comment.