ACI Power Deployment Tool – Update!

It’s been a long time! But, I’m back with some good news — at least if you care about ACI and the power deployment tool I’ve previously written about.

The tool itself was rather crude, and really my first attempt at anything substantive with python. I think functionally its been fantastic, but was certainly lacking in finesse! Well, over the past however long since I released it into the world, I’ve got a major, major update to write about!

I’ve been basically making minor enhancement to the tool since the last update in terms of functionality, however there have also been some pretty drastic improvements to the code structure. For a time we were using this stuff internally at work and I couldn’t really share all of that, though I did try to keep at least the baseline functionality updates rolling to Github (poorly, more on that later).

Now, however, we are done with our internal stuff and I’m releasing the far, far, superior version of pdt into the wild. The primary improvement here is that instead of a gargantuan mess of multi-line strings in the main library, I’ve moved to real live json files (whoa crazy idea huh!) and jinja2 templating. This cleaned up the main code base quite a bit. I’ve also been doing my best to slowly add in error handling throughout — starting with simple stuff like validating integers are integers, and the status input is actually a valid status! I’ve also added some basic error handling to improve any re-transmission errors — particularly on the ACI simulators (which yes, I know, are not publically available unfortunately) the sims will fail — I guess running out of memory or cpu, or just some internal throttling thing… in any case, the tool now will simply pause and re-attempt if this occurs.

I’ve picked apart a fair amount of the methods and cleaned things up and made them much more granular as well — particularly for Bridge Domains… before the code was a bit of a mess… one big BD method, but now its been broken down into three smaller bits which gives us much more flexibility and granularity of config.

One important piece which I eluded to a bit earlier… I’m now attempting to get my life together and actually learn how to use Github properly! It’s a bit embarrassing that I really had never done anything but delete repos and add it back with updated files. Not exactly stellar use of the tool! But hey, never too late to learn, so I’m doing my best to use Github in a more correct way (still a long way to go!!). So for now, I’ll probably always have a master and a dev branch. I’ll be using the dev branch pretty recklessly, updating whenever I damn well please! Whenever I feel like I get things to a reasonable place — stability wise, functionally, or whatever else — i’ll merge the dev branch into the master. Then ill start the whole thing over again! I’d also love to have contributors on the project if possible. I know it’s a pretty niche thing, but that would be good fun, and would be great to learn from some other folks about how to do all this stuff correctly! So, if you’re bored, feel free to make some pull requests and we’ll get to crackin’! For now, happy ACI’ing, hope some folks get good use out of the tool!

 

You can find the tool here: https://github.com/carlniger/acitool

Advertisements

20 thoughts on “ACI Power Deployment Tool – Update!

  1. Hi Carl.

    Is it possible to run your tool in read-only mode, just to grab configuration data from Cisco ACI? It would be a good tool to pull data for audit or configuration assurance.

    Cheers,
    Anatoly

    • At the moment… no. BUT I’ve been working on “v2” on the side which does indeed do this. I don’t have a good timeframe for when it will be out though since its a pet project and its basically a total overhaul. It’ll be on my Github though as soon as I figure it all out 🙂

  2. hey Carl, thx for the blog and real good work!!
    Im struggling to get ACIPDT to work 🙂
    Followed the Github and all seem good with the installation, only missing how can we start the scripts 🙂
    python acipdt.py
    File “acipdt.py”, line 41
    templateVars = {**required_args, **optional_args}
    ^
    SyntaxError: invalid syntax

    Can you give me some hints 🙂 (sorry for the ignorance)

  3. ok got it running was python3 command missing…
    one question..if we need only partial configuration, how are the blank fields treated?
    thanks in advance.

  4. It seem that all the fields are required:

    Enter APIC username: admin
    Enter APIC password:
    Workbook Loaded.
    Snapshot taken successfully, continuing.
    ********************************************************************************
    Starting work on Fabric Pod Policies section
    ********************************************************************************
    Deploying line 6 from section Fabric Pod Policies…
    Traceback (most recent call last):
    File “main.py”, line 456, in
    main()
    File “main.py”, line 441, in main
    pod_policies(apic, cookies, wb, wr_wb)
    File “main.py”, line 161, in pod_policies
    status = eval(“podpol.%s(**var_dict[pos])” % func)
    File “”, line 1, in
    File “/Users/nuno.marques/Desktop/acipdt-master/acipdt/acipdt.py”, line 148, in comission_hw
    templateVars = process_kwargs(required_args, optional_args, **kwargs)
    File “/Users/nuno.marques/Desktop/acipdt-master/acipdt/acipdt.py”, line 30, in process_kwargs
    raise InsufficientArgs(‘Insufficient required arguments.’)
    acipdt.InsufficientArgs: Insufficient required arguments.

    • If the value is there in the A column it will require the values for the keywords (unless they are optional values, you can find that out by looking at the comments before the method in the acipdt.py file). It’s also super annoyingly sensitive to white space, so you can’t have blank lines within a section (keyword) or it will break. I promise v2 will be better if u ever get around to it 🙂

  5. One more question, so if i only want to make a subset of actions, can i remove the value in A column and assume it will only apply the specific subset of scripts?

    • Correct. It basically “screen scrapes” excel. So it starts at like row 6 or so and just goes down A column until it hits something… then it will go up one row, and over, and those values are the keywords required for the particular method. Finally it loads up the values below the keywords. All this is why it’s sensitive to space so much.

  6. Hello Carl,

    i hope you are doing hello, i have a question about what if i can run the script for certain parts of the aci elements. because i only want to create tenant policies and not all the aci construct, how can i do that, for now i was able to connect and load the workbook, but i was wondering what do i need to run your acipdt in that manner. I hope you can help me.
    best regards

    • Hello Carl,

      Don’t worry, i started to think and i could, excellent program that you created, thanks a lot!
      Best Regards, i could create tenant and epg, but i think i’m missing something with the bridge domain
      whatever thing i write you, thanks!!!

      • Sounds like you got it sorted out, but yep you can use it to configure things individually if you’d like. Just have to be careful to have the appropriate fields and deal w/ the touchy spreadsheet 🙂

  7. Hello Carl,

    thanks i have a question about the bridge domain field, because when i try to create one of the bridge domain, i having a problem witt it, because, it says that the limitlearn is not mandatory, but even or not with that specification i was not able to make a bridge domain, do i have to put all the association for the bridge domain on it, like subnet and vrf association??

    bd
    tn_name name arp mdest mcast unicast unk_unicast vrf status limitlearn

    • What version APIC are you using? If you’re on a version before limit learn was added (I feel like this was around 2.2) right now PDT will just fail on that call. Also can we move this to Github — can you open an issue there and we can figure it out? https://github.com/carlniger/acipdt Post up your error and spreadsheet data there and we’ll get it sorted!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s