Module 1: Configure VXLAN MultiPod using NXAPI
-
Configure Multi-Hop MP-eBGP EVPN between the preconfigured POD-9 to extend your tenant VXLAN overlay between PODs/DCs by executing the Python script as shown below. The actual Python script is included in Appendix I.
The NXAPI CLI Python script simply configures an eBGP Peer Template, much like you configured an iBGP Peer Template in the previous lab. Then, instead of configuring different neighbors by hand, the Python script sends the commands to the switch to configure each neighbor and inherit the peer template.
Additionally, since this is eBGP EVPN, you would normally have to manually handle importing and exporting route-targets so that routes could be imported/exported to/from other BGP ASNs. However, on the Nexus series there is a command called rewrite-evpn-rt-asn that will perform the route-target rewrite for you when crossing AS boundaries. This is available only under the L2VPN EVPN address-family as expected and is the last feature configured by the NXAPI Python script.
Upon execution of the script, you will see the exact commands printed to the PyCharm console that you would have had to enter by hand.
Note: The output below is shown from Pod-1. You will not see your local Pod as a configured peer.
Make sure that the file “lab5-module1.py” is open. If not double-click the file in the left navigation pane under the Lab5 folder. The Python script will be executed from within the PyCharm IDE by Right-clicking and in the popup menu, clicking Run ‘lab5-module1’.
from vxlanmultipod import EBGPEVPN
switchuser = 'admin'
switchpassword = 'cisco.123'
pod_spines = ['10.1.0.2']
print '***** Configuring Multi-Hop eBGP EVPN Peering for VXLAN Multi-Pod *****'
print ''
for spine in pod_spines:
pod = spine[3]
local_as = '6500' + pod
url = 'http://' + spine + '/ins'
eBGPEVPN = EBGPEVPN(url, switchuser, switchpassword, local_as)
eBGPEVPN.multihop_ebgp_evpn()
***** Configuring Multi-Hop eBGP EVPN Peering for VXLAN Multi-Pod *****
conf
route-map permit-all permit
set ip next-hop unchanged
Route-map configured to prevent next-hop from changing.
Next-hop must always be tunnel endpoint address.
conf
router bgp 65000
template peer eBGP-EVPN
ebgp-multihop 5
update-source loopback0
address-family l2vpn evpn
send-community extended
route-map permit-all out
eBGP EVPN peer template configured!
conf
router bgp 65000
neighbor 9.9.9.1 remote-as 65009
inherit peer eBGP-EVPN
address-family l2vpn evpn
rewrite-evpn-rt-asn
neighbor 9.9.9.2 remote-as 65009
inherit peer eBGP-EVPN
address-family l2vpn evpn
rewrite-evpn-rt-asn
Multi-Hop eBGP Peering to POD-9 Configured!
Transit Spine eBGP EVPN neighbors configured!
Saving Spine Switch Configuration
Done!