Pretty print notepad++ json11/14/2022 'monPolDn': 'uni/tn-common/monepg-default', Basically I have have some payload ( a bridge domain) that I got from a REST call to the APIC in a python dictionary called payload and you can see some of the manipulations below to pretty print it and save to a file. My preference is not to work with XML but in those cases where I have no choice I've used the xmltodict and dicttoxml modules in python. Like Notepad++ with XML tools addon, or Atom with some XML addon, or I'm pretty sure your favourite editor has a plugin too. (both for json and XML format)įor the indentation part, use some text editor which recognise XML files and can convert it to the proper format. You can use POSTMAN to deploy the configurations. (I do like it, because you can get the correct post/get URL and the json file content from it, while you are browsing the APIC) The API inspector, but that is json based. The tenant, VRF, and BD are not yet deployed. This example configures tenant t1 with VRF v1 and bridge domain bd1. I've got some Ansible ACI sample playbooks on GitHub from a presentation I did at Interop last year that might help.Ĭonfigure the tenant, VRF, and bridge domain. Thats where I got all of the payload data you see in the Postman collection. Lastly, make liberal use of the ACI Inspector. Early days it did not have all the actions I needed and so I went the "do it yourself" route. Very good for basic stuff and handles alot of stuff for you (authentication, etc.). The final option I'll mention is the ACI Tookit. Makes it easy to back out the configuration as well as apply it.Īgain, the Postman collection is here and it comes with an environment set up for the DevNet APIC Sandbox. However its good practice to keep it consistent and as you will see in some of the other requests in the Postman collection I do set a STATUS variable to give you and example of putting the "state" in a variable within your playbooks. notice that the Parent object ipRouteP is set to "status": "deleted" and after that it does not matter what the child object says. Using one of your use cases, the payload below (which I used to add a host route to the Google DNS server 8.8.8.8/32 with "status": "created") has been updated to delete that 8.8.8.8/32 route. In this case if you wanted to delete the SVI but keep your Interface Profile object (a likely scenario), line 7 would stay as is and line 21 would change to "deleted". The payload below creates the DCL_IntProf Interface Profile object and then creates the child SVI object. Typically the parent object needs to be "created, modified" or "modified" if you are sure it already exists and children objects can then be noted as "deleted". However if you are going in to modify items then you will need to pay close attention to each status as you work your way through the relationships. If you want to delete the objects you can use "status": "deleted" The first time you create all of this you can use "status": "created". Under that starting at line 11 (but note the "children" in line 9) you have the l3extRsPath元OutAtt which represents your SVI. Notice that the first object in line 2 is l3extLIfP which defines the Logical Node Profile. Here is an example of payload to add an SVI. When you are updating specific "children" in ACI you will need to pay attention to the MIT and the relationships. Thats just an indication that the work was done on a Mac. Note: you can disregard the MACOS folder. Its pretty basic and does not have all the objects and relationships you need for a functioning network but its just enough to illustrate the examples. I also spend time using POSTMAN to validate the payloads I'm pushing to ACI and so I have some examples for you to look at with Postman. A common workflow for me is to build out the Data Center via Python and then "tune" with Ansible and mostly the REST module. Ansible has lots of modules ready to go including a rest module and so for one off things I'll go that route. If I'm doing something highly customized I'll use python because I have all of that build already. I work on ACI via python scripts using the requests module and via Ansible. PRETTY PRINT NOTEPAD++ JSON FULLI'm not a fan of the CobraSDK so I'll share some other ways to do this so you get a full picture. Hi will find alot of examples out there and there are many ways to automate already described one, and quite a powerful one at that.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |