Giter VIP home page Giter VIP logo

ansible_batfish_cicd's Introduction

CICD pipeline to configure BGP between four cisco IOS devices

This pipeline executes on a Self Managend GitLab instance and a gitlab-runner executing in shell mode.

CICD workflow

Before making any configuration changes (only IP and BGP confgiuration covered in this example), a new issue and a branch needs to be created in GitLab.

Each time a commit is made to the Gitlab branch, device configs are generated and the generated configs are evaluated against defined assertions.

  • The device configs are generated using jinja2 templates in the templates folder and input data in the host_vars folder. The code for configuration generation is in the generate_config.yaml playbook.
  • A batfish snapshot is initialized from the generated configuration and an assertion is made to validate that there are no incompatabile bgp sessions. The code to do this is in the batfish_test.yaml playbook.

Once these two stages are successful, a merge request needs to be placed to merge with the master branch. Upon approval, the third and final stage of the pipeline is initiated which configures the actual network devices. The code to do this is in the configure_devices.yaml.

The exact sequence of commands to generate configurations, run assertions and deploy the configuration are in template.gitlab-ci.yml file, which is uploaded to the Gitlab repository as its pipeline file (.gitlab-ci.yml) when the repository is initialized.

Sample Output

Generate Configuration

alt text

Batfish Test

alt text

Configure Device

alt text

Note

In a real world scenario I would use napalm_install_config to do a full config replace. Due the limitation of using virtual Cisco IOS devices in EVE-NG and a lack of flash: memory on them, in the above example I have used ios_config.

ansible_batfish_cicd's People

Contributors

sudarshanvk avatar

Watchers

 avatar  avatar

Forkers

micruzz82

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.