Skip to main content

A python tool to deploy topology defined in a json config

Project description

build

topology-deployer

Python tool to deploy topologies on Ubuntu from the defined json config files.

Table of Contents

  1. Prerequisites
  2. User Guide
    1. Create Topology
    2. Delete Topology
    3. Verbosity
  3. JSON Topology Config
    1. JSON Network Config
    2. JSON Virtual Machine Config

Prerequisites

Run ./scripts/install

User Guide

Installation

Install from Python Package Index

sudo pip3 install topology-deployer

To install from source

sudo pip3 install .

Options

Parse topology config

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        JSON Config file that defines the topology
  -o {create,delete,CREATE,DELETE}, --operation {create,delete,CREATE,DELETE}
                        Operation to create or delete topology from the JSON Config
  -i {ubuntu,rocky}, --image {ubuntu,rocky}
                        Choose the base OS image for the VMS
  -l {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the log level
  --dry-run             Instead of executing, print the commands
  --skip-network        Skip creating networks. Cannot be used with --skip-vm
  --skip-vm             Skip creating vms. Cannot be used with --skip-network

Creating Topologies

A JSON cofig is taken as input. Check here for guide to define config

sudo topology-deployer -c config.json -o create -i ubuntu -l INFO

To skip creating networks. It can be used woth delete too. (This is BETA feature. Not fully tested)

sudo topology-deployer -c config.json -o create -i ubuntu -l INFO --skip-network

To skip creating virtual machines. It can be used woth delete too. (This is BETA feature. Not fully tested)

sudo topology-deployer -c config.json -o create -i ubuntu -l INFO --skip-vm

Deleting Topologies

Same JSON cofig used to create topology is taken as input.

sudo topology-deployer -c config.json -o delete -l INFO

Verbosity

To print verbose output for created networks

sudo topology-deployer --print-nw -c config.json -o create

To print verbose output for created virtual machines

sudo topology-deployer --print-vm -c config.json -o create

JSON Config

The json config to define topologies comprises of 2 sections.

  1. Networks
  2. Virtual Machines
{
    "version" : 2,
    "networks" : [],
    "vms" : []
}

JSON Network Config

The JSON network object comprises of array of networks. A network object skeleton is shown below

{
    "networks" : [
        {
            "name" : "<name>",
            "type" : "<nat | management | isolated>",
            "subnet4" : "<ipv4 subnet>",
            "subnet6" : "<ipv6 subnet>"
        }
    ],
}

Add NAT network in JSON network object

For nat network, name and subnet4 are mandatory fields. subnet6 is optional in case you need v6 network in your topology. To have multiple NAT networks, you can add multiple objects in the networks.nat json object.

{
    "networks" : [
        {
            "name" : "<name>",
            "type" : "nat",
            "subnet4" : "<ipv4 subnet>",
            "subnet6" : "<ipv6 subnet>"
        }
    ]
}

Add Management network in JSON network object

For management network, name and subnet4 are mandatory fields. Currently we do not support v6 management network. To have multiple NAT networks, you can add multiple objects in the networks.management json object.

{
    "networks" : [
        {
            "name" : "<name>",
            "type" : "management",
            "subnet4" : "<ipv4 subnet>"
        }
    ]
}

Add Isolated network in JSON network object

For isolated network, name is mandatory fields. To have multiple NAT networks, you can add multiple objects in the networks.isolated json object.

{
    "networks" : [
        {
            "name" : "<name>",
            "type" : "management"
        }
    ]
}

JSON Virtual Machine Config

The vms object is array of multiple vm objects. For the vm object on the JSON config, name, flavor, vnc_port and networks are mandatory fields. You can optionally use ram, vcpus and disk to override the defaults for the flavor. A vms object skeleton is shown below

{
    "vms" : [{
        "name" : "",
        "flavor" : "",
        "vnc_port" : "",
        "networks" : {
            "<nw_name1>" : {
                "v4" : ""
            },
            "<nw_name2>" : {
                "v4" : "",
                "v6" : ""
            }
        }
    }]
}

To define networks for the vm, you have to use the network name as key and provide v4 address. You can also add a v6 address if the network type is NAT.

If you want to customize the resources for your VM you can use the vcpus, ram and disk keys. Example

{
    "vms" : [{
        "name" : "",
        "flavor" : "",
        "vcpus" : 10,
        "ram" : 8192,
        "disk" : "128G",
        "vnc_port" : "",
        "networks" : {
            "<nw_name1>" : {
                "v4" : ""
            },
            "<nw_name2>" : {
                "v4" : "",
                "v6" : ""
            }
        }
    }]
}

Sample Topology Configurations

  1. 2PE-CE
  2. 2PE-2PSWITCH-2CE

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

topology_deployer-0.2.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

topology_deployer-0.2.1-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file topology_deployer-0.2.1.tar.gz.

File metadata

  • Download URL: topology_deployer-0.2.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for topology_deployer-0.2.1.tar.gz
Algorithm Hash digest
SHA256 bffef84db8badc8458b1cd5ea953c4a5b5b62b232adb3f6c8c589d1a0f3d7b85
MD5 5c62524ca370d8c50400dfc8c5700643
BLAKE2b-256 80b94848c5945ed345dc6c880c5e0054b8a79f903e4212b65e98095437d677d5

See more details on using hashes here.

File details

Details for the file topology_deployer-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topology_deployer-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eee4205be3f307f7e6fe1c9b441e54371b04a1924c77c59716daae2c376efdbc
MD5 7cf12b076a53cdd2b55d10377ba60b7d
BLAKE2b-256 d601458954ec5a1757ed170c14131916e97f066823ca0bba6eff459d894ba5bb

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