From cde15610c694073daab9ed1aa806ae8b2ede3b25 Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Fri, 19 May 2023 10:27:41 -0500 Subject: [PATCH 1/9] Bump libs (#380) * Bump ttp from 0.9.2 to 0.9.4 Bumps [ttp](https://github.com/dmulyalin/ttp) from 0.9.2 to 0.9.4. - [Release notes](https://github.com/dmulyalin/ttp/releases) - [Commits](https://github.com/dmulyalin/ttp/compare/0.9.2...0.9.4) --- updated-dependencies: - dependency-name: ttp dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump ipython from 8.10.0 to 8.13.2 Bumps [ipython](https://github.com/ipython/ipython) from 8.10.0 to 8.13.2. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/8.10.0...8.13.2) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update pytest requirement from ~=7.2.1 to ~=7.3.1 Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/7.2.1...7.3.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update flake8-comprehensions requirement from ~=3.11.1 to ~=3.12.0 Updates the requirements on [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) to permit the latest version. - [Release notes](https://github.com/adamchainz/flake8-comprehensions/releases) - [Changelog](https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst) - [Commits](https://github.com/adamchainz/flake8-comprehensions/compare/3.11.1...3.12.0) --- updated-dependencies: - dependency-name: flake8-comprehensions dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump nornir-scrapli from 2022.7.30 to 2023.1.30.post1 Bumps [nornir-scrapli](https://github.com/scrapli/nornir_scrapli) from 2022.7.30 to 2023.1.30.post1. - [Release notes](https://github.com/scrapli/nornir_scrapli/releases) - [Commits](https://github.com/scrapli/nornir_scrapli/compare/2022.07.30...2023.01.30.post1) --- updated-dependencies: - dependency-name: nornir-scrapli dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump tokenize-rt from 3.2.0 to 5.0.0 Bumps [tokenize-rt](https://github.com/asottile/tokenize-rt) from 3.2.0 to 5.0.0. - [Release notes](https://github.com/asottile/tokenize-rt/releases) - [Commits](https://github.com/asottile/tokenize-rt/compare/v3.2.0...v5.0.0) --- updated-dependencies: - dependency-name: tokenize-rt dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump click-params from 0.1.2 to 0.4.1 Bumps [click-params](https://github.com/click-contrib/click_params) from 0.1.2 to 0.4.1. - [Release notes](https://github.com/click-contrib/click_params/releases) - [Changelog](https://github.com/click-contrib/click_params/blob/master/CHANGELOG.md) - [Commits](https://github.com/click-contrib/click_params/commits) --- updated-dependencies: - dependency-name: click-params dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump natsort from 7.1.1 to 8.3.1 Bumps [natsort](https://github.com/SethMMorton/natsort) from 7.1.1 to 8.3.1. - [Release notes](https://github.com/SethMMorton/natsort/releases) - [Changelog](https://github.com/SethMMorton/natsort/blob/main/CHANGELOG.md) - [Commits](https://github.com/SethMMorton/natsort/compare/7.1.1...8.3.1) --- updated-dependencies: - dependency-name: natsort dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Bump responses from 0.14.0 to 0.23.1 Bumps [responses](https://github.com/getsentry/responses) from 0.14.0 to 0.23.1. - [Release notes](https://github.com/getsentry/responses/releases) - [Changelog](https://github.com/getsentry/responses/blob/master/CHANGES) - [Commits](https://github.com/getsentry/responses/compare/0.14.0...0.23.1) --- updated-dependencies: - dependency-name: responses dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump nornir-netmiko from 0.2.0 to 1.0.0 Bumps [nornir-netmiko](https://github.com/ktbyers/nornir_netmiko) from 0.2.0 to 1.0.0. - [Release notes](https://github.com/ktbyers/nornir_netmiko/releases) - [Changelog](https://github.com/ktbyers/nornir_netmiko/blob/develop/release_process.txt) - [Commits](https://github.com/ktbyers/nornir_netmiko/compare/0.2.0...1.0.0) --- updated-dependencies: - dependency-name: nornir-netmiko dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukebates123 --- pyproject.toml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7e97dd99f..9dd1ce27e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,35 +41,35 @@ dependencies = [ 'aiohttp==3.8.4', 'click-help-colors==0.9.1', 'click-option-group==0.5.5', - 'click-params==0.1.2', + 'click-params==0.4.1', 'click-spinner==0.1.10', 'click==8.1.3', 'colorama==0.4.6', 'emoji==2.2.0', 'hier-config==2.2.2', - 'ipython==8.10.0', + 'ipython==8.13.2', 'jinja2==3.1.2', 'jsonschema==4.17.3', 'kubernetes==26.1.0', 'mac-vendor-lookup==0.1.12', - 'natsort==7.1.1', + 'natsort==8.3.1', 'netaddr==0.8.0', 'netmiko==4.1.2', 'netutils==1.4.1', - 'nornir-netmiko==0.2.0', + 'nornir-netmiko==1.0.0', 'nornir-salt==0.19.1', - 'nornir-scrapli==2022.7.30', + 'nornir-scrapli==2023.1.30.post1', 'nornir-utils==0.2.0', 'nornir==3.3.0', 'openpyxl==3.1.2', 'pyyaml==6.0', 'requests==2.28.2', - 'responses==0.14.0', + 'responses==0.23.1', 'ruamel.yaml<0.17.22', 'tabulate==0.9.0', - 'tokenize-rt==3.2.0', + 'tokenize-rt==5.0.0', 'tomli==2.0.1', - 'ttp==0.9.2', + 'ttp==0.9.4', 'urllib3==1.26.15', 'yamale<=4.0.4', ] @@ -104,7 +104,7 @@ lint = [ 'flake8-black~=0.3.6', 'flake8-bugbear~=23.3.12', 'flake8-commas~=2.1.0', - 'flake8-comprehensions~=3.11.1', + 'flake8-comprehensions~=3.12.0', 'flake8-debugger~=4.1.2', 'flake8-docstrings~=1.7.0', 'flake8-eradicate~=1.4.0', @@ -123,7 +123,7 @@ test = [ 'coverage~=7.2.2', 'mock~=5.0.1', 'py~=1.11.0', - 'pytest~=7.2.1', + 'pytest~=7.3.1', 'pytest-cov~=4.0.0', 'pytest-sugar~=0.9.6', 'testfixtures~=7.1.0', From a7c27b8494d96f1ecccb1796d662734ccd858631 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Fri, 19 May 2023 12:17:37 -0500 Subject: [PATCH 2/9] add integration tests using shellspec (#363) this adds a spec/ folder, where all the tests live. To begin, I just added simple tests for the --help output of every command. More work is needed to run more tests and additional mocks are needed for the majority of the commands. This gives us a good start and works as a nice sanity check. Signed-off-by: Jacob Salmela Co-authored-by: Sean Lynn --- .github/CHANGELOG.md | 3 ++ .github/workflows/tests.yml | 52 ++++++++++++++++++++--- .shellspec | 12 ++++++ Makefile | 15 +++++++ spec/backup_network_spec.sh | 28 +++++++++++++ spec/backup_spec.sh | 28 +++++++++++++ spec/banner.md | 1 + spec/cache_spec.sh | 46 +++++++++++++++++++++ spec/config_spec.sh | 28 +++++++++++++ spec/generate_spec.sh | 52 +++++++++++++++++++++++ spec/init_spec.sh | 28 +++++++++++++ spec/report_spec.sh | 70 +++++++++++++++++++++++++++++++ spec/spec_helper.sh | 79 +++++++++++++++++++++++++++++++++++ spec/test_spec.sh | 28 +++++++++++++ spec/validate_spec.sh | 82 +++++++++++++++++++++++++++++++++++++ spec/version_spec.sh | 28 +++++++++++++ 16 files changed, 575 insertions(+), 5 deletions(-) create mode 100644 .shellspec create mode 100755 spec/backup_network_spec.sh create mode 100755 spec/backup_spec.sh create mode 100644 spec/banner.md create mode 100755 spec/cache_spec.sh create mode 100755 spec/config_spec.sh create mode 100755 spec/generate_spec.sh create mode 100755 spec/init_spec.sh create mode 100755 spec/report_spec.sh create mode 100644 spec/spec_helper.sh create mode 100755 spec/test_spec.sh create mode 100755 spec/validate_spec.sh create mode 100755 spec/version_spec.sh diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index ff65646e3..e948414db 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,4 +1,7 @@ ## Changelog +## [UNRELEASED] + +- added very basic integration tests via shellspec for local and github actions ## [1.7.3] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 12c733c52..d59250b8b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,10 +23,12 @@ # name: Python (unit tests) -on: [push] +on: + push: + workflow_dispatch: jobs: - nox: + unit_tests: name: Tests and Coverage strategy: matrix: @@ -44,6 +46,46 @@ jobs: env: GIT_REPO_NAME: "${GITHUB_REPOSITORY#*/}" run: | - pip install .[ci] - nox -e tests - nox -e cover + pip install setuptools_scm[toml] '.[test]' + make unit + + integration_tests: + strategy: + matrix: + version: ['3.10', '3.9'] + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.version }} + + - if: ${{ matrix.os == 'ubuntu-latest' }} + uses: cachix/install-nix-action@v18 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + experimental-features = nix-command flakes + + - if: ${{ matrix.os == 'ubuntu-latest' }} + name: Run shellspec + run: | + pip install setuptools_scm[toml] '.[test]' + nix-shell -p shellspec --run 'make integration' + + - if: ${{ matrix.os == 'macos-latest' }} + name: Install shellspec (macOS) + run: | + brew tap shellspec/shellspec + brew update + brew install shellspec ksh93 bash + + - if: ${{ matrix.os == 'macos-latest' }} + name: Run integration tests via shellspec + run: | + pip install setuptools_scm[toml] '.[test]' + make integration diff --git a/.shellspec b/.shellspec new file mode 100644 index 000000000..d567ecf97 --- /dev/null +++ b/.shellspec @@ -0,0 +1,12 @@ +--require spec_helper + +## Default kcov (coverage) options +# --kcov-options "--include-path=. --path-strip-level=1" +# --kcov-options "--include-pattern=.sh" +# --kcov-options "--exclude-pattern=/.shellspec,/spec/,/coverage/,/report/" + +## Example: Include script "myprog" with no extension +# --kcov-options "--include-pattern=.sh,myprog" + +## Example: Only specified files/directories +# --kcov-options "--include-pattern=myprog,/lib/" diff --git a/Makefile b/Makefile index 3ad17f637..6a7bcc72c 100644 --- a/Makefile +++ b/Makefile @@ -186,6 +186,21 @@ help: clean: rm -rf build dist +############################################################################# +# Testing targets +############################################################################# + +# docs are deployed with mike, but we can build them locally with mkdocs +# mike can also serve local docs, but requires a bit more setup +# with deploy and set-default and using a specfic branch so as not to overwrite gh-pages +unit: + pip install .[ci] + nox -e tests + nox -e cover + +integration: + shellspec --format tap --no-warning-as-failure --jobs 3 + ############################################################################# # Doc targets ############################################################################# diff --git a/spec/backup_network_spec.sh b/spec/backup_network_spec.sh new file mode 100755 index 000000000..1a6a61da1 --- /dev/null +++ b/spec/backup_network_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'backup network --help' + When call canu backup network --help + The lines of stdout should equal 15 + The line 1 of stdout should equal 'Usage: canu backup network [OPTIONS]' +End diff --git a/spec/backup_spec.sh b/spec/backup_spec.sh new file mode 100755 index 000000000..cb58cef5b --- /dev/null +++ b/spec/backup_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'backup --help' + When call canu backup --help + The lines of stdout should equal 9 + The line 1 of stdout should equal 'Usage: canu backup [OPTIONS] COMMAND [ARGS]...' +End diff --git a/spec/banner.md b/spec/banner.md new file mode 100644 index 000000000..a40823685 --- /dev/null +++ b/spec/banner.md @@ -0,0 +1 @@ +I can test canu works as expected, canu? diff --git a/spec/cache_spec.sh b/spec/cache_spec.sh new file mode 100755 index 000000000..c72f0cce4 --- /dev/null +++ b/spec/cache_spec.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'cache --help' + When call canu cache --help + The lines of stdout should equal 11 + The line 1 of stdout should equal 'Usage: canu cache [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache delete --help' + When call canu cache delete --help + The lines of stdout should equal 6 + The line 1 of stdout should equal 'Usage: canu cache delete [OPTIONS]' +End + +It 'cache location --help' + When call canu cache location --help + The lines of stdout should equal 6 + The line 1 of stdout should equal 'Usage: canu cache location [OPTIONS]' +End + +It 'cache print --help' + When call canu cache print --help + The lines of stdout should equal 6 + The line 1 of stdout should equal 'Usage: canu cache print [OPTIONS]' +End diff --git a/spec/config_spec.sh b/spec/config_spec.sh new file mode 100755 index 000000000..620e08c01 --- /dev/null +++ b/spec/config_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'cache config --help' + When call canu config --help + The lines of stdout should equal 6 + The line 1 of stdout should equal 'Usage: canu config [OPTIONS] COMMAND [ARGS]...' +End diff --git a/spec/generate_spec.sh b/spec/generate_spec.sh new file mode 100755 index 000000000..507d253d3 --- /dev/null +++ b/spec/generate_spec.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'cache generate --help' + When call canu generate --help + The lines of stdout should equal 10 + The line 1 of stdout should equal 'Usage: canu generate [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache generate network --help' + When call canu generate network --help + The lines of stdout should equal 9 + The line 1 of stdout should equal 'Usage: canu generate network [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache generate network config --help' + When call canu generate network config --help + The lines of stdout should equal 78 + The line 1 of stdout should equal 'Usage: canu generate network config [OPTIONS]' +End + +It 'cache generate switch --help' + When call canu generate switch --help + The lines of stdout should equal 9 + The line 1 of stdout should equal 'Usage: canu generate switch [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache generate switch config --help' + When call canu generate switch config --help + The lines of stdout should equal 81 + The line 1 of stdout should equal 'Usage: canu generate switch config [OPTIONS]' +End diff --git a/spec/init_spec.sh b/spec/init_spec.sh new file mode 100755 index 000000000..948c21471 --- /dev/null +++ b/spec/init_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'cache init --help' + When call canu init --help + The lines of stdout should equal 29 + The line 1 of stdout should equal 'Usage: canu init [OPTIONS]' +End diff --git a/spec/report_spec.sh b/spec/report_spec.sh new file mode 100755 index 000000000..b6b2e9952 --- /dev/null +++ b/spec/report_spec.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'cache report --help' + When call canu report --help + The lines of stdout should equal 10 + The line 1 of stdout should equal 'Usage: canu report [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache report network --help' + When call canu report network --help + The lines of stdout should equal 11 + The line 1 of stdout should equal 'Usage: canu report network [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache report network cabling --help' + When call canu report network cabling --help + The lines of stdout should equal 62 + The line 1 of stdout should equal 'Usage: canu report network cabling [OPTIONS]' +End + +It 'cache report network firmware --help' + When call canu report network firmware --help + The lines of stdout should equal 37 + The line 1 of stdout should equal 'Usage: canu report network firmware [OPTIONS]' +End + +It 'cache report network version --help' + When call canu report network version --help + The lines of stdout should equal 18 + The line 1 of stdout should equal 'Usage: canu report network version [OPTIONS]' +End + +It 'cache report switch --help' + When call canu report switch --help + The lines of stdout should equal 10 + The line 1 of stdout should equal 'Usage: canu report switch [OPTIONS] COMMAND [ARGS]...' +End + +It 'cache report switch cabling --help' + When call canu report switch cabling --help + The lines of stdout should equal 32 + The line 1 of stdout should equal 'Usage: canu report switch cabling [OPTIONS]' +End + +It 'cache report switch firmware --help' + When call canu report switch firmware --help + The lines of stdout should equal 22 + The line 1 of stdout should equal 'Usage: canu report switch firmware [OPTIONS]' +End diff --git a/spec/spec_helper.sh b/spec/spec_helper.sh new file mode 100644 index 000000000..7df922c97 --- /dev/null +++ b/spec/spec_helper.sh @@ -0,0 +1,79 @@ +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +# shellcheck shell=sh + +# Defining variables and functions here will affect all specfiles. +# Change shell options inside a function may cause different behavior, +# so it is better to set them here. +# set -eu + +# This callback function will be invoked only once before loading specfiles. +spec_helper_precheck() { + # Available functions: info, warn, error, abort, setenv, unsetenv + # Available variables: VERSION, SHELL_TYPE, SHELL_VERSION + : minimum_version "0.28.1" +} + +# This callback function will be invoked after a specfile has been loaded. +spec_helper_loaded() { + : +} + +# This callback function will be invoked after core modules has been loaded. +spec_helper_configure() { + # Available functions: import, before_each, after_each, before_all, after_all + : import 'support/custom_matcher' +} + +# Custom matcher used to find a string inside of a text containing ANSI escape codes. +# https://github.com/shellspec/shellspec/issues/278 +match_colored_text() { + # Source: https://unix.stackexchange.com/a/18979/348102 + sanitized_text="$(echo "${match_colored_text:?}" | perl -e ' + while (<>) { + s/ \e[ #%()*+\-.\/]. | + \r | # Remove extra carriage returns also + (?:\e\[|\x9b) [ -?]* [@-~] | # CSI ... Cmd + (?:\e\]|\x9d) .*? (?:\e\\|[\a\x9c]) | # OSC ... (ST|BEL) + (?:\e[P^_]|[\x90\x9e\x9f]) .*? (?:\e\\|\x9c) | # (DCS|PM|APC) ... ST + \e.|[\x80-\x9f] //xg; + 1 while s/[^\b][\b]//g; # remove all non-backspace followed by backspace + print; + } + ')" + echo "${sanitized_text}" | grep -q "$1" +} + +# Custom matcher used to find a string inside of a text containing ANSI escape codes. +match_rich_text() { + if [ -z "${1}" ]; then + printf "ERROR: You cannot pass an empty string!\n" >&2; + return 1; + fi + + # shellcheck disable=SC2059 + rich_search_term="$(printf "$1")" + match="$(echo "${match_rich_text:-}" | perl -ne "print if /\Q${rich_search_term}/")" + + [ -n "${match}" ] +} diff --git a/spec/test_spec.sh b/spec/test_spec.sh new file mode 100755 index 000000000..51caf235d --- /dev/null +++ b/spec/test_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'test --help' + When call canu test --help + The lines of stdout should equal 22 + The line 1 of stdout should equal 'Usage: canu test [OPTIONS]' +End diff --git a/spec/validate_spec.sh b/spec/validate_spec.sh new file mode 100755 index 000000000..53a7f3d46 --- /dev/null +++ b/spec/validate_spec.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It 'validate --help' + When call canu validate --help + The lines of stdout should equal 14 + The line 1 of stdout should equal 'Usage: canu validate [OPTIONS] COMMAND [ARGS]...' +End + +It 'validate network --help' + When call canu validate network --help + The lines of stdout should equal 10 + The line 1 of stdout should equal 'Usage: canu validate network [OPTIONS] COMMAND [ARGS]...' +End + +It 'validate network bgp --help' + When call canu validate network bgp --help + The lines of stdout should equal 28 + The line 1 of stdout should equal 'Usage: canu validate network bgp [OPTIONS]' +End + +It 'validate network cabling --help' + When call canu validate network cabling --help + The lines of stdout should equal 28 + The line 1 of stdout should equal 'Usage: canu validate network cabling [OPTIONS]' +End + +It 'validate paddle --help' + When call canu validate paddle --help + The lines of stdout should equal 15 + The line 1 of stdout should equal 'Usage: canu validate paddle [OPTIONS]' +End + +It 'validate paddle-cabling --help' + When call canu validate paddle-cabling --help + The lines of stdout should equal 27 + The line 1 of stdout should equal 'Usage: canu validate paddle-cabling [OPTIONS]' +End + +It 'validate shcd --help' + When call canu validate shcd --help + The lines of stdout should equal 33 + The line 1 of stdout should equal 'Usage: canu validate shcd [OPTIONS]' +End + +It 'validate shcd-cabling --help' + When call canu validate shcd-cabling --help + The lines of stdout should equal 33 + The line 1 of stdout should equal 'Usage: canu validate shcd-cabling [OPTIONS]' +End + +It 'validate switch --help' + When call canu validate switch --help + The lines of stdout should equal 9 + The line 1 of stdout should equal 'Usage: canu validate switch [OPTIONS] COMMAND [ARGS]...' +End + +It 'validate switch config --help' + When call canu validate switch config --help + The lines of stdout should equal 47 + The line 1 of stdout should equal 'Usage: canu validate switch config [OPTIONS]' +End diff --git a/spec/version_spec.sh b/spec/version_spec.sh new file mode 100755 index 000000000..5af8ecb6c --- /dev/null +++ b/spec/version_spec.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh +# MIT License +# +# (C) Copyright 2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +It '--version' + When call canu --version + The lines of stdout should equal 1 + The line 1 of stdout should include 'canu, version ' +End From c9125cca7bc86c4354460c98b6e02bbdda33d73a Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Wed, 7 Jun 2023 18:03:38 -0500 Subject: [PATCH 3/9] Lib bumps (#399) * Update ruamel-yaml requirement from <0.17.22 to <0.17.32 Updates the requirements on [ruamel-yaml](https://sourceforge.net/p/ruamel-yaml/code/ci/default/tree) to permit the latest version. --- updated-dependencies: - dependency-name: ruamel-yaml dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump cachix/install-nix-action from 18 to 21 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 18 to 21. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v18...v21) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update pytest-cov requirement from ~=4.0.0 to ~=4.1.0 Updates the requirements on [pytest-cov](https://github.com/pytest-dev/pytest-cov) to permit the latest version. - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest-cov/compare/v4.0.0...v4.1.0) --- updated-dependencies: - dependency-name: pytest-cov dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump emoji from 2.2.0 to 2.4.0 Bumps [emoji](https://github.com/carpedm20/emoji) from 2.2.0 to 2.4.0. - [Release notes](https://github.com/carpedm20/emoji/releases) - [Changelog](https://github.com/carpedm20/emoji/blob/master/CHANGES.md) - [Commits](https://github.com/carpedm20/emoji/compare/v2.2.0...v2.4.0) --- updated-dependencies: - dependency-name: emoji dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump requests from 2.28.2 to 2.31.0 Bumps [requests](https://github.com/psf/requests) from 2.28.2 to 2.31.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.28.2...v2.31.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update sphinx requirement from ~=6.1.3 to ~=7.0.1 Updates the requirements on [sphinx](https://github.com/sphinx-doc/sphinx) to permit the latest version. - [Release notes](https://github.com/sphinx-doc/sphinx/releases) - [Changelog](https://github.com/sphinx-doc/sphinx/blob/master/CHANGES) - [Commits](https://github.com/sphinx-doc/sphinx/compare/v6.1.3...v7.0.1) --- updated-dependencies: - dependency-name: sphinx dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Update flake8-bugbear requirement from ~=23.3.12 to ~=23.5.9 Updates the requirements on [flake8-bugbear](https://github.com/PyCQA/flake8-bugbear) to permit the latest version. - [Release notes](https://github.com/PyCQA/flake8-bugbear/releases) - [Commits](https://github.com/PyCQA/flake8-bugbear/compare/23.3.12...23.5.9) --- updated-dependencies: - dependency-name: flake8-bugbear dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump netmiko from 4.1.2 to 4.2.0 Bumps [netmiko](https://github.com/ktbyers/netmiko) from 4.1.2 to 4.2.0. - [Release notes](https://github.com/ktbyers/netmiko/releases) - [Changelog](https://github.com/ktbyers/netmiko/blob/develop/release_process.txt) - [Commits](https://github.com/ktbyers/netmiko/compare/v4.1.2...v4.2.0) --- updated-dependencies: - dependency-name: netmiko dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update nox requirement from ~=2022.11.21 to ~=2023.4.22 Updates the requirements on [nox](https://github.com/wntrblm/nox) to permit the latest version. - [Release notes](https://github.com/wntrblm/nox/releases) - [Changelog](https://github.com/wntrblm/nox/blob/main/CHANGELOG.md) - [Commits](https://github.com/wntrblm/nox/compare/2022.11.21...2023.04.22) --- updated-dependencies: - dependency-name: nox dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Bump nornir-salt from 0.19.1 to 0.19.2 Bumps [nornir-salt](https://github.com/dmulyalin/nornir-salt) from 0.19.1 to 0.19.2. - [Release notes](https://github.com/dmulyalin/nornir-salt/releases) - [Commits](https://github.com/dmulyalin/nornir-salt/compare/0.19.1...0.19.2) --- updated-dependencies: - dependency-name: nornir-salt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump urllib3 from 1.26.15 to 2.0.2 Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.15 to 2.0.2. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.26.15...2.0.2) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * rollback netmiko * rollback flake8 * revert sphinx --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukebates123 --- .github/workflows/tests.yml | 2 +- pyproject.toml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d59250b8b..7bd9181fe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,7 @@ jobs: python-version: ${{ matrix.version }} - if: ${{ matrix.os == 'ubuntu-latest' }} - uses: cachix/install-nix-action@v18 + uses: cachix/install-nix-action@v21 with: nix_path: nixpkgs=channel:nixos-unstable extra_nix_config: | diff --git a/pyproject.toml b/pyproject.toml index 9dd1ce27e..33e36738f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ dependencies = [ 'click-spinner==0.1.10', 'click==8.1.3', 'colorama==0.4.6', - 'emoji==2.2.0', + 'emoji==2.4.0', 'hier-config==2.2.2', 'ipython==8.13.2', 'jinja2==3.1.2', @@ -57,20 +57,20 @@ dependencies = [ 'netmiko==4.1.2', 'netutils==1.4.1', 'nornir-netmiko==1.0.0', - 'nornir-salt==0.19.1', + 'nornir-salt==0.19.2', 'nornir-scrapli==2023.1.30.post1', 'nornir-utils==0.2.0', 'nornir==3.3.0', 'openpyxl==3.1.2', 'pyyaml==6.0', - 'requests==2.28.2', + 'requests==2.31.0', 'responses==0.23.1', - 'ruamel.yaml<0.17.22', + 'ruamel.yaml<0.17.32', 'tabulate==0.9.0', 'tokenize-rt==5.0.0', 'tomli==2.0.1', 'ttp==0.9.4', - 'urllib3==1.26.15', + 'urllib3==2.0.2', 'yamale<=4.0.4', ] dynamic = ['entry-points', 'scripts', 'version'] @@ -86,7 +86,7 @@ license = { file = 'LICENSE' } [project.optional-dependencies] ci = [ - 'nox~=2022.11.21', + 'nox~=2023.4.22', ] docs = [ 'myst-parser~=1.0.0', @@ -124,7 +124,7 @@ test = [ 'mock~=5.0.1', 'py~=1.11.0', 'pytest~=7.3.1', - 'pytest-cov~=4.0.0', + 'pytest-cov~=4.1.0', 'pytest-sugar~=0.9.6', 'testfixtures~=7.1.0', ] From a55e294e9ca6ef89b9db3f218cb0d24575e949cf Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:34:26 -0500 Subject: [PATCH 4/9] Library bumps (#407) * Bump click-option-group from 0.5.5 to 0.5.6 Bumps [click-option-group](https://github.com/click-contrib/click-option-group) from 0.5.5 to 0.5.6. - [Release notes](https://github.com/click-contrib/click-option-group/releases) - [Changelog](https://github.com/click-contrib/click-option-group/blob/master/CHANGELOG.md) - [Commits](https://github.com/click-contrib/click-option-group/compare/v0.5.5...v0.5.6) --- updated-dependencies: - dependency-name: click-option-group dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump emoji from 2.4.0 to 2.5.0 Bumps [emoji](https://github.com/carpedm20/emoji) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/carpedm20/emoji/releases) - [Changelog](https://github.com/carpedm20/emoji/blob/master/CHANGES.md) - [Commits](https://github.com/carpedm20/emoji/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: emoji dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump tokenize-rt from 5.0.0 to 5.1.0 Bumps [tokenize-rt](https://github.com/asottile/tokenize-rt) from 5.0.0 to 5.1.0. - [Commits](https://github.com/asottile/tokenize-rt/compare/v5.0.0...v5.1.0) --- updated-dependencies: - dependency-name: tokenize-rt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump ipython from 8.13.2 to 8.14.0 Bumps [ipython](https://github.com/ipython/ipython) from 8.13.2 to 8.14.0. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/8.13.2...8.14.0) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update flake8-eradicate requirement from ~=1.4.0 to ~=1.5.0 Updates the requirements on [flake8-eradicate](https://github.com/wemake-services/flake8-eradicate) to permit the latest version. - [Release notes](https://github.com/wemake-services/flake8-eradicate/releases) - [Changelog](https://github.com/wemake-services/flake8-eradicate/blob/master/CHANGELOG.md) - [Commits](https://github.com/wemake-services/flake8-eradicate/commits) --- updated-dependencies: - dependency-name: flake8-eradicate dependency-type: direct:production ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 33e36738f..9fa1a5344 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,14 +40,14 @@ description = 'CSM Automatic Network Utility' dependencies = [ 'aiohttp==3.8.4', 'click-help-colors==0.9.1', - 'click-option-group==0.5.5', + 'click-option-group==0.5.6', 'click-params==0.4.1', 'click-spinner==0.1.10', 'click==8.1.3', 'colorama==0.4.6', - 'emoji==2.4.0', + 'emoji==2.5.0', 'hier-config==2.2.2', - 'ipython==8.13.2', + 'ipython==8.14.0', 'jinja2==3.1.2', 'jsonschema==4.17.3', 'kubernetes==26.1.0', @@ -67,7 +67,7 @@ dependencies = [ 'responses==0.23.1', 'ruamel.yaml<0.17.32', 'tabulate==0.9.0', - 'tokenize-rt==5.0.0', + 'tokenize-rt==5.1.0', 'tomli==2.0.1', 'ttp==0.9.4', 'urllib3==2.0.2', @@ -107,7 +107,7 @@ lint = [ 'flake8-comprehensions~=3.12.0', 'flake8-debugger~=4.1.2', 'flake8-docstrings~=1.7.0', - 'flake8-eradicate~=1.4.0', + 'flake8-eradicate~=1.5.0', 'flake8-import-order~=0.18.2', 'flake8-quotes~=3.3.2', 'flake8-string-format==0.3.0', From 67e5ce5ef1d5a7b5368ca63e37612fc2913aeb65 Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Tue, 13 Jun 2023 13:18:31 -0500 Subject: [PATCH 5/9] CASMNET-1893 Canu test improvements/bug-fixes (#398) * aruba test fixes/upgrades * pyinstaller * pyinstaller * format * revert * spec * Update test_suite.yaml Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> * add additional tests * dellanox tests * fix test_suite --------- Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> Co-authored-by: lukebates123 --- canu/canu.yaml | 45 ++- canu/test/__init__.py | 0 canu/test/aruba/bgp_test.py | 117 ++++++++ canu/test/aruba/test_suite.yaml | 231 +++++++++------ canu/test/aruba/vlan_interface_test.py | 103 +++++++ canu/test/custom.py | 0 canu/test/dellanox/test_suite.yaml | 56 ++-- canu/test/test.py | 141 +++++++--- canu/utils/inventory.py | 28 +- canu/utils/json_load.py | 48 ++++ canu/utils/sls.py | 376 +++++++++---------------- canu/utils/sls_utils/Managers.py | 16 +- canu/utils/sls_utils/index.md | 6 +- pyinstaller.py | 32 +-- spec/test_spec.sh | 2 +- 15 files changed, 756 insertions(+), 445 deletions(-) mode change 100755 => 100644 canu/test/__init__.py create mode 100644 canu/test/aruba/bgp_test.py create mode 100644 canu/test/aruba/vlan_interface_test.py mode change 100755 => 100644 canu/test/custom.py mode change 100755 => 100644 canu/test/test.py create mode 100644 canu/utils/json_load.py mode change 120000 => 100644 canu/utils/sls_utils/index.md diff --git a/canu/canu.yaml b/canu/canu.yaml index eef3b8cf8..83407e935 100644 --- a/canu/canu.yaml +++ b/canu/canu.yaml @@ -80,13 +80,13 @@ csm: "1.3": aruba: "6300": - - FL.10.09.0010 + - FL.10.11.1010 "8320": - - GL.10.09.0010 + - GL.10.11.1010 "8325": - - GL.10.09.0010 + - GL.10.11.1010 "8360": - - LL.10.09.0010 + - LL.10.11.1010 X86-64: - Virtual.10.09.0010 dell: @@ -108,13 +108,41 @@ csm: "1.4": aruba: "6300": - - FL.10.09.0010 + - FL.10.11.1010 "8320": - - GL.10.09.0010 + - GL.10.11.1010 "8325": - - GL.10.09.0010 + - GL.10.11.1010 "8360": - - LL.10.09.0010 + - LL.10.11.1010 + X86-64: + - Virtual.10.09.0010 + dell: + "S3048-ON": + - "10.5.1.4" + "S4148F-ON": + - "10.5.1.4" + "S4148T-ON": + - "10.5.1.4" + "S4048-VM": + - "10.5.0.0" + "S4048T-ON": + - "10.5.1.4" + mellanox: + MSN2100: + - 3.9.3210 + MSN2700: + - 3.9.3210 + "1.5": + aruba: + "6300": + - FL.10.11.1010 + "8320": + - GL.10.11.1010 + "8325": + - GL.10.11.1010 + "8360": + - LL.10.11.1010 X86-64: - Virtual.10.09.0010 dell: @@ -138,3 +166,4 @@ csm_versions: - "1.2" - "1.3" - "1.4" + - "1.5" diff --git a/canu/test/__init__.py b/canu/test/__init__.py old mode 100755 new mode 100644 diff --git a/canu/test/aruba/bgp_test.py b/canu/test/aruba/bgp_test.py new file mode 100644 index 000000000..45ddff06e --- /dev/null +++ b/canu/test/aruba/bgp_test.py @@ -0,0 +1,117 @@ +# MIT License +# +# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +"""parse aruba bgp config and test for missing neighbors.""" +from ttp import ttp + + +def bgp_config(result, vlan_ips): + """Verify NCN-W IPs in SLS are BGP neighbors on the switch. + + Args: + result: show run bgp + vlan_ips: list of NCN and Switch IPs + + Returns: + Pass or fail + """ + # TTP template to convert switch show command to structured data. + aruba_aoscx_show_run_bgp = """ + +router bgp {{ asn }} + + neighbor {{ neighbor | _start_ }} remote-as {{ remote_asn }} + neighbor {{ neighbor }} {{ passive | macro("is_passive") }} + + + neighbor {{ neighbor }} {{ activate | exclude("passive") | macro("is_active") }} + + + neighbor {{ neighbor }} route-map {{ route-map-in }} in + + + neighbor {{ neighbor }} route-map {{ route-map-out }} out + + + + vrf {{ vrf }} + bgp router-id {{ bgp_rid }} + maximum-paths {{ max_paths }} + timers bgp {{ keepalive_timer }} {{ hold_timer }} + distance bgp {{ ebgp_distance }} {{ ibgp_distance }} + + neighbor {{ neighbor | _start_ }} remote-as {{ remote_asn }} + neighbor {{ neighbor }} {{ passive | macro("is_passive") }} + + + neighbor {{ neighbor }} {{ activate | macro("is_active") }} + + + neighbor {{ neighbor }} route-map {{ route-map-in }} in + + + neighbor {{ neighbor }} route-map {{ route-map-out }} out + + + """ + # Parse the aruba "show run bgp" command + result_parsed = ttp(str(result), aruba_aoscx_show_run_bgp) + result_parsed.parse() + output = result_parsed.result() + + exception = None + result = "PASS" + success = True + + # Get BGP peers from switch config + bgp_peers = {} + bgp_peers.update(output[0][0]["bgp_cfg"]["vrfs"]["Customer"]["peers"]) + bgp_peers.update(output[0][0]["bgp_cfg"]["vrfs"]["default"]["peers"]) + + # Get the worker nodes CMN and NMN IPs + # If those are not in the BGP config on the switch add them to the list. + + missing_neighbors = [ + data["name"] + for data in ( + entry + for net, vlan_data in vlan_ips.items() + for entry in vlan_data.get("ips", []) + if "ncn-w" in entry["name"] + and any(s in entry["name"] for s in ["cmn", "nmn"]) + and entry["ipv4_address"] not in bgp_peers + ) + ] + + # Add missing neighbors to test exception message. + if missing_neighbors: + missing_neighbors_string = ", ".join(missing_neighbors) + exception = ( + f"Missing BGP Neighbors: {missing_neighbors_string}\n" + "This is usually caused by changing networks used by CSM or adding worker nodes" + ) + result = "FAIL" + + return { + "exception": exception, + "result": result, + "success": success, + } diff --git a/canu/test/aruba/test_suite.yaml b/canu/test/aruba/test_suite.yaml index e5dde054f..450bd8cf3 100644 --- a/canu/test/aruba/test_suite.yaml +++ b/canu/test/aruba/test_suite.yaml @@ -20,40 +20,74 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. --- -- name: Software version test +- name: Software Version task: show version test: contains - pattern: "10.09.0010" + pattern: "10.11.1010" err_msg: Software version is wrong device: - cdu - leaf - leaf-bmc - spine -- name: lacp interfaces test + pre_install: True + +- name: BGP Config + task: show run bgp + test: custom + function_file: bgp_test.py + function_name: bgp_config + device: + - spine + pre_install: True + +- name: VLAN IP Interface Config + task: show run + test: custom + function_file: vlan_interface_test.py + function_name: vlan_interface_config + device: + - cdu + - leaf + - leaf-bmc + - spine + pre_install: True + +- name: LACP Interfaces task: show lacp interfaces test: ncontains_lines pattern: - "lacp-block" - "ASFO" - err_msg: lacp port blocking or out of sync + err_msg: | + LACP port blocking or out of sync. + Run "show lacp interfaces" & "show int br" to identify the ports. + This error is often caused by a cabling issue. device: - cdu - leaf - leaf-bmc - spine -- name: interface speed mismatch check + pre_install: True + +- name: Interface Speed Mismatch task: show int br test: ncontains_lines pattern: - "mismatch" - err_msg: interface speed mismatch detected + err_msg: | + Interface speed mismatch detected. + Execute "show system interface-group" on the switch. + This error indicates a transceiver cannot match the port group speed. + You can ignore this message if the affected port is not in use. device: - cdu - leaf - leaf-bmc - spine -- name: VSX status check + pre_install: True + +- name: VSX Status task: show vsx status test: ncontains_lines pattern: @@ -67,7 +101,9 @@ - leaf - cdu - spine -- name: VSX ISL check + pre_install: True + +- name: VSX ISL task: show lacp interfaces | include lag256 test: ncontains_lines pattern: @@ -77,7 +113,9 @@ - leaf - cdu - spine -- name: VSX keepalive check + pre_install: True + +- name: VSX Keepalive task: show vsx status keepalive test: ncontains_lines pattern: @@ -88,32 +126,37 @@ - leaf - cdu - spine -- name: Interface error check + pre_install: True + +- name: Interface Errors task: "show interface error-statistics | exclude vlan" test: "!contains_re" pattern: "\\d{4,}" - err_msg: Interfaces errors above 999 + err_msg: | + Interfaces errors above 999. + Execute "show interface error-statistics" to display ports with errors. device: - cdu - leaf - leaf-bmc - spine -- name: running-config different from startup-config + pre_install: True + +- name: Running-Config Different from Startup-Config task: checkpoint diff startup-config running-config test: contains pattern: No difference in configs - err_msg: running-config does not match startup-config + err_msg: | + Running-config does not match the startup-config. + Execute "write memory" on the switch to resolve this message. device: - cdu - leaf - leaf-bmc - spine -# - name: custom test -# task: show ip route all-vrfs -# test: custom -# function_file: "custom.py" -# function_name: "run" -- name: STP check for blocked ports + pre_install: True + +- name: STP Blocked Ports task: show spanning-tree inconsistent-ports test: ncontains_lines pattern: @@ -126,41 +169,9 @@ - leaf - leaf-bmc - spine -# - name: CPU Utilization over 70% -# task: show system resource-utilization | include "CPU usage" -# test: "!contains_re" -# pattern: "[7-9][0-9]+" -# err_msg: CPU Utilization is over 70% -# device: -# - cdu -# - leaf -# - leaf-bmc -# - spine -# - name: Memory Utilization over 70% -# task: show system resource-utilization | include "Memory usage" -# test: "!contains_re" -# pattern: "[7-9][0-9]+" -# err_msg: Memory usage is over 70% -# device: -# - cdu -# - leaf -# - leaf-bmc -# - spine -# - name: vlan 1 ip-helper test -# task: show run interface vlan 1 -# test: contains -# pattern: 10.92.100.222 -# err_msg: IP-Helper is missing -# device: -# - spine -# - name: vlan 2 ip-helper test -# task: show run interface vlan 2 -# test: contains -# pattern: 10.92.100.222 -# err_msg: IP-Helper is missing -# device: -# - spine -- name: KEA connection check + pre_install: True + +- name: KEA Connection task: ping 10.92.100.222 source vlan{{ variables.NMN_VLAN }} repetitions 1 test: contains pattern: bytes from @@ -170,21 +181,16 @@ - leaf-bmc - cdu - spine -# - name: vlan 4 ip-helper test -# task: show run interface vlan 4 -# test: contains -# pattern: 10.94.100.222 -# err_msg: IP-Helper is missing -# device: -# - spine -- name: tftp route + +- name: TFTP Route task: show ip route 10.92.100.60 test: contains pattern: Nexthop err_msg: route to tftp incorrect device: - spine -- name: BGP Test + +- name: BGP Neighbors Status task: show bgp all-vrf all summary test: ncontains_lines pattern: @@ -194,14 +200,25 @@ err_msg: BGP has Neighbors not established. device: - spine -- name: STP check for root bridge spine + +- name: BGP vrf Customer Routing Table + task: show ip route bgp vrf Customer + test: ncontains + pattern: No ipv4 routes configured + err_msg: There are no BGP routes in the Customer VRF routing table. + device: + - spine + +- name: STP Root Bridge task: show spanning-tree test: contains pattern: This bridge is the root err_msg: Not the root bridge device: - spine -- name: STP check for root bridge leaf + pre_install: True + +- name: STP Root Bridge task: show spanning test: ncontains pattern: This bridge is the root @@ -210,7 +227,9 @@ - leaf - leaf-bmc - cdu -- name: Is internal DNS server alive (ping) + pre_install: True + +- name: Internal DNS Server Alive (Ping) task: ping 10.92.100.225 repetitions 1 test: contains pattern: bytes from @@ -220,7 +239,8 @@ - leaf-bmc - cdu - spine -- name: Does internal DNS resolve ncn-m001-nmn + +- name: DNS lookup (ncn-m001-nmn) task: ping ncn-m001-nmn repetitions 1 test: contains pattern: bytes from @@ -230,29 +250,76 @@ - leaf-bmc - cdu - spine -- name: Internet connection check - task: ping 8.8.8.8 source vlan{{ variables.CAN_VLAN }} repetitions 1 + # used for testing --csm flag + csm: + - 1.5 + - 1.4 + - 1.3 + +- name: Needed Updates + task: show needed-updates test: contains - pattern: bytes from - err_msg: External network (internet) does not respond. + pattern: Would have updated 0 device(s) + err_msg: | + Switch has pending updates. + To fix, execute the command "allow-unsafe-updates" and reboot. device: - leaf - leaf-bmc - cdu - spine - csm: - - 1.0 -- name: Internet connection check - task: ping 8.8.8.8 source vlan{{ variables.CMN_VLAN }} vrf Customer repetitions 1 - test: contains - pattern: bytes from - err_msg: External network (internet) does not respond. + pre_install: True + +- name: OSPF vrf default Neighbors + task: show ip ospf neighbors + test: ncontains + pattern: No OSPF neighbor + err_msg: No OSPF neighbors found on the default VRF. device: - leaf - leaf-bmc - cdu - spine - csm: - - 1.2 - - 1.3 - - 1.4 + pre_install: True + +- name: OSPF vrf Customer Neighbors + task: show ip ospf neighbors vrf Customer + test: ncontains + pattern: No OSPF neighbor + err_msg: No OSPF neighbors found on the default VRF. + device: + - leaf + - leaf-bmc + - cdu + - spine + pre_install: True + +- name: OSPF vrf default EXSTART Neighbors + task: show ip ospf neighbors + test: ncontains + pattern: EXSTART + err_msg: | + OSPF neighbors found in EXSTART state. + This is commonly caused by a MTU mismatch between neighbors. + Execute "show ip interface" to see the MTU of L3 interfaces. + device: + - leaf + - leaf-bmc + - cdu + - spine + pre_install: True + +- name: OSPF vrf Customer EXSTART Neighbors + task: show ip ospf neighbors vrf Customer + test: ncontains + pattern: EXSTART + err_msg: | + OSPF neighbors found in EXSTART state. + This is commonly caused by a MTU mismatch between neighbors. + Execute "show ip interface" to see the MTU of L3 interfaces. + device: + - leaf + - leaf-bmc + - cdu + - spine + pre_install: True diff --git a/canu/test/aruba/vlan_interface_test.py b/canu/test/aruba/vlan_interface_test.py new file mode 100644 index 000000000..0c23be985 --- /dev/null +++ b/canu/test/aruba/vlan_interface_test.py @@ -0,0 +1,103 @@ +# MIT License +# +# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +"""parse aruba interface config and verify IPs are correct.""" +from ttp import ttp + + +def vlan_interface_config(result, vlan_ips): + """Verify the switch VLAN IPs match SLS. + + Args: + result: show run + vlan_ips: list of NCN and Switch IPs + + Returns: + Pass or fail + """ + aruba_aoscx_show_run_interface = """ + +hostname {{ hostname }} + +vlan {{ vlan }} + + +interface vlan {{ vlan }} + vrf attach {{ vrf }} + description {{ interface_description }} + ip mtu {{ mtu }} + ip address {{ ip | is_ip }} + active-gateway ip mac {{ active_gateway_ip_mac }} + active-gateway ip {{ active_gateway_ip | is_ip }} + ip ospf {{ ospf_instance }} area {{ area }} + + + """ + # Parse the aruba "show run" + result_parsed = ttp(str(result), aruba_aoscx_show_run_interface) + result_parsed.parse() + output = result_parsed.result() + + # Get the vlan config and hostname + vlan_config = output[0][0]["config"]["vlan"] + hostname = output[0][0]["config"]["hostname"] + + exception = [] + result = "PASS" + success = True + + # Verify that the IP addresses from SLS match the IPs that are on the switch. + + for net, net_data in vlan_ips.items(): + vlan = str(net_data["vlan"]) + for data in net_data.get("ips", []): + try: + ip = data["ipv4_address"] + name = data["name"] + if hostname in name: + if vlan in vlan_config and ip in vlan_config[vlan]["ip"]: + continue + else: + exception.append( + f"VLAN IP Incorrect for network: {net} VLAN {vlan}", + ) + result = "FAIL" + success = False + except KeyError: + exception.append( + f"Missing IP address on VLAN interface for network: {net}", + ) + result = "FAIL" + success = False + + # Check if there are any incorrect/missing IP addresses from the switches + if exception: + exception = "\n".join(exception) + exception += "\nVerify IPs in SLS matches the switch config" + else: + exception = None + + # return the results of the test + return { + "exception": exception, + "result": result, + "success": success, + } diff --git a/canu/test/custom.py b/canu/test/custom.py old mode 100755 new mode 100644 diff --git a/canu/test/dellanox/test_suite.yaml b/canu/test/dellanox/test_suite.yaml index ee1901450..74bee8929 100644 --- a/canu/test/dellanox/test_suite.yaml +++ b/canu/test/dellanox/test_suite.yaml @@ -26,8 +26,11 @@ pattern: "10.5.1.4" err_msg: Software version is wrong device: + - leaf - leaf-bmc - cdu + pre_install: True + - name: BGP Test task: show ip bgp vrf all summary test: ncontains_lines @@ -38,6 +41,7 @@ err_msg: BGP has Neighbors not established. device: - spine + - name: running-config different matches startup-config task: show configuration files test: ncontains @@ -45,6 +49,8 @@ err_msg: running-config does not match startup-config device: - spine + pre_install: True + - name: OSPF check task: show ip ospf neighbor test: ncontains @@ -53,6 +59,8 @@ device: - leaf-bmc - cdu + pre_install: True + - name: OSPF check vrf customer task: show ip ospf vrf Customer neighbor test: ncontains @@ -61,6 +69,8 @@ device: - leaf-bmc - cdu + pre_install: True + - name: STP check for root bridge task: show spanning-tree brief test: ncontains @@ -68,6 +78,8 @@ err_msg: we are the STP root device: - leaf-bmc + pre_install: True + - name: Interface error check task: "show interface | grep CRC" test: "!contains_re" @@ -76,6 +88,8 @@ device: - leaf-bmc - cdu + pre_install: True + # - name: running-config different from startup-config # task: show diff running-configuration startup-configuration # test: "!contains_re" @@ -92,6 +106,7 @@ - leaf-bmc - cdu - spine + - name: Does internal DNS resolve ncn-m001-nmn task: ping ncn-m001-nmn -c 1 test: contains @@ -102,6 +117,7 @@ - leaf-bmc - cdu - spine + - name: Software version test task: show version concise test: contains @@ -109,6 +125,8 @@ err_msg: Software version is wrong device: - spine + pre_install: True + - name: STP check for root bridge task: show spanning-tree test: contains @@ -116,6 +134,8 @@ err_msg: Not the root bridge device: - spine + pre_install: True + - name: STP check for discarding ports task: show spanning-tree test: ncontains @@ -123,6 +143,8 @@ err_msg: Port is disabled due to STP device: - spine + pre_install: True + - name: MLAG VIP check task: show mlag-vip test: ncontains @@ -130,6 +152,8 @@ err_msg: MLAG VIP has only 1 active node device: - spine + pre_install: True + - name: Interface error check task: "show interfaces ethernet counters | include error" test: "!contains_re" @@ -137,6 +161,8 @@ err_msg: Interfaces errors above 999 device: - spine + pre_install: True + - name: MLAG check task: show interfaces mlag-port-channel summary | include LACP test: ncontains @@ -144,6 +170,8 @@ err_msg: MLAG port in suspended mode device: - spine + pre_install: True + - name: OSPF check task: show ip ospf neighbors vrf all test: ncontains_lines @@ -152,6 +180,8 @@ err_msg: ospf neighbor down device: - spine + pre_install: True + - name: KEA connection check task: ping 10.92.100.222 -c 1 test: contains @@ -162,29 +192,3 @@ - leaf-bmc - cdu - spine -- name: Internet connection check - task: ping vrf Customer 8.8.8.8 -c 1 - test: contains - pattern: bytes from - err_msg: External network (internet) does not respond. - device: - - leaf - - leaf-bmc - - cdu - - spine - csm: - - 1.2 - - 1.3 - - 1.4 -- name: Internet connection check - task: ping 8.8.8.8 -c 1 - test: contains - pattern: bytes from - err_msg: External network (internet) does not respond. - device: - - leaf - - leaf-bmc - - cdu - - spine - csm: - - 1.0 diff --git a/canu/test/test.py b/canu/test/test.py old mode 100755 new mode 100644 index 300db8c9d..14867f2e1 --- a/canu/test/test.py +++ b/canu/test/test.py @@ -38,6 +38,8 @@ from canu.style import Style from canu.utils.host_alive import host_alive from canu.utils.inventory import inventory +from canu.utils.json_load import load_json +from canu.utils.sls import sls_dump from canu.utils.sls_utils.Managers import NetworkManager # Get project root directory @@ -58,10 +60,10 @@ @click.option("--username", default="admin", show_default=True, help="Switch username") @click.option( "--csm", + default="1.4", type=click.Choice(csm_options), help="CSM version", - prompt="CSM version", - required=True, + required=False, show_choices=True, ) @click.option( @@ -106,9 +108,15 @@ help="Ping test from all mgmt switches to all NCNs.", required=False, ) +@click.option( + "--pre-install", + "pre_install_", + is_flag=True, + help="Tests to run before installing CSM", + required=False, +) @click.option("--sls-address", default="api-gw-service-nmn.local", show_default=True) @click.pass_context -# @pysnooper.snoop() def test( ctx, username, @@ -120,6 +128,7 @@ def test( log_, json_, ping, + pre_install_, ): """Run tests against the network. @@ -134,6 +143,7 @@ def test( log_: enable logging json_: output test results in JSON format ping: run the ping test suite + pre_install_: Tests to run before CSM installation """ if not password: password = click.prompt( @@ -145,6 +155,52 @@ def test( # set to ERROR otherwise nornir plugin logs debug messages to the screen. logging.basicConfig(level="ERROR") + csm = float(csm) + + # Get project root directory + if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): # pragma: no cover + project_root = sys._MEIPASS + else: + project_root = Path(__file__).resolve().parent.parent.parent + + def get_vlan_ips(network): + network_dict = {} + for net in network: + for subnet in networks.get(net).subnets().values(): + for reservation in subnet.reservations().values(): + if "ncn" in reservation.name() or "sw" in reservation.name(): + net_key = net.lower() + vlan = subnet.vlan() + name = reservation.name() + f"-{net}".lower() + ipv4_address = str(reservation.ipv4_address()) + + if net_key not in network_dict: + network_dict[net_key] = {"vlan": vlan, "ips": []} + network_dict[net_key]["ips"].append( + {"name": name, "ipv4_address": ipv4_address}, + ) + return network_dict + + def send_ssh_commands(vendor, commands, nornir_object): + if vendor == "aruba": + results = nornir_object.run(task=scrapli_send_commands, commands=commands) + else: + results = nornir_object.run( + task=netmiko_send_commands, + commands=commands, + enable=True, + ) + return results + + if sls_file: + sls_json = load_json(file=sls_file) + else: + sls_json = sls_dump(path="dumpstate") + + networks = NetworkManager(sls_json["Networks"]) + + vlan_ips = get_vlan_ips(["HMN", "CMN", "NMN"]) + switch_inventory, sls_variables = inventory( username, password, @@ -171,29 +227,6 @@ def test( else: vendor = "dellanox" - def get_ncn_switch_address(network): - network_dict = {} - for net in network: - for subnet in networks.get(net).subnets().values(): - for reservation in subnet.reservations().values(): - if "ncn" in reservation.name() or "sw" in reservation.name(): - network_dict[reservation.name() + f"-{net}".lower()] = str( - reservation.ipv4_address(), - ) - return network_dict - - def send_ssh_commands(vendor, commands, nornir_object): - - if vendor == "aruba": - results = nornir_object.run(task=scrapli_send_commands, commands=commands) - else: - results = nornir_object.run( - task=netmiko_send_commands, - commands=commands, - enable=True, - ) - return results - online_hosts, unreachable_hosts = host_alive(nr) if unreachable_hosts: @@ -204,8 +237,6 @@ def send_ssh_commands(vendor, commands, nornir_object): ) if ping: - networks = NetworkManager(sls_file["Networks"]) - ping = { "device": ["leaf", "leaf-bmc", "cdu", "spine"], "err_msg": "", @@ -214,23 +245,26 @@ def send_ssh_commands(vendor, commands, nornir_object): "test": "contains", } - ncn_switch_address = get_ncn_switch_address(["HMN", "CMN", "NMN"]) - ping_test = [] # construct pings tests for switches - for k, v in ncn_switch_address.items(): - ping["err_msg"] = f"{k} is not reachable" - ping["name"] = f"ping {k} {v}" - if "cmn" in k and vendor == "aruba": - ping["task"] = f"ping {v} vrf Customer repetitions 1" - elif vendor == "aruba": - ping["task"] = f"ping {v} repetitions 1" - if "cmn" in k and vendor == "dellanox": - ping["task"] = f"ping vrf Customer {v} -c 1" - elif vendor == "dellanox": - ping["task"] = f"ping {v} -c 1" - ping_test.append(ping.copy()) + for _net, net_data in vlan_ips.items(): + for data in net_data.get("ips", []): + ip = data["ipv4_address"] + name = data["name"] + ping["err_msg"] = f"{name} is not reachable" + ping["name"] = f"ping {name} {ip}" + if vendor == "aruba": + if "cmn" in name: + ping["task"] = f"ping {ip} vrf Customer repetitions 1" + else: + ping["task"] = f"ping {ip} repetitions 1" + elif vendor == "dellanox": + if "cmn" in name: + ping["task"] = f"ping vrf Customer {ip} -c 1" + else: + ping["task"] = f"ping {ip} -c 1" + ping_test.append(ping.copy()) nr_with_tests = online_hosts.with_processors([TestsProcessor(ping_test)]) @@ -245,7 +279,6 @@ def send_ssh_commands(vendor, commands, nornir_object): pretty_results = ResultSerializer(results, add_details=True, to_dict=False) dict_results = ResultSerializer(results, add_details=False, to_dict=True) else: - test_file = path.join( project_root, "canu", @@ -267,17 +300,35 @@ def send_ssh_commands(vendor, commands, nornir_object): for test_command in test_suite: devices = test_command.get("device") csm_test_version = test_command.get("csm") - csm = float(csm) + test_type = test_command.get("test") + pre_install = test_command.get("pre_install") + + if pre_install_ and pre_install is None: + continue + if csm_test_version is not None and csm not in csm_test_version: continue + if switch in devices: switch_test_suite[switch].append(test_command) - if switch in devices and isinstance(test_command["task"], str): + if switch in devices and isinstance(test_command["task"], str): template = environment.from_string(test_command["task"]) command = template.render(variables=sls_variables) test_command["task"] = command switch_commands[switch].append(test_command["task"]) + if test_type == "custom": + custom_test = test_command.get("function_file") + test_path = path.join( + project_root, + "canu", + "test", + vendor, + custom_test, + ) + # Update the dictionary entry + test_command["function_file"] = test_path + test_command["function_kwargs"] = {"vlan_ips": vlan_ips} elif switch in devices and isinstance(test_command["task"], list): switch_commands.extend(test_command["task"]) diff --git a/canu/utils/inventory.py b/canu/utils/inventory.py index a9c5233f6..8a709deee 100644 --- a/canu/utils/inventory.py +++ b/canu/utils/inventory.py @@ -20,30 +20,22 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. """Create Nornir Inventory from SLS.""" -import json -import sys - -import click - +from canu.utils.json_load import load_json from canu.utils.sls import pull_sls_hardware, pull_sls_networks -def inventory(username, password, network, sls_file=None, sls_inventory=None, dumpstate=None): +def inventory( + username, + password, + network, + sls_file=None, + sls_inventory=None, + dumpstate=None, +): """Build Nornir inventory from sls_input.""" inventory = {"groups": {}, "hosts": {}} if sls_file: - try: - if dumpstate: - with open(sls_file.name, 'r', encoding='utf-8') as f: - sls_json = json.load(f) - else: - sls_json = json.load(sls_file) - except (json.JSONDecodeError, UnicodeDecodeError): - click.secho( - f"The file {sls_file.name} is not valid JSON.", - fg="red", - ) - sys.exit(1) + sls_json = load_json(file=sls_file) sls_variables = pull_sls_networks(sls_json) sls_hardware = pull_sls_hardware(sls_json) elif dumpstate: diff --git a/canu/utils/json_load.py b/canu/utils/json_load.py new file mode 100644 index 000000000..36dca7abe --- /dev/null +++ b/canu/utils/json_load.py @@ -0,0 +1,48 @@ +# MIT License +# +# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +"""Load json file.""" +import json +import os +import sys + + +def load_json(file): + """Load JSON file and return dictionary. + + Args: + file: JSON file. + + Returns: + Loaded JSON file. + """ + try: + with open(os.path.join(file.name), "r") as f: + json_file = json.load(f) + except FileNotFoundError: + print( + f"The {file} file was not found, check that you entered the right file name and path", + ) + sys.exit(1) + except json.JSONDecodeError as e: + print(f"{str(e)}, JSON error parsing {file}") + sys.exit(1) + return json_file diff --git a/canu/utils/sls.py b/canu/utils/sls.py index 40a6a8568..6ff6484a3 100644 --- a/canu/utils/sls.py +++ b/canu/utils/sls.py @@ -31,143 +31,155 @@ import urllib3 -def pull_sls_networks(sls_file=None): - """Query API-GW and retrieve token. +def sls_dump(path): + """Query API-GW and retrieve SLS. Args: - sls_file: generated sls json file. + path: SLS path. Returns: - API token. + SLS dump. """ - if sls_file: - sls_networks = [ - network[x] for network in [sls_file.get("Networks", {})] for x in network - ] - if not sls_file: - urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) - debug = False - - def on_debug(debug=False, message=None): - if debug: - print("DEBUG: {}".format(message)) - - # - # Convenience wrapper around remote calls - # - def remote_request( - remote_type, - remote_url, - headers=None, - data=None, - verify=False, - debug=False, - ): - remote_response = None - while True: - try: - response = requests.request( - remote_type, - url=remote_url, - headers=headers, - data=data, - verify=verify, - ) - on_debug(debug, "Request response: {}".format(response.text)) - response.raise_for_status() - remote_response = json.dumps({}) - if response.text: - remote_response = response.json() - break - except Exception as err: - message = "Error calling {}: {}".format(remote_url, err) - raise SystemExit(message) from err - return remote_response - - # - # Get the admin client secret from Kubernetes - # - secret = None - cenv = os.getenv("CRAYENV", "notk8s") - if cenv != "k8s": - try: - config.load_kube_config() - v1 = client.CoreV1Api() - secret_obj = v1.list_namespaced_secret( - "default", - field_selector="metadata.name=admin-client-auth", - ) - secret_dict = secret_obj.to_dict() - secret_base64_str = secret_dict["items"][0]["data"]["client-secret"] - secret = base64.b64decode(secret_base64_str.encode("utf-8")) - except Exception as err: - print("Error collecting secret from Kubernetes: {}".format(err)) - sys.exit(1) - - # - # Get an auth token by using the secret - # - if os.getenv("SLS_TOKEN") is None: - token = None - else: - token = os.getenv("SLS_TOKEN") - sls_cache = None - - if os.getenv("SLS_API_GW") is None: - # this is in mesh pod-to-pod communication - sls_url = "http://cray-sls.services.svc.cluster.local/v1/networks" - else: - # this is out of the mesh - sls_url = "https://" + os.getenv("SLS_API_GW") + "/apis/sls/v1/networks" - if cenv != "k8s": - sls_url = "https://api-gw-service-nmn.local/apis/sls/v1/networks" + urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + debug = False + + def on_debug(debug=False, message=None): + if debug: + print("DEBUG: {}".format(message)) + + # + # Convenience wrapper around remote calls + # + def remote_request( + remote_type, + remote_url, + headers=None, + data=None, + verify=False, + debug=False, + ): + remote_response = None + while True: try: - token_url = "https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token" - token_data = { - "grant_type": "client_credentials", - "client_id": "admin-client", - "client_secret": secret, - } - token_request = remote_request( - "POST", - token_url, - data=token_data, - debug=debug, - ) - token = token_request["access_token"] - on_debug( - debug=debug, - message="Auth Token from keycloak (first 50 char): {}".format( - token[:50], - ), + response = requests.request( + remote_type, + url=remote_url, + headers=headers, + data=data, + verify=verify, ) - + on_debug(debug, "Request response: {}".format(response.text)) + response.raise_for_status() + remote_response = json.dumps({}) + if response.text: + remote_response = response.json() + break except Exception as err: - print("Error obtaining keycloak token: {}".format(err)) - sys.exit(1) + message = "Error calling {}: {}".format(remote_url, err) + raise SystemExit(message) from err + return remote_response + + # + # Get the admin client secret from Kubernetes + # + secret = None + cenv = os.getenv("CRAYENV", "notk8s") + if cenv != "k8s": + try: + config.load_kube_config() + v1 = client.CoreV1Api() + secret_obj = v1.list_namespaced_secret( + "default", + field_selector="metadata.name=admin-client-auth", + ) + secret_dict = secret_obj.to_dict() + secret_base64_str = secret_dict["items"][0]["data"]["client-secret"] + secret = base64.b64decode(secret_base64_str.encode("utf-8")) + except Exception as err: + print("Error collecting secret from Kubernetes: {}".format(err)) + sys.exit(1) - # - # Get existing SLS data for comparison (used as a cache) - # - sls_cache = None - auth_headers = {"Authorization": "Bearer {}".format(token)} + # + # Get an auth token by using the secret + # + if os.getenv("SLS_TOKEN") is None: + token = None + else: + token = os.getenv("SLS_TOKEN") + sls_cache = None + + if os.getenv("SLS_API_GW") is None: + # this is in mesh pod-to-pod communication + sls_url = f"http://cray-sls.services.svc.cluster.local/v1/{path}" + else: + # this is out of the mesh + sls_url = "https://" + os.getenv("SLS_API_GW") + f"/apis/sls/v1/{path}" + if cenv != "k8s": + sls_url = f"https://api-gw-service-nmn.local/apis/sls/v1/{path}" try: - sls_cache = remote_request( - "GET", - sls_url, - headers=auth_headers, - verify=False, + token_url = "https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token" + token_data = { + "grant_type": "client_credentials", + "client_id": "admin-client", + "client_secret": secret, + } + token_request = remote_request( + "POST", + token_url, + data=token_data, + debug=debug, ) + token = token_request["access_token"] on_debug( debug=debug, - message="SLS data has {} records".format(len(sls_cache)), + message="Auth Token from keycloak (first 50 char): {}".format( + token[:50], + ), ) + except Exception as err: - print("Error requesting Networks from SLS: {}".format(err)) + print("Error obtaining keycloak token: {}".format(err)) sys.exit(1) - on_debug(debug=debug, message="SLS records {}".format(sls_cache)) - sls_networks = sls_cache + # + # Get existing SLS data for comparison (used as a cache) + # + sls_cache = None + auth_headers = {"Authorization": "Bearer {}".format(token)} + try: + sls_cache = remote_request( + "GET", + sls_url, + headers=auth_headers, + verify=False, + ) + on_debug( + debug=debug, + message="SLS data has {} records".format(len(sls_cache)), + ) + except Exception as err: + print("Error requesting Networks from SLS: {}".format(err)) + sys.exit(1) + on_debug(debug=debug, message="SLS records {}".format(sls_cache)) + + return sls_cache + + +def pull_sls_networks(sls_file=None): + """Query API-GW and retrieve token. + + Args: + sls_file: generated sls json file. + + Returns: + API token. + """ + if sls_file: + sls_networks = [ + network[x] for network in [sls_file.get("Networks", {})] for x in network + ] + if not sls_file: + sls_networks = sls_dump("networks") sls_variables = { "SWITCH_ASN": None, @@ -333,125 +345,5 @@ def pull_sls_hardware(sls_file=None): ] return sls_hardware if not sls_file: - urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) - debug = False - - def on_debug(debug=False, message=None): - if debug: - print("DEBUG: {}".format(message)) - - # - # Convenience wrapper around remote calls - # - def remote_request( - remote_type, - remote_url, - headers=None, - data=None, - verify=False, - debug=False, - ): - remote_response = None - while True: - try: - response = requests.request( - remote_type, - url=remote_url, - headers=headers, - data=data, - verify=verify, - ) - on_debug(debug, "Request response: {}".format(response.text)) - response.raise_for_status() - remote_response = json.dumps({}) - if response.text: - remote_response = response.json() - break - except Exception as err: - message = "Error calling {}: {}".format(remote_url, err) - raise SystemExit(message) from err - return remote_response - - # - # Get the admin client secret from Kubernetes - # - secret = None - cenv = os.getenv("CRAYENV", "notk8s") - if cenv != "k8s": - try: - config.load_kube_config() - v1 = client.CoreV1Api() - secret_obj = v1.list_namespaced_secret( - "default", - field_selector="metadata.name=admin-client-auth", - ) - secret_dict = secret_obj.to_dict() - secret_base64_str = secret_dict["items"][0]["data"]["client-secret"] - secret = base64.b64decode(secret_base64_str.encode("utf-8")) - except Exception as err: - print("Error collecting secret from Kubernetes: {}".format(err)) - sys.exit(1) - - # - # Get an auth token by using the secret - # - if os.getenv("SLS_TOKEN") is None: - token = None - else: - token = os.getenv("SLS_TOKEN") - sls_cache = None - - if os.getenv("SLS_API_GW") is None: - # this is in mesh pod-to-pod communication - sls_url = "http://cray-sls.services.svc.cluster.local/v1/hardware" - else: - # this is out of the mesh - sls_url = "https://" + os.getenv("SLS_API_GW") + "/apis/sls/v1/hardware" - if cenv != "k8s": - sls_url = "https://api-gw-service-nmn.local/apis/sls/v1/hardware" - try: - token_url = "https://api-gw-service-nmn.local/keycloak/realms/shasta/protocol/openid-connect/token" - token_data = { - "grant_type": "client_credentials", - "client_id": "admin-client", - "client_secret": secret, - } - token_request = remote_request( - "POST", - token_url, - data=token_data, - debug=debug, - ) - token = token_request["access_token"] - on_debug( - debug=debug, - message="Auth Token from keycloak (first 50 char): {}".format( - token[:50], - ), - ) - - except Exception as err: - print("Error obtaining keycloak token: {}".format(err)) - sys.exit(1) - - # - # Get existing SLS data for comparison (used as a cache) - # - auth_headers = {"Authorization": "Bearer {}".format(token)} - try: - sls_cache = remote_request( - "GET", - sls_url, - headers=auth_headers, - verify=False, - ) - on_debug( - debug=debug, - message="SLS data has {} records".format(len(sls_cache)), - ) - except Exception as err: - print("Error requesting Networks from SLS: {}".format(err)) - sys.exit(1) - on_debug(debug=debug, message="SLS records {}".format(sls_cache)) - - return sls_cache + sls_hardware = sls_dump("hardware") + return sls_hardware diff --git a/canu/utils/sls_utils/Managers.py b/canu/utils/sls_utils/Managers.py index c40b8906b..ff9099cdf 100644 --- a/canu/utils/sls_utils/Managers.py +++ b/canu/utils/sls_utils/Managers.py @@ -34,7 +34,7 @@ project_root = sys._MEIPASS else: prog = __file__ - project_root = Path(__file__).resolve().parent.parent + project_root = Path(__file__).resolve().parent.parent.parent.parent class NetworkManager(UserDict): @@ -120,11 +120,16 @@ def __validate(self, sls_data): """ default_sls_networks_schema_file = path.join( project_root, + "canu", + "utils", "sls_utils", "schemas", "sls_networks_schema.json", ) - validate_sls_json(schema_file=default_sls_networks_schema_file, sls_data=sls_data) + validate_sls_json( + schema_file=default_sls_networks_schema_file, + sls_data=sls_data, + ) class SubnetManager(UserDict): @@ -207,8 +212,13 @@ def __validate(self, sls_data): """ default_sls_subnets_schema_file = path.join( project_root, + "canu", + "utils", "sls_utils", "schemas", "sls_subnets_schema.json", ) - validate_sls_json(schema_file=default_sls_subnets_schema_file, sls_data=sls_data) + validate_sls_json( + schema_file=default_sls_subnets_schema_file, + sls_data=sls_data, + ) diff --git a/canu/utils/sls_utils/index.md b/canu/utils/sls_utils/index.md deleted file mode 120000 index 61cfe9a51..000000000 --- a/canu/utils/sls_utils/index.md +++ /dev/null @@ -1 +0,0 @@ -./README.md \ No newline at end of file diff --git a/canu/utils/sls_utils/index.md b/canu/utils/sls_utils/index.md new file mode 100644 index 000000000..f54c2eae4 --- /dev/null +++ b/canu/utils/sls_utils/index.md @@ -0,0 +1,5 @@ +# `sls_utils` Library + +This is a reusable Python library for safely interacting with SLS network data (in JSON format). + +The library has been tested against Python version 3.6 and up. diff --git a/pyinstaller.py b/pyinstaller.py index cebb0f5c2..ba96313e7 100644 --- a/pyinstaller.py +++ b/pyinstaller.py @@ -20,17 +20,20 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # -*- mode: python ; coding: utf-8 -*- -from PyInstaller.utils.hooks import collect_submodules +from PyInstaller.utils.hooks import ( + collect_data_files, + collect_submodules, + copy_metadata, +) hiddenimports = [] -hiddenimports += collect_submodules('canu') -hiddenimports += collect_submodules('network_modeling') - +hiddenimports += collect_submodules("canu") +hiddenimports += collect_submodules("network_modeling") +added_files = [] +added_files += collect_data_files("canu", True) + copy_metadata("canu") block_cipher = None -added_files = [ - ("canu/canu.yaml", "canu"), - ("canu/validate/switch/config/*.yaml", "canu/validate/switch/config"), +added_files += [ ("network_modeling/models/*", "network_modeling/models"), ("network_modeling/mac_vendors", "network_modeling"), ("network_modeling/schema/*", "network_modeling/schema"), @@ -134,22 +137,13 @@ "network_modeling/configs/templates/1.4/dellmellanox/full/*.j2", "network_modeling/configs/templates/1.4/dellmellanox/full", ), - ( - "canu/test/aruba/test_suite.yaml", - "canu/test/aruba" - ), - ( - "canu/test/dellanox/test_suite.yaml", - "canu/test/dellanox" - ), + ("canu/test/aruba/test_suite.yaml", "canu/test/aruba"), + ("canu/test/dellanox/test_suite.yaml", "canu/test/dellanox"), ( "canu/generate/switch/config/ttp_templates/*.txt", "canu/generate/switch/config/ttp_templates", ), - ( - "canu/utils/sls_utils/schemas/*.json", - "canu/utils/sls_utils/schemas" - ), + ("canu/utils/sls_utils/schemas/*.json", "canu/utils/sls_utils/schemas"), ] a = Analysis( ["canu/cli.py"], diff --git a/spec/test_spec.sh b/spec/test_spec.sh index 51caf235d..9c4426813 100755 --- a/spec/test_spec.sh +++ b/spec/test_spec.sh @@ -23,6 +23,6 @@ It 'test --help' When call canu test --help - The lines of stdout should equal 22 + The lines of stdout should equal 24 The line 1 of stdout should equal 'Usage: canu test [OPTIONS]' End From 4259b81ccb3be82345b41ca5911c117846afa8ef Mon Sep 17 00:00:00 2001 From: Jouni Kosonen <38793679+kosonenj@users.noreply.github.com> Date: Tue, 13 Jun 2023 12:23:14 -0700 Subject: [PATCH 6/9] CASMNET-2104 | Aruba software update and template fixes for storage nodes (#373) * aruba software update and template fixes for storage nodes * Update ncn-s.lag.j2 Signed-off-by: Jouni Kosonen <38793679+kosonenj@users.noreply.github.com> * Update CHANGELOG.md Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> --------- Signed-off-by: Jouni Kosonen <38793679+kosonenj@users.noreply.github.com> Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> Co-authored-by: Sean Lynn Co-authored-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> --- .github/CHANGELOG.md | 2 ++ .../configs/templates/1.3/aruba/common/ncn-s.lag.j2 | 5 +++-- .../configs/templates/1.4/aruba/common/ncn-s.lag.j2 | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index e948414db..ef089799c 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -3,6 +3,8 @@ - added very basic integration tests via shellspec for local and github actions +- Fix storage node lag configuration in Aruba templates to prevent loop + ## [1.7.3] - Add `force` option to generated Mellanox web and ntp configuration. diff --git a/network_modeling/configs/templates/1.3/aruba/common/ncn-s.lag.j2 b/network_modeling/configs/templates/1.3/aruba/common/ncn-s.lag.j2 index 991abe2e3..fe9ab82be 100644 --- a/network_modeling/configs/templates/1.3/aruba/common/ncn-s.lag.j2 +++ b/network_modeling/configs/templates/1.3/aruba/common/ncn-s.lag.j2 @@ -5,10 +5,11 @@ interface lag {{ node.config.LAG_NUMBER }} multi-chassis no shutdown description {{ node.config.DESCRIPTION }} no routing - vlan trunk native {{ variables.NATIVE_VLAN }} {%- if node.destination_port == 1%} + vlan trunk native {{ variables.NATIVE_VLAN }} vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} {%- else %} + vlan trunk native 10 vlan trunk allowed 10 {%- endif %} lacp mode active @@ -21,4 +22,4 @@ interface 1/1/{{ node.config.PORT }} description {{ node.config.DESCRIPTION }} lag {{ node.config.LAG_NUMBER }} {%- endfor %} -{#- end storage #} \ No newline at end of file +{#- end storage #} diff --git a/network_modeling/configs/templates/1.4/aruba/common/ncn-s.lag.j2 b/network_modeling/configs/templates/1.4/aruba/common/ncn-s.lag.j2 index 991abe2e3..9e774e160 100644 --- a/network_modeling/configs/templates/1.4/aruba/common/ncn-s.lag.j2 +++ b/network_modeling/configs/templates/1.4/aruba/common/ncn-s.lag.j2 @@ -5,10 +5,11 @@ interface lag {{ node.config.LAG_NUMBER }} multi-chassis no shutdown description {{ node.config.DESCRIPTION }} no routing - vlan trunk native {{ variables.NATIVE_VLAN }} {%- if node.destination_port == 1%} + vlan trunk native {{ variables.NATIVE_VLAN }} vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} {%- else %} + vlan trunk native 10 vlan trunk allowed 10 {%- endif %} lacp mode active From e4199f60bac4f32f771969b5980aebb8e9afa48d Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:02:54 -0500 Subject: [PATCH 7/9] CASMNET-2138 Increase Dell netmiko timeout when using nornir (#408) * Bump click-option-group from 0.5.5 to 0.5.6 Bumps [click-option-group](https://github.com/click-contrib/click-option-group) from 0.5.5 to 0.5.6. - [Release notes](https://github.com/click-contrib/click-option-group/releases) - [Changelog](https://github.com/click-contrib/click-option-group/blob/master/CHANGELOG.md) - [Commits](https://github.com/click-contrib/click-option-group/compare/v0.5.5...v0.5.6) --- updated-dependencies: - dependency-name: click-option-group dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump emoji from 2.4.0 to 2.5.0 Bumps [emoji](https://github.com/carpedm20/emoji) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/carpedm20/emoji/releases) - [Changelog](https://github.com/carpedm20/emoji/blob/master/CHANGES.md) - [Commits](https://github.com/carpedm20/emoji/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: emoji dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump tokenize-rt from 5.0.0 to 5.1.0 Bumps [tokenize-rt](https://github.com/asottile/tokenize-rt) from 5.0.0 to 5.1.0. - [Commits](https://github.com/asottile/tokenize-rt/compare/v5.0.0...v5.1.0) --- updated-dependencies: - dependency-name: tokenize-rt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump ipython from 8.13.2 to 8.14.0 Bumps [ipython](https://github.com/ipython/ipython) from 8.13.2 to 8.14.0. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/8.13.2...8.14.0) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update flake8-eradicate requirement from ~=1.4.0 to ~=1.5.0 Updates the requirements on [flake8-eradicate](https://github.com/wemake-services/flake8-eradicate) to permit the latest version. - [Release notes](https://github.com/wemake-services/flake8-eradicate/releases) - [Changelog](https://github.com/wemake-services/flake8-eradicate/blob/master/CHANGELOG.md) - [Commits](https://github.com/wemake-services/flake8-eradicate/commits) --- updated-dependencies: - dependency-name: flake8-eradicate dependency-type: direct:production ... Signed-off-by: dependabot[bot] * bump dell netmiko timeout when using nornir * changelog * lint --------- Signed-off-by: dependabot[bot] Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukebates123 --- .github/CHANGELOG.md | 1 + canu/utils/inventory.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index ef089799c..3340ab0b3 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,6 +1,7 @@ ## Changelog ## [UNRELEASED] +- Increase Dell netmiko timeout when using nornir. - added very basic integration tests via shellspec for local and github actions - Fix storage node lag configuration in Aruba templates to prevent loop diff --git a/canu/utils/inventory.py b/canu/utils/inventory.py index 8a709deee..29af1677a 100644 --- a/canu/utils/inventory.py +++ b/canu/utils/inventory.py @@ -97,8 +97,15 @@ def inventory( "platform": "aruba_aoscx", "connection_options": {"scrapli": {"extras": {"auth_strict_key": False}}}, }, - "dell": {"platform": "dell_os10"}, - "mellanox": {"platform": "mellanox"}, + "dell": { + "platform": "dell_os10", + "connection_options": { + "netmiko": {"extras": {"read_timeout_override": 60}}, + }, + }, + "mellanox": { + "platform": "mellanox", + }, } if sls_inventory: From fd7e65081a2f4c3cd010c1dbde1a7b3bd4eda8e0 Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Tue, 13 Jun 2023 17:32:37 -0500 Subject: [PATCH 8/9] CASMNET-2113 CASMNET-2112 Add 1.5 configs & update BGP next hop to 32 (#409) * Bump click-option-group from 0.5.5 to 0.5.6 Bumps [click-option-group](https://github.com/click-contrib/click-option-group) from 0.5.5 to 0.5.6. - [Release notes](https://github.com/click-contrib/click-option-group/releases) - [Changelog](https://github.com/click-contrib/click-option-group/blob/master/CHANGELOG.md) - [Commits](https://github.com/click-contrib/click-option-group/compare/v0.5.5...v0.5.6) --- updated-dependencies: - dependency-name: click-option-group dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump emoji from 2.4.0 to 2.5.0 Bumps [emoji](https://github.com/carpedm20/emoji) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/carpedm20/emoji/releases) - [Changelog](https://github.com/carpedm20/emoji/blob/master/CHANGES.md) - [Commits](https://github.com/carpedm20/emoji/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: emoji dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump tokenize-rt from 5.0.0 to 5.1.0 Bumps [tokenize-rt](https://github.com/asottile/tokenize-rt) from 5.0.0 to 5.1.0. - [Commits](https://github.com/asottile/tokenize-rt/compare/v5.0.0...v5.1.0) --- updated-dependencies: - dependency-name: tokenize-rt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump ipython from 8.13.2 to 8.14.0 Bumps [ipython](https://github.com/ipython/ipython) from 8.13.2 to 8.14.0. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/8.13.2...8.14.0) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update flake8-eradicate requirement from ~=1.4.0 to ~=1.5.0 Updates the requirements on [flake8-eradicate](https://github.com/wemake-services/flake8-eradicate) to permit the latest version. - [Release notes](https://github.com/wemake-services/flake8-eradicate/releases) - [Changelog](https://github.com/wemake-services/flake8-eradicate/blob/master/CHANGELOG.md) - [Commits](https://github.com/wemake-services/flake8-eradicate/commits) --- updated-dependencies: - dependency-name: flake8-eradicate dependency-type: direct:production ... Signed-off-by: dependabot[bot] * bump dell netmiko timeout when using nornir * changelog * lint * change default of canu init to HMN * changelog, storage template * Update bgp.primary.j2 Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> * Update bgp.secondary.j2 Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] Signed-off-by: lukebates123 <66981180+lukebates123@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukebates123 --- .github/CHANGELOG.md | 5 +- canu/cli.py | 6 +- .../templates/1.3/aruba/common/bgp.primary.j2 | 2 +- .../1.3/aruba/common/bgp.secondary.j2 | 2 +- .../templates/1.4/aruba/common/bgp.primary.j2 | 2 +- .../1.4/aruba/common/bgp.secondary.j2 | 2 +- .../templates/1.5/arista/sw-edge.primary.j2 | 121 ++++++++++++++ .../templates/1.5/arista/sw-edge.secondary.j2 | 119 ++++++++++++++ .../configs/templates/1.5/aruba/common/acl.j2 | 74 +++++++++ .../templates/1.5/aruba/common/banner-motd.j2 | 8 + .../templates/1.5/aruba/common/bgp.primary.j2 | 44 ++++++ .../1.5/aruba/common/bgp.secondary.j2 | 44 ++++++ .../configs/templates/1.5/aruba/common/bmc.j2 | 13 ++ .../1.5/aruba/common/cdu-to-spine.lag.j2 | 24 +++ .../configs/templates/1.5/aruba/common/cec.j2 | 13 ++ .../configs/templates/1.5/aruba/common/cmm.j2 | 18 +++ .../templates/1.5/aruba/common/compute.j2 | 13 ++ .../1.5/aruba/common/four_port_ocp.j2 | 11 ++ .../1.5/aruba/common/leaf_bmc_unused_port.j2 | 9 ++ .../1.5/aruba/common/mtn_hmn_vlan.j2 | 20 +++ .../1.5/aruba/common/mtn_nmn_vlan.j2 | 19 +++ .../templates/1.5/aruba/common/ncn-m.lag.j2 | 29 ++++ .../templates/1.5/aruba/common/ncn-s.lag.j2 | 25 +++ .../templates/1.5/aruba/common/ncn-w.lag.j2 | 20 +++ .../templates/1.5/aruba/common/prefix-list.j2 | 10 ++ .../templates/1.5/aruba/common/route-map.j2 | 37 +++++ .../1.5/aruba/common/spine-to-cdu.lag.j2 | 22 +++ .../aruba/common/spine_leaf_unused_port.j2 | 7 + .../1.5/aruba/common/sw-cdu.primary.j2 | 86 ++++++++++ .../1.5/aruba/common/sw-cdu.secondary.j2 | 86 ++++++++++ .../configs/templates/1.5/aruba/common/uan.j2 | 42 +++++ .../templates/1.5/aruba/common/unknown.j2 | 14 ++ .../1.5/aruba/common/vsx_isl.primary.j2 | 38 +++++ .../1.5/aruba/common/vsx_isl.secondary.j2 | 38 +++++ .../1.5/aruba/full/leaf-bmc-to-leaf.lag.j2 | 24 +++ .../1.5/aruba/full/leaf-to-leaf-bmc.lag.j2 | 18 +++ .../1.5/aruba/full/leaf-to-spine.lag.j2 | 27 ++++ .../1.5/aruba/full/spine-to-leaf.lag.j2 | 22 +++ .../templates/1.5/aruba/full/sw-leaf-bmc.j2 | 84 ++++++++++ .../1.5/aruba/full/sw-leaf.primary.j2 | 95 +++++++++++ .../1.5/aruba/full/sw-leaf.secondary.j2 | 95 +++++++++++ .../1.5/aruba/full/sw-spine.primary.j2 | 118 ++++++++++++++ .../1.5/aruba/full/sw-spine.secondary.j2 | 118 ++++++++++++++ .../templates/1.5/aruba/sw-edge.primary.j2 | 136 ++++++++++++++++ .../templates/1.5/aruba/sw-edge.secondary.j2 | 135 ++++++++++++++++ .../1.5/aruba/tds/leaf-bmc-to-spine.lag.j2 | 24 +++ .../configs/templates/1.5/aruba/tds/notes.md | 61 ++++++++ .../1.5/aruba/tds/spine-to-leaf-bmc.lag.j2 | 18 +++ .../templates/1.5/aruba/tds/sw-leaf-bmc.j2 | 84 ++++++++++ .../1.5/aruba/tds/sw-spine.primary.j2 | 122 +++++++++++++++ .../1.5/aruba/tds/sw-spine.secondary.j2 | 122 +++++++++++++++ .../1.5/dellmellanox/common/acl-dell.j2 | 45 ++++++ .../1.5/dellmellanox/common/acl-mellanox.j2 | 43 +++++ .../dellmellanox/common/banner-motd-dell.j2 | 8 + .../1.5/dellmellanox/common/banner-motd.j2 | 8 + .../templates/1.5/dellmellanox/common/bgp.j2 | 33 ++++ .../templates/1.5/dellmellanox/common/bmc.j2 | 16 ++ .../dellmellanox/common/cdu-to-spine.lag.j2 | 30 ++++ .../templates/1.5/dellmellanox/common/cec.j2 | 14 ++ .../templates/1.5/dellmellanox/common/cmm.j2 | 24 +++ .../1.5/dellmellanox/common/compute.j2 | 16 ++ .../1.5/dellmellanox/common/dell-unused.j2 | 10 ++ .../1.5/dellmellanox/common/load-balancing.j2 | 9 ++ .../templates/1.5/dellmellanox/common/magp.j2 | 20 +++ .../dellmellanox/common/mellanox-unused.j2 | 5 + .../1.5/dellmellanox/common/mlag_isl.j2 | 20 +++ .../1.5/dellmellanox/common/mtn_hmn_vlan.j2 | 23 +++ .../1.5/dellmellanox/common/mtn_nmn_vlan.j2 | 23 +++ .../1.5/dellmellanox/common/ncn-m.lag.j2 | 24 +++ .../1.5/dellmellanox/common/ncn-s.lag.j2 | 23 +++ .../1.5/dellmellanox/common/ncn-w.lag.j2 | 23 +++ .../1.5/dellmellanox/common/prefix.list.j2 | 21 +++ .../1.5/dellmellanox/common/route-map.j2 | 26 +++ .../dellmellanox/common/spine-to-cdu.lag.j2 | 21 +++ .../1.5/dellmellanox/common/sw-cdu.primary.j2 | 112 +++++++++++++ .../dellmellanox/common/sw-cdu.secondary.j2 | 112 +++++++++++++ .../1.5/dellmellanox/common/uan-nmn.j2 | 16 ++ .../templates/1.5/dellmellanox/common/uan.j2 | 18 +++ .../1.5/dellmellanox/common/unknown.j2 | 14 ++ .../full/leaf-bmc-to-spine.lag.j2 | 28 ++++ .../full/spine-to-leaf-bmc.lag.j2 | 21 +++ .../1.5/dellmellanox/full/sw-leaf-bmc.j2 | 84 ++++++++++ .../1.5/dellmellanox/full/sw-spine.primary.j2 | 148 ++++++++++++++++++ .../dellmellanox/full/sw-spine.secondary.j2 | 148 ++++++++++++++++++ pyinstaller.py | 15 +- 85 files changed, 3513 insertions(+), 14 deletions(-) create mode 100644 network_modeling/configs/templates/1.5/arista/sw-edge.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/arista/sw-edge.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/acl.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/banner-motd.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/bgp.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/bgp.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/bmc.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/cdu-to-spine.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/cec.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/cmm.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/compute.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/four_port_ocp.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/leaf_bmc_unused_port.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/mtn_hmn_vlan.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/mtn_nmn_vlan.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/ncn-m.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/ncn-s.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/ncn-w.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/prefix-list.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/route-map.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/spine-to-cdu.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/spine_leaf_unused_port.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/sw-cdu.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/sw-cdu.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/uan.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/unknown.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/vsx_isl.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/common/vsx_isl.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/leaf-bmc-to-leaf.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/leaf-to-leaf-bmc.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/leaf-to-spine.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/spine-to-leaf.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/sw-leaf-bmc.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/sw-leaf.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/sw-leaf.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/sw-spine.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/full/sw-spine.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/sw-edge.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/sw-edge.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/leaf-bmc-to-spine.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/notes.md create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/spine-to-leaf-bmc.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/sw-leaf-bmc.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/sw-spine.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/aruba/tds/sw-spine.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/acl-dell.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/acl-mellanox.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd-dell.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/bgp.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/bmc.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/cdu-to-spine.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/cec.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/cmm.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/compute.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/dell-unused.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/load-balancing.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/magp.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/mellanox-unused.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/mlag_isl.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/mtn_hmn_vlan.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/mtn_nmn_vlan.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/ncn-m.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/ncn-s.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/ncn-w.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/prefix.list.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/route-map.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/spine-to-cdu.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.secondary.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/uan-nmn.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/uan.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/common/unknown.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/full/leaf-bmc-to-spine.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/full/spine-to-leaf-bmc.lag.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/full/sw-leaf-bmc.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.primary.j2 create mode 100644 network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.secondary.j2 diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 3340ab0b3..7e89b6487 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,9 +1,10 @@ ## Changelog ## [UNRELEASED] -- Increase Dell netmiko timeout when using nornir. +- Update BGP to use 32 max paths +- Add CSM 1.5 configs +- Increase Dell netmiko timeout when using nornir - added very basic integration tests via shellspec for local and github actions - - Fix storage node lag configuration in Aruba templates to prevent loop ## [1.7.3] diff --git a/canu/cli.py b/canu/cli.py index 0b45f8819..8acd5a385 100644 --- a/canu/cli.py +++ b/canu/cli.py @@ -250,14 +250,14 @@ def init(ctx, sls_file, auth_token, sls_address, network, out): ) -def parse_sls_json_for_ips(csm, network="NMN"): +def parse_sls_json_for_ips(csm, network="HMN"): """Parse SLS JSON and return IPv4 addresses. - Defaults to the "NMN" network, but another network can be passed in. Cache the switch IP and hostname. + Defaults to the "HMN" network, but another network can be passed in. Cache the switch IP and hostname. Args: csm: The SLS JSON to be parsed. - network: Switch network e.g. (CAN, MTL, NMN). + network: Switch network e.g. (CAN, MTL, HMN). Returns: switch_addresses: A list of switch IPs. diff --git a/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 b/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 index 960240722..bc2a6f81e 100644 --- a/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 +++ b/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 8 + maximum-paths 32 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} diff --git a/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 b/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 index e5c70f21d..0a4b6b207 100644 --- a/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 +++ b/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 8 + maximum-paths 32 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %} diff --git a/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 b/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 index 960240722..bc2a6f81e 100644 --- a/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 +++ b/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 8 + maximum-paths 32 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} diff --git a/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 b/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 index e5c70f21d..0a4b6b207 100644 --- a/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 +++ b/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 8 + maximum-paths 32 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %} diff --git a/network_modeling/configs/templates/1.5/arista/sw-edge.primary.j2 b/network_modeling/configs/templates/1.5/arista/sw-edge.primary.j2 new file mode 100644 index 000000000..0f23daeab --- /dev/null +++ b/network_modeling/configs/templates/1.5/arista/sw-edge.primary.j2 @@ -0,0 +1,121 @@ +{#- edge_router #} + +transceiver qsfp default-mode 4x10G +! +hostname sw-edge-001 +! +spanning-tree mode none +no spanning-tree vlan-id 4094 + +interface Loopback0 + ip address 10.2.1.194/32 + ip ospf area 0.0.0.0 + +interface Management1 + ip address 172.30.52.119/20 + +vlan 5 + name CHN + +vlan 4094 + trunk group MLAG-Peer +! +interface Port-Channel1000 + description [MLAG Peer-Link] + switchport mode trunk + switchport trunk group MLAG-Peer +! +interface Vlan4094 + description [MLAG Link] + no autostate + ip address 10.255.255.0/31 + ip ospf area 0.0.0.0 +! + +interface Vlan{{ variables.CHN_VLAN }} + description CHN + mtu 9214 + ip address {{ variables.CHN_IP }}/{{variables.CHN_PREFIX_LEN}} + ip virtual-router address {{ variables.CHN_IP_GATEWAY }} +ip routing + +ip virtual-router mac-address 06:00:00:20:20:20 + +ip prefix-list HSN seq 10 permit {{ variables.CHN }} ge {{ variables.CHN_PREFIX_LEN }} +! + +mlag configuration + domain-id edge + local-interface Vlan4094 + peer-address 10.255.255.1 + peer-address heartbeat 172.30.52.120 + peer-link Port-Channel1000 + +router ospf 1 + router-id 10.2.1.194 + max-lsa 12000 + default-information originate + +{# note: hard coded IPs until we get them added to IPAM/SLS #} + +{%- if variables.BGP_CONTROL_PLANE == 'CMN' %} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} +{% set sequence = namespace(value=10) %} +route-map {{ name }}-CHN permit {{ sequence.value }} + match ip address prefix-list HSN + {%- for CHN_name, CHN_ip in variables.CHN_IPs.items() if name == CHN_name %} + set ip next-hop {{ CHN_ip }} + {%- endfor %} +{%- endfor %} + +router bgp {{ variables.SWITCH_ASN }} + timers bgp 1 3 + distance bgp 20 200 200 + router-id 10.2.1.194 + maximum-paths 32 + neighbor 10.2.1.195 remote-as 65533 + neighbor 10.2.1.195 next-hop-self + neighbor 10.2.1.195 update-source Loopback0 + neighbor 10.2.1.195 maximum-routes 12000 + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + neighbor {{ ip }} ebgp-multihop 5 + neighbor {{ ip }} update-source Loopback0 + neighbor {{ ip }} route-map {{ name }}-CHN in + neighbor {{ ip }} maximum-routes 12000 + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.194 activate + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + {%- endfor %} +{%- endif %} + +{%- if variables.BGP_CONTROL_PLANE == 'CHN' %} +route-map HSN permit 5 + match ip address prefix-list HSN + +router bgp {{ variables.SWITCH_ASN }} + timers bgp 1 3 + distance bgp 20 200 200 + router-id 10.2.1.194 + maximum-paths 32 + neighbor 10.2.1.195 remote-as 65533 + neighbor 10.2.1.195 next-hop-self + neighbor 10.2.1.195 update-source Loopback0 + neighbor 10.2.1.195 maximum-routes 12000 + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + neighbor {{ ip }} route-map HSN in + neighbor {{ ip }} maximum-routes 12000 + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.195 activate + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + {%- endfor %} +{%- endif %} + +{#- end edge_router #} diff --git a/network_modeling/configs/templates/1.5/arista/sw-edge.secondary.j2 b/network_modeling/configs/templates/1.5/arista/sw-edge.secondary.j2 new file mode 100644 index 000000000..cb3f24e38 --- /dev/null +++ b/network_modeling/configs/templates/1.5/arista/sw-edge.secondary.j2 @@ -0,0 +1,119 @@ +{#- edge_router #} + +transceiver qsfp default-mode 4x10G +! +hostname sw-edge-002 +! +spanning-tree mode none +no spanning-tree vlan-id 4094 + +interface Loopback0 + ip address 10.2.1.195/32 + ip ospf area 0.0.0.0 + +interface Management1 + ip address 172.30.52.120/20 + +vlan 5 + name CHN + +vlan 4094 + trunk group MLAG-Peer +! +interface Port-Channel1000 + description [MLAG Peer-Link] + switchport mode trunk + switchport trunk group MLAG-Peer +! +interface Vlan4094 + description [MLAG Link] + no autostate + ip address 10.255.255.1/31 + ip ospf area 0.0.0.0 +! + +interface Vlan{{ variables.CHN_VLAN }} + description CHN + mtu 9214 + ip address {{ variables.CHN_IP }}/{{variables.CHN_PREFIX_LEN}} + ip virtual-router address {{ variables.CHN_IP_GATEWAY }} +ip routing + +ip virtual-router mac-address 06:00:00:20:20:20 + +ip prefix-list HSN seq 10 permit {{ variables.CHN }} ge {{ variables.CHN_PREFIX_LEN }} +! + +mlag configuration + domain-id edge + local-interface Vlan4094 + peer-address 10.255.255.0 + peer-address heartbeat 172.30.52.119 + peer-link Port-Channel1000 + +router ospf 1 + router-id 10.2.1.195 + max-lsa 12000 + default-information originate + +{%- if variables.BGP_CONTROL_PLANE == 'CMN' %} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} +{% set sequence = namespace(value=10) %} +route-map {{ name }}-CHN permit {{ sequence.value }} + match ip address prefix-list HSN + {%- for CHN_name, CHN_ip in variables.CHN_IPs.items() if name == CHN_name %} + set ip next-hop {{ CHN_ip }} + {%- endfor %} +{%- endfor %} + +router bgp {{ variables.SWITCH_ASN }} + timers bgp 1 3 + distance bgp 20 200 200 + router-id 10.2.1.195 + maximum-paths 32 + neighbor 10.2.1.194 remote-as 65533 + neighbor 10.2.1.194 next-hop-self + neighbor 10.2.1.194 update-source Loopback0 + neighbor 10.2.1.194 maximum-routes 12000 + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + neighbor {{ ip }} ebgp-multihop 5 + neighbor {{ ip }} update-source Loopback0 + neighbor {{ ip }} route-map {{ name }}-CHN in + neighbor {{ ip }} maximum-routes 12000 + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.194 activate + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + {%- endfor %} +{%- endif %} + +{%- if variables.BGP_CONTROL_PLANE == 'CHN' %} +route-map HSN permit 5 + match ip address prefix-list HSN + +router bgp {{ variables.SWITCH_ASN }} + timers bgp 1 3 + distance bgp 20 200 200 + router-id 10.2.1.195 + maximum-paths 32 + neighbor 10.2.1.194 remote-as 65533 + neighbor 10.2.1.194 next-hop-self + neighbor 10.2.1.194 update-source Loopback0 + neighbor 10.2.1.194 maximum-routes 12000 + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + neighbor {{ ip }} route-map HSN in + neighbor {{ ip }} maximum-routes 12000 + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.194 activate + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + {%- endfor %} +{%- endif %} + +{#- end edge_router #} diff --git a/network_modeling/configs/templates/1.5/aruba/common/acl.j2 b/network_modeling/configs/templates/1.5/aruba/common/acl.j2 new file mode 100644 index 000000000..08bdbc5f0 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/acl.j2 @@ -0,0 +1,74 @@ +{#- acl #} +access-list ip mgmt +{% set sequence = 10 %} {{ sequence }} comment ALLOW SSH, HTTPS, AND SNMP ON HMN SUBNET and CMN +{% set sequence = sequence+10 %} {{ sequence }} permit tcp {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} any eq ssh +{% set sequence = sequence+10 %} {{ sequence }} permit tcp {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} any eq https +{% set sequence = sequence+10 %} {{ sequence }} permit udp {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} any eq snmp +{% set sequence = sequence+10 %} {{ sequence }} permit udp {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} any eq snmp-trap +{% set sequence = sequence+10 %} {{ sequence }} comment ALLOW SNMP FROM HMN METALLB SUBNET +{% set sequence = sequence+10 %} {{ sequence }} permit udp {{ variables.HMNLB_NETWORK_IP }}/{{ variables.HMNLB_NETMASK }} any eq snmp +{% set sequence = sequence+10 %} {{ sequence }} permit udp {{ variables.HMNLB_NETWORK_IP }}/{{ variables.HMNLB_NETMASK }} any eq snmp-trap +{% set sequence = sequence+10 %} {{ sequence }} comment BLOCK SSH, HTTPS, AND SNMP FROM EVERYWHERE ELSE +{% set sequence = sequence+10 %} {{ sequence }} deny tcp any any eq ssh +{% set sequence = sequence+10 %} {{ sequence }} deny tcp any any eq https +{% set sequence = sequence+10 %} {{ sequence }} deny udp any any eq snmp +{% set sequence = sequence+10 %} {{ sequence }} deny udp any any eq snmp-trap +{% set sequence = sequence+10 %} {{ sequence }} comment ALLOW ANYTHING ELSE +{% set sequence = sequence+10 %} {{ sequence }} permit any any any +access-list ip nmn-hmn +{%- if variables.NMN and variables.HMN %} +{% set sequence = 10 %} {{ sequence }} deny any {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} +{%- endif %} +{%- if variables.HMN and variables.NMN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} +{%- endif %} +{%- if variables.NMN and variables.HMN_MTN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.HMN and variables.NMN_MTN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_NETMASK }} {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN_MTN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_NETMASK }} {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_NETMASK }} {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN_MTN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_NETMASK }} {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.NMNLB and variables.HMN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.NMNLB_NETWORK_IP }}/{{ variables.NMNLB_NETMASK }} {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} +{%- endif %} +{%- if variables.HMNLB and variables.NMN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMNLB_NETWORK_IP }}/{{ variables.HMNLB_NETMASK }} {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} +{%- endif %} +{%- if variables.HMN and variables.NMNLB %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_NETMASK }} {{ variables.NMNLB_NETWORK_IP }}/{{ variables.NMNLB_NETMASK }} +{%- endif %} +{%- if variables.NMN and variables.HMNLB %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_NETMASK }} {{ variables.HMNLB_NETWORK_IP }}/{{ variables.HMNLB_NETMASK }} +{%- endif %} +{% set sequence = sequence+10 %} {{ sequence }} permit any any any +access-list ip cmn-can +{%- if variables.CMN and variables.CAN %} +{% set sequence = 10 %} {{ sequence }} deny any {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_NETMASK }} {{ variables.CAN_NETWORK_IP }}/{{ variables.CAN_NETMASK }} +{%- endif %} +{%- if variables.CMN and variables.CAN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.CAN_NETWORK_IP }}/{{ variables.CAN_NETMASK }} {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_NETMASK }} +{%- endif %} +{%- if variables.CMN and variables.CHN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_NETMASK }} {{ variables.CHN_NETWORK_IP }}/{{ variables.CHN_NETMASK }} +{%- endif %} +{%- if not variables.CAN %} +{% set sequence = 0 %} +{%- endif %} +{%- if variables.CMN and variables.CHN %} +{% set sequence = sequence+10 %} {{ sequence }} deny any {{ variables.CHN_NETWORK_IP }}/{{ variables.CHN_NETMASK }} {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_NETMASK }} +{%- endif %} +{% set sequence = sequence+10 %} {{ sequence }} permit any any any +apply access-list ip mgmt control-plane vrf default +{#- end acl #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/banner-motd.j2 b/network_modeling/configs/templates/1.5/aruba/common/banner-motd.j2 new file mode 100644 index 000000000..5fef86495 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/banner-motd.j2 @@ -0,0 +1,8 @@ +{# blank line below required #} + +banner exec {{ '!' }} +############################################################################### +# CSM version: {{ variables.CSM_VERSION }} +# CANU version: {{ variables.CANU_VERSION }} +############################################################################### +{{ '!' }} diff --git a/network_modeling/configs/templates/1.5/aruba/common/bgp.primary.j2 b/network_modeling/configs/templates/1.5/aruba/common/bgp.primary.j2 new file mode 100644 index 000000000..d1ad3130c --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/bgp.primary.j2 @@ -0,0 +1,44 @@ +{#- bgp #} +router bgp {{ variables.SWITCH_ASN }} + bgp router-id {{ variables.LOOPBACK_IP }} + maximum-paths 32 + timers bgp 1 3 + distance bgp 20 70 + {%- for name, ip in variables.NMN_IPs.items() if "sw-spine-002" in name %} + neighbor {{ ip }} remote-as {{ variables.SWITCH_ASN }} + {%- endfor %} + {%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.NMN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 unicast + {%- for name, ip in variables.NMN_IPs.items() if "sw-spine-002" in name %} + neighbor {{ ip }} activate + {%- endfor %} + {%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map {{ name }} in + {%- endfor %} + exit-address-family + vrf Customer + bgp router-id {{ variables.LOOPBACK_IP }} + maximum-paths 32 + timers bgp 1 3 + distance bgp 20 70 + {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} + neighbor {{ ip }} remote-as {{ variables.SWITCH_ASN }} + {%- endfor %} + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CMN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 unicast + {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} + neighbor {{ ip }} activate + {%- endfor %} + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map {{ name }}-Customer in + {%- endfor %} + exit-address-family +{#- end bgp #} diff --git a/network_modeling/configs/templates/1.5/aruba/common/bgp.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/common/bgp.secondary.j2 new file mode 100644 index 000000000..a76a0462e --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/bgp.secondary.j2 @@ -0,0 +1,44 @@ +{#- bgp #} +router bgp {{ variables.SWITCH_ASN }} + bgp router-id {{ variables.LOOPBACK_IP }} + maximum-paths 32 + timers bgp 1 3 + distance bgp 20 70 + {%- for name, ip in variables.NMN_IPs.items() if "sw-spine-001" in name %} + neighbor {{ ip }} remote-as {{ variables.SWITCH_ASN }} + {%- endfor %} + {%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.NMN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 unicast + {%- for name, ip in variables.NMN_IPs.items() if "sw-spine-001" in name %} + neighbor {{ ip }} activate + {%- endfor %} + {%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map {{ name }} in + {%- endfor %} + exit-address-family + vrf Customer + bgp router-id {{ variables.LOOPBACK_IP }} + maximum-paths 32 + timers bgp 1 3 + distance bgp 20 70 + {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %} + neighbor {{ ip }} remote-as {{ variables.SWITCH_ASN }} + {%- endfor %} + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CMN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 unicast + {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %} + neighbor {{ ip }} activate + {%- endfor %} + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map {{ name }}-Customer in + {%- endfor %} + exit-address-family +{#- end bgp #} diff --git a/network_modeling/configs/templates/1.5/aruba/common/bmc.j2 b/network_modeling/configs/templates/1.5/aruba/common/bmc.j2 new file mode 100644 index 000000000..12b782f70 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/bmc.j2 @@ -0,0 +1,13 @@ +{#- bmc #} +{%- for node in cabling.nodes if node.slot == "bmc" or node.slot == "cmc" or node.subtype == "sw-hsn" or node.subtype == "pdu" or node.subtype == "kvm" %} +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + no routing + vlan access {{ variables.HMN_VLAN }} + spanning-tree bpdu-guard + spanning-tree port-type admin-edge + +{%- endfor %} +{#- end bmc #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/cdu-to-spine.lag.j2 b/network_modeling/configs/templates/1.5/aruba/common/cdu-to-spine.lag.j2 new file mode 100644 index 000000000..b56ba0468 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/cdu-to-spine.lag.j2 @@ -0,0 +1,24 @@ +{#- cdu-to-spine.lag #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "spine" %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description cdu_to_spines_lag + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active +{%- endif %} +{%- endfor %} + +{%- for node in cabling.nodes if node.subtype == "spine"%} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} +{%- endfor %} +{#- end cdu-to-spine.lag #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/cec.j2 b/network_modeling/configs/templates/1.5/aruba/common/cec.j2 new file mode 100644 index 000000000..2dbad77a3 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/cec.j2 @@ -0,0 +1,13 @@ +{#- cec #} +{%- for node in cabling.nodes if node.subtype == "cec" %} +interface 1/1/{{ node.config.INTERFACE_NUMBER }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + no routing + vlan access {{ node.config.NATIVE_VLAN }} + spanning-tree bpdu-guard + spanning-tree port-type admin-edge + +{%- endfor %} +{#- end cec #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/cmm.j2 b/network_modeling/configs/templates/1.5/aruba/common/cmm.j2 new file mode 100644 index 000000000..a0127d3b9 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/cmm.j2 @@ -0,0 +1,18 @@ +{#- cmm #} +{%- for node in cabling.nodes if node.subtype == "cmm" %} +interface lag {{ node.config.LAG_NUMBER }} multi-chassis static + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ node.config.NATIVE_VLAN }} + vlan trunk allowed {{ groupby_vlan_range([node.config.NATIVE_VLAN, node.config.TAGGED_VLAN]) }} + spanning-tree root-guard + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end cmm #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/compute.j2 b/network_modeling/configs/templates/1.5/aruba/common/compute.j2 new file mode 100644 index 000000000..d46b98ea2 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/compute.j2 @@ -0,0 +1,13 @@ +{#- compute #} +{%- for node in cabling.nodes if node.subtype == "compute" and node.slot == "onboard" %} +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + no routing + vlan access {{ variables.NMN_VLAN }} + spanning-tree bpdu-guard + spanning-tree port-type admin-edge + +{%- endfor %} +{#- end compute #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/four_port_ocp.j2 b/network_modeling/configs/templates/1.5/aruba/common/four_port_ocp.j2 new file mode 100644 index 000000000..fc34ab6a4 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/four_port_ocp.j2 @@ -0,0 +1,11 @@ +{%- for node in cabling.nodes if node.subtype == "river_ncn_node_4_port_1g_ocp" and node.slot == "ocp" %} +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + no routing + vlan access {{ variables.NMN_VLAN }} + spanning-tree bpdu-guard + spanning-tree port-type admin-edge + +{%- endfor %} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/leaf_bmc_unused_port.j2 b/network_modeling/configs/templates/1.5/aruba/common/leaf_bmc_unused_port.j2 new file mode 100644 index 000000000..47d608059 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/leaf_bmc_unused_port.j2 @@ -0,0 +1,9 @@ +{#- unused #} +{%- for port in variables.UNUSED_PORTS %} +interface 1/1/{{ port }} + shutdown + no routing + vlan access 1 + +{%- endfor %} +{#- end unused #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/mtn_hmn_vlan.j2 b/network_modeling/configs/templates/1.5/aruba/common/mtn_hmn_vlan.j2 new file mode 100644 index 000000000..8d0d41554 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/mtn_hmn_vlan.j2 @@ -0,0 +1,20 @@ +{#- mtn_hmn_vlan #} +{%- for cabinet in variables.HMN_MTN_VLANS %} +vlan {{ cabinet.VlanID }} + name {{ cabinet.Name }}_hmn + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out + +interface vlan {{ cabinet.VlanID }} + description {{ cabinet.Name }}_hmn + ip mtu 9198 + ip address {{ cabinet.IP }}/{{ cabinet.PREFIX_LENGTH }} + active-gateway ip mac 12:00:00:00:73:00 + active-gateway ip {{ cabinet.Gateway }} + ipv6 address autoconfig + ip helper-address 10.94.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive + +{%- endfor %} +{#- end mtn_hmn_vlan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/mtn_nmn_vlan.j2 b/network_modeling/configs/templates/1.5/aruba/common/mtn_nmn_vlan.j2 new file mode 100644 index 000000000..68ab3f427 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/mtn_nmn_vlan.j2 @@ -0,0 +1,19 @@ +{#- mtn_nmn_vlan #} +{%- for cabinet in variables.NMN_MTN_VLANS %} +vlan {{ cabinet.VlanID }} + name {{ cabinet.Name }}_nmn + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out + +interface vlan {{ cabinet.VlanID }} + description {{ cabinet.Name }}_nmn + ip mtu 9198 + ip address {{ cabinet.IP }}/{{ cabinet.PREFIX_LENGTH }} + active-gateway ip mac 12:00:00:00:73:00 + active-gateway ip {{ cabinet.Gateway }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive + +{%- endfor %} +{#- end mtn_nmn_vlan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/ncn-m.lag.j2 b/network_modeling/configs/templates/1.5/aruba/common/ncn-m.lag.j2 new file mode 100644 index 000000000..0fd229f07 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/ncn-m.lag.j2 @@ -0,0 +1,29 @@ +{#- master #} +{%- for node in cabling.nodes if node.subtype == "master" %} +{%- if node.destination_port == 1%} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} + lacp mode active + lacp fallback + spanning-tree port-type admin-edge + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} +{%- endif %} +{%- if node.destination_port == 2%} + +interface 1/1/{{ node.config.PORT }} + shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} +{%- endif %} +{%- endfor %} +{#- end master #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/ncn-s.lag.j2 b/network_modeling/configs/templates/1.5/aruba/common/ncn-s.lag.j2 new file mode 100644 index 000000000..9e774e160 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/ncn-s.lag.j2 @@ -0,0 +1,25 @@ +{#- storage #} +{%- for node in cabling.nodes if node.subtype == "storage" %} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing +{%- if node.destination_port == 1%} + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} +{%- else %} + vlan trunk native 10 + vlan trunk allowed 10 +{%- endif %} + lacp mode active + lacp fallback + spanning-tree port-type admin-edge + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} +{%- endfor %} +{#- end storage #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/ncn-w.lag.j2 b/network_modeling/configs/templates/1.5/aruba/common/ncn-w.lag.j2 new file mode 100644 index 000000000..48bff8ace --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/ncn-w.lag.j2 @@ -0,0 +1,20 @@ +{#- worker #} +{%- for node in cabling.nodes if node.subtype == "worker" %} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} + lacp mode active + lacp fallback + spanning-tree port-type admin-edge + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} +{%- endfor %} +{#- end worker #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/prefix-list.j2 b/network_modeling/configs/templates/1.5/aruba/common/prefix-list.j2 new file mode 100644 index 000000000..2dbb74689 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/prefix-list.j2 @@ -0,0 +1,10 @@ +{#- prefix-list #} +ip prefix-list pl-cmn seq 10 permit {{ variables.CMN }} ge {{ variables.CMN_PREFIX_LEN }} +{%- if variables.CAN %} +ip prefix-list pl-can seq 20 permit {{ variables.CAN }} ge {{ variables.CAN_PREFIX_LEN }} +{%- endif %} +ip prefix-list pl-hmn seq 30 permit {{ variables.HMNLB }} ge {{ variables.HMNLB_PREFIX_LEN }} +ip prefix-list pl-nmn seq 40 permit {{ variables.NMNLB }} ge {{ variables.NMNLB_PREFIX_LEN }} +ip prefix-list tftp seq 10 permit {{ variables.NMNLB_TFTP }}/32 ge 32 le 32 +ip prefix-list tftp seq 20 permit {{ variables.HMNLB_TFTP }}/32 ge 32 le 32 +{#- end prefix-list #} diff --git a/network_modeling/configs/templates/1.5/aruba/common/route-map.j2 b/network_modeling/configs/templates/1.5/aruba/common/route-map.j2 new file mode 100644 index 000000000..16e34246d --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/route-map.j2 @@ -0,0 +1,37 @@ +{#- route-map #} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} +{% set sequence = namespace(value=10) %} +{% set localpref = namespace(value=1000) %} + {%- for tftp_name, tftp_ip in variables.NMN_IPs.items() if tftp_name in ["ncn-w001", "ncn-w002", "ncn-w003"] %} +route-map {{ name }} permit seq {{ sequence.value }}{% set sequence.value = sequence.value + 10%} + match ip address prefix-list tftp + match ip next-hop {{ tftp_ip }} + set local-preference {{ localpref.value }}{% set localpref.value = localpref.value + 100%} + {%- endfor %} +route-map {{ name }} permit seq {{ sequence.value }} + match ip address prefix-list pl-hmn + {%- for hmn_name, hmn_ip in variables.HMN_IPs.items() if name == hmn_name %} + set ip next-hop {{ hmn_ip }} + {%- endfor %} +{% set sequence.value = sequence.value + 10 %}route-map {{ name }} permit seq {{ sequence.value }} + match ip address prefix-list pl-nmn + {%- for nmn_name, nmn_ip in variables.NMN_IPs.items() if name == nmn_name %} + set ip next-hop {{ nmn_ip }} + {%- endfor %} + + +{%- if variables.CAN %} +{% set sequence = namespace(value=10) %} +route-map {{ name }}-Customer permit seq {{ sequence.value }} + match ip address prefix-list pl-can + {%- for CAN_name, CAN_ip in variables.CAN_IPs.items() if name == CAN_name %} + set ip next-hop {{ CAN_ip }} + {%- endfor %} +{%- endif %} +{%- if not variables.CAN %} +{% set sequence = namespace(value=10) %} +{%- endif %} +{% set sequence.value = sequence.value + 10 %}route-map {{ name }}-Customer permit seq {{ sequence.value }} + match ip address prefix-list pl-cmn +{%- endfor %} +{#- end route-map #} diff --git a/network_modeling/configs/templates/1.5/aruba/common/spine-to-cdu.lag.j2 b/network_modeling/configs/templates/1.5/aruba/common/spine-to-cdu.lag.j2 new file mode 100644 index 000000000..2aa76973c --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/spine-to-cdu.lag.j2 @@ -0,0 +1,22 @@ +{#- spine-to-cdu.lag #} +{%- for node in cabling.nodes if node.subtype == "cdu" %} +{%- if node.primary == true %} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active + spanning-tree root-guard +{%- endif %} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end spine-to-cdu.lag #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/spine_leaf_unused_port.j2 b/network_modeling/configs/templates/1.5/aruba/common/spine_leaf_unused_port.j2 new file mode 100644 index 000000000..5d186096c --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/spine_leaf_unused_port.j2 @@ -0,0 +1,7 @@ +{#- unused #} +{%- for port in variables.UNUSED_PORTS %} +interface 1/1/{{ port }} + description UNUSED + +{%- endfor %} +{#- end unused #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.primary.j2 b/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.primary.j2 new file mode 100644 index 000000000..45b658dde --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.primary.j2 @@ -0,0 +1,86 @@ +{#- sw-cdu.primary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf keepalive +vrf Customer +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{%- include '1.4/aruba/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/aruba/common/mtn_nmn_vlan.j2' %} +{% include '1.4/aruba/common/cmm.j2' %} +{% include '1.4/aruba/common/cec.j2' %} +{% include '1.4/aruba/common/cdu-to-spine.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.primary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan 1 + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 + +ip dns server-address {{ variables.NMNLB_DNS }} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-cdu.primary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.secondary.j2 new file mode 100644 index 000000000..f6920dc47 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/sw-cdu.secondary.j2 @@ -0,0 +1,86 @@ +{#- sw-cdu.secondary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf keepalive +vrf Customer +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{%- include '1.4/aruba/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/aruba/common/mtn_nmn_vlan.j2' %} +{% include '1.4/aruba/common/cmm.j2' %} +{% include '1.4/aruba/common/cec.j2' %} +{% include '1.4/aruba/common/cdu-to-spine.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.secondary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan 1 + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 + +ip dns server-address {{ variables.NMNLB_DNS }} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-cdu.secondary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/uan.j2 b/network_modeling/configs/templates/1.5/aruba/common/uan.j2 new file mode 100644 index 000000000..31f4ba71e --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/uan.j2 @@ -0,0 +1,42 @@ +{#- uan #} +{%- for node in cabling.nodes if node.subtype == "uan" %} +{%- if node.destination_port == 1%} +interface 1/1/{{ node.config.PORT }} +{%- if node.slot == 'ocp' %} + no shutdown +{%- else %} + +{%- endif %} + mtu 9198 + description {{ node.config.DESCRIPTION }} + no routing + vlan access {{ variables.NMN_VLAN }} + spanning-tree bpdu-guard + spanning-tree port-type admin-edge +{%- endif %} +{%- if node.destination_port == 2%} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + description {{ node.config.DESCRIPTION }} + no routing + lacp mode active + lacp fallback + spanning-tree port-type admin-edge +{%- if variables.CHN_VLAN %} + vlan access {{ variables.NATIVE_VLAN }} +{%- endif %} +{%- if not variables.CHN_VLAN %} + no shutdown + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.CAN_VLAN }} +{%- endif %} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endif %} +{%- endfor %} +{#- end-uan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/unknown.j2 b/network_modeling/configs/templates/1.5/aruba/common/unknown.j2 new file mode 100644 index 000000000..484544f08 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/unknown.j2 @@ -0,0 +1,14 @@ +{%- set ns = namespace(displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "unknown" %} +{%- if ns.displayed == false %} +{%- set ns.displayed = true %} +# WARNING: The following devices were discovered in the input data, +# but the CANU model cannot determine the type and generate +# a configuration. Applying this configuration without +# considering these devices will likely result in loss of +# contact with these devices. Ensure valid input, submit +# a bug to CANU and manually add these devices to the configuration. +{%- endif %} +# Unknown destination node not included in config +# {{ node.config.DESCRIPTION }} +{%- endfor %} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.primary.j2 b/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.primary.j2 new file mode 100644 index 000000000..c6624694b --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.primary.j2 @@ -0,0 +1,38 @@ +{#- vsx_isl #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype in variables.HOSTNAME and node.config.LAG_NUMBER %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} + +interface lag {{ node.config.LAG_NUMBER }} + no shutdown + description ISL link + no routing + vlan trunk native 1 tag + vlan trunk allowed all + lacp mode active +interface 1/1/{{ variables.VSX_KEEPALIVE }} + no shutdown + vrf attach keepalive + description VSX keepalive + ip address 192.168.255.0/31 +interface 1/1/{{ variables.VSX_ISL_PORT1 }} + no shutdown + mtu 9198 + description vsx isl + lag {{ node.config.LAG_NUMBER }} +interface 1/1/{{ variables.VSX_ISL_PORT2 }} + no shutdown + mtu 9198 + description vsx isl + lag {{ node.config.LAG_NUMBER }} +vsx + system-mac {{ vsx_mac(variables.HOSTNAME) }} + inter-switch-link lag {{ node.config.LAG_NUMBER }} + role primary + keepalive peer 192.168.255.1 source 192.168.255.0 vrf keepalive + linkup-delay-timer 600 + vsx-sync vsx-global +{%- endif %} +{%- endfor %} +{#- end vsx_isl #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.secondary.j2 new file mode 100644 index 000000000..07c3c0da9 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/common/vsx_isl.secondary.j2 @@ -0,0 +1,38 @@ +{#- vsx_isl #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype in variables.HOSTNAME and node.config.LAG_NUMBER %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} + +interface lag {{ node.config.LAG_NUMBER }} + no shutdown + description ISL link + no routing + vlan trunk native 1 tag + vlan trunk allowed all + lacp mode active +interface 1/1/{{ variables.VSX_KEEPALIVE }} + no shutdown + vrf attach keepalive + description VSX keepalive + ip address 192.168.255.1/31 +interface 1/1/{{ variables.VSX_ISL_PORT1 }} + no shutdown + mtu 9198 + description vsx isl + lag {{ node.config.LAG_NUMBER }} +interface 1/1/{{ variables.VSX_ISL_PORT2 }} + no shutdown + mtu 9198 + description vsx isl + lag {{ node.config.LAG_NUMBER }} +vsx + system-mac {{ vsx_mac(variables.HOSTNAME) }} + inter-switch-link lag {{ node.config.LAG_NUMBER }} + role secondary + keepalive peer 192.168.255.0 source 192.168.255.1 vrf keepalive + linkup-delay-timer 600 + vsx-sync vsx-global +{%- endif %} +{%- endfor %} +{#- end vsx_isl #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/leaf-bmc-to-leaf.lag.j2 b/network_modeling/configs/templates/1.5/aruba/full/leaf-bmc-to-leaf.lag.j2 new file mode 100644 index 000000000..3f640d48f --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/leaf-bmc-to-leaf.lag.j2 @@ -0,0 +1,24 @@ +{#- leaf-bmc-to-leaf #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "leaf" %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} +interface lag {{ node.config.LAG_NUMBER }} + no shutdown + description leaf_bmc_to_leaf_lag + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active +{%- endif %} +{%- endfor %} + +{%- for node in cabling.nodes if node.subtype == "leaf"%} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} +{%- endfor %} +{#- end leaf-bmc-to-leaf #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/leaf-to-leaf-bmc.lag.j2 b/network_modeling/configs/templates/1.5/aruba/full/leaf-to-leaf-bmc.lag.j2 new file mode 100644 index 000000000..8a1075a52 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/leaf-to-leaf-bmc.lag.j2 @@ -0,0 +1,18 @@ +{#- leaf-to-leaf-bmc #} +{%- for node in cabling.nodes if node.subtype == "leaf-bmc" %} +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end leaf-to-leaf-bmc #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/leaf-to-spine.lag.j2 b/network_modeling/configs/templates/1.5/aruba/full/leaf-to-spine.lag.j2 new file mode 100644 index 000000000..23e2470e7 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/leaf-to-spine.lag.j2 @@ -0,0 +1,27 @@ +{#- leaf-to-spine.lag #} +{%- set ns = namespace(lag1='') %} +{%- for node in cabling.nodes if node.subtype == "spine" %} +{#- Use the namespace to set the first of the two connections from the leaf to a single spine +They need to be on a single lag +Two Separate interfaces e.g. (1/1/53, 1/1/54) #} +{%- if ns.lag1 == '' %} +{%- set ns.lag1 = node.config.LAG_NUMBER %} + +interface lag {{ ns.lag1 }} multi-chassis + no shutdown + description leaf_to_spines_lag + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} + lacp mode active +{%- endif %} +{%- endfor %} +{%- for node in cabling.nodes if node.subtype == "spine"%} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ ns.lag1 }} +{%- endfor %} +{#- end leaf-to-spine.lag #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/spine-to-leaf.lag.j2 b/network_modeling/configs/templates/1.5/aruba/full/spine-to-leaf.lag.j2 new file mode 100644 index 000000000..50fe97cdb --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/spine-to-leaf.lag.j2 @@ -0,0 +1,22 @@ +{#- spine-to-leaf.lag #} +{%- for node in cabling.nodes if node.subtype == "leaf" %} +{%- if node.primary == true %} + +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description spine_to_leaf_lag + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.SPINE_LEAF_VLANS }} + lacp mode active + spanning-tree root-guard +{%- endif %} + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end spine-to-leaf.lag #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/sw-leaf-bmc.j2 b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf-bmc.j2 new file mode 100644 index 000000000..83540590e --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf-bmc.j2 @@ -0,0 +1,84 @@ +{#- sw-leaf-bmc #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf default +ssh server vrf mgmt +ssh server vrf Customer +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out + +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/four_port_ocp.j2' %} +{% include '1.4/aruba/common/compute.j2' %} +{% include '1.4/aruba/common/bmc.j2' %} +{% include '1.4/aruba/full/leaf-bmc-to-leaf.lag.j2' %} +{% include '1.4/aruba/common/leaf_bmc_unused_port.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 +snmp-server vrf default +ip dns server-address {{ variables.NMNLB_DNS }} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-leaf-bmc #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.primary.j2 b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.primary.j2 new file mode 100644 index 000000000..3547203b4 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.primary.j2 @@ -0,0 +1,95 @@ +{#- sw-leaf.primary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +ssh server vrf Customer +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/ncn-m.lag.j2' %} +{% include '1.4/aruba/common/ncn-w.lag.j2' %} +{% include '1.4/aruba/common/ncn-s.lag.j2' %} +{% include '1.4/aruba/common/uan.j2' %} +{% include '1.4/aruba/full/leaf-to-leaf-bmc.lag.j2' %} +{% include '1.4/aruba/full/leaf-to-spine.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.primary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 +ip dns server-address {{ variables.NMNLB_DNS }} + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-leaf.primary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.secondary.j2 new file mode 100644 index 000000000..af0a2be53 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/sw-leaf.secondary.j2 @@ -0,0 +1,95 @@ +{#- sw-leaf.secondary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +ssh server vrf Customer +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/ncn-m.lag.j2' %} +{% include '1.4/aruba/common/ncn-w.lag.j2' %} +{% include '1.4/aruba/common/ncn-s.lag.j2' %} +{% include '1.4/aruba/common/uan.j2' %} +{% include '1.4/aruba/full/leaf-to-leaf-bmc.lag.j2' %} +{% include '1.4/aruba/full/leaf-to-spine.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.secondary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 +ip dns server-address {{ variables.NMNLB_DNS }} + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-leaf.secondary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/sw-spine.primary.j2 b/network_modeling/configs/templates/1.5/aruba/full/sw-spine.primary.j2 new file mode 100644 index 000000000..944c4f56a --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/sw-spine.primary.j2 @@ -0,0 +1,118 @@ +{#- sw-spine.primary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree priority 0 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/full/spine-to-leaf.lag.j2' %} +{% include '1.4/aruba/common/spine-to-cdu.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.primary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.MTL_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.NMN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.HMN_IP_GATEWAY }} + ip helper-address 10.94.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +{%- if variables.CMN != None %} +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{ variables.CMN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CMN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} + vrf attach Customer + description CAN + ip mtu 9198 + ip address {{ variables.CAN_IP_PRIMARY }}/{{ variables.CAN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CAN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +ip dns server-address {{ variables.NMNLB_DNS }} +{% include '1.4/aruba/common/prefix-list.j2' %} +{% include '1.4/aruba/common/route-map.j2' %} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + default-information originate + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + redistribute bgp + area 0.0.0.0 +{% include '1.4/aruba/common/bgp.primary.j2' %} +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-spine.primary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/full/sw-spine.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/full/sw-spine.secondary.j2 new file mode 100644 index 000000000..b1439ed76 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/full/sw-spine.secondary.j2 @@ -0,0 +1,118 @@ +{#- sw-spine.secondary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree priority 0 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/full/spine-to-leaf.lag.j2' %} +{% include '1.4/aruba/common/spine-to-cdu.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.secondary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.MTL_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.NMN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.HMN_IP_GATEWAY }} + ip helper-address 10.94.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +{%- if variables.CMN != None %} +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{ variables.CMN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CMN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} + vrf attach Customer + description CAN + ip mtu 9198 + ip address {{ variables.CAN_IP_SECONDARY }}/{{ variables.CAN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CAN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +ip dns server-address {{ variables.NMNLB_DNS }} +{% include '1.4/aruba/common/prefix-list.j2' %} +{% include '1.4/aruba/common/route-map.j2' %} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + default-information originate + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + redistribute bgp + area 0.0.0.0 +{% include '1.4/aruba/common/bgp.secondary.j2' %} +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-spine.secondary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/sw-edge.primary.j2 b/network_modeling/configs/templates/1.5/aruba/sw-edge.primary.j2 new file mode 100644 index 000000000..d86a9393a --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/sw-edge.primary.j2 @@ -0,0 +1,136 @@ +{#- edge_router #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname sw-edge-001 +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +ssh server vrf Customer + +interface mgmt + no shutdown + ip static 172.30.52.119/20 + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.CHN_VLAN }} + name CHN + + +interface lag 256 + no shutdown + description ISL link + no routing + vlan trunk native 1 tag + vlan trunk allowed all + lacp mode active +interface 1/1/30 + no shutdown + vrf attach keepalive + description VSX keepalive + ip address 192.168.255.0/31 +interface 1/1/31 + no shutdown + mtu 9198 + description vsx isl + lag 256 +interface 1/1/32 + no shutdown + mtu 9198 + description vsx isl + lag 256 +interface loopback 0 + ip address 10.2.1.194/32 + ip ospf 1 area 0.0.0.0 + +interface vlan {{ variables.CHN_VLAN }} + description CHN + ip mtu 9198 + ip address {{ variables.CHN_IP }}/{{variables.CHN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6c:00 + active-gateway ip {{ variables.CHN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +ip dns server-address {{ variables.NMNLB_DNS }} + +vsx + system-mac 03:03:03:03:03:03 + inter-switch-link lag 256 + role primary + keepalive peer 192.168.255.1 source 192.168.255.0 vrf keepalive + linkup-delay-timer 600 + vsx-sync vsx-global + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 + default-information originate +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 + default-information originate + +{# note: hard coded IPs until we get them added to IPAM/SLS #} + +{%- if variables.BGP_CONTROL_PLANE == 'CMN' %} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} +{% set sequence = namespace(value=10) %} +route-map {{ name }}-CHN permit {{ sequence.value }} + match ip address prefix-list HSN + {%- for CHN_name, CHN_ip in variables.CHN_IPs.items() if name == CHN_name %} + set ip next-hop {{ CHN_ip }} + {%- endfor %} +{%- endfor %} + +router bgp {{ variables.SWITCH_ASN }} + router-id 10.2.1.194 + maximum-paths 8 + timers bgp 1 3 + distance bgp 20 70 + neighbor 10.2.1.195 remote-as 65533 + neighbor 10.2.1.195 update-source loopback 0 + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.195 activate + neighbor 10.2.1.195 next-hop-self + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map HSN in + {%- endfor %} +{%- endif %} + +{%- if variables.BGP_CONTROL_PLANE == 'CHN' %} +route-map HSN permit 5 + match ip address prefix-list HSN + +router bgp {{ variables.SWITCH_ASN }} + router-id 10.2.1.194 + maximum-paths 8 + timers bgp 1 3 + distance bgp 20 70 + neighbor 10.2.1.195 remote-as 65533 + neighbor 10.2.1.195 update-source Loopback 0 + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.195 activate + neighbor 10.2.1.195 next-hop-self + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map HSN in + {%- endfor %} +{%- endif %} + +{#- end edge_router #} diff --git a/network_modeling/configs/templates/1.5/aruba/sw-edge.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/sw-edge.secondary.j2 new file mode 100644 index 000000000..b74fc5480 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/sw-edge.secondary.j2 @@ -0,0 +1,135 @@ +{#- edge_router #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname sw-edge-002 +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +ssh server vrf Customer + +interface mgmt + no shutdown + ip static 172.30.52.120/20 + +vlan {{ variables.NATIVE_VLAN }} +vlan {{ variables.CHN_VLAN }} + name CHN + +interface lag 256 + no shutdown + description ISL link + no routing + vlan trunk native 1 tag + vlan trunk allowed all + lacp mode active +interface 1/1/30 + no shutdown + vrf attach keepalive + description VSX keepalive + ip address 192.168.255.0/31 +interface 1/1/31 + no shutdown + mtu 9198 + description vsx isl + lag 256 +interface 1/1/32 + no shutdown + mtu 9198 + description vsx isl + lag 256 +interface loopback 0 + ip address 10.2.1.195/32 + ip ospf 1 area 0.0.0.0 + +interface vlan {{ variables.CHN_VLAN }} + description CHN + ip mtu 9198 + ip address {{ variables.CHN_IP }}/{{variables.CHN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6c:00 + active-gateway ip {{ variables.CHN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +ip dns server-address {{ variables.NMNLB_DNS }} + +vsx + system-mac 03:03:03:03:03:03 + inter-switch-link lag 256 + role secondary + keepalive peer 192.168.255.0 source 192.168.255.1 vrf keepalive + linkup-delay-timer 600 + vsx-sync vsx-global + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 + default-information originate +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 + default-information originate + +{# note: hard coded IPs until we get them added to IPAM/SLS #} + +{%- if variables.BGP_CONTROL_PLANE == 'CMN' %} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} +{% set sequence = namespace(value=10) %} +route-map {{ name }}-CHN permit {{ sequence.value }} + match ip address prefix-list HSN + {%- for CHN_name, CHN_ip in variables.CHN_IPs.items() if name == CHN_name %} + set ip next-hop {{ CHN_ip }} + {%- endfor %} +{%- endfor %} + +router bgp {{ variables.SWITCH_ASN }} + router-id 10.2.1.195 + maximum-paths 8 + timers bgp 1 3 + distance bgp 20 70 + neighbor 10.2.1.194 remote-as 65533 + neighbor 10.2.1.194 update-source loopback 0 + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.194 activate + neighbor 10.2.1.194 next-hop-self + {%- for name, ip in variables.CMN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map HSN in + {%- endfor %} +{%- endif %} + +{%- if variables.BGP_CONTROL_PLANE == 'CHN' %} +route-map HSN permit 5 + match ip address prefix-list HSN + +router bgp {{ variables.SWITCH_ASN }} + router-id 10.2.1.195 + maximum-paths 8 + timers bgp 1 3 + distance bgp 20 70 + neighbor 10.2.1.194 remote-as 65533 + neighbor 10.2.1.194 update-source Loopback 0 + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} remote-as {{ variables.CHN_ASN }} + neighbor {{ ip }} passive + {%- endfor %} + address-family ipv4 + neighbor 10.2.1.194 activate + neighbor 10.2.1.194 next-hop-self + {%- for name, ip in variables.CHN_IPs.items() if "ncn-w" in name %} + neighbor {{ ip }} activate + neighbor {{ ip }} route-map HSN in + {%- endfor %} +{%- endif %} + +{#- end edge_router #} diff --git a/network_modeling/configs/templates/1.5/aruba/tds/leaf-bmc-to-spine.lag.j2 b/network_modeling/configs/templates/1.5/aruba/tds/leaf-bmc-to-spine.lag.j2 new file mode 100644 index 000000000..e817afa3b --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/leaf-bmc-to-spine.lag.j2 @@ -0,0 +1,24 @@ +{#- leaf-bmc-to-spine #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "spine" %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} +interface lag {{ node.config.LAG_NUMBER }} + no shutdown + description leaf_bmc_to_spine_lag + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active +{%- endif %} +{%- endfor %} + +{%- for node in cabling.nodes if node.subtype == "spine"%} +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end leaf-bmc-to-spine #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/tds/notes.md b/network_modeling/configs/templates/1.5/aruba/tds/notes.md new file mode 100644 index 000000000..ec7c62313 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/notes.md @@ -0,0 +1,61 @@ + + + +dm-spine-primary/secondary in tds/full + +Needs variables: + + +{{ variables.SUN_IP }} +{{ variables.MLAG_IP }} +{{ variables.SUN_IP_GATEWAY }} + +{% include 'common/ncn-m.lag.j2' %} +{% include 'common/ncn-w.lag.j2' %} +{% include 'common/ncn-s.lag.j2' %} +{% include 'common/uan.j2' %} +{% include 'tds/spine-to-leaf-bmc.lag.j2' %} +{% include 'common/spine-to-cdu.lag.j2' %} + +<- needs new port config templates + +should we rename: + +mlag-vip gamora-mlag-domain ip 192.168.255.242 /29 force + +to: + +mlag-vip cray-mlag-domain ip 192.168.255.242 /29 force + +? + + +dm-leaf + +needs: + {{ variables.CAN_IP }} + +{{ variables.MTN_NMN }} + +{{ variables.MTN_HMN }} + +{% include 'tds/leaf-bmc-to-spine.lag.j2' %} +{% include 'common/bmc.j2' %} + +{% include 'common/ncn-m.lag.j2' %} +{% include 'common/ncn-w.lag.j2' %} +{% include 'common/ncn-s.lag.j2' %} +{% include 'common/uan.j2' %} +{% include 'tds/spine-to-leaf-bmc.lag.j2' %} +{% include 'common/spine-to-cdu.lag.j2' %} + +<- needs new port config templates + +should we rename: + +mlag-vip shandy +-mlag-domain ip 192.168.255.242 /29 force + +to: + +mlag-vip cray-mlag-domain ip 192.168.255.242 /29 force diff --git a/network_modeling/configs/templates/1.5/aruba/tds/spine-to-leaf-bmc.lag.j2 b/network_modeling/configs/templates/1.5/aruba/tds/spine-to-leaf-bmc.lag.j2 new file mode 100644 index 000000000..76299712e --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/spine-to-leaf-bmc.lag.j2 @@ -0,0 +1,18 @@ +{#- spine-to-leaf-bmc #} +{%- for node in cabling.nodes if node.subtype == "leaf-bmc" %} +interface lag {{ node.config.LAG_NUMBER }} multi-chassis + no shutdown + description {{ node.config.DESCRIPTION }} + no routing + vlan trunk native {{ variables.NATIVE_VLAN }} + vlan trunk allowed {{ variables.LEAF_BMC_VLANS }} + lacp mode active + +interface 1/1/{{ node.config.PORT }} + no shutdown + mtu 9198 + description {{ node.config.DESCRIPTION }} + lag {{ node.config.LAG_NUMBER }} + +{%- endfor %} +{#- end spine-to-leaf-bmc #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/tds/sw-leaf-bmc.j2 b/network_modeling/configs/templates/1.5/aruba/tds/sw-leaf-bmc.j2 new file mode 100644 index 000000000..6463f191d --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/sw-leaf-bmc.j2 @@ -0,0 +1,84 @@ +{#- sw-leaf-bmc #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + + +ssh server vrf default +ssh server vrf mgmt +ssh server vrf Customer +{%- include '1.4/aruba/common/acl.j2' %} + +vlan 1 +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out + +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/four_port_ocp.j2' %} +{% include '1.4/aruba/common/compute.j2' %} +{% include '1.4/aruba/common/bmc.j2' %} +{% include '1.4/aruba/tds/leaf-bmc-to-spine.lag.j2' %} +{% include '1.4/aruba/common/leaf_bmc_unused_port.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan 1 + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip ospf 2 area 0.0.0.0 +snmp-server vrf default +ip dns server-address {{ variables.NMNLB_DNS }} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + area 0.0.0.0 +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-leaf-bmc #} diff --git a/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.primary.j2 b/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.primary.j2 new file mode 100644 index 000000000..f54341eba --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.primary.j2 @@ -0,0 +1,122 @@ +{#- sw-spine.primary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan 1 +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree priority 0 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/ncn-m.lag.j2' %} +{% include '1.4/aruba/common/ncn-w.lag.j2' %} +{% include '1.4/aruba/common/ncn-s.lag.j2' %} +{% include '1.4/aruba/common/uan.j2' %} +{% include '1.4/aruba/tds/spine-to-leaf-bmc.lag.j2' %} +{% include '1.4/aruba/common/spine-to-cdu.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.primary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan 1 + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.MTL_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.NMN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.HMN_IP_GATEWAY }} + ip helper-address 10.94.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +{%- if variables.CMN != None %} +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{ variables.CMN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CMN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} + vrf attach Customer + description CAN + ip mtu 9198 + ip address {{ variables.CAN_IP_PRIMARY }}/{{ variables.CAN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CAN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +ip dns server-address {{ variables.NMNLB_DNS }} +{% include '1.4/aruba/common/prefix-list.j2' %} +{% include '1.4/aruba/common/route-map.j2' %} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + default-information originate + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + redistribute bgp + area 0.0.0.0 +{% include '1.4/aruba/common/bgp.primary.j2' %} +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-spine.primary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.secondary.j2 b/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.secondary.j2 new file mode 100644 index 000000000..d9f339d55 --- /dev/null +++ b/network_modeling/configs/templates/1.5/aruba/tds/sw-spine.secondary.j2 @@ -0,0 +1,122 @@ +{#- sw-spine.secondary #} +{%- include '1.4/aruba/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/aruba/common/banner-motd.j2' %} +no ip icmp redirect +vrf Customer +vrf keepalive +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} +ntp enable + + +ssh server vrf Customer +ssh server vrf default +ssh server vrf keepalive +ssh server vrf mgmt +{%- include '1.4/aruba/common/acl.j2' %} + +vlan 1 +vlan {{ variables.NMN_VLAN }} + name NMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.HMN_VLAN }} + name HMN + apply access-list ip nmn-hmn in + apply access-list ip nmn-hmn out +vlan {{ variables.CMN_VLAN }} + name CMN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} + name CAN + apply access-list ip cmn-can in + apply access-list ip cmn-can out +{%- endif %} +vlan 10 + name SUN +spanning-tree +{#- forward delay added to help with pxe boots. CASMNET-1099 + CASMTRIAGE-2793 #} +spanning-tree forward-delay 4 +spanning-tree priority 0 +spanning-tree config-name MST0 +spanning-tree config-revision 1 +interface mgmt + shutdown + ip dhcp + +{% include '1.4/aruba/common/ncn-m.lag.j2' %} +{% include '1.4/aruba/common/ncn-w.lag.j2' %} +{% include '1.4/aruba/common/ncn-s.lag.j2' %} +{% include '1.4/aruba/common/uan.j2' %} +{% include '1.4/aruba/tds/spine-to-leaf-bmc.lag.j2' %} +{% include '1.4/aruba/common/spine-to-cdu.lag.j2' %} +{% include '1.4/aruba/common/vsx_isl.secondary.j2' %} + +interface loopback 0 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 +interface vlan 1 + ip mtu 9198 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.MTL_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +interface vlan {{ variables.NMN_VLAN }} + description NMN + ip mtu 9198 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.NMN_IP_GATEWAY }} + ip helper-address 10.92.100.222 + ip ospf 1 area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} + description HMN + ip mtu 9198 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.HMN_IP_GATEWAY }} + ip helper-address 10.94.100.222 + ip ospf 1 area 0.0.0.0 + ip ospf passive +{%- if variables.CMN != None %} +interface vlan {{ variables.CMN_VLAN }} + vrf attach Customer + description CMN + ip mtu 9198 + ip address {{ variables.CMN_IP }}/{{ variables.CMN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CMN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} + vrf attach Customer + description CAN + ip mtu 9198 + ip address {{ variables.CAN_IP_SECONDARY }}/{{ variables.CAN_PREFIX_LEN }} + active-gateway ip mac 12:00:00:00:6b:00 + active-gateway ip {{ variables.CAN_IP_GATEWAY }} + ip ospf 2 area 0.0.0.0 +{%- endif %} +ip dns server-address {{ variables.NMNLB_DNS }} +{% include '1.4/aruba/common/prefix-list.j2' %} +{% include '1.4/aruba/common/route-map.j2' %} +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + default-information originate + area 0.0.0.0 +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + redistribute bgp + area 0.0.0.0 +{% include '1.4/aruba/common/bgp.secondary.j2' %} +https-server vrf Customer +https-server vrf default +https-server vrf mgmt +{# end sw-spine.secondary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/acl-dell.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/acl-dell.j2 new file mode 100644 index 000000000..90cef4541 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/acl-dell.j2 @@ -0,0 +1,45 @@ +{#- acl #} +ip access-list nmn-hmn +{%- if variables.NMN and variables.HMN %} + seq {% set sequence = 10 %}{{ sequence }} deny ip {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_PREFIX_LEN }} {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_PREFIX_LEN }} +{%- endif %} +{%- if variables.HMN and variables.NMN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_PREFIX_LEN }} {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_PREFIX_LEN }} +{%- endif %} +{%- if variables.NMN and variables.HMN_MTN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_PREFIX_LEN }} {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_PREFIX_LEN }} +{%- endif %} +{%- if variables.HMN and variables.NMN_MTN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_PREFIX_LEN }} {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_PREFIX_LEN }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_PREFIX_LEN }} {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_PREFIX_LEN }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN_MTN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_PREFIX_LEN }} {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_PREFIX_LEN }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_PREFIX_LEN }} {{ variables.NMN_NETWORK_IP }}/{{ variables.NMN_PREFIX_LEN }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN_MTN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_MTN_NETWORK_IP }}/{{ variables.HMN_MTN_PREFIX_LEN }} {{ variables.NMN_MTN_NETWORK_IP }}/{{ variables.NMN_MTN_PREFIX_LEN }} +{%- endif %} + seq {% set sequence = sequence+10 %}{{ sequence }} permit ip any any +ip access-list cmn-can +{%- if variables.CMN and variables.CAN %} + seq {% set sequence = 10 %}{{ sequence }} deny ip {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_PREFIX_LEN }} {{ variables.CAN_NETWORK_IP }}/{{ variables.CAN_PREFIX_LEN }} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CAN_NETWORK_IP }}/{{ variables.CAN_PREFIX_LEN }} {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_PREFIX_LEN }} + seq {% set sequence = sequence+10 %}{{ sequence }} permit ip any any +{%- endif %} +{%- if not variables.CAN %} +{% set sequence = 0 %} +{%- endif %} +{%- if variables.CMN and variables.CHN %} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_PREFIX_LEN }} {{ variables.CHN_NETWORK_IP }}/{{ variables.CHN_PREFIX_LEN }} + seq {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CHN_NETWORK_IP }}/{{ variables.CHN_PREFIX_LEN }} {{ variables.CMN_NETWORK_IP }}/{{ variables.CMN_PREFIX_LEN }} + seq {% set sequence = sequence+10 %}{{ sequence }} permit ip any any +{%- endif %} +ip access-list ssh + seq 10 permit ip {{ variables.HMN_NETWORK_IP }}/{{ variables.HMN_PREFIX_LEN }} any + seq 20 deny ip any any +{#- end acl #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/acl-mellanox.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/acl-mellanox.j2 new file mode 100644 index 000000000..12b0c7ec5 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/acl-mellanox.j2 @@ -0,0 +1,43 @@ +{#- acl #} +ipv4 access-list nmn-hmn +ipv4 access-list nmn-hmn bind-point rif +{%- if variables.NMN and variables.HMN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = 10 %}{{ sequence }} deny ip {{ variables.NMN_NETWORK_IP }} mask {{ variables.NMN_NETMASK }} {{ variables.HMN_NETWORK_IP }} mask {{ variables.HMN_NETMASK }} +{%- endif %} +{%- if variables.HMN and variables.NMN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_NETWORK_IP }} mask {{ variables.HMN_NETMASK }} {{ variables.NMN_NETWORK_IP }} mask {{ variables.NMN_NETMASK }} +{%- endif %} +{%- if variables.NMN and variables.HMN_MTN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_NETWORK_IP }} mask {{ variables.NMN_NETMASK }} {{ variables.HMN_MTN_NETWORK_IP }} mask {{ variables.HMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.HMN and variables.NMN_MTN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_NETWORK_IP }} mask {{ variables.HMN_NETMASK }} {{ variables.NMN_MTN_NETWORK_IP }} mask {{ variables.NMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_MTN_NETWORK_IP }} mask {{ variables.NMN_MTN_NETMASK }} {{ variables.HMN_NETWORK_IP }} mask {{ variables.HMN_NETMASK }} +{%- endif %} +{%- if variables.NMN_MTN and variables.HMN_MTN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.NMN_MTN_NETWORK_IP }} mask {{ variables.NMN_MTN_NETMASK }} {{ variables.HMN_MTN_NETWORK_IP }} mask {{ variables.HMN_MTN_NETMASK }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_MTN_NETWORK_IP }} mask {{ variables.HMN_MTN_NETMASK }} {{ variables.NMN_NETWORK_IP }} mask {{ variables.NMN_NETMASK }} +{%- endif %} +{%- if variables.HMN_MTN and variables.NMN_MTN %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.HMN_MTN_NETWORK_IP }} mask {{ variables.HMN_MTN_NETMASK }} {{ variables.NMN_MTN_NETWORK_IP }} mask {{ variables.NMN_MTN_NETMASK }} +{%- endif %} +ipv4 access-list nmn-hmn seq-number {% set sequence = sequence+10 %}{{ sequence }} permit ip any any +ipv4 access-list cmn-can +ipv4 access-list cmn-can bind-point rif +{%- if variables.CMN and variables.CAN %} +ipv4 access-list cmn-can seq-number {% set sequence = 10 %}{{ sequence }} deny ip {{ variables.CMN_NETWORK_IP }} mask {{ variables.CMN_NETMASK }} {{ variables.CAN_NETWORK_IP }} mask {{ variables.CAN_NETMASK }} +ipv4 access-list cmn-can seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CAN_NETWORK_IP }} mask {{ variables.CAN_NETMASK }} {{ variables.CMN_NETWORK_IP }} mask {{ variables.CMN_NETMASK }} +{%- endif %} +{%- if not variables.CAN %} +{% set sequence = 0 %} +{%- endif %} +{%- if variables.CMN and variables.CHN %} +ipv4 access-list cmn-can seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CMN_NETWORK_IP }} mask {{ variables.CMN_NETMASK }} {{ variables.CHN_NETWORK_IP }} mask {{ variables.CHN_NETMASK }} +ipv4 access-list cmn-can seq-number {% set sequence = sequence+10 %}{{ sequence }} deny ip {{ variables.CHN_NETWORK_IP }} mask {{ variables.CHN_NETMASK }} {{ variables.CMN_NETWORK_IP }} mask {{ variables.CMN_NETMASK }} +{%- endif %} +ipv4 access-list cmn-can seq-number {% set sequence = sequence+10 %}{{ sequence }} permit ip any any +{#- end acl #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd-dell.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd-dell.j2 new file mode 100644 index 000000000..22e638ec3 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd-dell.j2 @@ -0,0 +1,8 @@ +{# blank line below required #} + +banner motd {{ '^C' }} + ############################################################################### + # CSM version: {{ variables.CSM_VERSION }} + # CANU version: {{ variables.CANU_VERSION }} + ############################################################################### +{{ '^C' }} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd.j2 new file mode 100644 index 000000000..b0fe02cc9 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/banner-motd.j2 @@ -0,0 +1,8 @@ +{# blank line below required #} + +banner motd {{ '"' }} +############################################################################### +# CSM version: {{ variables.CSM_VERSION }} +# CANU version: {{ variables.CANU_VERSION }} +############################################################################### +{{ '"' }} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/bgp.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/bgp.j2 new file mode 100644 index 000000000..7848e23c9 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/bgp.j2 @@ -0,0 +1,33 @@ +{#- bgp #} +protocol bgp +router bgp {{ variables.SWITCH_ASN }} vrf Customer +router bgp {{ variables.SWITCH_ASN }} vrf default +router bgp {{ variables.SWITCH_ASN }} vrf Customer router-id {{ variables.LOOPBACK_IP }} force +router bgp {{ variables.SWITCH_ASN }} vrf default router-id {{ variables.LOOPBACK_IP }} force +router bgp {{ variables.SWITCH_ASN }} vrf Customer distance 20 70 20 +router bgp {{ variables.SWITCH_ASN }} vrf default distance 20 70 20 +router bgp {{ variables.SWITCH_ASN }} vrf Customer maximum-paths ibgp 32 +router bgp {{ variables.SWITCH_ASN }} vrf Customer maximum-paths 32 +router bgp {{ variables.SWITCH_ASN }} vrf default maximum-paths ibgp 32 +router bgp {{ variables.SWITCH_ASN }} vrf default maximum-paths 32 +{%- for cmn_name, cmn_ip in variables.CMN_IPs.items() if "ncn-w" in cmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf Customer neighbor {{ cmn_ip }} remote-as {{ variables.CMN_ASN }} +{%- endfor %} +{%- for nmn_name, nmn_ip in variables.NMN_IPs.items() if "ncn-w" in nmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf default neighbor {{ nmn_ip }} remote-as {{ variables.NMN_ASN }} +router bgp {{ variables.SWITCH_ASN }} vrf default neighbor {{ nmn_ip }} route-map {{ nmn_name }} +{%- endfor %} +{%- for cmn_name, cmn_ip in variables.CMN_IPs.items() if "ncn-w" in cmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf Customer neighbor {{ cmn_ip }} timers 1 3 +{%- endfor %} +{%- for nmn_name, nmn_ip in variables.NMN_IPs.items() if "ncn-w" in nmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf default neighbor {{ nmn_ip }} timers 1 3 +{%- endfor %} +{%- for cmn_name, cmn_ip in variables.CMN_IPs.items() if "ncn-w" in cmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf Customer neighbor {{ cmn_ip }} transport connection-mode passive +router bgp {{ variables.SWITCH_ASN }} vrf Customer neighbor {{ cmn_ip }} route-map {{ cmn_name }}-Customer +{%- endfor %} +{%- for nmn_name, nmn_ip in variables.NMN_IPs.items() if "ncn-w" in nmn_name %} +router bgp {{ variables.SWITCH_ASN }} vrf default neighbor {{ nmn_ip }} transport connection-mode passive +{%- endfor %} +{#- end bgp #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/bmc.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/bmc.j2 new file mode 100644 index 000000000..eb8759033 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/bmc.j2 @@ -0,0 +1,16 @@ +{#- bmc #} +{%- for node in cabling.nodes if node.slot == "bmc" or node.subtype == "sw-hsn" or node.subtype == "pdu" %} +interface ethernet1/1/{{node.config.PORT}} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport access vlan {{ variables.HMN_VLAN }} + mtu 9216 + flowcontrol receive off + flowcontrol transmit off + spanning-tree bpduguard enable + spanning-tree port type edge + +{%- endfor %} +{#- end bmc #} + + diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/cdu-to-spine.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/cdu-to-spine.lag.j2 new file mode 100644 index 000000000..e66d70c64 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/cdu-to-spine.lag.j2 @@ -0,0 +1,30 @@ +{#- cdu-to-spine.lag #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "spine" %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} + +interface port-channel{{ node.config.LAG_NUMBER }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport mode trunk + switchport access vlan {{ variables.NATIVE_VLAN }} + switchport trunk allowed vlan {{ variables.NMN_VLAN }},{{ variables.HMN_VLAN }},{{ variables.CMN_VLAN }} + mtu 9216 + vlt-port-channel {{ node.config.LAG_NUMBER }} + ! +{%- endif %} +{%- endfor %} + +{%- for node in cabling.nodes if node.subtype == "spine"%} +interface ethernet1/1/{{ node.config.PORT }} + no shutdown + channel-group {{ node.config.LAG_NUMBER }} mode active + no switchport + speed 40000 + mtu 9216 + flowcontrol receive off + flowcontrol transmit off +! +{%- endfor %} +{#- end cdu-to-spine.lag #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/cec.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/cec.j2 new file mode 100644 index 000000000..162bafc6b --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/cec.j2 @@ -0,0 +1,14 @@ +{#- cec #} +{%- for node in cabling.nodes if node.subtype == "cec" %} +interface ethernet1/1/{{ node.config.INTERFACE_NUMBER }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport access vlan {{ node.config.NATIVE_VLAN }} + mtu 9216 + flowcontrol receive off + flowcontrol transmit off + spanning-tree bpduguard enable + spanning-tree port type edge + +{%- endfor %} +{#- end cec #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/cmm.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/cmm.j2 new file mode 100644 index 000000000..e1bc0429f --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/cmm.j2 @@ -0,0 +1,24 @@ +{#- cmm #} +{%- for node in cabling.nodes if node.subtype == "cmm" %} + +interface port-channel{{ node.config.LAG_NUMBER }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport mode trunk + switchport access vlan {{ node.config.NATIVE_VLAN }} + switchport trunk allowed vlan {{ node.config.TAGGED_VLAN }} + mtu 9216 + vlt-port-channel {{ node.config.LAG_NUMBER }} + spanning-tree guard root + +interface ethernet1/1/{{ node.config.PORT }} + description {{ node.config.DESCRIPTION }} + no shutdown + channel-group {{ node.config.LAG_NUMBER }} + no switchport + mtu 9216 + flowcontrol receive on + flowcontrol transmit on + +{%- endfor %} +{#- end cmm #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/compute.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/compute.j2 new file mode 100644 index 000000000..88b903e12 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/compute.j2 @@ -0,0 +1,16 @@ +{#- compute #} +{%- for node in cabling.nodes if node.subtype == "compute" and node.slot == "onboard" %} +interface ethernet1/1/{{ node.config.PORT }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport access vlan {{ variables.NMN_VLAN }} + mtu 9216 + flowcontrol receive off + flowcontrol transmit off + spanning-tree bpduguard enable + spanning-tree port type edge + +{%- endfor %} +{#- end compute #} + + diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/dell-unused.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/dell-unused.j2 new file mode 100644 index 000000000..6a914f077 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/dell-unused.j2 @@ -0,0 +1,10 @@ +{#- unused #} +{%- for port in variables.UNUSED_PORTS %} +interface ethernet1/1/{{ port }} + shutdown + switchport access vlan 1 + flowcontrol receive on + flowcontrol transmit off + +{%- endfor %} +{#- end unused #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/load-balancing.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/load-balancing.j2 new file mode 100644 index 000000000..c0c5ba25c --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/load-balancing.j2 @@ -0,0 +1,9 @@ +{#- load-balancing #} +load-balancing ingress-port enable +no load-balancing mac-selection destination-mac +no load-balancing mac-selection ethertype +no load-balancing mac-selection source-mac +no load-balancing mac-selection vlan-id +no load-balancing tcp-udp-selection l4-destination-port +no load-balancing tcp-udp-selection l4-source-port +{#- end load-balancing #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/magp.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/magp.j2 new file mode 100644 index 000000000..c5c4243b0 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/magp.j2 @@ -0,0 +1,20 @@ +{#- magp #} +protocol magp +interface vlan {{ variables.NATIVE_VLAN }} magp 1 +interface vlan {{ variables.NMN_VLAN }} magp 2 +interface vlan {{ variables.HMN_VLAN }} magp 3 +interface vlan {{ variables.CMN_VLAN }} magp 4 +interface vlan {{ variables.NATIVE_VLAN }} magp 1 ip virtual-router address {{ variables.MTL_IP_GATEWAY }} +interface vlan {{ variables.NMN_VLAN }} magp 2 ip virtual-router address {{ variables.NMN_IP_GATEWAY }} +interface vlan {{ variables.HMN_VLAN }} magp 3 ip virtual-router address {{ variables.HMN_IP_GATEWAY }} +interface vlan {{ variables.CMN_VLAN }} magp 4 ip virtual-router address {{ variables.CMN_IP_GATEWAY }} +interface vlan {{ variables.NATIVE_VLAN }} magp 1 ip virtual-router mac-address 00:00:5E:00:01:01 +interface vlan {{ variables.NMN_VLAN }} magp 2 ip virtual-router mac-address 00:00:5E:00:01:02 +interface vlan {{ variables.HMN_VLAN }} magp 3 ip virtual-router mac-address 00:00:5E:00:01:03 +interface vlan {{ variables.CMN_VLAN }} magp 4 ip virtual-router mac-address 00:00:5E:00:01:04 +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} magp 5 +interface vlan {{ variables.CAN_VLAN }} magp 5 ip virtual-router address {{ variables.CAN_IP_GATEWAY }} +interface vlan {{ variables.CAN_VLAN }} magp 5 ip virtual-router mac-address 00:00:5E:00:01:05 +{%- endif %} +{#- end magp #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/mellanox-unused.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/mellanox-unused.j2 new file mode 100644 index 000000000..e01c8064b --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/mellanox-unused.j2 @@ -0,0 +1,5 @@ +{#- unused #} +{%- for port in variables.UNUSED_PORTS %} +interface ethernet 1/{{ port }} shutdown +{%- endfor %} +{#- end unused #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/mlag_isl.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/mlag_isl.j2 new file mode 100644 index 000000000..d70345dd5 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/mlag_isl.j2 @@ -0,0 +1,20 @@ +{#- mlag_isl #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype in variables.HOSTNAME and node.config.LAG_NUMBER %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} + +interface port-channel {{ node.config.LAG_NUMBER }} +interface ethernet 1/{{ variables.VSX_ISL_PORT1 }} speed 40G force +interface ethernet 1/{{ variables.VSX_ISL_PORT2 }} speed 40G force +interface ethernet 1/{{ variables.VSX_ISL_PORT1 }} channel-group {{ node.config.LAG_NUMBER }} mode active +interface ethernet 1/{{ variables.VSX_ISL_PORT2 }} channel-group {{ node.config.LAG_NUMBER }} mode active +interface ethernet 1/{{ variables.VSX_ISL_PORT1 }} description "mlag-isl" +interface ethernet 1/{{ variables.VSX_ISL_PORT2 }} description "mlag-isl" +interface port-channel {{ node.config.LAG_NUMBER }} description "mlag-isl" +interface port-channel {{ node.config.LAG_NUMBER }} ipl 1 +interface port-channel {{ node.config.LAG_NUMBER }} dcb priority-flow-control mode on force + +{%- endif %} +{%- endfor %} +{#- end mlag_isl #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_hmn_vlan.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_hmn_vlan.j2 new file mode 100644 index 000000000..336088fcc --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_hmn_vlan.j2 @@ -0,0 +1,23 @@ +{#- mtn_hmn_vlan #} +{%- for cabinet in variables.HMN_MTN_VLANS %} +interface vlan{{ cabinet.VlanID }} + mode L3 + description {{ cabinet.Name }} + no shutdown + mtu 9216 + ip address {{ cabinet.IP }}/{{ cabinet.PREFIX_LENGTH }} + ip ospf 1 area 0.0.0.0 + ip ospf passive + ip helper-address 10.94.100.222 + ! +{% set vrrp_id = cabinet.VlanID|string %} vrrp-group {{ vrrp_id[:1] }}{{ vrrp_id[-1:] }} + virtual-address {{ cabinet.Gateway }} +{%- endfor %} +{%- for node in cabling.nodes if node.subtype == "cdu" %} +{%- if node.primary == false %} + priority 110 +{%- else %} + priority 90 +{%- endif %} +{%- endfor %} +{#- end mtn_hmn_vlan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_nmn_vlan.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_nmn_vlan.j2 new file mode 100644 index 000000000..5a696127d --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/mtn_nmn_vlan.j2 @@ -0,0 +1,23 @@ +{#- mtn_nmn_vlan #} +{%- for cabinet in variables.NMN_MTN_VLANS %} +interface vlan{{ cabinet.VlanID }} + mode L3 + description {{ cabinet.Name }} + no shutdown + mtu 9216 + ip address {{ cabinet.IP }}/{{ cabinet.PREFIX_LENGTH }} + ip ospf 1 area 0.0.0.0 + ip ospf passive + ip helper-address 10.92.100.222 + ! +{% set vrrp_id = cabinet.VlanID|string %} vrrp-group {{ vrrp_id[:1] }}{{ vrrp_id[-1:] }} + virtual-address {{ cabinet.Gateway }} +{%- endfor %} +{%- for node in cabling.nodes if node.subtype == "cdu" %} +{%- if node.primary == false %} + priority 110 +{%- else %} + priority 90 +{%- endif %} +{%- endfor %} +{#- end mtn_nmn_vlan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-m.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-m.lag.j2 new file mode 100644 index 000000000..a500e85f6 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-m.lag.j2 @@ -0,0 +1,24 @@ +{#- master #} +{%- for node in cabling.nodes if node.subtype == "master" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport mode hybrid +interface mlag-port-channel {{ node.config.LAG_NUMBER }} description "{{ node.config.DESCRIPTION }}" +interface mlag-port-channel {{ node.config.LAG_NUMBER }} no shutdown +{%- if variables.HOSTNAME == "sw-spine-001" %} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} lacp-individual enable force +{%- endif %} + + +interface ethernet 1/{{ node.config.PORT }} speed 40G force +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.NMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.HMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CMN_VLAN }} +{%- if variables.CAN != None %} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CAN_VLAN }} +{%- endif %} +{%- endfor %} +{#- end master #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-s.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-s.lag.j2 new file mode 100644 index 000000000..2a82bc6cb --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-s.lag.j2 @@ -0,0 +1,23 @@ +{#- storage #} +{%- for node in cabling.nodes if node.subtype == "storage" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport mode hybrid +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} description "{{ node.config.DESCRIPTION }}" +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} no shutdown +{%- if variables.HOSTNAME == "sw-spine-001" %} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} lacp-individual enable force +{%- endif %} + +interface ethernet 1/{{ node.config.PORT }} speed 40G force +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER_V1 }} mode active +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" + +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport hybrid allowed-vlan add {{ variables.NMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport hybrid allowed-vlan add {{ variables.HMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport hybrid allowed-vlan add {{ variables.CMN_VLAN }} +{%- if variables.CAN != None %} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport hybrid allowed-vlan add {{ variables.CAN_VLAN }} +{%- endif %} +{%- endfor %} +{#- end storage #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-w.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-w.lag.j2 new file mode 100644 index 000000000..c96ebef71 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/ncn-w.lag.j2 @@ -0,0 +1,23 @@ +{#- worker #} +{%- for node in cabling.nodes if node.subtype == "worker" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport mode hybrid +interface mlag-port-channel {{ node.config.LAG_NUMBER }} description "{{ node.config.DESCRIPTION }}" +interface mlag-port-channel {{ node.config.LAG_NUMBER }} no shutdown +{%- if variables.HOSTNAME == "sw-spine-001" %} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} lacp-individual enable force +{%- endif %} + +interface ethernet 1/{{ node.config.PORT }} speed 40G force +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.NMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.HMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CMN_VLAN }} +{%- if variables.CAN != None %} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CAN_VLAN }} +{%- endif %} +{%- endfor %} +{#- end worker #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/prefix.list.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/prefix.list.j2 new file mode 100644 index 000000000..ae7e03078 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/prefix.list.j2 @@ -0,0 +1,21 @@ +{#- bgp #} +{% set sequence = 10 %} +ip prefix-list pl-cmn +ip prefix-list pl-cmn bulk-mode +ip prefix-list pl-cmn seq {{ sequence }} permit {{ variables.CMN_NETWORK_IP }} /{{ variables.CMN_PREFIX_LEN }} ge {{ variables.CMN_PREFIX_LEN }} +ip prefix-list pl-cmn commit +{%- if variables.CAN %} +ip prefix-list pl-can +ip prefix-list pl-can bulk-mode +ip prefix-list pl-can seq {{ sequence }} permit {{ variables.CAN_NETWORK_IP }} /{{ variables.CAN_PREFIX_LEN }} ge {{ variables.CAN_PREFIX_LEN }} +ip prefix-list pl-can commit +{%- endif %} +ip prefix-list pl-hmn +ip prefix-list pl-hmn bulk-mode +ip prefix-list pl-hmn {% set sequence = sequence+10 %}seq {{ sequence }} permit {{ variables.HMNLB_NETWORK_IP }} /{{ variables.HMNLB_PREFIX_LEN }} ge {{ variables.HMNLB_PREFIX_LEN }} +ip prefix-list pl-hmn commit +ip prefix-list pl-nmn +ip prefix-list pl-nmn bulk-mode +ip prefix-list pl-nmn {% set sequence = sequence+10 %}seq {{ sequence }} permit {{ variables.NMNLB_NETWORK_IP }} /{{ variables.HMNLB_PREFIX_LEN }} ge {{ variables.HMNLB_PREFIX_LEN }} +ip prefix-list pl-nmn commit +{#- end bgp #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/route-map.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/route-map.j2 new file mode 100644 index 000000000..dc14a9936 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/route-map.j2 @@ -0,0 +1,26 @@ +{#- route-map #} +{%- for name, ip in variables.NMN_IPs.items() if "ncn-w" in name %} + +{% set sequence = namespace(value=10) %} +route-map {{ name }}-Customer permit {{ sequence.value }} match ip address pl-cmn + +{%- if variables.CAN %} +{% set sequence.value = sequence.value + 10 %} +route-map {{ name }}-Customer permit {{ sequence.value }} match ip address pl-can + {%- for can_name, can_ip in variables.CAN_IPs.items() if name == can_name %} +route-map {{ name }}-Customer permit {{ sequence.value }} set ip next-hop {{ can_ip }} + {%- endfor %} +{%- endif %} + +{% set sequence = namespace(value=10) %} +route-map {{ name }} permit {{ sequence.value }} match ip address pl-hmn + {%- for hmn_name, hmn_ip in variables.HMN_IPs.items() if name == hmn_name %} +route-map {{ name }} permit {{ sequence.value }} set ip next-hop {{ hmn_ip }} + {%- endfor %} +{% set sequence.value = sequence.value + 10 %}route-map {{ name }} permit {{ sequence.value }} match ip address pl-nmn + {%- for nmn_name, nmn_ip in variables.NMN_IPs.items() if name == nmn_name %} +route-map {{ name }} permit {{ sequence.value }} set ip next-hop {{ nmn_ip }} + {%- endfor %} + +{%- endfor %} +{#- end route-map #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/spine-to-cdu.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/spine-to-cdu.lag.j2 new file mode 100644 index 000000000..175a2ae2b --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/spine-to-cdu.lag.j2 @@ -0,0 +1,21 @@ +{#- spine-to-cdu.lag #} +{%- for node in cabling.nodes if node.subtype == "cdu" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport mode hybrid +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.NMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.HMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CMN_VLAN }} + +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active + +interface ethernet 1/{{ node.config.PORT }} speed 40G force +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active +interface mlag-port-channel {{ node.config.LAG_NUMBER }} description "{{ node.config.DESCRIPTION }}" +interface mlag-port-channel {{ node.config.LAG_NUMBER }} no shutdown +interface mlag-port-channel {{ node.config.LAG_NUMBER }} spanning-tree port type network +interface mlag-port-channel {{ node.config.LAG_NUMBER }} spanning-tree guard root + +{%- endfor %} +{#- end spine-to-cdu.lag #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.primary.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.primary.j2 new file mode 100644 index 000000000..63249107e --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.primary.j2 @@ -0,0 +1,112 @@ +{#- sw-cdu.primary #} +{%- include '1.4/dellmellanox/common/unknown.j2' %} +ip vrf default +ip vrf Customer +ip name-server {{ variables.NMNLB_DNS }} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/dellmellanox/common/banner-motd-dell.j2' %} +rest api restconf +spanning-tree mode mst + +{%- include '1.4/dellmellanox/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/dellmellanox/common/mtn_nmn_vlan.j2' %} + +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} + +{%- include '1.4/dellmellanox/common/acl-dell.j2' %} +{%- include '1.4/dellmellanox/common/load-balancing.j2' %} + +interface vlan{{ variables.NATIVE_VLAN }} + description MTL + no shutdown + mtu 9216 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.NMN_VLAN }} + description RIVER_NMN + no shutdown + mtu 9216 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + +interface vlan{{ variables.HMN_VLAN }} + description RIVER_HMN + no shutdown + mtu 9216 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.CMN_VLAN }} + description CMN + no shutdown + ip vrf forwarding Customer + mtu 9216 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip access-group cmn-can in + ip access-group cmn-can out + ip ospf 2 area 0.0.0.0 + +{%- include '1.4/dellmellanox/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/dellmellanox/common/mtn_nmn_vlan.j2' %} + +interface loopback0 + no shutdown + mtu 9216 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 + +spanning-tree mst configuration + name cray + revision 2 + +line vty + ip access-class ssh + +{% include '1.4/dellmellanox/common/cmm.j2' %} + +{% include '1.4/dellmellanox/common/cec.j2' %} + +{% include '1.4/dellmellanox/common/cdu-to-spine.lag.j2' %} + +{% include '1.4/dellmellanox/common/dell-unused.j2' %} + +interface mgmt1/1/1 + no shutdown + no ip address dhcp + ip address 192.168.255.242/29 + ipv6 address autoconfig + +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + +interface ethernet1/1/{{ variables.VSX_ISL_PORT1 }} + no shutdown + no switchport + flowcontrol receive off + flowcontrol transmit off +! +interface ethernet1/1/{{ variables.VSX_ISL_PORT2 }} + no shutdown + no switchport + flowcontrol receive off + flowcontrol transmit off + +vlt-domain 1 + backup destination 192.168.255.243 + discovery-interface ethernet1/1/{{ variables.VSX_ISL_PORT1 }}-1/1/{{ variables.VSX_ISL_PORT2 }} + peer-routing + primary-priority 4096 + vlt-mac 00:11:22:aa:bb:cc +{# end sw-cdu.primary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.secondary.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.secondary.j2 new file mode 100644 index 000000000..71555d6f4 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/sw-cdu.secondary.j2 @@ -0,0 +1,112 @@ +{#- sw-cdu.secondary #} +{%- include '1.4/dellmellanox/common/unknown.j2' %} +ip vrf default +ip vrf Customer +ip name-server {{ variables.NMNLB_DNS }} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/dellmellanox/common/banner-motd-dell.j2' %} +rest api restconf +spanning-tree mode mst + +{%- include '1.4/dellmellanox/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/dellmellanox/common/mtn_nmn_vlan.j2' %} + +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} + +{%- include '1.4/dellmellanox/common/acl-dell.j2' %} +{%- include '1.4/dellmellanox/common/load-balancing.j2' %} + +interface vlan{{ variables.NATIVE_VLAN }} + description MTL + no shutdown + mtu 9216 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.NMN_VLAN }} + description RIVER_NMN + no shutdown + mtu 9216 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + +interface vlan{{ variables.HMN_VLAN }} + description RIVER_HMN + no shutdown + mtu 9216 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.CMN_VLAN }} + description CMN + no shutdown + ip vrf forwarding Customer + mtu 9216 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip access-group cmn-can in + ip access-group cmn-can out + ip ospf 2 area 0.0.0.0 + +{%- include '1.4/dellmellanox/common/mtn_hmn_vlan.j2' %} +{%- include '1.4/dellmellanox/common/mtn_nmn_vlan.j2' %} + +interface loopback0 + no shutdown + mtu 9216 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 + +spanning-tree mst configuration + name cray + revision 2 + +line vty + ip access-class ssh + +{% include '1.4/dellmellanox/common/cmm.j2' %} + +{% include '1.4/dellmellanox/common/cec.j2' %} + +{% include '1.4/dellmellanox/common/cdu-to-spine.lag.j2' %} + +{% include '1.4/dellmellanox/common/dell-unused.j2' %} + +interface mgmt1/1/1 + no shutdown + no ip address dhcp + ip address 192.168.255.243/29 + ipv6 address autoconfig + +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + +interface ethernet1/1/{{ variables.VSX_ISL_PORT1 }} + no shutdown + no switchport + flowcontrol receive off + flowcontrol transmit off +! +interface ethernet1/1/{{ variables.VSX_ISL_PORT2 }} + no shutdown + no switchport + flowcontrol receive off + flowcontrol transmit off + +vlt-domain 1 + backup destination 192.168.255.242 + discovery-interface ethernet1/1/{{ variables.VSX_ISL_PORT1 }}-1/1/{{ variables.VSX_ISL_PORT2 }} + peer-routing + primary-priority 8192 + vlt-mac 00:11:22:aa:bb:cc +{# end sw-cdu.secondary #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/uan-nmn.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/uan-nmn.j2 new file mode 100644 index 000000000..356974d96 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/uan-nmn.j2 @@ -0,0 +1,16 @@ +{#- uan-nmn #} +{%- for node in cabling.nodes if node.slot == "onboard" %} +interface ethernet1/1/{{ node.config.PORT }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport access vlan {{ variables.NMN_VLAN }} + mtu 9216 + flowcontrol receive off + flowcontrol transmit off + spanning-tree bpduguard enable + spanning-tree port type edge + +{%- endfor %} +{#- end uan-nmn #} + + diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/uan.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/uan.j2 new file mode 100644 index 000000000..8cbd7cec7 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/uan.j2 @@ -0,0 +1,18 @@ +{#- uan #} +{%- for node in cabling.nodes if node.subtype == "uan" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport mode trunk +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} description "{{ node.config.DESCRIPTION }}" +{%- if variables.CAN %} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} no shutdown +{% if not variables.CHN_VLAN %} +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport trunk allowed-vlan none +interface mlag-port-channel {{ node.config.LAG_NUMBER_V1 }} switchport trunk allowed-vlan {{ variables.CAN_VLAN }} +{% endif %} +{%- endif %} +interface ethernet 1/{{ node.config.PORT }} speed 40G force +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER_V1 }} mode active +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" +{%- endfor %} +{#- end-uan #} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/common/unknown.j2 b/network_modeling/configs/templates/1.5/dellmellanox/common/unknown.j2 new file mode 100644 index 000000000..484544f08 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/common/unknown.j2 @@ -0,0 +1,14 @@ +{%- set ns = namespace(displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "unknown" %} +{%- if ns.displayed == false %} +{%- set ns.displayed = true %} +# WARNING: The following devices were discovered in the input data, +# but the CANU model cannot determine the type and generate +# a configuration. Applying this configuration without +# considering these devices will likely result in loss of +# contact with these devices. Ensure valid input, submit +# a bug to CANU and manually add these devices to the configuration. +{%- endif %} +# Unknown destination node not included in config +# {{ node.config.DESCRIPTION }} +{%- endfor %} \ No newline at end of file diff --git a/network_modeling/configs/templates/1.5/dellmellanox/full/leaf-bmc-to-spine.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/full/leaf-bmc-to-spine.lag.j2 new file mode 100644 index 000000000..6bc7f9591 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/full/leaf-bmc-to-spine.lag.j2 @@ -0,0 +1,28 @@ +{#- leaf-bmc-to-spine #} +{%- set ns = namespace(lag_displayed=false) %} +{%- for node in cabling.nodes if node.subtype == "spine" %} +{%- if ns.lag_displayed == false %} +{%- set ns.lag_displayed = true %} +interface port-channel{{ node.config.LAG_NUMBER }} + description {{ node.config.DESCRIPTION }} + no shutdown + switchport mode trunk + switchport access vlan {{ variables.NATIVE_VLAN }} + switchport trunk allowed vlan {{ variables.NMN_VLAN }},{{ variables.HMN_VLAN }},{{ variables.CMN_VLAN }} + mtu 9216 +{%- endif %} +{%- endfor %} + +{%- for node in cabling.nodes if node.subtype == "spine"%} + +interface ethernet1/1/{{ node.config.PORT }} + no shutdown + channel-group {{ node.config.LAG_NUMBER }} mode active + no switchport + mtu 9216 + speed 10000 + flowcontrol receive off + flowcontrol transmit off + +{%- endfor %} +{#- end leaf-bmc-to-spine #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/full/spine-to-leaf-bmc.lag.j2 b/network_modeling/configs/templates/1.5/dellmellanox/full/spine-to-leaf-bmc.lag.j2 new file mode 100644 index 000000000..eedcf6896 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/full/spine-to-leaf-bmc.lag.j2 @@ -0,0 +1,21 @@ +{#- spine-to-leaf-bmc #} +{%- for node in cabling.nodes if node.subtype == "leaf-bmc" %} + +interface mlag-port-channel {{ node.config.LAG_NUMBER }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport mode hybrid +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.CMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.NMN_VLAN }} +interface mlag-port-channel {{ node.config.LAG_NUMBER }} switchport hybrid allowed-vlan add {{ variables.HMN_VLAN }} + +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active + +interface ethernet 1/{{ node.config.PORT }} speed 10G force +interface ethernet 1/{{ node.config.PORT }} description "{{ node.config.DESCRIPTION }}" +interface ethernet 1/{{ node.config.PORT }} mlag-channel-group {{ node.config.LAG_NUMBER }} mode active +interface mlag-port-channel {{ node.config.LAG_NUMBER }} description "{{ node.config.DESCRIPTION }}" +interface mlag-port-channel {{ node.config.LAG_NUMBER }} no shutdown +interface mlag-port-channel {{ node.config.LAG_NUMBER }} spanning-tree port type network +interface mlag-port-channel {{ node.config.LAG_NUMBER }} spanning-tree guard root + +{%- endfor %} +{#- end spine-to-leaf-bmc #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/full/sw-leaf-bmc.j2 b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-leaf-bmc.j2 new file mode 100644 index 000000000..ec698e2f2 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-leaf-bmc.j2 @@ -0,0 +1,84 @@ +{#- sw-leaf-bmc #} +{%- include '1.4/dellmellanox/common/unknown.j2' %} +ip vrf default +ip vrf Customer +ip name-server {{ variables.NMNLB_DNS }} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/dellmellanox/common/banner-motd-dell.j2' %} +rest api restconf +spanning-tree mode mst + +ntp server {{ variables.NCN_W001 }} +ntp server {{ variables.NCN_W002 }} +ntp server {{ variables.NCN_W003 }} + +{%- include '1.4/dellmellanox/common/acl-dell.j2' %} +{%- include '1.4/dellmellanox/common/load-balancing.j2' %} + +interface vlan{{ variables.NATIVE_VLAN }} + description MTL + no shutdown + mtu 9216 + ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.NMN_VLAN }} + description RIVER_NMN + no shutdown + mtu 9216 + ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + +interface vlan{{ variables.HMN_VLAN }} + description RIVER_HMN + no shutdown + mtu 9216 + ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} + ip access-group nmn-hmn in + ip access-group nmn-hmn out + ip ospf 1 area 0.0.0.0 + ip ospf passive + +interface vlan{{ variables.CMN_VLAN }} + description CMN + no shutdown + ip vrf forwarding Customer + mtu 9216 + ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} + ip access-group cmn-can in + ip access-group cmn-can out + ip ospf 2 area 0.0.0.0 + +interface loopback0 + no shutdown + mtu 9216 + ip address {{ variables.LOOPBACK_IP }}/32 + ip ospf 1 area 0.0.0.0 + +interface mgmt1/1/1 + shutdown + ip address dhcp + ipv6 address autoconfig + +spanning-tree mst configuration + name cray + revision 2 + +line vty + ip access-class ssh + +{% include '1.4/dellmellanox/full/leaf-bmc-to-spine.lag.j2' %} +{% include '1.4/dellmellanox/common/bmc.j2' %} +{% include '1.4/dellmellanox/common/uan-nmn.j2' %} +{% include '1.4/dellmellanox/common/compute.j2' %} +{% include '1.4/dellmellanox/common/dell-unused.j2' %} +router ospf 1 + router-id {{ variables.LOOPBACK_IP }} + +router ospf 2 vrf Customer + router-id {{ variables.LOOPBACK_IP }} + +{# end sw-leaf-bmc #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.primary.j2 b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.primary.j2 new file mode 100644 index 000000000..be6e7e864 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.primary.j2 @@ -0,0 +1,148 @@ +{#- dm-sw-spine.primary #} +{%- include '1.4/dellmellanox/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/dellmellanox/common/banner-motd.j2' %} + +no cli default prefix-modes enable + +protocol mlag +protocol bgp + +vlan {{ variables.NMN_VLAN }} +vlan {{ variables.HMN_VLAN }} +vlan {{ variables.CMN_VLAN }} +vlan 4000 +vlan {{ variables.NMN_VLAN }} name "RVR_NMN" +vlan {{ variables.HMN_VLAN }} name "RVR_HMN" +vlan {{ variables.CMN_VLAN }} name "CMN" +vlan 4000 name "MLAG" + +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} +vlan {{ variables.CAN_VLAN }} name "CAN" +interface vlan {{ variables.CAN_VLAN }} vrf forwarding Customer +interface vlan {{ variables.CAN_VLAN }} ip address {{ variables.CAN_IP_PRIMARY }}/{{variables.CAN_PREFIX_LEN}} primary +no interface vlan {{ variables.CAN_VLAN }} ip icmp redirect +interface vlan {{ variables.CAN_VLAN }} mtu 9184 +interface vlan {{ variables.CAN_VLAN }} ipv4 port access-group cmn-can +{%- endif %} + +no ntp server {{ variables.NCN_W001 }} disable +ntp server {{ variables.NCN_W001 }} keyID 0 +no ntp server {{ variables.NCN_W001 }} trusted-enable +ntp server {{ variables.NCN_W001 }} version 4 +no ntp server {{ variables.NCN_W002 }} disable +ntp server {{ variables.NCN_W002 }} keyID 0 +no ntp server {{ variables.NCN_W002 }} trusted-enable +ntp server {{ variables.NCN_W002 }} version 4 +no ntp server {{ variables.NCN_W003 }} disable +ntp server {{ variables.NCN_W003 }} keyID 0 +no ntp server {{ variables.NCN_W003 }} trusted-enable +ntp server {{ variables.NCN_W003 }} version 4 +ntp vrf default enable force +web vrf default enable force + +ip filter chain input rule append tail target drop dup-delete dest-port 22 in-intf vlan{{ variables.NMN_VLAN }} protocol tcp +ip filter enable + +{%- include '1.4/dellmellanox/common/acl-mellanox.j2' %} + +{%- include '1.4/dellmellanox/common/mlag_isl.j2' %} + +lacp + +vrf definition Customer +vrf definition Customer rd 7:7 +ip routing vrf Customer +ip routing vrf default +interface loopback 0 +interface vlan {{ variables.NATIVE_VLAN }} +interface vlan {{ variables.NMN_VLAN }} +interface vlan {{ variables.HMN_VLAN }} +interface vlan {{ variables.CMN_VLAN }} vrf forwarding Customer +interface vlan 10 +interface vlan 4000 +interface loopback 0 ip address {{ variables.LOOPBACK_IP }}/32 primary +interface vlan 1 ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} primary +interface vlan {{ variables.NMN_VLAN }} ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} primary +interface vlan {{ variables.HMN_VLAN }} ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} primary +interface vlan {{ variables.CMN_VLAN }} ip address {{ variables.CMN_IP }}/{{variables.CMN_PREFIX_LEN}} primary +interface vlan 4000 ip address 192.168.255.253/30 primary +no interface vlan {{ variables.NATIVE_VLAN }} ip icmp redirect +interface vlan {{ variables.NATIVE_VLAN }} mtu 9184 +no interface vlan {{ variables.NMN_VLAN }} ip icmp redirect +interface vlan {{ variables.NMN_VLAN }} mtu 9184 +no interface vlan {{ variables.HMN_VLAN }} ip icmp redirect +interface vlan {{ variables.HMN_VLAN }} mtu 9184 +no interface vlan {{ variables.CMN_VLAN }} ip icmp redirect +interface vlan {{ variables.CMN_VLAN }} mtu 9184 +interface vlan {{ variables.NMN_VLAN }} ipv4 port access-group nmn-hmn +interface vlan {{ variables.HMN_VLAN }} ipv4 port access-group nmn-hmn +{%- if variables.CAN != None %} +interface vlan {{ variables.CMN_VLAN }} ipv4 port access-group cmn-can +{%- endif %} +ip load-sharing source-ip-port +ip load-sharing type consistent +port-channel load-balance ethernet source-destination-ip ingress-port +no interface mgmt0 dhcp +interface mgmt0 ip address 192.168.255.241 /29 + +{%- include '1.4/dellmellanox/common/prefix.list.j2' %} +{%- include '1.4/dellmellanox/common/route-map.j2' %} +{%- include '1.4/dellmellanox/common/bgp.j2' %} + +ip name-server vrf vrf-default {{ variables.NMNLB_DNS }} + +spanning-tree mode mst +spanning-tree priority 4096 +spanning-tree port type edge default +spanning-tree mst name cray +spanning-tree mst revision 2 + +{% include '1.4/dellmellanox/common/ncn-m.lag.j2' %} +{% include '1.4/dellmellanox/common/ncn-w.lag.j2' %} +{% include '1.4/dellmellanox/common/ncn-s.lag.j2' %} +{% include '1.4/dellmellanox/common/uan.j2' %} +{% include '1.4/dellmellanox/full/spine-to-leaf-bmc.lag.j2' %} +{% include '1.4/dellmellanox/common/spine-to-cdu.lag.j2' %} + +protocol ospf +router ospf 1 vrf default +router ospf 2 vrf Customer +router ospf 1 vrf default router-id {{ variables.LOOPBACK_IP }} +router ospf 2 vrf Customer router-id {{ variables.LOOPBACK_IP }} +router ospf 2 vrf Customer default-information originate +interface loopback 0 ip ospf area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.NMN_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.CMN_VLAN }} ip ospf area 0.0.0.0 +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} ip ospf area 0.0.0.0 +{%- endif %} +interface vlan {{ variables.NATIVE_VLAN }} ip ospf passive-interface +interface vlan {{ variables.HMN_VLAN }} ip ospf passive-interface +router ospf 1 vrf default redistribute bgp + +ip dhcp relay instance 2 vrf default +ip dhcp relay instance 4 vrf default +ip dhcp relay instance 2 address 10.92.100.222 +ip dhcp relay instance 4 address 10.94.100.222 +interface vlan {{ variables.NATIVE_VLAN }} ip dhcp relay instance 2 downstream +interface vlan {{ variables.NMN_VLAN }} ip dhcp relay instance 2 downstream +interface vlan {{ variables.HMN_VLAN }} ip dhcp relay instance 4 downstream + +{% include '1.4/dellmellanox/common/magp.j2' %} + +mlag-vip mlag-domain ip 192.168.255.242 /29 force +no mlag shutdown +mlag system-mac 00:00:5E:00:01:01 +interface vlan 4000 ipl 1 peer-address 192.168.255.254 + +no ldap vrf mgmt enable +no radius-server vrf mgmt enable +no snmp-server vrf mgmt enable +no tacacs-server vrf mgmt enable +vrf definition mgmt + +{# end dm-sw-spine.primary #} diff --git a/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.secondary.j2 b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.secondary.j2 new file mode 100644 index 000000000..ca3a504f1 --- /dev/null +++ b/network_modeling/configs/templates/1.5/dellmellanox/full/sw-spine.secondary.j2 @@ -0,0 +1,148 @@ +{#- dm-sw-spine.secondary #} +{%- include '1.4/dellmellanox/common/unknown.j2' %} +hostname {{ variables.HOSTNAME }} +{%- include '1.4/dellmellanox/common/banner-motd.j2' %} + +no cli default prefix-modes enable + +protocol mlag +protocol bgp + +vlan {{ variables.NMN_VLAN }} +vlan {{ variables.HMN_VLAN }} +vlan {{ variables.CMN_VLAN }} +vlan 4000 +vlan {{ variables.NMN_VLAN }} name "RVR_NMN" +vlan {{ variables.HMN_VLAN }} name "RVR_HMN" +vlan {{ variables.CMN_VLAN }} name "CMN" +vlan 4000 name "MLAG" + +{%- if variables.CAN != None %} +vlan {{ variables.CAN_VLAN }} +vlan {{ variables.CAN_VLAN }} name "CAN" +interface vlan {{ variables.CAN_VLAN }} vrf forwarding Customer +interface vlan {{ variables.CAN_VLAN }} ip address {{ variables.CAN_IP_SECONDARY }}/{{variables.CAN_PREFIX_LEN}} primary +no interface vlan {{ variables.CAN_VLAN }} ip icmp redirect +interface vlan {{ variables.CAN_VLAN }} mtu 9184 +interface vlan {{ variables.CAN_VLAN }} ipv4 port access-group cmn-can +{%- endif %} + +no ntp server {{ variables.NCN_W001 }} disable +ntp server {{ variables.NCN_W001 }} keyID 0 +no ntp server {{ variables.NCN_W001 }} trusted-enable +ntp server {{ variables.NCN_W001 }} version 4 +no ntp server {{ variables.NCN_W002 }} disable +ntp server {{ variables.NCN_W002 }} keyID 0 +no ntp server {{ variables.NCN_W002 }} trusted-enable +ntp server {{ variables.NCN_W002 }} version 4 +no ntp server {{ variables.NCN_W003 }} disable +ntp server {{ variables.NCN_W003 }} keyID 0 +no ntp server {{ variables.NCN_W003 }} trusted-enable +ntp server {{ variables.NCN_W003 }} version 4 +ntp vrf default enable force +web vrf default enable force + +ip filter chain input rule append tail target drop dup-delete dest-port 22 in-intf vlan{{ variables.NMN_VLAN }} protocol tcp +ip filter enable + +{%- include '1.4/dellmellanox/common/acl-mellanox.j2' %} + +{%- include '1.0/dellmellanox/common/mlag_isl.j2' %} + +lacp + +vrf definition Customer +vrf definition Customer rd 7:7 +ip routing vrf Customer +ip routing vrf default +interface loopback 0 +interface vlan {{ variables.NATIVE_VLAN }} +interface vlan {{ variables.NMN_VLAN }} +interface vlan {{ variables.HMN_VLAN }} +interface vlan {{ variables.CMN_VLAN }} vrf forwarding Customer +interface vlan 10 +interface vlan 4000 +interface loopback 0 ip address {{ variables.LOOPBACK_IP }}/32 primary +interface vlan {{ variables.NATIVE_VLAN }} ip address {{ variables.MTL_IP }}/{{variables.MTL_PREFIX_LEN}} primary +interface vlan {{ variables.NMN_VLAN }} ip address {{ variables.NMN_IP }}/{{variables.NMN_PREFIX_LEN}} primary +interface vlan {{ variables.HMN_VLAN }} ip address {{ variables.HMN_IP }}/{{variables.HMN_PREFIX_LEN}} primary +interface vlan {{ variables.CMN_VLAN }} ip address {{ variables.CMN_IP }}/{{ variables.CMN_PREFIX_LEN }} primary +interface vlan 4000 ip address 192.168.255.254/30 primary +no interface vlan {{ variables.NATIVE_VLAN }} ip icmp redirect +interface vlan {{ variables.NATIVE_VLAN }} mtu 9184 +no interface vlan {{ variables.NMN_VLAN }} ip icmp redirect +interface vlan {{ variables.NMN_VLAN }} mtu 9184 +no interface vlan {{ variables.HMN_VLAN }} ip icmp redirect +interface vlan {{ variables.HMN_VLAN }} mtu 9184 +no interface vlan {{ variables.CMN_VLAN }} ip icmp redirect +interface vlan {{ variables.CMN_VLAN }} mtu 9184 +interface vlan {{ variables.NMN_VLAN }} ipv4 port access-group nmn-hmn +interface vlan {{ variables.HMN_VLAN }} ipv4 port access-group nmn-hmn +{%- if variables.CAN != None %} +interface vlan {{ variables.CMN_VLAN }} ipv4 port access-group cmn-can +{%- endif %} +ip load-sharing source-ip-port +ip load-sharing type consistent +port-channel load-balance ethernet source-destination-ip ingress-port +no interface mgmt0 dhcp +interface mgmt0 ip address 192.168.255.243 /29 + +{%- include '1.4/dellmellanox/common/prefix.list.j2' %} +{%- include '1.4/dellmellanox/common/route-map.j2' %} +{%- include '1.4/dellmellanox/common/bgp.j2' %} + +ip name-server vrf vrf-default {{ variables.NMNLB_DNS }} + +spanning-tree mode mst +spanning-tree priority 4096 +spanning-tree port type edge default +spanning-tree mst name cray +spanning-tree mst revision 2 + +{% include '1.4/dellmellanox/common/ncn-m.lag.j2' %} +{% include '1.4/dellmellanox/common/ncn-w.lag.j2' %} +{% include '1.4/dellmellanox/common/ncn-s.lag.j2' %} +{% include '1.4/dellmellanox/common/uan.j2' %} +{% include '1.4/dellmellanox/full/spine-to-leaf-bmc.lag.j2' %} +{% include '1.4/dellmellanox/common/spine-to-cdu.lag.j2' %} + +protocol ospf +router ospf 1 vrf default +router ospf 2 vrf Customer +router ospf 1 vrf default router-id {{ variables.LOOPBACK_IP }} +router ospf 2 vrf Customer router-id {{ variables.LOOPBACK_IP }} +router ospf 2 vrf Customer default-information originate +interface loopback 0 ip ospf area 0.0.0.0 +interface vlan {{ variables.NATIVE_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.NMN_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.HMN_VLAN }} ip ospf area 0.0.0.0 +interface vlan {{ variables.CMN_VLAN }} ip ospf area 0.0.0.0 +{%- if variables.CAN != None %} +interface vlan {{ variables.CAN_VLAN }} ip ospf area 0.0.0.0 +{%- endif %} +interface vlan {{ variables.NATIVE_VLAN }} ip ospf passive-interface +interface vlan {{ variables.HMN_VLAN }} ip ospf passive-interface +router ospf 1 vrf default redistribute bgp + +ip dhcp relay instance 2 vrf default +ip dhcp relay instance 4 vrf default +ip dhcp relay instance 2 address 10.92.100.222 +ip dhcp relay instance 4 address 10.94.100.222 +interface vlan {{ variables.NATIVE_VLAN }} ip dhcp relay instance 2 downstream +interface vlan {{ variables.NMN_VLAN }} ip dhcp relay instance 2 downstream +interface vlan {{ variables.HMN_VLAN }} ip dhcp relay instance 4 downstream + +{% include '1.4/dellmellanox/common/magp.j2' %} + +mlag-vip mlag-domain ip 192.168.255.242 /29 force +no mlag shutdown +mlag system-mac 00:00:5E:00:01:01 +interface vlan 4000 ipl 1 peer-address 192.168.255.253 + +no ldap vrf mgmt enable +no radius-server vrf mgmt enable +no snmp-server vrf mgmt enable +no tacacs-server vrf mgmt enable +vrf definition mgmt + +{# end dm-sw-spine.secondary #} diff --git a/pyinstaller.py b/pyinstaller.py index ba96313e7..47b544ed9 100644 --- a/pyinstaller.py +++ b/pyinstaller.py @@ -137,13 +137,18 @@ "network_modeling/configs/templates/1.4/dellmellanox/full/*.j2", "network_modeling/configs/templates/1.4/dellmellanox/full", ), - ("canu/test/aruba/test_suite.yaml", "canu/test/aruba"), - ("canu/test/dellanox/test_suite.yaml", "canu/test/dellanox"), ( - "canu/generate/switch/config/ttp_templates/*.txt", - "canu/generate/switch/config/ttp_templates", + "network_modeling/configs/templates/1.5/aruba/*.j2", + "network_modeling/configs/templates/1.5/aruba/", + ), + ( + "network_modeling/configs/templates/1.5/aruba/full/*.j2", + "network_modeling/configs/templates/1.5/aruba/full", + ), + ( + "network_modeling/configs/templates/1.5/aruba/tds/*.j2", + "network_modeling/configs/templates/1.5/aruba/tds", ), - ("canu/utils/sls_utils/schemas/*.json", "canu/utils/sls_utils/schemas"), ] a = Analysis( ["canu/cli.py"], From a5b72639028d7e27eb6e965b10f12b93cf347c8f Mon Sep 17 00:00:00 2001 From: lukebates123 <66981180+lukebates123@users.noreply.github.com> Date: Thu, 15 Jun 2023 10:17:08 -0500 Subject: [PATCH 9/9] update 1.3 & 1.4 bgp (#410) * Bump click-option-group from 0.5.5 to 0.5.6 Bumps [click-option-group](https://github.com/click-contrib/click-option-group) from 0.5.5 to 0.5.6. - [Release notes](https://github.com/click-contrib/click-option-group/releases) - [Changelog](https://github.com/click-contrib/click-option-group/blob/master/CHANGELOG.md) - [Commits](https://github.com/click-contrib/click-option-group/compare/v0.5.5...v0.5.6) --- updated-dependencies: - dependency-name: click-option-group dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump emoji from 2.4.0 to 2.5.0 Bumps [emoji](https://github.com/carpedm20/emoji) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/carpedm20/emoji/releases) - [Changelog](https://github.com/carpedm20/emoji/blob/master/CHANGES.md) - [Commits](https://github.com/carpedm20/emoji/compare/v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: emoji dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump tokenize-rt from 5.0.0 to 5.1.0 Bumps [tokenize-rt](https://github.com/asottile/tokenize-rt) from 5.0.0 to 5.1.0. - [Commits](https://github.com/asottile/tokenize-rt/compare/v5.0.0...v5.1.0) --- updated-dependencies: - dependency-name: tokenize-rt dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump ipython from 8.13.2 to 8.14.0 Bumps [ipython](https://github.com/ipython/ipython) from 8.13.2 to 8.14.0. - [Release notes](https://github.com/ipython/ipython/releases) - [Commits](https://github.com/ipython/ipython/compare/8.13.2...8.14.0) --- updated-dependencies: - dependency-name: ipython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update flake8-eradicate requirement from ~=1.4.0 to ~=1.5.0 Updates the requirements on [flake8-eradicate](https://github.com/wemake-services/flake8-eradicate) to permit the latest version. - [Release notes](https://github.com/wemake-services/flake8-eradicate/releases) - [Changelog](https://github.com/wemake-services/flake8-eradicate/blob/master/CHANGELOG.md) - [Commits](https://github.com/wemake-services/flake8-eradicate/commits) --- updated-dependencies: - dependency-name: flake8-eradicate dependency-type: direct:production ... Signed-off-by: dependabot[bot] * update bgp templates --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: lukebates123 --- .../configs/templates/1.3/aruba/common/bgp.primary.j2 | 2 +- .../configs/templates/1.3/aruba/common/bgp.secondary.j2 | 2 +- .../configs/templates/1.4/aruba/common/bgp.primary.j2 | 2 +- .../configs/templates/1.4/aruba/common/bgp.secondary.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 b/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 index bc2a6f81e..960240722 100644 --- a/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 +++ b/network_modeling/configs/templates/1.3/aruba/common/bgp.primary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 32 + maximum-paths 8 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} diff --git a/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 b/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 index 0a4b6b207..e5c70f21d 100644 --- a/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 +++ b/network_modeling/configs/templates/1.3/aruba/common/bgp.secondary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 32 + maximum-paths 8 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %} diff --git a/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 b/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 index bc2a6f81e..960240722 100644 --- a/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 +++ b/network_modeling/configs/templates/1.4/aruba/common/bgp.primary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 32 + maximum-paths 8 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-002" in name %} diff --git a/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 b/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 index 0a4b6b207..e5c70f21d 100644 --- a/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 +++ b/network_modeling/configs/templates/1.4/aruba/common/bgp.secondary.j2 @@ -22,7 +22,7 @@ router bgp {{ variables.SWITCH_ASN }} exit-address-family vrf Customer bgp router-id {{ variables.LOOPBACK_IP }} - maximum-paths 32 + maximum-paths 8 timers bgp 1 3 distance bgp 20 70 {%- for name, ip in variables.CMN_IPs.items() if "sw-spine-001" in name %}