目标:ACI 支持图形化界面 GUI 配置和修改配置,同时用 Cisco Command Line/CLI 做 troubleshooting,支持 REST API 方式调用内部资源。
本质上来说,ACI 内部的资源都可以认为是mo( manage object),有些时候 TAC 收集命令,是 moquery,即为 对mo进行查询。
这篇帖子会 demo 三个场景:
1. Postman 去向 ACI 做认证,拿到 token
2. Postman API 方式去批量、快速修改 ACI 的 Fabric - interface policy group - AEP 的关联情况
3. Postman API 方式去批量、快速修改 ACI 的 Tenant - EPG - physical Domain 的绑定情况
首先是 Postman 去向 ACI 做认证,拿到 tokenPOST /api/aaaLogin.json HTTP/1.1
Host: 1.2.3.4 <<<<< APIC 地址
Content-Type: application/json
{
"aaaUser": {
"attributes": {
"name": "admin",
"pwd": "password"
}
}
}
认证的结果需要是 200 OK默认有效期 10 分钟;10 分钟以后,需要重新认证
Postman 修改 interface policy AEP 关联手打容易出错,可以借助 Object Store 去直接复制 policy name根据需要,可以一次修改多个 policy group 的 AEP;注意 JSON 格式,可以使用
https://jsonformatter.curiousconcept.com/ 来验证 JSON 格式。

POST /api/mo/uni/infra.json HTTP/1.1
Host: 1.2.3.4 <<<<< APIC 地址
Content-Type: application/json
{
"infraFuncP":{
"attributes":{
},
"children":[
{
"infraAccPortGrp":{
"attributes":{
"name":"fushuang_LeafAccessPortPolicyGroup", >>> 需要修改
"status":"created,modified"
},
"children":[
{
"infraRsAttEntP":{
"attributes":{
"tDn":"uni/infra/attentp-fushuang_AEP", >>> 需要修改
"status":"created,modified"
}
}
}
]
}
},
{
"infraAccPortGrp":{
"attributes":{
"name":"jiangygu_LeafAccessPortPolicyGroup", >>> 需要修改
"status":"created,modified"
},
"children":[
{
"infraRsAttEntP":{
"attributes":{
"tDn":"uni/infra/attentp-fushuang_AEP", >>> 需要修改
"status":"created,modified"
}
}
}
]
}
}
]
}
}
Postman 增加 EPG 关联的 physical domain
注意各个层级、名字 的对应关系
POST /api/mo/uni.json HTTP/1.1
Host: 1.2.3.4 <<<<< APIC 地址
Content-Type: application/json
{
"fvTenant":{
"attributes":{
"name":"fushuang", <<<<< Tenant 名字
"status":"created,modified"
},
"children":[
{
"fvAp":{
"attributes":{
"name":"AP_BD_102", <<<<< Application Profile 名字
"status":"created,modified"
},
"children":[
{
"fvAEPg":{
"attributes":{
"name":"EPG_VRF102_SVI601", <<<<< EPG 名字
"status":"created,modified"
},
"children":[
{
"fvRsDomAtt":{
"attributes":{
"status":"created,modified",
"tDn":"uni/phys-fushuang_PhysicalDomain" <<<< 增加的 domain
}
}
}
]
}
}
]
}
}
]
}
}
Postman 删除 EPG 关联的 Domain删除配置务必小心谨慎

通过对比可以发现,实际上和添加 EPG-Domain 相比,只是修改了两个部分的关键字:
1. status: deleted
2. 具体需要删掉的 physical domain
POST /api/mo/uni.json HTTP/1.1
Host: 1.2.3.4 <<<<< APIC 地址
Content-Type: application/json
{
"fvTenant":{
"attributes":{
"name":"fushuang", <<<<< Tenant 名字
"status":"created,modified"
},
"children":[
{
"fvAp":{
"attributes":{
"name":"AP_BD_102", <<<<< Application Profile 名字
"status":"created,modified"
},
"children":[
{
"fvAEPg":{
"attributes":{
"name":"EPG_VRF102_SVI601", <<<<< EPG 名字
"status":"created,modified"
},
"children":[
{
"fvRsDomAtt":{
"attributes":{
"status":"deleted", <<<< 删除 phys-domain
"tDn":"uni/phys-fushuang_PhysicalDomain" <<<< 删除的 domain
}
}
}
]
}
}
]
}
}
]
}
}

