├── .gitignore ├── configs └── .placeholder ├── scripts └── .placeholder ├── topologies └── .placeholder ├── requirements.txt ├── images ├── linux.jpg ├── linux.png └── switch.png ├── topo-build.sh ├── .devcontainer ├── Dockerfile └── devcontainer.json ├── examples └── topologies │ ├── atd.yaml │ ├── l2.yaml │ ├── ratd.yaml │ └── l3.yaml ├── Readme.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .history 2 | -------------------------------------------------------------------------------- /configs/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /topologies/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ruamel.yaml 2 | graphviz 3 | pydot 4 | jsonrpclib 5 | -------------------------------------------------------------------------------- /images/linux.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/networkRob/rLab-eos/HEAD/images/linux.jpg -------------------------------------------------------------------------------- /images/linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/networkRob/rLab-eos/HEAD/images/linux.png -------------------------------------------------------------------------------- /images/switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/networkRob/rLab-eos/HEAD/images/switch.png -------------------------------------------------------------------------------- /topo-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while getopts t:s:r: option 4 | do 5 | case "${option}" 6 | in 7 | t) TOPO=${OPTARG};; 8 | s) FLAG=true;; 9 | r) RUNTIME=${OPTARG};; 10 | esac 11 | done 12 | 13 | YELLOW='\033[1;33m' 14 | NC='\033[0m' 15 | 16 | # Check for runtime flag 17 | if [ -z "$RUNTIME" ] 18 | then 19 | RUNTIME="docker" 20 | fi 21 | 22 | #topobuilder 23 | echo -e "${YELLOW}Building topo: $TOPO${NC}\n" 24 | if [[ $FLAG == true ]]; 25 | then 26 | build/topo-builder.py -t $TOPO -s -r $RUNTIME 27 | else 28 | build/topo-builder.py -t $TOPO -r $RUNTIME 29 | fi 30 | 31 | 32 | echo -e "${YELLOW}DONE: Building topo: $TOPO${NC}\n" 33 | 34 | echo "" 35 | echo -e "${YELLOW}Building diagram for topo: $TOPO${NC}\n" 36 | #yamlviz 37 | build/yamlviz.py -t $TOPO 38 | echo -e "${YELLOW}DONE: Building diagram for topo: $TOPO${NC}\n" 39 | 40 | # don't forget to update the README 41 | # don't forget to update requirements.txt -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.10 2 | 3 | RUN apt update \ 4 | && apt install -y man-db sudo vim git \ 5 | zip cloc zsh zsh-syntax-highlighting \ 6 | zsh-doc less software-properties-common \ 7 | graphviz 8 | 9 | ARG USERNAME=dev 10 | ARG USER_UID=1000 11 | ARG USER_GID=$USER_UID 12 | ARG CONTAINERWS="/workspaces" 13 | 14 | # Create the user 15 | RUN groupadd --gid $USER_GID $USERNAME \ 16 | && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ 17 | # 18 | # [Optional] Add sudo support. Omit if you don't need to install software after connecting. 19 | && apt-get update \ 20 | && apt-get install -y sudo \ 21 | && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ 22 | && chmod 0440 /etc/sudoers.d/$USERNAME 23 | 24 | RUN pip install --upgrade pip 25 | 26 | RUN pip install autopep8 ruamel.yaml pylint graphviz pydot jsonrpclib 27 | 28 | # Install GitHub CLI 29 | RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 30 | 31 | RUN apt-add-repository https://cli.github.com/packages 32 | 33 | RUN apt update && apt install -y gh 34 | 35 | USER $USERNAME 36 | 37 | RUN cd ~/ && wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh && sh install.sh --unattended && rm install.sh 38 | 39 | # Persist session history 40 | 41 | RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=$CONTAINERWS/.history" \ 42 | && echo $SNIPPET >> "/home/$USERNAME/.zshrc" 43 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.117.1/containers/docker-existing-dockerfile 3 | { 4 | "name": "rLab-EOS", 5 | 6 | // Sets the run context to one level up instead of the .devcontainer folder. 7 | "context": "..", 8 | 9 | // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. 10 | "dockerFile": "Dockerfile", 11 | // Set *default* container specific settings.json values on container create. 12 | "settings": { 13 | "terminal.integrated.profiles.linux": { 14 | "zsh (login)": { 15 | "path": "zsh", 16 | "args": ["-l"] 17 | } 18 | }, 19 | "terminal.integrated.defaultProfile.linux": "zsh (login)" 20 | }, 21 | // "containerEnv": { 22 | // }, 23 | "build": { 24 | "args": { 25 | "CONTAINERWS": "${containerWorkspaceFolder}", 26 | }, 27 | }, 28 | // Add the IDs of extensions you want installed when the container is created. 29 | "extensions": [ 30 | "redhat.vscode-yaml", 31 | "ms-python.python", 32 | "ms-azuretools.vscode-docker", 33 | "aristapublisher.eos", 34 | "eamodio.gitlens", 35 | "mutantdino.resourcemonitor" 36 | ], 37 | "postCreateCommand": "touch ${containerWorkspaceFolder}/.history", 38 | "mounts": [ 39 | "source=${localEnv:HOME}/.ssh,target=/home/dev/.ssh,type=bind,consistency=cached", 40 | "source=${localEnv:HOME}/.gitconfig,target=/home/dev/.gitconfig,type=bind,consistency=cached", 41 | ], 42 | // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. 43 | "remoteUser": "dev" 44 | } 45 | -------------------------------------------------------------------------------- /examples/topologies/atd.yaml: -------------------------------------------------------------------------------- 1 | topology: 2 | name: ATD 3 | username: arista 4 | password: $6$BSMT1WbtoeKM/hK4$kJxcK/KXv4shkWUb9y5MOgNG6EUmmHR5fR4BM2e4uKtXB74lXL1fncHNC0d4xUcW86OJeYapbFZtBdjStkEqv. 5 | cv: 6 | nodes: 7 | - 192.168.49.12 8 | port: 9910 9 | auth: 10 | cert: xxxx 11 | path: /mnt/flash 12 | images: 13 | registry: local 14 | ceos: 4.28.0F 15 | 64-bit: true 16 | host: 1.0 17 | links: 18 | - [["spine1", "et1"], ["spine2", "et1"]] 19 | - [["spine1", "et2"], ["leaf1", "et2"]] 20 | - [["spine1", "et3"], ["leaf2", "et2"]] 21 | - [["spine1", "et4"], ["leaf3", "et2"]] 22 | - [["spine1", "et5"], ["leaf4", "et2"]] 23 | - [["spine1", "et6"], ["spine2", "et6"]] 24 | - [["spine2", "et2"], ["leaf1", "et3"]] 25 | - [["spine2", "et3"], ["leaf2", "et3"]] 26 | - [["spine2", "et4"], ["leaf3", "et3"]] 27 | - [["spine2", "et5"], ["leaf4", "et3"]] 28 | - [["leaf1", "et1"], ["leaf2", "et1"]] 29 | - [["leaf1", "et4"], ["host1", "et1"]] 30 | - [["leaf1", "et5"], ["host1", "et3"]] 31 | - [["leaf1", "et6"], ["leaf2", "et6"]] 32 | - [["leaf2", "et4"], ["host1", "et2"]] 33 | - [["leaf2", "et5"], ["host1", "et4"]] 34 | - [["leaf2", "et6"], ["host1", "et6"]] 35 | - [["leaf3", "et1"], ["leaf4", "et1"]] 36 | - [["leaf3", "et4"], ["host2", "et1"]] 37 | - [["leaf3", "et5"], ["host2", "et3"]] 38 | - [["leaf3", "et6"], ["leaf4", "et6"]] 39 | - [["leaf4", "et4"], ["host2", "et2"]] 40 | - [["leaf4", "et5"], ["host2", "et4"]] 41 | - [["leaf4", "et6"], ["host2", "et6"]] 42 | nodes: 43 | - name: spine1 44 | mac: 00:1c:73:f0:c6:01 45 | - name: spine2 46 | mac: 00:1c:73:f1:c6:01 47 | - name: leaf1 48 | mac: 00:1c:73:f2:c6:01 49 | - name: leaf2 50 | mac: 00:1c:73:f3:c6:01 51 | - name: leaf3 52 | mac: 00:1c:73:f4:c6:01 53 | - name: leaf4 54 | mac: 00:1c:73:f5:c6:01 55 | - name: host1 56 | mac: 00:1c:73:f7:c6:01 57 | - name: host2 58 | mac: 00:1c:73:f8:c6:01 59 | hosts: 60 | iperf: 61 | commands: 62 | mlag: 63 | pre: 'MLAG' 64 | bgp: 65 | pre: 'BGP' 66 | vxlan: 67 | pre: 'VXLAN' 68 | l2evpn: 69 | pre: 'L2EVPN' 70 | l3evpn: 71 | pre: 'L3EVPN' 72 | cvp: 73 | pre: 'CVP' 74 | base: 75 | pre: 'BASE' 76 | -------------------------------------------------------------------------------- /examples/topologies/l2.yaml: -------------------------------------------------------------------------------- 1 | topology: 2 | name: L2 3 | vforward: 1 4 | cvpaddress: 192.168.49.12 5 | cvp-key: rob-lab 6 | username: arista 7 | password: $6$BSMT1WbtoeKM/hK4$kJxcK/KXv4shkWUb9y5MOgNG6EUmmHR5fR4BM2e4uKtXB74lXL1fncHNC0d4xUcW86OJeYapbFZtBdjStkEqv. 8 | cv: 9 | nodes: 10 | - 192.168.49.12 11 | port: 9910 12 | auth: 13 | cert: xxxx 14 | path: /mnt/flash 15 | infra: 16 | bridge: vmgmt 17 | vrf: MGMT 18 | gateway: 192.168.50.1 19 | mac_mgmt: False 20 | images: 21 | registry: local 22 | ceos: 4.28.0F 23 | 64-bit: true 24 | host: 1.0 25 | links: 26 | - [["spine1", "et1"], ["spine2", "et1"]] 27 | - [["spine1", "et2"], ["leaf1", "et1"]] 28 | - [["spine1", "et3"], ["leaf2", "et1"]] 29 | - [["spine1", "et4"], ["leaf3", "et1"]] 30 | - [["spine2", "et2"], ["leaf1", "et2"]] 31 | - [["spine2", "et3"], ["leaf2", "et2"]] 32 | - [["spine2", "et4"], ["leaf3", "et2"]] 33 | - [["leaf1", "et3"], ["host10", "et0"]] 34 | - [["leaf1", "et4"], ["host11", "et0"]] 35 | - [["leaf2", "et3"], ["host20", "et0"]] 36 | - [["leaf2", "et4"], ["host21", "et0"]] 37 | - [["leaf3", "et3"], ["host30", "et0"]] 38 | - [["leaf3", "et4"], ["host31", "et0"]] 39 | 40 | nodes: 41 | - name: spine1 42 | mac: 00:1c:73:b0:c6:01 43 | ip_addr: 192.168.50.21 44 | - name: spine2 45 | mac: 00:1c:73:b1:c6:01 46 | ip_addr: 192.168.50.22 47 | - name: leaf1 48 | mac: 00:1c:73:b2:c6:01 49 | ip_addr: 192.168.50.23 50 | - name: leaf2 51 | mac: 00:1c:73:b3:c6:01 52 | ip_addr: 192.168.50.24 53 | - name: leaf3 54 | mac: 00:1c:73:b4:c6:01 55 | ip_addr: 192.168.50.25 56 | hosts: 57 | - name: host10 58 | ip_addr: 10.0.12.11 59 | mask: 255.255.255.0 60 | gateway: 10.0.12.1 61 | - name: host11 62 | ip_addr: 10.0.13.11 63 | mask: 255.255.255.0 64 | gateway: 10.0.13.1 65 | - name: host20 66 | ip_addr: 10.0.12.21 67 | mask: 255.255.255.0 68 | gateway: 10.0.12.1 69 | - name: host21 70 | ip_addr: 10.0.13.21 71 | mask: 255.255.255.0 72 | gateway: 10.0.13.1 73 | - name: host30 74 | ip_addr: 10.0.12.31 75 | mask: 255.255.255.0 76 | gateway: 10.0.12.1 77 | - name: host31 78 | ip_addr: 10.0.13.31 79 | mask: 255.255.255.0 80 | gateway: 10.0.13.1 81 | iperf: 82 | port: 5010 83 | brate: 1000000 84 | servers: 85 | - host10 86 | - host30 87 | - host31 88 | clients: 89 | - client: host11 90 | target: host30 91 | - client: host20 92 | target: host10 93 | - client: host21 94 | target: host31 95 | commands: 96 | -------------------------------------------------------------------------------- /examples/topologies/ratd.yaml: -------------------------------------------------------------------------------- 1 | topology: 2 | name: RATD 3 | username: arista 4 | password: $6$BSMT1WbtoeKM/hK4$kJxcK/KXv4shkWUb9y5MOgNG6EUmmHR5fR4BM2e4uKtXB74lXL1fncHNC0d4xUcW86OJeYapbFZtBdjStkEqv. 5 | cv: 6 | nodes: 7 | - 192.168.49.12 8 | port: 9910 9 | auth: 10 | cert: xxxx 11 | path: /mnt/flash 12 | images: 13 | registry: local 14 | ceos: 4.28.0F 15 | 64-bit: true 16 | host: 1.0 17 | links: 18 | - [["eos1", "et1"], ["eos2", "et5"]] 19 | - [["eos1", "et2"], ["eos7", "et3"]] 20 | - [["eos1", "et3"], ["eos11", "et1"]] 21 | - [["eos1", "et4"], ["eos6", "et4"]] 22 | - [["eos1", "et5"], ["eos5", "et4"]] 23 | - [["eos1", "et6"], ["eos17", "et1"]] 24 | - [["eos2", "et1"], ["eos3", "et3"]] 25 | - [["eos2", "et2"], ["eos4", "et4"]] 26 | - [["eos2", "et3"], ["eos5", "et3"]] 27 | - [["eos2", "et4"], ["eos6", "et5"]] 28 | - [["eos3", "et1"], ["eos9", "et2"]] 29 | - [["eos3", "et2"], ["eos7", "et1"]] 30 | - [["eos3", "et4"], ["eos5", "et2"]] 31 | - [["eos3", "et5"], ["eos4", "et5"]] 32 | - [["eos3", "et6"], ["eos20", "et1"]] 33 | - [["eos4", "et1"], ["eos9", "et1"]] 34 | - [["eos4", "et2"], ["eos8", "et1"]] 35 | - [["eos4", "et3"], ["eos5", "et1"]] 36 | - [["eos4", "et6"], ["eos16", "et1"]] 37 | - [["eos5", "et6"], ["eos6", "et1"]] 38 | - [["eos6", "et2"], ["eos8", "et3"]] 39 | - [["eos6", "et3"], ["eos13", "et1"]] 40 | - [["eos6", "et6"], ["eos14", "et2"]] 41 | - [["eos7", "et2"], ["eos10", "et1"]] 42 | - [["eos7", "et4"], ["eos19", "et1"]] 43 | - [["eos8", "et2"], ["eos15", "et1"]] 44 | - [["eos8", "et4"], ["eos14", "et1"]] 45 | - [["eos8", "et5"], ["eos18", "et1"]] 46 | - [["eos11", "et2"], ["eos12", "et2"]] 47 | - [["eos11", "et3"], ["eos13", "et3"]] 48 | - [["eos12", "et1"], ["eos13", "et2"]] 49 | 50 | nodes: 51 | - name: eos1 52 | mac: 00:1c:73:d0:c6:01 53 | - name: eos2 54 | mac: 00:1c:73:d1:c6:01 55 | - name: eos3 56 | mac: 00:1c:73:d2:c6:01 57 | - name: eos4 58 | mac: 00:1c:73:d3:c6:01 59 | - name: eos5 60 | mac: 00:1c:73:d4:c6:01 61 | - name: eos6 62 | mac: 00:1c:73:d5:c6:01 63 | - name: eos7 64 | mac: 00:1c:73:d6:c6:01 65 | - name: eos8 66 | mac: 00:1c:73:d7:c6:01 67 | - name: eos9 68 | mac: 00:1c:73:d8:c6:01 69 | - name: eos10 70 | mac: 00:1c:73:d9:c6:01 71 | - name: eos11 72 | mac: 00:1c:73:e0:c6:01 73 | - name: eos12 74 | mac: 00:1c:73:e1:c6:01 75 | - name: eos13 76 | mac: 00:1c:73:e2:c6:01 77 | - name: eos14 78 | mac: 00:1c:73:e3:c6:01 79 | - name: eos15 80 | mac: 00:1c:73:e4:c6:01 81 | - name: eos16 82 | mac: 00:1c:73:d5:c6:01 83 | - name: eos17 84 | mac: 00:1c:73:e6:c6:01 85 | - name: eos18 86 | mac: 00:1c:73:e7:c6:01 87 | - name: eos19 88 | mac: 00:1c:73:e8:c6:01 89 | - name: eos20 90 | mac: 00:1c:73:e9:c6:01 91 | hosts: 92 | iperf: 93 | commands: 94 | sr: 95 | pre: 'SR' 96 | evpn: 97 | pre: 'EVPN' 98 | c1-l3vpn: 99 | pre: 'C1_L3VPN' 100 | c2-l2vpn: 101 | pre: 'C2_L2VPN' 102 | c3-eline: 103 | pre: 'C3_ELINE' 104 | c4-l3vpn: 105 | pre: 'C4_L3VPN' 106 | centsvc: 107 | pre: 'CENTSVC' 108 | complete: 109 | pre: 'Complete' 110 | base: 111 | pre: 'BaseIPv4' 112 | -------------------------------------------------------------------------------- /examples/topologies/l3.yaml: -------------------------------------------------------------------------------- 1 | topology: 2 | name: L3 3 | forward: 1 4 | cvpaddress: 192.168.49.12 5 | cvp-key: rob-lab 6 | username: arista 7 | password: $6$BSMT1WbtoeKM/hK4$kJxcK/KXv4shkWUb9y5MOgNG6EUmmHR5fR4BM2e4uKtXB74lXL1fncHNC0d4xUcW86OJeYapbFZtBdjStkEqv. 8 | cv: 9 | nodes: 10 | - 192.168.49.12 11 | port: 9910 12 | auth: 13 | cert: xxxx 14 | path: /mnt/flash 15 | infra: 16 | bridge: vmgmt 17 | vrf: MGMT 18 | gateway: 192.168.50.1 19 | mac_mgmt: False 20 | images: 21 | registry: local 22 | ceos: 4.28.0F 23 | 64-bit: true 24 | host: 1.0 25 | links: 26 | - [["spine1", "et1"], ["leaf11", "et2"]] 27 | - [["spine1", "et2"], ["leaf12", "et2"]] 28 | - [["spine1", "et3"], ["leaf21", "et2"]] 29 | - [["spine1", "et4"], ["leaf22", "et2"]] 30 | - [["spine1", "et5"], ["leaf31", "et2"]] 31 | - [["spine1", "et6"], ["leaf32", "et2"]] 32 | - [["spine1", "et7"], ["brdr1", "et2"]] 33 | - [["spine1", "et8"], ["brdr2", "et2"]] 34 | - [["spine2", "et1"], ["leaf11", "et3"]] 35 | - [["spine2", "et2"], ["leaf12", "et3"]] 36 | - [["spine2", "et3"], ["leaf21", "et3"]] 37 | - [["spine2", "et4"], ["leaf22", "et3"]] 38 | - [["spine2", "et5"], ["leaf31", "et3"]] 39 | - [["spine2", "et6"], ["leaf32", "et3"]] 40 | - [["spine2", "et7"], ["brdr1", "et3"]] 41 | - [["spine2", "et8"], ["brdr2", "et3"]] 42 | - [["leaf11", "et1"], ["leaf12", "et1"]] 43 | - [["leaf11", "et4"], ["host11", "et0"]] 44 | - [["leaf11", "et5"], ["host12", "et0"]] 45 | - [["leaf21", "et1"], ["leaf22", "et1"]] 46 | - [["leaf21", "et4"], ["host21", "et0"]] 47 | - [["leaf22", "et4"], ["host22", "et0"]] 48 | - [["leaf31", "et1"], ["leaf32", "et1"]] 49 | - [["leaf31", "et4"], ["host31", "et0"]] 50 | - [["leaf31", "et5"], ["host32", "et0"]] 51 | - [["brdr1", "et1"], ["brdr2", "et1"]] 52 | 53 | nodes: 54 | - name: spine1 55 | mac: 00:1c:73:c0:c6:01 56 | ip_addr: 192.168.50.31 57 | - name: spine2 58 | mac: 00:1c:73:c1:c6:01 59 | ip_addr: 192.168.50.32 60 | - name: leaf11 61 | mac: 00:1c:73:c2:c6:01 62 | ip_addr: 192.168.50.33 63 | - name: leaf12 64 | mac: 00:1c:73:c3:c6:01 65 | ip_addr: 192.168.50.34 66 | - name: leaf21 67 | mac: 00:1c:73:c4:c6:01 68 | ip_addr: 192.168.50.35 69 | - name: leaf22 70 | mac: 00:1c:73:c5:c6:01 71 | ip_addr: 192.168.50.36 72 | - name: leaf31 73 | mac: 00:1c:73:c6:c6:01 74 | ip_addr: 192.168.50.37 75 | - name: leaf32 76 | mac: 00:1c:73:c7:c6:01 77 | ip_addr: 192.168.50.38 78 | - name: brdr1 79 | mac: 00:1c:73:c8:c6:01 80 | ip_addr: 192.168.50.39 81 | - name: brdr2 82 | mac: 00:1c:73:c9:c6:01 83 | ip_addr: 192.168.50.40 84 | hosts: 85 | - name: host11 86 | ip_addr: 192.168.12.11 87 | mask: 255.255.255.0 88 | gateway: 192.168.12.1 89 | - name: host12 90 | ip_addr: 192.168.13.11 91 | mask: 255.255.255.0 92 | gateway: 192.168.13.1 93 | - name: host21 94 | ip_addr: 192.168.12.21 95 | mask: 255.255.255.0 96 | gateway: 192.168.12.1 97 | - name: host22 98 | ip_addr: 192.168.13.21 99 | mask: 255.255.255.0 100 | gateway: 192.168.13.1 101 | - name: host31 102 | ip_addr: 192.168.12.31 103 | mask: 255.255.255.0 104 | gateway: 192.168.12.1 105 | - name: host32 106 | ip_addr: 192.168.13.31 107 | mask: 255.255.255.0 108 | gateway: 192.168.13.1 109 | iperf: 110 | port: 5010 111 | brate: 1000000 112 | servers: 113 | - host11 114 | - host12 115 | - host31 116 | clients: 117 | - client: host21 118 | target: host11 119 | - client: host32 120 | target: host12 121 | - client: host22 122 | target: host31 123 | commands: 124 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | ## rLab EOS Topologies 2 | 3 | This repo will contain the data models and configs to build different toplogies to run EOS as a container. 4 | 5 | ### Requirements 6 | To run the network topology on a container host machine, there are a few requirements and tested software versions that are known to work. 7 | 8 | #### Distribution Testing 9 | | Distro | Version | Runtimes | 10 | | --------- | ------- | --------------- | 11 | | CentOS | 7 | Docker | 12 | | Fedora | >=34 | Docker, Podman | 13 | | Ubuntu | >= 22.04| Docker, Podman | 14 | 15 | #### Container Runtimes 16 | | Package | Version | 17 | | --------- | --------- | 18 | | Docker | >= 20.10 | 19 | | Podman | >= 3.4 | 20 | 21 | #### Linux Packages 22 | - bridge-utils 23 | - net-tools 24 | - graphviz 25 | - Docker or Podman 26 | - python3-pip 27 | 28 | #### Python3 Packages 29 | - ruamel.yaml 30 | - graphviz 31 | - pydot 32 | - jsonrpclib 33 | 34 | 35 | ### Getting Started 36 | To build a new topology, the following files/data structures need to be created. 37 | - `build/password_hash.py` - This script will generate a SHA512 hashed password to be entered into the topology yaml file. 38 | - `examples/topologies/{name}.yaml` - This directory containers some example/sample topology files to help get started. These can be copied to the `topologies/` directory for use. 39 | - `topologies/{name}.yaml` - This file is leveraged by `build/topo-builder.py` to create the necessary commands to build the topology. 40 | - `build/yamlviz.py` This script will draw a cabling diagram of your topology. It writes a PNG image named after your topology in the `topologies/` directory. 41 | - `build/topo-build.sh` This is a wrapper script that calls both `build/topo-builder.py` and `build/yamlviz.py` 42 | - `configs/{topo}/{device}` - This directory structure is were any files you want to be loaded into cEOS-lab's `/mnt/flash` should be loaded to. Scripts, startup-config etc. 43 | 44 | 45 | To install the necessary packages and libraries enter the following commands: (Fedora example below) 46 | 47 | ``` 48 | sudo dnf install bridge-utils net-tools graphviz docker podman python3-pip 49 | pip3 install -r requirements.txt 50 | ``` 51 | 52 | To leverage Podman for containers, cgroups_v2 will need to be disabled. A reboot is required after for the change. 53 | 54 | ``` 55 | sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" 56 | sudo reboot now 57 | ``` 58 | 59 | #### NOTE: 60 | To be able to run MLAG and dot1q, use the 4.23.1F or newer release of cEOS-Lab. 61 | 62 | #### Topology File Format 63 | There are some required fields to be specified in the topology files. See the examples listed in the `topologies/` directory. The required parameters are: 64 | ``` 65 | topology: 66 | name: {TOPO_NAME} 67 | vforward: 1 68 | cvpaddress: {CVP_IPADDRESS} 69 | cvp-key: {CVP_KEY} 70 | username: {USERNAME} 71 | password: {PASSWORD} 72 | cv: 73 | nodes: 74 | - {CV_NODE} 75 | port: {CV_PORT} 76 | auth: 77 | cert: {CV_ONBOARDING_TOKEN} 78 | path: /mnt/flash 79 | infra: 80 | bridge: {MGMT_BRIDGE} 81 | gateway: {MGMT_NETWORK_GATEWAY} 82 | mac_mgmt: {MAC_MGMT} 83 | images: 84 | registry: {LOCATION} 85 | ceos: {ceosimage_tag} 86 | 64-bit: {CEOSTYPE} 87 | host: {chostimage_tag} 88 | links: 89 | - [["spine1", "et1"], ["spine2", "et1"]] 90 | - [["spine1", "et2"], ["leaf1", "et1"]] 91 | - [["leaf1", "et3"], ["host10", "et0"]] 92 | nodes: 93 | - name: spine1 94 | mac: 00:1c:73:c0:c6:01 95 | ipaddress: 192.168.0.10 96 | hosts: 97 | - name: host10 98 | ipaddress: 10.0.12.11 99 | mask: 255.255.255.0 100 | gateway: 10.0.12.1 101 | iperf: 102 | port: 5010 103 | brate: 1000000 104 | servers: 105 | - host11 106 | clients: 107 | - client: host21 108 | target: host11 109 | commands: 110 | ``` 111 | 112 | - The `CVP_IPADDRESS` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP. (Deprecated) 113 | - The `CVP_KEY` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP. (Deprecated) 114 | - The `CV_NODE` This paramter is to specity the address of the CV instance. Can be a list of Addresses 115 | - The `CV_PORT` This paramter is to specify the destination port for CV. On-Prem = `9910`, CVaaS = `443` 116 | - The `CV_ONBOARDING_TOKEN` This parameter is to be populated with a device enrollment token from CV 117 | - The `USERNAME` parameter is optional, this is if a bare startup-config is created. It will generate a local user account in EOS. 118 | - The `PASSWORD` parameter is optional, this is if a bare startup-config is created. It will generate the password for the local user account. 119 | - The `MGMT_BRIDGE` parameter is optional, this is if you wish to attach the cEOS containers Management0 Interface to this network. 120 | - The `MGMT_NETWORK_GATEWAY` parameter is optional, this is if a bare startup-config is created, but should be specified if the `MGMT_BRIDGE` parameter is set. 121 | - The `MAC_MGMT` parameter lets the script know, if the supplied MAC Address for each node should be used for the System ID or Ma0 Interface. (bool) True/False 122 | - The `LOCATION` parameter should be set to `local` as default. Update this to the url of any private/remote registries. 123 | - The `CEOSTYPE` parameter is used to specify if the ceosimage should be `ceosimage` or `ceosimage-64`. (bool) true/false 124 | - The `mac` section for each cEOS-lab node needs to be unique, this sets the mgmt interface MAC Address which also sets the system-id. 125 | - The `links` section is used to create a "virtual" patch cable between each node. 126 | - If you do not want to run iperf on the host nodes, you can leave that section empty and only set `iperf:` 127 | - The `commands:` section can create additional bash scripts to load new configurations on the nodes. The `topologies/ratd.yaml` file has examples for this. 128 | 129 | ## Creating a Topology 130 | 131 | Clone this repo to your container host node and enter the main directory for this repo. 132 | 133 | Here are the steps required to get it running for the first time. Examples for both Docker and Podman are given. 134 | 135 | 1. Import a cEOS-lab container archive: 136 | ``` 137 | docker import cEOS-lab.tar.xz ceosimage:{ceosimage_tag} 138 | sudo podman import cEOS-lab.tar.xz ceosimage:{ceosimage_tag} 139 | ``` 140 | {ceosimage_tag} = tag for the image, ie `4.23.1F` 141 | 142 | 2. Build and tag the host node: 143 | ``` 144 | docker build -t chost:{chostimage_tag} build/hosts/. 145 | sudo podman build -t chost:{chostimage_tag} build/hosts/. 146 | ``` 147 | {chostimage_tag} = tag for the image, ie `0.5` 148 | 149 | 3. Copy or create a topology definition file. Example definition files are found in `examples/topologies`. As a quick-start, copy one of the definition files to the `topologies/` directory. Otherwise you may create your own topology definition file and save it in `topologies/` 150 | 151 | ``` 152 | cp examples/topologies/l2.yaml topologies 153 | ``` 154 | 155 | 4. Create the topology scripts: 156 | To create the necessary scripts and leverage either no startup-configs or leverage already provided ones: 157 | ``` 158 | ./topo-build.sh -t {topo} 159 | ``` 160 | 161 | {topo} is the filename for the topology file located in `topologies/` without the `.yaml` extension. For the L2 topology, the command would look like: 162 | ``` 163 | topo-build.sh -t l2 164 | ``` 165 | Note: `topo-build.sh` is a wrapper shell script that calls both `topo-builder.py` and `yamlviz.py`. If the diagram that `yamlviz.py` generates is not needed or to use other arguments to `topo-builder.py`, you can run it directly: 166 | ``` 167 | build/topo-builder.py -t {topo} 168 | ``` 169 | 170 | To update the container runtime (Docker is default) run with the `-r` flag: 171 | 172 | {runtime} is the container runtime options. Available options are: `docker` or `podman` 173 | ``` 174 | ./topo-build.sh -t {topo} -r {runtime} 175 | ``` 176 | or 177 | ``` 178 | build/topo-builder.py -t {topo} -r {runtime} 179 | ``` 180 | 181 | To create the necessary scripts and create a bare startup-configuration: 182 | ``` 183 | ./topo-build.sh -t {topo} -s 184 | ``` 185 | 186 | or 187 | 188 | ``` 189 | build/topo-builder.py -t {topo} -s 190 | ``` 191 | 192 | 5. The `topo-builder.py` script will create a minimum of 4 bash scripts. They are located in `scripts/{TOPO_NAME}/`. It is important to run the commands for the project directories top-level directory. 193 | The four main scripts created are as follows with their description: 194 | - `Create.sh` - Creates all Open vSwitch bridges, containers, starts containers and links all containers together. 195 | - `Start.sh` - Starts all stopped containers and links all containers together. 196 | - `Stop.sh` - Disconnects all links between containers and stops running containers. 197 | - `Delete.sh` - Disconnects all links between containeres, stops running containers, removes containers, and removes Open vSwitch bridges. 198 | 199 | An example on creating and starting a new topology, use the following command: 200 | ``` 201 | bash scripts/L2/Create.sh 202 | ``` 203 | 204 | #### Using a Topology 205 | cEOS-Lab nodes do require CPU to get started, but once running CPU utilization will drop down. Memory utilization for a cEOS-lab instance is anywhere from 300-500 MB. Make sure your host node is sized appropriately. 206 | 207 | Use the following commands to view running containers, stats and connecting to a container. 208 | #### Docker Example 209 | ``` 210 | # View running containers 211 | docker ps 212 | 213 | # View running and stopped containers 214 | docker ps -a 215 | 216 | # View stats of the containers one-time 217 | docker stats --no-stream 218 | 219 | # View a continuous update for container stats. Stop with Ctrl + C 220 | docker stats 221 | 222 | # Connect to a cEOS-Lab instance. 223 | docker exec -it l2leaf1 Cli -p 15 224 | 225 | # Connect to a host instance. 226 | docker exec -it l2host11 bash 227 | ``` 228 | 229 | #### Podman Example 230 | ``` 231 | # View running containers 232 | sudo podman ps 233 | 234 | # View running and stopped containers 235 | sudo podman ps -a 236 | 237 | # View stats of the containers one-time 238 | sudo podman stats --no-stream 239 | 240 | # View a continuous update for container stats. Stop with Ctrl + C 241 | sudo podman stats 242 | 243 | # Connect to a cEOS-Lab instance. 244 | sudo podman exec -it l2leaf1 Cli -p 15 245 | 246 | # Connect to a host instance. 247 | sudo podman exec -it l2host11 bash 248 | ``` 249 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2022 Rob Martin 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------