取消
显示结果 
搜索替代 
您的意思是: 
cancel
4123
查看次数
20
有帮助
5
评论
Luke Huang
Cisco Employee
Cisco Employee
目标:
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 做认证,拿到 token
POST /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 格式。
085716fcnh8f9m309kngza.png
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
085921zluufe88dprr85z8.png


注意各个层级、名字 的对应关系
090413yz1fdna1nfiziaf8.png
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
删除配置务必小心谨慎

090531y5vkd5n55g4sog2s.png
通过对比可以发现,实际上和添加 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
}
}
}
]
}
}
]
}
}
]
}
}

085921zluufe88dprr85z8.png
085921zluufe88dprr85z8.png085921zluufe88dprr85z8.png
评论
one-time
Level 13
Level 13
感谢专家分享,谢谢~
wuhao0015
Spotlight
Spotlight
支持专家分享。
借此想问下,TAC接设备API对接等开发的CASE吗?
shlei
Cisco Employee
Cisco Employee
wuhao0015 发表于 2020-3-20 11:19
支持专家分享。
借此想问下,TAC接设备API对接等开发的CASE吗?

API对接开发的case由专门的developer team支持。
详情可以参考下面的link:
https://developer.cisco.com/site/support/
wuhao0015
Spotlight
Spotlight
shlei 发表于 2020-4-2 10:29
API对接开发的case由专门的developer team支持。
详情可以参考下面的link:
https://developer.cisco.co ...

谢谢回复~~!
likuo
Spotlight
Spotlight
步骤很清晰。
入门指南

使用上面的搜索栏输入关键字、短语或问题,搜索问题的答案。

我们希望您在这里的旅程尽可能顺利,因此这里有一些链接可以帮助您快速熟悉思科社区:









快捷链接