Giter Site home page Giter Site logo

dmmar / gns3_auto_topology_builder Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 637 KB

This repository contains a python3 script that is used to deploy a GNS3 topology from a YAML file using GNS3 REST API.

License: MIT License

Python 100.00%
gns3 gns3-api gns3-builder network-automation python3

gns3_auto_topology_builder's Introduction

gns3_auto_topology_builder

Overview

This repository contains a python3 script [gns3_deploy_topology.py] that is used to deploy a GNS3 topology from a YAML file using GNS3 API.

The auto_builder can be useful in combination with CI/CD. For example, to build a development environment for a Network Engineer.

The main idea was to do not open GNS3 GUI interface to create/delete/connect devices and use it like a code because my GNS3 server is located far away from me [>=380ms.] and it was hard to use GUI interface.

You can find some examples in Examples and NetasCode_example folders.

Tested on [GNS3 2.1.21 and 2.2.7] and appliances such as Cisco IOSv, IOSvL2, vASA 9.9.2, VyOS 1.1.8 and JunOS vSRX 17.3R1.

The script does not support GNS3 server authentication login/pass for now.

P.S. Author is not an expert, he is learning how to code. Errors can exist.

I would appreciate any feedback. Thank you!

Prerequisites

* python3
* pip3
* GNS3

Getting Started

# git clone https://github.com/dmmar/gns3_auto_topology_builder.git
# pip3 install -r requirements.txt

Running simple examples:

The most important part is to get the right names of appliances from a GNS3 server.

For that, you can use a simple python3 script which will show you all current appliances on your GNS3 server.
Those appliances names you can copy and paste to the topology file (.yaml).
* I have used mine GNS3 server IP, appliances names and IP addresses to make these examples. For you they can be different.*

*[GNS3 2.1.21]*
Use the following to get appliances names/ids:
# python3 gns3_show_appliances.py -s http://[<IP>:<port>]
For example, # python3 gns3_show_appliances.py -s http://172.30.33.200:3080

[Simple examples:]
* Please, before run a script look at the topology file (.yaml) and the diagram (.png)
Also, please read * Important notes section *

# python3 gns3_deploy_topology.py -f Examples/ex1/gns3_simple_topology_1.yaml
# python3 gns3_deploy_topology.py -f Examples/ex2/gns3_simple_topology_2.yaml
# python3 gns3_deploy_topology.py -f Examples/ex3/gns3_simple_topology_3.yaml

*[GNS3 2.2.7]*

Use the following to get appliances names/ids:
# python3 gns3_show_appliances_v1_1.py -s http://[<IP>:<port>]
For example, # python3 gns3_show_appliances_v1_1.py -s http://172.30.33.200:3080

[Simple examples:]
* Please, before run a script look at the topology file (.yaml) and the diagram (.png)
Also, please read * Important notes section *

# python3 gns3_deploy_topology_v1_1.py -f Examples/ex1/gns3_simple_topology_1.yaml
# python3 gns3_deploy_topology_v1_1.py -f Examples/ex2/gns3_simple_topology_2.yaml
# python3 gns3_deploy_topology_v1_1.py -f Examples/ex3/gns3_simple_topology_3.yaml

Running NetasCode example:

You can use this example to deploy GNS3 topologies for dev/test/prod env. of the virtual fictional company 'X' and play with network automation.

More information: https://github.com/dmmar/netascode

[NetasCode example:]
* Please, before run a script look at the topology file (.yaml) and the diagram (.png)
* I have used mine GNS3 server IP, appliances names and IP addresses to make the example. For you they can be different.*
Also, please read * Important notes section *

*[GNS3 2.1.21]*
# python3 gns3_deploy_topology.py -f NetasCode_example/gns3_dev_topology.yaml
# python3 gns3_deploy_topology.py -f NetasCode_example/gns3_test_topology.yaml
# python3 gns3_deploy_topology.py -f NetasCode_example/gns3_prod_topology.yaml

*[GNS3 2.2.7]*
# python3 gns3_deploy_topology_v1_1.py -f NetasCode_example/gns3_dev_topology.yaml
# python3 gns3_deploy_topology_v1_1.py -f NetasCode_example/gns3_test_topology.yaml
# python3 gns3_deploy_topology_v1_1.py -f NetasCode_example/gns3_prod_topology.yaml

Important notes:

- Running time for JunOS vSRX is 10 min.
- Running time for VPCS is 5 sec.
- Running time for other GNS3 appliances is 1 min.

- Startup configs applies using [Netmiko with pexpect via telnet], and for Cisco IOS, ASA, JunOS, VyOS, and VPCS.
For more information look at [def gns3_send_start_config_telnet()] in gns3_deploy_topology.py script.

- global_delay_factor: 4

# global_delay_factor for [gns3_send_start_config_telnet]
# I have used a global delay parameter because
# my GNS3 server is located far away from me (380>= latency).
# info https://ktbyers.github.io/netmiko/docs/netmiko/

License

This project is licensed under the MIT License - see the LICENSE file for details.

gns3_auto_topology_builder's People

Contributors

dmmar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.