Skip to content

Commit f214fe2

Browse files
author
Fückert, Oliver
committed
V1.1
1 parent 0a0cb34 commit f214fe2

2 files changed

Lines changed: 119 additions & 1 deletion

File tree

README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
aci2dot converts JSON formatted Cisco ACI policy files or snippets to a DOT graph format.
2+
3+
```
4+
./aci2dot.py --help
5+
usage: aci2dot.py [-h] [--nr] [--na] [--write]
6+
[--stdout | --dot {svg,png,pdf}]
7+
policy_file
8+
9+
Create DOT formatted Graph from JSON formatted ACI policy export.
10+
11+
positional arguments:
12+
policy_file JSON ACI Policy Filename
13+
14+
optional arguments:
15+
-h, --help show this help message and exit
16+
--nr Suppress redundant children
17+
--na Don't show attributes
18+
--write Write config template to .aci2dot and exit
19+
--stdout Write to STDOUT instead of to file
20+
--dot {svg,png,pdf} Also write SVG/PNG/PDF. 'dot' needs to be installed.
21+
```
22+
23+
For example:
24+
25+
![ACI Policy Graph](example/bgp.svg "ACI Policy Graph")
26+
27+
was rendered from:
28+
29+
```json
30+
{
31+
"polUni": {
32+
"attributes": {
33+
"status": "created,modified"
34+
},
35+
"children": [{
36+
"fabricInst": {
37+
"attributes": {
38+
"status": "created,modified"
39+
},
40+
"children": [{
41+
"bgpInstPol": {
42+
"attributes": {
43+
"status": "created,modified",
44+
"ownerKey": "",
45+
"name": "default",
46+
"descr": "Default BGP Policy",
47+
"nameAlias": "",
48+
"ownerTag": "",
49+
"annotation": ""
50+
},
51+
"children": [{
52+
"bgpAsP": {
53+
"attributes": {
54+
"status": "created,modified",
55+
"name": "",
56+
"descr": "",
57+
"asn": "100",
58+
"nameAlias": "",
59+
"annotation": ""
60+
}
61+
}
62+
}, {
63+
"bgpExtRRP": {
64+
"attributes": {
65+
"status": "created,modified",
66+
"annotation": "",
67+
"name": "",
68+
"descr": "",
69+
"nameAlias": ""
70+
}
71+
}
72+
}, {
73+
"bgpRRP": {
74+
"attributes": {
75+
"status": "created,modified",
76+
"annotation": "",
77+
"name": "",
78+
"descr": "",
79+
"nameAlias": ""
80+
},
81+
"children": [{
82+
"bgpRRNodePEp": {
83+
"attributes": {
84+
"status": "created,modified",
85+
"descr": "",
86+
"podId": "1",
87+
"annotation": "",
88+
"nameAlias": "",
89+
"id": "1101"
90+
}
91+
}
92+
}, {
93+
"bgpRRNodePEp": {
94+
"attributes": {
95+
"status": "created,modified",
96+
"descr": "",
97+
"podId": "1",
98+
"annotation": "",
99+
"nameAlias": "",
100+
"id": "1102"
101+
}
102+
}
103+
}]
104+
}
105+
}]
106+
}
107+
}]
108+
}
109+
}, {
110+
"infraInfra": {
111+
"attributes": {
112+
"status": "created,modified"
113+
}
114+
}
115+
}]
116+
}
117+
}
118+
```

aci2dot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def main():
9292
global simple
9393
global show_attributes
9494
global gformat
95-
parser = argparse.ArgumentParser(description='Export DOT formatted Graph from JSON formatted ACI policy export.\nConvert with: ./aci2dot.py policy.json | dot -o policy.svg -Tsvg')
95+
parser = argparse.ArgumentParser(description='Create DOT formatted Graph from JSON formatted ACI policy export.')
9696
parser.add_argument('policy_file', type=argparse.FileType('r'), help='JSON ACI Policy Filename')
9797
parser.add_argument('--nr', action='store_true', help='Suppress redundant children')
9898
parser.add_argument('--na', action='store_true', help="Don't show attributes")

0 commit comments

Comments
 (0)