10-01-2019 01:22 AM
Hello!
I've planning to deploy a lot of EPGs on bare-metal servers and looking for advice on how to do it via REST API.
Looking on example of existing static deployment
{ "totalCount": "1", "imdata": [ { "fvRsPathAtt": { "attributes": { "annotation": "", "descr": "", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]]", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "unknown", "tDn": "topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]" } } } ] }
and browsing APIC Postman application I found that I need to use fv:RsPathAtt class. As I understand resulting POST message body should look like this:
{ "fvRsPathAtt": { "attributes": { "tDn": "topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]]", "rn": "rspathAtt-{topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]}", "status": "created,modified", "annotation": "", "descr": "", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "" }, "children": [] } }
Is this a correct request body? And what about endpoint where I should send the request?
Fields annotation, descr, array children are required or I can omit them?
Thank you!
Solved! Go to Solution.
10-04-2019 11:45 PM
Hi,
@dtekaccount10 wrote:Hello!
I've planning to deploy a lot of EPGs on bare-metal servers and looking for advice on how to do it via REST API.
Looking on example of existing static deployment
{ "totalCount": "1", "imdata": [ { "fvRsPathAtt": { "attributes": { "annotation": "", "descr": "", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]]", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "unknown", "tDn": "topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]" } } } ] }and browsing APIC Postman application I found that I need to use fv:RsPathAtt class. As I understand resulting POST message body should look like this:
{ "fvRsPathAtt": { "attributes": { "tDn": "topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]]", "rn": "rspathAtt-{topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]}", "status": "created,modified", "annotation": "", "descr": "", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "" }, "children": [] } }Is this a correct request body? And what about endpoint where I should send the request?
Fields annotation, descr, array children are required or I can omit them?
Thank you!
This is the correct body. The Fields annotation, descr, array children are not required.
The request should be send as a POST with a REST tool (Postman, curl...) to the controllers IP. What do you mean about endpoint? You specify the EPG after "dn".
10-07-2019 12:19 AM - edited 10-07-2019 12:20 AM
Hi @dtekaccount10 ,
The URL should be "https://APIC-IP/api/node/mo/uni.json"
And the body should be as mentioned before!
Regards
Udo
@dtekaccount10 wrote:I mean the API URI. It should be just https://APIC or something else like https://APIC/api/node/mo/uni/tn-EXP/ap-APP1/epg-VL1101_EPG.json ?
10-04-2019 11:45 PM
Hi,
@dtekaccount10 wrote:Hello!
I've planning to deploy a lot of EPGs on bare-metal servers and looking for advice on how to do it via REST API.
Looking on example of existing static deployment
{ "totalCount": "1", "imdata": [ { "fvRsPathAtt": { "attributes": { "annotation": "", "descr": "", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]]", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "unknown", "tDn": "topology/pod-1/protpaths-101-102/pathep-[_Cisco_ME3400_VPC]" } } } ] }and browsing APIC Postman application I found that I need to use fv:RsPathAtt class. As I understand resulting POST message body should look like this:
{ "fvRsPathAtt": { "attributes": { "tDn": "topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]", "dn": "uni/tn-EXP/ap-APP1/epg-VL1101_EPG/rspathAtt-[topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]]", "rn": "rspathAtt-{topology/pod-1/protpaths-101-102/pathep-[_AnotherDevice_VPC]}", "status": "created,modified", "annotation": "", "descr": "", "encap": "vlan-1101", "instrImedcy": "immediate", "mode": "regular", "primaryEncap": "" }, "children": [] } }Is this a correct request body? And what about endpoint where I should send the request?
Fields annotation, descr, array children are required or I can omit them?
Thank you!
This is the correct body. The Fields annotation, descr, array children are not required.
The request should be send as a POST with a REST tool (Postman, curl...) to the controllers IP. What do you mean about endpoint? You specify the EPG after "dn".
10-06-2019 11:26 PM
I mean the API URI. It should be just https://APIC or something else like https://APIC/api/node/mo/uni/tn-EXP/ap-APP1/epg-VL1101_EPG.json ?
10-07-2019 12:19 AM - edited 10-07-2019 12:20 AM
Hi @dtekaccount10 ,
The URL should be "https://APIC-IP/api/node/mo/uni.json"
And the body should be as mentioned before!
Regards
Udo
@dtekaccount10 wrote:I mean the API URI. It should be just https://APIC or something else like https://APIC/api/node/mo/uni/tn-EXP/ap-APP1/epg-VL1101_EPG.json ?
10-17-2022 12:31 PM
Can you stack multiple configuration entries in the json data like below:
{ "totalCount": "2", "imdata": [ { "fvRsPathAtt": {
}
}
{
"fvRsPathAtt": {
}
}
]
}
10-21-2022 10:16 AM - edited 10-21-2022 10:17 AM
You can but what you ought to do is write it up with the {{variables}} bracketed in Postman like below. Make a CSV file with those variable names as the top row and then fill in all your iterations. Then in Postman, you will select "Run Collection" and use the CSV as the data file. That way each run will be separate and you will get a 200 OK when it works or a 4xx code when one fails.
https://learning.postman.com/docs/getting-started/creating-the-first-collection/
You will also want to create a login task for the APIC like so and add it to all your collections as the first job. Setup an environment for your ACI environment with the APIC, Username and Password variables stored:
POST: https://{{APIC}}/api/aaaLogin.json
{
"aaaUser": {
"attributes": {
"name": "{{UserName}}",
"pwd": "{{Password}}"
}
}
}
POST: https://{{APIC}}/api/mo/uni.json?rsp-subtree=modified
{
"fvRsPathAtt": {
"attributes": {
"dn": "uni/tn-{{Tenant}}/ap-{{ANP}}/epg-{{EPG}}/rspathAtt-[topology/pod-{{Pod}}/protpaths-{{Leaf1}}-{{Leaf2}}/pathep-[{{PolGrp}}]]",
"encap": "vlan-{{VLAN_ID}}",
"instrImedcy": "immediate",
"mode": "{{Mode}}",
"status": "{{Status}}"
}
}
}
{{Tenant}} = the tenant
{{ANP}} = the ANP
{{EPG}} = the EPG
{{Pod}} = pod #
{{Leaf1}} = the node #
{{Leaf2}} = the node #
{{PolGrp}} = the VPC interface policy group name
{{VlanID}} = the vlan #
{{Mode}} = "regular" for a standard tagged dot1q trunk configuration (
{{Status}} = "created" (other options are "created,modified", "modified" or "deleted")
Your CSV would look something like this:
Tenant | ANP | EPG | Vlan_ID | Pod | Leaf1 | Leaf2 | PolGrp | Mode | Status |
INTERNAL | NETCENTRIC_ANP | EPG_VLAN0200 | 200 | 1 | 203 | 204 | VPC_UCS_FI_100A | regular | created,modified |
03-19-2020 07:09 AM
This is great. Is there anyone who has deployed Static Epg from Terraform. Any help is appriciated.
Thank you.
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