Giter Site home page Giter Site logo

networkop / docker-topo Goto Github PK

View Code? Open in Web Editor NEW
137.0 19.0 41.0 2.38 MB

Docker topology builder for network simulations

License: BSD 3-Clause "New" or "Revised" License

Python 49.01% Shell 26.63% Dockerfile 2.26% HTML 22.09%
docker-topology-builder docker network simulation

docker-topo's Introduction

docker-topo

Docker network topology builder

Build Status

Supported images

  • Arista cEOS-lab
  • Arista vEOS-lab
  • Arista CVP
  • All vrnetlab images - experimental support, currently only tested with CSR1k, vMX and XRv.
  • User-defined docker images

Installation

With Python virtualenv (recommended)

python3 -m pip install virtualenv
python3 -m virtualenv testdir; cd testdir
source bin/activate 
pip install git+https://github.com/networkop/docker-topo.git

Without virtualenv

python3 -m pip install --upgrade --user git+https://github.com/networkop/docker-topo.git

Note: Python 2.x is not supported

Usage

# docker-topo -h
usage: docker-topo [-h] [-d] [--create | --destroy] [-s] [-a] topology

Tool to create cEOS topologies

positional arguments:
  topology       Topology file

optional arguments:
  -h, --help     show this help message and exit
  -d, --debug    Enable Debug

Actions:
  Create or destroy topology

  --create       Create topology
  --destroy      Destroy topology

Save:
  Save or archive the topology

  -s, --save     Save topology configs
  -a, --archive  Archive topology file and configs

Topology file

Topology file is a YAML file describing how docker containers are to be interconnected. This information is stored in the links variable which contains a list of links. Each link is described by a unique set of connected interfaces. There are several versions of topology file formats.

Topology file v1

This version is considered legacy and is documented here.

Topology file v2

Each link in a links array is a dictionary with the following format:

VERSION: 2
links:
  - endpoints:
      - "Device-A:Interface-2" 
      - "Device-B:Interface-1"
  - driver: macvlan
    driver_opts: 
      parent: wlp58s0
    endpoints: ["Device-A:Interface-1", "Device-B:Interface-2"]

Each link dictionary supports the following elements:

  • endpoints - the only mandatory element, contains a list of endpoints to be connected to a link.
  • driver - defines the link driver to be used. Currently supported drivers are veth, bridge, macvlan. When driver is not specified, default bridge driver is used. The following limitations apply:
    • macvlan driver will require a mandatory driver_opts object described below
    • veth driver is talking directly to netlink (no libnetwork involved) and making changes to namespaces
  • driver_opts - optional object containing driver options as required by Docker's libnetwork. Currently only used for macvlan's parent interface definition

Each link endpoint is encoded as "DeviceName:InterfaceName:IPPrefix" with the following contraints:

  • DeviceName determines which docker image is going to be used by (case-insensitive) matching of the following strings:
    • host - alpine-host image is going to be used
    • cvp - cvp image is going to be used
    • veos - Arista vEOS image built according to the procedure described here
    • vmx - Juniper vMX image built with vrnetlab
    • csr - Cisco CSR1000v image built with vrnetlab
    • xrv - Cisco IOS XRv image built with vrnetlab
    • For anything else Arista cEOS image will be used
  • InterfaceName must match the exact name of the interface you expect to see inside a container. For example if you expect to connect a link to DeviceA interface eth0, endpoint definition should be "DeviceA:eth0"
  • IPPrefix - Optional parameter that works ONLY for alpine-host devices and will attempt to configure a provided IP prefix inside a container.

Bridge vs veth driver caveats

Both bridge and veth driver have their own set of caveats. Keep them in mind when choosing a driver:

Features bridge veth
multipoint links supported not supported
sudo privileges not required required
docker modifications requires patched docker deamon uses standard docker daemon
L2 multicast only LLDP supported

You can mix both bridge and veth drivers in the same topology, however make sure that bridge driver links always come first, followed by the veth links. For example:

VERSION: 2
driver: veth

links:
  - endpoints: ["Leaf1:eth1", "Leaf2:eth1"]
    driver: 'bridge'
  - endpoints: ["Leaf1:eth2", "Leaf2:eth2"]
  - endpoints: ["Leaf1:eth3", "Leaf2:eth3"]

Note: You also need to specify the default eth0 intefaces for all endpoints given docker-topo does not create said interface whereas normal docker create does create this interface without defining.

macOS / OSX Support

Pyroute2 supports BSD as of 0.5.2, but veth drivers will not work in topology files.

Pyroute2 runs natively on Linux and emulates some limited subset of RTNL netlink API on BSD systems on top of PF_ROUTE notifications and standard system tools.

(Optional) Global variables

Along with the mandatory link array, there are a number of options that can be specified to override some of the default settings. Below are the list of options with their default values:

VERSION: 1  # Topology file version. Accepts [1|2]
CEOS_IMAGE: ceos:latest # cEOS docker image name
CONF_DIR: './config' # Config directory to store cEOS startup configuration files
PUBLISH_BASE: 8000 # Publish cEOS ports starting from this number
OOB_PREFIX: '192.168.100.0/24' # Only used when link contains CVP. This prefix is assinged to CVP's eth1
PREFIX: 'CEOS-LAB' # This will default to a topology filename (without .yml extension)
driver: None

All of the capitalised global variables can also be provided as environment variables with the following priority:

  1. Global variables defined in a topology file
  2. Global variables from environment variables
  3. Defaults

The final driver variable can be used to specify the default link driver for ALL links at once. This can be used to create all links with non-default veth type drivers:

VERSION: 2
driver: veth
links:
  - endpoints: ["host1:eth1", "host2:eth1"]
  - endpoints: ["host1:eth2", "host3:eth1"]

There should be several examples in the ./topo-extra-files/examples directory

(Optional) Exposing arbitrary ports

By default, PUBLISH_BASE will expose internal HTTPS (443/tcp) port of a container. It is possible to expose any number of internal ports for each container by defining PUBLISH_BASE in the following way:

PUBLISH_BASE:
  443/tcp: None # Will expose inside 443 to a random outside port
  22/tcp: 2000 # All containers will get their ports exposed starting from outside port 2000
  161/tcp: [127.0.0.1, 1600] # Similar to the above but only exposes ports on the defined local IP address

Note: topology file must have at least one interface of type bridge in order for PUBLISH_BASE to work.

(Optional) Saving and archiving network topologies

By default, docker-topo will pick up any files located in the CONF_DIR and, if the filename matches the PREFIX_DEVICENAME, will mount it inside the container as /mnt/flash/startup-config.

When the topology is running, there's a way to easily save the output of "show run" from each device inside the CONF_DIR to make them available on next reboot:

$ docker-topo -s topology.yml
Config directory exists, existing files may be overwritten. Continue? [y/n]:y
INFO:__main__:All configs saved in ./config

Archive option creates a tar.gz file with the CONF_DIR directory and the topology YAML file

$ docker-topo -a topology.yml
INFO:__main__:Archive file topo.tar.gz created
$ tar -tvf topo.tar.gz 
drwxr-xr-x root/root         0 2018-09-14 11:53 config/
-rw-r--r-- null/null       660 2018-09-11 15:08 topology.yml

(Optional) User-defined docker images

It is possible to create topology with arbitrary docker images. One such example is the openstack topology. Whenever a CUSTOM_IMAGE dictionary present, any device names that did not match against the well-known images (e.g. cEOS, vEOS, Host, VMX, CSR etc.), will be matched against the keys of this dictionary and, if match is found, the corresponding value will be used as an image. So in case the topology file has:

CUSTOM_IMAGE:
  search_key: docker_image

The docker-topo image matching logic will try to see if search_key in device_name.lower() and if True, will build a Generic device type with self.image == docker_image.

Example 1 - Creating a 2-node topology interconnected directly with veth links (without config)

+------+             +------+
|      |et1+-----+et2|      |
|cEOS 1|             |cEOS 2|
|      |et2+-----+et1|      |
+------+             +------+
sudo docker-topo --create topo-extra-files/examples/v2/2-node.yml

Example 2 - Creating a 3-node topology using the default docker bridge driver (with config)

+------+             +------+
|cEOS 1|et1+-----+et2|cEOS 2|
+------+             +------+
   et2                  et1
    +                    +
    |      +------+      |
    +--+et1|cEOS 3|et2+--+
           +------+

mkdir config
echo "hostname cEOS-1" > ./config/3-node_cEOS-1
echo "hostname cEOS-2" > ./config/3-node_cEOS-2
echo "hostname cEOS-3" > ./config/3-node_cEOS-3
docker-topo --create topo-extra-files/examples/v1-legacy/3-node.yml

List and connect to devices

# docker ps -a 
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                     PORTS                   NAMES
2315373f8741        ceosimage:latest    "/sbin/init"             About a minute ago   Up About a minute          0.0.0.0:9002->443/tcp   3-node_cEOS-3
e427def01f3a        ceosimage:latest    "/sbin/init"             About a minute ago   Up About a minute          0.0.0.0:9001->443/tcp   3-node_cEOS-2
f1a2ac8a904f        ceosimage:latest    "/sbin/init"             About a minute ago   Up About a minute          0.0.0.0:9000->443/tcp   3-node_cEOS-1


# docker exec -it 3-node_cEOS-1 Cli
cEOS-1>

Destroy a topology

docker-topo --destroy topo-extra-files/examples/3-node.yml

Troubleshooting

  • If you get the following error, try renaming the topology filename to a string shorter than 15 characters

    pyroute2.netlink.exceptions.NetlinkError: (34, 'Numerical result out of range')
    
  • CVP can't connect to cEOS devices - make sure that CVP is attached with at least two interfaces. The first one is always for external access and the second one if always for device management

docker-topo's People

Contributors

alexfeig avatar alexisdacquay avatar freedge avatar hansbogert avatar jorisc90 avatar networkop avatar romecode avatar ronmcmillian avatar ryanmerolle avatar svinota avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-topo's Issues

"Cannot pause container[uuid]: OCI runtime pause failed: unable to freeze: unknown"

Hi,
I am intermittently getting the above error when trying topologies such as the 5 node leaf-spine. I am using the latest ceos image.

I can run two nodes fine, but it seems once I get to 3-5 it seems to hit an issue. This makes me feel it is hitting a race condition where it tries to pause the container before it has fully been started.

Is this something others have hit before?

OSError: [Errno 47] Address family not supported by protocol family

Hi all.
I am getting a strange error when running docker-topo.

I am on MacOS HighSierra, Virtualenv + Python 3.7.
Installed via python setup.py install (inside the venv) as per your instructions.

Traceback (most recent call last):
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/bin/docker-topo", line 4, in <module>
    __import__('pkg_resources').run_script('docker-topo==2.0.2', 'docker-topo')
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pkg_resources/__init__.py", line 664, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1451, in run_script
    exec(script_code, namespace, namespace)
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 793, in <module>
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 687, in main
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 228, in parse_v2
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 585, in __init__
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 589, in get_or_create
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 606, in _get
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/docker_topo-2.0.2-py3.7.egg/EGG-INFO/scripts/docker-topo", line 536, in __init__
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/ipdb/main.py", line 900, in __init__
    self.initdb()
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/ipdb/main.py", line 965, in initdb
    self.nl = IPRoute(sndbuf=self._sndbuf, rcvbuf=self._rcvbuf)
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/iproute/linux.py", line 127, in __init__
    super(RTNL_API, self).__init__(*argv, **kwarg)
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/netlink/rtnl/iprsocket.py", line 29, in __init__
    all_ns=all_ns)
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/netlink/nlsocket.py", line 364, in __init__
    self.post_init()
  File "/Users/narnoldi/Projects/cEOS-Lab/testdir/lib/python3.7/site-packages/pyroute2/netlink/nlsocket.py", line 918, in post_init
    self._fileno)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 151, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 47] Address family not supported by protocol family

Ports do not get published

Hi,
I am trying to publish ports to the host from one container in my topology, but even though the docker-topo --create script appears to succeed, the port doesn't get published.

Here is the topology I am using:

VERSION: 2

CUSTOM_IMAGE:
      onos: onosproject/onos
PUBLISH_BASE:
      8181/tcp: 8383 # publish GUI port to host
#driver: veth
links:
    - endpoints: ["vmx-a1:eth0", "vmx-g1:eth0","vmx-b1:eth0","vmx-g2:eth0","onos:eth0"]
      driver: bridge

Acces to docker-top device's interfaces from localhost

Hey,
To simulate access to switch's management interfaces through a management network (OOB), is it possible to configure the switches to connect to a local bridge, so we could access their mngt interfaces from the host?

I already have CVP latest version running on my host and I would like it to manage docker-topo devices.
Thanks.

OSError: [Errno 22] failed to open netns using veth interfaces (Fedora 18 host)

I'm using the topo-extra-files/examples/v2/3-node.ymlsample file. The host is Fedora 18 with a 4.9.76 kernel. I can use the bridge driver to get around this issue for now, it seems.

Here's the last part of docker-topo --debug --create topo-extra-files/examples/v2/3-node.yml

DEBUG:__main__: Attaching container 3-node_cEOS-1 interface eth1 to its link
DEBUG:__main__: Connecting veth-type link to 3-node_cEOS-1
DEBUG:__main__:Connecting 3-node_net-1-a to 3-node_cEOS-1
DEBUG:__main__:Create an interface for container 3-node_cEOS-1: {'ifname': 'eth1', 'stats': None, 'protinfo': None, 'map': None, 'linkinfo': None, 'stats64': None, 'af_spec': None, 'net_ns_fd': 30, 'event': None, 'flags': 4099, '-ports': set(), '+ports': set(), '-ipaddr': set(), '+ipaddr': set(), '-vlans': set(), '+vlans': set()}
Traceback (most recent call last):
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 840, in <module>
    main()
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 775, in main
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 775, in <listcomp>
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 354, in start
    self._attach()
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 371, in _attach
    link.connect(self, interface)
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 659, in connect
    self.network.connect(device, interface)
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 601, in connect
    with IPDB(nl=NetNS(ns_name)) as ns:
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/netns/nslink.py", line 170, in __init__
    super(NetNS, self).__init__(trnsp_in, trnsp_out)
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/iproute/linux.py", line 127, in __init__
    super(RTNL_API, self).__init__(*argv, **kwarg)
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/remote/__init__.py", line 200, in __init__
    raise init['error']
OSError: [Errno 22] failed to open netns: 'e5df19bfe142'

Full log: debug.txt

I also confirmed that e5df19bfe142 existed as /var/run/docker/netns/e5df19bfe142

found unexpected end of stream

I get an error that says "found unexpected end of stream" when it reads through the YAML. It could be a problem with my setup but it worked before with the same YAML file but different cEOS image.

Any ideas? Did anything change? Thanks!

sureshk$ cat 3-node.yml
VERSION: 2
driver: bridge
PREFIX: ARISTA
CONF_DIR: ./config
CEOS_IMAGE: ceosimage:4.23.2F
PUBLISH_BASE: 4000

links:

  • endpoints: ["spine-A:eth1", "spine-B:eth2"]
  • endpoints: ["spine-A:eth2", "TOR-A:eth1"]
  • endpoints: ["spine-B:eth1", "TOR-A:eth2”]
    sureshk$

sureshk$ docker-topo --create 3-node.yml
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/docker-topo", line 812, in
main()
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/docker-topo", line 669, in main
t_yml = yaml.load(stream)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/init.py", line 72, in load
return loader.get_single_data()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/constructor.py", line 35, in get_single_data
node = self.get_single_node()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 82, in compose_node
node = self.compose_sequence_node(anchor)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 111, in compose_sequence_node
node.value.append(self.compose_node(node, index))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
item_value = self.compose_node(node, item_key)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 82, in compose_node
node = self.compose_sequence_node(anchor)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/composer.py", line 110, in compose_sequence_node
while not self.check_event(SequenceEndEvent):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/parser.py", line 486, in parse_flow_sequence_entry
if self.check_token(KeyToken):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 248, in fetch_more_tokens
return self.fetch_double()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 652, in fetch_double
self.fetch_flow_scalar(style='"')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 663, in fetch_flow_scalar
self.tokens.append(self.scan_flow_scalar(style))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 1148, in scan_flow_scalar
chunks.extend(self.scan_flow_scalar_spaces(double, start_mark))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yaml/scanner.py", line 1235, in scan_flow_scalar_spaces
"found unexpected end of stream", self.get_mark())
yaml.scanner.ScannerError: while scanning a quoted scalar
in "/Users/sureshk/Automation/ceos/3-node.yml", line 11, column 33
found unexpected end of stream
in "/Users/sureshk/Automation/ceos/3-node.yml", line 12, column 1
sureshk$

SSH port mapping

Could you consider SSH port-mapping based on specific requirements to manage cEOS instances?

More examples

Please details the v2 links format with a more complex topology than 1-to-1. Could you use a 3-devices example?

SNMP port mapping

Thanks for providing cEOS-lab docker image and topology tool. Please consider adding support for publishing snmp port.

macOS python3 cannot import name 'NetNS'

docker-top -h Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/docker-topo", line 13, in <module> from pyroute2 import NetNS ImportError: cannot import name 'NetNS' from 'pyroute2' (/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyroute2/__init__.py)

pyroute2 is installed via pip3 and so is docker-topo on this macOS 10.14.14 machine. It seems like it works if you change the import to use 'netns' from 'pyroute2 '

CVP not executing entrypoint.sh

I used cvp-in-docker build commands; if I run the container from bash all seems well. However, using the docker-topo CVP declarations in endpoints, once instantiated, the entrypoint script is ignored and the cvp domain is never built.

Any ideas?

virsh not finding domain

Installed virt-manager via this method on mac: https://github.com/jeffreywildman/homebrew-virt-manager

Install looks fine:

 ./build.sh
chmod: /dev/kvm: No such file or directory
docker build -t cvp .
Sending build context to Docker daemon  5.234GB
Step 1/10 : FROM centos:latest
 ---> 9f38484d220f
Step 2/10 : RUN yum -y install epel-release &&     yum makecache fast
 ---> Using cache
 ---> 34755f9162bf
Step 3/10 : RUN yum install -y qemu-kvm bridge-utils iproute libvirt libvirt-client     && yum install -y python-pip openssh genisoimage net-tools ethtool     && pip install pyaml     && yum clean all
 ---> Using cache
 ---> c23273decaea
Step 4/10 : ADD cvp.tgz /tmp
 ---> Using cache
 ---> 49cc8c56c3ea
Step 5/10 : ADD cvp-tools.tgz /tmp
 ---> Using cache
 ---> 3c1bd25dd336
Step 6/10 : COPY answers.yaml /tmp
 ---> Using cache
 ---> d7f5b6baee8e
Step 7/10 : COPY entrypoint.sh /
 ---> Using cache
 ---> 1ec23a4c6a93
Step 8/10 : RUN chmod +x /entrypoint.sh
 ---> Using cache
 ---> 5e16376fe5b2
Step 9/10 : ENTRYPOINT ["/entrypoint.sh"]
 ---> Using cache
 ---> 377859e5573a
Step 10/10 : CMD ["192.168.200.254", "255.255.255.0"]
 ---> Using cache
 ---> 8c19d7c54f5e
Successfully built 8c19d7c54f5e
Successfully tagged cvp:latest

THen

docker run -d --name cvp --privileged cvp
f073c18f3f1cdd62447ebc06c619a503fac061fe3834bcc3b4c83bbae04829f9
(testdir) Christians-MacBook-Pro-2:cvp christian$ docker exec -it cvp bash
[root@f073c18f3f1c /]# 

But..

virsh console cvp
error: failed to get domain 'cvp'
error: Domain not found: no domain with matching name 'cvp'

Same from within container and host OS. It seems like I'm missing something super obvious.?

Can't reload

Leaf-1#reload now
% Unavailable command (not supported on this hardware platform)

When I try a reload it doesn't go through using the latest cEOS image.

Do you know what image would allow me to do this. I'm trying to test the ZTP functionality using virtual devices.

cannot start paused container (start vs unpause)

Hi,
Is "unpause" something new the script must adapt to, or am I doing something wrong?

(testdir) arista@arista-vm-001:~/testdir$ docker-topo --create topo-extra-files/examples/v2/5-node-ls.yml 
INFO:__main__:Version 2 requires sudo. Restarting script with sudo
Traceback (most recent call last):
  File "/home/arista/testdir/bin/docker-topo", line 625, in <module>
    main()
  File "/home/arista/testdir/bin/docker-topo", line 590, in main
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/arista/testdir/bin/docker-topo", line 590, in <listcomp>
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/arista/testdir/bin/docker-topo", line 280, in start
    self._attach()
  File "/home/arista/testdir/bin/docker-topo", line 297, in _attach
    link.connect(self, interface)
  File "/home/arista/testdir/bin/docker-topo", line 489, in connect
    self.network.connect(device, interface)
  File "/home/arista/testdir/bin/docker-topo", line 421, in connect
    self._create()
  File "/home/arista/testdir/bin/docker-topo", line 412, in _create
    return self.ipdb.create(ifname=self.sideA, kind='veth', peer=self.sideB).commit()
  File "/home/arista/testdir/lib/python3.6/site-packages/pyroute2/ipdb/interfaces.py", line 583, in commit
    self.nl.link('add', **request)
  File "/home/arista/testdir/lib/python3.6/site-packages/pyroute2/iproute.py", line 1310, in link
    msg_flags=msg_flags)
  File "/home/arista/testdir/lib/python3.6/site-packages/pyroute2/netlink/nlsocket.py", line 825, in nlm_request
    return do_try()
  File "/home/arista/testdir/lib/python3.6/site-packages/pyroute2/netlink/nlsocket.py", line 804, in do_try
    callback=callback)
  File "/home/arista/testdir/lib/python3.6/site-packages/pyroute2/netlink/nlsocket.py", line 649, in get
    raise msg['header']['error']
pyroute2.netlink.exceptions.NetlinkError: (34, 'Numerical result out of range')
(testdir) arista@arista-vm-001:~/testdir$ sudo docker-topo --create topo-extra-files/examples/v2/5-node-ls.yml 
sudo: docker-topo: command not found
(testdir) arista@arista-vm-001:~/testdir$ sudo docker-topo --create topo-extra-files/examples/v2/5-node-ls.yml 
sudo: docker-topo: command not found
(testdir) arista@arista-vm-001:~/testdir$ docker-topo --create topo-extra-files/examples/v2/5-node-ls.yml 
INFO:__main__:Version 2 requires sudo. Restarting script with sudo
Traceback (most recent call last):
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/api/client.py", line 229, in _raise_for_status
    response.raise_for_status()
  File "/home/arista/testdir/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localhost/v1.35/containers/c2f9479a5ee20226fd24491302d0a6948c382548d6bf254352f00b6ab43fa736/start

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arista/testdir/bin/docker-topo", line 625, in <module>
    main()
  File "/home/arista/testdir/bin/docker-topo", line 590, in main
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/arista/testdir/bin/docker-topo", line 590, in <listcomp>
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/arista/testdir/bin/docker-topo", line 273, in start
    self.container.start()
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/models/containers.py", line 374, in start
    return self.client.api.start(self.id, **kwargs)
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/api/container.py", line 1064, in start
    self._raise_for_status(res)
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/api/client.py", line 231, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/home/arista/testdir/lib/python3.6/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 409 Client Error: Conflict ("cannot start a paused container, try unpause instead")
(testdir) arista@arista-vm-001:~/testdir$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                       PORTS                   NAMES
c2f9479a5ee2        ceosimage:latest    "/sbin/init"        About a minute ago   Up About a minute (Paused)   0.0.0.0:9003->443/tcp   5-node-ls_Spine-1
(testdir) arista@arista-vm-001:~/testdir$ sudo docker start c2f9479a5ee2
Error response from daemon: cannot start a paused container, try unpause instead
Error: failed to start containers: c2f9479a5ee2
(testdir) arista@arista-vm-001:~/testdir$ docker -v
Docker version 18.06.0-ce, build 0ffa825
(testdir) arista@arista-vm-001:~/testdir$ 
(testdir) arista@arista-vm-001:~/testdir$ cat topo-extra-files/examples/v2/5-node-ls.yml 
links:
  - endpoints: ["Spine-1:eth0", "Spine-2:eth0", "Leaf-1:eth0", "Leaf-2:eth0", "Leaf-3:eth0"]
    driver: bridge
  - endpoints: ["Spine-1:eth1", "Leaf-1:eth1"]
  - endpoints: ["Spine-1:eth2", "Leaf-2:eth1"]
  - endpoints: ["Spine-1:eth3", "Leaf-3:eth1"]
  - endpoints: ["Spine-2:eth1", "Leaf-1:eth2"]
  - endpoints: ["Spine-2:eth2", "Leaf-2:eth2"]
  - endpoints: ["Spine-2:eth3", "Leaf-3:eth2"]

VERSION: 2
driver: veth
PREFIX: 5-node-ls
CONF_DIR: ./config
CEOS_IMAGE: ceosimage:latest
PUBLISH_BASE: 9000
(testdir) arista@arista-vm-001:~/testdir$ sudo docker info
Containers: 1
 Running: 0
 Paused: 1
 Stopped: 0
Images: 1
Server Version: 18.06.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d64c661f1d51c48782c9cec8fda7604785f93587
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.15.0-23-generic
Operating System: Ubuntu 18.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 125.9GiB
Name: arista-vm-001
ID: BCLN:AZKL:J3WW:EZZT:T5OL:7X7Q:UPJO:UYIB:XHH3:SJPV:OBDJ:JETC
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
(testdir) arista@arista-vm-001:~/testdir$ 


pyroute2: no IPRoute module for the platform on macOS Mojave 10.14.3

When using requirements included in setup.py generate an error when trying to run docker-topo on a macOS platform (Mojave 10.14.3). Below are some notes:

Installation without virtualenv using pip3

$ pip3 install git+https://github.com/networkop/docker-topo.git --user
Collecting git+https://github.com/networkop/docker-topo.git
  Cloning https://github.com/networkop/docker-topo.git to /private/var/folders/bj/x0pdlg4s46vbk9t8916xkfb00000gn/T/pip-req-build-fidxsnb6
Requirement already satisfied (use --upgrade to upgrade): docker-topo==2.0.2 from git+https://github.com/networkop/docker-topo.git in /usr/local/lib/python3.7/site-packages
Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/site-packages (from docker-topo==2.0.2) (3.13)
Requirement already satisfied: docker in /usr/local/lib/python3.7/site-packages (from docker-topo==2.0.2) (3.7.0)
Requirement already satisfied: netaddr in /usr/local/lib/python3.7/site-packages (from docker-topo==2.0.2) (0.7.19)
Requirement already satisfied: pyroute2==0.5.2 in /usr/local/lib/python3.7/site-packages (from docker-topo==2.0.2) (0.5.2)
Requirement already satisfied: docker-pycreds>=0.4.0 in /usr/local/lib/python3.7/site-packages (from docker->docker-topo==2.0.2) (0.4.0)
Requirement already satisfied: requests!=2.18.0,>=2.14.2 in /usr/local/lib/python3.7/site-packages (from docker->docker-topo==2.0.2) (2.21.0)
Requirement already satisfied: websocket-client>=0.32.0 in /usr/local/lib/python3.7/site-packages (from docker->docker-topo==2.0.2) (0.54.0)
Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python3.7/site-packages (from docker->docker-topo==2.0.2) (1.12.0)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests!=2.18.0,>=2.14.2->docker->docker-topo==2.0.2) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests!=2.18.0,>=2.14.2->docker->docker-topo==2.0.2) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests!=2.18.0,>=2.14.2->docker->docker-topo==2.0.2) (3.0.4)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests!=2.18.0,>=2.14.2->docker->docker-topo==2.0.2) (1.24.1)
Building wheels for collected packages: docker-topo
  Running setup.py bdist_wheel for docker-topo ... done
  Stored in directory: /private/var/folders/bj/x0pdlg4s46vbk9t8916xkfb00000gn/T/pip-ephem-wheel-cache-l39eoe83/wheels/2d/13/44/613210af05f2abcdc58fdcc3ae040cd2fe8ccb398deff1859d
Successfully built docker-topo

Error message is related to pyroute2 and IPRoute

$ docker-topo -h
Traceback (most recent call last):
  File "/usr/local/bin/docker-topo", line 11, in <module>
    from pyroute2 import IPDB
  File "/usr/local/lib/python3.7/site-packages/pyroute2/__init__.py", line 19, in <module>
    from pyroute2.iproute import (IPRoute,
  File "/usr/local/lib/python3.7/site-packages/pyroute2/iproute/__init__.py", line 141, in <module>
    raise ImportError('no IPRoute module for the platform')
ImportError: no IPRoute module for the platform

Python3 modules are:

$ pip3 list
Package          Version
---------------- ----------
certifi          2018.11.29
chardet          3.0.4
docker           3.7.0
docker-pycreds   0.4.0
docker-topo      2.0.2
idna             2.8
netaddr          0.7.19
pip              18.1
pyroute2         0.5.2
PyYAML           3.13
requests         2.21.0
setuptools       40.6.3
six              1.12.0
urllib3          1.24.1
websocket-client 0.54.0
wheel            0.32.3

After upgrading pyroute2 from 0.5.2 to latest (0.5.3), docker-topo can start as expected:

$ pip3 install --upgrade pyroute2
Collecting pyroute2
  Downloading https://files.pythonhosted.org/packages/19/1c/fc2efd9dfa5c1f7f713dbfee621365ad01f7b7ec0a6908e444f08bfd5873/pyroute2-0.5.3.tar.gz (687kB)
    100% |████████████████████████████████| 696kB 2.2MB/s
Building wheels for collected packages: pyroute2
  Running setup.py bdist_wheel for pyroute2 ... done
  Stored in directory: /Users/tgrimonet/Library/Caches/pip/wheels/3a/8d/19/a02a0af7742b48122d4ee7aa1f5ae9fa4833ec6043fc74052b
Successfully built pyroute2
docker-topo 2.0.2 has requirement pyroute2==0.5.2, but you'll have pyroute2 0.5.3 which is incompatible.
Installing collected packages: pyroute2
  Found existing installation: pyroute2 0.5.2
    Uninstalling pyroute2-0.5.2:
      Successfully uninstalled pyroute2-0.5.2
Successfully installed pyroute2-0.5.3

$ docker-topo -h

usage: docker-topo [-h] [-d] [--create | --destroy] [-s] [-a] topology

Tool to create cEOS topologies

positional arguments:
  topology       Topology file

optional arguments:
  -h, --help     show this help message and exit
  -d, --debug    Enable Debug

Actions:
  Create or destroy topology

  --create       Create topology
  --destroy      Destroy topology

Save:
  Save or archive the topology

  -s, --save     Save topology configs
  -a, --archive  Archive topology file and configs

Version 2 requires sudo and credentials.

I have followed the steps on this repo and when I try to create a topology I get this:

❯ docker-topo --create 3-node.yml
INFO:__main__:Version 2 requires sudo. Restarting script with sudo
sudo: setrlimit(RLIMIT_STACK): Invalid argument
Password:
Sorry, try again

Prompting me for a password that I don't know. I have looked but I don't find it in any place.
I changed the yml file to use version 1 and then I still get the prompt for credentials but the devices at least run, although the links between then are missing.
This is the configuration file for version 2:

links:
  - endpoints: ["cEOS-1:eth0", "cEOS-2:eth0", "cEOS-3:eth0"]
    driver: bridge
  - endpoints: ["cEOS-1:eth1", "cEOS-2:eth2"]
  - endpoints: ["cEOS-1:eth2", "cEOS-3:eth1"]
  - endpoints: ["cEOS-2:eth1", "cEOS-3:eth2"]

VERSION: 2
driver: veth
PREFIX: 3-node
CONF_DIR: ./config
CEOS_IMAGE: ceosimage1:latest
PUBLISH_BASE: 9000

For version 1 is the same file changing the line VERSION: 1
Thanks.

Option to add notconnected interfaces

It would be nice if docker-topo had an option to create not connected interfaces to a container.

I'd think this could be implemented e.g. using a driver_opt = notconnected or driver = notconnected.

Reason for this feature is to simulate non-complete networks, while still being able to do complete configuration simulation. I've seen configurations of mpoint networks using veth as driver, resulting in a lot of veth connections that could result in unexpected data-plane behavior.

For now the workaround is to use the macvlan driver and connect to an not-connected interface - I guess this is okay but not really the "nice" way.

config not loaded for v2

Creating the v2/3-node.yml does not seem to load a config in ./config/3-node_cEOS-1 for example

steps to come to above conclusion:

docker ps                                  
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                                 NAMES
35007ac414f2        ceosimage:latest       "/sbin/init"             13 minutes ago      Up 13 minutes       0.0.0.0:9002->443/tcp                 3-node_cEOS-3
ed4f4d1707a6        ceosimage:latest       "/sbin/init"             13 minutes ago      Up 13 minutes       0.0.0.0:9001->443/tcp                 3-node_cEOS-2
e95cd1ca1711        ceosimage:latest       "/sbin/init"             13 minutes ago      Up 13 minutes       0.0.0.0:9000->443/tcp                 3-node_cEOS-1
(testdir)  hvdb@hvdb-ThinkPad-T480s  ~/src/testdir  grep -R 3-node_cEOS-1 config               
(testdir)  ✘ hvdb@hvdb-ThinkPad-T480s  ~/src/testdir  find . |grep  3-node_cEOS-1       
./config/3-node_cEOS-1
(testdir)  hvdb@hvdb-ThinkPad-T480s  ~/src/testdir  docker exec -ti 3-node_cEOS-1 ls -alh /mnt/flash
total 96K
drwxrwxr-x+ 1 root root 4.0K Jun 29 19:15 .
drwxr-xr-x  1 root root 4.0K Jun 16 03:18 ..
-rw-rw-rw-+ 1 root root    0 Jun 29 19:14 .assetTags
drwxrwxr-x+ 2 root root 4.0K Jun 29 19:14 .checkpoints
drwxrwx---+ 2 root root 4.0K Jun 29 19:14 .extensions
-rw-rwxr--+ 1 root root  231 Jun 29 19:13 AsuFastPktTransmit.log
drwxr-xr-x+ 2 root root 4.0K Jun 29 19:13 Fossil
-rw-rwxr--+ 1 root root  142 Jun 29 19:13 SsuRestore.log
-rw-rwxr--+ 1 root root  142 Jun 29 19:13 SsuRestoreLegacy.log
drwxrwx---+ 3 root root 4.0K Jun 29 19:13 debug
drwxrwxr-x+ 2 root root 4.0K Jun 29 19:13 fastpkttx.backup
-rw-rw-r--+ 1 root root  460 Jun 29 19:13 kickstart-config
drwxrwxr-x+ 3 root root 4.0K Jun 29 19:24 persist
drwxrwxr-x+ 3 root root 4.0K Jun 29 19:15 schedule
-rw-rwx---+ 1 root root   13 Jun 16 03:18 zerotouch-config

trunk between cEOS instances not working

I'm trying to get a simple topology to work

  1. Two cEOS connected to each other with a trunk
  2. Each has a host connected with access port 100

I expect them to be able to communicate

What I see, when using Wireshark on the connection between the cEOSs is ARP requests between the hosts, which are correctly tagged with vlan 100.

See attached tar
twoq.tar.gz

docker-topo crash when running bridge driver

Hi, I've been experimenting with this topology builder and it's working well using veth connections.
Now I'd like to expose port 22 so I could ssh into the ma1 ceos interfaces. I've read that for this I need to use bridge interfaces. After creating those it looks like the docker-topo is crushing. Could you please have a look? Thank you, Mat

`[mkurjanski@netopslab1 ceos-lab]$ cat topo2
VERSION: 2
CONF_DIR: './config'
PUBLISH_BASE:
22/tcp: 2000
#driver: veth
links:

  • endpoints: ["ceos1:eth11", "ceos2:eth11"]
  • endpoints: ["ceos1:ma1", "ceos2:ma1"]

[mkurjanski@netopslab1 ceos-lab]$ sudo docker-topo topo2
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/docker/api/client.py", line 222, in _raise_for_status
response.raise_for_status()
File "/usr/lib/python3.4/site-packages/requests/models.py", line 893, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localunixsocket/v1.30/networks/create

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/bin/docker-topo", line 703, in
main()
File "/bin/docker-topo", line 602, in main
devices, links = parse_v2(t_yml)
File "/bin/docker-topo", line 216, in parse_v2
link = Link(link_type, 'net-{}'.format(idx), link_driver, driver_opts)
File "/bin/docker-topo", line 511, in init
self.get_or_create()
File "/bin/docker-topo", line 517, in get_or_create
self.network = self._create()
File "/bin/docker-topo", line 526, in _create
options=self.opts
File "/usr/lib/python3.4/site-packages/docker/models/networks.py", line 153, in create
resp = self.client.api.create_network(name, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/docker/utils/decorators.py", line 34, in wrapper
return f(self, *args, **kwargs)
File "/usr/lib/python3.4/site-packages/docker/api/network.py", line 154, in create_network
return self._result(res, json=True)
File "/usr/lib/python3.4/site-packages/docker/api/client.py", line 228, in _result
self._raise_for_status(response)
File "/usr/lib/python3.4/site-packages/docker/api/client.py", line 224, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/lib/python3.4/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("Failed to Setup IP tables: Unable to enable SKIP DNAT rule: (iptables failed: iptables --wait -t nat -I DOCKER -i br-c744d61204ff -j RETURN: iptables: No chain/target/match by that name.
(exit status 1))")
`

Containerized vEOS ignores interface names in topology file.

When running ceos with named veth interfaces in the topology file, switches come up with the correct interface names/numbers. When running containerized veos built using the procedure here, the interfaces are listed numerically beginning with ethernet1.

Topology file here

Expected Behavior: (Taken from a ceos environment with the above topology)

ch2-csw-01#sh int status
Port       Name                                 Status       Vlan        Duplex Speed  Type            Flags Encapsulation
Et49       CH2-ASW-01 Access (leaf) Switch      notconnect   routed      full   unconf EbraTestPhyPort
Et50       CH2-ASW-02 Access (leaf) Switch      connected    routed      full   unconf EbraTestPhyPort
Et51       CH2-PSW-1 Peer Access (leaf) Switch  connected    trunk       full   unconf EbraTestPhyPort
Et52       CH2-PSW-02 Peer Access (leaf) Switch connected    trunk       full   unconf EbraTestPhyPort
Re627                                           notconnect   Not bridged full   unconf N/A

Observed Behavior: (Taken from a containerized veos environment with the same topology)

ch2-csw-01#sh int status
Port       Name                                                            Status       Vlan        Duplex Speed  Type            Flags Encapsulation
Et1        NY4-CSW-01 Level3 WAN Link                                      errdisabled  routed      full   unconf EbraTestPhyPort
Et2                                                                        connected    1           full   unconf EbraTestPhyPort
Et3                                                                        disabled     1           full   unconf EbraTestPhyPort
Et4                                                                        connected    1           full   unconf EbraTestPhyPort
Et5        ch2-fw-01:ethernet1/1 trunked interface for intra-vlan firewall connected    trunk       full   unconf EbraTestPhyPort
Ma1                                                                        connected    routed      a-full a-1G   10/100/1000
Re627                                                                      notconnect   Not bridged full   unconf N/A

Target ifname is not set with docker-topo --create

Hi Michael!
Please give me a hand with the debugging the following issue.
I am trying to emulate a part or better a slice of our production network. I created topology with 1 spine and 16 superspines and due to the presence of LACP and other l2 multicast I use veth.
I encountered two issues so far.

  1. One is described here #15
    In my case it happened next run after docker-topo failed. As far as I understood this is due to interface docker-topo is trying to create already exists in a dom0 host. I have to clean all interfaces manually. At the same time I have active eth2 interface on a host so I have to change it in topology. This issue is not a stopper, just wanted to mention it here
  2. But the second one breaks script and topology. At any point of time I get:
    pyroute2.ipdb.exceptions.CommitException: target ifname is not set
    Here there are some outputs from --debug:
DEBUG:__main__:	Starting container test2_vla-9x3
DEBUG:__main__:	Obtaining a pointer to container test2_vla-9x3
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.35/containers/test2_vla-9x3/json HTTP/1.1" 404 47
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.35/containers/create?name=test2_vla-9x3 HTTP/1.1" 201 90
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.35/containers/ab91cd4703bbd703d14afd6a1bc8482157f0fe2b300b07b56123dab951645b84/json HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.35/containers/ab91cd4703bbd703d14afd6a1bc8482157f0fe2b300b07b56123dab951645b84/start HTTP/1.1" 204 0
DEBUG:urllib3.connectionpool:http://localhost:None "GET /v1.35/containers/test2_vla-9x3/json HTTP/1.1" 200 None
DEBUG:__main__:	PID for container test2_vla-9x3 is 17278
DEBUG:__main__:	Sandbox key for container test2_vla-9x3 is 17278
DEBUG:urllib3.connectionpool:http://localhost:None "POST /v1.35/containers/ab91cd4703bbd703d14afd6a1bc8482157f0fe2b300b07b56123dab951645b84/pause HTTP/1.1" 204 0
DEBUG:__main__:	Attaching container test2_vla-9x3 interface eth13 to its link
DEBUG:__main__:	Connecting veth-type link to test2_vla-9x3
DEBUG:__main__:Connecting test2_net-17-b to test2_vla-9x3
DEBUG:__main__:Create an interface for container test2_vla-9x3: {'ifname': 'eth13', 'stats': None, 'protinfo': None, 'map': None, 'linkinfo': None, 'stats64': None, 'af_spec': None, 'net_ns_fd': 444, 'event': None, 'flags': 4099, '-ports': set(), '+ports': set(), '-ipaddr': set(), '+ipaddr': set(), '-vlans': set(), '+vlans': set()}
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=15 qsize=17 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=12 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=13 qsize=13 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=13 qsize=13 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=17 qsize=19 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=14 qsize=19 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=19 delay=0.01
Traceback (most recent call last):
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=17 qsize=18 delay=0.01
  File "/home/v0lk/testdir/bin/docker-topo", line 840, in <module>
    main()
  File "/home/v0lk/testdir/bin/docker-topo", line 775, in main
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=17 qsize=19 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=19 qsize=19 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=17 qsize=19 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=17 qsize=19 delay=0.01
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/v0lk/testdir/bin/docker-topo", line 775, in <listcomp>
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=20 delay=0.01
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/v0lk/testdir/bin/docker-topo", line 354, in start
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=11 qsize=20 delay=0.01
    self._attach()
  File "/home/v0lk/testdir/bin/docker-topo", line 371, in _attach
    link.connect(self, interface)
  File "/home/v0lk/testdir/bin/docker-topo", line 657, in connect
    self.network.connect(device, interface)
  File "/home/v0lk/testdir/bin/docker-topo", line 591, in connect
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=20 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=20 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=20 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=21 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=13 qsize=21 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=21 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=11 qsize=21 delay=0.01
    LOG.debug("Create an interface for container {}: {}".format(device.name, i.review()))
  File "/home/v0lk/testdir/lib/python3.6/site-packages/pyroute2/ipdb/transactional.py", line 209, in __exit__
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=12 qsize=24 delay=0.01
    self.commit()
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=14 qsize=26 delay=0.01
  File "/home/v0lk/testdir/lib/python3.6/site-packages/pyroute2/ipdb/interfaces.py", line 1071, in commit
    raise error
  File "/home/v0lk/testdir/lib/python3.6/site-packages/pyroute2/ipdb/interfaces.py", line 852, in commit
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=13 qsize=26 delay=0.01
DEBUG:pyroute2.netlink.nlsocket:Packet burst: delta=13 qsize=26 delay=0.01
    transaction.wait_all_targets()
  File "/home/v0lk/testdir/lib/python3.6/site-packages/pyroute2/ipdb/transactional.py", line 507, in wait_all_targets
    raise CommitException('target %s is not set' % key)
pyroute2.ipdb.exceptions.CommitException: target ifname is not set

I tried multiple times and got the same error for the same interface.
I attached my topology file as a reference.
Feel free to contact if you have any related question or need to test something.
Regards, Alex.
v0lk-topology.txt

implement a --save option

Save option should take a snapshot of current device configuration and save it in a directory.

docker-topo --save topology directory

The above should find all cEOS devices and capture the output of

docker exec -it topo_device Cli -p 15 -c "show run" 

which is later saved in

./directory/device

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.