Giter VIP home page Giter VIP logo

aci_workshop_code_samples's Introduction

aci_workshop_code_samples

Summary


Collection of simple code samples for ACI programmability. Includes beginner level ansible playbooks and python code snippets used or referenced in DevNet Workshop DEVWKS-1309.

This repository contains sample code for automating various types of tasks relating to ACI configuration and initial ACI fabric bringup.

Following are the step by step instructions for the Cisco Live Devnet Workshop. The samples include both Ansible playbooks and Python scripts utilizing Cobra SDK.

Workshop Test APICs

https://128.107.232.40 (admin , cisco12345)

https://128.107.232.41 (admin , cisco12345)

https://128.107.232.42 (admin , cisco12345)

https://128.107.232.43 (admin , cisco12345)

Workshop Instructions


I. Environment Setup


This is using Python 2. It is recommended to run this package in a virtual environment.

1. Open Terminal application

Terminal

2. Change to home directory

cd

3. Install virtual environment package (if not installed )

virtualenv --version

If the command is not recognized, install virtualenv with the following instructions, else go to step 4.

sudo pip install virtualenv

4. Check your default version of Python

python --version

5. Create a virtual environment with python 2.7

virtualenv aci-workshop --python=/usr/bin/python2.7

6. Activate the virtual environment

source aci-workshop/bin/activate

7. Clone "aci_workshop_code_samples" repository

git clone https://github.com/CiscoDevNet/aci_workshop_code_samples.git

8. Change directory

cd aci_workshop_code_samples

9. Install requirements

pip install -r requirements.txt

10. Install Ansible

pip install ansible==2.7.8

11. Download Cobra SDK egg files

THIS STEP HAS ALREADY BEEN DONE FOR YOU:

Download cobra eggs:

cd $HOME/Downloads
wget https://www.dropbox.com/s/koiljhrra16g30o/acicobra-3.2_7f-py2.7.egg
wget https://www.dropbox.com/s/esohbv25bwtoj68/acimodel-3.2_7f-py2.7.egg

The 2 egg files have been placed in your Downloads directory

12. Change directory

cd $HOME/Downloads

13. Install Cisco APIC Python SDK - acicobra egg file

easy_install -Z acicobra-3.2_7f-py2.7.egg

14. Install Cisco APIC Python SDK - acimodel egg file

easy_install -Z acimodel-3.2_7f-py2.7.egg

15. Test APIC Access

Browse to your APIC simulator: https://<ip address> and login

II. Ansible Playbook - ACI Configuration for Firewall Solution


Create a Unique Tenant

16. In Terminal, return to "aci_workshop_code_samples" directory

cd $HOME/aci_workshop_code_samples

17. Open the file "tenant_create.yml" using Atom

atom tenant_create.yml

18. Make these changes to the file: tenant_create.yml

Verify or make changes to insure these fields are as noted:

	aci_hostname:  <your APIC simulator>
	tenant:        <your unique tenant name>
	description:   <some description>

SAVE YOUR CHANGES - click on File, click on Save

19. Return to command line and execute the Playbook

ansible-playbook tenant_create.yml

20. Verify tenant was created in Web UI

  Browse to your APIC simulator: https://<ip address> and login

Run the Ansible Playbook to create ACI Firewall Config

21. In Terminal, change directory to aci_workshop_code_samples/playbook_vars/aci_workshop_fab1

cd $HOME/aci_workshop_code_samples/playbook_vars/aci_workshop_fab1

22. Open the file "aci_fw_config_vars.yml" using Atom

atom aci_fw_config_vars.yml

23. Modify this file: aci_fw_config_vars.yml

Note: this is the input variable file for the Playbook we will run later.

Verify or make changes to insure these fields are as noted:

	aci_hostname:  <your APIC simulator>
	aci_tenant:    <your unique tenant name>

SAVE YOUR CHANGES - click on File, click on Save

24. In Terminal, change directory to aci-workshop

cd $HOME/aci_workshop_code_samples

25. Return to command line and execute the Playbook

ansible-playbook run_firewall_build_demo.yml -e @./playbook_vars/aci_workshop_fab1/aci_fw_config_vars.yml

26. Login to APIC to Verify/Monitor changes within your tenant's Networking section

	Browse to your APIC simulator: https://<ip address> and login

III. Python Scripts (with Cobra SDK) - ACI Fabric Bringup and Base Configuration


Security Policy Configuration

27. Change to python_scripts directory

cd $HOME/aci_workshop_code_samples/python_scripts

28. Open the file "policy_cfg_source.yml" using Atom

atom policy_cfg_source.yml

29. Modify this file: policy_cfg_source.yml

Verify or make changes to insure the tenant name is correct:

	tenants:
      -
        name: "<this is YOUR tenant you just created>"

SAVE YOUR CHANGES - click on File, click on Save

30. Return to command line, and view the Python script options

python policy_cfg.py -h

31. Execute the python script

python policy_cfg.py -a <your apic> -u admin -p <password> -f policy_cfg_source.yml

33. Login to APIC to Verify/Monitor changes within your tenant's Contract section

	Browse to your APIC simulator: https://<ip address> and login

Time Permitting: Fabric Discovery

33. Change to python_scripts directory

cd $HOME/aci_workshop_code_samples/python_scripts

34. Return to the command line, and view the Python script options

python fabric_site_specific.py -h

35. Execute the python script

python fabric_site_specific.py -a <your apic> -u admin -p <password> -f fabric_site_acisim.yml

aci_workshop_code_samples's People

Contributors

abaldan1 avatar eckelcu avatar sheerens avatar sourcery-ai-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.