diff --git a/.cp/copier.yml b/.cp/copier.yml index b6f77d8f..7a1e0dd5 100644 --- a/.cp/copier.yml +++ b/.cp/copier.yml @@ -59,6 +59,8 @@ lab_features: - git - slides - addAliases + - graphite + - terminals lab_author: type: str diff --git a/.cp/extra-vars/atd-l3ls/lab_host_inventory.csv b/.cp/extra-vars/atd-l3ls/lab_host_inventory.csv deleted file mode 100644 index 04c31eed..00000000 --- a/.cp/extra-vars/atd-l3ls/lab_host_inventory.csv +++ /dev/null @@ -1,3 +0,0 @@ -hostname,mgmt_ip -dc1-leaf1-server1,172.16.1.201 -dc1-leaf2-server1,172.16.1.202 \ No newline at end of file diff --git a/.cp/extra-vars/atd-l3ls/lab_inventory.csv b/.cp/extra-vars/atd-l3ls/lab_inventory.csv index 59857652..c58550f2 100644 --- a/.cp/extra-vars/atd-l3ls/lab_inventory.csv +++ b/.cp/extra-vars/atd-l3ls/lab_inventory.csv @@ -1,9 +1,11 @@ -hostname,mgmt_ip -dc1-spine1,172.16.1.11 -dc1-spine2,172.16.1.12 -dc1-leaf1a,172.16.1.101 -dc1-leaf1b,172.16.1.102 -dc1-leaf2a,172.16.1.103 -dc1-leaf2b,172.16.1.104 -dc1-leaf1c,172.16.1.151 -dc1-leaf2c,172.16.1.152 \ No newline at end of file +hostname,mgmt_ip,role,platform +dc1-spine1,172.16.1.11,spine,ceos +dc1-spine2,172.16.1.12,spine,ceos +dc1-leaf1a,172.16.1.101,leaf,ceos +dc1-leaf1b,172.16.1.102,leaf,ceos +dc1-leaf2a,172.16.1.103,leaf,ceos +dc1-leaf2b,172.16.1.104,leaf,ceos +dc1-leaf1c,172.16.1.151,leaf,ceos +dc1-leaf2c,172.16.1.152,leaf,ceos +dc1-leaf1-server1,172.16.1.201,host,ceos +dc1-leaf2-server1,172.16.1.202,host,ceos \ No newline at end of file diff --git a/.cp/extra-vars/default/lab_host_inventory.csv b/.cp/extra-vars/default/lab_host_inventory.csv deleted file mode 100644 index 8f0948bd..00000000 --- a/.cp/extra-vars/default/lab_host_inventory.csv +++ /dev/null @@ -1,3 +0,0 @@ -hostname,mgmt_ip -h01,10.0.3.1 -h02,10.0.3.2 \ No newline at end of file diff --git a/.cp/extra-vars/default/lab_inventory.csv b/.cp/extra-vars/default/lab_inventory.csv index ba4bccf2..179fb558 100644 --- a/.cp/extra-vars/default/lab_inventory.csv +++ b/.cp/extra-vars/default/lab_inventory.csv @@ -1,7 +1,9 @@ -hostname,mgmt_ip -s01,10.0.1.1 -s02,10.0.1.2 -l01,10.0.2.1 -l02,10.0.2.2 -l03,10.0.2.3 -l04,10.0.2.4 \ No newline at end of file +hostname,mgmt_ip,role,platform,terminals_icon,terminals_color,terminals_split +s01,10.0.1.1,spine,ceos +s02,10.0.1.2,spine,ceos,,,s01 +l01,10.0.2.1,leaf,ceos,bookmark,terminal.ansiRed +l02,10.0.2.2,leaf,ceos,bookmark,terminal.ansiRed,l01 +l03,10.0.2.3,leaf,ceos,,terminal.ansiGreen +l04,10.0.2.4,leaf,ceos,,terminal.ansiGreen,l03 +h01,10.0.3.1,host,ceos +h02,10.0.3.2,host,ceos \ No newline at end of file diff --git a/.cp/extra-vars/minimalistic-l3ls-aa/lab_host_inventory.csv b/.cp/extra-vars/minimalistic-l3ls-aa/lab_host_inventory.csv deleted file mode 100644 index ee4bdbb8..00000000 --- a/.cp/extra-vars/minimalistic-l3ls-aa/lab_host_inventory.csv +++ /dev/null @@ -1,2 +0,0 @@ -hostname,mgmt_ip -h01,10.0.3.1 \ No newline at end of file diff --git a/.cp/extra-vars/minimalistic-l3ls-aa/lab_inventory.csv b/.cp/extra-vars/minimalistic-l3ls-aa/lab_inventory.csv index b15d7adf..4bb6b3ba 100644 --- a/.cp/extra-vars/minimalistic-l3ls-aa/lab_inventory.csv +++ b/.cp/extra-vars/minimalistic-l3ls-aa/lab_inventory.csv @@ -1,5 +1,6 @@ -hostname,mgmt_ip -s01,10.0.1.1 -s02,10.0.1.2 -l01,10.0.2.1 -l02,10.0.2.2 \ No newline at end of file +hostname,mgmt_ip,role,platform +s01,10.0.1.1,spine,ceos +s02,10.0.1.2,spine,ceos +l01,10.0.2.1,leaf,ceos +l02,10.0.2.2,leaf,ceos +h01,10.0.3.1,host,ceos \ No newline at end of file diff --git a/.cp/extra-vars/minimalistic-l3ls-mlag/lab_host_inventory.csv b/.cp/extra-vars/minimalistic-l3ls-mlag/lab_host_inventory.csv deleted file mode 100644 index ee4bdbb8..00000000 --- a/.cp/extra-vars/minimalistic-l3ls-mlag/lab_host_inventory.csv +++ /dev/null @@ -1,2 +0,0 @@ -hostname,mgmt_ip -h01,10.0.3.1 \ No newline at end of file diff --git a/.cp/extra-vars/minimalistic-l3ls-mlag/lab_inventory.csv b/.cp/extra-vars/minimalistic-l3ls-mlag/lab_inventory.csv index b15d7adf..4bb6b3ba 100644 --- a/.cp/extra-vars/minimalistic-l3ls-mlag/lab_inventory.csv +++ b/.cp/extra-vars/minimalistic-l3ls-mlag/lab_inventory.csv @@ -1,5 +1,6 @@ -hostname,mgmt_ip -s01,10.0.1.1 -s02,10.0.1.2 -l01,10.0.2.1 -l02,10.0.2.2 \ No newline at end of file +hostname,mgmt_ip,role,platform +s01,10.0.1.1,spine,ceos +s02,10.0.1.2,spine,ceos +l01,10.0.2.1,leaf,ceos +l02,10.0.2.2,leaf,ceos +h01,10.0.3.1,host,ceos \ No newline at end of file diff --git a/.cp/extra-vars/small-l3ls-aa/lab_host_inventory.csv b/.cp/extra-vars/small-l3ls-aa/lab_host_inventory.csv deleted file mode 100644 index 8f0948bd..00000000 --- a/.cp/extra-vars/small-l3ls-aa/lab_host_inventory.csv +++ /dev/null @@ -1,3 +0,0 @@ -hostname,mgmt_ip -h01,10.0.3.1 -h02,10.0.3.2 \ No newline at end of file diff --git a/.cp/extra-vars/small-l3ls-aa/lab_inventory.csv b/.cp/extra-vars/small-l3ls-aa/lab_inventory.csv index ba4bccf2..2458cf81 100644 --- a/.cp/extra-vars/small-l3ls-aa/lab_inventory.csv +++ b/.cp/extra-vars/small-l3ls-aa/lab_inventory.csv @@ -1,7 +1,9 @@ -hostname,mgmt_ip -s01,10.0.1.1 -s02,10.0.1.2 -l01,10.0.2.1 -l02,10.0.2.2 -l03,10.0.2.3 -l04,10.0.2.4 \ No newline at end of file +hostname,mgmt_ip,role,platform +s01,10.0.1.1,spine,ceos +s02,10.0.1.2,spine,ceos +l01,10.0.2.1,leaf,ceos +l02,10.0.2.2,leaf,ceos +l03,10.0.2.3,leaf,ceos +l04,10.0.2.4,leaf,ceos +h01,10.0.3.1,host,ceos +h02,10.0.3.2,host,ceos \ No newline at end of file diff --git a/.cp/extra-vars/small-l3ls-mlag/lab_host_inventory.csv b/.cp/extra-vars/small-l3ls-mlag/lab_host_inventory.csv deleted file mode 100644 index 8f0948bd..00000000 --- a/.cp/extra-vars/small-l3ls-mlag/lab_host_inventory.csv +++ /dev/null @@ -1,3 +0,0 @@ -hostname,mgmt_ip -h01,10.0.3.1 -h02,10.0.3.2 \ No newline at end of file diff --git a/.cp/extra-vars/small-l3ls-mlag/lab_inventory.csv b/.cp/extra-vars/small-l3ls-mlag/lab_inventory.csv index ba4bccf2..2458cf81 100644 --- a/.cp/extra-vars/small-l3ls-mlag/lab_inventory.csv +++ b/.cp/extra-vars/small-l3ls-mlag/lab_inventory.csv @@ -1,7 +1,9 @@ -hostname,mgmt_ip -s01,10.0.1.1 -s02,10.0.1.2 -l01,10.0.2.1 -l02,10.0.2.2 -l03,10.0.2.3 -l04,10.0.2.4 \ No newline at end of file +hostname,mgmt_ip,role,platform +s01,10.0.1.1,spine,ceos +s02,10.0.1.2,spine,ceos +l01,10.0.2.1,leaf,ceos +l02,10.0.2.2,leaf,ceos +l03,10.0.2.3,leaf,ceos +l04,10.0.2.4,leaf,ceos +h01,10.0.3.1,host,ceos +h02,10.0.3.2,host,ceos \ No newline at end of file diff --git a/.cp/include/docs/lab-how-to-run.md.jinja b/.cp/include/docs/lab-how-to-run.md.jinja index 434bb44c..4fc973d9 100644 --- a/.cp/include/docs/lab-how-to-run.md.jinja +++ b/.cp/include/docs/lab-how-to-run.md.jinja @@ -35,13 +35,10 @@ To run the lab on your own machine, you can download all required files using th This lab has following devices: -| Hostname | Type | OS | Management Address | Username | Password | -| -------- | ---- | -- | ------------------ | -------- | -------- | +| Hostname | Role | Platform | OS Version | Management Address | Username | Password | +| -------- | ---- | -------- | -----------| ------------------ | -------- | -------- | {%- for node in lab_inventory %} -| {{ node.hostname }} | switch | cEOS-lab, {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | -{%- endfor %} -{%- for node in lab_host_inventory %} -| {{ node.hostname }} | host | cEOS-lab, {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | +| {{ node.hostname }} | {{ node.role }} | {{ node.platform }} | {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | {%- endfor %} > To access any device, use `ssh @` or simply type `` to use the SSH alias. diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/README.md.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/README.md.jinja index 8c60c62b..8bb8022b 100644 --- a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/README.md.jinja +++ b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/README.md.jinja @@ -25,13 +25,10 @@ Please check the lab materials: This lab has following devices: -| Hostname | Type | OS | Management Address | Username | Password | -| -------- | ---- | -- | ------------------ | -------- | -------- | +| Hostname | Role | Platform | OS Version | Management Address | Username | Password | +| -------- | ---- | -------- | -----------| ------------------ | -------- | -------- | {%- for node in lab_inventory %} -| {{ node.hostname }} | switch | cEOS-lab, {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | -{%- endfor %} -{%- for node in lab_host_inventory %} -| {{ node.hostname }} | host | cEOS-lab, {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | +| {{ node.hostname }} | {{ node.role }} | {{ node.platform }} | {{ ceos_lab_version }} | {{ node.mgmt_ip }} | {{ clab_user }} | {{ clab_password }} | {%- endfor %} > To access any device, use `ssh @` or simply type `` to use the SSH alias. diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/addAliases.sh.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/addAliases.sh.jinja index dff307ca..7fe52f8e 100644 --- a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/addAliases.sh.jinja +++ b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/addAliases.sh.jinja @@ -3,7 +3,4 @@ set +e {%- for node in lab_inventory %} echo "alias {{ node.hostname }}='sshpass -p {{ clab_password }} ssh -o \"StrictHostKeyChecking no\" {{ clab_user }}@{{ node.mgmt_ip }}'" >> ~/.zshrc -{%- endfor %} -{%- for node in lab_host_inventory %} -echo "alias {{ node.hostname }}='sshpass -p {{ clab_password }} ssh -o \"StrictHostKeyChecking no\" {{ clab_user }}@{{ node.mgmt_ip }}'" >> ~/.zshrc {%- endfor %} \ No newline at end of file diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_host_inventory %}.cfg.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_host_inventory %}.cfg.jinja deleted file mode 100644 index b433d839..00000000 --- a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_host_inventory %}.cfg.jinja +++ /dev/null @@ -1,39 +0,0 @@ -hostname {{ lab_inventory[copier_file_index].hostname }} -! -no aaa root -! -username {{ clab_user }} privilege 15 role network-admin secret {{ clab_password }} -! -vrf instance MGMT -! -ip name-server vrf MGMT 8.8.8.8 -dns domain avd.lab -! -platform tfa - personality arfa -! -ntp local-interface vrf MGMT Management0 -ntp server vrf MGMT time.apple.com -ntp server vrf MGMT time.google.com -ntp server vrf MGMT time.windows.com -! -service routing protocols model multi-agent -! -management api http-commands - protocol https - no shutdown - ! - vrf MGMT - no shutdown -! -aaa authorization exec default local -! -interface Management0 - vrf MGMT - ip address {{ lab_inventory[copier_file_index].mgmt_ip }}/{{ clab_mgmt_mask }} -! -ip route vrf MGMT 0.0.0.0/0 {{ clab_mgmt_gw }} -! -ip name-server vrf MGMT 8.8.8.8 -! -end \ No newline at end of file diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_inventory %}.cfg.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_inventory %}.cfg.jinja index 3143430d..6347ab40 100644 --- a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_inventory %}.cfg.jinja +++ b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/init-configs/{% for hostname in lab_inventory %}.cfg.jinja @@ -15,9 +15,6 @@ vrf instance MGMT ip name-server vrf MGMT 8.8.8.8 dns domain avd.lab ! -platform tfa - personality arfa -! ntp local-interface vrf MGMT Management0 ntp server vrf MGMT time.apple.com ntp server vrf MGMT time.google.com diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/topology.clab.yml.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/topology.clab.yml.jinja index 7185da96..1d43d63b 100644 --- a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/topology.clab.yml.jinja +++ b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/clab/topology.clab.yml.jinja @@ -26,13 +26,10 @@ topology: {%- for node in lab_inventory %} {{ node.hostname }}: mgmt-ipv4: {{ node.mgmt_ip }} +{%- if node.role in ['spine','leaf'] %} binds: - sn/{{ node.hostname }}.txt:/mnt/flash/ceos-config:ro - startup-config: init-configs/{{ node.hostname }}.cfg -{%- endfor %} -{%- for node in lab_host_inventory %} - {{ node.hostname }}: - mgmt-ipv4: {{ node.mgmt_ip }} +{%- endif %} startup-config: init-configs/{{ node.hostname }}.cfg {%- endfor %} diff --git a/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/{% if 'terminals' | _in(lab_features) %}.vscode{% endif %}/terminals.json.jinja b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/{% if 'terminals' | _in(lab_features) %}.vscode{% endif %}/terminals.json.jinja new file mode 100644 index 00000000..d4154f06 --- /dev/null +++ b/.cp/{% if 'lab' | _in(templates) %}labs{% endif %}/{{ lab_slug }}/{% if 'terminals' | _in(lab_features) %}.vscode{% endif %}/terminals.json.jinja @@ -0,0 +1,37 @@ +{% raw %}{{% endraw %} + "autorun": true, + "autokill": true, + "env": {% raw %}{{% endraw %} + "TERMINAL_READY_MESSAGE": "Please check the README.md and the lab documentation before using the lab.", + "TERMINAL_SHELL": "bash", + "TERMINAL_STATUS_COMMAND": "Cli -p 15 -c 'show version'", + "TERMINAL_READY_COMMAND": "Cli -p 15" + {% raw %}},{% endraw %} + "terminals": {% raw %}[{% endraw %} +{%- for node in lab_inventory %} + {% raw %}{{% endraw %} + "name": "{{ node.hostname }}", +{%- if node.terminals_description | default(false, true) %} + "description": "{{ node.terminals_description | default("", true) }}", +{%- endif %} +{%- if node.terminals_icon is defined %} + "icon": "{{ node.terminals_icon | default("code", true) }}", +{%- endif %} +{%- if node.terminals_color | default(false, true) %} + "color": "{{ node.terminals_color }}", +{%- endif %} +{%- if node.terminals_split | default(false, true) %} + "split": "{{ node.terminals_split }}", +{%- endif %} + "command": "terminals.sh {{ node.hostname }}", + "recycle": false, + "open": true, + "focus": true +{%- if not loop.last %} + {% raw %}},{% endraw %} +{%- else %} + {% raw %}}{% endraw %} +{%- endif %} +{%- endfor %} + {% raw %}]{% endraw %} +{% raw %}}{% endraw %} \ No newline at end of file diff --git a/.github/workflows/container_build_parent_matrix.yml b/.github/workflows/container_build_parent_matrix.yml index 6dfd3495..0469774b 100644 --- a/.github/workflows/container_build_parent_matrix.yml +++ b/.github/workflows/container_build_parent_matrix.yml @@ -30,4 +30,6 @@ jobs: from_variant: ${{ matrix.from_variant }} clab_version: ${{ matrix.clab_version }} # the rev number will be updated with each run - container_revision: "1.1" + # 1.1 - initial version + # 1.2 - added fabiospampinato.vscode-terminals extension + container_revision: "1.2" diff --git a/containers/dev/.devcontainer/devcontainer.json b/containers/dev/.devcontainer/devcontainer.json index ec53a8ee..354fae60 100644 --- a/containers/dev/.devcontainer/devcontainer.json +++ b/containers/dev/.devcontainer/devcontainer.json @@ -16,6 +16,8 @@ "oderwat.indent-rainbow", "AykutSarac.jsoncrack-vscode", "hilleer.yaml-plus-json", + // spell checker + "streetsidesoftware.code-spell-checker", // marp preview extension "marp-team.marp-vscode", // errors and highlighters @@ -28,6 +30,8 @@ "yzhang.markdown-all-in-one", "bierner.markdown-checkbox", "DavidAnson.vscode-markdownlint", + // jinja + "samuelcolvin.jinjahtml", // various tools "tuxtina.json2yaml", "mutantdino.resourcemonitor" diff --git a/containers/lab-base/.devcontainer/Dockerfile b/containers/lab-base/.devcontainer/Dockerfile index f2abb9d4..f878790d 100644 --- a/containers/lab-base/.devcontainer/Dockerfile +++ b/containers/lab-base/.devcontainer/Dockerfile @@ -26,6 +26,9 @@ RUN apt-get update \ # copy postCreate script COPY ./postCreate.sh /bin/postCreate.sh RUN chmod +x /bin/postCreate.sh +# copy terminals script +COPY ./terminals.sh /bin/terminals.sh +RUN chmod +x /bin/terminals.sh USER ${USERNAME} diff --git a/containers/lab-base/.devcontainer/devcontainer.json b/containers/lab-base/.devcontainer/devcontainer.json index b3819b2e..c82ba66c 100644 --- a/containers/lab-base/.devcontainer/devcontainer.json +++ b/containers/lab-base/.devcontainer/devcontainer.json @@ -29,7 +29,9 @@ "DavidAnson.vscode-markdownlint", // various tools "tuxtina.json2yaml", - "mutantdino.resourcemonitor" + "mutantdino.resourcemonitor", + // terminals manager + "fabiospampinato.vscode-terminals" ] } } diff --git a/containers/lab-base/.devcontainer/terminals.sh b/containers/lab-base/.devcontainer/terminals.sh new file mode 100644 index 00000000..aa6fcdde --- /dev/null +++ b/containers/lab-base/.devcontainer/terminals.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# This script requires VSCode `fabiospampinato.vscode-terminals` extension +# The script will wait for docker exec to be ready before making the terminal available to user input + +clear +echo 'Waiting for the lab to start...' +until docker exec -it $1 ${TERMINAL_SHELL} -c "${TERMINAL_STATUS_COMMAND} 2> /dev/null" >/dev/null 2>&1; do + sleep 5 +done +clear +echo "$1 is ready." +# Print additional instructions for the user if env var is set +if [ "${TERMINAL_READY_MESSAGE}" ]; then + echo ${TERMINAL_READY_MESSAGE} +fi +docker exec -it $1 ${TERMINAL_READY_COMMAND}