Last active
September 27, 2018 12:50
-
-
Save networkop/f6a40814938fabcbac9ac2c25b5acfca to your computer and use it in GitHub Desktop.
Network-CI 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the list of all BGP sessions for leaf switches | |
bgp = bfq.bgpSessionStatus(nodes='leaf.*', includeEstablishedCount=True).answer().frame() | |
# All leaves should only peer with spines | |
non_spines = bgp[~bgp['Remote_Node'].str.contains('spine', na=False)] | |
# Assuming Leaf-2 and Leaf-3 peer with each other | |
print(non_spines) | |
Node Local_IP VRF Local_Interface Remote_Node Remote_Prefix Session_Type Configured_Status Established_Neighbors | |
0 leaf-2 1.1.1.2 default leaf-2:Loopback0 leaf-3 1.1.1.3/32 EBGP_MULTIHOP UNIQUE_MATCH 0 | |
5 leaf-3 1.1.1.3 default leaf-3:Loopback0 leaf-2 1.1.1.2/32 EBGP_MULTIHOP UNIQUE_MATCH 0 | |
# All leaves should have at least one peering with each spine | |
spines = set(bfq.nodeProperties(nodes='spine.*').answer().frame()['Node']) | |
violators = bgp.groupby('Node').filter(lambda x: set(x['Remote_Node']).difference(spines) != set([])) | |
# Assuming Ethernet3 on Spine-2 is shutdown | |
print(violators[~violators['Remote_Node'].str.contains('spine', na=False)]) | |
Node Local_IP VRF Local_Interface Remote_Node Remote_Prefix Session_Type Configured_Status Established_Neighbors | |
6 leaf-3 10.0.255.5 default leaf-3:Ethernet2 None 10.0.255.4/32 EBGP_SINGLEHOP UNKNOWN_REMOTE 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Variables *** | |
${HOST1} 192.168.10.10 | |
${HOST2} 192.168.20.20 | |
E2E connectivity | |
[Documentation] Check if Host-3 can reach other hosts | |
${host1}= Run Process docker exec -i lab_Host-3 sudo ping -c 3 ${HOST1} shell=yes | |
${host2}= Run Process docker exec -i lab_Host-3 sudo ping -c 3 ${HOST2} shell=yes | |
Should Be Equal As Integers ${host1.rc} 0 | |
Should Be Equal As Integers ${host2.rc} 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% include 'management.j2' %} | |
{% include 'infra.j2' %} | |
{% include 'routing.j2' %} | |
{% include 'access.j2' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for peer, link in ipam[inventory_hostname].items() %} | |
! | |
interface {{ link.my_intf }} | |
description {{ peer }}:{{ link.peer_intf }}:{{ link.peer_ip }} | |
no switchport | |
ip address {{ link.my_ip }} | |
exit | |
! | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Clos: | |
Spine-1: | |
Leaf-1: | |
- ipv4_subnet: 10.0.254.0/31 | |
prod: | |
local: Ethernet1 | |
remote: Ethernet1 | |
lab: | |
local: eth1 | |
remote: eth1 | |
Spine-2: | |
Leaf-1: | |
- ipv4_subnet: 10.0.255.0/31 | |
prod: | |
local: Ethernet1 | |
remote: Ethernet2 | |
lab: | |
local: eth1 | |
remote: eth2 | |
bgp: | |
asn: | |
Leaf-1: 65001 | |
routerid: | |
Leaf-1: 1.1.1.1/32 | |
servers: | |
Leaf-1: | |
interfaces: | |
lab: eth3 | |
prod: Ethernet10-11 | |
vlan: 10 | |
svi: 192.168.10.1/24 | |
management: | |
username: arista |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################### | |
# IP routing table added: # | |
########################### | |
[ | |
"1.1.1.1/32", | |
"1.1.1.200/32", | |
"1.1.1.100/32", | |
"192.168.20.0/24", | |
"10.0.254.0/31", | |
"1.1.1.2/32", | |
"10.0.254.2/31", | |
"192.168.30.0/24", | |
"192.168.10.0/24", | |
"10.0.255.0/31", | |
"1.1.1.3/32", | |
"10.0.255.2/31" | |
] | |
------------------------------------ | |
############################# | |
# IP routing table removed: # | |
############################# | |
[] | |
------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
! | |
ip routing | |
! | |
route-map RMAP-CONNECTED-BGP permit 1000 | |
match ip address prefix-list PL-ALL-LOOPBACKS | |
! | |
ip prefix-list PL-LOOPBACKS seq 10 permit 0.0.0.0/0 ge 32 | |
! | |
interface Loopback0 | |
description ROUTER-ID | |
ip address {{ bgp.routerid[inventory_hostname] }} | |
exit | |
! | |
router bgp {{ bgp.asn[inventory_hostname] }} | |
{% for peer, link in ipam[inventory_hostname].items() %} | |
{% set peer_ip = link.peer_ip | ipaddr('address') %} | |
{% if bgp.asn[peer] is defined %} | |
neighbor {{ peer_ip }} remote-as {{ bgp.asn[peer] }} | |
neighbor {{ peer_ip }} send-community | |
neighbor {{ peer_ip }} maximum-routes 12000 | |
{% endif %} | |
{% endfor %} | |
redistribute connected route-map RMAP-CONNECTED-BGP | |
exit | |
! | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ansible-playbook --diff --check | |
-e buildenv=$BUILDENV | |
-e outpath=$CI_PROJECT_DIR/outputs/diffs | |
-e confdir=$CONF_DIR | |
diff.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- system:/running-config | |
+++ session:/ansible_1537901087-session-config | |
@@ -47,6 +47,9 @@ | |
neighbor 10.0.254.3 remote-as 65002 | |
neighbor 10.0.254.3 send-community | |
neighbor 10.0.254.3 maximum-routes 12000 | |
+ neighbor 10.0.254.5 remote-as 65003 | |
+ neighbor 10.0.254.5 send-community | |
+ neighbor 10.0.254.5 maximum-routes 12000 | |
redistribute connected route-map RMAP-CONNECTED-BGP | |
! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment