Skip to content

Commit 32ad133

Browse files
Add files via upload
1 parent 0376384 commit 32ad133

File tree

7 files changed

+365
-0
lines changed

7 files changed

+365
-0
lines changed

Dev2/Cutover.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
def main():
2+
import getpass
3+
import csv
4+
from FW_GW_project_Master import Client
5+
host = "172.19.254.4"
6+
usr="admin"
7+
pwd = "!@#CiScO123"
8+
input_file = csv.DictReader(open("data.csv",encoding="utf-8-sig"))
9+
for data in input_file:
10+
host=(data["Fabric_Host_IP"])
11+
Datacenter = (data["Datacenter"])
12+
tn = (data["Tenant_Name"])
13+
bd=(data["EPG"])
14+
vrf = bd
15+
Subnet=(data["Subnet"])
16+
Scope =""
17+
print("")
18+
print("Logging into **{} ** ACI FABRIC Controller IP:{}".format(Datacenter,host))
19+
print("")
20+
print("Configure the Tenant on:{}".format(tn))
21+
print("Configure the L2->L3 BD/EPG Name:{}".format(bd))
22+
print("Configure the L3 Subnet on EPG Name:{}".format(Subnet))
23+
print("")
24+
ACTION = input("Are you sure you want to push the configuration (y/n): ")
25+
26+
if ACTION in ("y","yes","Y","YES"):
27+
#FABRIC=Client(cfg.host, cfg.usr, cfg.pwd)
28+
FABRIC=Client(host, usr, pwd)
29+
print("Calling the Master function -> Authenticating into the Controller")
30+
FABRIC.login()
31+
t3=FABRIC.bd_Subnet(tn,bd,Subnet,Scope)
32+
t2=FABRIC.VRF_bd(tn,vrf,bd)
33+
34+
35+
36+
elif ACTION in ("n","no","N","No"):
37+
print("Ending the script")
38+
else:
39+
print("Please enter yes or no.")
40+
41+
42+
if __name__ == '__main__':
43+
main()

Dev2/FW_GW_project_Master.py

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
import requests
2+
import json
3+
from string import Template
4+
requests.urllib3.disable_warnings()
5+
"""
6+
Author: Ganesh Mohan
7+
Date: 12/23/2020
8+
Purpose: Send API calls to APIC and print status
9+
Version: 1.3
10+
"""
11+
12+
class AuthenticationError(Exception):
13+
pass
14+
class Client:
15+
def __init__(self, host, usr, pwd):
16+
#self.jar = requests.cookies.RequestsCookieJar()
17+
self.host = host
18+
self.usr = usr
19+
self.pwd = pwd
20+
self.client = requests.Session()
21+
#Pushing the configuration in the APIC controller
22+
def POST(self, url, data,Role):
23+
response= self.client.post('https://%s%s' % (self.host, url),data=json.dumps(data),timeout=5,verify=False)
24+
resp=response.text
25+
if 'error' in resp:
26+
print("\n!!!!{}: Config already exist or config issue..Code{}\n".format(Role,response))
27+
print("!!!!Error code:{}\n".format(resp))
28+
#raise AuthenticationError
29+
else:
30+
print(">>>>{}:>>>>>Done # Status Code>{}".format(Role,response))
31+
return response
32+
#Pulling the data in the APIC controller
33+
def get(self, url):
34+
print("getting into the controller:{}".format(url))
35+
r=self.client.get('https://%s%s' % (self.host, url),timeout=5,verify=False)
36+
print("get response {}".format(r))
37+
return r
38+
#Login into APIC using static Credentials.
39+
def login(self):
40+
data = {"aaaUser": {"attributes": {"name": self.usr, "pwd": self.pwd}}}
41+
res= self.client.post('https://%s/api/aaaLogin.json' % (self.host),data=json.dumps(data),timeout=5,verify=False)
42+
print(res)
43+
if res.status_code != 200 or 'error' in res.json()['imdata'][0]:
44+
raise AuthenticationError
45+
46+
47+
#T1:Create Tenant,VRF
48+
def tenant(self,Tname,VRF):
49+
Role='T1:Create/Modifying the tenant:{},VRF:{}'.format(Tname,VRF)
50+
print("\n Logining into the tenant:{}\n".format(Tname))
51+
data = { "fvTenant":{"attributes":{"dn":"uni/tn-"+Tname,"status":"created,modified"},"children":[
52+
#{"fvBD":{"attributes":{"dn":"uni/tn-"+Tname+"/BD-"+BD+"_bd","name":BD+"_bd","arpFlood":"true","unicastRoute":"true","rn":"BD-"+BD+"_bd","status":"created,modified"},
53+
#"children":[{"fvRsCtx":{"attributes":{"tnFvCtxName":VRF+"_vrf","status":"created,modified"},"children":[] }}],
54+
{"fvCtx":{"attributes":{"dn":"uni/tn-"+Tname+"/ctx-"+VRF+"_vrf","name": VRF+"_vrf","rn":"ctx-"+VRF+"_vrf","status":"created,modified"},"children":[]
55+
}}]}}
56+
return self.POST('/api/mo/uni/tn-{}.json'.format(Tname), data,Role)
57+
58+
def VRF_bd(self,Tname,VRF,BD):
59+
Role='T3: Associate BD:{} into VRF:{} in Tenant {}'.format(BD,VRF,Tname)
60+
#print("\nCreating the tenant:{}\n".format(Tname))
61+
data = { "fvTenant":{"attributes":{"dn":"uni/tn-"+Tname,"status":"created,modified"},"children":[
62+
{"fvBD":{"attributes":{"dn":"uni/tn-"+Tname+"/BD-"+BD+"_bd","name":BD+"_bd","arpFlood":"false","unkMacUcastAct":"proxy","unicastRoute":"true","rn":"BD-"+BD+"_bd","status":"created,modified"},
63+
"children":[{"fvRsCtx":{"attributes":{"tnFvCtxName":VRF+"_vrf","status":"created,modified"},"children":[] }}]}},
64+
{"fvCtx":{"attributes":{"dn":"uni/tn-"+Tname+"/ctx-"+VRF+"_vrf","name": VRF+"_vrf","rn":"ctx-"+VRF+"_vrf","status":"created,modified"},"children":[]
65+
}}]}}
66+
return self.POST('/api/mo/uni/tn-{}.json'.format(Tname), data,Role)
67+
68+
#T2:Create L3 BD,Subnet and Scope of the subnet.
69+
def bd_Subnet(self,Tname,BD,Subnet,Scope):
70+
Role='T4: Creating the L3 BD:{} with Anycast GW:{} on Scope:{}'.format(BD,Subnet,Scope)
71+
scope_list = ['public', 'shared','private']
72+
if Scope in scope_list:
73+
data = {"fvSubnet": {"attributes": {"dn": "uni/tn-"+Tname+"/BD-"+BD+"_bd/subnet-["+Subnet+"]", "ctrl": "", "ip": Subnet, "rn": "subnet-["+Subnet+"]","scope":Scope, "status": "created,modified"},"children": [] } }
74+
else:
75+
data = {"fvSubnet": {"attributes": {"dn": "uni/tn-"+Tname+"/BD-"+BD+"_bd/subnet-["+Subnet+"]", "ctrl": "", "ip": Subnet, "rn": "subnet-["+Subnet+"]", "scope":"public,shared","status": "created,modified"},"children": [] } }
76+
return self.POST('/api/node/mo/uni/tn-{}/BD-{}_bd/subnet-[{}].json'.format(Tname,BD,Subnet), data,Role)
77+
78+
#T19 Create L2 BD domain.
79+
def bd_L2(self,Tname,BD):
80+
Role="T19:{}-L2 BD domain(Flood/Unicast disabled):".format(BD)
81+
data = {"fvBD":{"attributes":{"dn":"uni/tn-"+Tname+"/BD-"+BD+"_bd","arpFlood":"true","unicastRoute":"false","unkMacUcastAct":"flood","status":"created,modified"},"children":[]}}
82+
return self.POST('/api/mo/uni/tn-{}/BD-{}_bd.json'.format(Tname,BD), data,Role)
83+
84+
#T20 Create L3OUT Primary IP & Secondary IP
85+
def L3OUT_Config(self,Tname,VRF,L3OUT_NAME,L3OUT_DOMAIN,L3OUT_SUBNETS,Node_ID,PORT,SVI_VLAN,SVI_IP,MTU,ROUTER_ID):
86+
Role="T20:Configure the {}_L3out on Node {}:".format(L3OUT_NAME,Node_ID)
87+
data = {"l3extOut":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME,"name":L3OUT_NAME,"rn":"out-"+L3OUT_NAME,"status":"created,modified"},
88+
"children":[
89+
#{"l3extInstP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/instP-"+L3OUT_SUBNETS,"name":L3OUT_SUBNETS,"rn":"instP-"+L3OUT_SUBNETS,"status":"created,modified"},"children":[{"l3extSubnet":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/instP-"+L3OUT_SUBNETS+"/extsubnet-[0.0.0.0/0]","ip":"0.0.0.0/0","status":"created,modified"},"children":[]}}]}},
90+
{"l3extInstP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/instP-"+L3OUT_SUBNETS,"name":L3OUT_SUBNETS,"rn":"instP-"+L3OUT_SUBNETS,"status":"created,modified"},"children":[]}},
91+
{"l3extLNodeP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile","name":L3OUT_NAME+"_nodeProfile","status":"created,modified"},
92+
"children":[{"l3extLIfP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile/lifp-"+L3OUT_NAME+"_interfaceProfile","name":L3OUT_NAME+"_interfaceProfile","status":"created,modified"},
93+
"children":[{"l3extRsPathL3OutAtt":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile/lifp-"+L3OUT_NAME+"_interfaceProfile/rspathL3OutAtt-[topology/pod-1/paths-"+Node_ID+"/pathep-[eth"+PORT+"]]","tDn":"topology/pod-1/paths-"+Node_ID+"/pathep-[eth"+PORT+"]","addr":SVI_IP,"ifInstT":"ext-svi","mtu":MTU,"encap":"vlan-"+SVI_VLAN,"status":"created,modified","rn":"rspathL3OutAtt-[topology/pod-1/paths-"+Node_ID+"/pathep-[eth"+PORT+"]]"},
94+
"children":[] }}]}},
95+
{"l3extRsNodeL3OutAtt":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile/rsnodeL3OutAtt-[topology/pod-1/node-"+Node_ID+"]","tDn":"topology/pod-1/node-"+Node_ID,"rtrId":ROUTER_ID,"rtrIdLoopBack":"false","status":"created,modified"},
96+
"children":[]}}]}},
97+
{"l3extRsEctx":{"attributes":{"tnFvCtxName":VRF+"_vrf","status":"created,modified"},"children":[]}},{"l3extRsL3DomAtt":{"attributes":{"tDn":"uni/l3dom-"+L3OUT_DOMAIN,"status":"created,modified"},"children":[]}}]}}
98+
return self.POST('/api/node/mo/uni/tn-{}/out-{}.json'.format(Tname,L3OUT_NAME), data,Role)
99+
100+
def L3OUT_GW_IP(self,Tname,L3OUT_NAME,Node_ID,PORT,SVI_GW_IP):
101+
Role="T21:Configure the GW IP Address on {}_L3OUT for Node {}:".format(L3OUT_NAME,Node_ID)
102+
data = {"l3extIp":{"attributes":{"addr":SVI_GW_IP,"status":"created,modified"},"children":[]}}
103+
return self.POST('/api/node/mo/uni/tn-{}/out-{}/lnodep-{}_nodeProfile/lifp-{}_interfaceProfile/rspathL3OutAtt-[topology/pod-1/paths-{}/pathep-[eth{}]].json'.format(Tname,L3OUT_NAME,L3OUT_NAME,L3OUT_NAME,Node_ID,PORT),data,Role)
104+
105+
#T22 Create Static L3OUT
106+
def L3OUT_Static(self,Tname,L3OUT_NAME,Node_ID,Dest_Network,Next_hop):
107+
Role= "T22:{}-L3 Static Route Configure Network {} as Next-hop:{} on Node {}:".format(L3OUT_NAME,Dest_Network,Next_hop,Node_ID)
108+
data= {"ipRouteP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile/rsnodeL3OutAtt-[topology/pod-1/node-"+Node_ID+"]/rt-["+Dest_Network+"]","ip":Dest_Network,"rn":"rt-["+Dest_Network+"]","status":"created,modified"},
109+
"children":[{"ipNexthopP":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/lnodep-"+L3OUT_NAME+"_nodeProfile/rsnodeL3OutAtt-[topology/pod-1/node-"+Node_ID+"]/rt-["+Dest_Network+"]/nh-["+Next_hop+"]","nhAddr":Next_hop,"rn":"nh-["+Next_hop+"]","status":"created,modified"},"children":[]}}]}}
110+
return self.POST('/api/node/mo/uni/tn-{}/out-{}/lnodep-{}_nodeProfile/rsnodeL3OutAtt-[topology/pod-1/node-{}]/rt-[{}].json'.format(Tname,L3OUT_NAME,L3OUT_NAME,Node_ID,Dest_Network), data,Role)
111+
#T23 Create Static L3OUT
112+
def L3OUT_Subnets(self,Tname,L3OUT_NAME,L3OUT_SUBNETS,Dest_Network):
113+
Role= "T23:{}-L3out Subnets for Network {}:".format(L3OUT_NAME,Dest_Network)
114+
Dest_Network_list = ['0.0.0.0/0']
115+
if Dest_Network in Dest_Network_list:
116+
data= {"l3extSubnet":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/instP-"+L3OUT_SUBNETS+"/extsubnet-["+Dest_Network+"]","ip":Dest_Network,"scope":"import-security,shared-security,shared-rtctrl","aggregate":"shared-rtctrl","rn":"extsubnet-["+Dest_Network+"]","status":"created,modified"},"children":[]}}
117+
else:
118+
data= {"l3extSubnet":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME+"/instP-"+L3OUT_SUBNETS+"/extsubnet-["+Dest_Network+"]","ip":Dest_Network,"scope":"import-security,shared-security,shared-rtctrl","aggregate":"","rn":"extsubnet-["+Dest_Network+"]","status":"created,modified"},"children":[]}}
119+
return self.POST('/api/node/mo/uni/tn-{}/out-{}/instP-{}/extsubnet-[{}].json'.format(Tname,L3OUT_NAME,L3OUT_SUBNETS,Dest_Network),data,Role)
120+
121+
#T24 Create Contract
122+
def Contract(self,Tname,Contract_name,Contract_sub,Scope):
123+
Role= "T24:Create Contract {} under Tenant {}:".format(Contract_name,Tname)
124+
scope_list = ['tenant','global']
125+
if Scope in scope_list:
126+
data ={"vzBrCP":{"attributes":{"dn":"uni/tn-"+Tname+"/brc-"+Contract_name,"name":Contract_name,"scope":Scope,"rn":"brc-"+Contract_name,"status":"created,modified"},
127+
"children":[{"vzSubj":{"attributes":{"dn":"uni/tn-"+Tname+"/brc-"+Contract_name+"/subj-"+Contract_sub+"","name":Contract_sub,"rn":"subj-"+Contract_sub,"status":"created,modified"},
128+
"children":[{"vzRsSubjFiltAtt":{"attributes":{"status":"created,modified","tnVzFilterName":"default","directives":"none"},"children":[]}}]}}]}}
129+
else:
130+
data ={"vzBrCP":{"attributes":{"dn":"uni/tn-"+Tname+"/brc-"+Contract_name,"name":Contract_name,"rn":"brc-"+Contract_name,"status":"created,modified"},
131+
"children":[{"vzSubj":{"attributes":{"dn":"uni/tn-"+Tname+"/brc-"+Contract_name+"/subj-"+Contract_sub+"","name":Contract_sub,"rn":"subj-"+Contract_sub,"status":"created,modified"},
132+
"children":[{"vzRsSubjFiltAtt":{"attributes":{"status":"created,modified","tnVzFilterName":"default","directives":"none"},"children":[]}}]}}]}}
133+
return self.POST('/api/node/mo/uni/tn-{}/brc-{}.json'.format(Tname,Contract_name),data,Role)
134+
135+
#T25 Provider Contract
136+
def Prov_Contract(self,Tname,L3OUT_NAME,Contract_name,P_EPG):
137+
Role= "T25:Apply the Provider Contract under EPG {}:".format(P_EPG)
138+
data={"fvRsProv":{"attributes":{"tnVzBrCPName":Contract_name,"status":"created,modified"},"children":[]}}
139+
return self.POST('/api/node/mo/uni/tn-{}/out-{}/instP-{}.json'.format(Tname,L3OUT_NAME,P_EPG),data,Role)
140+
#T26 Consumer Contract
141+
def Cons_Contract(self,Tname,Contract_name,APP,C_EPG):
142+
Role= "T27:Apply the Consumer Contract under EPG {}:".format(C_EPG)
143+
data ={"fvRsCons":{"attributes":{"tnVzBrCPName":Contract_name,"status":"created,modified"},"children":[]}}
144+
return self.POST('/api/node/mo/uni/tn-{}/ap-{}/epg-{}.json'.format(Tname,APP,C_EPG),data,Role)
145+
146+
147+
# T28 Rollback Plan: Delete the L3OUT.
148+
def Del_L3OUT(self,Tname,L3OUT_NAME):
149+
Role= "T28:Rollback the L3OUT configuration:{} on Tenant:{}".format(L3OUT_NAME,Tname)
150+
data ={"l3extOut":{"attributes":{"dn":"uni/tn-"+Tname+"/out-"+L3OUT_NAME,"status":"deleted"},"children":[]}}
151+
return self.POST('/api/node/mo/uni/tn-{}/out-{}.json'.format(Tname,L3OUT_NAME),data,Role)
152+
153+
# T29 Rollback Plan: Delete the Contract.
154+
def Del_Contract(self,Tname,Contract_name):
155+
Role= "T29:Rollback the {} Contract on Tenant {}:".format(Contract_name,Tname)
156+
data={"vzBrCP":{"attributes":{"dn":"uni/tn-"+Tname+"/brc-"+Contract_name,"status":"deleted"},"children":[]}}
157+
return self.POST('/api/node/mo/uni/tn-{}/brc-{}.json'.format(Tname,Contract_name),data,Role)
158+
159+
160+
def main():
161+
162+
import apic_cfg as cfg
163+
client = Client(cfg.host, cfg.usr, cfg.pwd)
164+
print("\n Authenication in to the controller: {}\n".format(cfg.host))
165+
client.login()
166+
167+
if __name__ == '__main__':
168+
main()

Dev2/Prework.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
def main():
2+
import getpass
3+
import csv
4+
from FW_GW_project_Master import Client
5+
#host = "172.19.254.4"
6+
usr="admin"
7+
pwd = "!@#CiScO123"
8+
#tn = "HNSEC_FW_GW"
9+
input_file = csv.DictReader(open("data.csv",encoding="utf-8-sig"))
10+
for data in input_file:
11+
host=(data["Fabric_Host_IP"])
12+
Datacenter = (data["Datacenter"])
13+
tn = (data["Tenant_Name"])
14+
EPG=(data["EPG"])
15+
SVI_VLAN=(data["SVI_VLAN"])
16+
PRI_Node_ID=(data["PRI_Node_ID"])
17+
SEC_Node_ID=(data["SEC_Node_ID"])
18+
PRI_PORT=(data["PRI_PORT"])
19+
SEC_PORT=(data["SEC_PORT"])
20+
PRI_SVI_IP1=(data["PRI_SVI_IP"])
21+
PRI_SVI_IP = PRI_SVI_IP1+"/29"
22+
SEC_SVI_IP1=(data["SEC_SVI_IP"])
23+
SEC_SVI_IP =SEC_SVI_IP1+"/29"
24+
SVI_GW_IP1=(data["SVI_GW_IP"])
25+
SVI_GW_IP = SVI_GW_IP1+"/29"
26+
Next_hop=(data["Next_hop"])
27+
Dest_Network =(data["Dest_Network"])
28+
Contract_Scope = (data["Contract_Scope"])
29+
APP= (data["APP_Profile_Name"])
30+
MTU = (data["MTU"])
31+
L3OUT_DOMAIN = (data["L3OUT_DOMAIN"])
32+
vrf = EPG
33+
L3OUT_NAME = EPG
34+
L3OUT_SUBNETS_NAME = L3OUT_NAME+"_Ext_Network"
35+
PRI_ROUTER_ID = PRI_Node_ID+"."+PRI_Node_ID+"."+PRI_Node_ID+"."+SVI_VLAN
36+
SEC_ROUTER_ID = SEC_Node_ID+"."+SEC_Node_ID+"."+SEC_Node_ID+"."+SVI_VLAN
37+
Consumer_EPG = EPG+"_EPG"
38+
#Subnet = "192.168.4.1/24"
39+
Provider_EPG = L3OUT_SUBNETS_NAME
40+
Contract_name = EPG+"_ct"
41+
Contract_sub = Contract_name+"_sub"
42+
print ("")
43+
print("Logging into **{} ** ACI FABRIC Controller IP:{}".format(Datacenter,host))
44+
print("Configure the Tenant Configure on:{}".format(tn))
45+
print("Configure the VRF/EPG Name:{}".format(vrf))
46+
print("Configure the .1Q SVI_VLAN ID#:{}".format(SVI_VLAN))
47+
print("Configure the Leaf PRI_Node_ID Ex:1XX:{}".format(PRI_Node_ID))
48+
print("Configure the Leaf SEC_Node_ID Ex:1YY: {}".format(SEC_Node_ID))
49+
print("Configure the Ethernet interface on PRI_Node_Port:{}".format(PRI_PORT))
50+
print("Configure the Ethernet interface on SEC_Node_Port:{}".format(SEC_PORT))
51+
print("Configure the SVI Primary_IP for PRI_Node:{}".format(PRI_SVI_IP))
52+
print("Configure the SVI Second._IP for SEC_Node:{}".format(SEC_SVI_IP))
53+
print("Configure the SVI GW_IP on PRI_SEC_Node:{}".format(SVI_GW_IP))
54+
print("Configure the FW/RTR L3out NEXT_HOP IP_Address:{}".format(Next_hop))
55+
print("Configure the Destination Network :{}".format(Dest_Network))
56+
print ("")
57+
print("Configure the Primary Node ROUTER_ID:{}".format(PRI_ROUTER_ID))
58+
print("Configure the Second Node ROUTER_ID:{}".format(SEC_ROUTER_ID))
59+
print("Configure the MTU value :{}".format(MTU))
60+
print("Configure the Application Profile Name:{}".format(APP))
61+
print ("")
62+
#print ("************Contract information****")
63+
print("Configure the Contract Name :{}".format(Contract_name))
64+
print("Configure the Contract Scope :{}".format(Contract_Scope))
65+
print("Configure the Consumer contract on EPG :{}".format(Consumer_EPG))
66+
print("Configure the Provider contract on EPG :{}".format(Provider_EPG))
67+
print ("")
68+
69+
ACTION = input("Are you sure you want to push the above configuration (y/n): ")
70+
71+
if ACTION in ("y","yes","Y","YES"):
72+
#FABRIC=Client(cfg.host, cfg.usr, cfg.pwd)
73+
FABRIC=Client(host, usr, pwd)
74+
print("Calling the Master function -> Authenticating into the Controller")
75+
FABRIC.login()
76+
t1=FABRIC.tenant(tn,vrf)
77+
t20=FABRIC.L3OUT_Config(tn,vrf,L3OUT_NAME,L3OUT_DOMAIN,L3OUT_SUBNETS_NAME,PRI_Node_ID,PRI_PORT,SVI_VLAN,PRI_SVI_IP,MTU,PRI_ROUTER_ID)
78+
t22=FABRIC.L3OUT_GW_IP(tn,L3OUT_NAME,PRI_Node_ID,PRI_PORT,SVI_GW_IP)
79+
t23=FABRIC.L3OUT_Static(tn,L3OUT_NAME,PRI_Node_ID,Dest_Network,Next_hop)
80+
t20_1=FABRIC.L3OUT_Config(tn,vrf,L3OUT_NAME,L3OUT_DOMAIN,L3OUT_SUBNETS_NAME,SEC_Node_ID,SEC_PORT,SVI_VLAN,SEC_SVI_IP,MTU,SEC_ROUTER_ID)
81+
t22_1=FABRIC.L3OUT_GW_IP(tn,L3OUT_NAME,SEC_Node_ID,SEC_PORT,SVI_GW_IP)
82+
t23_1=FABRIC.L3OUT_Static(tn,L3OUT_NAME,SEC_Node_ID,Dest_Network,Next_hop)
83+
t24=FABRIC.L3OUT_Subnets(tn,L3OUT_NAME,L3OUT_SUBNETS_NAME,Dest_Network)
84+
t25=FABRIC.Contract(tn,Contract_name,Contract_sub,Contract_Scope)
85+
t26=FABRIC.Prov_Contract(tn,L3OUT_NAME,Contract_name,Provider_EPG)
86+
t27=FABRIC.Cons_Contract(tn,Contract_name,APP,Consumer_EPG)
87+
88+
elif ACTION in ("n","no","N","No"):
89+
print("Ending the script")
90+
else:
91+
print("Please enter yes or no.")
92+
93+
94+
if __name__ == '__main__':
95+
main()

0 commit comments

Comments
 (0)