Skip to main content

APIC Rest to pYthon Adapter

Project description

# APIC Rest Python Adapter (arya)

Original Author: Paul Lesiak - [palesiak@cisco.com](palesiak@cisco.com)

Co-author: Mike Timm - [mtimm@cisco.com](mtimm@cisco.com)

# Description

arya is a tool that will convert APIC object documents from their XML or JSON form into the equivalent Python code leveraging the Cobra SDK.

arya supports input in a number of formats, including XML, JSON, a directory containing multiple xml or json documents, as well as standard input. The standard input option is very useful for use as a filter in most text editors, where one can copy the JSON or XML extracted from APIC Visore or API inspector, and quickly generate the Python source code framework, which can then be modified, tokenized and rapidly turned into functional prototypes.

Note that arya is a very useful tool for the heavy lifting of converting object model into source code, however it does not validate configuration, perform advanced lookup logic or implement a number of best practices that should be followed, such as performing lookups to validate targets, referencing object attributes instead of hardcoding Dns and names, and other proper coding practices

It is strongly recommended that for advanced use cases, getting expert advice and validating your code, you reach out to Cisco Advanced Services for support. For more information, visit http://www.cisco.com/go/aci

If you run into issues with arya, please open an issue on github

# Installation

## Environment Required

  • Python 2.7+

Recommended:

  • pip (to install from pypi)

  • Git (to install from github)

## Downloading and installing

Option A:

Download and install from pypi:

pip install arya

With this option, this is the only step.

Option B:

If you have git installed clone the repository

git clone https://github.com/datacenter/arya.git

Install following the instructions below.

Option C:

If you don’t have git [download a zip copy of the repository](https://github.com/datacenter/arya/archive/master.zip) and extract.

### Install if using options B or C

cd arya

Run the setup script

python setup.py install

Check that arya can be run from the command line

$ arya.py

# Usage

Once installed arya will place the file arya.py in your path, so you should be able to call arya.py from any prompt.

Usage is as such:

$ arya.py

usage: Code generator for APIC cobra SDK [-h] [-f FILEIN] [-s] [-d SOURCEDIR]

[-t TARGETDIR] [-i IP] [-u USERNAME] [-p PASSWORD] [-nc] [-b]

optional arguments:
-h, --help

show this help message and exit

-f FILEIN, --filein FILEIN

Document containing post to be sent to REST API

-s, --stdin

Parse input from stdin, for use as a filter, e.g., cat doc.xml | arya.py -s

-d SOURCEDIR, --sourcedir SOURCEDIR

Specify a source directory containing ACI object files you want to convert to python.

-t TARGETDIR, --targetdir TARGETDIR

Where to write the .py files that come from the -d directory. If none is specified, it will default to SOURCEDIR

-i IP, --ip IP

IP address of APIC to be pre-populated

-u USERNAME, --username USERNAME

Username for APIC account to be pre-populated in generated code

-p PASSWORD, --password PASSWORD

Password for APIC account to be pre-populated in generated code

-nc, --nocommit

Generate code without final commit to changes

-b, --brief

Generate brief code (without headers, comments, etc) Password for admin account on APIC

# License

Copyright (C) 2014 Cisco Systems Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arya-1.1.5.tar.gz (11.5 kB view details)

Uploaded Source

Built Distributions

arya-1.1.5-py2.7.egg (36.6 kB view details)

Uploaded Source

arya-1.1.5-py2-none-any.whl (26.5 kB view details)

Uploaded Python 2

File details

Details for the file arya-1.1.5.tar.gz.

File metadata

  • Download URL: arya-1.1.5.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for arya-1.1.5.tar.gz
Algorithm Hash digest
SHA256 02fba8d0e4814a77601a6893ba4e9eedf7ec521206c7285635e930853dd345a9
MD5 e4236a10d87a844572b1b2376fbb1457
BLAKE2b-256 fb7201c3c12667a6e59c47fc76f3b8f707239d5817b8aabdc4aeee053a98acc0

See more details on using hashes here.

File details

Details for the file arya-1.1.5-py2.7.egg.

File metadata

  • Download URL: arya-1.1.5-py2.7.egg
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for arya-1.1.5-py2.7.egg
Algorithm Hash digest
SHA256 b19fc946e2f1a56ce6f049c9bc97a2f903abbeff35f12a0d023787b6a5782e55
MD5 066ca1db94d8b02ab6036b3665237ae9
BLAKE2b-256 6be53118c2c6fe11301b857266ab21aca686a9afd5ed61e7a0d2b85dd599f2f2

See more details on using hashes here.

File details

Details for the file arya-1.1.5-py2-none-any.whl.

File metadata

File hashes

Hashes for arya-1.1.5-py2-none-any.whl
Algorithm Hash digest
SHA256 0dcf9ee3ae7277c25bf77a701d61435464feb1f732c71db195c7637df32a28a3
MD5 8a4cc06aa84322622fe491b2b16aafd3
BLAKE2b-256 0ad8742493604f848457f1aa37e9cf1f2e664d45dd6355a183fa2eb63dcef027

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page