05-19-2016 01:10 AM - edited 03-01-2019 04:58 AM
I need help in creating EPG in ACI using Json Script. I wanted to create EPG using cURL command and JSON Script. Please can anyone help me out here. I tried below options but hard luck.
curl -b cookie.txt -X POST -k https://1.1.1.1/api/node/mo/uni/tn-Test_ACI/ap-DevNet-AP1/epg-DevNet-DB.json -d
'{
"fvAEPg":{
"attributes":{
"dn":"uni/tn-Test_ACI/ap-DevNet-AP1/epg-DevNet-DB",
"name":"DevNet-DB",
"rn":"epg-DevNet-DB"
},
"children":[
{
"fvCrtrn":{
"attributes":{
"dn":"uni/tn-Test_ACI/ap-DevNet-AP1/epg-DevNet-DB/crtrn",
"name":"default",
"rn":"crtrn"
},
"children":[
]
}
},
{
"fvRsBd":{
"attributes":{
"tnFvBDName":"DevNet-BD1"
},
"children":[
]
}
}
]
}
}'
05-19-2016 04:20 AM
Hello
What error did you receive?
05-19-2016 10:06 AM
05-19-2016 10:27 AM
hey narottamoza, I think you are posting this to the wrong URL, there might be something wrong with your curl command or script file, but I definitely noticed your post URL looks wrong:
https://1.1.1.1/api/node/mo/uni/tn-Test_ACI/ap-DevNet-AP1/epg-DevNet-DB.json
I think this should be
api/node/mo/uni/tn-Test_ACI/ap-DevNetAP1.json
05-19-2016 09:00 PM
05-20-2016 03:58 AM
ADD TENANT INTO THE APIC USING CURL
===================================
LOGIN
-----
curl -X POST -k https://1.2.3.4/api/aaaLogin.json -d '{ "aaaUser" : { "attributes" : { "name" : "admin", "pwd" : "abc123!" } } }' -c cookie.txt
ie.
deadbeef:Downloads tdeleon$ curl -X POST -k https://1.2.3.4/api/aaaLogin.json -d '{ "aaaUser" : { "attributes" : { "name" : "admin", "pwd" : "abc123!" } } }' -c cookie.txt
{"totalCount":"1","imdata":[{"aaaLogin":{"attributes":{"token":"U6mpdkH5F71r8Q53vXYH1sQH4KoDztHF8Wl033CRV1IQPolSh+SXOo79Yb6yEIC3KJfyRUK/BrgPqPlldK5vBC+Wxlu36Ecsnu5B5xMI7/+CqNue9n8r7CVbIyVSqfMAeMzro20hJCW3DETkAN+5BnT0VgjJTmjzIEQ6HH4nQJo=","siteFingerprint":"Z1SRdAjhFnm5w3Mt","refreshTimeoutSeconds":"9600","maximumLifetimeSeconds":"86400","guiIdleTimeoutSeconds":"65525","restTimeoutSeconds":"90","creationTime":"1460134090","firstLoginTime":"1460134090","userName":"admin","remoteUser":"false","unixUserId":"15374","sessionId":"y2FUzQ2CSr6PSJId17UUBg==","lastName":"","firstName":"","version":"1.2(2h)","buildTime":"Tue Feb 23 20:07:23 PST 2016","node":"topology/pod-1/node-1"},"children":[{"aaaUserDomain":{"attributes":{"name":"all","rolesR":"admin","rolesW":"admin"},"children":[{"aaaReadRoles":{"attributes":{}}},{"aaaWriteRoles":{"attributes":{},"children":[{"role":{"attributes":{"name":"admin"}}}]}}]}},{"DnDomainMapEntry":{"attributes":{"dn":"comp/prov-VMware/dom-mb-fab1-vmm","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-common","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"comp/prov-VMware/ctrlr-[mb-fab1-vmm]-mb-fab1-vmm","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"topology/pod-1","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-infra","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-jk-Tenant","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/vmmp-VMware/dom-mb-fab1-vmm","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/phys-jk-Phys","readPrivileges":"admin","writePrivileges":"admin"}}},{"DnDomainMapEntry":{"attributes":{"dn":"uni/tn-mgmt","readPrivileges":"admin","writePrivileges":"admin"}}}]}}]}
ADD TENANT
----------
curl -b cookie.txt -X POST -k https://1.2.3.4/api/node/mo/uni/tn-deadbeef-curl.json -d '{"fvTenant":{"attributes":{"dn":"uni/tn-deadbeef-curl","name":"deadbeef-curl","descr":"Add Tenant using CURL","rn":"tn-deadbeef-curl","status":"created"},"children":[{"fvRsTenantMonPol":{"attributes":{"tnMonEPGPolName":"default","status":"created,modified"},"children":[]}}]}}'
ADD VRF
-------
curl -b cookie.txt -X POST -k https://1.2.3.4/api/node/mo/uni/tn-deadbeef-curl/ctx-curl-vrf1.json -d '{"fvCtx":{"attributes":{"dn":"uni/tn-deadbeef-curl/ctx-curl-vrf1","name":"curl-vrf1","descr":"Add VRF using CURL","rn":"ctx-curl-vrf1","status":"created"},"children":[{"fvRsCtxToEpRet":{"attributes":{"tnFvEpRetPolName":"default","status":"created,modified"},"children":[]}},{"fvRsCtxMonPol":{"attributes":{"tnMonEPGPolName":"default","status":"created,modified"},"children":[]}}]}}'
ADD BRIDGE DOMAIN
-----------------
curl -b cookie.txt -X POST -k https://1.2.3.4/api/node/mo/uni/tn-deadbeef-curl/BD-curl-bd1.json -d '{"fvBD":{"attributes":{"dn":"uni/tn-deadbeef-curl/BD-curl-bd1","mac":"00:22:BD:F8:19:FF","name":"curl-bd1","descr":"Add BD using CURL","rn":"BD-curl-bd1","status":"created"},"children":[{"fvSubnet":{"attributes":{"dn":"uni/tn-deadbeef-curl/BD-curl-bd1/subnet-[1.1.1.1/1]","ip":"1.1.1.1/1","rn":"subnet-[1.1.1.1/1]","status":"created"},"children":[]}},{"fvRsCtx":{"attributes":{"tnFvCtxName":"curl-vrf1","status":"created,modified"},"children":[]}},{"fvRsBdToEpRet":{"attributes":{"tnFvEpRetPolName":"default","status":"created,modified"},"children":[]}},{"fvRsABDPolMonPol":{"attributes":{"tnMonEPGPolName":"default","status":"created,modified"},"children":[]}}]}}'
-------------------------------
Using XML
---------
* Add Tenant with complete configuration.
LOGIN
-----
curl -X POST -k https://1.2.3.4/api/aaaLogin.xml -d '<aaaUser name="admin" pwd="abc123!"/>' -c cookie.txt
ADD TENANT
----------
curl -b cookie.txt -X POST -k https://1.2.3.4/api/node/mo/uni.xml -d "@tn-deadbeef-red.xml" -c cookie.txt
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide