diff --git a/.spauto-clab.yml.bak b/.spauto-clab.yml.bak new file mode 100644 index 0000000..2333273 --- /dev/null +++ b/.spauto-clab.yml.bak @@ -0,0 +1,139 @@ +# clab/clab@123 +# admin/admin +--- +name: "spauto" + +mgmt: + network: "spauto" + ipv4_subnet: "172.100.100.0/24" + ipv6_subnet: "2001:172:100:100::/80" + +topology: + defaults: + kinds: + ceos: + image: "h4ndzdatm0ld/ceosimage:4.28.0F" + vr-xrv: + image: "h4ndzdatm0ld/vr-xrv:6.1.3" + vr-csr: + image: "h4ndzdatm0ld/vr-csr:17.03.02" + + nodes: + # CE Nodes - AS65001 - West + vr-csr-ce-1: + kind: "vr-csr" + mgmt_ipv4: 172.100.100.15 + mgmt_ipv6: 2001:172:100:100::15 + vr-csr-ce-2: + kind: "vr-csr" + mgmt_ipv4: 172.100.100.20 + mgmt_ipv6: 2001:172:100:100::20 + ceos_sw_1: + kind: ceos + mgmt_ipv4: 172.100.100.180 + mgmt_ipv6: 2001:172:100:100::180 + xrv-h1: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.150 + mgmt_ipv6: 2001:172:100:100::150 + # CE Nodes - AS65001 - East + vr-csr-ce-3: + kind: "vr-csr" + mgmt_ipv4: 172.100.100.25 + mgmt_ipv6: 2001:172:100:100::25 + vr-csr-ce-4: + kind: "vr-csr" + mgmt_ipv4: 172.100.100.30 + mgmt_ipv6: 2001:172:100:100::30 + xrv-h2: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.155 + mgmt_ipv6: 2001:172:100:100::155 + # CORE / PE Nodes + xrv-pe1: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.11 + mgmt_ipv6: 2001:172:100:100::11 + xrv-pe2: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.22 + mgmt_ipv6: 2001:172:100:100::22 + xrv-pe3: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.33 + mgmt_ipv6: 2001:172:100:100::33 + xrv-pe4: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.44 + mgmt_ipv6: 2001:172:100:100::44 + xrv-p1: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.101 + mgmt_ipv6: 2001:172:100:100::101 + xrv-p2: + kind: vr-xrv + mgmt_ipv4: 172.100.100.102 + mgmt_ipv6: 2001:172:100:100::102 + xrv-rr-1: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.201 + mgmt_ipv6: 2001:172:100:100::201 + xrv-rr-2: + kind: "vr-xrv" + mgmt_ipv4: 172.100.100.202 + mgmt_ipv6: 2001:172:100:100::202 + + links: + # PE1 <> P1 + - endpoints: ["xrv-pe1:eth5", "xrv-p1:eth2"] + # PE1 <> PE2 + - endpoints: ["xrv-pe1:eth4", "xrv-pe2:eth3"] + # PE2 <> P2 + - endpoints: ["xrv-pe2:eth4", "xrv-p2:eth1"] + # PE3 <> P1 + - endpoints: ["xrv-pe3:eth2", "xrv-p1:eth7"] + # PE3 <> P4 + - endpoints: ["xrv-pe3:eth3", "xrv-pe4:eth2"] + # PE4 <> P2 + - endpoints: ["xrv-pe4:eth1", "xrv-p2:eth6"] + + # P1 TO P2 CORE LINKS + # P1 <> P2 + - endpoints: ["xrv-p1:eth5", "xrv-p2:eth4"] + - endpoints: ["xrv-p1:eth4", "xrv-p2:eth3"] + + # Route Reflectors R1 + # RR1 <> P1 + - endpoints: ["xrv-rr-1:eth2", "xrv-p1:eth3"] + # RR1 <> P2 + - endpoints: ["xrv-rr-1:eth4", "xrv-p2:eth2"] + # Route Reflectors R2 + # RR2 <> P1 + - endpoints: ["xrv-rr-2:eth1", "xrv-p1:eth6"] + # RR2 <> P2 + - endpoints: ["xrv-rr-2:eth3", "xrv-p2:eth5"] + + # CORE LINK BETWEEN RRs + # RR1 <> RR2 + - endpoints: ["xrv-rr-1:eth3", "xrv-rr-2:eth2"] + + # CE NODES - AS 65001 [CE1] + - endpoints: ["vr-csr-ce-1:eth1", "xrv-pe1:eth2"] + - endpoints: ["vr-csr-ce-1:eth2", "ceos_sw_1:eth1"] + # CE NODES - AS 65001 [CE2] + - endpoints: ["vr-csr-ce-2:eth1", "xrv-pe2:eth2"] + - endpoints: ["vr-csr-ce-2:eth2", "ceos_sw_1:eth2"] + # CE NODES - AS 65001 [CE3] + - endpoints: ["vr-csr-ce-3:eth1", "xrv-pe3:eth4"] + # H2 NODE TO CE3 + - endpoints: ["xrv-h2:eth1", "vr-csr-ce-3:eth2"] + # CE NODES - AS 65001 [CE4] + - endpoints: ["vr-csr-ce-4:eth2", "xrv-pe4:eth3"] + # H2 NODE TO CE4 + - endpoints: ["xrv-h2:eth2", "vr-csr-ce-4:eth1"] + # H1 NODE TO SW 1 + - endpoints: ["xrv-h1:eth1", "ceos_sw_1:eth3"] + - endpoints: ["xrv-h1:eth2", "ceos_sw_1:eth4"] + - endpoints: ["xrv-h1:eth3", "ceos_sw_1:eth5"] + - endpoints: ["xrv-h1:eth4", "ceos_sw_1:eth6"] + diff --git a/README.md b/README.md index df6fe92..ee29471 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ poetry shell Locate the Nornir playground ```bash -cd spauto/spauto_nornir +cd spauto/nornir ``` Deploy configs with Nornir diff --git a/spauto-clab.yml b/spauto-clab.yml index b65ecc9..be09cc4 100644 --- a/spauto-clab.yml +++ b/spauto-clab.yml @@ -123,7 +123,14 @@ topology: # CE NODES - AS 65001 [CE2] - endpoints: ["vr-csr-ce-2:eth1", "xrv-pe2:eth2"] - endpoints: ["vr-csr-ce-2:eth2", "ceos_sw_1:eth2"] - + # CE NODES - AS 65001 [CE3] + - endpoints: ["vr-csr-ce-3:eth1", "xrv-pe3:eth4"] + # H2 NODE TO CE3 + - endpoints: ["xrv-h2:eth1", "vr-csr-ce-3:eth2"] + # CE NODES - AS 65001 [CE4] + - endpoints: ["vr-csr-ce-4:eth2", "xrv-pe4:eth3"] + # H2 NODE TO CE4 + - endpoints: ["xrv-h2:eth2", "vr-csr-ce-4:eth1"] # H1 NODE TO SW 1 - endpoints: ["xrv-h1:eth1", "ceos_sw_1:eth3"] - endpoints: ["xrv-h1:eth2", "ceos_sw_1:eth4"] diff --git a/spauto/spauto_nornir/config.yml b/spauto/nornir/config.yml similarity index 90% rename from spauto/spauto_nornir/config.yml rename to spauto/nornir/config.yml index cf7f043..73e2d5d 100644 --- a/spauto/spauto_nornir/config.yml +++ b/spauto/nornir/config.yml @@ -12,5 +12,5 @@ inventory: defaults_file: "inventory/defaults.yml" logging: - log_file: logs/nornir.log + log_file: nornir.log level: DEBUG diff --git a/spauto/spauto_nornir/data_input/acl-example.yml b/spauto/nornir/data_input/acl-example.yml similarity index 100% rename from spauto/spauto_nornir/data_input/acl-example.yml rename to spauto/nornir/data_input/acl-example.yml diff --git a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE1.yml b/spauto/nornir/data_input/cisco_xe/AS65001_CE1.yml similarity index 88% rename from spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE1.yml rename to spauto/nornir/data_input/cisco_xe/AS65001_CE1.yml index 775d63b..7691a07 100644 --- a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE1.yml +++ b/spauto/nornir/data_input/cisco_xe/AS65001_CE1.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true ip_interfaces: - interface: GigabitEthernet3 description: TO_H1 @@ -12,11 +10,6 @@ ip_interfaces: description: TO_PE1 ip_address: 10.1.0.0 mask: 255.255.255.254 - # - interface: GigabitEthernet3 - # description: TO_PE2 - # ip_address: 10.1.0.4 - # mask: 255.255.255.254 - # sub_int: false - interface: Loopback0 description: SYSTEM_LO_IP ip_address: 192.168.10.1 diff --git a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE2.yml b/spauto/nornir/data_input/cisco_xe/AS65001_CE2.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE2.yml rename to spauto/nornir/data_input/cisco_xe/AS65001_CE2.yml index 7199d04..103e104 100644 --- a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE2.yml +++ b/spauto/nornir/data_input/cisco_xe/AS65001_CE2.yml @@ -1,7 +1,4 @@ --- -base: - lldp: true - ip_interfaces: - interface: GigabitEthernet3 admin_status: true diff --git a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE3.yml b/spauto/nornir/data_input/cisco_xe/AS65001_CE3.yml similarity index 79% rename from spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE3.yml rename to spauto/nornir/data_input/cisco_xe/AS65001_CE3.yml index 7d233e3..d46ce46 100644 --- a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE3.yml +++ b/spauto/nornir/data_input/cisco_xe/AS65001_CE3.yml @@ -1,13 +1,13 @@ --- -base: - lldp: true ip_interfaces: - - interface: GigabitEthernet1.1001 - description: TO_PE + - interface: GigabitEthernet2 + description: TO_PE3 ip_address: 10.2.0.3 mask: 255.255.255.0 - sub_int: true - vlan: 1001 + - interface: GigabitEthernet3 + description: TO_H2_0/0/0/0 + ip_address: 10.201.0.2 + mask: 255.255.255.0 - interface: Loopback0 description: SYSTEM_LO_IP ip_address: 192.168.10.3 @@ -19,7 +19,7 @@ bgp: neighbors: - remote_as: 65000 neighbor: 10.2.0.33 - update_source: GigabitEthernet1.1001 + update_source: GigabitEthernet2 afi: ipv4 unicast route_policy: - PL-EBGP-PE3-OUT out diff --git a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE4.yml b/spauto/nornir/data_input/cisco_xe/AS65001_CE4.yml similarity index 82% rename from spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE4.yml rename to spauto/nornir/data_input/cisco_xe/AS65001_CE4.yml index 998be1b..f0af1f3 100644 --- a/spauto/spauto_nornir/data_input/cisco_xe/AS65001_CE4.yml +++ b/spauto/nornir/data_input/cisco_xe/AS65001_CE4.yml @@ -1,14 +1,13 @@ --- -base: - lldp: true ip_interfaces: - - interface: GigabitEthernet1.1001 + - interface: GigabitEthernet2 + description: TO_H2 + ip_address: 10.202.0.2 + mask: 255.255.255.0 + - interface: GigabitEthernet3 description: TO_PE4 ip_address: 10.2.0.4 mask: 255.255.255.0 - sub_int: true - vlan: 1001 - vrf: VRF-A - interface: Loopback0 description: SYSTEM_LO_IP ip_address: 192.168.10.4 @@ -20,7 +19,7 @@ bgp: neighbors: - remote_as: 65000 neighbor: 10.2.0.44 - update_source: GigabitEthernet1.1001 + update_source: GigabitEthernet3 afi: ipv4 unicast route_policy: - PL-EBGP-PE4-OUT out diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_P1.yml b/spauto/nornir/data_input/cisco_xr/AS65000_P1.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_P1.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_P1.yml index 19cabfd..9467d29 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_P1.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_P1.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true ip_interfaces: - interface: GigabitEthernet0/0/0/1 description: "Parent INT to PE1" diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_P2.yml b/spauto/nornir/data_input/cisco_xr/AS65000_P2.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_P2.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_P2.yml index 2af21fb..f582d15 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_P2.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_P2.yml @@ -1,7 +1,4 @@ --- -base: - lldp: true - ip_interfaces: - interface: GigabitEthernet0/0/0/0 description: "Parent INT to PE2" diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE1.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE1.yml similarity index 89% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE1.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE1.yml index 4b45200..d8dfcdf 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE1.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE1.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true vrfs: - name: VRF-A family: address-family ipv4 unicast @@ -50,13 +48,11 @@ bgp: asn: 65000 router_id: 172.16.0.11 add_paths: true + add_pe_policy: true route_reflector: false route_reflectors: - 172.16.0.201 - 172.16.0.202 - add_pe_policy: true - add_65001_in_out: false - add_65001_in: true CE1_MED: 100 vrf_neighbors: - vrf: VRF-A @@ -66,9 +62,6 @@ bgp: - remote_as: 65001 neighbor: 10.1.0.0 update_source: GigabitEthernet0/0/0/1 - route_policy: - - PL-EBGP-65001-IN in - - PL-EBGP-CE1-OUT out static_routes: - dst: 0.0.0.0/0 next_hop: Null0 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE100.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE100.yml similarity index 97% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE100.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE100.yml index 0be5d9d..94887e6 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE100.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE100.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true vrfs: - name: VRF-A family: address-family ipv4 unicast diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE101.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE101.yml similarity index 97% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE101.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE101.yml index cc67b68..133b52f 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE101.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE101.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true ip_interfaces: - interface: GigabitEthernet0/0/0/0 description: TO_CORE_PE4 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE2.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE2.yml similarity index 92% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE2.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE2.yml index 86d4ed1..1136eb6 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE2.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE2.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true vrfs: - name: VRF-A family: address-family ipv4 unicast @@ -73,14 +71,12 @@ bgp: asn: 65000 router_id: 172.16.0.22 add_paths: true + add_pe_policy: true route_reflector: false route_reflectors: - 172.16.0.201 - 172.16.0.202 cluster_id: - add_pe_policy: true - add_65001_in_out: false - add_65001_in: true CE2_MED: 100 vrf_neighbors: - vrf: VRF-A @@ -90,9 +86,6 @@ bgp: - remote_as: 65001 neighbor: 10.1.0.2 update_source: GigabitEthernet0/0/0/1 - route_policy: - - PL-EBGP-65001-IN in - - PL-EBGP-CE2-OUT out static_routes: - dst: 0.0.0.0/0 next_hop: Null0 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE3.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE3.yml similarity index 80% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE3.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE3.yml index 54e8530..c94f9d6 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE3.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE3.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true vrfs: - name: VRF-A family: address-family ipv4 unicast @@ -29,15 +27,10 @@ ip_interfaces: admin_status: true - interface: GigabitEthernet0/0/0/3 - description: "Parent INT to CPE-3" - admin_status: true - - interface: GigabitEthernet0/0/0/3.1001 vrf: VRF-A description: TO_CPE_3 ip_address: 10.2.0.33 mask: "/24" - sub_int: true - vlan: 1001 - interface: Loopback0 description: SYSTEM_LO_IP @@ -58,24 +51,20 @@ bgp: asn: 65000 router_id: 172.16.0.33 add_paths: true + add_pe_policy: true route_reflector: false route_reflectors: - 172.16.0.201 - 172.16.0.202 - add_pe_policy: true - add_65001_in_out: true vrf_neighbors: - vrf: VRF-A router_id: 100.1.1.3 RD: 1003 neighbors: - remote_as: 65001 - update_source: GigabitEthernet0/0/0/3.1001 + update_source: GigabitEthernet0/0/0/3 neighbor: 10.2.0.3 as_override: true - route_policy: - - PL-EBGP-65001-IN in - - PL-EBGP-65001-OUT out static_routes: - dst: 0.0.0.0/0 next_hop: Null0 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE4.yml b/spauto/nornir/data_input/cisco_xr/AS65000_PE4.yml similarity index 93% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE4.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_PE4.yml index 30d55c5..68fcc1e 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_PE4.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_PE4.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true ip_interfaces: - interface: GigabitEthernet0/0/0/0 description: TO_CORE_P2 @@ -83,7 +81,6 @@ bgp: - 172.16.0.201 - 172.16.0.202 add_pe_policy: true - add_65001_in_out: true vrf_neighbors: - vrf: VRF-A router_id: 100.1.1.4 @@ -93,6 +90,3 @@ bgp: update_source: GigabitEthernet0/0/0/2.1001 neighbor: 10.2.0.4 as_override: true - route_policy: - - PL-EBGP-65001-IN in - - PL-EBGP-65001-OUT out diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR1.yml b/spauto/nornir/data_input/cisco_xr/AS65000_RR1.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR1.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_RR1.yml index d5f317d..9144d6c 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR1.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_RR1.yml @@ -1,7 +1,4 @@ --- -base: - lldp: true - ip_interfaces: - interface: GigabitEthernet0/0/0/1 description: TO_CORE_P1 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR2.yml b/spauto/nornir/data_input/cisco_xr/AS65000_RR2.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR2.yml rename to spauto/nornir/data_input/cisco_xr/AS65000_RR2.yml index c215f0f..2cffa0d 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65000_RR2.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65000_RR2.yml @@ -1,7 +1,4 @@ --- -base: - lldp: true - ip_interfaces: - interface: GigabitEthernet0/0/0/0 description: TO_CORE_P1 diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65001_H1.yml b/spauto/nornir/data_input/cisco_xr/AS65001_H1.yml similarity index 98% rename from spauto/spauto_nornir/data_input/cisco_xr/AS65001_H1.yml rename to spauto/nornir/data_input/cisco_xr/AS65001_H1.yml index 4113766..1c5bcf5 100644 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65001_H1.yml +++ b/spauto/nornir/data_input/cisco_xr/AS65001_H1.yml @@ -1,6 +1,4 @@ --- -base: - lldp: true ip_interfaces: - interface: GigabitEthernet0/0/0/1 admin_status: true diff --git a/spauto/nornir/data_input/cisco_xr/AS65001_H2.yml b/spauto/nornir/data_input/cisco_xr/AS65001_H2.yml new file mode 100644 index 0000000..f2afd49 --- /dev/null +++ b/spauto/nornir/data_input/cisco_xr/AS65001_H2.yml @@ -0,0 +1,18 @@ +--- +ip_interfaces: + - interface: GigabitEthernet0/0/0/0 + admin_status: true + description: TO ISP 1 - CE3 + ip_address: 10.201.0.1 + mask: "/24" + sub_int: false + - interface: GigabitEthernet0/0/0/1 + admin_status: true + description: TO ISP 1 - CE4 + ip_address: 10.202.0.1 + mask: "/24" + sub_int: false +static_routes: + - vrf: H1 + dst: 0.0.0.0/0 + next_hop: 10.1.12.100 diff --git a/spauto/spauto_nornir/data_input/eos/AS65001_SW_01.yml b/spauto/nornir/data_input/eos/AS65001_SW_01.yml similarity index 100% rename from spauto/spauto_nornir/data_input/eos/AS65001_SW_01.yml rename to spauto/nornir/data_input/eos/AS65001_SW_01.yml diff --git a/spauto/spauto_nornir/inventory/defaults.yml b/spauto/nornir/inventory/defaults.yml similarity index 100% rename from spauto/spauto_nornir/inventory/defaults.yml rename to spauto/nornir/inventory/defaults.yml diff --git a/spauto/spauto_nornir/inventory/groups.yml b/spauto/nornir/inventory/groups.yml similarity index 100% rename from spauto/spauto_nornir/inventory/groups.yml rename to spauto/nornir/inventory/groups.yml diff --git a/spauto/spauto_nornir/inventory/hosts.yml b/spauto/nornir/inventory/hosts.yml similarity index 99% rename from spauto/spauto_nornir/inventory/hosts.yml rename to spauto/nornir/inventory/hosts.yml index aaa279d..6685638 100644 --- a/spauto/spauto_nornir/inventory/hosts.yml +++ b/spauto/nornir/inventory/hosts.yml @@ -90,7 +90,6 @@ AS65001_CE3: data: type: CE_ROUTER asn: 65001 - AS65001_CE4: hostname: 172.100.100.30 groups: diff --git a/spauto/spauto_nornir/nr_add_device_nso.py b/spauto/nornir/nr_add_device_nso.py similarity index 100% rename from spauto/spauto_nornir/nr_add_device_nso.py rename to spauto/nornir/nr_add_device_nso.py diff --git a/spauto/spauto_nornir/nr_deploy_configs.py b/spauto/nornir/nr_deploy_configs.py similarity index 96% rename from spauto/spauto_nornir/nr_deploy_configs.py rename to spauto/nornir/nr_deploy_configs.py index 1c79187..025322e 100644 --- a/spauto/spauto_nornir/nr_deploy_configs.py +++ b/spauto/nornir/nr_deploy_configs.py @@ -6,6 +6,7 @@ the correct Out of Band IP devices assigned to your lab topology. """ import itertools +import os from nornir import InitNornir from nornir_jinja2.plugins.tasks import template_file @@ -18,7 +19,9 @@ __author__ = "Hugo Tinoco" __email__ = "hugotinoco@icloud.com" -nr = InitNornir("config.yml") +DIR_PATH = os.path.dirname(os.path.realpath(__file__)) + +nr = InitNornir(f"{DIR_PATH}/config.yml") def load_all_data(task): @@ -129,9 +132,9 @@ def push_config(task): def main(): """Execute our Nornir runbook.""" - nr.run(task=load_all_data) + print_result(nr.run(task=load_all_data)) print_result(nr.run(task=generate_full_mesh_list)) - nr.run(task=render_main) + print_result(nr.run(task=render_main)) print_result(nr.run(task=push_config)) # nr.run(task=push_config) diff --git a/spauto/spauto_nornir/nr_get_napalm_configs.py b/spauto/nornir/nr_get_napalm_configs.py similarity index 100% rename from spauto/spauto_nornir/nr_get_napalm_configs.py rename to spauto/nornir/nr_get_napalm_configs.py diff --git a/spauto/spauto_nornir/nr_get_nso_device_facts.py b/spauto/nornir/nr_get_nso_device_facts.py similarity index 100% rename from spauto/spauto_nornir/nr_get_nso_device_facts.py rename to spauto/nornir/nr_get_nso_device_facts.py diff --git a/spauto/spauto_nornir/nr_remediate.py b/spauto/nornir/nr_remediate.py similarity index 100% rename from spauto/spauto_nornir/nr_remediate.py rename to spauto/nornir/nr_remediate.py diff --git a/spauto/nornir/templates/configs/cisco_xe/base.j2 b/spauto/nornir/templates/configs/cisco_xe/base.j2 new file mode 100644 index 0000000..88687b8 --- /dev/null +++ b/spauto/nornir/templates/configs/cisco_xe/base.j2 @@ -0,0 +1,4 @@ +lldp run +! +hostname {{host}} +! diff --git a/spauto/spauto_nornir/templates/configs/cisco_xe/bgp-route-policy.j2 b/spauto/nornir/templates/configs/cisco_xe/bgp-route-policy.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xe/bgp-route-policy.j2 rename to spauto/nornir/templates/configs/cisco_xe/bgp-route-policy.j2 diff --git a/spauto/nornir/templates/configs/cisco_xe/bgp.j2 b/spauto/nornir/templates/configs/cisco_xe/bgp.j2 new file mode 100644 index 0000000..beace3e --- /dev/null +++ b/spauto/nornir/templates/configs/cisco_xe/bgp.j2 @@ -0,0 +1,28 @@ +{% if host.data_input.get('bgp') %} +! +router bgp {{ host.data_input.bgp.get('asn') }} + bgp router-id {{ host.data_input.bgp.get('router_id') }} + bgp log-neighbor-changes +{% if host.data_input.bgp.get('neighbors') %} +{% for nx in host.data_input.bgp.get('neighbors') %} + neighbor {{ nx.get('neighbor') }} remote-as {{ nx.get('remote_as') }} + neighbor {{ nx.get('neighbor') }} update-source {{ nx.get('update_source') }} + ! +{% endfor %} +{% endif %} + address-family ipv4 +{% if host.data_input.bgp.get('neighbors') %} +{% for nx in host.data_input.bgp.get('neighbors') %} + redistribute connected + neighbor {{ nx.get('neighbor') }} activate +{% if nx.get('route_policy') %} +{%- for route_map in nx.get('route_policy') %} + neighbor {{ nx.get('neighbor') }} send-community both + neighbor {{ nx.get('neighbor') }} route-map {{ route_map }} +{% endfor %} + exit-address-family +{% endif %} +{% endfor %} +{% endif %} +! +{% endif %} diff --git a/spauto/spauto_nornir/templates/configs/cisco_xe/interfaces.j2 b/spauto/nornir/templates/configs/cisco_xe/interfaces.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xe/interfaces.j2 rename to spauto/nornir/templates/configs/cisco_xe/interfaces.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xe/main.j2 b/spauto/nornir/templates/configs/cisco_xe/main.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xe/main.j2 rename to spauto/nornir/templates/configs/cisco_xe/main.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/acl.j2 b/spauto/nornir/templates/configs/cisco_xr/acl.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/acl.j2 rename to spauto/nornir/templates/configs/cisco_xr/acl.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/base.j2 b/spauto/nornir/templates/configs/cisco_xr/base.j2 similarity index 51% rename from spauto/spauto_nornir/templates/configs/cisco_xr/base.j2 rename to spauto/nornir/templates/configs/cisco_xr/base.j2 index 6f6121a..ded4869 100644 --- a/spauto/spauto_nornir/templates/configs/cisco_xr/base.j2 +++ b/spauto/nornir/templates/configs/cisco_xr/base.j2 @@ -1,5 +1,4 @@ !! IOS XR Configuration 6.1.3 -{% if host.data_input.base.lldp %} +! hostname {{host}} ! -{% endif %} diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/bgp-route-policy.j2 b/spauto/nornir/templates/configs/cisco_xr/bgp-route-policy.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/bgp-route-policy.j2 rename to spauto/nornir/templates/configs/cisco_xr/bgp-route-policy.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/bgp.j2 b/spauto/nornir/templates/configs/cisco_xr/bgp.j2 similarity index 98% rename from spauto/spauto_nornir/templates/configs/cisco_xr/bgp.j2 rename to spauto/nornir/templates/configs/cisco_xr/bgp.j2 index bd39e5e..59fb100 100644 --- a/spauto/spauto_nornir/templates/configs/cisco_xr/bgp.j2 +++ b/spauto/nornir/templates/configs/cisco_xr/bgp.j2 @@ -75,9 +75,11 @@ neighbor {{ nx.get('neighbor') }} remote-as {{ nx.get('remote_as') }} update-source {{ nx.get('update_source') }} address-family ipv4 unicast +{% if nx.get('route_policy') %} {% for policy in nx.get('route_policy') %} route-policy {{ policy }} {% endfor %} +{% endif %} {% if nx.get('as_override') %} as-override ! diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/final.j2 b/spauto/nornir/templates/configs/cisco_xr/final.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/final.j2 rename to spauto/nornir/templates/configs/cisco_xr/final.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/interfaces.j2 b/spauto/nornir/templates/configs/cisco_xr/interfaces.j2 similarity index 91% rename from spauto/spauto_nornir/templates/configs/cisco_xr/interfaces.j2 rename to spauto/nornir/templates/configs/cisco_xr/interfaces.j2 index 7a565d7..3184a56 100644 --- a/spauto/spauto_nornir/templates/configs/cisco_xr/interfaces.j2 +++ b/spauto/nornir/templates/configs/cisco_xr/interfaces.j2 @@ -15,6 +15,9 @@ interface {{ interface.get('interface') }} {% if interface.get('description')%} description {{ interface.get('description') }} {% endif %} +{% if interface.get('vrf') %} + vrf {{ interface.get('vrf') }} +{% endif %} {% if interface.get('ip_address')%} ipv4 address {{ interface.get('ip_address') }}{{ interface.get('mask') }} {% endif %} diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/isis.j2 b/spauto/nornir/templates/configs/cisco_xr/isis.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/isis.j2 rename to spauto/nornir/templates/configs/cisco_xr/isis.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/main.j2 b/spauto/nornir/templates/configs/cisco_xr/main.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/main.j2 rename to spauto/nornir/templates/configs/cisco_xr/main.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/mpls.j2 b/spauto/nornir/templates/configs/cisco_xr/mpls.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/mpls.j2 rename to spauto/nornir/templates/configs/cisco_xr/mpls.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/mpls_lsp_groups.j2 b/spauto/nornir/templates/configs/cisco_xr/mpls_lsp_groups.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/mpls_lsp_groups.j2 rename to spauto/nornir/templates/configs/cisco_xr/mpls_lsp_groups.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/ospf.j2 b/spauto/nornir/templates/configs/cisco_xr/ospf.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/ospf.j2 rename to spauto/nornir/templates/configs/cisco_xr/ospf.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/static-routes.j2 b/spauto/nornir/templates/configs/cisco_xr/static-routes.j2 similarity index 100% rename from spauto/spauto_nornir/templates/configs/cisco_xr/static-routes.j2 rename to spauto/nornir/templates/configs/cisco_xr/static-routes.j2 diff --git a/spauto/spauto_nornir/templates/configs/cisco_xr/vrf.j2 b/spauto/nornir/templates/configs/cisco_xr/vrf.j2 similarity index 99% rename from spauto/spauto_nornir/templates/configs/cisco_xr/vrf.j2 rename to spauto/nornir/templates/configs/cisco_xr/vrf.j2 index b1241da..6c91c4d 100644 --- a/spauto/spauto_nornir/templates/configs/cisco_xr/vrf.j2 +++ b/spauto/nornir/templates/configs/cisco_xr/vrf.j2 @@ -1,3 +1,4 @@ + {% if host.data_input.get('vrfs') %} {% for vrf in host.data_input.get('vrfs') %} vrf {{ vrf.get('name') }} diff --git a/spauto/nornir/templates/configs/eos/main.j2 b/spauto/nornir/templates/configs/eos/main.j2 new file mode 100644 index 0000000..a81e803 --- /dev/null +++ b/spauto/nornir/templates/configs/eos/main.j2 @@ -0,0 +1,47 @@ +! Command: show running-config +! device: {{host|replace("_","-")}} (cEOSLab, EOS-4.28.0F-26924507.4280F (engineering build)) +! +no aaa root +! +username admin privilege 15 role network-admin secret sha512 $6$ZY93FpLnviItXJWD$ngdNjmx1eXavX8UyDvxqRVRdsppRiAajTpO.jBTCCaIXPjtch0w.soUZPWuSehyfMSuf/AGF0scJEa/SIsn9w/ +! +transceiver qsfp default-mode 4x10G +! +service routing protocols model multi-agent +! +hostname AS65001_SW_01 +! +spanning-tree mode mstp +! +management api http-commands + no shutdown +! +management api gnmi + transport grpc default +! +management api netconf + transport ssh default +! +interface Ethernet1 +! +interface Ethernet2 +! +interface Ethernet3 +! +interface Ethernet4 +! +interface Ethernet5 +! +interface Ethernet6 +! +interface Management0 + ip address 172.100.100.180/24 + ipv6 address 2001:172:100:100::180/80 +! +no ip routing +! +ip route 0.0.0.0/0 172.100.100.1 +! +ipv6 route ::/0 2001:172:100:100::1 +! +end \ No newline at end of file diff --git a/spauto/spauto_nornir/templates/nso/data.xml b/spauto/nornir/templates/nso/data.xml similarity index 100% rename from spauto/spauto_nornir/templates/nso/data.xml rename to spauto/nornir/templates/nso/data.xml diff --git a/spauto/spauto_nornir/templates/nso/device_update.j2 b/spauto/nornir/templates/nso/device_update.j2 similarity index 100% rename from spauto/spauto_nornir/templates/nso/device_update.j2 rename to spauto/nornir/templates/nso/device_update.j2 diff --git a/spauto/spauto_batfish/bf_mpls_sdn.py b/spauto/spauto_batfish/bf_mpls_sdn.py index ae2b8d6..611f6f3 100644 --- a/spauto/spauto_batfish/bf_mpls_sdn.py +++ b/spauto/spauto_batfish/bf_mpls_sdn.py @@ -15,7 +15,7 @@ # At the moment this doesn't work. NAPALM Getters is extracting these configurations, however # the top line of the config is being stipped out, which identifies the IOSXR version - this is how # Batfish determines this is an iosxr device. (One method at least) -# CONFIGS = "../../spauto/spauto_nornir/napalm_getters/mpls_sdn_era/" +# CONFIGS = "../../spauto/nornir/napalm_getters/mpls_sdn_era/" # Run 'pytest' from root dir to rebuild the latest configs before running interactive CONFIGS = "../../tests/network_data/mpls_sdn_era" diff --git a/spauto/spauto_nornir/data_input/cisco_xr/AS65001_H2.yml b/spauto/spauto_nornir/data_input/cisco_xr/AS65001_H2.yml deleted file mode 100644 index 4113766..0000000 --- a/spauto/spauto_nornir/data_input/cisco_xr/AS65001_H2.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -base: - lldp: true -ip_interfaces: - - interface: GigabitEthernet0/0/0/1 - admin_status: true - description: TO ISP 1 - VRRP Group 1 - ip_address: 10.1.12.10 - mask: "/24" - sub_int: false - vrrp: - - group: 1 - ip_address: 10.1.12.100 - priority: 100 - - interface: GigabitEthernet0/0/0/2 - admin_status: true - description: TO ISP 1 - VRRP Group 1 - ip_address: 10.1.12.20 - mask: "/24" - sub_int: false - vrrp: - - group: 1 - ip_address: 10.1.12.100 - priority: 100 - - interface: GigabitEthernet0/0/0/3 - admin_status: true - description: TO ISP 2 - VRRP Group 2 - ip_address: 10.1.20.10 - mask: "/24" - sub_int: false - vrrp: - - group: 1 - ip_address: 10.1.20.100 - priority: 100 - - interface: GigabitEthernet0/0/0/4 - admin_status: true - description: TO ISP 2 - VRRP Group 2 - ip_address: 10.1.20.20 - mask: "/24" - sub_int: false - vrrp: - - group: 1 - ip_address: 10.1.20.100 - priority: 100 -static_routes: - - vrf: H1 - dst: 0.0.0.0/0 - next_hop: 10.1.12.100 diff --git a/spauto/spauto_nornir/logs/.gitkeep b/spauto/spauto_nornir/logs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/spauto/spauto_nornir/templates/configs/cisco_ios/base.j2 b/spauto/spauto_nornir/templates/configs/cisco_ios/base.j2 deleted file mode 100644 index 87cbaa7..0000000 --- a/spauto/spauto_nornir/templates/configs/cisco_ios/base.j2 +++ /dev/null @@ -1,3 +0,0 @@ -lldp run -! -hostname {{host}} \ No newline at end of file diff --git a/spauto/spauto_nornir/templates/configs/cisco_ios/interfaces.j2 b/spauto/spauto_nornir/templates/configs/cisco_ios/interfaces.j2 deleted file mode 100644 index 76e5922..0000000 --- a/spauto/spauto_nornir/templates/configs/cisco_ios/interfaces.j2 +++ /dev/null @@ -1,9 +0,0 @@ - -! -{% for interface in host.data_input.interfaces %} -interface {{ interface['name'] }} -{% if interface['trunk'] %} - switchport trunk encapsulation dot1q - switchport mode trunk - {% endif %} -{% endfor %} \ No newline at end of file diff --git a/spauto/spauto_nornir/templates/configs/cisco_ios/main.j2 b/spauto/spauto_nornir/templates/configs/cisco_ios/main.j2 deleted file mode 100644 index d4c4677..0000000 --- a/spauto/spauto_nornir/templates/configs/cisco_ios/main.j2 +++ /dev/null @@ -1,2 +0,0 @@ -{% include "base.j2" %} -{% include "interfaces.j2" %} \ No newline at end of file diff --git a/spauto/spauto_nornir/templates/configs/cisco_xe/base.j2 b/spauto/spauto_nornir/templates/configs/cisco_xe/base.j2 deleted file mode 100644 index 4dd54a8..0000000 --- a/spauto/spauto_nornir/templates/configs/cisco_xe/base.j2 +++ /dev/null @@ -1,12 +0,0 @@ -{% if host.data_input.base.lldp %} -lldp run -! -hostname {{host}} -{% endif %} -! -interface gi1 -no shutdown -interface gi2 -no shutdown -interface gi3 -no shutdown diff --git a/spauto/spauto_nornir/templates/configs/cisco_xe/bgp.j2 b/spauto/spauto_nornir/templates/configs/cisco_xe/bgp.j2 deleted file mode 100644 index dfa1120..0000000 --- a/spauto/spauto_nornir/templates/configs/cisco_xe/bgp.j2 +++ /dev/null @@ -1,24 +0,0 @@ -{% if host.data_input.get('bgp') %} -! -router bgp {{ host.data_input.bgp.get('asn') }} -bgp log-neighbor-changes -bgp router-id {{ host.data_input.bgp.get('router_id') }} -address-family ipv4 unicast -! -{% if host.data_input.bgp.get('neighbors') %} -{% for nx in host.data_input.bgp.get('neighbors') %} -neighbor {{ nx.get('neighbor') }} remote-as {{ nx.get('remote_as') }} -neighbor {{ nx.get('neighbor') }} update-source {{ nx.get('update_source') }} - address-family {{ nx.get('afi') }} - redistribute connected -{% if nx.get('route_policy') %} -{% for route_map in nx.get('route_policy') %} - neighbor {{ nx.get('neighbor') }} send-community both - neighbor {{ nx.get('neighbor') }} route-map {{ route_map }} -{% endfor %} -{% endif %} -! -{% endfor %} -{% endif %} -! -{% endif %} diff --git a/tests/conftest.py b/tests/conftest.py index a642d85..13e146b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,15 @@ +from typing import List + import pytest from nornir import InitNornir from nornir_jinja2.plugins.tasks import template_file from nornir_utils.plugins.tasks.data import load_yaml from nornir_utils.plugins.tasks.files import write_file from pybatfish.client.commands import bf_init_snapshot -from pybatfish.question import load_questions, bfq from pybatfish.client.session import Session -from typing import List +from pybatfish.question import bfq, load_questions -NORNIR_PATH: str = "spauto/spauto_nornir" +NORNIR_PATH: str = "spauto/nornir" BATFISH_HOST: str = "localhost" SNAPSHOT_PATH: str = "tests/network_data/mpls_sdn_era" CONFIGS_DIR: str = f"{SNAPSHOT_PATH}/configs/" @@ -42,7 +43,7 @@ def devices(): return network_devices -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(scope="session") def batfish_session(): batfish = Session(host=BATFISH_HOST) batfish.set_network(NETWORK_NAME) @@ -51,6 +52,7 @@ def batfish_session(): return batfish +@pytest.mark.usefixtures("batfish_session") @pytest.fixture def bgp_config(): """Use the pybatfish SDK to extract Panda Data frame answer @@ -95,61 +97,6 @@ def load_data(task): task.host["data_input"] = data.result -# # def generate_full_mesh_list(task): -# # """Loop through inventory hosts which are MPLS enabled devices. - -# # Generate a list of Loopback IP far-end addresses and add to a task_host[dict] -# # to reference later as we deploy our full-mesh MPLS LSP Configuration. - -# # This task 100% depends on the success of "load_all_data" task. -# # """ -# # # Create a list of devices from our inventory which are MPLS enabled. -# # # List comprehension will be ran on each host to gather a list and access the -# # # host loopback IP, which will be used as the far-end IP for the MPLS LSP. -# # FULL_MESH_DEVICES = [ -# # host -# # for host in nornir.inventory.hosts.keys() -# # if "AS65000" in host and "RR" not in host and "P1" not in host -# # if "P2" not in host -# # ] -# # # Remove the current task host out of the list. We don't need our local device in this -# # # List as our goal is to gather data from the rest of the inventory from each device. -# # # We wrap in a try/block as we are popping items we KNOW are not in that list (CE devices) -# # # from our previous filtering. -# # try: -# # FULL_MESH_DEVICES.remove(f"{task.host}") -# # except ValueError: -# # pass - -# # # The only reason we are able to access some of these external data values is because -# # # we loaded the external data in a previous task and added to the task.host['data_input] dict. -# # # We use some more list comprehension to extract all the interfaces from each host. -# # all_hosts_interfaces = [ -# # nornir.inventory.hosts[device]["data_input"]["ip_interfaces"] -# # for device in FULL_MESH_DEVICES -# # ] - -# # # Combine lists of lists into one list. We compile ALL interfaces from ALL devices besides -# # # The current task host. We need this so we can now create one final list of all the actual -# # # IP Addresses from the Loopbacks. -# # interfaces = list(itertools.chain.from_iterable(all_hosts_interfaces)) - -# # # Finally! Create a list of all the far-end system IP addresses (Loopbacks) to use as our -# # # Far-END destination for configuring our full-mesh of MPLS LSPs from the current task.host. -# # loopbacks = [ -# # ip.get("ip_address") -# # for ip in interfaces -# # if ip.get("description") == "SYSTEM_LO_IP" -# # ] - -# # Check the task.host vars and ensure ifull_mesh key is True under the MPLS dict -# # Take the newly created list and add it to a task.host[dictionary] for us to access in a different task. -# if task.host.get("mpls_full_mesh"): -# # print(task.host['mpls_full_mesh']) -# task.host["loopbacks"] = loopbacks -# # print(task.host["loopbacks"]) - - def render_configs(task): """Render device configuration using our Jinja2 Templates. diff --git a/tests/integration/test_network_health.py b/tests/integration/test_network_health.py index b28b184..f63ad12 100644 --- a/tests/integration/test_network_health.py +++ b/tests/integration/test_network_health.py @@ -1,6 +1,7 @@ import os import pytest +from nornir_utils.plugins.functions import print_result from pybatfish.client.asserts import ( assert_no_duplicate_router_ids, assert_no_forwarding_loops, @@ -8,10 +9,11 @@ assert_no_undefined_references, assert_no_unestablished_bgp_sessions, ) -from pybatfish.client.commands import bf_upload_diagnostics + +# from pybatfish.client.commands import bf_upload_diagnostics from pybatfish.question import bfq -from tests.conftest import devices, load_data, render_configs, CONFIGS_DIR +from tests.conftest import CONFIGS_DIR, devices, load_data, render_configs # # ###################################################################### # # # Example Configuration Compliance Checks to use within Pipeline # @@ -45,6 +47,7 @@ def test_config_gen(nr, node): """Render J2 Templates/Configs.""" nr.run(task=load_data) result = nr.run(task=render_configs) + print_result(result) assert node in result.keys() @@ -57,17 +60,21 @@ def test_config_gen_output(nr, node): assert f"{node}.cfg" in files +@pytest.mark.usefixtures("batfish_session") def test_assert_no_incompatible_bgp_session(snapshot_name): """Built in assertion to ensure there are no incompatible BGP sessions. + This looks at the BGP Configuration between all nodes.""" assert_no_incompatible_bgp_sessions(snapshot=snapshot_name) +@pytest.mark.usefixtures("batfish_session") def test_assert_no_unestablished_bgp_session(snapshot_name): """Assert there are no unestablished bgp sessions in our network.""" assert_no_unestablished_bgp_sessions(snapshot=snapshot_name) +@pytest.mark.usefixtures("batfish_session") def test_parse_status(): """Validate all files in the current snapshot have been parsed successfully. If a file is parsed but partially unrecognized, @@ -75,12 +82,18 @@ def test_parse_status(): batfish recognize a full config correctly.""" result = bfq.fileParseStatus().answer().frame() for i, row in result.iterrows(): + if row.get("File_Name") == "configs/AS65001_SW_01.cfg": + # Skip over generic EOS switch for now. + continue if row.get("Status") == "PARTIALLY_UNRECOGNIZED": - bf_upload_diagnostics() + # bf_upload_diagnostics() + # Commenting to not blast developers w/ random uploads + pass else: assert row.get("Status") == "PASSED" +@pytest.mark.usefixtures("batfish_session") def test_unused_structures(): """This tests checks if configuration lines are not used such as ACLs or route-maps""" @@ -88,6 +101,7 @@ def test_unused_structures(): assert len(result) == 0 +@pytest.mark.usefixtures("batfish_session") @pytest.mark.parametrize("node", ["AS65000_RR1", "AS65000_RR2"]) def test_rr(node): """Testing to ensure configuration compliance against route reflectors.""" @@ -96,24 +110,29 @@ def test_rr(node): assert row.get("Route_Reflector") +@pytest.mark.usefixtures("batfish_session") def test_no_duplicate_routerids(): """Built in assertion, validate router-ids.""" assert assert_no_duplicate_router_ids() +@pytest.mark.usefixtures("batfish_session") def test_no_fw_loops(): """ "Built in assertion, no forwarding loops""" assert assert_no_forwarding_loops() +@pytest.mark.usefixtures("batfish_session") def test_no_undefined_ref(): """Validate no unused ref, such as route-maps are present, but unused.""" assert assert_no_undefined_references() +@pytest.mark.usefixtures("batfish_session") @pytest.mark.parametrize("node", ALL_NETWORK_DEVICES) def test_bgp_state_routers(node): """Testing to ensure BGP Sessions are in an Established state.""" + # result = bfq.bgpSessionStatus().answer().frame() bgp_sess_status = bfq.bgpSessionStatus(nodes=node).answer().frame() for i, row in bgp_sess_status.iterrows(): assert row.get("Established_Status") == "ESTABLISHED" @@ -134,4 +153,3 @@ def test_bgp_state_routers(node): # for i, row in vrrp.iterrows(): # print(row.get("Vrrp")) # print(row.get(len("VRRP_Groups"))) -# breakpoint() diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_P1.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_P1.cfg index c01ecb2..dc25ae6 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_P1.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_P1.cfg @@ -1,42 +1,43 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_P1 ! ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description Parent INT to PE1 no shutdown ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_PE1 ipv4 address 10.0.100.3/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description Parent INT to PE2 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_CORE_RR1 ipv4 address 10.0.100.16/31 no shutdown ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 description TO_CORE_P2_1 ipv4 address 10.0.100.6/31 no shutdown ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 description TO_CORE_P2_2 ipv4 address 10.1.0.24/31 no shutdown ! -interface Gi0/0/0/5 +interface GigabitEthernet0/0/0/5 description TO_CORE_RR2 ipv4 address 10.0.100.20/31 no shutdown ! -interface Gi0/0/0/6 +interface GigabitEthernet0/0/0/6 description TO_CORE_PE3 ipv4 address 10.0.100.8/31 no shutdown @@ -58,34 +59,34 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/5 +interface GigabitEthernet0/0/0/5 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/6 +interface GigabitEthernet0/0/0/6 point-to-point address-family ipv4 unicast metric 100 level 2 @@ -107,13 +108,13 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/1 + interface GigabitEthernet0/0/0/1 ! - interface Gi0/0/0/3 + interface GigabitEthernet0/0/0/3 ! - interface Gi0/0/0/4 + interface GigabitEthernet0/0/0/4 ! - interface Gi0/0/0/6 + interface GigabitEthernet0/0/0/6 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_P2.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_P2.cfg index a540c47..5817790 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_P2.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_P2.cfg @@ -1,42 +1,43 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_P2 ! ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 description Parent INT to PE2 no shutdown ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 description TO_CORE_PE2 ipv4 address 10.0.100.5/31 no shutdown ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description Parent INT to RR1 no shutdown ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_RR1 ipv4 address 10.0.100.18/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_CORE_P2_1 ipv4 address 10.0.100.7/31 no shutdown ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 description TO_CORE_P1 ipv4 address 10.0.100.25/31 no shutdown ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 description TO_CORE_RR2 ipv4 address 10.0.100.22/31 no shutdown ! -interface Gi0/0/0/5 +interface GigabitEthernet0/0/0/5 description TO_CORE_PE4 ipv4 address 10.0.100.10/31 no shutdown @@ -58,35 +59,35 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/5 +interface GigabitEthernet0/0/0/5 point-to-point address-family ipv4 unicast ! @@ -107,15 +108,15 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/0 + interface GigabitEthernet0/0/0/0 ! - interface Gi0/0/0/1 + interface GigabitEthernet0/0/0/1 ! - interface Gi0/0/0/2 + interface GigabitEthernet0/0/0/2 ! - interface Gi0/0/0/3 + interface GigabitEthernet0/0/0/3 ! - interface Gi0/0/0/5 + interface GigabitEthernet0/0/0/5 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_PE1.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_PE1.cfg index f0cc659..f9984e4 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_PE1.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_PE1.cfg @@ -1,4 +1,5 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_PE1 ! vrf VRF-A @@ -7,17 +8,18 @@ vrf VRF-A export route-target 65000:1001 ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_AS65001_CE1 + vrf VRF-A ipv4 address 10.1.0.1/31 no shutdown ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 description TO_EDGE_PE2 ipv4 address 10.0.100.0/31 no shutdown ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 description TO_CORE_P1 ipv4 address 10.0.100.2/31 no shutdown @@ -31,10 +33,6 @@ set next-hop self end-policy ! ! -route-policy PL-EBGP-65001-IN - pass -end-policy -! router isis core is-type level-2-only net 49.0000.1720.1600.0011.00 @@ -46,13 +44,13 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/4 +interface GigabitEthernet0/0/0/4 point-to-point address-family ipv4 unicast metric 100 level 2 @@ -102,10 +100,8 @@ router bgp 65000 ! neighbor 10.1.0.0 remote-as 65001 - update-source Gi0/0/0/1 + update-source GigabitEthernet0/0/0/1 address-family ipv4 unicast - route-policy PL-EBGP-65001-IN in - route-policy PL-EBGP-CE1-OUT out router static address-family ipv4 unicast 0.0.0.0/0 Null0 @@ -115,9 +111,9 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/3 + interface GigabitEthernet0/0/0/3 ! - interface Gi0/0/0/4 + interface GigabitEthernet0/0/0/4 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_PE2.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_PE2.cfg index 258a8ff..37f548f 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_PE2.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_PE2.cfg @@ -1,4 +1,5 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_PE2 ! vrf VRF-A @@ -7,17 +8,18 @@ vrf VRF-A export route-target 65000:1001 ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_AS65001_CE2 + vrf VRF-A ipv4 address 10.1.0.3/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_EDGE_PE1 ipv4 address 10.0.100.1/31 no shutdown ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 description TO_CORE_P2 ipv4 address 10.0.100.4/31 no shutdown @@ -36,10 +38,6 @@ set next-hop self end-policy ! ! -route-policy PL-EBGP-65001-IN - pass -end-policy -! router isis core is-type level-2-only net 49.0000.1720.1600.0022.00 @@ -51,13 +49,13 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast metric 200 level 2 ! ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 point-to-point address-family ipv4 unicast ! @@ -106,10 +104,8 @@ router bgp 65000 ! neighbor 10.1.0.2 remote-as 65001 - update-source Gi0/0/0/1 + update-source GigabitEthernet0/0/0/1 address-family ipv4 unicast - route-policy PL-EBGP-65001-IN in - route-policy PL-EBGP-CE2-OUT out router static address-family ipv4 unicast 0.0.0.0/0 Null0 @@ -119,9 +115,9 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/2 + interface GigabitEthernet0/0/0/2 ! - interface Gi0/0/0/3 + interface GigabitEthernet0/0/0/3 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_PE3.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_PE3.cfg index f0838db..1903134 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_PE3.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_PE3.cfg @@ -1,4 +1,5 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_PE3 ! vrf VRF-A @@ -7,26 +8,20 @@ vrf VRF-A export route-target 65000:1001 ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_P1 ipv4 address 10.0.100.9/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_CORE_PE4 ipv4 address 10.0.100.12/31 no shutdown ! -interface Gi0/0/0/3 - description Parent INT to CPE-3 - no shutdown -! -interface Gi0/0/0/3.1001 - vrf VRF-A +interface GigabitEthernet0/0/0/3 description TO_CPE_3 + vrf VRF-A ipv4 address 10.2.0.33/24 - encapsulation dot1q 1001 - no shutdown ! interface Loopback0 description SYSTEM_LO_IP @@ -36,14 +31,6 @@ route-policy PL-iBGP-RR-OUT set next-hop self end-policy ! -route-policy PL-EBGP-65001-IN - pass -end-policy -! -route-policy PL-EBGP-65001-OUT - pass -end-policy -! ! router isis core distribute bgp-ls @@ -57,12 +44,12 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast ! @@ -111,10 +98,8 @@ router bgp 65000 ! neighbor 10.2.0.3 remote-as 65001 - update-source Gi0/0/0/3.1001 + update-source GigabitEthernet0/0/0/3 address-family ipv4 unicast - route-policy PL-EBGP-65001-IN in - route-policy PL-EBGP-65001-OUT out as-override ! ! @@ -129,9 +114,9 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/1 + interface GigabitEthernet0/0/0/1 ! - interface Gi0/0/0/2 + interface GigabitEthernet0/0/0/2 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_PE4.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_PE4.cfg index 7c44f4f..df57edf 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_PE4.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_PE4.cfg @@ -1,23 +1,24 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_PE4 ! ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 description TO_CORE_P2 ipv4 address 10.0.100.11/31 no shutdown ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_PE3 ipv4 address 10.0.100.13/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description Parent INT to CPE2 no shutdown ! -interface Gi0/0/0/2.1001 +interface GigabitEthernet0/0/0/2.1001 vrf VRF-A description TO_CPE_4 ipv4 address 10.2.0.44/24 @@ -36,14 +37,6 @@ route-policy PL-iBGP-RR-OUT set next-hop self end-policy ! -route-policy PL-EBGP-65001-IN - pass -end-policy -! -route-policy PL-EBGP-65001-OUT - pass -end-policy -! ! router isis core is-type level-2-only @@ -56,13 +49,13 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 point-to-point address-family ipv4 unicast metric 100 level 2 ! ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast metric 100 level 2 @@ -112,10 +105,8 @@ router bgp 65000 ! neighbor 10.2.0.4 remote-as 65001 - update-source Gi0/0/0/2.1001 + update-source GigabitEthernet0/0/0/2.1001 address-family ipv4 unicast - route-policy PL-EBGP-65001-IN in - route-policy PL-EBGP-65001-OUT out as-override ! ! @@ -126,9 +117,9 @@ mpls oam ! mpls traffic-eng ! - interface Gi0/0/0/0 + interface GigabitEthernet0/0/0/0 ! - interface Gi0/0/0/1 + interface GigabitEthernet0/0/0/1 ! mpls ldp ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_RR1.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_RR1.cfg index 338237b..d33e479 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_RR1.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_RR1.cfg @@ -1,19 +1,20 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_RR1 ! ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_P1 ipv4 address 10.0.100.17/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_CORE_RR2 ipv4 address 10.0.100.14/31 no shutdown ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 description TO_CORE_P2 ipv4 address 10.0.100.19/31 no shutdown @@ -34,17 +35,17 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/3 +interface GigabitEthernet0/0/0/3 point-to-point address-family ipv4 unicast ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65000_RR2.cfg b/tests/network_data/mpls_sdn_era/configs/AS65000_RR2.cfg index 7ef03aa..cb897ea 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65000_RR2.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65000_RR2.cfg @@ -1,19 +1,20 @@ !! IOS XR Configuration 6.1.3 +! hostname AS65000_RR2 ! ipv4 unnumbered mpls traffic-eng Loopback0 ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 description TO_CORE_P1 ipv4 address 10.0.100.21/31 no shutdown ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 description TO_CORE_P2 ipv4 address 10.0.100.15/31 no shutdown ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 description TO_CORE_RR2 ipv4 address 10.0.100.23/31 no shutdown @@ -34,17 +35,17 @@ router isis core maximum-paths 8 segment-routing mpls ! -interface Gi0/0/0/0 +interface GigabitEthernet0/0/0/0 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/1 +interface GigabitEthernet0/0/0/1 point-to-point address-family ipv4 unicast ! ! -interface Gi0/0/0/2 +interface GigabitEthernet0/0/0/2 point-to-point address-family ipv4 unicast ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65001_CE1.cfg b/tests/network_data/mpls_sdn_era/configs/AS65001_CE1.cfg index f0d37da..a310fb4 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65001_CE1.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65001_CE1.cfg @@ -1,13 +1,7 @@ lldp run ! hostname AS65001_CE1 -! -interface gi1 -no shutdown -interface gi2 -no shutdown -interface gi3 -no shutdown! +!! interface GigabitEthernet3 description TO_H1 ip address 10.1.12.1 255.255.255.0 @@ -32,15 +26,15 @@ route-map PL-EBGP-PE1-OUT permit 1 match ip address prefix-list PL-EBGP-PE-OUT-PREFIX-LIST ! router bgp 65001 -bgp log-neighbor-changes -bgp router-id 192.168.10.1 -address-family ipv4 unicast -! -neighbor 10.1.0.1 remote-as 65000 -neighbor 10.1.0.1 update-source GigabitEthernet2 - address-family ipv4 unicast - redistribute connected - neighbor 10.1.0.1 send-community both - neighbor 10.1.0.1 route-map PL-EBGP-PE1-OUT out -! + bgp router-id 192.168.10.1 + bgp log-neighbor-changes + neighbor 10.1.0.1 remote-as 65000 + neighbor 10.1.0.1 update-source GigabitEthernet2 + ! + address-family ipv4 + redistribute connected + neighbor 10.1.0.1 activate + neighbor 10.1.0.1 send-community both + neighbor 10.1.0.1 route-map PL-EBGP-PE1-OUT out + exit-address-family ! diff --git a/tests/network_data/mpls_sdn_era/configs/AS65001_CE2.cfg b/tests/network_data/mpls_sdn_era/configs/AS65001_CE2.cfg index 61c6a2c..7174595 100644 --- a/tests/network_data/mpls_sdn_era/configs/AS65001_CE2.cfg +++ b/tests/network_data/mpls_sdn_era/configs/AS65001_CE2.cfg @@ -1,13 +1,7 @@ lldp run ! hostname AS65001_CE2 -! -interface gi1 -no shutdown -interface gi2 -no shutdown -interface gi3 -no shutdown! +!! interface GigabitEthernet3 description TO_H1 ip address 10.1.20.1 255.255.255.0 @@ -32,15 +26,15 @@ route-map PL-EBGP-PE2-OUT permit 1 match ip address prefix-list PL-EBGP-PE-OUT-PREFIX-LIST ! router bgp 65001 -bgp log-neighbor-changes -bgp router-id 192.168.10.2 -address-family ipv4 unicast -! -neighbor 10.1.0.3 remote-as 65000 -neighbor 10.1.0.3 update-source GigabitEthernet2 - address-family ipv4 unicast - redistribute connected - neighbor 10.1.0.3 send-community both - neighbor 10.1.0.3 route-map PL-EBGP-PE2-OUT out -! + bgp router-id 192.168.10.2 + bgp log-neighbor-changes + neighbor 10.1.0.3 remote-as 65000 + neighbor 10.1.0.3 update-source GigabitEthernet2 + ! + address-family ipv4 + redistribute connected + neighbor 10.1.0.3 activate + neighbor 10.1.0.3 send-community both + neighbor 10.1.0.3 route-map PL-EBGP-PE2-OUT out + exit-address-family ! diff --git a/tests/unit/test_nornir_data.py b/tests/unit/test_nornir_data.py index 6809278..78e8995 100644 --- a/tests/unit/test_nornir_data.py +++ b/tests/unit/test_nornir_data.py @@ -1,5 +1,6 @@ """Nornir data tests.""" import os + from tests.conftest import CONFIGS_DIR